mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-06 19:00:12 +00:00
GtkActionBar: Just leave the center widget as NULL, initially
No need to construct a box that gets thrown away later. Plus, this fixes the defaultvalue test for GtkActionBar.
This commit is contained in:
parent
cc6ffd0481
commit
3efd0b2874
@ -99,19 +99,6 @@ get_css_padding_and_border (GtkWidget *widget,
|
|||||||
border->left += tmp.left;
|
border->left += tmp.left;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
construct_center_widget (GtkActionBar *bar)
|
|
||||||
{
|
|
||||||
GtkActionBarPrivate *priv = gtk_action_bar_get_instance_private (bar);
|
|
||||||
|
|
||||||
g_assert (priv->center_widget == NULL);
|
|
||||||
|
|
||||||
priv->center_widget = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
|
||||||
gtk_widget_set_valign (priv->center_widget, GTK_ALIGN_CENTER);
|
|
||||||
gtk_widget_show (priv->center_widget);
|
|
||||||
gtk_widget_set_parent (priv->center_widget, GTK_WIDGET (bar));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_action_bar_init (GtkActionBar *bar)
|
gtk_action_bar_init (GtkActionBar *bar)
|
||||||
{
|
{
|
||||||
@ -127,8 +114,6 @@ gtk_action_bar_init (GtkActionBar *bar)
|
|||||||
priv->children = NULL;
|
priv->children = NULL;
|
||||||
priv->spacing = DEFAULT_SPACING;
|
priv->spacing = DEFAULT_SPACING;
|
||||||
|
|
||||||
construct_center_widget (bar);
|
|
||||||
|
|
||||||
context = gtk_widget_get_style_context (GTK_WIDGET (bar));
|
context = gtk_widget_get_style_context (GTK_WIDGET (bar));
|
||||||
gtk_style_context_add_class (context, "action-bar");
|
gtk_style_context_add_class (context, "action-bar");
|
||||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_HORIZONTAL);
|
gtk_style_context_add_class (context, GTK_STYLE_CLASS_HORIZONTAL);
|
||||||
@ -618,10 +603,6 @@ gtk_action_bar_set_center_widget (GtkActionBar *bar,
|
|||||||
gtk_widget_set_valign (priv->center_widget, GTK_ALIGN_CENTER);
|
gtk_widget_set_valign (priv->center_widget, GTK_ALIGN_CENTER);
|
||||||
gtk_widget_show (center_widget);
|
gtk_widget_show (center_widget);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
construct_center_widget (bar);
|
|
||||||
}
|
|
||||||
|
|
||||||
gtk_widget_queue_resize (GTK_WIDGET (bar));
|
gtk_widget_queue_resize (GTK_WIDGET (bar));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user