forked from AuroraMiddleware/gtk
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.
This commit is contained in:
parent
c6b2184aa0
commit
59c6862a03
@ -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));
|
||||
}
|
||||
|
@ -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 ());
|
||||
}
|
||||
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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));
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user