Compare commits

...

31 Commits

Author SHA1 Message Date
Timm Bäder dd40cd4f90 testdnd2: Don't pass a toplevel to gtk_drag_set_icon_widget 2017-04-25 18:47:42 +02:00
Timm Bäder 3131cbf692 label: Remove angle property 2017-04-25 17:42:02 +02:00
Timm Bäder b39844c70f label: Move if statement where it makes sense
In the else branch of the if statement before this one, we're assigning
*smallest = *widest anyway, so this if statement is never true. Move it
to the if block before instead, where it can apply.
2017-04-25 17:29:41 +02:00
Timm Bäder 7cf85519e7 label: Remove useless if statements
We never pass nullable pointers into get_size_for_allocation.
2017-04-25 17:29:41 +02:00
Timm Bäder c401bb5adb label: Remove useless if statement
The if before this one already makes sure priv->wrap is TRUE.
2017-04-25 17:29:41 +02:00
Timm Bäder 088897c7bc gtkmain: Fix code example
gtk_init doesn't take parameters anymore
2017-04-25 17:29:41 +02:00
Timm Bäder 559ea08978 label: Don't use gtk_widget_set_simple_clip
The clip returned by gtk_css_gadget_allocate already includes the
box-shadow size and we manually care about the text-shadow size.
2017-04-25 17:29:41 +02:00
Timm Bäder 02ff0ab3ec frame: Compute clip directly 2017-04-25 13:05:27 +02:00
Timm Bäder 5a034f3489 listbox: Compute clips directly 2017-04-25 13:05:27 +02:00
Timm Bäder df14af4287 gtkwidget: Queue a resize on the parent when unparenting
gtk_widget_set_parent (via gtk_widget_reposition_after) will queue a
resize on the parent widget automatically when adding a child widget, so
unparent should do the same
2017-04-25 13:05:27 +02:00
Timm Bäder cf51e2c274 widget: Fix set_parent/unparent docs to not mention GtkContainer
They can both be used by non-container widgets these days.
2017-04-25 13:05:27 +02:00
Timm Bäder 3fe03d80a7 grid: Compute clip directly
Instead of iterating over the children again in
gtk_container_get_children_clip
2017-04-25 13:05:27 +02:00
Timm Bäder 5e602e438e container: Use gtk_container_forall less
Just iterate over the child widgets directly and produce a much nicer
stack trace when debugging.
2017-04-25 13:05:27 +02:00
Timm Bäder 18672fd616 box: Compute clips directly
Instead of using _gtk_widget_set_simple_clip *and*
gtk_container_get_children_clip
2017-04-25 13:05:27 +02:00
Timm Bäder 98b3c56a75 testsuite: Add widget ordering test case 2017-04-25 13:05:27 +02:00
Timm Bäder c0056963d1 box: Remove center child 2017-04-25 13:05:27 +02:00
Timm Bäder 6cde47300a container: Remove include_internals parameter from forall
with include_internals=TRUE, this is the same as the (still private)
gtk_widget_forall, or just using the children/sibling accessors in a
loop.
2017-04-25 13:05:26 +02:00
Timm Bäder 2a4d1f63e7 actionbar: Add explicit center widget
The center widget in GtkBox was only introduced to use it in
GtkActionBar. However, the implementation there is much more complex
than it needs to be, so move the center widget into GtkActionBar instead
and later remove it from GtkBox.
2017-04-25 13:05:26 +02:00
Timm Bäder 88cbd79bf6 box: Remove fill child property
GtkWidget:halign and GtkWidget:valign are sufficient
2017-04-25 13:05:23 +02:00
Timm Bäder d8140d75ab box: Remove expand child property
GtkWidget already has hexpand/vexpand properties.
2017-04-24 21:52:14 +02:00
Timm Bäder fbfe8c37ec expander: Use widgets for title box and arrow 2017-04-24 21:52:14 +02:00
Timm Bäder 2efcbd4b0f window: Make sure the decoration node stays at the beginning
Otherwise, the gtk_widget_set_parent call might add the widget node of
the child before the decoration node.
2017-04-24 21:52:14 +02:00
Timm Bäder 395e8d6569 levelbar: Use widgets for all blocks
This replaces all internal gadgets with widgets.

Remaining problem: "block" nodes have a min-width of 32px in Adwaita,
but when allocated in continuous mode, the levelbar doesn't care and
underallocates them.
2017-04-24 21:52:14 +02:00
Timm Bäder 36e4d502c4 progressbar: Use widgets for all subgadgets
A GtkLabel for the possible text node and two GtkGizmos for the
trough/progress gadgets.
2017-04-24 21:52:14 +02:00
Timm Bäder e1acec273e Add GtkGizmo
GtkGizmo is the easiest possible widget to implement. It does nothing
except give its creator a way to control measure/size-allocate/snapshot,
so it can be used in a variety of use cases.
2017-04-24 21:52:14 +02:00
Timm Bäder 21c6aa5a15 overlay: Ensure proper child widget order
Make sure the main widget stays below all the overlay children.
2017-04-24 21:52:13 +02:00
Timm Bäder bc7b93ca31 treeview: insert the column button css node in the right place
Insert the css node before setting a parent widget on the column button,
so the gtk_widget_set_parent won't attempt to add the css node as child
of the parent widget css node.
2017-04-24 21:52:13 +02:00
Timm Bäder 6c808fe6a0 widget: Add gtk_widget_insert_before/after
To insert a widget into the widget tree before or after a child widget
of the soon-to-be parent.
2017-04-24 21:52:10 +02:00
Timm Bäder 72ab59a1af gdk: Add 3.92 version macros 2017-04-24 19:14:30 +02:00
Timm Bäder 88bc0aad06 listbox: Properly remove placeholders 2017-04-24 19:14:27 +02:00
Timm Bäder abe1280594 widget-factory: Add dummy listbox placeholder
It doesn't do anything and isn't visible anyway, but it tests that
adding and removing placeholders works
2017-04-24 18:41:52 +02:00
268 changed files with 3199 additions and 5196 deletions
+3 -3
View File
@@ -96,12 +96,12 @@ create_page1 (GtkWidget *assistant)
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
label = gtk_label_new ("You must fill out this entry to continue:");
gtk_box_pack_start (GTK_BOX (box), label, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (box), label);
entry = gtk_entry_new ();
gtk_entry_set_activates_default (GTK_ENTRY (entry), TRUE);
gtk_widget_set_valign (entry, GTK_ALIGN_CENTER);
gtk_box_pack_start (GTK_BOX (box), entry, TRUE, TRUE);
gtk_box_pack_start (GTK_BOX (box), entry);
g_signal_connect (G_OBJECT (entry), "changed",
G_CALLBACK (on_entry_changed), assistant);
@@ -119,7 +119,7 @@ create_page2 (GtkWidget *assistant)
checkbutton = gtk_check_button_new_with_label ("This is optional data, you may continue "
"even if you do not check this");
gtk_box_pack_start (GTK_BOX (box), checkbutton, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (box), checkbutton);
gtk_assistant_append_page (GTK_ASSISTANT (assistant), box);
gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), box, TRUE);
+14 -26
View File
@@ -70,64 +70,52 @@ do_button_box (GtkWidget *do_widget)
frame_horz = gtk_frame_new ("Horizontal Button Boxes");
gtk_widget_set_margin_top (frame_horz, 10);
gtk_widget_set_margin_bottom (frame_horz, 10);
gtk_box_pack_start (GTK_BOX (main_vbox), frame_horz, TRUE, TRUE);
gtk_box_pack_start (GTK_BOX (main_vbox), frame_horz);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10);
g_object_set (vbox, "margin", 10, NULL);
gtk_container_add (GTK_CONTAINER (frame_horz), vbox);
gtk_box_pack_start (GTK_BOX (vbox),
create_bbox (TRUE, "Spread", 40, GTK_BUTTONBOX_SPREAD),
TRUE, TRUE);
create_bbox (TRUE, "Spread", 40, GTK_BUTTONBOX_SPREAD));
gtk_box_pack_start (GTK_BOX (vbox),
create_bbox (TRUE, "Edge", 40, GTK_BUTTONBOX_EDGE),
TRUE, TRUE);
create_bbox (TRUE, "Edge", 40, GTK_BUTTONBOX_EDGE));
gtk_box_pack_start (GTK_BOX (vbox),
create_bbox (TRUE, "Start", 40, GTK_BUTTONBOX_START),
TRUE, TRUE);
create_bbox (TRUE, "Start", 40, GTK_BUTTONBOX_START));
gtk_box_pack_start (GTK_BOX (vbox),
create_bbox (TRUE, "End", 40, GTK_BUTTONBOX_END),
TRUE, TRUE);
create_bbox (TRUE, "End", 40, GTK_BUTTONBOX_END));
gtk_box_pack_start (GTK_BOX (vbox),
create_bbox (TRUE, "Center", 40, GTK_BUTTONBOX_CENTER),
TRUE, TRUE);
create_bbox (TRUE, "Center", 40, GTK_BUTTONBOX_CENTER));
gtk_box_pack_start (GTK_BOX (vbox),
create_bbox (TRUE, "Expand", 0, GTK_BUTTONBOX_EXPAND),
TRUE, TRUE);
create_bbox (TRUE, "Expand", 0, GTK_BUTTONBOX_EXPAND));
frame_vert = gtk_frame_new ("Vertical Button Boxes");
gtk_box_pack_start (GTK_BOX (main_vbox), frame_vert, TRUE, TRUE);
gtk_box_pack_start (GTK_BOX (main_vbox), frame_vert);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
g_object_set (hbox, "margin", 10, NULL);
gtk_container_add (GTK_CONTAINER (frame_vert), hbox);
gtk_box_pack_start (GTK_BOX (hbox),
create_bbox (FALSE, "Spread", 10, GTK_BUTTONBOX_SPREAD),
TRUE, TRUE);
create_bbox (FALSE, "Spread", 10, GTK_BUTTONBOX_SPREAD));
gtk_box_pack_start (GTK_BOX (hbox),
create_bbox (FALSE, "Edge", 10, GTK_BUTTONBOX_EDGE),
TRUE, TRUE);
create_bbox (FALSE, "Edge", 10, GTK_BUTTONBOX_EDGE));
gtk_box_pack_start (GTK_BOX (hbox),
create_bbox (FALSE, "Start", 10, GTK_BUTTONBOX_START),
TRUE, TRUE);
create_bbox (FALSE, "Start", 10, GTK_BUTTONBOX_START));
gtk_box_pack_start (GTK_BOX (hbox),
create_bbox (FALSE, "End", 10, GTK_BUTTONBOX_END),
TRUE, TRUE);
create_bbox (FALSE, "End", 10, GTK_BUTTONBOX_END));
gtk_box_pack_start (GTK_BOX (hbox),
create_bbox (FALSE, "Center", 10, GTK_BUTTONBOX_CENTER),
TRUE, TRUE);
create_bbox (FALSE, "Center", 10, GTK_BUTTONBOX_CENTER));
gtk_box_pack_start (GTK_BOX (hbox),
create_bbox (FALSE, "Expand", 0, GTK_BUTTONBOX_EXPAND),
TRUE, TRUE);
create_bbox (FALSE, "Expand", 0, GTK_BUTTONBOX_EXPAND));
}
if (!gtk_widget_get_visible (window))
+6 -6
View File
@@ -312,7 +312,7 @@ create_frame (ChangeDisplayInfo *info,
GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrollwin),
GTK_SHADOW_IN);
gtk_box_pack_start (GTK_BOX (hbox), scrollwin, TRUE, TRUE);
gtk_box_pack_start (GTK_BOX (hbox), scrollwin);
*tree_view = gtk_tree_view_new ();
gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (*tree_view), FALSE);
@@ -322,7 +322,7 @@ create_frame (ChangeDisplayInfo *info,
gtk_tree_selection_set_mode (selection, GTK_SELECTION_BROWSE);
*button_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5);
gtk_box_pack_start (GTK_BOX (hbox), *button_vbox, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (hbox), *button_vbox);
if (!info->size_group)
info->size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
@@ -362,11 +362,11 @@ create_display_frame (ChangeDisplayInfo *info)
button = left_align_button_new ("_Open...");
g_signal_connect (button, "clicked", G_CALLBACK (open_display_cb), info);
gtk_box_pack_start (GTK_BOX (button_vbox), button, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (button_vbox), button);
button = left_align_button_new ("_Close");
g_signal_connect (button, "clicked", G_CALLBACK (close_display_cb), info);
gtk_box_pack_start (GTK_BOX (button_vbox), button, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (button_vbox), button);
info->display_model = (GtkTreeModel *)gtk_list_store_new (DISPLAY_NUM_COLUMNS,
G_TYPE_STRING,
@@ -539,10 +539,10 @@ do_changedisplay (GtkWidget *do_widget)
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5);
g_object_set (vbox, "margin", 8, NULL);
gtk_box_pack_start (GTK_BOX (content_area), vbox, TRUE, TRUE);
gtk_box_pack_start (GTK_BOX (content_area), vbox);
frame = create_display_frame (info);
gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE);
gtk_box_pack_start (GTK_BOX (vbox), frame);
initialize_displays (info);
+10 -10
View File
@@ -225,45 +225,45 @@ do_clipboard (GtkWidget *do_widget)
label = gtk_label_new ("\"Copy\" will copy the text\nin the entry to the clipboard");
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (vbox), label);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
g_object_set (hbox, "margin", 8, NULL);
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (vbox), hbox);
/* Create the first entry */
entry = gtk_entry_new ();
gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE);
gtk_box_pack_start (GTK_BOX (hbox), entry);
/* Create the button */
button = gtk_button_new_with_mnemonic (_("_Copy"));
gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (hbox), button);
g_signal_connect (button, "clicked",
G_CALLBACK (copy_button_clicked), entry);
label = gtk_label_new ("\"Paste\" will paste the text from the clipboard to the entry");
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (vbox), label);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
g_object_set (hbox, "margin", 8, NULL);
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (vbox), hbox);
/* Create the second entry */
entry = gtk_entry_new ();
gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE);
gtk_box_pack_start (GTK_BOX (hbox), entry);
/* Create the button */
button = gtk_button_new_with_mnemonic (_("_Paste"));
gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (hbox), button);
g_signal_connect (button, "clicked",
G_CALLBACK (paste_button_clicked), entry);
label = gtk_label_new ("Images can be transferred via the clipboard, too");
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (vbox), label);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
g_object_set (hbox, "margin", 8, NULL);
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (vbox), hbox);
/* Create the first image */
image = gtk_image_new_from_icon_name ("dialog-warning",
+2 -2
View File
@@ -87,7 +87,7 @@ do_colorsel (GtkWidget *do_widget)
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE);
gtk_box_pack_start (GTK_BOX (vbox), frame);
da = gtk_drawing_area_new ();
gtk_drawing_area_set_content_width (GTK_DRAWING_AREA (da), 200);
@@ -100,7 +100,7 @@ do_colorsel (GtkWidget *do_widget)
gtk_widget_set_halign (button, GTK_ALIGN_END);
gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (vbox), button);
g_signal_connect (button, "clicked",
G_CALLBACK (change_color_callback), NULL);
+4 -4
View File
@@ -326,7 +326,7 @@ do_combobox (GtkWidget *do_widget)
* insensitive rows
*/
frame = gtk_frame_new ("Items with icons");
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (vbox), frame);
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
g_object_set (box, "margin", 5, NULL);
@@ -367,7 +367,7 @@ do_combobox (GtkWidget *do_widget)
/* A combobox demonstrating trees.
*/
frame = gtk_frame_new ("Where are we ?");
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (vbox), frame);
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
g_object_set (box, "margin", 5, NULL);
@@ -395,7 +395,7 @@ do_combobox (GtkWidget *do_widget)
/* A GtkComboBoxEntry with validation */
frame = gtk_frame_new ("Editable");
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (vbox), frame);
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
g_object_set (box, "margin", 5, NULL);
@@ -413,7 +413,7 @@ do_combobox (GtkWidget *do_widget)
/* A combobox with string IDs */
frame = gtk_frame_new ("String IDs");
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (vbox), frame);
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
g_object_set (box, "margin", 5, NULL);
+2 -2
View File
@@ -27,13 +27,13 @@ add_section (GtkWidget *box,
gtk_label_set_xalign (GTK_LABEL (label), 0.0);
gtk_widget_set_margin_top (label, 10);
gtk_widget_set_margin_bottom (label, 10);
gtk_box_pack_start (GTK_BOX (box), label, FALSE, TRUE);
gtk_box_pack_start (GTK_BOX (box), label);
section = gtk_flow_box_new ();
gtk_widget_set_halign (section, GTK_ALIGN_START);
gtk_flow_box_set_selection_mode (GTK_FLOW_BOX (section), GTK_SELECTION_NONE);
gtk_flow_box_set_min_children_per_line (GTK_FLOW_BOX (section), 2);
gtk_flow_box_set_max_children_per_line (GTK_FLOW_BOX (section), 20);
gtk_box_pack_start (GTK_BOX (box), section, FALSE, TRUE);
gtk_box_pack_start (GTK_BOX (box), section);
return section;
}
+1 -6
View File
@@ -159,9 +159,6 @@
</object>
</child>
</object>
<packing>
<property name="expand">0</property>
</packing>
</child>
<child>
<object class="GtkToolbar" id="toolbar1">
@@ -227,7 +224,6 @@
</child>
</object>
<packing>
<property name="expand">0</property>
<property name="position">1</property>
</packing>
</child>
@@ -235,6 +231,7 @@
<object class="GtkScrolledWindow" id="scrolledwindow1">
<property name="shadow_type">in</property>
<property name="visible">1</property>
<property name="expand">1</property>
<child>
<object class="GtkTreeView" id="treeview1">
<property name="visible">1</property>
@@ -286,7 +283,6 @@
</object>
<packing>
<property name="position">2</property>
<property name="expand">1</property>
</packing>
</child>
<child>
@@ -295,7 +291,6 @@
</object>
<packing>
<property name="position">3</property>
<property name="expand">0</property>
</packing>
</child>
</object>
+10 -11
View File
@@ -56,15 +56,15 @@ interactive_dialog_clicked (GtkButton *button,
content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8);
gtk_box_pack_start (GTK_BOX (content_area), hbox, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (content_area), hbox);
image = gtk_image_new_from_icon_name ("dialog-question", GTK_ICON_SIZE_DIALOG);
gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (hbox), image);
table = gtk_grid_new ();
gtk_grid_set_row_spacing (GTK_GRID (table), 4);
gtk_grid_set_column_spacing (GTK_GRID (table), 4);
gtk_box_pack_start (GTK_BOX (hbox), table, TRUE, TRUE);
gtk_box_pack_start (GTK_BOX (hbox), table);
label = gtk_label_new_with_mnemonic ("_Entry 1");
gtk_grid_attach (GTK_GRID (table), label, 0, 0, 1, 1);
local_entry1 = gtk_entry_new ();
@@ -122,30 +122,29 @@ do_dialog (GtkWidget *do_widget)
/* Standard message dialog */
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8);
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (vbox), hbox);
button = gtk_button_new_with_mnemonic ("_Message Dialog");
g_signal_connect (button, "clicked",
G_CALLBACK (message_dialog_clicked), NULL);
gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (hbox), button);
gtk_box_pack_start (GTK_BOX (vbox), gtk_separator_new (GTK_ORIENTATION_HORIZONTAL),
FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (vbox), gtk_separator_new (GTK_ORIENTATION_HORIZONTAL));
/* Interactive dialog*/
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8);
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (vbox), hbox);
vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
button = gtk_button_new_with_mnemonic ("_Interactive Dialog");
g_signal_connect (button, "clicked",
G_CALLBACK (interactive_dialog_clicked), NULL);
gtk_box_pack_start (GTK_BOX (hbox), vbox2, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (hbox), vbox2);
gtk_box_pack_start (GTK_BOX (vbox2), button);
table = gtk_grid_new ();
gtk_grid_set_row_spacing (GTK_GRID (table), 4);
gtk_grid_set_column_spacing (GTK_GRID (table), 4);
gtk_box_pack_start (GTK_BOX (hbox), table, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (hbox), table);
label = gtk_label_new_with_mnemonic ("_Entry 1");
gtk_grid_attach (GTK_GRID (table), label, 0, 0, 1, 1);
+4 -4
View File
@@ -221,11 +221,11 @@ do_drawingarea (GtkWidget *do_widget)
label = gtk_label_new (NULL);
gtk_label_set_markup (GTK_LABEL (label),
"<u>Checkerboard pattern</u>");
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (vbox), label);
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE);
gtk_box_pack_start (GTK_BOX (vbox), frame);
da = gtk_drawing_area_new ();
gtk_drawing_area_set_content_width (GTK_DRAWING_AREA (da), 100);
@@ -240,11 +240,11 @@ do_drawingarea (GtkWidget *do_widget)
label = gtk_label_new (NULL);
gtk_label_set_markup (GTK_LABEL (label),
"<u>Scribble area</u>");
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (vbox), label);
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE);
gtk_box_pack_start (GTK_BOX (vbox), frame);
da = gtk_drawing_area_new ();
gtk_drawing_area_set_content_width (GTK_DRAWING_AREA (da), 100);
+5 -6
View File
@@ -357,8 +357,7 @@ do_editable_cells (GtkWidget *do_widget)
gtk_container_add (GTK_CONTAINER (window), vbox);
gtk_box_pack_start (GTK_BOX (vbox),
gtk_label_new ("Shopping list (you can edit the cells!)"),
FALSE, FALSE);
gtk_label_new ("Shopping list (you can edit the cells!)"));
sw = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw),
@@ -366,7 +365,7 @@ do_editable_cells (GtkWidget *do_widget)
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
gtk_box_pack_start (GTK_BOX (vbox), sw, TRUE, TRUE);
gtk_box_pack_start (GTK_BOX (vbox), sw);
/* create models */
items_model = create_items_model ();
@@ -387,17 +386,17 @@ do_editable_cells (GtkWidget *do_widget)
/* some buttons */
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
gtk_box_set_homogeneous (GTK_BOX (hbox), TRUE);
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (vbox), hbox);
button = gtk_button_new_with_label ("Add item");
g_signal_connect (button, "clicked",
G_CALLBACK (add_item), treeview);
gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE);
gtk_box_pack_start (GTK_BOX (hbox), button);
button = gtk_button_new_with_label ("Remove item");
g_signal_connect (button, "clicked",
G_CALLBACK (remove_item), treeview);
gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE);
gtk_box_pack_start (GTK_BOX (hbox), button);
gtk_window_set_default_size (GTK_WINDOW (window), 320, 200);
}
+3 -3
View File
@@ -34,19 +34,19 @@ do_entry_buffer (GtkWidget *do_widget)
label = gtk_label_new (NULL);
gtk_label_set_markup (GTK_LABEL (label),
"Entries share a buffer. Typing in one is reflected in the other.");
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (vbox), label);
/* Create a buffer */
buffer = gtk_entry_buffer_new (NULL, 0);
/* Create our first entry */
entry = gtk_entry_new_with_buffer (buffer);
gtk_box_pack_start (GTK_BOX (vbox), entry, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (vbox), entry);
/* Create the second entry */
entry = gtk_entry_new_with_buffer (buffer);
gtk_entry_set_visibility (GTK_ENTRY (entry), FALSE);
gtk_box_pack_start (GTK_BOX (vbox), entry, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (vbox), entry);
g_object_unref (buffer);
}
+2 -2
View File
@@ -60,11 +60,11 @@ do_entry_completion (GtkWidget *do_widget)
label = gtk_label_new (NULL);
gtk_label_set_markup (GTK_LABEL (label), "Completion demo, try writing <b>total</b> or <b>gnome</b> for example.");
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (vbox), label);
/* Create our entry */
entry = gtk_entry_new ();
gtk_box_pack_start (GTK_BOX (vbox), entry, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (vbox), entry);
/* Create the completion object */
completion = gtk_entry_completion_new ();
+1 -13
View File
@@ -25,19 +25,11 @@ expander_cb (GtkExpander *expander, GParamSpec *pspec, GtkWindow *dialog)
gtk_window_set_resizable (dialog, gtk_expander_get_expanded (expander));
}
static void
do_not_expand (GtkWidget *child, gpointer data)
{
gtk_container_child_set (GTK_CONTAINER (gtk_widget_get_parent (child)), child,
"expand", FALSE, "fill", FALSE, NULL);
}
GtkWidget *
do_expander (GtkWidget *do_widget)
{
GtkWidget *toplevel;
GtkWidget *area;
GtkWidget *box;
GtkWidget *expander;
GtkWidget *sw;
GtkWidget *tv;
@@ -57,10 +49,6 @@ do_expander (GtkWidget *do_widget)
"but not the full story.");
area = gtk_message_dialog_get_message_area (GTK_MESSAGE_DIALOG (window));
box = gtk_widget_get_parent (area);
gtk_container_child_set (GTK_CONTAINER (gtk_widget_get_parent (box)), box,
"expand", TRUE, "fill", TRUE, NULL);
gtk_container_foreach (GTK_CONTAINER (area), do_not_expand, NULL);
expander = gtk_expander_new ("Details:");
sw = gtk_scrolled_window_new (NULL, NULL);
@@ -85,7 +73,7 @@ do_expander (GtkWidget *do_widget)
"resize the window. Do it already !", -1);
gtk_container_add (GTK_CONTAINER (sw), tv);
gtk_container_add (GTK_CONTAINER (expander), sw);
gtk_box_pack_end (GTK_BOX (area), expander, TRUE, TRUE);
gtk_box_pack_end (GTK_BOX (area), expander);
g_signal_connect (expander, "notify::expanded",
G_CALLBACK (expander_cb), window);
-4
View File
@@ -200,7 +200,6 @@ gtk_fishbowl_remove (GtkContainer *container,
static void
gtk_fishbowl_forall (GtkContainer *container,
gboolean include_internals,
GtkCallback callback,
gpointer callback_data)
{
@@ -209,9 +208,6 @@ gtk_fishbowl_forall (GtkContainer *container,
GtkFishbowlChild *child;
GList *children;
if (!include_internals)
return;
children = priv->children;
while (children)
{
+3 -2
View File
@@ -266,7 +266,7 @@ do_iconview (GtkWidget *do_widget)
gtk_container_add (GTK_CONTAINER (window), vbox);
tool_bar = gtk_toolbar_new ();
gtk_box_pack_start (GTK_BOX (vbox), tool_bar, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (vbox), tool_bar);
up_button = gtk_tool_button_new (NULL, NULL);
gtk_tool_button_set_label (GTK_TOOL_BUTTON (up_button), _("_Up"));
@@ -290,8 +290,9 @@ do_iconview (GtkWidget *do_widget)
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
gtk_widget_set_vexpand (sw, TRUE);
gtk_box_pack_start (GTK_BOX (vbox), sw, TRUE, TRUE);
gtk_box_pack_start (GTK_BOX (vbox), sw);
/* Create the store and fill it with the contents of '/' */
parent = g_strdup ("/");
+9 -9
View File
@@ -354,13 +354,13 @@ do_images (GtkWidget *do_widget)
label = gtk_label_new (NULL);
gtk_label_set_markup (GTK_LABEL (label),
"<u>Image loaded from a file</u>");
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (vbox), label);
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
gtk_widget_set_halign (frame, GTK_ALIGN_CENTER);
gtk_widget_set_valign (frame, GTK_ALIGN_CENTER);
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (vbox), frame);
image = gtk_image_new_from_icon_name ("gtk3-demo", GTK_ICON_SIZE_DIALOG);
@@ -372,13 +372,13 @@ do_images (GtkWidget *do_widget)
label = gtk_label_new (NULL);
gtk_label_set_markup (GTK_LABEL (label),
"<u>Animation loaded from a file</u>");
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (vbox), label);
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
gtk_widget_set_halign (frame, GTK_ALIGN_CENTER);
gtk_widget_set_valign (frame, GTK_ALIGN_CENTER);
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (vbox), frame);
image = gtk_image_new_from_resource ("/images/floppybuddy.gif");
@@ -389,13 +389,13 @@ do_images (GtkWidget *do_widget)
label = gtk_label_new (NULL);
gtk_label_set_markup (GTK_LABEL (label),
"<u>Symbolic themed icon</u>");
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (vbox), label);
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
gtk_widget_set_halign (frame, GTK_ALIGN_CENTER);
gtk_widget_set_valign (frame, GTK_ALIGN_CENTER);
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (vbox), frame);
gicon = g_themed_icon_new_with_default_fallbacks ("battery-caution-charging-symbolic");
image = gtk_image_new_from_gicon (gicon, GTK_ICON_SIZE_DIALOG);
@@ -408,13 +408,13 @@ do_images (GtkWidget *do_widget)
label = gtk_label_new (NULL);
gtk_label_set_markup (GTK_LABEL (label),
"<u>Progressive image loading</u>");
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (vbox), label);
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
gtk_widget_set_halign (frame, GTK_ALIGN_CENTER);
gtk_widget_set_valign (frame, GTK_ALIGN_CENTER);
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (vbox), frame);
/* Create an empty image for now; the progressive loader
* will create the pixbuf and fill it in.
@@ -426,7 +426,7 @@ do_images (GtkWidget *do_widget)
/* Sensitivity control */
button = gtk_toggle_button_new_with_mnemonic ("_Insensitive");
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (vbox), button);
g_signal_connect (button, "toggled",
G_CALLBACK (toggle_sensitivity_callback),
+13 -13
View File
@@ -65,24 +65,24 @@ do_infobar (GtkWidget *do_widget)
gtk_container_add (GTK_CONTAINER (window), vbox);
bar = gtk_info_bar_new ();
gtk_box_pack_start (GTK_BOX (vbox), bar, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (vbox), bar);
gtk_info_bar_set_message_type (GTK_INFO_BAR (bar), GTK_MESSAGE_INFO);
label = gtk_label_new ("This is an info bar with message type GTK_MESSAGE_INFO");
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
gtk_label_set_xalign (GTK_LABEL (label), 0);
gtk_box_pack_start (GTK_BOX (gtk_info_bar_get_content_area (GTK_INFO_BAR (bar))), label, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (gtk_info_bar_get_content_area (GTK_INFO_BAR (bar))), label);
button = gtk_toggle_button_new_with_label ("Message");
g_object_bind_property (bar, "revealed", button, "active", G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
gtk_container_add (GTK_CONTAINER (actions), button);
bar = gtk_info_bar_new ();
gtk_box_pack_start (GTK_BOX (vbox), bar, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (vbox), bar);
gtk_info_bar_set_message_type (GTK_INFO_BAR (bar), GTK_MESSAGE_WARNING);
label = gtk_label_new ("This is an info bar with message type GTK_MESSAGE_WARNING");
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
gtk_label_set_xalign (GTK_LABEL (label), 0);
gtk_box_pack_start (GTK_BOX (gtk_info_bar_get_content_area (GTK_INFO_BAR (bar))), label, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (gtk_info_bar_get_content_area (GTK_INFO_BAR (bar))), label);
button = gtk_toggle_button_new_with_label ("Warning");
g_object_bind_property (bar, "revealed", button, "active", G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
@@ -91,24 +91,24 @@ do_infobar (GtkWidget *do_widget)
bar = gtk_info_bar_new_with_buttons (_("_OK"), GTK_RESPONSE_OK, NULL);
gtk_info_bar_set_show_close_button (GTK_INFO_BAR (bar), TRUE);
g_signal_connect (bar, "response", G_CALLBACK (on_bar_response), window);
gtk_box_pack_start (GTK_BOX (vbox), bar, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (vbox), bar);
gtk_info_bar_set_message_type (GTK_INFO_BAR (bar), GTK_MESSAGE_QUESTION);
label = gtk_label_new ("This is an info bar with message type GTK_MESSAGE_QUESTION");
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
gtk_label_set_xalign (GTK_LABEL (label), 0);
gtk_box_pack_start (GTK_BOX (gtk_info_bar_get_content_area (GTK_INFO_BAR (bar))), label, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (gtk_info_bar_get_content_area (GTK_INFO_BAR (bar))), label);
button = gtk_toggle_button_new_with_label ("Question");
g_object_bind_property (bar, "revealed", button, "active", G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
gtk_container_add (GTK_CONTAINER (actions), button);
bar = gtk_info_bar_new ();
gtk_box_pack_start (GTK_BOX (vbox), bar, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (vbox), bar);
gtk_info_bar_set_message_type (GTK_INFO_BAR (bar), GTK_MESSAGE_ERROR);
label = gtk_label_new ("This is an info bar with message type GTK_MESSAGE_ERROR");
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
gtk_label_set_xalign (GTK_LABEL (label), 0);
gtk_box_pack_start (GTK_BOX (gtk_info_bar_get_content_area (GTK_INFO_BAR (bar))), label, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (gtk_info_bar_get_content_area (GTK_INFO_BAR (bar))), label);
button = gtk_toggle_button_new_with_label ("Error");
g_object_bind_property (bar, "revealed", button, "active", G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
@@ -116,12 +116,12 @@ do_infobar (GtkWidget *do_widget)
gtk_container_add (GTK_CONTAINER (actions), button);
bar = gtk_info_bar_new ();
gtk_box_pack_start (GTK_BOX (vbox), bar, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (vbox), bar);
gtk_info_bar_set_message_type (GTK_INFO_BAR (bar), GTK_MESSAGE_OTHER);
label = gtk_label_new ("This is an info bar with message type GTK_MESSAGE_OTHER");
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
gtk_label_set_xalign (GTK_LABEL (label), 0);
gtk_box_pack_start (GTK_BOX (gtk_info_bar_get_content_area (GTK_INFO_BAR (bar))), label, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (gtk_info_bar_get_content_area (GTK_INFO_BAR (bar))), label);
button = gtk_toggle_button_new_with_label ("Other");
g_object_bind_property (bar, "revealed", button, "active", G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
@@ -130,7 +130,7 @@ do_infobar (GtkWidget *do_widget)
frame = gtk_frame_new ("Info bars");
gtk_widget_set_margin_top (frame, 8);
gtk_widget_set_margin_bottom (frame, 8);
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (vbox), frame);
vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
g_object_set (vbox2, "margin", 8, NULL);
@@ -138,9 +138,9 @@ do_infobar (GtkWidget *do_widget)
/* Standard message dialog */
label = gtk_label_new ("An example of different info bars");
gtk_box_pack_start (GTK_BOX (vbox2), label, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (vbox2), label);
gtk_box_pack_start (GTK_BOX (vbox2), actions, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (vbox2), actions);
}
if (!gtk_widget_get_visible (window))
+2 -2
View File
@@ -268,7 +268,7 @@ do_list_store (GtkWidget *do_widget)
gtk_container_add (GTK_CONTAINER (window), vbox);
label = gtk_label_new ("This is the bug list (note: not based on real data, it would be nice to have a nice ODBC interface to bugzilla or so, though).");
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (vbox), label);
sw = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw),
@@ -276,7 +276,7 @@ do_list_store (GtkWidget *do_widget)
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
GTK_POLICY_NEVER,
GTK_POLICY_AUTOMATIC);
gtk_box_pack_start (GTK_BOX (vbox), sw, TRUE, TRUE);
gtk_box_pack_start (GTK_BOX (vbox), sw);
/* create tree model */
model = create_model ();
+3 -2
View File
@@ -359,10 +359,11 @@ do_listbox (GtkWidget *do_widget)
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
gtk_container_add (GTK_CONTAINER (window), vbox);
label = gtk_label_new ("Messages from Gtk+ and friends");
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (vbox), label);
scrolled = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
gtk_box_pack_start (GTK_BOX (vbox), scrolled, TRUE, TRUE);
gtk_widget_set_vexpand (scrolled, TRUE);
gtk_box_pack_start (GTK_BOX (vbox), scrolled);
listbox = gtk_list_box_new ();
gtk_container_add (GTK_CONTAINER (scrolled), listbox);
-1
View File
@@ -90,7 +90,6 @@
</style>
</object>
<packing>
<property name="fill">0</property>
<property name="pack_type">end</property>
<property name="position">2</property>
</packing>
+1 -1
View File
@@ -97,6 +97,7 @@
<property name="scrollable">1</property>
<property name="enable_popup">1</property>
<property name="show_border">0</property>
<property name="expand">1</property>
<child>
<object class="GtkScrolledWindow">
<property name="visible">1</property>
@@ -166,7 +167,6 @@
</child>
</object>
<packing>
<property name="expand">1</property>
<property name="position">1</property>
</packing>
</child>
+4 -4
View File
@@ -115,7 +115,7 @@ do_menus (GtkWidget *do_widget)
menubar = gtk_menu_bar_new ();
gtk_widget_set_hexpand (menubar, TRUE);
gtk_box_pack_start (GTK_BOX (box1), menubar, FALSE, TRUE);
gtk_box_pack_start (GTK_BOX (box1), menubar);
gtk_widget_show (menubar);
menu = create_menu (2);
@@ -136,19 +136,19 @@ do_menus (GtkWidget *do_widget)
gtk_widget_show (menuitem);
box2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10);
gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, TRUE);
gtk_box_pack_start (GTK_BOX (box1), box2);
gtk_widget_show (box2);
button = gtk_button_new_with_label ("Flip");
g_signal_connect (button, "clicked",
G_CALLBACK (change_orientation), menubar);
gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE);
gtk_box_pack_start (GTK_BOX (box2), button);
gtk_widget_show (button);
button = gtk_button_new_with_label ("Close");
g_signal_connect_swapped (button, "clicked",
G_CALLBACK(gtk_widget_destroy), window);
gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE);
gtk_box_pack_start (GTK_BOX (box2), button);
gtk_widget_set_can_default (button, TRUE);
gtk_widget_grab_default (button);
gtk_widget_show (button);
+2 -2
View File
@@ -65,12 +65,12 @@ do_overlay (GtkWidget *do_widget)
gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
gtk_widget_set_margin_top (label, 8);
gtk_widget_set_margin_bottom (label, 8);
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (vbox), label);
gtk_entry_set_placeholder_text (GTK_ENTRY (entry), "Your Lucky Number");
gtk_widget_set_margin_top (entry, 8);
gtk_widget_set_margin_bottom (entry, 8);
gtk_box_pack_start (GTK_BOX (vbox), entry, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (vbox), entry);
gtk_container_add (GTK_CONTAINER (window), overlay);
+3 -5
View File
@@ -148,7 +148,7 @@ do_panes (GtkWidget *do_widget)
vpaned = gtk_paned_new (GTK_ORIENTATION_VERTICAL);
g_object_set (vpaned, "margin", 5, NULL);
gtk_box_pack_start (GTK_BOX (vbox), vpaned, TRUE, TRUE);
gtk_box_pack_start (GTK_BOX (vbox), vpaned);
hpaned = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL);
gtk_paned_add1 (GTK_PANED (vpaned), hpaned);
@@ -177,15 +177,13 @@ do_panes (GtkWidget *do_widget)
create_pane_options (GTK_PANED (hpaned),
"Horizontal",
"Left",
"Right"),
FALSE, FALSE);
"Right"));
gtk_box_pack_start (GTK_BOX (vbox),
create_pane_options (GTK_PANED (vpaned),
"Vertical",
"Top",
"Bottom"),
FALSE, FALSE);
"Bottom"));
}
if (!gtk_widget_get_visible (window))
-2
View File
@@ -204,8 +204,6 @@ do_rotated_text (GtkWidget *do_widget)
label = gtk_label_new (text);
gtk_container_add (GTK_CONTAINER (box), label);
gtk_label_set_angle (GTK_LABEL (label), 45);
/* Set up fancy stuff on the label */
layout = gtk_label_get_layout (GTK_LABEL (label));
pango_cairo_context_set_shape_renderer (pango_layout_get_context (layout),
+4 -4
View File
@@ -241,20 +241,20 @@ do_search_entry (GtkWidget *do_widget)
label = gtk_label_new (NULL);
gtk_label_set_markup (GTK_LABEL (label), "Search entry demo");
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (vbox), label);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE);
gtk_box_pack_start (GTK_BOX (vbox), hbox);
/* Create our entry */
entry = gtk_search_entry_new ();
gtk_box_pack_start (GTK_BOX (hbox), entry, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (hbox), entry);
/* Create the find and cancel buttons */
notebook = gtk_notebook_new ();
gtk_notebook_set_show_tabs (GTK_NOTEBOOK (notebook), FALSE);
gtk_notebook_set_show_border (GTK_NOTEBOOK (notebook), FALSE);
gtk_box_pack_start (GTK_BOX (hbox), notebook, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (hbox), notebook);
find_button = gtk_button_new_with_label ("Find");
g_signal_connect (find_button, "clicked",
+10 -10
View File
@@ -91,12 +91,12 @@ do_search_entry2 (GtkWidget *do_widget)
entry = gtk_search_entry_new ();
container = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
gtk_widget_set_halign (container, GTK_ALIGN_CENTER);
gtk_box_pack_start (GTK_BOX (container), entry, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (container), entry);
searchbar = gtk_search_bar_new ();
gtk_search_bar_connect_entry (GTK_SEARCH_BAR (searchbar), GTK_ENTRY (entry));
gtk_search_bar_set_show_close_button (GTK_SEARCH_BAR (searchbar), FALSE);
gtk_container_add (GTK_CONTAINER (searchbar), container);
gtk_box_pack_start (GTK_BOX (vbox), searchbar, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (vbox), searchbar);
/* Hook the search bar to key presses */
g_signal_connect (window, "key-press-event",
@@ -104,26 +104,26 @@ do_search_entry2 (GtkWidget *do_widget)
/* Help */
label = gtk_label_new ("Start Typing to search");
gtk_box_pack_start (GTK_BOX (vbox), label, TRUE, TRUE);
gtk_box_pack_start (GTK_BOX (vbox), label);
/* Toggle button */
button = gtk_toggle_button_new_with_label ("Search");
g_object_bind_property (button, "active",
searchbar, "search-mode-enabled",
G_BINDING_BIDIRECTIONAL);
gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, TRUE);
gtk_box_pack_start (GTK_BOX (vbox), button);
/* Result */
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE);
gtk_box_pack_start (GTK_BOX (vbox), hbox);
label = gtk_label_new ("Result:");
gtk_label_set_xalign (GTK_LABEL (label), 0.0);
gtk_widget_set_margin_start (label, 6);
gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE);
gtk_box_pack_start (GTK_BOX (hbox), label);
label = gtk_label_new ("");
gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE);
gtk_box_pack_start (GTK_BOX (hbox), label);
g_signal_connect (entry, "search-changed",
G_CALLBACK (search_changed_cb), label);
@@ -131,15 +131,15 @@ do_search_entry2 (GtkWidget *do_widget)
G_CALLBACK (changed_cb), label);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE);
gtk_box_pack_start (GTK_BOX (vbox), hbox);
label = gtk_label_new ("Signal:");
gtk_label_set_xalign (GTK_LABEL (label), 0.0);
gtk_widget_set_margin_start (label, 6);
gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE);
gtk_box_pack_start (GTK_BOX (hbox), label);
label = gtk_label_new ("");
gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE);
gtk_box_pack_start (GTK_BOX (hbox), label);
g_signal_connect (entry, "search-changed",
G_CALLBACK (search_changed), label);
+3 -3
View File
@@ -49,7 +49,7 @@ do_sidebar (GtkWidget *do_widget)
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
sidebar = gtk_stack_sidebar_new ();
gtk_box_pack_start (GTK_BOX (box), sidebar, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (box), sidebar);
stack = gtk_stack_new ();
gtk_stack_set_transition_type (GTK_STACK (stack), GTK_STACK_TRANSITION_TYPE_SLIDE_UP_DOWN);
@@ -57,9 +57,9 @@ do_sidebar (GtkWidget *do_widget)
/* Separator between sidebar and stack */
widget = gtk_separator_new (GTK_ORIENTATION_VERTICAL);
gtk_box_pack_start (GTK_BOX(box), widget, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX(box), widget);
gtk_box_pack_start (GTK_BOX (box), stack, TRUE, TRUE);
gtk_box_pack_start (GTK_BOX (box), stack);
for (i=0; (c = *(pages+i)) != NULL; i++ )
{
+3 -3
View File
@@ -116,7 +116,7 @@ do_sizegroup (GtkWidget *do_widget)
/* Create one frame holding color options */
frame = gtk_frame_new ("Color Options");
gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE);
gtk_box_pack_start (GTK_BOX (vbox), frame);
table = gtk_grid_new ();
g_object_set (table, "margin", 5, NULL);
@@ -129,7 +129,7 @@ do_sizegroup (GtkWidget *do_widget)
/* And another frame holding line style options */
frame = gtk_frame_new ("Line Options");
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (vbox), frame);
table = gtk_grid_new ();
g_object_set (table, "margin", 5, NULL);
@@ -142,7 +142,7 @@ do_sizegroup (GtkWidget *do_widget)
/* And a check button to turn grouping on and off */
check_button = gtk_check_button_new_with_mnemonic ("_Enable grouping");
gtk_box_pack_start (GTK_BOX (vbox), check_button, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (vbox), check_button);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check_button), TRUE);
g_signal_connect (check_button, "toggled",
+1 -1
View File
@@ -53,7 +53,7 @@ do_spinner (GtkWidget *do_widget)
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5);
g_object_set (vbox, "margin", 5, NULL);
gtk_box_pack_start (GTK_BOX (content_area), vbox, TRUE, TRUE);
gtk_box_pack_start (GTK_BOX (content_area), vbox);
/* Sensitive */
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 5);
+1 -1
View File
@@ -157,7 +157,7 @@ create_text_view (GtkWidget *hbox,
guint timeout;
swindow = gtk_scrolled_window_new (NULL, NULL);
gtk_box_pack_start (GTK_BOX (hbox), swindow, TRUE, TRUE);
gtk_box_pack_start (GTK_BOX (hbox), swindow);
textview = gtk_text_view_new ();
gtk_container_add (GTK_CONTAINER (swindow), textview);
+10 -13
View File
@@ -124,13 +124,11 @@ palette_drop_item (GtkToolItem *drag_item,
if (GTK_TOOL_ITEM_GROUP (drag_group) != drop_group)
{
gboolean homogeneous, expand, fill, new_row;
gboolean homogeneous, new_row;
g_object_ref (drag_item);
gtk_container_child_get (GTK_CONTAINER (drag_group), GTK_WIDGET (drag_item),
"homogeneous", &homogeneous,
"expand", &expand,
"fill", &fill,
"new-row", &new_row,
NULL);
gtk_container_remove (GTK_CONTAINER (drag_group), GTK_WIDGET (drag_item));
@@ -138,8 +136,6 @@ palette_drop_item (GtkToolItem *drag_item,
drag_item, drop_position);
gtk_container_child_set (GTK_CONTAINER (drop_group), GTK_WIDGET (drag_item),
"homogeneous", homogeneous,
"expand", expand,
"fill", fill,
"new-row", new_row,
NULL);
g_object_unref (drag_item);
@@ -473,7 +469,7 @@ do_toolpalette (GtkWidget *do_widget)
"text", 0,
NULL);
gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combo_orientation), &iter);
gtk_box_pack_start (GTK_BOX (box), combo_orientation, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (box), combo_orientation);
/* Style combo box: */
style_model = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_INT);
@@ -512,11 +508,11 @@ do_toolpalette (GtkWidget *do_widget)
"text", 0,
NULL);
gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combo_style), &iter);
gtk_box_pack_start (GTK_BOX (box), combo_style, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (box), combo_style);
/* Add hbox */
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 5);
gtk_box_pack_start (GTK_BOX (box), hbox, TRUE, TRUE);
gtk_box_pack_start (GTK_BOX (box), hbox);
/* Add and fill the ToolPalette: */
palette = gtk_tool_palette_new ();
@@ -526,6 +522,7 @@ do_toolpalette (GtkWidget *do_widget)
load_special_items (GTK_TOOL_PALETTE (palette));
palette_scroller = gtk_scrolled_window_new (NULL, NULL);
gtk_widget_set_vexpand (palette_scroller, TRUE);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (palette_scroller),
GTK_POLICY_NEVER,
GTK_POLICY_AUTOMATIC);
@@ -548,7 +545,7 @@ do_toolpalette (GtkWidget *do_widget)
notebook = gtk_notebook_new ();
g_object_set (notebook, "margin", 6, NULL);
gtk_box_pack_end (GTK_BOX(hbox), notebook, FALSE, FALSE);
gtk_box_pack_end (GTK_BOX(hbox), notebook);
/* ===== DnD for tool items ===== */
@@ -750,19 +747,19 @@ load_special_items (GtkToolPalette *palette)
item = create_entry_item ("homogeneous=FALSE, expand=TRUE");
gtk_tool_item_group_insert (GTK_TOOL_ITEM_GROUP (group), item, -1);
gtk_container_child_set (GTK_CONTAINER (group), GTK_WIDGET (item),
"homogeneous", FALSE, "expand", TRUE,
"homogeneous", FALSE,
NULL);
item = create_entry_item ("homogeneous=FALSE, expand=TRUE, fill=FALSE");
gtk_tool_item_group_insert (GTK_TOOL_ITEM_GROUP (group), item, -1);
gtk_container_child_set (GTK_CONTAINER (group), GTK_WIDGET (item),
"homogeneous", FALSE, "expand", TRUE,
"fill", FALSE, NULL);
"homogeneous", FALSE,
NULL);
item = create_entry_item ("homogeneous=FALSE, expand=TRUE, new-row=TRUE");
gtk_tool_item_group_insert (GTK_TOOL_ITEM_GROUP (group), item, -1);
gtk_container_child_set (GTK_CONTAINER (group), GTK_WIDGET (item),
"homogeneous", FALSE, "expand", TRUE,
"homogeneous", FALSE,
"new-row", TRUE, NULL);
item = gtk_tool_button_new (NULL, NULL);
+2 -3
View File
@@ -402,8 +402,7 @@ do_tree_store (GtkWidget *do_widget)
gtk_container_add (GTK_CONTAINER (window), vbox);
gtk_box_pack_start (GTK_BOX (vbox),
gtk_label_new ("Jonathan's Holiday Card Planning Sheet"),
FALSE, FALSE);
gtk_label_new ("Jonathan's Holiday Card Planning Sheet"));
sw = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw),
@@ -411,7 +410,7 @@ do_tree_store (GtkWidget *do_widget)
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
gtk_box_pack_start (GTK_BOX (vbox), sw, TRUE, TRUE);
gtk_box_pack_start (GTK_BOX (vbox), sw);
/* create model */
model = create_model ();
+6 -4
View File
@@ -800,10 +800,11 @@ overshot (GtkScrolledWindow *sw, GtkPositionType pos, GtkWidget *widget)
"use-markup", TRUE,
"halign", GTK_ALIGN_START,
"valign", GTK_ALIGN_CENTER,
"hexpand", TRUE,
"margin", 6,
"xalign", 0.0,
NULL);
gtk_box_pack_start (GTK_BOX (row), label, TRUE, TRUE);
gtk_box_pack_start (GTK_BOX (row), label);
gdk_rgba_parse (&rgba, color);
swatch = g_object_new (g_type_from_name ("GtkColorSwatch"),
"rgba", &rgba,
@@ -815,7 +816,7 @@ overshot (GtkScrolledWindow *sw, GtkPositionType pos, GtkWidget *widget)
NULL);
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_container_add (GTK_CONTAINER (box), swatch);
gtk_box_pack_start (GTK_BOX (row), box, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (row), box);
gtk_list_box_insert (GTK_LIST_BOX (widget), row, -1);
row = gtk_widget_get_parent (row);
gtk_list_box_row_set_activatable (GTK_LIST_BOX_ROW (row), FALSE);
@@ -911,9 +912,10 @@ populate_colors (GtkWidget *widget, GtkWidget *chooser)
"halign", GTK_ALIGN_START,
"valign", GTK_ALIGN_CENTER,
"margin", 6,
"hexpand", TRUE,
"xalign", 0.0,
NULL);
gtk_box_pack_start (GTK_BOX (row), label, TRUE, TRUE);
gtk_box_pack_start (GTK_BOX (row), label);
gdk_rgba_parse (&rgba, colors[i].color);
swatch = g_object_new (g_type_from_name ("GtkColorSwatch"),
"rgba", &rgba,
@@ -925,7 +927,7 @@ populate_colors (GtkWidget *widget, GtkWidget *chooser)
NULL);
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_container_add (GTK_CONTAINER (box), swatch);
gtk_box_pack_start (GTK_BOX (row), box, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (row), box);
gtk_list_box_insert (GTK_LIST_BOX (widget), row, -1);
row = gtk_widget_get_parent (row);
gtk_list_box_row_set_activatable (GTK_LIST_BOX_ROW (row), FALSE);
+32 -99
View File
@@ -450,9 +450,6 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<item>Jet McQuack</item>
</items>
</object>
<packing>
<property name="fill">0</property>
</packing>
</child>
<child>
<object class="GtkComboBoxText" id="comboboxtext2">
@@ -466,7 +463,6 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
</child>
</object>
<packing>
<property name="fill">0</property>
<property name="position">1</property>
</packing>
</child>
@@ -479,7 +475,6 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<signal name="icon-release" handler="on_entry_icon_release" swapped="no"/>
</object>
<packing>
<property name="fill">0</property>
<property name="position">2</property>
</packing>
</child>
@@ -491,12 +486,12 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<property name="text" translatable="yes">entry</property>
</object>
<packing>
<property name="fill">0</property>
<property name="position">3</property>
</packing>
</child>
<child>
<object class="GtkBox" id="box223">
<property name="hexpand">0</property>
<style>
<class name="linked"/>
</style>
@@ -505,10 +500,8 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<property name="can_focus">1</property>
<property name="invisible_char">•</property>
<property name="text" translatable="yes">entry</property>
<property name="hexpand">1</property>
</object>
<packing>
<property name="expand">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="button224">
@@ -516,7 +509,6 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<property name="icon-name">window-close-symbolic</property>
</object>
<packing>
<property name="fill">0</property>
<property name="position">1</property>
</packing>
</child>
@@ -527,6 +519,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
</child>
<child>
<object class="GtkBox">
<property name="hexpand">0</property>
<style>
<class name="linked"/>
</style>
@@ -534,6 +527,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<object class="GtkComboBox">
<property name="model">lrmodel</property>
<property name="active">0</property>
<property name="hexpand">1</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
@@ -541,14 +535,12 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
</attributes>
</child>
</object>
<packing>
<property name="expand">1</property>
</packing>
</child>
<child>
<object class="GtkComboBox">
<property name="model">lrmodel</property>
<property name="active">1</property>
<property name="hexpand">1</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
@@ -556,14 +548,12 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
</attributes>
</child>
</object>
<packing>
<property name="expand">1</property>
</packing>
</child>
<child>
<object class="GtkComboBox">
<property name="model">lrmodel</property>
<property name="active">2</property>
<property name="hexpand">1</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
@@ -571,9 +561,6 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
</attributes>
</child>
</object>
<packing>
<property name="expand">1</property>
</packing>
</child>
</object>
</child>
@@ -603,7 +590,6 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<property name="adjustment">adjustment2</property>
</object>
<packing>
<property name="fill">0</property>
<property name="position">2</property>
</packing>
</child>
@@ -616,14 +602,10 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<property name="max-width-chars">2</property>
</object>
<packing>
<property name="fill">0</property>
<property name="position">3</property>
</packing>
</child>
</object>
<packing>
<property name="fill">0</property>
</packing>
</child>
<child>
<object class="GtkGrid" id="grid1">
@@ -809,14 +791,8 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
</packing>
</child>
</object>
<packing>
<property name="fill">0</property>
</packing>
</child>
</object>
<packing>
<property name="fill">0</property>
</packing>
</child>
<child>
<object class="GtkSeparator" id="separator1">
@@ -836,9 +812,6 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<property name="can_focus">1</property>
<property name="receives_default">1</property>
</object>
<packing>
<property name="fill">0</property>
</packing>
</child>
<child>
<object class="GtkToggleButton" id="togglebutton2">
@@ -848,7 +821,6 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<property name="receives_default">1</property>
</object>
<packing>
<property name="fill">0</property>
<property name="position">1</property>
</packing>
</child>
@@ -860,7 +832,6 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<property name="active">1</property>
</object>
<packing>
<property name="fill">0</property>
<property name="position">2</property>
</packing>
</child>
@@ -873,7 +844,6 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<property name="active">1</property>
</object>
<packing>
<property name="fill">0</property>
<property name="position">3</property>
</packing>
</child>
@@ -905,7 +875,6 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
</child>
</object>
<packing>
<property name="fill">0</property>
<property name="position">6</property>
</packing>
</child>
@@ -915,7 +884,6 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<property name="receives_default">1</property>
</object>
<packing>
<property name="fill">0</property>
<property name="position">6</property>
</packing>
</child>
@@ -970,7 +938,6 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
</child>
</object>
<packing>
<property name="fill">0</property>
<property name="position">2</property>
</packing>
</child>
@@ -986,17 +953,15 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<object class="GtkBox" id="box20">
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<property name="hexpand">1</property>
<child>
<object class="GtkBox" id="box21">
<object class="GtkBox" id="box21">
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
<object class="GtkProgressBar" id="progressbar1">
<property name="fraction">0.5</property>
</object>
<packing>
<property name="fill">0</property>
</packing>
</child>
<child>
<object class="GtkProgressBar" id="progressbar2">
@@ -1004,7 +969,6 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<property name="inverted">1</property>
</object>
<packing>
<property name="fill">0</property>
<property name="position">1</property>
</packing>
</child>
@@ -1014,7 +978,6 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<property name="show_text">1</property>
</object>
<packing>
<property name="fill">0</property>
<property name="position">2</property>
</packing>
</child>
@@ -1042,9 +1005,6 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
</packing>
</child>
</object>
<packing>
<property name="fill">0</property>
</packing>
</child>
<child>
<object class="GtkBox" id="box27">
@@ -1076,13 +1036,9 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
</packing>
</child>
</object>
<packing>
<property name="expand">1</property>
</packing>
</child>
</object>
<packing>
<property name="fill">0</property>
<property name="position">1</property>
</packing>
</child>
@@ -1113,10 +1069,12 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<object class="GtkBox" id="box28">
<property name="vexpand">1</property>
<property name="spacing">6</property>
<property name="homogeneous">1</property>
<child>
<object class="GtkProgressBar" id="progressbar5">
<property name="orientation">vertical</property>
<property name="fraction">0.5</property>
<property name="halign">end</property>
</object>
</child>
<child>
@@ -1124,20 +1082,19 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<property name="orientation">vertical</property>
<property name="fraction">0.5</property>
<property name="inverted">1</property>
<property name="halign">start</property>
</object>
<packing>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="fill">0</property>
</packing>
</child>
<child>
<object class="GtkBox" id="box23">
<property name="vexpand">1</property>
<property name="spacing">6</property>
<property name="homogeneous">1</property>
<child>
<object class="GtkScale" id="scale3">
<property name="height_request">100</property>
@@ -1148,6 +1105,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<property name="fill_level">75</property>
<property name="draw_value">1</property>
<property name="digits">-1</property>
<property name="halign">end</property>
<signal name="format-value" handler="scale_format_value"/>
</object>
</child>
@@ -1162,6 +1120,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<property name="fill_level">75</property>
<property name="draw_value">1</property>
<property name="digits">-1</property>
<property name="halign">start</property>
<signal name="format-value" handler="scale_format_value_blank"/>
</object>
<packing>
@@ -1170,13 +1129,11 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
</child>
</object>
<packing>
<property name="fill">0</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">1</property>
<property name="position">3</property>
</packing>
</child>
@@ -1198,6 +1155,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<property name="orientation">vertical</property>
<property name="homogeneous">1</property>
<property name="spacing">6</property>
<property name="hexpand">1</property>
<child>
<object class="GtkFrame" id="frame1">
<property name="shadow_type">in</property>
@@ -1208,9 +1166,6 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
</object>
</child>
</object>
<packing>
<property name="expand">1</property>
</packing>
</child>
<child>
<object class="GtkFrame" id="frame2">
@@ -1223,7 +1178,6 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
</child>
</object>
<packing>
<property name="expand">1</property>
<property name="position">1</property>
</packing>
</child>
@@ -1237,7 +1191,6 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
</child>
</object>
<packing>
<property name="expand">1</property>
<property name="position">2</property>
</packing>
</child>
@@ -1252,13 +1205,11 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
</child>
</object>
<packing>
<property name="expand">1</property>
<property name="position">3</property>
</packing>
</child>
</object>
<packing>
<property name="expand">1</property>
<property name="position">6</property>
</packing>
</child>
@@ -1274,12 +1225,14 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<object class="GtkBox" id="box4">
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<property name="hexpand">1</property>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow1">
<property name="width_request">150</property>
<property name="can_focus">1</property>
<property name="vscrollbar_policy">always</property>
<property name="shadow_type">in</property>
<property name="vexpand">1</property>
<child>
<object class="GtkTreeView" id="treeview1">
<property name="can_focus">1</property>
@@ -1350,14 +1303,12 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
</object>
</child>
</object>
<packing>
<property name="expand">1</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow2">
<property name="can_focus">1</property>
<property name="shadow_type">in</property>
<property name="vexpand">1</property>
<child>
<object class="GtkTextView" id="textview1">
<property name="can_focus">1</property>
@@ -1370,13 +1321,11 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
</child>
</object>
<packing>
<property name="expand">1</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">1</property>
<property name="position">8</property>
</packing>
</child>
@@ -1618,7 +1567,6 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
</child>
</object>
<packing>
<property name="expand">1</property>
<property name="position">4</property>
</packing>
</child>
@@ -1813,6 +1761,11 @@ microphone-sensitivity-medium-symbolic</property>
<child>
<object class="GtkListBox" id="listbox">
<property name="selection-mode">none</property>
<child type="placeholder">
<object class="GtkLabel">
<property name="label">No rows found</property>
</object>
</child>
<child>
<object class="GtkListBoxRow" id="listboxrow1">
<property name="activatable">0</property>
@@ -1826,9 +1779,6 @@ microphone-sensitivity-medium-symbolic</property>
<property name="valign">center</property>
<property name="margin">6</property>
</object>
<packing>
<property name="expand">1</property>
</packing>
</child>
<child>
<object class="GtkSwitch" id="listboxrow1switch">
@@ -1856,9 +1806,6 @@ microphone-sensitivity-medium-symbolic</property>
<property name="valign">center</property>
<property name="margin">6</property>
</object>
<packing>
<property name="expand">1</property>
</packing>
</child>
<child>
<object class="GtkScale">
@@ -1888,9 +1835,6 @@ microphone-sensitivity-medium-symbolic</property>
<property name="valign">center</property>
<property name="margin">6</property>
</object>
<packing>
<property name="expand">1</property>
</packing>
</child>
<child>
<object class="GtkImage" id="listboxrow3image">
@@ -1920,9 +1864,6 @@ microphone-sensitivity-medium-symbolic</property>
<property name="valign">center</property>
<property name="margin">6</property>
</object>
<packing>
<property name="expand">1</property>
</packing>
</child>
<child>
<object class="GtkImage">
@@ -1953,9 +1894,6 @@ microphone-sensitivity-medium-symbolic</property>
<property name="valign">center</property>
<property name="margin">6</property>
</object>
<packing>
<property name="expand">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="listboxrow5button">
@@ -1984,9 +1922,6 @@ microphone-sensitivity-medium-symbolic</property>
<property name="valign">center</property>
<property name="margin">6</property>
</object>
<packing>
<property name="expand">1</property>
</packing>
</child>
<child>
<object class="GtkCheckButton">
@@ -2411,9 +2346,6 @@ microphone-sensitivity-medium-symbolic</property>
</object>
</child>
</object>
<packing>
<property name="expand">1</property>
</packing>
</child>
</object>
</child>
@@ -2627,6 +2559,7 @@ microphone-sensitivity-medium-symbolic</property>
<object class="GtkListBox" id="munsell">
<property name="selection-mode">multiple</property>
<property name="activate-on-single-click">0</property>
<property name="hexpand">0</property>
</object>
</child>
</object>
@@ -2946,6 +2879,7 @@ microphone-sensitivity-medium-symbolic</property>
<object class="GtkFrame">
<child>
<object class="GtkBox">
<property name="hexpand">0</property>
<child>
<object class="GtkToolbar">
<property name="orientation">vertical</property>
@@ -2975,14 +2909,12 @@ microphone-sensitivity-medium-symbolic</property>
</child>
<child>
<object class="GtkScrolledWindow">
<property name="hexpand">1</property>
<child>
<object class="GtkTextView" id="tooltextview">
</object>
</child>
</object>
<packing>
<property name="expand">1</property>
</packing>
</child>
<child>
<object class="GtkBox">
@@ -3020,9 +2952,6 @@ microphone-sensitivity-medium-symbolic</property>
<property name="valign">end</property>
<property name="icon-name">edit-delete-symbolic</property>
</object>
<packing>
<property name="expand">1</property>
</packing>
</child>
</object>
</child>
@@ -3109,9 +3038,11 @@ microphone-sensitivity-medium-symbolic</property>
</child>
<child type="tab">
<object class="GtkBox">
<child type="center">
<child>
<object class="GtkLabel">
<property name="label" translatable="yes">Page 1</property>
<property name="halign">center</property>
<property name="hexpand">1</property>
</object>
</child>
<child>
@@ -3140,9 +3071,11 @@ microphone-sensitivity-medium-symbolic</property>
</child>
<child type="tab">
<object class="GtkBox">
<child type="center">
<child>
<object class="GtkLabel">
<property name="label" translatable="yes">Page 2</property>
<property name="halign">center</property>
<property name="hexpand">1</property>
</object>
</child>
<child>
+2 -4
View File
@@ -329,8 +329,6 @@ gtk_box_query_child_packing
gtk_box_set_child_packing
gtk_box_get_baseline_position
gtk_box_set_baseline_position
gtk_box_get_center_widget
gtk_box_set_center_widget
<SUBSECTION Standard>
GTK_BOX
GTK_IS_BOX
@@ -1656,12 +1654,10 @@ gtk_label_get_selection_bounds
gtk_label_get_use_markup
gtk_label_get_use_underline
gtk_label_get_single_line_mode
gtk_label_get_angle
gtk_label_set_label
gtk_label_set_use_markup
gtk_label_set_use_underline
gtk_label_set_single_line_mode
gtk_label_set_angle
gtk_label_get_current_uri
gtk_label_set_track_visited_links
gtk_label_get_track_visited_links
@@ -4647,6 +4643,8 @@ gtk_widget_get_next_sibling
gtk_widget_get_prev_sibling
gtk_widget_get_first_child
gtk_widget_get_last_child
gtk_widget_insert_before
gtk_widget_insert_after
<SUBSECTION>
gtk_widget_get_path
+68 -99
View File
@@ -86,9 +86,9 @@ create_switch (void)
widget = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3);
sw = gtk_switch_new ();
gtk_switch_set_active (GTK_SWITCH (sw), TRUE);
gtk_box_pack_start (GTK_BOX (widget), sw, TRUE, TRUE);
gtk_container_add (GTK_CONTAINER (widget), sw);
sw = gtk_switch_new ();
gtk_box_pack_start (GTK_BOX (widget), sw, TRUE, TRUE);
gtk_container_add (GTK_CONTAINER (widget), sw);
gtk_widget_set_halign (widget, GTK_ALIGN_CENTER);
gtk_widget_set_valign (widget, GTK_ALIGN_CENTER);
@@ -150,11 +150,11 @@ create_menu_button (void)
gtk_menu_button_set_popup (GTK_MENU_BUTTON (widget), menu);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3);
gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE, FALSE);
gtk_container_add (GTK_CONTAINER (vbox), widget);
gtk_widget_set_halign (widget, GTK_ALIGN_CENTER);
gtk_widget_set_valign (widget, GTK_ALIGN_CENTER);
gtk_box_pack_start (GTK_BOX (vbox), gtk_label_new ("Menu Button"), TRUE, TRUE);
gtk_box_pack_start (GTK_BOX (vbox), gtk_label_new ("Menu Button"));
return new_widget_info ("menu-button", vbox, SMALL);
}
@@ -203,10 +203,9 @@ create_lockbutton (void)
widget = gtk_lock_button_new (g_object_new (G_TYPE_TEST_PERMISSION, NULL));
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3);
gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (vbox), widget);
gtk_box_pack_start (GTK_BOX (vbox),
gtk_label_new ("Lock Button"),
FALSE, FALSE);
gtk_label_new ("Lock Button"));
gtk_widget_set_halign (vbox, GTK_ALIGN_CENTER);
gtk_widget_set_valign (vbox, GTK_ALIGN_CENTER);
@@ -248,11 +247,11 @@ create_radio (void)
widget = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3);
radio = gtk_radio_button_new_with_mnemonic (NULL, "Radio Button _One");
gtk_box_pack_start (GTK_BOX (widget), radio, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (widget), radio);
radio = gtk_radio_button_new_with_mnemonic_from_widget (GTK_RADIO_BUTTON (radio), "Radio Button _Two");
gtk_box_pack_start (GTK_BOX (widget), radio, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (widget), radio);
radio = gtk_radio_button_new_with_mnemonic_from_widget (GTK_RADIO_BUTTON (radio), "Radio Button T_hree");
gtk_box_pack_start (GTK_BOX (widget), radio, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (widget), radio);
gtk_widget_set_halign (widget, GTK_ALIGN_CENTER);
gtk_widget_set_valign (widget, GTK_ALIGN_CENTER);
@@ -404,8 +403,7 @@ create_search_bar (void)
gtk_container_add (GTK_CONTAINER (box), widget);
view = gtk_text_view_new ();
gtk_widget_show (view);
gtk_box_pack_start (GTK_BOX (box), view, TRUE, TRUE);
gtk_box_pack_start (GTK_BOX (box), view);
info = new_widget_info ("search-bar", box, SMALL);
@@ -423,8 +421,7 @@ create_action_bar (void)
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
view = gtk_text_view_new ();
gtk_widget_show (view);
gtk_box_pack_start (GTK_BOX (box), view, TRUE, TRUE);
gtk_box_pack_start (GTK_BOX (box), view);
widget = gtk_action_bar_new ();
@@ -554,10 +551,9 @@ create_icon_view (void)
gtk_container_add (GTK_CONTAINER (widget), icon_view);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3);
gtk_box_pack_start (GTK_BOX (vbox), widget, TRUE, TRUE);
gtk_box_pack_start (GTK_BOX (vbox), widget);
gtk_box_pack_start (GTK_BOX (vbox),
gtk_label_new ("Icon View"),
FALSE, FALSE);
gtk_label_new ("Icon View"));
info = new_widget_info ("icon-view", vbox, MEDIUM);
info->no_focus = FALSE;
@@ -579,10 +575,9 @@ create_color_button (void)
picker = gtk_color_button_new_with_rgba (&color);
gtk_widget_set_halign (picker, GTK_ALIGN_CENTER);
gtk_widget_set_valign (picker, GTK_ALIGN_CENTER);
gtk_box_pack_start (GTK_BOX (vbox), picker, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (vbox), picker);
gtk_box_pack_start (GTK_BOX (vbox),
gtk_label_new ("Color Button"),
FALSE, FALSE);
gtk_label_new ("Color Button"));
return new_widget_info ("color-button", vbox, SMALL);
}
@@ -597,10 +592,9 @@ create_font_button (void)
picker = gtk_font_button_new_with_font ("Sans Serif 10");
gtk_widget_set_halign (picker, GTK_ALIGN_CENTER);
gtk_widget_set_valign (picker, GTK_ALIGN_CENTER);
gtk_box_pack_start (GTK_BOX (vbox), picker, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (vbox), picker);
gtk_box_pack_start (GTK_BOX (vbox),
gtk_label_new ("Font Button"),
FALSE, FALSE);
gtk_label_new ("Font Button"));
return new_widget_info ("font-button", vbox, SMALL);
}
@@ -620,16 +614,14 @@ create_file_button (void)
gtk_widget_set_size_request (picker, 150, -1);
gtk_widget_set_halign (picker, GTK_ALIGN_CENTER);
gtk_widget_set_valign (picker, GTK_ALIGN_CENTER);
gtk_box_pack_start (GTK_BOX (vbox2), picker, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (vbox2), picker);
gtk_box_pack_start (GTK_BOX (vbox2),
gtk_label_new ("File Button (Files)"),
FALSE, FALSE);
gtk_label_new ("File Button (Files)"));
gtk_box_pack_start (GTK_BOX (vbox),
vbox2, TRUE, TRUE);
vbox2);
gtk_box_pack_start (GTK_BOX (vbox),
gtk_separator_new (GTK_ORIENTATION_HORIZONTAL),
FALSE, FALSE);
gtk_separator_new (GTK_ORIENTATION_HORIZONTAL));
vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3);
picker = gtk_file_chooser_button_new ("File Chooser Button",
@@ -640,12 +632,11 @@ create_file_button (void)
g_free (path);
gtk_widget_set_halign (picker, GTK_ALIGN_CENTER);
gtk_widget_set_valign (picker, GTK_ALIGN_CENTER);
gtk_box_pack_start (GTK_BOX (vbox2), picker, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (vbox2), picker);
gtk_box_pack_start (GTK_BOX (vbox2),
gtk_label_new ("File Button (Select Folder)"),
FALSE, FALSE);
gtk_label_new ("File Button (Select Folder)"));
gtk_box_pack_start (GTK_BOX (vbox),
vbox2, TRUE, TRUE);
vbox2);
return new_widget_info ("file-button", vbox, MEDIUM);
}
@@ -660,18 +651,15 @@ create_separator (void)
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_box_set_homogeneous (GTK_BOX (hbox), TRUE);
gtk_box_pack_start (GTK_BOX (hbox),
gtk_separator_new (GTK_ORIENTATION_HORIZONTAL),
TRUE, TRUE);
gtk_separator_new (GTK_ORIENTATION_HORIZONTAL));
gtk_box_pack_start (GTK_BOX (hbox),
gtk_separator_new (GTK_ORIENTATION_VERTICAL),
TRUE, TRUE);
gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE);
gtk_separator_new (GTK_ORIENTATION_VERTICAL));
gtk_box_pack_start (GTK_BOX (vbox), hbox);
gtk_box_pack_start (GTK_BOX (vbox),
g_object_new (GTK_TYPE_LABEL,
"label", "Horizontal and Vertical\nSeparators",
"justify", GTK_JUSTIFY_CENTER,
NULL),
FALSE, FALSE);
NULL));
return new_widget_info ("separator", vbox, MEDIUM);
}
@@ -697,8 +685,7 @@ create_panes (void)
NULL),
FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (hbox),
pane,
TRUE, TRUE);
pane);
pane = gtk_paned_new (GTK_ORIENTATION_VERTICAL);
gtk_paned_pack1 (GTK_PANED (pane),
g_object_new (GTK_TYPE_FRAME,
@@ -711,15 +698,13 @@ create_panes (void)
NULL),
FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (hbox),
pane,
TRUE, TRUE);
gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE);
pane);
gtk_box_pack_start (GTK_BOX (vbox), hbox);
gtk_box_pack_start (GTK_BOX (vbox),
g_object_new (GTK_TYPE_LABEL,
"label", "Horizontal and Vertical\nPanes",
"justify", GTK_JUSTIFY_CENTER,
NULL),
FALSE, FALSE);
NULL));
return new_widget_info ("panes", vbox, MEDIUM);
}
@@ -881,10 +866,9 @@ create_menubar (void)
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3);
gtk_widget_set_halign (widget, GTK_ALIGN_FILL);
gtk_widget_set_valign (widget, GTK_ALIGN_CENTER);
gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (vbox), widget);
gtk_box_pack_start (GTK_BOX (vbox),
gtk_label_new ("Menu Bar"),
FALSE, FALSE);
gtk_label_new ("Menu Bar"));
return new_widget_info ("menubar", vbox, SMALL);
}
@@ -960,10 +944,9 @@ create_progressbar (void)
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3);
gtk_widget_set_halign (widget, GTK_ALIGN_FILL);
gtk_widget_set_valign (widget, GTK_ALIGN_CENTER);
gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (vbox), widget);
gtk_box_pack_start (GTK_BOX (vbox),
gtk_label_new ("Progress Bar"),
FALSE, FALSE);
gtk_label_new ("Progress Bar"));
return new_widget_info ("progressbar", vbox, SMALL);
}
@@ -978,10 +961,9 @@ create_level_bar (void)
gtk_level_bar_set_value (GTK_LEVEL_BAR (widget), 0.333);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3);
gtk_box_pack_start (GTK_BOX (vbox), widget, TRUE, FALSE);
gtk_box_pack_start (GTK_BOX (vbox), widget);
gtk_box_pack_start (GTK_BOX (vbox),
gtk_label_new ("Level Bar"),
FALSE, FALSE);
gtk_label_new ("Level Bar"));
return new_widget_info ("levelbar", vbox, SMALL);
}
@@ -1013,10 +995,9 @@ create_scrollbar (void)
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3);
gtk_widget_set_halign (widget, GTK_ALIGN_FILL);
gtk_widget_set_valign (widget, GTK_ALIGN_CENTER);
gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (vbox), widget);
gtk_box_pack_start (GTK_BOX (vbox),
gtk_label_new ("Scrollbar"),
FALSE, FALSE);
gtk_label_new ("Scrollbar"));
return new_widget_info ("scrollbar", vbox, SMALL);
}
@@ -1032,10 +1013,9 @@ create_spinbutton (void)
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3);
gtk_widget_set_halign (widget, GTK_ALIGN_FILL);
gtk_widget_set_valign (widget, GTK_ALIGN_CENTER);
gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (vbox), widget);
gtk_box_pack_start (GTK_BOX (vbox),
gtk_label_new ("Spin Button"),
FALSE, FALSE);
gtk_label_new ("Spin Button"));
return new_widget_info ("spinbutton", vbox, SMALL);
}
@@ -1049,13 +1029,12 @@ create_statusbar (void)
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_box_pack_start (GTK_BOX (vbox),
gtk_label_new ("Status Bar"),
FALSE, FALSE);
gtk_label_new ("Status Bar"));
widget = gtk_statusbar_new ();
gtk_widget_set_halign (widget, GTK_ALIGN_FILL);
gtk_statusbar_push (GTK_STATUSBAR (widget), 0, "Hold on...");
gtk_box_pack_end (GTK_BOX (vbox), widget, FALSE, FALSE);
gtk_box_pack_end (GTK_BOX (vbox), widget);
info = new_widget_info ("statusbar", vbox, SMALL);
@@ -1073,19 +1052,16 @@ create_scales (void)
gtk_box_set_homogeneous (GTK_BOX (hbox), TRUE);
gtk_box_pack_start (GTK_BOX (hbox),
gtk_scale_new_with_range (GTK_ORIENTATION_HORIZONTAL,
0.0, 100.0, 1.0),
TRUE, TRUE);
0.0, 100.0, 1.0));
gtk_box_pack_start (GTK_BOX (hbox),
gtk_scale_new_with_range (GTK_ORIENTATION_VERTICAL,
0.0, 100.0, 1.0),
TRUE, TRUE);
gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE);
0.0, 100.0, 1.0));
gtk_box_pack_start (GTK_BOX (vbox), hbox);
gtk_box_pack_start (GTK_BOX (vbox),
g_object_new (GTK_TYPE_LABEL,
"label", "Horizontal and Vertical\nScales",
"justify", GTK_JUSTIFY_CENTER,
NULL),
FALSE, FALSE);
NULL));
return new_widget_info ("scales", vbox, MEDIUM);}
static WidgetInfo *
@@ -1100,10 +1076,9 @@ create_image (void)
gtk_widget_set_valign (widget, GTK_ALIGN_CENTER);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3);
gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (vbox), widget);
gtk_box_pack_start (GTK_BOX (vbox),
gtk_label_new ("Image"),
FALSE, FALSE);
gtk_label_new ("Image"));
return new_widget_info ("image", vbox, SMALL);
}
@@ -1121,10 +1096,9 @@ create_spinner (void)
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3);
gtk_widget_set_halign (widget, GTK_ALIGN_CENTER);
gtk_widget_set_valign (widget, GTK_ALIGN_CENTER);
gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (vbox), widget);
gtk_box_pack_start (GTK_BOX (vbox),
gtk_label_new ("Spinner"),
FALSE, FALSE);
gtk_label_new ("Spinner"));
return new_widget_info ("spinner", vbox, SMALL);
}
@@ -1143,7 +1117,7 @@ create_volume_button (void)
gtk_container_add (GTK_CONTAINER (widget), box);
button = gtk_volume_button_new ();
gtk_box_pack_end (GTK_BOX (box), button, FALSE, FALSE);
gtk_box_pack_end (GTK_BOX (box), button);
gtk_scale_button_set_value (GTK_SCALE_BUTTON (button), 33);
popup = gtk_scale_button_get_popup (GTK_SCALE_BUTTON (button));
@@ -1192,10 +1166,9 @@ create_appchooserbutton (void)
picker = gtk_app_chooser_button_new ("text/plain");
gtk_widget_set_halign (picker, GTK_ALIGN_CENTER);
gtk_widget_set_valign (picker, GTK_ALIGN_CENTER);
gtk_box_pack_start (GTK_BOX (vbox), picker, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (vbox), picker);
gtk_box_pack_start (GTK_BOX (vbox),
gtk_label_new ("Application Button"),
FALSE, FALSE);
gtk_label_new ("Application Button"));
return new_widget_info ("appchooserbutton", vbox, SMALL);
}
@@ -1278,10 +1251,9 @@ create_placessidebar (void)
gtk_widget_set_halign (bar, GTK_ALIGN_CENTER);
gtk_widget_set_valign (bar, GTK_ALIGN_CENTER);
gtk_box_pack_start (GTK_BOX (vbox), bar, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (vbox), bar);
gtk_box_pack_start (GTK_BOX (vbox),
gtk_label_new ("Places Sidebar"),
FALSE, FALSE);
gtk_label_new ("Places Sidebar"));
return new_widget_info ("placessidebar", vbox, ASIS);
}
@@ -1311,11 +1283,10 @@ create_stack (void)
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_box_pack_start (GTK_BOX (vbox), switcher, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (vbox), stack, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (vbox), switcher);
gtk_box_pack_start (GTK_BOX (vbox), stack);
gtk_box_pack_start (GTK_BOX (vbox),
gtk_label_new ("Stack"),
FALSE, FALSE);
gtk_label_new ("Stack"));
return new_widget_info ("stack", vbox, ASIS);
}
@@ -1345,11 +1316,10 @@ create_stack_switcher (void)
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_box_pack_start (GTK_BOX (vbox), switcher, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (vbox), stack, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (vbox), switcher);
gtk_box_pack_start (GTK_BOX (vbox), stack);
gtk_box_pack_start (GTK_BOX (vbox),
gtk_label_new ("Stack Switcher"),
FALSE, FALSE);
gtk_label_new ("Stack Switcher"));
return new_widget_info ("stackswitcher", vbox, ASIS);
}
@@ -1381,9 +1351,9 @@ create_sidebar (void)
frame = gtk_frame_new (NULL);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_box_pack_start (GTK_BOX (hbox), sidebar, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (hbox), gtk_separator_new (GTK_ORIENTATION_VERTICAL), FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (hbox), stack, TRUE, TRUE);
gtk_box_pack_start (GTK_BOX (hbox), sidebar);
gtk_box_pack_start (GTK_BOX (hbox), gtk_separator_new (GTK_ORIENTATION_VERTICAL));
gtk_box_pack_start (GTK_BOX (hbox), stack);
gtk_container_add (GTK_CONTAINER (frame), hbox);
return new_widget_info ("sidebar", frame, ASIS);
@@ -1475,9 +1445,8 @@ create_flow_box (void)
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (vbox), gtk_label_new ("Flow Box"),
FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (vbox), widget);
gtk_box_pack_start (GTK_BOX (vbox), gtk_label_new ("Flow Box"));
info = new_widget_info ("flow-box", vbox, ASIS);
info->no_focus = FALSE;
+3 -5
View File
@@ -27,15 +27,13 @@ activate_cb (GtkApplication *app,
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
gtk_container_add (GTK_CONTAINER (search_bar), box);
gtk_widget_show (box);
entry = gtk_search_entry_new ();
gtk_box_pack_start (GTK_BOX (box), entry, TRUE, TRUE);
gtk_widget_show (entry);
gtk_widget_set_hexpand (entry, TRUE);
gtk_box_pack_start (GTK_BOX (box), entry);
menu_button = gtk_menu_button_new ();
gtk_box_pack_start (GTK_BOX (box), menu_button, FALSE, FALSE);
gtk_widget_show (menu_button);
gtk_box_pack_start (GTK_BOX (box), menu_button);
gtk_search_bar_connect_entry (GTK_SEARCH_BAR (search_bar), GTK_ENTRY (entry));
+18
View File
@@ -182,6 +182,17 @@
*/
#define GDK_VERSION_3_90 (G_ENCODE_VERSION (3, 90))
/**
* GDK_VERSION_3_92:
*
* A macro that evaluates to the 3.92 version of GDK, in a format
* that can be used by the C pre-processor.
*
* Since: 3.92
*/
#define GDK_VERSION_3_92 (G_ENCODE_VERSION (3, 92))
/* evaluates to the current stable version; for development cycles,
* this means the next stable target
*/
@@ -428,5 +439,12 @@
# define GDK_AVAILABLE_IN_3_90 _GDK_EXTERN
#endif
#if GDK_VERSION_MAX_ALLOWED < GDK_VERSION_3_92
# define GDK_AVAILABLE_IN_3_92 GDK_UNAVAILABLE(3, 92)
#else
# define GDK_AVAILABLE_IN_3_92 _GDK_EXTERN
#endif
#endif /* __GDK_VERSION_MACROS_H__ */
+6 -2
View File
@@ -575,7 +575,9 @@ gtk_private_h_sources = \
gtkwin32themeprivate.h \
gtkwindowprivate.h \
gtktreemenu.h \
gdkpixbufutilsprivate.h
gdkpixbufutilsprivate.h \
gtkgizmoprivate.h \
gtkcenterboxprivate.h
# GTK+ C sources to build the library from
gtk_base_c_sources = \
@@ -937,7 +939,9 @@ gtk_base_c_sources = \
gtkwindowgroup.c \
gtkwin32draw.c \
gtkwin32theme.c \
gdkpixbufutils.c
gdkpixbufutils.c \
gtkgizmo.c \
gtkcenterbox.c
if USE_QUARTZ
gtk_base_c_sources += \
+158 -33
View File
@@ -30,6 +30,7 @@
#include "gtkwidgetprivate.h"
#include "gtkcontainerprivate.h"
#include "gtkprivate.h"
#include "gtkcenterboxprivate.h"
#include <string.h>
@@ -55,8 +56,11 @@
struct _GtkActionBarPrivate
{
GtkWidget *box;
GtkWidget *center_box;
GtkWidget *start_box;
GtkWidget *end_box;
GtkWidget *revealer;
GtkCssGadget *gadget;
};
@@ -85,7 +89,8 @@ gtk_action_bar_add (GtkContainer *container,
{
GtkActionBarPrivate *priv = gtk_action_bar_get_instance_private (GTK_ACTION_BAR (container));
gtk_container_add (GTK_CONTAINER (priv->box), child);
/* Default for pack-type is start */
gtk_container_add (GTK_CONTAINER (priv->start_box), child);
}
static void
@@ -94,21 +99,32 @@ gtk_action_bar_remove (GtkContainer *container,
{
GtkActionBarPrivate *priv = gtk_action_bar_get_instance_private (GTK_ACTION_BAR (container));
gtk_container_remove (GTK_CONTAINER (priv->box), child);
if (gtk_widget_get_parent (child) == priv->start_box)
gtk_container_remove (GTK_CONTAINER (priv->start_box), child);
else if (gtk_widget_get_parent (child) == priv->end_box)
gtk_container_remove (GTK_CONTAINER (priv->end_box), child);
else if (child == gtk_center_box_get_center_widget (GTK_CENTER_BOX (priv->center_box)))
gtk_center_box_set_center_widget (GTK_CENTER_BOX (priv->center_box), NULL);
else
g_warning ("Can't remove non-child %s %p from GtkActionBar %p",
G_OBJECT_TYPE_NAME (child), child, container);
}
static void
gtk_action_bar_forall (GtkContainer *container,
gboolean include_internals,
GtkCallback callback,
gpointer callback_data)
{
GtkActionBarPrivate *priv = gtk_action_bar_get_instance_private (GTK_ACTION_BAR (container));
if (include_internals)
(* callback) (priv->revealer, callback_data);
else if (priv->box)
gtk_container_forall (GTK_CONTAINER (priv->box), callback, callback_data);
if (priv->start_box != NULL)
gtk_container_forall (GTK_CONTAINER (priv->start_box), callback, callback_data);
if (gtk_center_box_get_center_widget (GTK_CENTER_BOX (priv->center_box)) != NULL)
(*callback) (gtk_center_box_get_center_widget (GTK_CENTER_BOX (priv->center_box)), callback_data);
if (priv->end_box != NULL)
gtk_container_forall (GTK_CONTAINER (priv->end_box), callback, callback_data);
}
static void
@@ -116,9 +132,10 @@ gtk_action_bar_finalize (GObject *object)
{
GtkActionBarPrivate *priv = gtk_action_bar_get_instance_private (GTK_ACTION_BAR (object));
g_clear_object (&priv->gadget);
gtk_widget_unparent (priv->revealer);
g_clear_object (&priv->gadget);
G_OBJECT_CLASS (gtk_action_bar_parent_class)->finalize (object);
}
@@ -137,13 +154,47 @@ gtk_action_bar_get_child_property (GtkContainer *container,
{
GtkActionBarPrivate *priv = gtk_action_bar_get_instance_private (GTK_ACTION_BAR (container));
if (child == priv->revealer)
g_param_value_set_default (pspec, value);
else
gtk_container_child_get_property (GTK_CONTAINER (priv->box),
child,
pspec->name,
value);
switch (property_id)
{
case CHILD_PROP_PACK_TYPE:
if (gtk_widget_get_parent (child) == priv->start_box)
g_value_set_enum (value, GTK_PACK_START);
else if (gtk_widget_get_parent (child) == priv->end_box)
g_value_set_enum (value, GTK_PACK_END);
else /* Center widget */
g_value_set_enum (value, GTK_PACK_START);
break;
case CHILD_PROP_POSITION:
if (gtk_widget_get_parent (child) == priv->start_box)
{
int n;
gtk_container_child_get (GTK_CONTAINER (priv->start_box),
child,
"position", &n,
NULL);
g_value_set_int (value, n);
}
else if (gtk_widget_get_parent (child) == priv->end_box)
{
int n;
gtk_container_child_get (GTK_CONTAINER (priv->end_box),
child,
"position", &n,
NULL);
g_value_set_int (value, n);
}
else /* Center widget */
{
g_value_set_int (value, 0);
}
break;
default:
GTK_CONTAINER_WARN_INVALID_CHILD_PROPERTY_ID (container, property_id, pspec);
break;
}
}
static void
@@ -155,11 +206,61 @@ gtk_action_bar_set_child_property (GtkContainer *container,
{
GtkActionBarPrivate *priv = gtk_action_bar_get_instance_private (GTK_ACTION_BAR (container));
if (child != priv->revealer)
gtk_container_child_set_property (GTK_CONTAINER (priv->box),
child,
pspec->name,
value);
switch (property_id)
{
case CHILD_PROP_PACK_TYPE:
if (gtk_widget_get_parent (child) == priv->start_box)
{
if (g_value_get_enum (value) == GTK_PACK_END)
{
g_object_ref (child);
gtk_container_remove (GTK_CONTAINER (priv->start_box), child);
gtk_box_pack_end (GTK_BOX (priv->end_box), child);
g_object_unref (child);
}
}
else if (gtk_widget_get_parent (child) == priv->end_box)
{
if (g_value_get_enum (value) == GTK_PACK_START)
{
g_object_ref (child);
gtk_container_remove (GTK_CONTAINER (priv->end_box), child);
gtk_container_add (GTK_CONTAINER (priv->start_box), child);
g_object_unref (child);
}
}
else
{
/* Ignore the center widget */
}
break;
case CHILD_PROP_POSITION:
if (gtk_widget_get_parent (child) == priv->start_box)
{
gtk_container_child_set (GTK_CONTAINER (priv->start_box),
child,
"position", g_value_get_int (value),
NULL);
}
else if (gtk_widget_get_parent (child) == priv->end_box)
{
gtk_container_child_set (GTK_CONTAINER (priv->end_box),
child,
"position", g_value_get_int (value),
NULL);
}
else
{
/* Ignore center widget */
}
break;
default:
GTK_CONTAINER_WARN_INVALID_CHILD_PROPERTY_ID (container, property_id, pspec);
break;
}
}
static gboolean
@@ -171,7 +272,10 @@ gtk_action_bar_render (GtkCssGadget *gadget,
int height,
gpointer data)
{
GTK_WIDGET_CLASS (gtk_action_bar_parent_class)->snapshot (gtk_css_gadget_get_owner (gadget), snapshot);
GtkActionBar *self = GTK_ACTION_BAR (gtk_css_gadget_get_owner (gadget));
GtkActionBarPrivate *priv = gtk_action_bar_get_instance_private (GTK_ACTION_BAR (self));
gtk_widget_snapshot_child (GTK_WIDGET (self), priv->revealer, snapshot);
return FALSE;
}
@@ -196,8 +300,7 @@ gtk_action_bar_allocate (GtkCssGadget *gadget,
GtkActionBarPrivate *priv = gtk_action_bar_get_instance_private (GTK_ACTION_BAR (widget));
gtk_widget_size_allocate (priv->revealer, (GtkAllocation *)allocation);
gtk_container_get_children_clip (GTK_CONTAINER (widget), out_clip);
gtk_widget_get_clip (priv->revealer, out_clip);
}
static void
@@ -290,6 +393,22 @@ gtk_action_bar_get_property (GObject *object,
}
}
static void
gtk_action_bar_destroy (GtkWidget *widget)
{
GtkActionBar *self = GTK_ACTION_BAR (widget);
GtkActionBarPrivate *priv = gtk_action_bar_get_instance_private (self);
gtk_center_box_set_start_widget (GTK_CENTER_BOX (priv->center_box), NULL);
gtk_center_box_set_center_widget (GTK_CENTER_BOX (priv->center_box), NULL);
gtk_center_box_set_end_widget (GTK_CENTER_BOX (priv->center_box), NULL);
priv->start_box = NULL;
priv->end_box = NULL;
GTK_WIDGET_CLASS (gtk_action_bar_parent_class)->destroy (widget);
}
static void
gtk_action_bar_class_init (GtkActionBarClass *klass)
{
@@ -308,6 +427,7 @@ gtk_action_bar_class_init (GtkActionBarClass *klass)
widget_class->snapshot = gtk_action_bar_snapshot;
widget_class->size_allocate = gtk_action_bar_size_allocate;
widget_class->measure = gtk_action_bar_measure_;
widget_class->destroy = gtk_action_bar_destroy;
container_class->add = gtk_action_bar_add;
container_class->remove = gtk_action_bar_remove;
@@ -354,12 +474,18 @@ gtk_action_bar_init (GtkActionBar *action_bar)
priv->revealer = gtk_revealer_new ();
gtk_widget_set_parent (priv->revealer, widget);
priv->box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
gtk_container_add (GTK_CONTAINER (priv->revealer), priv->box);
gtk_revealer_set_reveal_child (GTK_REVEALER (priv->revealer), TRUE);
gtk_revealer_set_transition_type (GTK_REVEALER (priv->revealer), GTK_REVEALER_TRANSITION_TYPE_SLIDE_UP);
priv->start_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
priv->end_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
priv->center_box = gtk_center_box_new ();
gtk_center_box_set_start_widget (GTK_CENTER_BOX (priv->center_box), priv->start_box);
gtk_center_box_set_end_widget (GTK_CENTER_BOX (priv->center_box), priv->end_box);
gtk_container_add (GTK_CONTAINER (priv->revealer), priv->center_box);
widget_node = gtk_widget_get_css_node (GTK_WIDGET (action_bar));
priv->gadget = gtk_css_custom_gadget_new_for_node (widget_node,
GTK_WIDGET (action_bar),
@@ -377,10 +503,9 @@ gtk_action_bar_buildable_add_child (GtkBuildable *buildable,
const gchar *type)
{
GtkActionBar *action_bar = GTK_ACTION_BAR (buildable);
GtkActionBarPrivate *priv = gtk_action_bar_get_instance_private (action_bar);
if (type && strcmp (type, "center") == 0)
gtk_box_set_center_widget (GTK_BOX (priv->box), GTK_WIDGET (child));
gtk_action_bar_set_center_widget (action_bar, GTK_WIDGET (child));
else if (!type)
gtk_container_add (GTK_CONTAINER (buildable), GTK_WIDGET (child));
else
@@ -412,7 +537,7 @@ gtk_action_bar_pack_start (GtkActionBar *action_bar,
{
GtkActionBarPrivate *priv = gtk_action_bar_get_instance_private (action_bar);
gtk_box_pack_start (GTK_BOX (priv->box), child, FALSE, TRUE);
gtk_container_add (GTK_CONTAINER (priv->start_box), child);
}
/**
@@ -431,7 +556,7 @@ gtk_action_bar_pack_end (GtkActionBar *action_bar,
{
GtkActionBarPrivate *priv = gtk_action_bar_get_instance_private (action_bar);
gtk_box_pack_end (GTK_BOX (priv->box), child, FALSE, TRUE);
gtk_box_pack_end (GTK_BOX (priv->end_box), child);
}
/**
@@ -449,7 +574,7 @@ gtk_action_bar_set_center_widget (GtkActionBar *action_bar,
{
GtkActionBarPrivate *priv = gtk_action_bar_get_instance_private (action_bar);
gtk_box_set_center_widget (GTK_BOX (priv->box), center_widget);
gtk_center_box_set_center_widget (GTK_CENTER_BOX (priv->center_box), center_widget);
}
/**
@@ -469,7 +594,7 @@ gtk_action_bar_get_center_widget (GtkActionBar *action_bar)
g_return_val_if_fail (GTK_IS_ACTION_BAR (action_bar), NULL);
return gtk_box_get_center_widget (GTK_BOX (priv->box));
return gtk_center_box_get_center_widget (GTK_CENTER_BOX (priv->center_box));
}
/**
+5 -3
View File
@@ -347,7 +347,9 @@ construct_appchooser_widget (GtkAppChooserDialog *self)
/* Need to build the appchooser widget after, because of the content-type construct-only property */
self->priv->app_chooser_widget = gtk_app_chooser_widget_new (self->priv->content_type);
gtk_box_pack_start (GTK_BOX (self->priv->inner_box), self->priv->app_chooser_widget, TRUE, TRUE);
gtk_widget_set_vexpand (self->priv->app_chooser_widget, TRUE);
gtk_box_pack_start (GTK_BOX (self->priv->inner_box), self->priv->app_chooser_widget);
g_signal_connect (self->priv->app_chooser_widget, "application-selected",
G_CALLBACK (widget_application_selected_cb), self);
@@ -360,10 +362,10 @@ construct_appchooser_widget (GtkAppChooserDialog *self)
/* Add the custom button to the new appchooser */
gtk_box_pack_start (GTK_BOX (self->priv->inner_box),
self->priv->show_more_button, FALSE, FALSE);
self->priv->show_more_button);
gtk_box_pack_start (GTK_BOX (self->priv->inner_box),
self->priv->software_button, FALSE, FALSE);
self->priv->software_button);
info = gtk_app_chooser_get_app_info (GTK_APP_CHOOSER (self->priv->app_chooser_widget));
gtk_dialog_set_response_sensitive (GTK_DIALOG (self), GTK_RESPONSE_OK, info != NULL);
+1 -2
View File
@@ -692,7 +692,6 @@ gtk_application_window_real_unmap (GtkWidget *widget)
static void
gtk_application_window_real_forall_internal (GtkContainer *container,
gboolean include_internal,
GtkCallback callback,
gpointer user_data)
{
@@ -702,7 +701,7 @@ gtk_application_window_real_forall_internal (GtkContainer *container,
callback (window->priv->menubar, user_data);
GTK_CONTAINER_CLASS (gtk_application_window_parent_class)
->forall (container, include_internal, callback, user_data);
->forall (container, callback, user_data);
}
static void
+4 -4
View File
@@ -1727,14 +1727,14 @@ gtk_assistant_insert_page (GtkAssistant *assistant,
priv->pages = g_list_insert (priv->pages, page_info, position);
gtk_box_pack_start (GTK_BOX (priv->sidebar), page_info->regular_title, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (priv->sidebar), page_info->current_title, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (priv->sidebar), page_info->regular_title);
gtk_box_pack_start (GTK_BOX (priv->sidebar), page_info->current_title);
gtk_box_reorder_child (GTK_BOX (priv->sidebar), page_info->regular_title, 2 * position);
gtk_box_reorder_child (GTK_BOX (priv->sidebar), page_info->current_title, 2 * position + 1);
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_widget_show (box);
gtk_box_pack_start (GTK_BOX (box), page, TRUE, TRUE);
gtk_box_pack_start (GTK_BOX (box), page);
g_object_set (box, "margin", 12, NULL);
g_signal_connect (box, "remove", G_CALLBACK (assistant_remove_page_cb), assistant);
@@ -1837,7 +1837,7 @@ add_to_action_area (GtkAssistant *assistant,
gtk_widget_set_valign (child, GTK_ALIGN_BASELINE);
gtk_box_pack_end (GTK_BOX (priv->action_area), child, FALSE, FALSE);
gtk_box_pack_end (GTK_BOX (priv->action_area), child);
}
/**
+1 -1
View File
@@ -145,7 +145,7 @@ static void
gtk_button_box_add (GtkContainer *container,
GtkWidget *widget)
{
gtk_box_pack_start (GTK_BOX (container), widget, TRUE, TRUE);
gtk_box_pack_start (GTK_BOX (container), widget);
}
static void
-2
View File
@@ -51,7 +51,6 @@ static void gtk_bin_add (GtkContainer *container,
static void gtk_bin_remove (GtkContainer *container,
GtkWidget *widget);
static void gtk_bin_forall (GtkContainer *container,
gboolean include_internals,
GtkCallback callback,
gpointer callback_data);
static GType gtk_bin_child_type (GtkContainer *container);
@@ -150,7 +149,6 @@ gtk_bin_remove (GtkContainer *container,
static void
gtk_bin_forall (GtkContainer *container,
gboolean include_internals,
GtkCallback callback,
gpointer callback_data)
{
+34 -695
View File
File diff suppressed because it is too large Load Diff
+2 -16
View File
@@ -82,14 +82,10 @@ GtkWidget* gtk_box_new (GtkOrientation orientation,
GDK_AVAILABLE_IN_ALL
void gtk_box_pack_start (GtkBox *box,
GtkWidget *child,
gboolean expand,
gboolean fill);
GtkWidget *child);
GDK_AVAILABLE_IN_ALL
void gtk_box_pack_end (GtkBox *box,
GtkWidget *child,
gboolean expand,
gboolean fill);
GtkWidget *child);
GDK_AVAILABLE_IN_ALL
void gtk_box_set_homogeneous (GtkBox *box,
@@ -115,22 +111,12 @@ void gtk_box_reorder_child (GtkBox *box,
GDK_AVAILABLE_IN_ALL
void gtk_box_query_child_packing (GtkBox *box,
GtkWidget *child,
gboolean *expand,
gboolean *fill,
GtkPackType *pack_type);
GDK_AVAILABLE_IN_ALL
void gtk_box_set_child_packing (GtkBox *box,
GtkWidget *child,
gboolean expand,
gboolean fill,
GtkPackType pack_type);
GDK_AVAILABLE_IN_3_12
void gtk_box_set_center_widget (GtkBox *box,
GtkWidget *widget);
GDK_AVAILABLE_IN_3_12
GtkWidget *gtk_box_get_center_widget (GtkBox *box);
G_END_DECLS
#endif /* __GTK_BOX_H__ */
+226
View File
@@ -0,0 +1,226 @@
#include "gtkcenterboxprivate.h"
G_DEFINE_TYPE (GtkCenterBox, gtk_center_box, GTK_TYPE_WIDGET);
static void
gtk_center_box_measure (GtkWidget *widget,
GtkOrientation orientation,
int for_size,
int *minimum,
int *natural,
int *minimum_baseline,
int *natural_baseline)
{
GtkCenterBox *self = GTK_CENTER_BOX (widget);
int min, nat, min_baseline, nat_baseline;
gtk_widget_measure (self->start_widget,
orientation,
for_size,
minimum, natural,
minimum_baseline, natural_baseline);
if (self->center_widget)
{
gtk_widget_measure (self->center_widget,
orientation,
for_size,
&min, &nat,
&min_baseline, &nat_baseline);
/* XXX How are baselines even handled? */
if (orientation == GTK_ORIENTATION_HORIZONTAL)
{
*minimum = *minimum + min;
*natural = *natural + nat;
}
else /* GTK_ORIENTATION_VERTICAL */
{
*minimum = MAX (*minimum, min);
*natural = MAX (*minimum, nat);
}
}
gtk_widget_measure (self->end_widget,
orientation,
for_size,
&min, &nat,
&min_baseline, &nat_baseline);
if (orientation == GTK_ORIENTATION_HORIZONTAL)
{
*minimum = *minimum + min;
*natural = *natural + nat;
}
else /* GTK_ORIENTATION_VERTICAL */
{
*minimum = MAX (*minimum, min);
*natural = MAX (*minimum, nat);
}
}
static void
gtk_center_box_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)
{
GtkCenterBox *self = GTK_CENTER_BOX (widget);
GtkAllocation child_allocation;
GtkAllocation clip = *allocation;
GtkAllocation child_clip;
int start_size, end_size;
int min, nat;
GTK_WIDGET_CLASS (gtk_center_box_parent_class)->size_allocate (widget, allocation);
// TODO: Allocate natural sizes if possible?
/* Start Box */
gtk_widget_measure (self->start_widget, GTK_ORIENTATION_HORIZONTAL,
allocation->height,
&min, &nat, NULL, NULL);
child_allocation.x = allocation->x;
child_allocation.y = allocation->y;
child_allocation.width = min;
child_allocation.height = allocation->height;
gtk_widget_size_allocate (self->start_widget, &child_allocation);
gtk_widget_get_clip (self->start_widget, &child_clip);
gdk_rectangle_union (&clip, &clip, &child_clip);
start_size = child_allocation.width;
/* End Box */
gtk_widget_measure (self->end_widget, GTK_ORIENTATION_HORIZONTAL,
allocation->height,
&min, &nat, NULL, NULL);
child_allocation.x = allocation->x + allocation->width - min;
child_allocation.width = min;
gtk_widget_size_allocate (self->end_widget, &child_allocation);
gtk_widget_get_clip (self->end_widget, &child_clip);
gdk_rectangle_union (&clip, &clip, &child_clip);
end_size = child_allocation.width;
/* Center Widget */
if (self->center_widget)
{
gtk_widget_measure (self->center_widget, GTK_ORIENTATION_HORIZONTAL,
allocation->height,
&min, &nat, NULL, NULL);
child_allocation.x = (allocation->width / 2) - (min / 2);
/* Push in from start/end */
if (start_size > child_allocation.x)
child_allocation.x = start_size;
else if (allocation->width - end_size < child_allocation.x + min)
child_allocation.x = allocation->width - min - end_size;
child_allocation.x += allocation->x;
child_allocation.width = min;
gtk_widget_size_allocate (self->center_widget, &child_allocation);
gtk_widget_get_clip (self->center_widget, &child_clip);
gdk_rectangle_union (&clip, &clip, &child_clip);
}
gtk_widget_set_clip (widget, &clip);
}
static void
gtk_center_box_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot)
{
GtkCenterBox *self = GTK_CENTER_BOX (widget);
gtk_widget_snapshot_child (widget, self->start_widget, snapshot);
if (self->center_widget)
gtk_widget_snapshot_child (widget, self->center_widget, snapshot);
gtk_widget_snapshot_child (widget, self->end_widget, snapshot);
}
static void
gtk_center_box_class_init (GtkCenterBoxClass *klass)
{
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
widget_class->measure = gtk_center_box_measure;
widget_class->size_allocate = gtk_center_box_size_allocate;
widget_class->snapshot = gtk_center_box_snapshot;
}
static void
gtk_center_box_init (GtkCenterBox *self)
{
gtk_widget_set_has_window (GTK_WIDGET (self), FALSE);
self->start_widget = NULL;
self->center_widget = NULL;
self->end_widget = NULL;
}
GtkWidget *
gtk_center_box_new (void)
{
return GTK_WIDGET (g_object_new (GTK_TYPE_CENTER_BOX, NULL));
}
void
gtk_center_box_set_start_widget (GtkCenterBox *self,
GtkWidget *child)
{
if (self->start_widget)
gtk_widget_unparent (self->start_widget);
self->start_widget = child;
if (child)
gtk_widget_set_parent (child, GTK_WIDGET (self));
}
void
gtk_center_box_set_center_widget (GtkCenterBox *self,
GtkWidget *child)
{
if (self->center_widget)
gtk_widget_unparent (self->center_widget);
self->center_widget = child;
if (child)
gtk_widget_set_parent (child, GTK_WIDGET (self));
}
void
gtk_center_box_set_end_widget (GtkCenterBox *self,
GtkWidget *child)
{
if (self->end_widget)
gtk_widget_unparent (self->end_widget);
self->end_widget = child;
if (child)
gtk_widget_set_parent (child, GTK_WIDGET (self));
}
GtkWidget *
gtk_center_box_get_start_widget (GtkCenterBox *self)
{
return self->start_widget;
}
GtkWidget *
gtk_center_box_get_center_widget (GtkCenterBox *self)
{
return self->center_widget;
}
GtkWidget *
gtk_center_box_get_end_widget (GtkCenterBox *self)
{
return self->end_widget;
}
+43
View File
@@ -0,0 +1,43 @@
#ifndef __GTK_CENTER_BOX_H__
#define __GTK_CENTER_BOX_H__
#include "gtkwidget.h"
#define GTK_TYPE_CENTER_BOX (gtk_center_box_get_type ())
#define GTK_CENTER_BOX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_CENTER_BOX, GtkCenterBox))
#define GTK_CENTER_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_CENTER_BOX, GtkCenterBoxClass))
#define GTK_IS_CENTER_BOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_CENTER_BOX))
#define GTK_IS_CENTER_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_CENTER_BOX))
#define GTK_CENTER_BOX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_CENTER_BOX, GtkCenterBoxClass))
typedef struct _GtkCenterBox GtkCenterBox;
typedef struct _GtkCenterBoxClass GtkCenterBoxClass;
struct _GtkCenterBox
{
GtkWidget parent_instance;
GtkWidget *start_widget;
GtkWidget *center_widget;
GtkWidget *end_widget;
};
struct _GtkCenterBoxClass
{
GtkWidgetClass parent_class;
};
GType gtk_center_box_get_type (void) G_GNUC_CONST;
GtkWidget *gtk_center_box_new (void);
void gtk_center_box_set_start_widget (GtkCenterBox *self, GtkWidget *child);
void gtk_center_box_set_center_widget (GtkCenterBox *self, GtkWidget *child);
void gtk_center_box_set_end_widget (GtkCenterBox *self, GtkWidget *child);
GtkWidget * gtk_center_box_get_start_widget (GtkCenterBox *self);
GtkWidget * gtk_center_box_get_center_widget (GtkCenterBox *self);
GtkWidget * gtk_center_box_get_end_widget (GtkCenterBox *self);
#endif
+2 -2
View File
@@ -535,12 +535,12 @@ gtk_color_chooser_widget_init (GtkColorChooserWidget *cc)
cc->priv->custom = box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
g_object_set (box, "margin-top", 12, NULL);
gtk_box_pack_end (GTK_BOX (cc->priv->palette), box, FALSE, TRUE);
gtk_box_pack_end (GTK_BOX (cc->priv->palette), box);
/* translators: label for the custom section in the color chooser */
cc->priv->custom_label = label = gtk_label_new (_("Custom"));
gtk_widget_set_halign (label, GTK_ALIGN_START);
gtk_box_pack_end (GTK_BOX (cc->priv->palette), label, FALSE, TRUE);
gtk_box_pack_end (GTK_BOX (cc->priv->palette), label);
cc->priv->button = button = gtk_color_swatch_new ();
gtk_widget_set_name (button, "add-color-button");
+2 -9
View File
@@ -254,7 +254,6 @@ static void gtk_combo_box_menu_hide (GtkWidget *menu,
static void gtk_combo_box_unset_model (GtkComboBox *combo_box);
static void gtk_combo_box_forall (GtkContainer *container,
gboolean include_internals,
GtkCallback callback,
gpointer callback_data);
static gboolean gtk_combo_box_scroll_event (GtkWidget *widget,
@@ -1315,7 +1314,8 @@ gtk_combo_box_add (GtkContainer *container,
priv->cell_view = NULL;
}
gtk_box_pack_start (GTK_BOX (priv->box), widget, TRUE, TRUE);
gtk_widget_set_hexpand (widget, TRUE);
gtk_container_add (GTK_CONTAINER (priv->box), widget);
_gtk_bin_set_child (GTK_BIN (container), widget);
if (priv->has_entry)
@@ -1738,7 +1738,6 @@ gtk_combo_box_unset_model (GtkComboBox *combo_box)
static void
gtk_combo_box_forall (GtkContainer *container,
gboolean include_internals,
GtkCallback callback,
gpointer callback_data)
{
@@ -1746,12 +1745,6 @@ gtk_combo_box_forall (GtkContainer *container,
GtkComboBoxPrivate *priv = combo_box->priv;
GtkWidget *child;
if (include_internals)
{
if (priv->box)
(* callback) (priv->box, callback_data);
}
child = gtk_bin_get_child (GTK_BIN (container));
if (child && child != priv->cell_view)
(* callback) (child, callback_data);
+17 -24
View File
@@ -1910,15 +1910,12 @@ gtk_container_forall (GtkContainer *container,
GtkCallback callback,
gpointer callback_data)
{
GtkContainerClass *class;
g_return_if_fail (GTK_IS_CONTAINER (container));
g_return_if_fail (callback != NULL);
class = GTK_CONTAINER_GET_CLASS (container);
if (class->forall)
class->forall (container, TRUE, callback, callback_data);
gtk_widget_forall (GTK_WIDGET (container),
callback,
callback_data);
}
/**
@@ -1950,7 +1947,7 @@ gtk_container_foreach (GtkContainer *container,
class = GTK_CONTAINER_GET_CLASS (container);
if (class->forall)
class->forall (container, FALSE, callback, callback_data);
class->forall (container, callback, callback_data);
}
/**
@@ -3016,24 +3013,16 @@ gtk_container_draw (GtkWidget *widget,
return FALSE;
}
static void
gtk_container_snapshot_forall (GtkWidget *child,
gpointer snapshot)
{
gtk_widget_snapshot_child (_gtk_widget_get_parent (child),
child,
snapshot);
}
static void
gtk_container_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot)
{
GtkContainer *container = GTK_CONTAINER (widget);
GtkWidget *child;
gtk_container_forall (container,
gtk_container_snapshot_forall,
snapshot);
for (child = _gtk_widget_get_first_child (widget);
child != NULL;
child = _gtk_widget_get_next_sibling (child))
gtk_widget_snapshot_child (widget, child, snapshot);
}
static gboolean
@@ -3048,10 +3037,9 @@ gtk_container_should_propagate_draw (GtkContainer *container,
}
static void
union_with_clip (GtkWidget *widget,
gpointer data)
union_with_clip (GtkWidget *widget,
GtkAllocation *clip)
{
GdkRectangle *clip = data;
GtkAllocation widget_clip;
if (!gtk_widget_is_visible (widget) ||
@@ -3070,9 +3058,14 @@ void
gtk_container_get_children_clip (GtkContainer *container,
GtkAllocation *out_clip)
{
GtkWidget *child;
memset (out_clip, 0, sizeof (GtkAllocation));
gtk_container_forall (container, union_with_clip, out_clip);
for (child = _gtk_widget_get_first_child (GTK_WIDGET (container));
child != NULL;
child = _gtk_widget_get_next_sibling (child))
union_with_clip (child, out_clip);
}
static void
-1
View File
@@ -82,7 +82,6 @@ struct _GtkContainerClass
GtkWidget *widget);
void (*check_resize) (GtkContainer *container);
void (*forall) (GtkContainer *container,
gboolean include_internals,
GtkCallback callback,
gpointer callback_data);
void (*set_focus_child) (GtkContainer *container,
+12 -12
View File
@@ -555,7 +555,7 @@ new_unit_widget (GtkCustomPaperUnixDialog *dialog,
else
gtk_spin_button_set_digits (GTK_SPIN_BUTTON (button), 1);
gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE);
gtk_box_pack_start (GTK_BOX (hbox), button);
gtk_widget_show (button);
data->spin_button = button;
@@ -569,7 +569,7 @@ new_unit_widget (GtkCustomPaperUnixDialog *dialog,
label = gtk_label_new (_("mm"));
gtk_widget_set_valign (label, GTK_ALIGN_BASELINE);
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (hbox), label);
gtk_widget_show (label);
gtk_label_set_mnemonic_widget (GTK_LABEL (mnemonic_label), button);
@@ -979,13 +979,13 @@ wrap_in_frame (const gchar *label,
g_free (bold_text);
frame = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
gtk_box_pack_start (GTK_BOX (frame), label_widget, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (frame), label_widget);
gtk_widget_set_margin_start (child, 12);
gtk_widget_set_halign (child, GTK_ALIGN_FILL);
gtk_widget_set_valign (child, GTK_ALIGN_FILL);
gtk_box_pack_start (GTK_BOX (frame), child, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (frame), child);
gtk_widget_show (frame);
@@ -1036,11 +1036,11 @@ populate_dialog (GtkCustomPaperUnixDialog *dialog)
gtk_box_set_spacing (GTK_BOX (content_area), 2); /* 2 * 5 + 2 = 12 */
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 18);
gtk_box_pack_start (GTK_BOX (content_area), hbox, TRUE, TRUE);
gtk_box_pack_start (GTK_BOX (content_area), hbox);
gtk_widget_show (hbox);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE);
gtk_box_pack_start (GTK_BOX (hbox), vbox);
gtk_widget_show (vbox);
scrolled = gtk_scrolled_window_new (NULL, NULL);
@@ -1048,7 +1048,7 @@ populate_dialog (GtkCustomPaperUnixDialog *dialog)
GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled),
GTK_SHADOW_IN);
gtk_box_pack_start (GTK_BOX (vbox), scrolled, TRUE, TRUE);
gtk_box_pack_start (GTK_BOX (vbox), scrolled);
gtk_widget_show (scrolled);
treeview = gtk_tree_view_new_with_model (GTK_TREE_MODEL (priv->custom_paper_list));
@@ -1079,7 +1079,7 @@ populate_dialog (GtkCustomPaperUnixDialog *dialog)
context = gtk_widget_get_style_context (toolbar);
gtk_style_context_add_class (context, GTK_STYLE_CLASS_INLINE_TOOLBAR);
gtk_box_pack_start (GTK_BOX (vbox), toolbar, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (vbox), toolbar);
gtk_widget_show (toolbar);
icon = g_themed_icon_new_with_default_fallbacks ("list-add-symbolic");
@@ -1098,7 +1098,7 @@ populate_dialog (GtkCustomPaperUnixDialog *dialog)
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 18);
priv->values_box = vbox;
gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE);
gtk_box_pack_start (GTK_BOX (hbox), vbox);
gtk_widget_show (vbox);
grid = gtk_grid_new ();
@@ -1130,7 +1130,7 @@ populate_dialog (GtkCustomPaperUnixDialog *dialog)
frame = wrap_in_frame (_("Paper Size"), grid);
gtk_widget_show (grid);
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (vbox), frame);
gtk_widget_show (frame);
grid = gtk_grid_new ();
@@ -1203,7 +1203,7 @@ populate_dialog (GtkCustomPaperUnixDialog *dialog)
NULL, NULL);
gtk_combo_box_set_active (GTK_COMBO_BOX (combo), 0);
gtk_box_pack_start (GTK_BOX (hbox), combo, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (hbox), combo);
gtk_widget_show (combo);
g_signal_connect_swapped (combo, "changed",
@@ -1211,7 +1211,7 @@ populate_dialog (GtkCustomPaperUnixDialog *dialog)
frame = wrap_in_frame (_("Paper Margins"), grid);
gtk_widget_show (grid);
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (vbox), frame);
gtk_widget_show (frame);
update_custom_widgets_from_list (dialog);
+4 -3
View File
@@ -629,8 +629,9 @@ gtk_entry_completion_constructed (GObject *object)
gtk_container_add (GTK_CONTAINER (popup_frame), priv->vbox);
gtk_container_add (GTK_CONTAINER (priv->scrolled_window), priv->tree_view);
gtk_box_pack_start (GTK_BOX (priv->vbox), priv->scrolled_window,
TRUE, TRUE);
gtk_widget_set_hexpand (priv->scrolled_window, TRUE);
gtk_widget_set_vexpand (priv->scrolled_window, TRUE);
gtk_container_add (GTK_CONTAINER (priv->vbox), priv->scrolled_window);
/* we don't want to see the action treeview when no actions have
* been inserted, so we pack the action treeview after the first
@@ -1323,7 +1324,7 @@ gtk_entry_completion_insert_action (GtkEntryCompletion *completion,
gtk_tree_path_free (path);
gtk_box_pack_start (GTK_BOX (completion->priv->vbox),
completion->priv->action_view, FALSE, FALSE);
completion->priv->action_view);
gtk_widget_show (completion->priv->action_view);
}
}
+29 -80
View File
@@ -124,6 +124,7 @@
#include "gtkbuiltiniconprivate.h"
#include "gtkwidgetprivate.h"
#include "gtkcontainerprivate.h"
#include "gtkiconprivate.h"
#define TIMEOUT_EXPAND 500
@@ -146,8 +147,8 @@ struct _GtkExpanderPrivate
GdkWindow *event_window;
GtkCssGadget *gadget;
GtkCssGadget *title_gadget;
GtkCssGadget *arrow_gadget;
GtkWidget *title_widget;
GtkWidget *arrow_widget;
GtkGesture *multipress_gesture;
gint spacing;
@@ -200,10 +201,6 @@ static void gtk_expander_add (GtkContainer *container,
GtkWidget *widget);
static void gtk_expander_remove (GtkContainer *container,
GtkWidget *widget);
static void gtk_expander_forall (GtkContainer *container,
gboolean include_internals,
GtkCallback callback,
gpointer callback_data);
static void gtk_expander_activate (GtkExpander *expander);
@@ -226,8 +223,6 @@ static void gtk_expander_measure (GtkWidget *widget,
int *natural_baseline);
static void gtk_expander_state_flags_changed (GtkWidget *widget,
GtkStateFlags previous_state);
static void gtk_expander_direction_changed (GtkWidget *widget,
GtkTextDirection previous_direction);
/* Gestures */
static void gesture_multipress_released_cb (GtkGestureMultiPress *gesture,
@@ -241,6 +236,16 @@ G_DEFINE_TYPE_WITH_CODE (GtkExpander, gtk_expander, GTK_TYPE_BIN,
G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE,
gtk_expander_buildable_init))
static void
gtk_expander_finalize (GObject *obj)
{
GtkExpanderPrivate *priv = gtk_expander_get_instance_private (GTK_EXPANDER (obj));
gtk_widget_unparent (priv->title_widget);
G_OBJECT_CLASS (gtk_expander_parent_class)->finalize (obj);
}
static void
gtk_expander_class_init (GtkExpanderClass *klass)
{
@@ -252,6 +257,7 @@ gtk_expander_class_init (GtkExpanderClass *klass)
widget_class = (GtkWidgetClass *) klass;
container_class = (GtkContainerClass *) klass;
gobject_class->finalize = gtk_expander_finalize;
gobject_class->set_property = gtk_expander_set_property;
gobject_class->get_property = gtk_expander_get_property;
@@ -269,11 +275,9 @@ gtk_expander_class_init (GtkExpanderClass *klass)
widget_class->drag_leave = gtk_expander_drag_leave;
widget_class->measure = gtk_expander_measure;
widget_class->state_flags_changed = gtk_expander_state_flags_changed;
widget_class->direction_changed = gtk_expander_direction_changed;
container_class->add = gtk_expander_add;
container_class->remove = gtk_expander_remove;
container_class->forall = gtk_expander_forall;
klass->activate = gtk_expander_activate;
@@ -380,21 +384,16 @@ gtk_expander_init (GtkExpander *expander)
widget_node = gtk_widget_get_css_node (GTK_WIDGET (expander));
priv->gadget = gtk_box_gadget_new_for_node (widget_node, GTK_WIDGET (expander));
gtk_box_gadget_set_orientation (GTK_BOX_GADGET (priv->gadget), GTK_ORIENTATION_VERTICAL);
priv->title_gadget = gtk_box_gadget_new ("title",
GTK_WIDGET (expander),
priv->gadget,
NULL);
gtk_box_gadget_set_orientation (GTK_BOX_GADGET (priv->title_gadget), GTK_ORIENTATION_HORIZONTAL);
gtk_box_gadget_set_draw_focus (GTK_BOX_GADGET (priv->title_gadget), TRUE);
gtk_box_gadget_insert_gadget (GTK_BOX_GADGET (priv->gadget), -1, priv->title_gadget, FALSE, GTK_ALIGN_START);
priv->title_widget = g_object_new (GTK_TYPE_BOX,
"css-name", "title",
NULL);
gtk_widget_set_parent (priv->title_widget, GTK_WIDGET (expander));
gtk_box_gadget_insert_widget (GTK_BOX_GADGET (priv->gadget), -1, priv->title_widget);
priv->arrow_gadget = gtk_builtin_icon_new ("arrow",
GTK_WIDGET (expander),
priv->title_gadget,
NULL);
gtk_css_gadget_add_class (priv->arrow_gadget, GTK_STYLE_CLASS_HORIZONTAL);
gtk_box_gadget_insert_gadget (GTK_BOX_GADGET (priv->title_gadget), -1, priv->arrow_gadget, FALSE, GTK_ALIGN_CENTER);
priv->arrow_widget = gtk_icon_new ("arrow");
gtk_style_context_add_class (gtk_widget_get_style_context (priv->arrow_widget),
GTK_STYLE_CLASS_HORIZONTAL);
gtk_container_add (GTK_CONTAINER (priv->title_widget), priv->arrow_widget);
gtk_drag_dest_set (GTK_WIDGET (expander), 0, NULL, 0, 0);
gtk_drag_dest_set_track_motion (GTK_WIDGET (expander), TRUE);
@@ -522,8 +521,6 @@ gtk_expander_destroy (GtkWidget *widget)
GTK_WIDGET_CLASS (gtk_expander_parent_class)->destroy (widget);
g_clear_object (&priv->arrow_gadget);
g_clear_object (&priv->title_gadget);
g_clear_object (&priv->gadget);
}
@@ -587,7 +584,7 @@ gtk_expander_size_allocate (GtkWidget *widget,
{
GtkAllocation title_allocation;
gtk_css_gadget_get_border_allocation (priv->title_gadget, &title_allocation, NULL);
gtk_widget_get_allocation (priv->title_widget, &title_allocation);
gdk_window_move_resize (priv->event_window,
title_allocation.x, title_allocation.y,
title_allocation.width, title_allocation.height);
@@ -599,8 +596,7 @@ gtk_expander_map (GtkWidget *widget)
{
GtkExpanderPrivate *priv = GTK_EXPANDER (widget)->priv;
if (priv->label_widget)
gtk_widget_map (priv->label_widget);
gtk_widget_map (priv->title_widget);
GTK_WIDGET_CLASS (gtk_expander_parent_class)->map (widget);
@@ -617,9 +613,6 @@ gtk_expander_unmap (GtkWidget *widget)
gdk_window_hide (priv->event_window);
GTK_WIDGET_CLASS (gtk_expander_parent_class)->unmap (widget);
if (priv->label_widget)
gtk_widget_unmap (priv->label_widget);
}
static void
@@ -653,14 +646,14 @@ update_node_state (GtkExpander *expander)
else
state &= ~GTK_STATE_FLAG_PRELIGHT;
gtk_css_gadget_set_state (priv->title_gadget, state);
gtk_widget_set_state_flags (priv->title_widget, state, TRUE);
if (priv->expanded)
state |= GTK_STATE_FLAG_CHECKED;
else
state &= ~GTK_STATE_FLAG_CHECKED;
gtk_css_gadget_set_state (priv->arrow_gadget, state);
gtk_widget_set_state_flags (priv->arrow_widget, state, TRUE);
}
static void
@@ -672,27 +665,6 @@ gtk_expander_state_flags_changed (GtkWidget *widget,
GTK_WIDGET_CLASS (gtk_expander_parent_class)->state_flags_changed (widget, previous_state);
}
static void
gtk_expander_direction_changed (GtkWidget *widget,
GtkTextDirection previous_direction)
{
GtkExpanderPrivate *priv = GTK_EXPANDER (widget)->priv;
GtkAlign align;
gtk_box_gadget_reverse_children (GTK_BOX_GADGET (priv->title_gadget));
align = gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL ? GTK_ALIGN_END : GTK_ALIGN_START;
gtk_box_gadget_remove_gadget (GTK_BOX_GADGET (priv->gadget), priv->title_gadget);
gtk_box_gadget_insert_gadget (GTK_BOX_GADGET (priv->gadget), 0, priv->title_gadget, FALSE, align);
gtk_box_gadget_set_allocate_reverse (GTK_BOX_GADGET (priv->title_gadget),
gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL);
gtk_box_gadget_set_align_reverse (GTK_BOX_GADGET (priv->title_gadget),
gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL);
GTK_WIDGET_CLASS (gtk_expander_parent_class)->direction_changed (widget, previous_direction);
}
static gboolean
gtk_expander_enter_notify (GtkWidget *widget,
GdkEventCrossing *event)
@@ -1012,24 +984,6 @@ gtk_expander_remove (GtkContainer *container,
}
}
static void
gtk_expander_forall (GtkContainer *container,
gboolean include_internals,
GtkCallback callback,
gpointer callback_data)
{
GtkBin *bin = GTK_BIN (container);
GtkExpanderPrivate *priv = GTK_EXPANDER (container)->priv;
GtkWidget *child;
child = gtk_bin_get_child (bin);
if (child)
(* callback) (child, callback_data);
if (priv->label_widget)
(* callback) (priv->label_widget, callback_data);
}
static void
gtk_expander_activate (GtkExpander *expander)
{
@@ -1356,7 +1310,6 @@ gtk_expander_set_label_widget (GtkExpander *expander,
{
GtkExpanderPrivate *priv;
GtkWidget *widget;
int pos;
g_return_if_fail (GTK_IS_EXPANDER (expander));
g_return_if_fail (label_widget == NULL || GTK_IS_WIDGET (label_widget));
@@ -1369,9 +1322,7 @@ gtk_expander_set_label_widget (GtkExpander *expander,
if (priv->label_widget)
{
gtk_box_gadget_remove_widget (GTK_BOX_GADGET (priv->title_gadget), priv->label_widget);
gtk_widget_set_state_flags (priv->label_widget, 0, TRUE);
gtk_widget_unparent (priv->label_widget);
gtk_container_remove (GTK_CONTAINER (priv->title_widget), priv->label_widget);
}
priv->label_widget = label_widget;
@@ -1380,13 +1331,11 @@ gtk_expander_set_label_widget (GtkExpander *expander,
if (label_widget)
{
priv->label_widget = label_widget;
gtk_widget_set_parent (label_widget, widget);
if (priv->prelight)
gtk_widget_set_state_flags (label_widget, GTK_STATE_FLAG_PRELIGHT, FALSE);
pos = gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL ? 0 : 1;
gtk_box_gadget_insert_widget (GTK_BOX_GADGET (priv->title_gadget), pos, label_widget);
gtk_container_add (GTK_CONTAINER (priv->title_widget), label_widget);
}
if (gtk_widget_get_visible (widget))
+5 -5
View File
@@ -926,7 +926,7 @@ update_preview_widget_visibility (GtkFileChooserWidget *impl)
if (!priv->preview_label)
{
priv->preview_label = gtk_label_new (priv->preview_display_name);
gtk_box_pack_start (GTK_BOX (priv->preview_box), priv->preview_label, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (priv->preview_box), priv->preview_label);
gtk_box_reorder_child (GTK_BOX (priv->preview_box), priv->preview_label, 0);
gtk_label_set_ellipsize (GTK_LABEL (priv->preview_label), PANGO_ELLIPSIZE_MIDDLE);
gtk_widget_show (priv->preview_label);
@@ -967,7 +967,7 @@ set_preview_widget (GtkFileChooserWidget *impl,
if (priv->preview_widget)
{
gtk_widget_show (priv->preview_widget);
gtk_box_pack_start (GTK_BOX (priv->preview_box), priv->preview_widget, TRUE, TRUE);
gtk_box_pack_start (GTK_BOX (priv->preview_box), priv->preview_widget);
gtk_box_reorder_child (GTK_BOX (priv->preview_box),
priv->preview_widget,
(priv->use_preview_label && priv->preview_label) ? 1 : 0);
@@ -2687,7 +2687,7 @@ save_widgets_create (GtkFileChooserWidget *impl)
gtk_style_context_add_class (gtk_widget_get_style_context (vbox), "search-bar");
priv->save_widgets_table = gtk_grid_new ();
gtk_box_pack_start (GTK_BOX (vbox), priv->save_widgets_table, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (vbox), priv->save_widgets_table);
gtk_grid_set_row_spacing (GTK_GRID (priv->save_widgets_table), 12);
gtk_grid_set_column_spacing (GTK_GRID (priv->save_widgets_table), 12);
@@ -2707,7 +2707,7 @@ save_widgets_create (GtkFileChooserWidget *impl)
gtk_label_set_mnemonic_widget (GTK_LABEL (widget), priv->location_entry);
priv->save_widgets = vbox;
gtk_box_pack_start (GTK_BOX (impl), priv->save_widgets, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (impl), priv->save_widgets);
gtk_box_reorder_child (GTK_BOX (impl), priv->save_widgets, 0);
gtk_widget_show (priv->save_widgets);
}
@@ -2774,7 +2774,7 @@ location_switch_to_filename_entry (GtkFileChooserWidget *impl)
if (!priv->location_entry)
{
location_entry_create (impl);
gtk_box_pack_start (GTK_BOX (priv->location_entry_box), priv->location_entry, TRUE, TRUE);
gtk_box_pack_start (GTK_BOX (priv->location_entry_box), priv->location_entry);
}
_gtk_file_chooser_entry_set_base_folder (GTK_FILE_CHOOSER_ENTRY (priv->location_entry), priv->current_folder);
-2
View File
@@ -106,7 +106,6 @@ static void gtk_fixed_add (GtkContainer *container,
static void gtk_fixed_remove (GtkContainer *container,
GtkWidget *widget);
static void gtk_fixed_forall (GtkContainer *container,
gboolean include_internals,
GtkCallback callback,
gpointer callback_data);
static GType gtk_fixed_child_type (GtkContainer *container);
@@ -498,7 +497,6 @@ gtk_fixed_remove (GtkContainer *container,
static void
gtk_fixed_forall (GtkContainer *container,
gboolean include_internals,
GtkCallback callback,
gpointer callback_data)
{
+1 -2
View File
@@ -3154,7 +3154,6 @@ gtk_flow_box_remove (GtkContainer *container,
static void
gtk_flow_box_forall (GtkContainer *container,
gboolean include_internals,
GtkCallback callback,
gpointer callback_target)
{
@@ -4374,7 +4373,7 @@ gtk_flow_box_bind_model (GtkFlowBox *box,
g_clear_object (&priv->bound_model);
}
gtk_flow_box_forall (GTK_CONTAINER (box), FALSE, (GtkCallback) gtk_widget_destroy, NULL);
gtk_flow_box_forall (GTK_CONTAINER (box), (GtkCallback) gtk_widget_destroy, NULL);
if (model == NULL)
return;
+9 -6
View File
@@ -128,7 +128,6 @@ static void gtk_frame_size_allocate (GtkWidget *widget,
static void gtk_frame_remove (GtkContainer *container,
GtkWidget *child);
static void gtk_frame_forall (GtkContainer *container,
gboolean include_internals,
GtkCallback callback,
gpointer callback_data);
@@ -399,7 +398,6 @@ gtk_frame_remove (GtkContainer *container,
static void
gtk_frame_forall (GtkContainer *container,
gboolean include_internals,
GtkCallback callback,
gpointer callback_data)
{
@@ -690,7 +688,7 @@ static void
gtk_frame_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)
{
GtkAllocation clip;
GtkAllocation clip = *allocation;
gtk_widget_set_allocation (widget, allocation);
@@ -714,6 +712,7 @@ gtk_frame_allocate (GtkCssGadget *gadget,
GtkFramePrivate *priv;
GtkWidget *child;
GtkAllocation new_allocation;
GtkAllocation clip;
widget = gtk_css_gadget_get_owner (gadget);
frame = GTK_FRAME (widget);
@@ -745,13 +744,17 @@ gtk_frame_allocate (GtkCssGadget *gadget,
priv->label_allocation.width = width;
gtk_widget_size_allocate (priv->label_widget, &priv->label_allocation);
gtk_widget_get_clip (priv->label_widget, &clip);
gdk_rectangle_union (out_clip, out_clip, &clip);
}
child = gtk_bin_get_child (GTK_BIN (widget));
if (child && gtk_widget_get_visible (child))
gtk_widget_size_allocate (child, &priv->child_allocation);
gtk_container_get_children_clip (GTK_CONTAINER (widget), out_clip);
{
gtk_widget_size_allocate (child, &priv->child_allocation);
gtk_widget_get_clip (child, &clip);
gdk_rectangle_union (out_clip, out_clip, &clip);
}
}
static void
+157
View File
@@ -0,0 +1,157 @@
#include "gtkgizmoprivate.h"
#include "gtkwidgetprivate.h"
#include "gtkcsscustomgadgetprivate.h"
G_DEFINE_TYPE (GtkGizmo, gtk_gizmo, GTK_TYPE_WIDGET);
static void
gtk_gizmo_measure (GtkWidget *widget,
GtkOrientation orientation,
int for_size,
int *minimum,
int *natural,
int *minimum_baseline,
int *natural_baseline)
{
GtkGizmo *self = GTK_GIZMO (widget);
gtk_css_gadget_get_preferred_size (self->gadget,
orientation,
for_size,
minimum, natural,
minimum_baseline, natural_baseline);
}
static void
gtk_gizmo_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)
{
GtkGizmo *self = GTK_GIZMO (widget);
GtkAllocation clip;
GTK_WIDGET_CLASS (gtk_gizmo_parent_class)->size_allocate (widget, allocation);
gtk_css_gadget_allocate (self->gadget,
allocation,
gtk_widget_get_allocated_baseline (widget),
&clip);
gtk_widget_set_clip (widget, &clip);
}
static void
gtk_gizmo_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot)
{
GtkGizmo *self = GTK_GIZMO (widget);
gtk_css_gadget_snapshot (self->gadget, snapshot);
}
static void
gtk_gizmo_measure_contents (GtkCssGadget *gadget,
GtkOrientation orientation,
int for_size,
int *minimum,
int *natural,
int *minimum_baseline,
int *natural_baseline,
gpointer user_data)
{
GtkGizmo *self = GTK_GIZMO (gtk_css_gadget_get_owner (gadget));
if (self->measure_func)
self->measure_func (self, orientation, for_size,
minimum, natural,
minimum_baseline, natural_baseline);
}
static void
gtk_gizmo_allocate_contents (GtkCssGadget *gadget,
const GtkAllocation *allocation,
int baseline,
GtkAllocation *out_clip,
gpointer user_data)
{
GtkGizmo *self = GTK_GIZMO (gtk_css_gadget_get_owner (gadget));
if (self->allocate_func)
self->allocate_func (self,
allocation,
baseline,
out_clip);
}
static gboolean
gtk_gizmo_snapshot_contents (GtkCssGadget *gadget,
GtkSnapshot *snapshot,
int x,
int y,
int width,
int height,
gpointer user_data)
{
GtkGizmo *self = GTK_GIZMO (gtk_css_gadget_get_owner (gadget));
if (self->snapshot_func)
return self->snapshot_func (self, snapshot);
return FALSE;
}
static void
gtk_gizmo_finalize (GObject *obj)
{
GtkGizmo *self = GTK_GIZMO (obj);
g_clear_object (&self->gadget);
G_OBJECT_CLASS (gtk_gizmo_parent_class)->finalize (obj);
}
static void
gtk_gizmo_class_init (GtkGizmoClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
object_class->finalize = gtk_gizmo_finalize;
widget_class->measure = gtk_gizmo_measure;
widget_class->size_allocate = gtk_gizmo_size_allocate;
widget_class->snapshot = gtk_gizmo_snapshot;
}
static void
gtk_gizmo_init (GtkGizmo *self)
{
gtk_widget_set_has_window (GTK_WIDGET (self), FALSE);
self->gadget = gtk_css_custom_gadget_new_for_node (gtk_widget_get_css_node (GTK_WIDGET (self)),
GTK_WIDGET (self),
gtk_gizmo_measure_contents,
gtk_gizmo_allocate_contents,
gtk_gizmo_snapshot_contents,
NULL,
NULL);
}
GtkWidget *
gtk_gizmo_new (const char *css_name,
GtkGizmoMeasureFunc measure_func,
GtkGizmoAllocateFunc allocate_func,
GtkGizmoSnapshotFunc snapshot_func)
{
GtkGizmo *gizmo = GTK_GIZMO (g_object_new (GTK_TYPE_GIZMO,
"css-name", css_name,
NULL));
gizmo->measure_func = measure_func;
gizmo->allocate_func = allocate_func;
gizmo->snapshot_func = snapshot_func;
return GTK_WIDGET (gizmo);
}
+58
View File
@@ -0,0 +1,58 @@
#ifndef __GTK_GIZMO_H__
#define __GTK_GIZMO_H__
#include "gtkwidget.h"
#include "gtkcssgadgetprivate.h"
#include "gtkcsscustomgadgetprivate.h"
#define GTK_TYPE_GIZMO (gtk_gizmo_get_type ())
#define GTK_GIZMO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_GIZMO, GtkGizmo))
#define GTK_GIZMO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_GIZMO, GtkGizmoClass))
#define GTK_IS_GIZMO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_GIZMO))
#define GTK_IS_GIZMO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_GIZMO))
#define GTK_GIZMO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_GIZMO, GtkGizmoClass))
typedef struct _GtkGizmo GtkGizmo;
typedef struct _GtkGizmoClass GtkGizmoClass;
typedef void (* GtkGizmoMeasureFunc) (GtkGizmo *gizmo,
GtkOrientation orientation,
int for_size,
int *minimum,
int *natural,
int *minimum_baseline,
int *natural_baseline);
typedef void (* GtkGizmoAllocateFunc) (GtkGizmo *gizmo,
const GtkAllocation *allocation,
int baseline,
GtkAllocation *out_clip);
typedef gboolean (* GtkGizmoSnapshotFunc) (GtkGizmo *gizmo,
GtkSnapshot *snapshot);
struct _GtkGizmo
{
GtkWidget parent_instance;
GtkCssGadget *gadget;
GtkGizmoMeasureFunc measure_func;
GtkGizmoAllocateFunc allocate_func;
GtkGizmoSnapshotFunc snapshot_func;
};
struct _GtkGizmoClass
{
GtkWidgetClass parent_class;
};
GType gtk_gizmo_get_type (void) G_GNUC_CONST;
GtkWidget *gtk_gizmo_new (const char *css_name,
GtkGizmoMeasureFunc measure_func,
GtkGizmoAllocateFunc allocate_func,
GtkGizmoSnapshotFunc snapshot_func);
#endif
+7 -5
View File
@@ -526,7 +526,6 @@ gtk_grid_remove (GtkContainer *container,
static void
gtk_grid_forall (GtkContainer *container,
gboolean include_internals,
GtkCallback callback,
gpointer callback_data)
{
@@ -1573,12 +1572,14 @@ allocate_child (GtkGridRequest *request,
static void
gtk_grid_request_allocate_children (GtkGridRequest *request,
const GtkAllocation *allocation)
const GtkAllocation *allocation,
GtkAllocation *out_clip)
{
GtkGridPrivate *priv = request->grid->priv;
GList *list;
GtkGridChild *child;
GtkAllocation child_allocation;
GtkAllocation child_clip;
gint x, y, width, height, baseline, ignore;
for (list = priv->children; list; list = list->next)
@@ -1601,6 +1602,8 @@ gtk_grid_request_allocate_children (GtkGridRequest *request,
- (child_allocation.x - allocation->x) - child_allocation.width;
gtk_widget_size_allocate_with_baseline (child->widget, &child_allocation, baseline);
gtk_widget_get_clip (child->widget, &child_clip);
gdk_rectangle_union (out_clip, out_clip, &child_clip);
}
}
@@ -1663,9 +1666,8 @@ gtk_grid_allocate (GtkCssGadget *gadget,
gtk_grid_request_position (&request, 0);
gtk_grid_request_position (&request, 1);
gtk_grid_request_allocate_children (&request, allocation);
gtk_container_get_children_clip (GTK_CONTAINER (grid), out_clip);
*out_clip = *allocation;
gtk_grid_request_allocate_children (&request, allocation, out_clip);
}
static gboolean
+6 -16
View File
@@ -140,7 +140,7 @@ init_sizing_box (GtkHeaderBar *bar)
w = gtk_label_new (NULL);
context = gtk_widget_get_style_context (w);
gtk_style_context_add_class (context, GTK_STYLE_CLASS_TITLE);
gtk_box_pack_start (GTK_BOX (priv->label_sizing_box), w, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (priv->label_sizing_box), w);
gtk_label_set_line_wrap (GTK_LABEL (w), FALSE);
gtk_label_set_single_line_mode (GTK_LABEL (w), TRUE);
gtk_label_set_ellipsize (GTK_LABEL (w), PANGO_ELLIPSIZE_END);
@@ -149,7 +149,7 @@ init_sizing_box (GtkHeaderBar *bar)
w = gtk_label_new (NULL);
context = gtk_widget_get_style_context (w);
gtk_style_context_add_class (context, GTK_STYLE_CLASS_SUBTITLE);
gtk_box_pack_start (GTK_BOX (priv->label_sizing_box), w, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (priv->label_sizing_box), w);
gtk_label_set_line_wrap (GTK_LABEL (w), FALSE);
gtk_label_set_single_line_mode (GTK_LABEL (w), TRUE);
gtk_label_set_ellipsize (GTK_LABEL (w), PANGO_ELLIPSIZE_END);
@@ -177,7 +177,7 @@ create_title_box (const char *title,
gtk_label_set_line_wrap (GTK_LABEL (title_label), FALSE);
gtk_label_set_single_line_mode (GTK_LABEL (title_label), TRUE);
gtk_label_set_ellipsize (GTK_LABEL (title_label), PANGO_ELLIPSIZE_END);
gtk_box_pack_start (GTK_BOX (label_box), title_label, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (label_box), title_label);
gtk_label_set_width_chars (GTK_LABEL (title_label), MIN_TITLE_CHARS);
subtitle_label = gtk_label_new (subtitle);
@@ -186,7 +186,7 @@ create_title_box (const char *title,
gtk_label_set_line_wrap (GTK_LABEL (subtitle_label), FALSE);
gtk_label_set_single_line_mode (GTK_LABEL (subtitle_label), TRUE);
gtk_label_set_ellipsize (GTK_LABEL (subtitle_label), PANGO_ELLIPSIZE_END);
gtk_box_pack_start (GTK_BOX (label_box), subtitle_label, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (label_box), subtitle_label);
gtk_widget_set_visible (subtitle_label, subtitle && subtitle[0]);
if (ret_title_label)
@@ -441,7 +441,7 @@ _gtk_header_bar_update_window_buttons (GtkHeaderBar *bar)
if (button)
{
gtk_box_pack_start (GTK_BOX (box), button, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (box), button);
n_children ++;
}
}
@@ -456,7 +456,7 @@ _gtk_header_bar_update_window_buttons (GtkHeaderBar *bar)
continue;
}
gtk_box_pack_start (GTK_BOX (box), separator, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (box), separator);
if (i == 1)
gtk_box_reorder_child (GTK_BOX (box), separator, 0);
@@ -1656,7 +1656,6 @@ gtk_header_bar_remove (GtkContainer *container,
static void
gtk_header_bar_forall (GtkContainer *container,
gboolean include_internals,
GtkCallback callback,
gpointer callback_data)
{
@@ -1665,9 +1664,6 @@ gtk_header_bar_forall (GtkContainer *container,
Child *child;
GList *children;
if (include_internals && priv->titlebar_start_box != NULL)
(* callback) (priv->titlebar_start_box, callback_data);
children = priv->children;
while (children)
{
@@ -1680,9 +1676,6 @@ gtk_header_bar_forall (GtkContainer *container,
if (priv->custom_title != NULL)
(* callback) (priv->custom_title, callback_data);
if (include_internals && priv->label_box != NULL)
(* callback) (priv->label_box, callback_data);
children = priv->children;
while (children)
{
@@ -1691,9 +1684,6 @@ gtk_header_bar_forall (GtkContainer *container,
if (child->pack_type == GTK_PACK_END)
(* callback) (child->widget, callback_data);
}
if (include_internals && priv->titlebar_end_box != NULL)
(* callback) (priv->titlebar_end_box, callback_data);
}
static void
-2
View File
@@ -176,7 +176,6 @@ static gboolean gtk_icon_view_key_release (GtkWidget
static void gtk_icon_view_remove (GtkContainer *container,
GtkWidget *widget);
static void gtk_icon_view_forall (GtkContainer *container,
gboolean include_internals,
GtkCallback callback,
gpointer callback_data);
@@ -1987,7 +1986,6 @@ gtk_icon_view_remove (GtkContainer *container,
static void
gtk_icon_view_forall (GtkContainer *container,
gboolean include_internals,
GtkCallback callback,
gpointer callback_data)
{
+1 -2
View File
@@ -518,8 +518,7 @@ gtk_info_bar_add_action_widget (GtkInfoBar *info_bar,
else
g_warning ("Only 'activatable' widgets can be packed into the action area of a GtkInfoBar");
gtk_box_pack_end (GTK_BOX (info_bar->priv->action_area),
child, FALSE, FALSE);
gtk_box_pack_end (GTK_BOX (info_bar->priv->action_area), child);
if (response_id == GTK_RESPONSE_HELP)
gtk_button_box_set_child_secondary (GTK_BUTTON_BOX (info_bar->priv->action_area),
child, TRUE);
+27 -306
View File
@@ -262,7 +262,6 @@ struct _GtkLabelPrivate
gchar *label;
gchar *text;
gdouble angle;
gfloat xalign;
gfloat yalign;
@@ -273,7 +272,6 @@ struct _GtkLabelPrivate
guint use_markup : 1;
guint ellipsize : 3;
guint single_line_mode : 1;
guint have_transform : 1;
guint in_click : 1;
guint wrap_mode : 3;
guint pattern_set : 1;
@@ -376,7 +374,6 @@ enum {
PROP_ELLIPSIZE,
PROP_WIDTH_CHARS,
PROP_SINGLE_LINE_MODE,
PROP_ANGLE,
PROP_MAX_WIDTH_CHARS,
PROP_TRACK_VISITED_LINKS,
PROP_LINES,
@@ -387,11 +384,6 @@ enum {
static GParamSpec *label_props[NUM_PROPERTIES] = { NULL, };
/* When rotating ellipsizable text we want the natural size to request
* more to ensure the label wont ever ellipsize in an allocation of full natural size.
* */
#define ROTATION_ELLIPSIZE_PADDING 2
static guint signals[LAST_SIGNAL] = { 0 };
static GQuark quark_shortcuts_connected;
@@ -982,24 +974,6 @@ gtk_label_class_init (GtkLabelClass *class)
FALSE,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
/**
* GtkLabel:angle:
*
* The angle that the baseline of the label makes with the horizontal,
* in degrees, measured counterclockwise. An angle of 90 reads from
* from bottom to top, an angle of 270, from top to bottom. Ignored
* if the label is selectable.
*
* Since: 2.6
**/
label_props[PROP_ANGLE] =
g_param_spec_double ("angle",
P_("Angle"),
P_("Angle at which the label is rotated"),
0.0, 360.0,
0.0,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
/**
* GtkLabel:max-width-chars:
*
@@ -1231,9 +1205,6 @@ gtk_label_set_property (GObject *object,
case PROP_SINGLE_LINE_MODE:
gtk_label_set_single_line_mode (label, g_value_get_boolean (value));
break;
case PROP_ANGLE:
gtk_label_set_angle (label, g_value_get_double (value));
break;
case PROP_MAX_WIDTH_CHARS:
gtk_label_set_max_width_chars (label, g_value_get_int (value));
break;
@@ -1311,9 +1282,6 @@ gtk_label_get_property (GObject *object,
case PROP_SINGLE_LINE_MODE:
g_value_set_boolean (value, gtk_label_get_single_line_mode (label));
break;
case PROP_ANGLE:
g_value_set_double (value, gtk_label_get_angle (label));
break;
case PROP_MAX_WIDTH_CHARS:
g_value_set_int (value, gtk_label_get_max_width_chars (label));
break;
@@ -3363,83 +3331,16 @@ static void
gtk_label_update_layout_width (GtkLabel *label)
{
GtkLabelPrivate *priv = label->priv;
GtkWidget *widget = GTK_WIDGET (label);
g_assert (priv->layout);
if (priv->ellipsize || priv->wrap)
{
GtkAllocation allocation;
PangoRectangle logical;
gint width, height;
gtk_css_gadget_get_content_allocation (priv->gadget, &allocation, NULL);
width = allocation.width;
height = allocation.height;
if (priv->have_transform)
{
PangoContext *context = gtk_widget_get_pango_context (widget);
const PangoMatrix *matrix = pango_context_get_matrix (context);
const gdouble dx = matrix->xx; /* cos (M_PI * angle / 180) */
const gdouble dy = matrix->xy; /* sin (M_PI * angle / 180) */
pango_layout_set_width (priv->layout, -1);
pango_layout_get_pixel_extents (priv->layout, NULL, &logical);
if (fabs (dy) < 0.01)
{
if (logical.width > width)
pango_layout_set_width (priv->layout, width * PANGO_SCALE);
}
else if (fabs (dx) < 0.01)
{
if (logical.width > height)
pango_layout_set_width (priv->layout, height * PANGO_SCALE);
}
else
{
gdouble x0, y0, x1, y1, length;
gboolean vertical;
gint cy;
x0 = width / 2;
y0 = dx ? x0 * dy / dx : G_MAXDOUBLE;
vertical = fabs (y0) > height / 2.0;
if (vertical)
{
y0 = height/2;
x0 = dy ? y0 * dx / dy : G_MAXDOUBLE;
}
length = 2 * sqrt (x0 * x0 + y0 * y0);
pango_layout_set_width (priv->layout, rint (length * PANGO_SCALE));
pango_layout_get_pixel_size (priv->layout, NULL, &cy);
x1 = +dy * cy/2;
y1 = -dx * cy/2;
if (vertical)
{
y0 = height/2 + y1 - y0;
x0 = -y0 * dx/dy;
}
else
{
x0 = width/2 + x1 - x0;
y0 = -x0 * dy/dx;
}
length = length - sqrt (x0 * x0 + y0 * y0) * 2;
pango_layout_set_width (priv->layout, rint (length * PANGO_SCALE));
}
}
else
{
pango_layout_set_width (priv->layout, width * PANGO_SCALE);
}
pango_layout_set_width (priv->layout, allocation.width * PANGO_SCALE);
}
else
{
@@ -3523,29 +3424,6 @@ gtk_label_ensure_layout (GtkLabel *label)
if (!priv->layout)
{
PangoAlignment align = PANGO_ALIGN_LEFT; /* Quiet gcc */
gdouble angle = gtk_label_get_angle (label);
if (angle != 0.0 && !priv->select_info)
{
PangoMatrix matrix = PANGO_MATRIX_INIT;
/* We rotate the standard singleton PangoContext for the widget,
* depending on the fact that it's meant pretty much exclusively
* for our use.
*/
pango_matrix_rotate (&matrix, angle);
pango_context_set_matrix (gtk_widget_get_pango_context (widget), &matrix);
priv->have_transform = TRUE;
}
else
{
if (priv->have_transform)
pango_context_set_matrix (gtk_widget_get_pango_context (widget), NULL);
priv->have_transform = FALSE;
}
priv->layout = gtk_widget_create_pango_layout (widget, priv->text);
@@ -3585,46 +3463,35 @@ static GtkSizeRequestMode
gtk_label_get_request_mode (GtkWidget *widget)
{
GtkLabel *label = GTK_LABEL (widget);
gdouble angle;
angle = gtk_label_get_angle (label);
if (label->priv->wrap)
return (angle == 90 || angle == 270)
? GTK_SIZE_REQUEST_WIDTH_FOR_HEIGHT
: GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH;
return GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH;
return GTK_SIZE_REQUEST_CONSTANT_SIZE;
}
static void
get_size_for_allocation (GtkLabel *label,
gint allocation,
gint *minimum_size,
gint *natural_size,
gint *minimum_baseline,
gint *natural_baseline)
get_height_for_width (GtkLabel *label,
gint width,
gint *minimum_height,
gint *natural_height,
gint *minimum_baseline,
gint *natural_baseline)
{
PangoLayout *layout;
gint text_height, baseline;
layout = gtk_label_get_measuring_layout (label, NULL, allocation * PANGO_SCALE);
layout = gtk_label_get_measuring_layout (label, NULL, width * PANGO_SCALE);
pango_layout_get_pixel_size (layout, NULL, &text_height);
*minimum_size = text_height;
*natural_size = text_height;
*minimum_height = text_height;
*natural_height = text_height;
if (minimum_baseline || natural_baseline)
{
baseline = pango_layout_get_baseline (layout) / PANGO_SCALE;
if (minimum_baseline)
*minimum_baseline = baseline;
if (natural_baseline)
*natural_baseline = baseline;
}
baseline = pango_layout_get_baseline (layout) / PANGO_SCALE;
*minimum_baseline = baseline;
*natural_baseline = baseline;
g_object_unref (layout);
}
@@ -3706,15 +3573,15 @@ gtk_label_get_preferred_layout_size (GtkLabel *label,
widest->width = MAX (widest->width, char_pixels * priv->width_chars);
widest->x = widest->y = 0;
}
if (widest->width < smallest->width)
*smallest = *widest;
}
else
{
*smallest = *widest;
}
if (widest->width < smallest->width)
*smallest = *widest;
g_object_unref (layout);
}
@@ -3727,42 +3594,11 @@ gtk_label_get_preferred_size (GtkWidget *widget,
gint *natural_baseline)
{
GtkLabel *label = GTK_LABEL (widget);
GtkLabelPrivate *priv = label->priv;
PangoRectangle widest_rect;
PangoRectangle smallest_rect;
gtk_label_get_preferred_layout_size (label, &smallest_rect, &widest_rect);
/* Now that we have minimum and natural sizes in pango extents, apply a possible transform */
if (priv->have_transform)
{
PangoContext *context;
const PangoMatrix *matrix;
context = pango_layout_get_context (priv->layout);
matrix = pango_context_get_matrix (context);
pango_matrix_transform_rectangle (matrix, &widest_rect);
pango_matrix_transform_rectangle (matrix, &smallest_rect);
/* Bump the size in case of ellipsize to ensure pango has
* enough space in the angles (note, we could alternatively set the
* layout to not ellipsize when we know we have been allocated our
* full size, or it may be that pango needs a fix here).
*/
if (priv->ellipsize && priv->angle != 0 && priv->angle != 90 &&
priv->angle != 180 && priv->angle != 270 && priv->angle != 360)
{
/* For some reason we only need this at about 110 degrees, and only
* when gaining in height
*/
widest_rect.height += ROTATION_ELLIPSIZE_PADDING * 2 * PANGO_SCALE;
widest_rect.width += ROTATION_ELLIPSIZE_PADDING * 2 * PANGO_SCALE;
smallest_rect.height += ROTATION_ELLIPSIZE_PADDING * 2 * PANGO_SCALE;
smallest_rect.width += ROTATION_ELLIPSIZE_PADDING * 2 * PANGO_SCALE;
}
}
widest_rect.width = PANGO_PIXELS_CEIL (widest_rect.width);
widest_rect.height = PANGO_PIXELS_CEIL (widest_rect.height);
@@ -3771,27 +3607,9 @@ gtk_label_get_preferred_size (GtkWidget *widget,
if (orientation == GTK_ORIENTATION_HORIZONTAL)
{
/* Note, we cant use get_size_for_allocation() when rotating
* ellipsized labels.
*/
if (!(priv->ellipsize && priv->have_transform) &&
(priv->angle == 90 || priv->angle == 270))
{
/* Doing a h4w request on a rotated label here, return the
* required width for the minimum height.
*/
get_size_for_allocation (label,
smallest_rect.height,
minimum_size, natural_size,
NULL, NULL);
}
else
{
/* Normal desired width */
*minimum_size = smallest_rect.width;
*natural_size = widest_rect.width;
}
/* Normal desired width */
*minimum_size = smallest_rect.width;
*natural_size = widest_rect.width;
if (minimum_baseline)
*minimum_baseline = -1;
@@ -3801,36 +3619,8 @@ gtk_label_get_preferred_size (GtkWidget *widget,
}
else /* GTK_ORIENTATION_VERTICAL */
{
/* Note, we cant use get_size_for_allocation() when rotating
* ellipsized labels.
*/
if (!(priv->ellipsize && priv->have_transform) &&
(priv->angle == 0 || priv->angle == 180 || priv->angle == 360))
{
/* Doing a w4h request on a label here, return the required
* height for the minimum width.
*/
get_size_for_allocation (label,
widest_rect.width,
minimum_size, natural_size,
minimum_baseline, natural_baseline);
if (priv->angle == 180)
{
if (minimum_baseline)
*minimum_baseline = *minimum_size - *minimum_baseline;
if (natural_baseline)
*natural_baseline = *natural_size - *natural_baseline;
}
}
else
{
/* A vertically rotated label does w4h, so return the base
* desired height (text length)
*/
*minimum_size = MIN (smallest_rect.height, widest_rect.height);
*natural_size = MAX (smallest_rect.height, widest_rect.height);
}
*minimum_size = MIN (smallest_rect.height, widest_rect.height);
*natural_size = MAX (smallest_rect.height, widest_rect.height);
}
}
@@ -3852,13 +3642,11 @@ gtk_label_measure (GtkCssGadget *gadget,
label = GTK_LABEL (widget);
priv = label->priv;
if ((orientation == GTK_ORIENTATION_VERTICAL && for_size != -1 && priv->wrap && (priv->angle == 0 || priv->angle == 180 || priv->angle == 360)) ||
(orientation == GTK_ORIENTATION_HORIZONTAL && priv->wrap && (priv->angle == 90 || priv->angle == 270)))
if (orientation == GTK_ORIENTATION_VERTICAL && for_size != -1 && priv->wrap)
{
if (priv->wrap)
gtk_label_clear_layout (label);
gtk_label_clear_layout (label);
get_size_for_allocation (label, for_size, minimum, natural, minimum_baseline, natural_baseline);
get_height_for_width (label, for_size, minimum, natural, minimum_baseline, natural_baseline);
}
else
gtk_label_get_preferred_size (widget, orientation, minimum, natural, minimum_baseline, natural_baseline);
@@ -3905,13 +3693,6 @@ get_layout_location (GtkLabel *label,
pango_layout_get_extents (priv->layout, NULL, &logical);
if (priv->have_transform)
{
PangoContext *context = gtk_widget_get_pango_context (widget);
const PangoMatrix *matrix = pango_context_get_matrix (context);
pango_matrix_transform_rectangle (matrix, &logical);
}
pango_extents_to_pixels (&logical, NULL);
req_width = logical.width;
@@ -3924,7 +3705,7 @@ get_layout_location (GtkLabel *label,
x = floor (allocation.x + xalign * (allocation.width - req_width) - logical.x);
baseline_offset = 0;
if (baseline != -1 && !priv->have_transform)
if (baseline != -1)
{
layout_baseline = pango_layout_get_baseline (priv->layout) / PANGO_SCALE;
baseline_offset = baseline - layout_baseline;
@@ -4005,7 +3786,7 @@ gtk_label_size_allocate (GtkWidget *widget,
gtk_label_get_ink_rect (label, &clip_rect);
gdk_rectangle_union (&clip_rect, &clip, &clip_rect);
_gtk_widget_set_simple_clip (widget, &clip_rect);
gtk_widget_set_clip (widget, &clip_rect);
}
static void
@@ -5469,66 +5250,6 @@ gtk_label_get_selectable (GtkLabel *label)
return priv->select_info && priv->select_info->selectable;
}
/**
* gtk_label_set_angle:
* @label: a #GtkLabel
* @angle: the angle that the baseline of the label makes with
* the horizontal, in degrees, measured counterclockwise
*
* Sets the angle of rotation for the label. An angle of 90 reads from
* from bottom to top, an angle of 270, from top to bottom. The angle
* setting for the label is ignored if the label is selectable,
* wrapped, or ellipsized.
*
* Since: 2.6
**/
void
gtk_label_set_angle (GtkLabel *label,
gdouble angle)
{
GtkLabelPrivate *priv;
g_return_if_fail (GTK_IS_LABEL (label));
priv = label->priv;
/* Canonicalize to [0,360]. We don't canonicalize 360 to 0, because
* double property ranges are inclusive, and changing 360 to 0 would
* make a property editor behave strangely.
*/
if (angle < 0 || angle > 360.0)
angle = angle - 360. * floor (angle / 360.);
if (priv->angle != angle)
{
priv->angle = angle;
gtk_label_clear_layout (label);
gtk_widget_queue_resize (GTK_WIDGET (label));
g_object_notify_by_pspec (G_OBJECT (label), label_props[PROP_ANGLE]);
}
}
/**
* gtk_label_get_angle:
* @label: a #GtkLabel
*
* Gets the angle of rotation for the label. See
* gtk_label_set_angle().
*
* Returns: the angle of rotation for the label
*
* Since: 2.6
**/
gdouble
gtk_label_get_angle (GtkLabel *label)
{
g_return_val_if_fail (GTK_IS_LABEL (label), 0.0);
return label->priv->angle;
}
static void
gtk_label_set_selection_text (GtkLabel *label,
GtkSelectionData *selection_data)
-5
View File
@@ -177,11 +177,6 @@ void gtk_label_set_selectable (GtkLabel *label,
GDK_AVAILABLE_IN_ALL
gboolean gtk_label_get_selectable (GtkLabel *label);
GDK_AVAILABLE_IN_ALL
void gtk_label_set_angle (GtkLabel *label,
gdouble angle);
GDK_AVAILABLE_IN_ALL
gdouble gtk_label_get_angle (GtkLabel *label);
GDK_AVAILABLE_IN_ALL
void gtk_label_select_region (GtkLabel *label,
gint start_offset,
gint end_offset);
-2
View File
@@ -137,7 +137,6 @@ static void gtk_layout_add (GtkContainer *container,
static void gtk_layout_remove (GtkContainer *container,
GtkWidget *widget);
static void gtk_layout_forall (GtkContainer *container,
gboolean include_internals,
GtkCallback callback,
gpointer callback_data);
static void gtk_layout_set_child_property (GtkContainer *container,
@@ -935,7 +934,6 @@ gtk_layout_remove (GtkContainer *container,
static void
gtk_layout_forall (GtkContainer *container,
gboolean include_internals,
GtkCallback callback,
gpointer callback_data)
{
+105 -138
View File
@@ -121,7 +121,6 @@
#include "gtkbuildable.h"
#include "gtkbuilderprivate.h"
#include "gtkcsscustomgadgetprivate.h"
#include "gtkintl.h"
#include "gtkorientableprivate.h"
#include "gtklevelbar.h"
@@ -133,6 +132,7 @@
#include "gtkstylecontextprivate.h"
#include "gtkcssstylepropertyprivate.h"
#include "gtkcssnodeprivate.h"
#include "gtkgizmoprivate.h"
#include <math.h>
#include <stdlib.h>
@@ -175,8 +175,8 @@ struct _GtkLevelBarPrivate {
GList *offsets;
GtkCssGadget *trough_gadget;
GtkCssGadget **block_gadget;
GtkWidget *trough_widget;
GtkWidget **block_widget;
guint n_blocks;
guint inverted : 1;
@@ -302,16 +302,16 @@ gtk_level_bar_get_min_block_size (GtkLevelBar *self,
for (i = 0; i < n_blocks; i++)
{
gtk_css_gadget_get_preferred_size (self->priv->block_gadget[i],
GTK_ORIENTATION_HORIZONTAL,
-1,
&width, NULL,
NULL, NULL);
gtk_css_gadget_get_preferred_size (self->priv->block_gadget[i],
GTK_ORIENTATION_VERTICAL,
-1,
&height, NULL,
NULL, NULL);
gtk_widget_measure (self->priv->block_widget[i],
GTK_ORIENTATION_HORIZONTAL,
-1,
&width, NULL,
NULL, NULL);
gtk_widget_measure (self->priv->block_widget[i],
GTK_ORIENTATION_VERTICAL,
-1,
&height, NULL,
NULL, NULL);
*block_width = MAX (width, *block_width);
*block_height = MAX (height, *block_height);
@@ -328,49 +328,34 @@ gtk_level_bar_get_real_inverted (GtkLevelBar *self)
return self->priv->inverted;
}
static void
gtk_level_bar_snapshot_fill_continuous (GtkLevelBar *self,
GtkSnapshot *snapshot)
{
gboolean inverted;
inverted = gtk_level_bar_get_real_inverted (self);
/* render the empty (unfilled) part */
gtk_css_gadget_snapshot (self->priv->block_gadget[inverted ? 0 : 1], snapshot);
/* now render the filled part on top of it */
gtk_css_gadget_snapshot (self->priv->block_gadget[inverted ? 1 : 0], snapshot);
}
static void
gtk_level_bar_snapshot_fill_discrete (GtkLevelBar *self,
GtkSnapshot *snapshot)
{
gint num_blocks, i;
num_blocks = gtk_level_bar_get_num_blocks (self);
for (i = 0; i < num_blocks; i++)
gtk_css_gadget_snapshot (self->priv->block_gadget[i], snapshot);
}
static gboolean
gtk_level_bar_render_trough (GtkCssGadget *gadget,
GtkSnapshot *snapshot,
int x,
int y,
int width,
int height,
gpointer data)
gtk_level_bar_render_trough (GtkGizmo *gizmo,
GtkSnapshot *snapshot)
{
GtkWidget *widget = gtk_css_gadget_get_owner (gadget);
GtkLevelBar *self = GTK_LEVEL_BAR (widget);
GtkWidget *widget = GTK_WIDGET (gizmo);
GtkLevelBar *self = GTK_LEVEL_BAR (gtk_widget_get_parent (GTK_WIDGET (gizmo)));
if (self->priv->bar_mode == GTK_LEVEL_BAR_MODE_CONTINUOUS)
gtk_level_bar_snapshot_fill_continuous (self, snapshot);
{
gboolean inverted;
inverted = gtk_level_bar_get_real_inverted (self);
/* render the empty (unfilled) part */
gtk_widget_snapshot_child (widget, self->priv->block_widget[inverted ? 0 : 1], snapshot);
/* now render the filled part on top of it */
gtk_widget_snapshot_child (widget, self->priv->block_widget[inverted ? 1 : 0], snapshot);
}
else
gtk_level_bar_snapshot_fill_discrete (self, snapshot);
{
gint num_blocks, i;
num_blocks = gtk_level_bar_get_num_blocks (self);
for (i = 0; i < num_blocks; i++)
gtk_widget_snapshot_child (widget, self->priv->block_widget[i], snapshot);
}
return FALSE;
}
@@ -381,21 +366,20 @@ gtk_level_bar_snapshot (GtkWidget *widget,
{
GtkLevelBar *self = GTK_LEVEL_BAR (widget);
gtk_css_gadget_snapshot (self->priv->trough_gadget, snapshot);
gtk_widget_snapshot_child (widget, self->priv->trough_widget, snapshot);
}
static void
gtk_level_bar_measure_trough (GtkCssGadget *gadget,
gtk_level_bar_measure_trough (GtkGizmo *gizmo,
GtkOrientation orientation,
int for_size,
int *minimum,
int *natural,
int *minimum_baseline,
int *natural_baseline,
gpointer data)
int *natural_baseline)
{
GtkWidget *widget = gtk_css_gadget_get_owner (gadget);
GtkLevelBar *self = GTK_LEVEL_BAR (widget);
GtkWidget *widget = GTK_WIDGET (gizmo);
GtkLevelBar *self = GTK_LEVEL_BAR (gtk_widget_get_parent (widget));
gint num_blocks, size;
gint block_width, block_height;
@@ -430,11 +414,11 @@ gtk_level_bar_measure (GtkWidget *widget,
int *minimum_baseline,
int *natural_baseline)
{
gtk_css_gadget_get_preferred_size (GTK_LEVEL_BAR (widget)->priv->trough_gadget,
orientation,
for_size,
minimum, natural,
minimum_baseline, natural_baseline);
gtk_widget_measure (GTK_LEVEL_BAR (widget)->priv->trough_widget,
orientation,
for_size,
minimum, natural,
minimum_baseline, natural_baseline);
}
static void
@@ -451,10 +435,10 @@ gtk_level_bar_allocate_trough_continuous (GtkLevelBar *self,
/* allocate the empty (unfilled) part */
block_area = *allocation;
gtk_css_gadget_allocate (self->priv->block_gadget[inverted ? 0 : 1],
&block_area,
baseline,
out_clip);
gtk_widget_size_allocate_with_baseline (self->priv->block_widget[inverted ? 0 : 1],
&block_area,
baseline);
gtk_widget_get_clip (self->priv->block_widget[inverted ? 0 : 1], out_clip);
/* now allocate the filled part */
block_area = *allocation;
@@ -476,10 +460,10 @@ gtk_level_bar_allocate_trough_continuous (GtkLevelBar *self,
block_area.y += allocation->height - block_area.height;
}
gtk_css_gadget_allocate (self->priv->block_gadget[inverted ? 1 : 0],
&block_area,
baseline,
&clip);
gtk_widget_size_allocate_with_baseline (self->priv->block_widget[inverted ? 1 : 0],
&block_area,
baseline);
gtk_widget_get_clip (self->priv->block_widget[inverted ? 1 : 0], &clip);
gdk_rectangle_intersect (out_clip, &clip, out_clip);
}
@@ -514,10 +498,10 @@ gtk_level_bar_allocate_trough_discrete (GtkLevelBar *self,
for (i = 0; i < num_blocks; i++)
{
gtk_css_gadget_allocate (self->priv->block_gadget[i],
&block_area,
baseline,
&clip);
gtk_widget_size_allocate_with_baseline (self->priv->block_widget[i],
&block_area,
baseline);
gtk_widget_get_clip (self->priv->block_widget[i], &clip);
gdk_rectangle_intersect (out_clip, &clip, out_clip);
if (self->priv->orientation == GTK_ORIENTATION_HORIZONTAL)
@@ -528,14 +512,13 @@ gtk_level_bar_allocate_trough_discrete (GtkLevelBar *self,
}
static void
gtk_level_bar_allocate_trough (GtkCssGadget *gadget,
gtk_level_bar_allocate_trough (GtkGizmo *gizmo,
const GtkAllocation *allocation,
int baseline,
GtkAllocation *out_clip,
gpointer data)
GtkAllocation *out_clip)
{
GtkWidget *widget = gtk_css_gadget_get_owner (gadget);
GtkLevelBar *self = GTK_LEVEL_BAR (widget);
GtkWidget *widget = GTK_WIDGET (gizmo);
GtkLevelBar *self = GTK_LEVEL_BAR (gtk_widget_get_parent (widget));
if (self->priv->bar_mode == GTK_LEVEL_BAR_MODE_CONTINUOUS)
gtk_level_bar_allocate_trough_continuous (self, allocation, baseline, out_clip);
@@ -547,14 +530,13 @@ static void
gtk_level_bar_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)
{
GtkLevelBarPrivate *priv = gtk_level_bar_get_instance_private (GTK_LEVEL_BAR (widget));
GtkAllocation clip;
GTK_WIDGET_CLASS (gtk_level_bar_parent_class)->size_allocate (widget, allocation);
gtk_css_gadget_allocate (GTK_LEVEL_BAR (widget)->priv->trough_gadget,
allocation,
gtk_widget_get_allocated_baseline (widget),
&clip);
gtk_widget_size_allocate (priv->trough_widget, allocation);
gtk_widget_get_clip (priv->trough_widget, &clip);
gtk_widget_set_clip (widget, &clip);
}
@@ -563,7 +545,6 @@ static void
update_block_nodes (GtkLevelBar *self)
{
GtkLevelBarPrivate *priv = self->priv;
GtkCssNode *trough_node = gtk_css_gadget_get_node (priv->trough_gadget);
guint n_blocks;
guint i;
@@ -575,24 +556,18 @@ update_block_nodes (GtkLevelBar *self)
{
for (i = n_blocks; i < priv->n_blocks; i++)
{
gtk_css_node_set_parent (gtk_css_gadget_get_node (priv->block_gadget[i]), NULL);
g_clear_object (&priv->block_gadget[i]);
gtk_widget_unparent (priv->block_widget[i]);
}
priv->block_gadget = g_renew (GtkCssGadget*, priv->block_gadget, n_blocks);
priv->block_widget = g_renew (GtkWidget*, priv->block_widget, n_blocks);
priv->n_blocks = n_blocks;
}
else
{
priv->block_gadget = g_renew (GtkCssGadget*, priv->block_gadget, n_blocks);
priv->block_widget = g_renew (GtkWidget*, priv->block_widget, n_blocks);
for (i = priv->n_blocks; i < n_blocks; i++)
{
priv->block_gadget[i] = gtk_css_custom_gadget_new ("block",
GTK_WIDGET (self),
priv->trough_gadget,
NULL,
NULL, NULL, NULL,
NULL, NULL);
gtk_css_gadget_set_state (priv->block_gadget[i], gtk_css_node_get_state (trough_node));
priv->block_widget[i] = gtk_gizmo_new ("block", NULL, NULL, NULL);
gtk_widget_insert_before (priv->block_widget[i], GTK_WIDGET (priv->trough_widget), NULL);
}
priv->n_blocks = n_blocks;
}
@@ -617,30 +592,11 @@ update_mode_style_classes (GtkLevelBar *self)
}
}
static void
gtk_level_bar_state_flags_changed (GtkWidget *widget,
GtkStateFlags previous_state)
{
GtkLevelBar *self = GTK_LEVEL_BAR (widget);
GtkLevelBarPrivate *priv = self->priv;
GtkStateFlags state;
gint i;
state = gtk_widget_get_state_flags (widget);
gtk_css_gadget_set_state (priv->trough_gadget, state);
for (i = 0; i < priv->n_blocks; i++)
gtk_css_gadget_set_state (priv->block_gadget[i], state);
GTK_WIDGET_CLASS (gtk_level_bar_parent_class)->state_flags_changed (widget, previous_state);
}
static void
update_level_style_classes (GtkLevelBar *self)
{
GtkLevelBarPrivate *priv = self->priv;
gdouble value;
const gchar *classes[3] = { NULL, NULL, NULL };
const gchar *value_class = NULL;
GtkLevelBarOffset *offset, *prev_offset;
GList *l;
@@ -680,15 +636,33 @@ update_level_style_classes (GtkLevelBar *self)
else
num_filled = MIN (num_blocks, (gint) round (priv->cur_value) - (gint) round (priv->min_value));
classes[0] = "filled";
classes[1] = value_class;
for (i = 0; i < num_filled; i++)
gtk_css_node_set_classes (gtk_css_gadget_get_node (priv->block_gadget[inverted ? num_blocks - 1 - i : i]), classes);
{
GtkStyleContext *context = gtk_widget_get_style_context (priv->block_widget[inverted ? num_blocks - 1 - i : i]);
GList *classes = gtk_style_context_list_classes (context);
for (l = classes; l; l = l->next)
gtk_style_context_remove_class (context, l->data);
g_list_free (classes);
gtk_style_context_add_class (context, "filled");
if (value_class)
gtk_style_context_add_class (context, value_class);
}
classes[0] = "empty";
classes[1] = NULL;
for (; i < num_blocks; i++)
gtk_css_node_set_classes (gtk_css_gadget_get_node (priv->block_gadget[inverted ? num_blocks - 1 - i : i]), classes);
{
GtkStyleContext *context = gtk_widget_get_style_context (priv->block_widget[inverted ? num_blocks - 1 - i : i]);
GList *classes = gtk_style_context_list_classes (context);
for (l = classes; l; l = l->next)
gtk_style_context_remove_class (context, l->data);
g_list_free (classes);
gtk_style_context_add_class (context, "empty");
}
}
static void
@@ -940,10 +914,11 @@ gtk_level_bar_finalize (GObject *obj)
g_list_free_full (priv->offsets, (GDestroyNotify) gtk_level_bar_offset_free);
for (i = 0; i < priv->n_blocks; i++)
g_clear_object (&priv->block_gadget[i]);
g_free (priv->block_gadget);
gtk_widget_unparent (priv->block_widget[i]);
g_clear_object (&priv->trough_gadget);
g_free (priv->block_widget);
gtk_widget_unparent (priv->trough_widget);
G_OBJECT_CLASS (gtk_level_bar_parent_class)->finalize (obj);
}
@@ -961,7 +936,6 @@ gtk_level_bar_class_init (GtkLevelBarClass *klass)
wclass->snapshot = gtk_level_bar_snapshot;
wclass->size_allocate = gtk_level_bar_size_allocate;
wclass->measure = gtk_level_bar_measure;
wclass->state_flags_changed = gtk_level_bar_state_flags_changed;
wclass->direction_changed = gtk_level_bar_direction_changed;
g_object_class_override_property (oclass, PROP_ORIENTATION, "orientation");
@@ -1082,7 +1056,6 @@ static void
gtk_level_bar_init (GtkLevelBar *self)
{
GtkLevelBarPrivate *priv;
GtkCssNode *widget_node, *trough_node;
priv = self->priv = gtk_level_bar_get_instance_private (self);
@@ -1098,23 +1071,17 @@ gtk_level_bar_init (GtkLevelBar *self)
gtk_widget_set_has_window (GTK_WIDGET (self), FALSE);
widget_node = gtk_widget_get_css_node (GTK_WIDGET (self));
priv->trough_gadget = gtk_css_custom_gadget_new ("trough",
GTK_WIDGET (self),
NULL, NULL,
gtk_level_bar_measure_trough,
gtk_level_bar_allocate_trough,
gtk_level_bar_render_trough,
NULL, NULL);
trough_node = gtk_css_gadget_get_node (priv->trough_gadget);
gtk_css_node_set_parent (trough_node, widget_node);
gtk_css_node_set_state (trough_node, gtk_css_node_get_state (widget_node));
priv->trough_widget = gtk_gizmo_new ("trough",
gtk_level_bar_measure_trough,
gtk_level_bar_allocate_trough,
gtk_level_bar_render_trough);
gtk_widget_set_parent (priv->trough_widget, GTK_WIDGET (self));
gtk_level_bar_ensure_offset (self, GTK_LEVEL_BAR_OFFSET_LOW, 0.25);
gtk_level_bar_ensure_offset (self, GTK_LEVEL_BAR_OFFSET_HIGH, 0.75);
gtk_level_bar_ensure_offset (self, GTK_LEVEL_BAR_OFFSET_FULL, 1.0);
priv->block_gadget = NULL;
priv->block_widget = NULL;
priv->n_blocks = 0;
priv->bar_mode = GTK_LEVEL_BAR_MODE_CONTINUOUS;
@@ -1221,7 +1188,7 @@ gtk_level_bar_set_value_internal (GtkLevelBar *self,
{
self->priv->cur_value = value;
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_VALUE]);
gtk_widget_queue_allocate (GTK_WIDGET (self));
gtk_widget_queue_allocate (GTK_WIDGET (self->priv->trough_widget));
}
/**
+26 -17
View File
@@ -221,7 +221,6 @@ static void gtk_list_box_add (GtkContai
static void gtk_list_box_remove (GtkContainer *container,
GtkWidget *widget);
static void gtk_list_box_forall (GtkContainer *container,
gboolean include_internals,
GtkCallback callback,
gpointer callback_target);
static void gtk_list_box_compute_expand (GtkWidget *widget,
@@ -2166,10 +2165,7 @@ gtk_list_box_realize (GtkWidget *widget)
&allocation);
gdk_window_set_user_data (priv->view_window, (GObject*) widget);
gtk_list_box_forall (GTK_CONTAINER (widget),
TRUE,
(GtkCallback) gtk_widget_set_parent_window,
priv->view_window);
gtk_widget_forall (widget, (GtkCallback)gtk_widget_set_parent_window, priv->view_window);
GTK_WIDGET_CLASS (gtk_list_box_parent_class)->realize (widget);
}
@@ -2484,6 +2480,16 @@ gtk_list_box_remove (GtkContainer *container,
was_visible = gtk_widget_get_visible (child);
if (child == priv->placeholder)
{
gtk_widget_unparent (child);
priv->placeholder = NULL;
if (was_visible && gtk_widget_get_visible (widget))
gtk_widget_queue_resize (widget);
return;
}
if (!GTK_IS_LIST_BOX_ROW (child))
{
row = g_hash_table_lookup (priv->header_hash, child);
@@ -2557,7 +2563,6 @@ gtk_list_box_remove (GtkContainer *container,
static void
gtk_list_box_forall (GtkContainer *container,
gboolean include_internals,
GtkCallback callback,
gpointer callback_target)
{
@@ -2565,7 +2570,7 @@ gtk_list_box_forall (GtkContainer *container,
GSequenceIter *iter;
GtkListBoxRow *row;
if (priv->placeholder != NULL && include_internals)
if (priv->placeholder != NULL)
callback (priv->placeholder, callback_target);
iter = g_sequence_get_begin_iter (priv->children);
@@ -2573,8 +2578,6 @@ gtk_list_box_forall (GtkContainer *container,
{
row = g_sequence_get (iter);
iter = g_sequence_iter_next (iter);
if (ROW_PRIV (row)->header != NULL && include_internals)
callback (ROW_PRIV (row)->header, callback_target);
callback (GTK_WIDGET (row), callback_target);
}
}
@@ -2734,7 +2737,7 @@ gtk_list_box_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)
{
GtkListBoxPrivate *priv = BOX_PRIV (widget);
GtkAllocation clip;
GtkAllocation clip = *allocation;
gtk_widget_set_allocation (widget, allocation);
@@ -2764,6 +2767,7 @@ gtk_list_box_allocate (GtkCssGadget *gadget,
GtkAllocation child_allocation;
GtkAllocation header_allocation;
GtkAllocation widget_allocation;
GtkAllocation clip;
GtkListBoxRow *row;
GSequenceIter *iter;
int child_min;
@@ -2788,6 +2792,8 @@ gtk_list_box_allocate (GtkCssGadget *gadget,
header_allocation.height = allocation->height;
header_allocation.y = child_allocation.y;
gtk_widget_size_allocate (priv->placeholder, &header_allocation);
gtk_widget_get_clip (priv->placeholder, &clip);
gdk_rectangle_union (out_clip, out_clip, &clip);
child_allocation.y += child_min;
}
@@ -2811,6 +2817,8 @@ gtk_list_box_allocate (GtkCssGadget *gadget,
header_allocation.height = child_min;
header_allocation.y = child_allocation.y;
gtk_widget_size_allocate (ROW_PRIV (row)->header, &header_allocation);
gtk_widget_get_clip (ROW_PRIV (row)->header, &clip);
gdk_rectangle_union (out_clip, out_clip, &clip);
child_allocation.y += child_min;
}
@@ -2823,10 +2831,10 @@ gtk_list_box_allocate (GtkCssGadget *gadget,
ROW_PRIV (row)->height = child_allocation.height;
gtk_widget_size_allocate (GTK_WIDGET (row), &child_allocation);
gtk_widget_get_clip (GTK_WIDGET (row), &clip);
gdk_rectangle_union (out_clip, out_clip, &clip);
child_allocation.y += child_min;
}
gtk_container_get_children_clip (GTK_CONTAINER (widget), out_clip);
}
/**
@@ -3352,7 +3360,7 @@ static void
gtk_list_box_row_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)
{
GtkAllocation clip;
GtkAllocation clip = *allocation;
gtk_widget_set_allocation (widget, allocation);
@@ -3378,9 +3386,10 @@ gtk_list_box_row_allocate (GtkCssGadget *gadget,
child = gtk_bin_get_child (GTK_BIN (widget));
if (child && gtk_widget_get_visible (child))
gtk_widget_size_allocate (child, (GtkAllocation *)allocation);
gtk_container_get_children_clip (GTK_CONTAINER (widget), out_clip);
{
gtk_widget_size_allocate (child, (GtkAllocation *)allocation);
gtk_widget_get_clip (child, out_clip);
}
}
/**
@@ -3919,7 +3928,7 @@ gtk_list_box_bind_model (GtkListBox *box,
g_clear_object (&priv->bound_model);
}
gtk_list_box_forall (GTK_CONTAINER (box), FALSE, (GtkCallback) gtk_widget_destroy, NULL);
gtk_list_box_forall (GTK_CONTAINER (box), (GtkCallback) gtk_widget_destroy, NULL);
if (model == NULL)
return;
+1 -1
View File
@@ -64,7 +64,7 @@
* ...
*
* // Initialize the widget set
* gtk_init (&argc, &argv);
* gtk_init ();
*
* // Create the main window
* mainwin = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-2
View File
@@ -166,7 +166,6 @@ static void gtk_menu_item_ensure_label (GtkMenuItem *menu_item);
static gint gtk_menu_item_popup_timeout (gpointer data);
static void gtk_menu_item_forall (GtkContainer *container,
gboolean include_internals,
GtkCallback callback,
gpointer callback_data);
@@ -1926,7 +1925,6 @@ gtk_menu_item_get_accel_path (GtkMenuItem *menu_item)
static void
gtk_menu_item_forall (GtkContainer *container,
gboolean include_internals,
GtkCallback callback,
gpointer callback_data)
{
+8 -10
View File
@@ -134,7 +134,7 @@ gtk_menu_section_box_sync_separators (GtkMenuSectionBox *box,
return;
if (should_have_separator)
gtk_box_pack_start (GTK_BOX (box), box->separator, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (box), box->separator);
else
gtk_container_remove (GTK_CONTAINER (box), box->separator);
}
@@ -326,10 +326,7 @@ gtk_menu_section_box_insert_func (GtkMenuTrackerItem *item,
g_object_set_data_full (G_OBJECT (widget), "GtkMenuTrackerItem", g_object_ref (item), g_object_unref);
gtk_widget_set_halign (widget, GTK_ALIGN_FILL);
if (box->iconic)
gtk_box_pack_start (GTK_BOX (box->item_box), widget, TRUE, TRUE);
else
gtk_container_add (GTK_CONTAINER (box->item_box), widget);
gtk_container_add (GTK_CONTAINER (box->item_box), widget);
gtk_box_reorder_child (GTK_BOX (box->item_box), widget, position);
gtk_menu_section_box_schedule_separator_sync (box);
@@ -346,7 +343,7 @@ gtk_menu_section_box_init (GtkMenuSectionBox *box)
item_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
box->item_box = GTK_BOX (item_box);
gtk_box_pack_end (GTK_BOX (box), item_box, FALSE, FALSE);
gtk_box_pack_end (GTK_BOX (box), item_box);
gtk_widget_set_halign (GTK_WIDGET (item_box), GTK_ALIGN_FILL);
gtk_widget_set_halign (GTK_WIDGET (box), GTK_ALIGN_FILL);
@@ -454,7 +451,7 @@ gtk_menu_section_box_new_submenu (GtkMenuTrackerItem *item,
g_object_set_data (G_OBJECT (button), "focus", focus);
g_object_set_data (G_OBJECT (focus), "focus", button);
gtk_box_pack_start (GTK_BOX (box), button, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (box), button);
g_signal_connect (focus, "clicked", G_CALLBACK (open_submenu), item);
g_signal_connect (button, "clicked", G_CALLBACK (close_submenu), item);
@@ -487,6 +484,7 @@ gtk_menu_section_box_new_section (GtkMenuTrackerItem *item,
if (hint && g_str_equal (hint, "horizontal-buttons"))
{
gtk_box_set_homogeneous (box->item_box, TRUE);
gtk_orientable_set_orientation (GTK_ORIENTABLE (box->item_box), GTK_ORIENTATION_HORIZONTAL);
gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (box->item_box)), GTK_STYLE_CLASS_LINKED);
box->iconic = TRUE;
@@ -514,17 +512,17 @@ gtk_menu_section_box_new_section (GtkMenuTrackerItem *item,
separator = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
gtk_widget_set_valign (separator, GTK_ALIGN_CENTER);
gtk_box_pack_start (GTK_BOX (box->separator), separator, TRUE, TRUE);
gtk_box_pack_start (GTK_BOX (box->separator), separator);
title = gtk_label_new (label);
g_object_bind_property (item, "label", title, "label", G_BINDING_SYNC_CREATE);
gtk_style_context_add_class (gtk_widget_get_style_context (title), GTK_STYLE_CLASS_SEPARATOR);
gtk_widget_set_halign (title, GTK_ALIGN_START);
gtk_box_pack_start (GTK_BOX (box->separator), title, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (box->separator), title);
separator = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
gtk_widget_set_valign (separator, GTK_ALIGN_CENTER);
gtk_box_pack_start (GTK_BOX (box->separator), separator, TRUE, TRUE);
gtk_box_pack_start (GTK_BOX (box->separator), separator);
}
else
{
-2
View File
@@ -136,7 +136,6 @@ static void gtk_menu_shell_add (GtkContainer *container,
static void gtk_menu_shell_remove (GtkContainer *container,
GtkWidget *widget);
static void gtk_menu_shell_forall (GtkContainer *container,
gboolean include_internals,
GtkCallback callback,
gpointer callback_data);
static void gtk_menu_shell_real_insert (GtkMenuShell *menu_shell,
@@ -1092,7 +1091,6 @@ gtk_menu_shell_remove (GtkContainer *container,
static void
gtk_menu_shell_forall (GtkContainer *container,
gboolean include_internals,
GtkCallback callback,
gpointer callback_data)
{
+2 -4
View File
@@ -140,8 +140,7 @@ gtk_menu_tool_button_construct_contents (GtkMenuToolButton *button)
g_object_ref (priv->arrow_button);
gtk_container_remove (GTK_CONTAINER (parent),
priv->arrow_button);
gtk_box_pack_end (GTK_BOX (box), priv->arrow_button,
FALSE, FALSE);
gtk_box_pack_end (GTK_BOX (box), priv->arrow_button);
g_object_unref (priv->arrow_button);
}
@@ -285,8 +284,7 @@ gtk_menu_tool_button_init (GtkMenuToolButton *button)
g_object_unref (real_button);
arrow_button = gtk_menu_button_new ();
gtk_box_pack_end (GTK_BOX (box), arrow_button,
FALSE, FALSE);
gtk_box_pack_end (GTK_BOX (box), arrow_button);
/* the arrow button is insentive until we set a menu */
gtk_widget_set_sensitive (arrow_button, FALSE);
+2 -2
View File
@@ -180,7 +180,7 @@ gtk_model_menu_item_set_icon (GtkModelMenuItem *item,
/* Reparent the child without destroying it */
g_object_ref (child);
gtk_container_remove (GTK_CONTAINER (item), child);
gtk_box_pack_end (GTK_BOX (box), child, TRUE, TRUE);
gtk_box_pack_end (GTK_BOX (box), child);
g_object_unref (child);
gtk_container_add (GTK_CONTAINER (item), box);
@@ -200,7 +200,7 @@ gtk_model_menu_item_set_icon (GtkModelMenuItem *item,
image = gtk_image_new_from_gicon (icon, GTK_ICON_SIZE_MENU);
gtk_image_set_pixel_size (GTK_IMAGE (image), 16);
gtk_box_pack_start (GTK_BOX (child), image, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (child), image);
}
g_object_notify (G_OBJECT (item), "icon");
+14 -18
View File
@@ -547,17 +547,17 @@ gtk_mount_operation_ask_password_do_gtk (GtkMountOperation *operation,
/* Build contents */
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
gtk_box_pack_start (GTK_BOX (content_area), hbox, TRUE, TRUE);
gtk_box_pack_start (GTK_BOX (content_area), hbox);
icon = gtk_image_new_from_icon_name ("dialog-password",
GTK_ICON_SIZE_DIALOG);
gtk_widget_set_halign (icon, GTK_ALIGN_CENTER);
gtk_widget_set_valign (icon, GTK_ALIGN_START);
gtk_box_pack_start (GTK_BOX (hbox), icon, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (hbox), icon);
main_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 18);
gtk_box_pack_start (GTK_BOX (hbox), main_vbox, TRUE, TRUE);
gtk_box_pack_start (GTK_BOX (hbox), main_vbox);
secondary = strstr (message, "\n");
if (secondary != NULL)
@@ -573,8 +573,7 @@ gtk_mount_operation_ask_password_do_gtk (GtkMountOperation *operation,
gtk_widget_set_halign (label, GTK_ALIGN_START);
gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
gtk_box_pack_start (GTK_BOX (main_vbox), GTK_WIDGET (label),
FALSE, TRUE);
gtk_box_pack_start (GTK_BOX (main_vbox), GTK_WIDGET (label));
g_free (primary);
attrs = pango_attr_list_new ();
pango_attr_list_insert (attrs, pango_attr_weight_new (PANGO_WEIGHT_BOLD));
@@ -587,8 +586,7 @@ gtk_mount_operation_ask_password_do_gtk (GtkMountOperation *operation,
gtk_widget_set_halign (label, GTK_ALIGN_START);
gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
gtk_box_pack_start (GTK_BOX (main_vbox), GTK_WIDGET (label),
FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (main_vbox), GTK_WIDGET (label));
}
grid = gtk_grid_new ();
@@ -596,7 +594,7 @@ gtk_mount_operation_ask_password_do_gtk (GtkMountOperation *operation,
gtk_grid_set_row_spacing (GTK_GRID (grid), 12);
gtk_grid_set_column_spacing (GTK_GRID (grid), 12);
gtk_widget_set_margin_bottom (grid, 12);
gtk_box_pack_start (GTK_BOX (main_vbox), grid, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (main_vbox), grid);
can_anonymous = priv->ask_flags & G_ASK_PASSWORD_ANONYMOUS_SUPPORTED;
@@ -620,8 +618,7 @@ gtk_mount_operation_ask_password_do_gtk (GtkMountOperation *operation,
choice = gtk_radio_button_new_with_mnemonic (NULL, _("_Anonymous"));
gtk_box_pack_start (GTK_BOX (anon_box),
choice,
FALSE, FALSE);
choice);
g_signal_connect (choice, "toggled",
G_CALLBACK (pw_dialog_anonymous_toggled), operation);
priv->anonymous_toggle = choice;
@@ -629,8 +626,7 @@ gtk_mount_operation_ask_password_do_gtk (GtkMountOperation *operation,
group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (choice));
choice = gtk_radio_button_new_with_mnemonic (group, _("Registered U_ser"));
gtk_box_pack_start (GTK_BOX (anon_box),
choice,
FALSE, FALSE);
choice);
g_signal_connect (choice, "toggled",
G_CALLBACK (pw_dialog_anonymous_toggled), operation);
}
@@ -678,7 +674,7 @@ gtk_mount_operation_ask_password_do_gtk (GtkMountOperation *operation,
GINT_TO_POINTER (G_PASSWORD_SAVE_NEVER));
g_signal_connect (choice, "toggled",
G_CALLBACK (remember_button_toggled), operation);
gtk_box_pack_start (GTK_BOX (remember_box), choice, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (remember_box), choice);
group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (choice));
choice = gtk_radio_button_new_with_mnemonic (group, _("Remember password until you _logout"));
@@ -688,7 +684,7 @@ gtk_mount_operation_ask_password_do_gtk (GtkMountOperation *operation,
GINT_TO_POINTER (G_PASSWORD_SAVE_FOR_SESSION));
g_signal_connect (choice, "toggled",
G_CALLBACK (remember_button_toggled), operation);
gtk_box_pack_start (GTK_BOX (remember_box), choice, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (remember_box), choice);
group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (choice));
choice = gtk_radio_button_new_with_mnemonic (group, _("Remember _forever"));
@@ -698,7 +694,7 @@ gtk_mount_operation_ask_password_do_gtk (GtkMountOperation *operation,
GINT_TO_POINTER (G_PASSWORD_SAVE_PERMANENTLY));
g_signal_connect (choice, "toggled",
G_CALLBACK (remember_button_toggled), operation);
gtk_box_pack_start (GTK_BOX (remember_box), choice, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (remember_box), choice);
}
g_signal_connect (G_OBJECT (dialog), "response",
@@ -1403,7 +1399,7 @@ create_show_processes_dialog (GtkMountOperation *op,
content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
gtk_box_pack_start (GTK_BOX (content_area), vbox, TRUE, TRUE);
gtk_box_pack_start (GTK_BOX (content_area), vbox);
if (secondary != NULL)
s = g_strdup_printf ("<big><b>%s</b></big>\n\n%s", primary, secondary);
@@ -1414,7 +1410,7 @@ create_show_processes_dialog (GtkMountOperation *op,
label = gtk_label_new (NULL);
gtk_label_set_markup (GTK_LABEL (label), s);
g_free (s);
gtk_box_pack_start (GTK_BOX (vbox), label, TRUE, TRUE);
gtk_box_pack_start (GTK_BOX (vbox), label);
/* First count the items in the list then
* add the buttons in reverse order */
@@ -1466,7 +1462,7 @@ create_show_processes_dialog (GtkMountOperation *op,
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_window), GTK_SHADOW_IN);
gtk_container_add (GTK_CONTAINER (scrolled_window), tree_view);
gtk_box_pack_start (GTK_BOX (vbox), scrolled_window, TRUE, TRUE);
gtk_box_pack_start (GTK_BOX (vbox), scrolled_window);
g_signal_connect (tree_view, "popup-menu",
G_CALLBACK (on_popup_menu_for_process_tree_view),
-18
View File
@@ -448,7 +448,6 @@ static void gtk_notebook_set_focus_child (GtkContainer *container,
GtkWidget *child);
static GType gtk_notebook_child_type (GtkContainer *container);
static void gtk_notebook_forall (GtkContainer *container,
gboolean include_internals,
GtkCallback callback,
gpointer callback_data);
@@ -4408,14 +4407,12 @@ gtk_notebook_set_focus_child (GtkContainer *container,
static void
gtk_notebook_forall (GtkContainer *container,
gboolean include_internals,
GtkCallback callback,
gpointer callback_data)
{
GtkNotebook *notebook = GTK_NOTEBOOK (container);
GtkNotebookPrivate *priv = notebook->priv;
GList *children;
gint i;
children = priv->children;
while (children)
@@ -4425,21 +4422,6 @@ gtk_notebook_forall (GtkContainer *container,
page = children->data;
children = children->next;
(* callback) (page->child, callback_data);
if (include_internals)
{
if (page->tab_label)
(* callback) (page->tab_label, callback_data);
}
}
if (include_internals)
{
for (i = 0; i < N_ACTION_WIDGETS; i++)
{
if (priv->action_widget[i])
(* callback) (priv->action_widget[i], callback_data);
}
}
}
+12 -11
View File
@@ -587,15 +587,15 @@ gtk_overlay_reorder_overlay (GtkOverlay *overlay,
gtk_widget_child_notify (info->widget, "index");
}
if (gtk_widget_get_visible (child) &&
gtk_widget_get_visible (GTK_WIDGET (overlay)))
gtk_widget_queue_resize (GTK_WIDGET (overlay));
if (new_link)
gtk_widget_insert_before (child, GTK_WIDGET (overlay), ((GtkOverlayChild *)new_link->data)->widget);
else
gtk_widget_insert_before (child, GTK_WIDGET (overlay), NULL);
}
static void
gtk_overlay_forall (GtkContainer *overlay,
gboolean include_internals,
GtkCallback callback,
gpointer callback_data)
{
@@ -832,7 +832,11 @@ gtk_overlay_buildable_add_child (GtkBuildable *buildable,
if (type && strcmp (type, "overlay") == 0)
gtk_overlay_add_overlay (GTK_OVERLAY (buildable), GTK_WIDGET (child));
else if (!type)
gtk_container_add (GTK_CONTAINER (buildable), GTK_WIDGET (child));
{
/* Make sure the main-child node is the first one */
gtk_widget_insert_after (GTK_WIDGET (child), GTK_WIDGET (buildable), NULL);
_gtk_bin_set_child (GTK_BIN (buildable), GTK_WIDGET (child));
}
else
GTK_BUILDER_WARN_INVALID_CHILD_TYPE (buildable, type);
}
@@ -890,12 +894,9 @@ gtk_overlay_add_overlay (GtkOverlay *overlay,
priv->children = g_slist_append (priv->children, child);
if (gtk_widget_get_realized (GTK_WIDGET (overlay)))
{
child->window = gtk_overlay_create_child_window (overlay, child);
gtk_widget_set_parent (widget, GTK_WIDGET (overlay));
}
else
gtk_widget_set_parent (widget, GTK_WIDGET (overlay));
child->window = gtk_overlay_create_child_window (overlay, child);
gtk_widget_insert_before (widget, GTK_WIDGET (overlay), NULL);
gtk_widget_child_notify (widget, "index");
}
-2
View File
@@ -235,7 +235,6 @@ static void gtk_paned_add (GtkContainer *container,
static void gtk_paned_remove (GtkContainer *container,
GtkWidget *widget);
static void gtk_paned_forall (GtkContainer *container,
gboolean include_internals,
GtkCallback callback,
gpointer callback_data);
static void gtk_paned_calc_position (GtkPaned *paned,
@@ -2179,7 +2178,6 @@ gtk_paned_remove (GtkContainer *container,
static void
gtk_paned_forall (GtkContainer *container,
gboolean include_internals,
GtkCallback callback,
gpointer callback_data)
{
+2 -4
View File
@@ -133,7 +133,6 @@ static void gtk_path_bar_add (GtkContainer *container,
static void gtk_path_bar_remove (GtkContainer *container,
GtkWidget *widget);
static void gtk_path_bar_forall (GtkContainer *container,
gboolean include_internals,
GtkCallback callback,
gpointer callback_data);
static gboolean gtk_path_bar_scroll (GtkWidget *widget,
@@ -839,7 +838,6 @@ gtk_path_bar_remove (GtkContainer *container,
static void
gtk_path_bar_forall (GtkContainer *container,
gboolean include_internals,
GtkCallback callback,
gpointer callback_data)
{
@@ -1486,8 +1484,8 @@ make_directory_button (GtkPathBar *path_bar,
button_data->image = gtk_image_new ();
button_data->label = gtk_label_new (NULL);
child = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_box_pack_start (GTK_BOX (child), button_data->image, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (child), button_data->label, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (child), button_data->image);
gtk_box_pack_start (GTK_BOX (child), button_data->label);
break;
case NORMAL_BUTTON:
default:
+8 -8
View File
@@ -789,12 +789,12 @@ request_password (GtkPrintBackend *backend,
/* Packing */
content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
gtk_box_pack_start (GTK_BOX (content_area), main_box, TRUE, FALSE);
gtk_box_pack_start (GTK_BOX (content_area), main_box);
gtk_box_pack_start (GTK_BOX (main_box), icon, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (main_box), vbox, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (main_box), icon);
gtk_box_pack_start (GTK_BOX (main_box), vbox);
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, TRUE);
gtk_box_pack_start (GTK_BOX (vbox), label);
/* Right - 2. */
for (i = 0; i < length; i++)
@@ -820,10 +820,10 @@ request_password (GtkPrintBackend *backend,
gtk_entry_set_visibility (GTK_ENTRY (entry), ai_visible[i]);
gtk_entry_set_activates_default (GTK_ENTRY (entry), TRUE);
gtk_box_pack_start (GTK_BOX (vbox), box, FALSE, TRUE);
gtk_box_pack_start (GTK_BOX (vbox), box);
gtk_box_pack_start (GTK_BOX (box), label, TRUE, TRUE);
gtk_box_pack_start (GTK_BOX (box), entry, TRUE, TRUE);
gtk_box_pack_start (GTK_BOX (box), label);
gtk_box_pack_start (GTK_BOX (box), entry);
g_signal_connect (entry, "changed",
G_CALLBACK (store_entry), &(priv->auth_info[i]));
@@ -836,7 +836,7 @@ request_password (GtkPrintBackend *backend,
gtk_widget_set_margin_top (chkbtn, 6);
gtk_widget_set_margin_bottom (chkbtn, 6);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (chkbtn), FALSE);
gtk_box_pack_start (GTK_BOX (vbox), chkbtn, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (vbox), chkbtn);
g_signal_connect (chkbtn, "toggled",
G_CALLBACK (store_auth_info_toggled),
&(priv->store_auth_info));
+9 -11
View File
@@ -737,7 +737,7 @@ alternative_append (GtkWidget *box,
button = gtk_radio_button_new_with_label (group, label);
gtk_widget_show (button);
gtk_widget_set_valign (button, GTK_ALIGN_BASELINE);
gtk_box_pack_start (GTK_BOX (box), button, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (box), button);
g_object_set_data (G_OBJECT (button), "value", (gpointer)value);
g_signal_connect (button, "toggled",
@@ -768,7 +768,7 @@ construct_widgets (GtkPrinterOptionWidget *widget)
gtk_combo_box_set_active (GTK_COMBO_BOX (priv->combo), 0);
gtk_widget_set_sensitive (GTK_WIDGET (widget), FALSE);
gtk_widget_show (priv->combo);
gtk_box_pack_start (GTK_BOX (widget), priv->combo, TRUE, TRUE);
gtk_box_pack_start (GTK_BOX (widget), priv->combo);
}
else switch (source->type)
{
@@ -776,7 +776,7 @@ construct_widgets (GtkPrinterOptionWidget *widget)
priv->check = gtk_check_button_new_with_mnemonic (source->display_text);
g_signal_connect (priv->check, "toggled", G_CALLBACK (check_toggled_cb), widget);
gtk_widget_show (priv->check);
gtk_box_pack_start (GTK_BOX (widget), priv->check, TRUE, TRUE);
gtk_box_pack_start (GTK_BOX (widget), priv->check);
break;
case GTK_PRINTER_OPTION_TYPE_PICKONE:
case GTK_PRINTER_OPTION_TYPE_PICKONE_PASSWORD:
@@ -808,7 +808,7 @@ construct_widgets (GtkPrinterOptionWidget *widget)
source->choices_display[i],
source->choices[i]);
gtk_widget_show (priv->combo);
gtk_box_pack_start (GTK_BOX (widget), priv->combo, TRUE, TRUE);
gtk_box_pack_start (GTK_BOX (widget), priv->combo);
g_signal_connect (priv->combo, "changed", G_CALLBACK (combo_changed_cb), widget);
text = g_strdup_printf ("%s:", source->display_text);
@@ -822,7 +822,7 @@ construct_widgets (GtkPrinterOptionWidget *widget)
priv->box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
gtk_widget_set_valign (priv->box, GTK_ALIGN_BASELINE);
gtk_widget_show (priv->box);
gtk_box_pack_start (GTK_BOX (widget), priv->box, TRUE, TRUE);
gtk_box_pack_start (GTK_BOX (widget), priv->box);
for (i = 0; i < source->num_choices; i++)
{
group = alternative_append (priv->box,
@@ -850,7 +850,7 @@ construct_widgets (GtkPrinterOptionWidget *widget)
gtk_entry_set_activates_default (GTK_ENTRY (priv->entry),
gtk_printer_option_get_activates_default (source));
gtk_widget_show (priv->entry);
gtk_box_pack_start (GTK_BOX (widget), priv->entry, TRUE, TRUE);
gtk_box_pack_start (GTK_BOX (widget), priv->entry);
g_signal_connect (priv->entry, "changed", G_CALLBACK (entry_changed_cb), widget);
text = g_strdup_printf ("%s:", source->display_text);
@@ -863,7 +863,7 @@ construct_widgets (GtkPrinterOptionWidget *widget)
case GTK_PRINTER_OPTION_TYPE_FILESAVE:
priv->button = gtk_button_new ();
gtk_widget_show (priv->button);
gtk_box_pack_start (GTK_BOX (widget), priv->button, TRUE, TRUE);
gtk_box_pack_start (GTK_BOX (widget), priv->button);
g_signal_connect (priv->button, "clicked", G_CALLBACK (filesave_choose_cb), widget);
text = g_strdup_printf ("%s:", source->display_text);
@@ -876,13 +876,11 @@ construct_widgets (GtkPrinterOptionWidget *widget)
case GTK_PRINTER_OPTION_TYPE_INFO:
priv->info_label = gtk_label_new (NULL);
gtk_label_set_selectable (GTK_LABEL (priv->info_label), TRUE);
gtk_widget_show (priv->info_label);
gtk_box_pack_start (GTK_BOX (widget), priv->info_label, FALSE, TRUE);
gtk_box_pack_start (GTK_BOX (widget), priv->info_label);
text = g_strdup_printf ("%s:", source->display_text);
priv->label = gtk_label_new_with_mnemonic (text);
g_free (text);
gtk_widget_show (priv->label);
break;
@@ -891,7 +889,7 @@ construct_widgets (GtkPrinterOptionWidget *widget)
}
priv->image = gtk_image_new_from_icon_name ("dialog-warning", GTK_ICON_SIZE_MENU);
gtk_box_pack_start (GTK_BOX (widget), priv->image, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (widget), priv->image);
}
/*
+7 -7
View File
@@ -1306,13 +1306,13 @@ wrap_in_frame (const gchar *label,
g_free (bold_text);
frame = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
gtk_box_pack_start (GTK_BOX (frame), label_widget, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (frame), label_widget);
gtk_widget_set_margin_start (child, 12);
gtk_widget_set_halign (child, GTK_ALIGN_FILL);
gtk_widget_set_valign (child, GTK_ALIGN_FILL);
gtk_box_pack_start (GTK_BOX (frame), child, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (frame), child);
gtk_widget_show (frame);
@@ -1357,14 +1357,14 @@ add_option_to_extension_point (GtkPrinterOption *option,
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
gtk_widget_set_valign (hbox, GTK_ALIGN_BASELINE);
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (hbox), widget, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (hbox), label);
gtk_box_pack_start (GTK_BOX (hbox), widget);
gtk_widget_show (hbox);
gtk_box_pack_start (GTK_BOX (extension_point), hbox, TRUE, TRUE);
gtk_box_pack_start (GTK_BOX (extension_point), hbox);
}
else
gtk_box_pack_start (GTK_BOX (extension_point), widget, TRUE, TRUE);
gtk_box_pack_start (GTK_BOX (extension_point), widget);
}
static gint
@@ -1643,7 +1643,7 @@ update_dialog_from_settings (GtkPrintUnixDialog *dialog)
gtk_widget_show (frame);
gtk_box_pack_start (GTK_BOX (priv->advanced_vbox),
frame, FALSE, FALSE);
frame);
}
}
+186 -356
View File
@@ -38,6 +38,7 @@
#include "gtkcsscustomgadgetprivate.h"
#include "gtkcssnumbervalueprivate.h"
#include "gtkprogresstrackerprivate.h"
#include "gtkgizmoprivate.h"
#include "a11y/gtkprogressbaraccessible.h"
@@ -75,8 +76,8 @@
*
* |[<!-- language="plain" -->
* progressbar[.osd]
* [text]
* trough[.empty][.full]
* [text]
* progress[.pulse]
* ]|
*
@@ -93,10 +94,11 @@ struct _GtkProgressBarPrivate
{
gchar *text;
GtkWidget *label;
GtkWidget *trough_widget;
GtkWidget *progress_widget;
GtkCssGadget *gadget;
GtkCssGadget *text_gadget;
GtkCssGadget *trough_gadget;
GtkCssGadget *progress_gadget;
gdouble fraction;
gdouble pulse_fraction;
@@ -183,33 +185,6 @@ static gboolean gtk_progress_bar_render (GtkCssGadget *gadget,
gint width,
gint height,
gpointer data);
static void gtk_progress_bar_allocate_trough (GtkCssGadget *gadget,
const GtkAllocation *allocation,
gint baseline,
GtkAllocation *out_clip,
gpointer data);
static gboolean gtk_progress_bar_render_trough (GtkCssGadget *gadget,
GtkSnapshot *snapshot,
gint x,
gint y,
gint width,
gint height,
gpointer data);
static void gtk_progress_bar_measure_text (GtkCssGadget *gadget,
GtkOrientation orientation,
gint for_size,
gint *minimum,
gint *natural,
gint *minimum_baseline,
gint *natural_baseline,
gpointer data);
static gboolean gtk_progress_bar_render_text (GtkCssGadget *gadget,
GtkSnapshot *snapshot,
gint x,
gint y,
gint width,
gint height,
gpointer data);
G_DEFINE_TYPE_WITH_CODE (GtkProgressBar, gtk_progress_bar, GTK_TYPE_WIDGET,
G_ADD_PRIVATE (GtkProgressBar)
@@ -321,6 +296,7 @@ static void
update_fraction_classes (GtkProgressBar *pbar)
{
GtkProgressBarPrivate *priv = pbar->priv;
GtkStyleContext *context;
gboolean empty = FALSE;
gboolean full = FALSE;
@@ -335,21 +311,24 @@ update_fraction_classes (GtkProgressBar *pbar)
full = TRUE;
}
context = gtk_widget_get_style_context (priv->trough_widget);
if (empty)
gtk_css_gadget_add_class (priv->trough_gadget, "empty");
gtk_style_context_add_class (context, "empty");
else
gtk_css_gadget_remove_class (priv->trough_gadget, "empty");
gtk_style_context_remove_class (context, "empty");
if (full)
gtk_css_gadget_add_class (priv->trough_gadget, "full");
gtk_style_context_add_class (context, "full");
else
gtk_css_gadget_remove_class (priv->trough_gadget, "full");
gtk_style_context_remove_class (context, "full");
}
static void
update_node_classes (GtkProgressBar *pbar)
{
GtkProgressBarPrivate *priv = pbar->priv;
GtkStyleContext *context;
gboolean left = FALSE;
gboolean right = FALSE;
gboolean top = FALSE;
@@ -395,25 +374,27 @@ update_node_classes (GtkProgressBar *pbar)
}
}
context = gtk_widget_get_style_context (priv->progress_widget);
if (left)
gtk_css_gadget_add_class (priv->progress_gadget, GTK_STYLE_CLASS_LEFT);
gtk_style_context_add_class (context, GTK_STYLE_CLASS_LEFT);
else
gtk_css_gadget_remove_class (priv->progress_gadget, GTK_STYLE_CLASS_LEFT);
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_LEFT);
if (right)
gtk_css_gadget_add_class (priv->progress_gadget, GTK_STYLE_CLASS_RIGHT);
gtk_style_context_add_class (context, GTK_STYLE_CLASS_RIGHT);
else
gtk_css_gadget_remove_class (priv->progress_gadget, GTK_STYLE_CLASS_RIGHT);
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_RIGHT);
if (top)
gtk_css_gadget_add_class (priv->progress_gadget, GTK_STYLE_CLASS_TOP);
gtk_style_context_add_class (context, GTK_STYLE_CLASS_TOP);
else
gtk_css_gadget_remove_class (priv->progress_gadget, GTK_STYLE_CLASS_TOP);
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_TOP);
if (bottom)
gtk_css_gadget_add_class (priv->progress_gadget, GTK_STYLE_CLASS_BOTTOM);
gtk_style_context_add_class (context, GTK_STYLE_CLASS_BOTTOM);
else
gtk_css_gadget_remove_class (priv->progress_gadget, GTK_STYLE_CLASS_BOTTOM);
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_BOTTOM);
update_fraction_classes (pbar);
}
@@ -427,10 +408,95 @@ update_node_state (GtkProgressBar *pbar)
state = gtk_widget_get_state_flags (GTK_WIDGET (pbar));
gtk_css_gadget_set_state (priv->gadget, state);
gtk_css_gadget_set_state (priv->trough_gadget, state);
gtk_css_gadget_set_state (priv->progress_gadget, state);
if (priv->text_gadget)
gtk_css_gadget_set_state (priv->text_gadget, state);
}
static void
allocate_trough (GtkGizmo *gizmo,
const GtkAllocation *allocation,
int baseline,
GtkAllocation *out_clip)
{
GtkProgressBar *pbar = GTK_PROGRESS_BAR (gtk_widget_get_parent (GTK_WIDGET (gizmo)));
GtkProgressBarPrivate *priv = pbar->priv;
GtkAllocation alloc;
gint width, height;
gboolean inverted;
inverted = priv->inverted;
if (gtk_widget_get_direction (GTK_WIDGET (pbar)) == GTK_TEXT_DIR_RTL)
{
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
inverted = !inverted;
}
gtk_widget_measure (priv->progress_widget, GTK_ORIENTATION_VERTICAL, -1,
&height, NULL,
NULL, NULL);
gtk_widget_measure (priv->progress_widget, GTK_ORIENTATION_HORIZONTAL, -1,
&width, NULL,
NULL, NULL);
if (priv->activity_mode)
{
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
{
alloc.width = width + (allocation->width - width) / priv->activity_blocks;
alloc.x = allocation->x + priv->activity_pos * (allocation->width - alloc.width);
alloc.y = allocation->y + (allocation->height - height) / 2;
alloc.height = height;
}
else
{
alloc.height = height + (allocation->height - height) / priv->activity_blocks;
alloc.y = allocation->y + priv->activity_pos * (allocation->height - alloc.height);
alloc.x = allocation->x + (allocation->width - width) / 2;
alloc.width = width;
}
}
else
{
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
{
alloc.width = width + (allocation->width - width) * priv->fraction;
alloc.height = height;
alloc.y = allocation->y + (allocation->height - height) / 2;
if (!inverted)
alloc.x = allocation->x;
else
alloc.x = allocation->x + allocation->width - alloc.width;
}
else
{
alloc.width = width;
alloc.height = height + (allocation->height - height) * priv->fraction;
alloc.x = allocation->x + (allocation->width - width) / 2;
if (!inverted)
alloc.y = allocation->y;
else
alloc.y = allocation->y + allocation->height - alloc.height;
}
}
gtk_widget_size_allocate (priv->progress_widget, &alloc);
gtk_widget_get_clip (priv->progress_widget, out_clip);
}
static gboolean
snapshot_trough (GtkGizmo *gizmo,
GtkSnapshot *snapshot)
{
GtkProgressBar *pbar = GTK_PROGRESS_BAR (gtk_widget_get_parent (GTK_WIDGET (gizmo)));
gtk_widget_snapshot_child (GTK_WIDGET (gizmo), pbar->priv->progress_widget, snapshot);
return FALSE;
}
static void
@@ -467,25 +533,14 @@ gtk_progress_bar_init (GtkProgressBar *pbar)
NULL,
NULL);
priv->trough_gadget = gtk_css_custom_gadget_new ("trough",
GTK_WIDGET (pbar),
priv->gadget,
NULL,
NULL,
gtk_progress_bar_allocate_trough,
gtk_progress_bar_render_trough,
NULL,
NULL);
priv->trough_widget = gtk_gizmo_new ("trough",
NULL,
allocate_trough,
snapshot_trough);
gtk_widget_set_parent (priv->trough_widget, GTK_WIDGET (pbar));
priv->progress_gadget = gtk_css_custom_gadget_new ("progress",
GTK_WIDGET (pbar),
priv->trough_gadget,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL);
priv->progress_widget = gtk_gizmo_new ("progress", NULL, NULL, NULL);
gtk_widget_set_parent (priv->progress_widget, priv->trough_widget);
update_node_state (pbar);
update_node_classes (pbar);
@@ -596,9 +651,12 @@ gtk_progress_bar_finalize (GObject *object)
g_free (priv->text);
g_clear_object (&priv->text_gadget);
g_clear_object (&priv->progress_gadget);
g_clear_object (&priv->trough_gadget);
if (priv->label)
gtk_widget_unparent (priv->label);
gtk_widget_unparent (priv->progress_widget);
gtk_widget_unparent (priv->trough_widget);
g_clear_object (&priv->gadget);
G_OBJECT_CLASS (gtk_progress_bar_parent_class)->finalize (object);
@@ -636,19 +694,15 @@ gtk_progress_bar_measure (GtkCssGadget *gadget,
priv = pbar->priv;
if (priv->show_text)
gtk_css_gadget_get_preferred_size (priv->text_gadget,
orientation,
-1,
&text_minimum, &text_natural,
NULL, NULL);
gtk_widget_measure (priv->label, orientation, -1,
&text_minimum, &text_natural,
NULL, NULL);
else
text_minimum = text_natural = 0;
gtk_css_gadget_get_preferred_size (priv->trough_gadget,
orientation,
-1,
&trough_minimum, &trough_natural,
NULL, NULL);
gtk_widget_measure (priv->trough_widget, orientation, -1,
&trough_minimum, &trough_natural,
NULL, NULL);
if (orientation == GTK_ORIENTATION_HORIZONTAL)
{
@@ -678,96 +732,13 @@ gtk_progress_bar_measure (GtkCssGadget *gadget,
}
}
static PangoLayout *
gtk_progress_bar_get_layout (GtkProgressBar *pbar)
{
PangoLayout *layout;
gchar *buf;
GtkCssStyle *style;
PangoAttrList *attrs;
PangoFontDescription *desc;
buf = get_current_text (pbar);
layout = gtk_widget_create_pango_layout (GTK_WIDGET (pbar), buf);
style = gtk_css_node_get_style (gtk_css_gadget_get_node (pbar->priv->text_gadget));
attrs = gtk_css_style_get_pango_attributes (style);
desc = gtk_css_style_get_pango_font (style);
pango_layout_set_attributes (layout, attrs);
pango_layout_set_font_description (layout, desc);
if (attrs)
pango_attr_list_unref (attrs);
pango_font_description_free (desc);
g_free (buf);
return layout;
}
static void
gtk_progress_bar_measure_text (GtkCssGadget *gadget,
GtkOrientation orientation,
int for_size,
int *minimum,
int *natural,
int *minimum_baseline,
int *natural_baseline,
gpointer data)
{
GtkWidget *widget;
GtkProgressBar *pbar;
GtkProgressBarPrivate *priv;
PangoLayout *layout;
PangoRectangle logical_rect;
widget = gtk_css_gadget_get_owner (gadget);
pbar = GTK_PROGRESS_BAR (widget);
priv = pbar->priv;
layout = gtk_progress_bar_get_layout (pbar);
pango_layout_get_pixel_extents (layout, NULL, &logical_rect);
if (orientation == GTK_ORIENTATION_HORIZONTAL)
{
if (priv->ellipsize)
{
PangoContext *context;
PangoFontMetrics *metrics;
gint char_width;
/* The minimum size for ellipsized text is ~ 3 chars */
context = pango_layout_get_context (layout);
metrics = pango_context_get_metrics (context,
pango_layout_get_font_description (layout),
pango_context_get_language (context));
char_width = pango_font_metrics_get_approximate_char_width (metrics);
pango_font_metrics_unref (metrics);
*minimum = PANGO_PIXELS (char_width) * 3;
}
else
*minimum = logical_rect.width;
*natural = MAX (*minimum, logical_rect.width);
}
else
*minimum = *natural = logical_rect.height;
g_object_unref (layout);
}
static void
gtk_progress_bar_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)
{
GtkAllocation clip;
gtk_widget_set_allocation (widget, allocation);
GTK_WIDGET_CLASS (gtk_progress_bar_parent_class)->size_allocate (widget, allocation);
gtk_css_gadget_allocate (GTK_PROGRESS_BAR (widget)->priv->gadget,
allocation,
@@ -796,20 +767,16 @@ gtk_progress_bar_allocate (GtkCssGadget *gadget,
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
{
gtk_css_gadget_get_preferred_size (priv->trough_gadget,
GTK_ORIENTATION_VERTICAL,
-1,
&bar_height, NULL,
NULL, NULL);
gtk_widget_measure (priv->trough_widget, GTK_ORIENTATION_VERTICAL, -1,
&bar_height, NULL,
NULL, NULL);
bar_width = allocation->width;
}
else
{
gtk_css_gadget_get_preferred_size (priv->trough_gadget,
GTK_ORIENTATION_HORIZONTAL,
-1,
&bar_width, NULL,
NULL, NULL);
gtk_widget_measure (priv->trough_widget, GTK_ORIENTATION_HORIZONTAL, -1,
&bar_width, NULL,
NULL, NULL);
bar_height = allocation->height;
}
@@ -818,21 +785,18 @@ gtk_progress_bar_allocate (GtkCssGadget *gadget,
alloc.width = bar_width;
alloc.height = bar_height;
gtk_css_gadget_allocate (priv->trough_gadget, &alloc, -1, out_clip);
gtk_widget_size_allocate (priv->trough_widget, &alloc);
gtk_widget_get_clip (priv->trough_widget, out_clip);
if (!priv->show_text)
return;
gtk_css_gadget_get_preferred_size (priv->text_gadget,
GTK_ORIENTATION_HORIZONTAL,
-1,
&text_min, &text_nat,
NULL, NULL);
gtk_css_gadget_get_preferred_size (priv->text_gadget,
GTK_ORIENTATION_VERTICAL,
-1,
&text_height, NULL,
NULL, NULL);
gtk_widget_measure (priv->label, GTK_ORIENTATION_HORIZONTAL, -1,
&text_min, &text_nat,
NULL, NULL);
gtk_widget_measure (priv->label, GTK_ORIENTATION_VERTICAL, -1,
&text_height, NULL,
NULL, NULL);
text_width = CLAMP (text_nat, text_min, allocation->width);
@@ -851,94 +815,12 @@ gtk_progress_bar_allocate (GtkCssGadget *gadget,
alloc.height = text_height;
}
gtk_css_gadget_allocate (priv->text_gadget, &alloc, -1, &text_clip);
gtk_widget_size_allocate (priv->label, &alloc);
gtk_widget_get_clip (priv->label, &text_clip);
gdk_rectangle_union (out_clip, &text_clip, out_clip);
}
static void
gtk_progress_bar_allocate_trough (GtkCssGadget *gadget,
const GtkAllocation *allocation,
int baseline,
GtkAllocation *out_clip,
gpointer data)
{
GtkWidget *widget;
GtkProgressBarPrivate *priv;
GtkAllocation alloc;
gint width, height;
gboolean inverted;
widget = gtk_css_gadget_get_owner (gadget);
priv = GTK_PROGRESS_BAR (widget)->priv;
inverted = priv->inverted;
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
{
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
inverted = !inverted;
}
gtk_css_gadget_get_preferred_size (priv->progress_gadget,
GTK_ORIENTATION_VERTICAL,
-1,
&height, NULL,
NULL, NULL);
gtk_css_gadget_get_preferred_size (priv->progress_gadget,
GTK_ORIENTATION_HORIZONTAL,
-1,
&width, NULL,
NULL, NULL);
if (priv->activity_mode)
{
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
{
alloc.width = width + (allocation->width - width) / priv->activity_blocks;
alloc.x = allocation->x + priv->activity_pos * (allocation->width - alloc.width);
alloc.y = allocation->y + (allocation->height - height) / 2;
alloc.height = height;
}
else
{
alloc.height = height + (allocation->height - height) / priv->activity_blocks;
alloc.y = allocation->y + priv->activity_pos * (allocation->height - alloc.height);
alloc.x = allocation->x + (allocation->width - width) / 2;
alloc.width = width;
}
}
else
{
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
{
alloc.width = width + (allocation->width - width) * priv->fraction;
alloc.height = height;
alloc.y = allocation->y + (allocation->height - height) / 2;
if (!inverted)
alloc.x = allocation->x;
else
alloc.x = allocation->x + allocation->width - alloc.width;
}
else
{
alloc.width = width;
alloc.height = height + (allocation->height - height) * priv->fraction;
alloc.x = allocation->x + (allocation->width - width) / 2;
if (!inverted)
alloc.y = allocation->y;
else
alloc.y = allocation->y + allocation->height - alloc.height;
}
}
gtk_css_gadget_allocate (priv->progress_gadget, &alloc, -1, out_clip);
}
static void
gtk_progress_bar_measure_ (GtkWidget *widget,
GtkOrientation orientation,
@@ -1009,7 +891,7 @@ tick_cb (GtkWidget *widget,
update_node_classes (pbar);
gtk_widget_queue_allocate (widget);
gtk_widget_queue_allocate (priv->trough_widget);
return G_SOURCE_CONTINUE;
}
@@ -1021,7 +903,7 @@ gtk_progress_bar_act_mode_enter (GtkProgressBar *pbar)
GtkWidget *widget = GTK_WIDGET (pbar);
gboolean inverted;
gtk_css_gadget_add_class (priv->progress_gadget, GTK_STYLE_CLASS_PULSE);
gtk_style_context_add_class (gtk_widget_get_style_context (priv->progress_widget), GTK_STYLE_CLASS_PULSE);
inverted = priv->inverted;
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
@@ -1061,66 +943,11 @@ gtk_progress_bar_act_mode_leave (GtkProgressBar *pbar)
gtk_widget_remove_tick_callback (GTK_WIDGET (pbar), priv->tick_id);
priv->tick_id = 0;
gtk_css_gadget_remove_class (priv->progress_gadget, GTK_STYLE_CLASS_PULSE);
gtk_style_context_remove_class (gtk_widget_get_style_context (priv->progress_widget),
GTK_STYLE_CLASS_PULSE);
update_node_classes (pbar);
}
static gboolean
gtk_progress_bar_render_text (GtkCssGadget *gadget,
GtkSnapshot *snapshot,
int x,
int y,
int width,
int height,
gpointer data)
{
GtkWidget *widget;
GtkProgressBar *pbar;
GtkProgressBarPrivate *priv;
GtkStyleContext *context;
PangoLayout *layout;
widget = gtk_css_gadget_get_owner (gadget);
pbar = GTK_PROGRESS_BAR (widget);
priv = pbar->priv;
context = gtk_widget_get_style_context (widget);
gtk_style_context_save_to_node (context, gtk_css_gadget_get_node (gadget));
layout = gtk_progress_bar_get_layout (pbar);
pango_layout_set_ellipsize (layout, priv->ellipsize);
if (priv->ellipsize)
pango_layout_set_width (layout, width * PANGO_SCALE);
gtk_snapshot_render_layout (snapshot, context, x, y, layout);
g_object_unref (layout);
gtk_style_context_restore (context);
return FALSE;
}
static gboolean
gtk_progress_bar_render_trough (GtkCssGadget *gadget,
GtkSnapshot *snapshot,
int x,
int y,
int width,
int height,
gpointer data)
{
GtkWidget *widget;
GtkProgressBarPrivate *priv;
widget = gtk_css_gadget_get_owner (gadget);
priv = GTK_PROGRESS_BAR (widget)->priv;
gtk_css_gadget_snapshot (priv->progress_gadget, snapshot);
return FALSE;
}
static gboolean
gtk_progress_bar_render (GtkCssGadget *gadget,
GtkSnapshot *snapshot,
@@ -1136,9 +963,9 @@ gtk_progress_bar_render (GtkCssGadget *gadget,
widget = gtk_css_gadget_get_owner (gadget);
priv = GTK_PROGRESS_BAR (widget)->priv;
gtk_css_gadget_snapshot (priv->trough_gadget, snapshot);
gtk_widget_snapshot_child (widget, priv->trough_widget, snapshot);
if (priv->show_text)
gtk_css_gadget_snapshot (priv->text_gadget, snapshot);
gtk_widget_snapshot_child (widget, priv->label, snapshot);
return FALSE;
}
@@ -1194,8 +1021,17 @@ gtk_progress_bar_set_fraction (GtkProgressBar *pbar,
priv = pbar->priv;
priv->fraction = CLAMP (fraction, 0.0, 1.0);
if (priv->label)
{
char *text = get_current_text (pbar);
gtk_label_set_label (GTK_LABEL (priv->label), text);
g_free (text);
}
gtk_progress_bar_set_activity_mode (pbar, FALSE);
gtk_widget_queue_allocate (GTK_WIDGET (pbar));
gtk_widget_queue_allocate (priv->trough_widget);
update_fraction_classes (pbar);
g_object_notify_by_pspec (G_OBJECT (pbar), progress_props[PROP_FRACTION]);
@@ -1266,24 +1102,14 @@ gtk_progress_bar_set_text (GtkProgressBar *pbar,
g_free (priv->text);
priv->text = g_strdup (text);
if (priv->label)
gtk_label_set_label (GTK_LABEL (priv->label), text);
gtk_widget_queue_resize (GTK_WIDGET (pbar));
g_object_notify_by_pspec (G_OBJECT (pbar), progress_props[PROP_TEXT]);
}
static void
gtk_progress_bar_text_style_changed (GtkCssNode *node,
GtkCssStyleChange *change,
GtkProgressBar *pbar)
{
if (change == NULL ||
gtk_css_style_change_affects (change, GTK_CSS_AFFECTS_TEXT_ATTRS) ||
gtk_css_style_change_affects (change, GTK_CSS_AFFECTS_FONT))
{
gtk_widget_queue_resize (GTK_WIDGET (pbar));
}
}
/**
* gtk_progress_bar_set_show_text:
* @pbar: a #GtkProgressBar
@@ -1319,25 +1145,26 @@ gtk_progress_bar_set_show_text (GtkProgressBar *pbar,
if (show_text)
{
priv->text_gadget = gtk_css_custom_gadget_new ("text",
GTK_WIDGET (pbar),
priv->gadget,
priv->trough_gadget,
gtk_progress_bar_measure_text,
NULL,
gtk_progress_bar_render_text,
NULL,
NULL);
g_signal_connect (gtk_css_gadget_get_node (priv->text_gadget), "style-changed",
G_CALLBACK (gtk_progress_bar_text_style_changed), pbar);
char *text = get_current_text (pbar);
priv->label = g_object_new (GTK_TYPE_LABEL,
"css-name", "text",
"label", text,
"ellipsize", priv->ellipsize,
NULL);
gtk_widget_insert_after (priv->label, GTK_WIDGET (pbar), NULL);
update_node_state (pbar);
g_free (text);
}
else
{
if (priv->text_gadget)
gtk_css_node_set_parent (gtk_css_gadget_get_node (priv->text_gadget), NULL);
g_clear_object (&priv->text_gadget);
if (priv->label)
{
gtk_widget_unparent (priv->label);
priv->label = NULL;
}
}
gtk_widget_queue_resize (GTK_WIDGET (pbar));
@@ -1551,6 +1378,9 @@ gtk_progress_bar_set_ellipsize (GtkProgressBar *pbar,
{
priv->ellipsize = mode;
if (priv->label)
gtk_label_set_ellipsize (GTK_LABEL (priv->label), mode);
g_object_notify_by_pspec (G_OBJECT (pbar), progress_props[PROP_ELLIPSIZE]);
gtk_widget_queue_resize (GTK_WIDGET (pbar));
}
+1 -1
View File
@@ -206,7 +206,7 @@ gtk_recent_chooser_dialog_constructed (GObject *object)
content_area = gtk_dialog_get_content_area (GTK_DIALOG (object));
gtk_box_pack_start (GTK_BOX (content_area),
priv->chooser, TRUE, TRUE);
priv->chooser);
_gtk_recent_chooser_set_delegate (GTK_RECENT_CHOOSER (object),
GTK_RECENT_CHOOSER (priv->chooser));
-30
View File
@@ -329,10 +329,6 @@ static void gtk_scrolled_window_add (GtkContainer *conta
GtkWidget *widget);
static void gtk_scrolled_window_remove (GtkContainer *container,
GtkWidget *widget);
static void gtk_scrolled_window_forall (GtkContainer *container,
gboolean include_internals,
GtkCallback callback,
gpointer callback_data);
static gboolean gtk_scrolled_window_scroll_child (GtkScrolledWindow *scrolled_window,
GtkScrollType scroll,
gboolean horizontal);
@@ -532,7 +528,6 @@ gtk_scrolled_window_class_init (GtkScrolledWindowClass *class)
container_class->add = gtk_scrolled_window_add;
container_class->remove = gtk_scrolled_window_remove;
container_class->forall = gtk_scrolled_window_forall;
class->scroll_child = gtk_scrolled_window_scroll_child;
class->move_focus_out = gtk_scrolled_window_move_focus_out;
@@ -2857,31 +2852,6 @@ gtk_scrolled_window_snapshot (GtkWidget *widget,
gtk_css_gadget_snapshot (priv->gadget, snapshot);
}
static void
gtk_scrolled_window_forall (GtkContainer *container,
gboolean include_internals,
GtkCallback callback,
gpointer callback_data)
{
GtkScrolledWindowPrivate *priv;
GtkScrolledWindow *scrolled_window;
GTK_CONTAINER_CLASS (gtk_scrolled_window_parent_class)->forall (container,
include_internals,
callback,
callback_data);
if (include_internals)
{
scrolled_window = GTK_SCROLLED_WINDOW (container);
priv = scrolled_window->priv;
if (priv->vscrollbar)
callback (priv->vscrollbar, callback_data);
if (priv->hscrollbar)
callback (priv->hscrollbar, callback_data);
}
}
static gboolean
gtk_scrolled_window_scroll_child (GtkScrolledWindow *scrolled_window,
GtkScrollType scroll,
+2 -5
View File
@@ -157,7 +157,6 @@ gtk_shortcuts_group_add (GtkContainer *container,
typedef struct {
GtkCallback callback;
gpointer data;
gboolean include_internal;
} CallbackData;
static void
@@ -167,23 +166,21 @@ forall_cb (GtkWidget *widget, gpointer data)
CallbackData *cbdata = data;
self = GTK_SHORTCUTS_GROUP (gtk_widget_get_parent (widget));
if (cbdata->include_internal || widget != (GtkWidget*)self->title)
if (widget != (GtkWidget*)self->title)
cbdata->callback (widget, cbdata->data);
}
static void
gtk_shortcuts_group_forall (GtkContainer *container,
gboolean include_internal,
GtkCallback callback,
gpointer callback_data)
{
CallbackData cbdata;
cbdata.include_internal = include_internal;
cbdata.callback = callback;
cbdata.data = callback_data;
GTK_CONTAINER_CLASS (gtk_shortcuts_group_parent_class)->forall (container, include_internal, forall_cb, &cbdata);
GTK_CONTAINER_CLASS (gtk_shortcuts_group_parent_class)->forall (container, forall_cb, &cbdata);
}
static void
+4 -12
View File
@@ -154,24 +154,16 @@ gtk_shortcuts_section_remove (GtkContainer *container,
static void
gtk_shortcuts_section_forall (GtkContainer *container,
gboolean include_internal,
GtkCallback callback,
gpointer callback_data)
{
GtkShortcutsSection *self = (GtkShortcutsSection *)container;
GList *l;
if (include_internal)
for (l = self->groups; l; l = l->next)
{
GTK_CONTAINER_CLASS (gtk_shortcuts_section_parent_class)->forall (container, include_internal, callback, callback_data);
}
else
{
for (l = self->groups; l; l = l->next)
{
GtkWidget *group = l->data;
callback (group, callback_data);
}
GtkWidget *group = l->data;
callback (group, callback_data);
}
}
@@ -458,7 +450,7 @@ gtk_shortcuts_section_init (GtkShortcutsSection *self)
gtk_widget_set_hexpand (GTK_WIDGET (self->switcher), TRUE);
gtk_widget_set_halign (GTK_WIDGET (self->switcher), GTK_ALIGN_CENTER);
gtk_container_add (GTK_CONTAINER (self->footer), GTK_WIDGET (self->switcher));
gtk_box_pack_end (GTK_BOX (self->footer), self->show_all, TRUE, TRUE);
gtk_box_pack_end (GTK_BOX (self->footer), self->show_all);
gtk_widget_set_halign (self->show_all, GTK_ALIGN_END);
self->pan_gesture = gtk_gesture_pan_new (GTK_WIDGET (self->stack), GTK_ORIENTATION_HORIZONTAL);
+13 -22
View File
@@ -376,38 +376,29 @@ gtk_shortcuts_window_remove (GtkContainer *container,
static void
gtk_shortcuts_window_forall (GtkContainer *container,
gboolean include_internal,
GtkCallback callback,
gpointer callback_data)
{
GtkShortcutsWindow *self = (GtkShortcutsWindow *)container;
GtkShortcutsWindowPrivate *priv = gtk_shortcuts_window_get_instance_private (self);
if (include_internal)
if (priv->stack)
{
GTK_CONTAINER_CLASS (gtk_shortcuts_window_parent_class)->forall (container, include_internal, callback, callback_data);
}
else
{
if (priv->stack)
GList *children, *l;
GtkWidget *search;
GtkWidget *empty;
search = gtk_stack_get_child_by_name (GTK_STACK (priv->stack), "internal-search");
empty = gtk_stack_get_child_by_name (GTK_STACK (priv->stack), "no-search-results");
children = gtk_container_get_children (GTK_CONTAINER (priv->stack));
for (l = children; l; l = l->next)
{
GList *children, *l;
GtkWidget *search;
GtkWidget *empty;
GtkWidget *child = l->data;
search = gtk_stack_get_child_by_name (GTK_STACK (priv->stack), "internal-search");
empty = gtk_stack_get_child_by_name (GTK_STACK (priv->stack), "no-search-results");
children = gtk_container_get_children (GTK_CONTAINER (priv->stack));
for (l = children; l; l = l->next)
{
GtkWidget *child = l->data;
if (include_internal ||
(child != search && child != empty))
callback (child, callback_data);
}
g_list_free (children);
if (child != search && child != empty)
callback (child, callback_data);
}
g_list_free (children);
}
}
-2
View File
@@ -169,7 +169,6 @@ static void gtk_stack_add (GtkContainer *widget,
static void gtk_stack_remove (GtkContainer *widget,
GtkWidget *child);
static void gtk_stack_forall (GtkContainer *container,
gboolean include_internals,
GtkCallback callback,
gpointer callback_data);
static void gtk_stack_compute_expand (GtkWidget *widget,
@@ -1852,7 +1851,6 @@ gtk_stack_set_visible_child_full (GtkStack *stack,
static void
gtk_stack_forall (GtkContainer *container,
gboolean include_internals,
GtkCallback callback,
gpointer callback_data)
{
-2
View File
@@ -592,7 +592,6 @@ static void gtk_text_view_add (GtkContainer *container,
static void gtk_text_view_remove (GtkContainer *container,
GtkWidget *child);
static void gtk_text_view_forall (GtkContainer *container,
gboolean include_internals,
GtkCallback callback,
gpointer callback_data);
@@ -6039,7 +6038,6 @@ gtk_text_view_remove (GtkContainer *container,
static void
gtk_text_view_forall (GtkContainer *container,
gboolean include_internals,
GtkCallback callback,
gpointer callback_data)
{
+1 -6
View File
@@ -234,7 +234,6 @@ static void gtk_toolbar_add (GtkContainer *contain
static void gtk_toolbar_remove (GtkContainer *container,
GtkWidget *widget);
static void gtk_toolbar_forall (GtkContainer *container,
gboolean include_internals,
GtkCallback callback,
gpointer callback_data);
static GType gtk_toolbar_child_type (GtkContainer *container);
@@ -2366,7 +2365,6 @@ gtk_toolbar_remove (GtkContainer *container,
static void
gtk_toolbar_forall (GtkContainer *container,
gboolean include_internals,
GtkCallback callback,
gpointer callback_data)
{
@@ -2382,7 +2380,7 @@ gtk_toolbar_forall (GtkContainer *container,
ToolbarContent *content = list->data;
GList *next = list->next;
if (include_internals || !toolbar_content_is_placeholder (content))
if (!toolbar_content_is_placeholder (content))
{
GtkWidget *child = toolbar_content_get_widget (content);
@@ -2392,9 +2390,6 @@ gtk_toolbar_forall (GtkContainer *container,
list = next;
}
if (include_internals && priv->arrow_button)
callback (priv->arrow_button, callback_data);
}
static GType
+6 -11
View File
@@ -422,7 +422,6 @@ gtk_tool_button_construct_contents (GtkToolItem *tool_item)
{
gfloat align;
gtk_label_set_angle (GTK_LABEL (label), 0);
align = gtk_tool_item_get_text_alignment (GTK_TOOL_ITEM (button));
if (align < 0.4)
gtk_widget_set_halign (label, GTK_ALIGN_START);
@@ -436,10 +435,6 @@ gtk_tool_button_construct_contents (GtkToolItem *tool_item)
gfloat align;
gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_NONE);
if (gtk_widget_get_direction (GTK_WIDGET (tool_item)) == GTK_TEXT_DIR_RTL)
gtk_label_set_angle (GTK_LABEL (label), -90);
else
gtk_label_set_angle (GTK_LABEL (label), 90);
align = gtk_tool_item_get_text_alignment (GTK_TOOL_ITEM (button));
if (align < 0.4)
gtk_widget_set_valign (label, GTK_ALIGN_END);
@@ -518,8 +513,8 @@ gtk_tool_button_construct_contents (GtkToolItem *tool_item)
else
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL,0);
if (icon)
gtk_box_pack_start (GTK_BOX (box), icon, TRUE, TRUE);
gtk_box_pack_end (GTK_BOX (box), label, FALSE, TRUE);
gtk_box_pack_start (GTK_BOX (box), icon);
gtk_box_pack_end (GTK_BOX (box), label);
gtk_container_add (GTK_CONTAINER (button->priv->button), box);
gtk_style_context_add_class (gtk_widget_get_style_context (button->priv->button), "image-button");
gtk_style_context_add_class (gtk_widget_get_style_context (button->priv->button), "text-button");
@@ -530,17 +525,17 @@ gtk_tool_button_construct_contents (GtkToolItem *tool_item)
{
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
if (icon)
gtk_box_pack_start (GTK_BOX (box), icon, label? FALSE : TRUE, TRUE);
gtk_box_pack_start (GTK_BOX (box), icon);
if (label)
gtk_box_pack_end (GTK_BOX (box), label, TRUE, TRUE);
gtk_box_pack_end (GTK_BOX (box), label);
}
else
{
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
if (icon)
gtk_box_pack_end (GTK_BOX (box), icon, label ? FALSE : TRUE, TRUE);
gtk_box_pack_end (GTK_BOX (box), icon);
if (label)
gtk_box_pack_start (GTK_BOX (box), label, TRUE, TRUE);
gtk_box_pack_start (GTK_BOX (box), label);
}
gtk_container_add (GTK_CONTAINER (button->priv->button), box);
gtk_style_context_add_class (gtk_widget_get_style_context (button->priv->button), "image-button");
-11
View File
@@ -335,10 +335,8 @@ gtk_tool_item_group_header_adjust_style (GtkToolItemGroup *group)
{
GtkWidget *frame = gtk_bin_get_child (GTK_BIN (group->priv->header));
GtkWidget *label_widget = gtk_bin_get_child (GTK_BIN (frame));
GtkWidget *widget = GTK_WIDGET (group);
GtkToolItemGroupPrivate* priv = group->priv;
gint dx = 0, dy = 0;
GtkTextDirection direction = gtk_widget_get_direction (widget);
switch (gtk_tool_shell_get_orientation (GTK_TOOL_SHELL (group)))
{
@@ -348,10 +346,6 @@ gtk_tool_item_group_header_adjust_style (GtkToolItemGroup *group)
if (GTK_IS_LABEL (label_widget))
{
gtk_label_set_ellipsize (GTK_LABEL (label_widget), PANGO_ELLIPSIZE_NONE);
if (GTK_TEXT_DIR_RTL == direction)
gtk_label_set_angle (GTK_LABEL (label_widget), -90);
else
gtk_label_set_angle (GTK_LABEL (label_widget), 90);
}
break;
@@ -361,7 +355,6 @@ gtk_tool_item_group_header_adjust_style (GtkToolItemGroup *group)
if (GTK_IS_LABEL (label_widget))
{
gtk_label_set_ellipsize (GTK_LABEL (label_widget), priv->ellipsize);
gtk_label_set_angle (GTK_LABEL (label_widget), 0);
}
break;
}
@@ -1312,7 +1305,6 @@ gtk_tool_item_group_remove (GtkContainer *container,
static void
gtk_tool_item_group_forall (GtkContainer *container,
gboolean internals,
GtkCallback callback,
gpointer callback_data)
{
@@ -1320,9 +1312,6 @@ gtk_tool_item_group_forall (GtkContainer *container,
GtkToolItemGroupPrivate* priv = group->priv;
GList *children;
if (internals && priv->header)
callback (priv->header, callback_data);
children = priv->children;
while (children)
{
-1
View File
@@ -791,7 +791,6 @@ gtk_tool_palette_remove (GtkContainer *container,
static void
gtk_tool_palette_forall (GtkContainer *container,
gboolean internals,
GtkCallback callback,
gpointer callback_data)
{
+2 -17
View File
@@ -624,7 +624,6 @@ static void gtk_tree_view_style_updated (GtkWidget *widget);
static void gtk_tree_view_remove (GtkContainer *container,
GtkWidget *widget);
static void gtk_tree_view_forall (GtkContainer *container,
gboolean include_internals,
GtkCallback callback,
gpointer callback_data);
@@ -8141,14 +8140,11 @@ gtk_tree_view_remove (GtkContainer *container,
static void
gtk_tree_view_forall (GtkContainer *container,
gboolean include_internals,
GtkCallback callback,
gpointer callback_data)
{
GtkTreeView *tree_view = GTK_TREE_VIEW (container);
GtkTreeViewChild *child = NULL;
GtkTreeViewColumn *column;
GtkWidget *button;
GList *tmp_list;
tmp_list = tree_view->priv->children;
@@ -8159,17 +8155,6 @@ gtk_tree_view_forall (GtkContainer *container,
(* callback) (child->widget, callback_data);
}
if (include_internals == FALSE)
return;
for (tmp_list = tree_view->priv->columns; tmp_list; tmp_list = tmp_list->next)
{
column = tmp_list->data;
button = gtk_tree_view_column_get_button (column);
if (button)
(* callback) (button, callback_data);
}
}
/* Returns TRUE is any of the columns contains a cell that can-focus.
@@ -11722,10 +11707,10 @@ gtk_tree_view_insert_column (GtkTreeView *tree_view,
column, position);
tree_view->priv->n_columns++;
_gtk_tree_view_column_set_tree_view (column, tree_view);
gtk_tree_view_update_button_position (tree_view, column);
_gtk_tree_view_column_set_tree_view (column, tree_view);
if (gtk_widget_get_realized (GTK_WIDGET (tree_view)))
{
GList *list;

Some files were not shown because too many files have changed in this diff Show More