Use gtk_revealer_set_child throughout

Replace all uses of gtk_container_add on revealers
with gtk_revealer_set_child.
This commit is contained in:
Matthias Clasen 2020-05-02 17:02:42 -04:00
parent 686be577d5
commit 649ae635a7
9 changed files with 21 additions and 22 deletions

View File

@ -249,7 +249,7 @@ gtk_action_bar_init (GtkActionBar *self)
gtk_center_box_set_start_widget (GTK_CENTER_BOX (self->center_box), self->start_box);
gtk_center_box_set_end_widget (GTK_CENTER_BOX (self->center_box), self->end_box);
gtk_container_add (GTK_CONTAINER (self->revealer), self->center_box);
gtk_revealer_set_child (GTK_REVEALER (self->revealer), self->center_box);
}
static GtkBuildableIface *parent_buildable_iface;

View File

@ -496,7 +496,7 @@ gtk_info_bar_init (GtkInfoBar *info_bar)
gtk_widget_set_parent (info_bar->revealer, widget);
main_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_container_add (GTK_CONTAINER (info_bar->revealer), main_box);
gtk_revealer_set_child (GTK_REVEALER (info_bar->revealer), main_box);
info_bar->content_area = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_widget_set_hexpand (info_bar->content_area, TRUE);

View File

@ -355,8 +355,7 @@ gtk_search_bar_init (GtkSearchBar *bar)
gtk_center_box_set_end_widget (GTK_CENTER_BOX (priv->box_center), priv->close_button);
gtk_widget_hide (priv->close_button);
gtk_container_add (GTK_CONTAINER (priv->revealer), priv->box_center);
gtk_revealer_set_child (GTK_REVEALER (priv->revealer), priv->box_center);
g_signal_connect (priv->revealer, "notify::reveal-child",
G_CALLBACK (reveal_child_changed_cb), bar);

View File

@ -63,7 +63,7 @@ main(int argc, char **argv)
gtk_window_set_child (GTK_WINDOW (window), revealer);
grid = gtk_grid_new ();
gtk_container_add (GTK_CONTAINER (revealer), grid);
gtk_revealer_set_child (GTK_REVEALER (revealer), grid);
cssprovider = gtk_css_provider_new ();
gtk_css_provider_load_from_data (cssprovider, "* { padding: 2px; text-shadow: 5px 5px 2px grey; }", -1);

View File

@ -152,7 +152,7 @@ main (int argc, char *argv[])
frame = gtk_frame_new (NULL);
gtk_widget_add_css_class (frame, "app-notification");
gtk_container_add (GTK_CONTAINER (revealer), frame);
gtk_revealer_set_child (GTK_REVEALER (revealer), frame);
gtk_widget_show (frame);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, FALSE);

View File

@ -22,7 +22,7 @@ remove_this_row (GtkButton *button, GtkWidget *child)
gtk_widget_show (revealer);
g_object_ref (child);
gtk_container_remove (GTK_CONTAINER (gtk_widget_get_parent (child)), child);
gtk_container_add (GTK_CONTAINER (revealer), child);
gtk_revealer_set_child (GTK_REVEALER (revealer), child);
g_object_unref (child);
gtk_container_add (GTK_CONTAINER (row), revealer);
g_signal_connect (revealer, "notify::child-revealed",
@ -38,9 +38,9 @@ row_revealed (GObject *revealer, GParamSpec *pspec, gpointer data)
GtkWidget *row, *child;
row = gtk_widget_get_parent (GTK_WIDGET (revealer));
child = gtk_bin_get_child (GTK_BIN (revealer));
child = gtk_revealer_get_child (GTK_REVEALER (revealer));
g_object_ref (child);
gtk_container_remove (GTK_CONTAINER (revealer), child);
gtk_revealer_set_child (GTK_REVEALER (revealer), NULL);
gtk_widget_destroy (GTK_WIDGET (revealer));
gtk_container_add (GTK_CONTAINER (row), child);
g_object_unref (child);
@ -57,7 +57,7 @@ add_row_below (GtkButton *button, GtkWidget *child)
list = gtk_widget_get_parent (row);
row = create_row ("Extra row");
revealer = gtk_revealer_new ();
gtk_container_add (GTK_CONTAINER (revealer), row);
gtk_revealer_set_child (GTK_REVEALER (revealer), row);
g_signal_connect (revealer, "notify::child-revealed",
G_CALLBACK (row_revealed), NULL);
gtk_list_box_insert (GTK_LIST_BOX (list), revealer, index + 1);

View File

@ -35,7 +35,7 @@ main (gint argc,
gtk_widget_set_valign (revealer, GTK_ALIGN_START);
entry = gtk_entry_new ();
gtk_editable_set_text (GTK_EDITABLE (entry), "00000");
gtk_container_add (GTK_CONTAINER (revealer), entry);
gtk_revealer_set_child (GTK_REVEALER (revealer), entry);
g_object_bind_property (widget, "active", revealer, "reveal-child", 0);
gtk_revealer_set_transition_type (GTK_REVEALER (revealer), GTK_REVEALER_TRANSITION_TYPE_NONE);
gtk_revealer_set_transition_duration (GTK_REVEALER (revealer), 2000);
@ -48,7 +48,7 @@ main (gint argc,
gtk_widget_set_valign (revealer, GTK_ALIGN_END);
entry = gtk_entry_new ();
gtk_editable_set_text (GTK_EDITABLE (entry), "00000");
gtk_container_add (GTK_CONTAINER (revealer), entry);
gtk_revealer_set_child (GTK_REVEALER (revealer), entry);
g_object_bind_property (widget, "active", revealer, "reveal-child", 0);
gtk_revealer_set_transition_type (GTK_REVEALER (revealer), GTK_REVEALER_TRANSITION_TYPE_CROSSFADE);
gtk_revealer_set_transition_duration (GTK_REVEALER (revealer), 2000);
@ -61,7 +61,7 @@ main (gint argc,
gtk_widget_set_halign (revealer, GTK_ALIGN_START);
entry = gtk_entry_new ();
gtk_editable_set_text (GTK_EDITABLE (entry), "12345");
gtk_container_add (GTK_CONTAINER (revealer), entry);
gtk_revealer_set_child (GTK_REVEALER (revealer), entry);
g_object_bind_property (widget, "active", revealer, "reveal-child", 0);
gtk_revealer_set_transition_type (GTK_REVEALER (revealer), GTK_REVEALER_TRANSITION_TYPE_SLIDE_RIGHT);
gtk_revealer_set_transition_duration (GTK_REVEALER (revealer), 2000);
@ -76,7 +76,7 @@ main (gint argc,
gtk_widget_set_valign (revealer, GTK_ALIGN_START);
entry = gtk_entry_new ();
gtk_editable_set_text (GTK_EDITABLE (entry), "12345");
gtk_container_add (GTK_CONTAINER (revealer), entry);
gtk_revealer_set_child (GTK_REVEALER (revealer), entry);
g_object_bind_property (widget, "active", revealer, "reveal-child", 0);
gtk_revealer_set_transition_type (GTK_REVEALER (revealer), GTK_REVEALER_TRANSITION_TYPE_SWING_RIGHT);
gtk_revealer_set_transition_duration (GTK_REVEALER (revealer), 2000);
@ -89,7 +89,7 @@ main (gint argc,
gtk_widget_set_valign (revealer, GTK_ALIGN_START);
entry = gtk_entry_new ();
gtk_editable_set_text (GTK_EDITABLE (entry), "23456");
gtk_container_add (GTK_CONTAINER (revealer), entry);
gtk_revealer_set_child (GTK_REVEALER (revealer), entry);
g_object_bind_property (widget, "active", revealer, "reveal-child", 0);
gtk_revealer_set_transition_type (GTK_REVEALER (revealer), GTK_REVEALER_TRANSITION_TYPE_SLIDE_DOWN);
gtk_revealer_set_transition_duration (GTK_REVEALER (revealer), 2000);
@ -102,7 +102,7 @@ main (gint argc,
gtk_widget_set_valign (revealer, GTK_ALIGN_START);
entry = gtk_entry_new ();
gtk_editable_set_text (GTK_EDITABLE (entry), "23456");
gtk_container_add (GTK_CONTAINER (revealer), entry);
gtk_revealer_set_child (GTK_REVEALER (revealer), entry);
g_object_bind_property (widget, "active", revealer, "reveal-child", 0);
gtk_revealer_set_transition_type (GTK_REVEALER (revealer), GTK_REVEALER_TRANSITION_TYPE_SWING_DOWN);
gtk_revealer_set_transition_duration (GTK_REVEALER (revealer), 2000);
@ -115,7 +115,7 @@ main (gint argc,
gtk_widget_set_halign (revealer, GTK_ALIGN_END);
entry = gtk_entry_new ();
gtk_editable_set_text (GTK_EDITABLE (entry), "34567");
gtk_container_add (GTK_CONTAINER (revealer), entry);
gtk_revealer_set_child (GTK_REVEALER (revealer), entry);
g_object_bind_property (widget, "active", revealer, "reveal-child", 0);
gtk_revealer_set_transition_type (GTK_REVEALER (revealer), GTK_REVEALER_TRANSITION_TYPE_SLIDE_LEFT);
gtk_revealer_set_transition_duration (GTK_REVEALER (revealer), 2000);
@ -130,7 +130,7 @@ main (gint argc,
gtk_widget_set_valign (revealer, GTK_ALIGN_START);
entry = gtk_entry_new ();
gtk_editable_set_text (GTK_EDITABLE (entry), "34567");
gtk_container_add (GTK_CONTAINER (revealer), entry);
gtk_revealer_set_child (GTK_REVEALER (revealer), entry);
g_object_bind_property (widget, "active", revealer, "reveal-child", 0);
gtk_revealer_set_transition_type (GTK_REVEALER (revealer), GTK_REVEALER_TRANSITION_TYPE_SWING_LEFT);
gtk_revealer_set_transition_duration (GTK_REVEALER (revealer), 2000);
@ -143,7 +143,7 @@ main (gint argc,
gtk_widget_set_valign (revealer, GTK_ALIGN_END);
entry = gtk_entry_new ();
gtk_editable_set_text (GTK_EDITABLE (entry), "45678");
gtk_container_add (GTK_CONTAINER (revealer), entry);
gtk_revealer_set_child (GTK_REVEALER (revealer), entry);
g_object_bind_property (widget, "active", revealer, "reveal-child", 0);
gtk_revealer_set_transition_type (GTK_REVEALER (revealer), GTK_REVEALER_TRANSITION_TYPE_SLIDE_UP);
gtk_revealer_set_transition_duration (GTK_REVEALER (revealer), 2000);
@ -156,7 +156,7 @@ main (gint argc,
gtk_widget_set_valign (revealer, GTK_ALIGN_END);
entry = gtk_entry_new ();
gtk_editable_set_text (GTK_EDITABLE (entry), "45678");
gtk_container_add (GTK_CONTAINER (revealer), entry);
gtk_revealer_set_child (GTK_REVEALER (revealer), entry);
g_object_bind_property (widget, "active", revealer, "reveal-child", 0);
gtk_revealer_set_transition_type (GTK_REVEALER (revealer), GTK_REVEALER_TRANSITION_TYPE_SWING_UP);
gtk_revealer_set_transition_duration (GTK_REVEALER (revealer), 2000);

View File

@ -44,7 +44,7 @@ on_activate (GApplication *app,
sidebar = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_widget_set_size_request (sidebar, 150, -1);
gtk_widget_add_css_class (sidebar, GTK_STYLE_CLASS_SIDEBAR);
gtk_container_add (GTK_CONTAINER (revealer), sidebar);
gtk_revealer_set_child (GTK_REVEALER (revealer), sidebar);
img = gtk_image_new ();
g_object_set (img, "icon-name", "face-smile-symbolic",

View File

@ -18,7 +18,7 @@ keep_size (int direction,
g_object_get (settings, "gtk-enable-animations", &animations_before, NULL);
g_object_set (settings, "gtk-enable-animations", animations, NULL);
gtk_container_add (GTK_CONTAINER (revealer), child);
gtk_revealer_set_child (GTK_REVEALER (revealer), child);
gtk_revealer_set_transition_type (revealer, transition_type);