diff options
author | Emmanuele Bassi <ebassi@gnome.org> | 2019-05-06 12:06:27 +0100 |
---|---|---|
committer | Emmanuele Bassi <ebassi@gnome.org> | 2019-05-06 12:06:27 +0100 |
commit | 59c6862a0301d4c922f6adc36c81f859997555ba (patch) | |
tree | 431e2b8edce688ae96fab4afd6184a37f598462f | |
parent | c6b2184aa0cce3b1ac65d538495cd725db0f4770 (diff) | |
download | gtk+-59c6862a0301d4c922f6adc36c81f859997555ba.tar.gz |
Use gtk_widget_class_set_layout_manager_type()
Instead of manually creating the layout manager inside the instance
initialization function, we can let GtkWidget do that for us.
-rw-r--r-- | gtk/gtkbox.c | 4 | ||||
-rw-r--r-- | gtk/gtkfilechooserbutton.c | 4 | ||||
-rw-r--r-- | gtk/gtkfilechooserwidget.c | 4 | ||||
-rw-r--r-- | gtk/gtkfixed.c | 6 | ||||
-rw-r--r-- | gtk/gtkgrid.c | 5 | ||||
-rw-r--r-- | gtk/gtkoverlay.c | 5 |
6 files changed, 15 insertions, 13 deletions
diff --git a/gtk/gtkbox.c b/gtk/gtkbox.c index 1491d8d007..616b7d6e44 100644 --- a/gtk/gtkbox.c +++ b/gtk/gtkbox.c @@ -161,6 +161,7 @@ gtk_box_class_init (GtkBoxClass *class) g_object_class_install_properties (object_class, LAST_PROP, props); + gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BOX_LAYOUT); gtk_widget_class_set_accessible_role (widget_class, ATK_ROLE_FILLER); gtk_widget_class_set_css_name (widget_class, I_("box")); } @@ -344,12 +345,9 @@ static void gtk_box_init (GtkBox *box) { GtkBoxPrivate *priv = gtk_box_get_instance_private (box); - GtkLayoutManager *box_layout = gtk_box_layout_new (GTK_ORIENTATION_HORIZONTAL); gtk_widget_set_has_surface (GTK_WIDGET (box), FALSE); - gtk_widget_set_layout_manager (GTK_WIDGET (box), box_layout); - priv->orientation = GTK_ORIENTATION_HORIZONTAL; _gtk_orientable_set_style_classes (GTK_ORIENTABLE (box)); } diff --git a/gtk/gtkfilechooserbutton.c b/gtk/gtkfilechooserbutton.c index eb4d883955..8b87409f84 100644 --- a/gtk/gtkfilechooserbutton.c +++ b/gtk/gtkfilechooserbutton.c @@ -422,6 +422,8 @@ gtk_file_chooser_button_class_init (GtkFileChooserButtonClass * class) _gtk_file_chooser_install_properties (gobject_class); gtk_widget_class_set_css_name (widget_class, I_("filechooserbutton")); + + gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BIN_LAYOUT); } static void @@ -497,8 +499,6 @@ gtk_file_chooser_button_init (GtkFileChooserButton *button) target_list, GDK_ACTION_COPY); gdk_content_formats_unref (target_list); - - gtk_widget_set_layout_manager (GTK_WIDGET (button), gtk_bin_layout_new ()); } diff --git a/gtk/gtkfilechooserwidget.c b/gtk/gtkfilechooserwidget.c index 915c615b78..a5915769e9 100644 --- a/gtk/gtkfilechooserwidget.c +++ b/gtk/gtkfilechooserwidget.c @@ -8326,6 +8326,8 @@ gtk_file_chooser_widget_class_init (GtkFileChooserWidgetClass *class) gtk_widget_class_bind_template_callback (widget_class, widget_key_press_cb); gtk_widget_class_set_css_name (widget_class, I_("filechooser")); + + gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BIN_LAYOUT); } static void @@ -8467,8 +8469,6 @@ gtk_file_chooser_widget_init (GtkFileChooserWidget *impl) */ post_process_ui (impl); - gtk_widget_set_layout_manager (GTK_WIDGET (impl), gtk_bin_layout_new ()); - profile_end ("end", NULL); } diff --git a/gtk/gtkfixed.c b/gtk/gtkfixed.c index 4f0ae14241..24af3fd513 100644 --- a/gtk/gtkfixed.c +++ b/gtk/gtkfixed.c @@ -96,11 +96,14 @@ static void gtk_fixed_class_init (GtkFixedClass *klass) { GtkContainerClass *container_class = GTK_CONTAINER_CLASS (klass); + GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); container_class->add = gtk_fixed_add; container_class->remove = gtk_fixed_remove; container_class->forall = gtk_fixed_forall; container_class->child_type = gtk_fixed_child_type; + + gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_FIXED_LAYOUT); } static GType @@ -117,8 +120,7 @@ gtk_fixed_init (GtkFixed *self) gtk_widget_set_has_surface (GTK_WIDGET (self), FALSE); gtk_widget_set_overflow (GTK_WIDGET (self), GTK_OVERFLOW_HIDDEN); - priv->layout = gtk_fixed_layout_new (); - gtk_widget_set_layout_manager (GTK_WIDGET (self), priv->layout); + priv->layout = gtk_widget_get_layout_manager (GTK_WIDGET (self)); } /** diff --git a/gtk/gtkgrid.c b/gtk/gtkgrid.c index f68468d769..18d005280b 100644 --- a/gtk/gtkgrid.c +++ b/gtk/gtkgrid.c @@ -380,6 +380,8 @@ gtk_grid_class_init (GtkGridClass *class) g_object_class_install_properties (object_class, N_PROPERTIES, obj_properties); gtk_widget_class_set_css_name (widget_class, I_("grid")); + + gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_GRID_LAYOUT); } static void @@ -389,8 +391,7 @@ gtk_grid_init (GtkGrid *grid) gtk_widget_set_has_surface (GTK_WIDGET (grid), FALSE); - priv->layout_manager = gtk_grid_layout_new (); - gtk_widget_set_layout_manager (GTK_WIDGET (grid), priv->layout_manager); + priv->layout_manager = gtk_widget_get_layout_manager (GTK_WIDGET (grid)); priv->orientation = GTK_ORIENTATION_HORIZONTAL; _gtk_orientable_set_style_classes (GTK_ORIENTABLE (grid)); diff --git a/gtk/gtkoverlay.c b/gtk/gtkoverlay.c index 5195f9ac0a..13af196f40 100644 --- a/gtk/gtkoverlay.c +++ b/gtk/gtkoverlay.c @@ -302,6 +302,8 @@ gtk_overlay_class_init (GtkOverlayClass *klass) GDK_TYPE_RECTANGLE | G_SIGNAL_TYPE_STATIC_SCOPE); gtk_widget_class_set_css_name (widget_class, I_("overlay")); + + gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_OVERLAY_LAYOUT); } static void @@ -311,8 +313,7 @@ gtk_overlay_init (GtkOverlay *overlay) gtk_widget_set_has_surface (GTK_WIDGET (overlay), FALSE); - priv->layout = gtk_overlay_layout_new (); - gtk_widget_set_layout_manager (GTK_WIDGET (overlay), priv->layout); + priv->layout = gtk_widget_get_layout_manager (GTK_WIDGET (overlay)); } static GtkBuildableIface *parent_buildable_iface; |