forked from AuroraMiddleware/gtk
Merge branch 'drop-stack-homogeneous' into 'master'
Drop stack homogeneous Closes #2673 See merge request GNOME/gtk!1791
This commit is contained in:
commit
0a2e0775b6
@ -5626,8 +5626,6 @@ gtk_stack_get_visible_child
|
||||
gtk_stack_set_visible_child_name
|
||||
gtk_stack_get_visible_child_name
|
||||
gtk_stack_set_visible_child_full
|
||||
gtk_stack_set_homogeneous
|
||||
gtk_stack_get_homogeneous
|
||||
gtk_stack_set_hhomogeneous
|
||||
gtk_stack_get_hhomogeneous
|
||||
gtk_stack_set_vhomogeneous
|
||||
|
@ -509,7 +509,8 @@ add_emoji (GtkWidget *list,
|
||||
g_object_set_data (G_OBJECT (child), "base", label);
|
||||
|
||||
stack = gtk_stack_new ();
|
||||
gtk_stack_set_homogeneous (GTK_STACK (stack), TRUE);
|
||||
gtk_stack_set_hhomogeneous (GTK_STACK (stack), TRUE);
|
||||
gtk_stack_set_vhomogeneous (GTK_STACK (stack), TRUE);
|
||||
gtk_stack_set_transition_type (GTK_STACK (stack), GTK_STACK_TRANSITION_TYPE_OVER_RIGHT_LEFT);
|
||||
gtk_container_add (GTK_CONTAINER (box), stack);
|
||||
g_object_set_data (G_OBJECT (child), "stack", stack);
|
||||
|
@ -418,7 +418,8 @@ gtk_shortcuts_section_init (GtkShortcutsSection *self)
|
||||
gtk_box_set_spacing (GTK_BOX (self), 22);
|
||||
|
||||
self->stack = g_object_new (GTK_TYPE_STACK,
|
||||
"homogeneous", TRUE,
|
||||
"hhomogeneous", TRUE,
|
||||
"vhomogeneous", TRUE,
|
||||
"transition-type", GTK_STACK_TRANSITION_TYPE_SLIDE_LEFT_RIGHT,
|
||||
"vexpand", TRUE,
|
||||
"visible", TRUE,
|
||||
|
@ -913,7 +913,8 @@ gtk_shortcuts_window_init (GtkShortcutsWindow *self)
|
||||
priv->stack = g_object_new (GTK_TYPE_STACK,
|
||||
"hexpand", TRUE,
|
||||
"vexpand", TRUE,
|
||||
"homogeneous", TRUE,
|
||||
"hhomogeneous", TRUE,
|
||||
"vhomogeneous", TRUE,
|
||||
"transition-type", GTK_STACK_TRANSITION_TYPE_CROSSFADE,
|
||||
NULL);
|
||||
gtk_container_add (GTK_CONTAINER (priv->main_box), GTK_WIDGET (priv->stack));
|
||||
|
@ -163,7 +163,6 @@ G_DEFINE_TYPE_WITH_CODE (GtkStack, gtk_stack, GTK_TYPE_CONTAINER,
|
||||
gtk_stack_buildable_interface_init))
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_HOMOGENEOUS,
|
||||
PROP_HHOMOGENEOUS,
|
||||
PROP_VHOMOGENEOUS,
|
||||
PROP_VISIBLE_CHILD,
|
||||
@ -641,9 +640,6 @@ gtk_stack_get_property (GObject *object,
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_HOMOGENEOUS:
|
||||
g_value_set_boolean (value, gtk_stack_get_homogeneous (stack));
|
||||
break;
|
||||
case PROP_HHOMOGENEOUS:
|
||||
g_value_set_boolean (value, gtk_stack_get_hhomogeneous (stack));
|
||||
break;
|
||||
@ -687,9 +683,6 @@ gtk_stack_set_property (GObject *object,
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_HOMOGENEOUS:
|
||||
gtk_stack_set_homogeneous (stack, g_value_get_boolean (value));
|
||||
break;
|
||||
case PROP_HHOMOGENEOUS:
|
||||
gtk_stack_set_hhomogeneous (stack, g_value_get_boolean (value));
|
||||
break;
|
||||
@ -738,11 +731,6 @@ gtk_stack_class_init (GtkStackClass *klass)
|
||||
container_class->remove = gtk_stack_remove;
|
||||
container_class->forall = gtk_stack_forall;
|
||||
|
||||
stack_props[PROP_HOMOGENEOUS] =
|
||||
g_param_spec_boolean ("homogeneous", P_("Homogeneous"), P_("Homogeneous sizing"),
|
||||
TRUE,
|
||||
GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
|
||||
|
||||
/**
|
||||
* GtkStack:hhomogeneous:
|
||||
*
|
||||
@ -1570,73 +1558,6 @@ gtk_stack_page_get_child (GtkStackPage *page)
|
||||
return page->widget;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_stack_set_homogeneous:
|
||||
* @stack: a #GtkStack
|
||||
* @homogeneous: %TRUE to make @stack homogeneous
|
||||
*
|
||||
* Sets the #GtkStack to be homogeneous or not. If it
|
||||
* is homogeneous, the #GtkStack will request the same
|
||||
* size for all its children. If it isn't, the stack
|
||||
* may change size when a different child becomes visible.
|
||||
*
|
||||
* Homogeneity can be controlled separately
|
||||
* for horizontal and vertical size, with the
|
||||
* #GtkStack:hhomogeneous and #GtkStack:vhomogeneous.
|
||||
*/
|
||||
void
|
||||
gtk_stack_set_homogeneous (GtkStack *stack,
|
||||
gboolean homogeneous)
|
||||
{
|
||||
GtkStackPrivate *priv = gtk_stack_get_instance_private (stack);
|
||||
|
||||
g_return_if_fail (GTK_IS_STACK (stack));
|
||||
|
||||
homogeneous = !!homogeneous;
|
||||
|
||||
if ((priv->hhomogeneous && priv->vhomogeneous) == homogeneous)
|
||||
return;
|
||||
|
||||
g_object_freeze_notify (G_OBJECT (stack));
|
||||
|
||||
if (priv->hhomogeneous != homogeneous)
|
||||
{
|
||||
priv->hhomogeneous = homogeneous;
|
||||
g_object_notify_by_pspec (G_OBJECT (stack), stack_props[PROP_HHOMOGENEOUS]);
|
||||
}
|
||||
|
||||
if (priv->vhomogeneous != homogeneous)
|
||||
{
|
||||
priv->vhomogeneous = homogeneous;
|
||||
g_object_notify_by_pspec (G_OBJECT (stack), stack_props[PROP_VHOMOGENEOUS]);
|
||||
}
|
||||
|
||||
if (gtk_widget_get_visible (GTK_WIDGET(stack)))
|
||||
gtk_widget_queue_resize (GTK_WIDGET (stack));
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (stack), stack_props[PROP_HOMOGENEOUS]);
|
||||
g_object_thaw_notify (G_OBJECT (stack));
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_stack_get_homogeneous:
|
||||
* @stack: a #GtkStack
|
||||
*
|
||||
* Gets whether @stack is homogeneous.
|
||||
* See gtk_stack_set_homogeneous().
|
||||
*
|
||||
* Returns: whether @stack is homogeneous.
|
||||
*/
|
||||
gboolean
|
||||
gtk_stack_get_homogeneous (GtkStack *stack)
|
||||
{
|
||||
GtkStackPrivate *priv = gtk_stack_get_instance_private (stack);
|
||||
|
||||
g_return_val_if_fail (GTK_IS_STACK (stack), FALSE);
|
||||
|
||||
return priv->hhomogeneous && priv->vhomogeneous;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_stack_set_hhomogeneous:
|
||||
* @stack: a #GtkStack
|
||||
|
@ -242,7 +242,8 @@
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkStack" id="object_start_stack">
|
||||
<property name="homogeneous">0</property>
|
||||
<property name="hhomogeneous">0</property>
|
||||
<property name="vhomogeneous">0</property>
|
||||
<child>
|
||||
<object class="GtkStackPage">
|
||||
<property name="name">empty</property>
|
||||
@ -299,7 +300,8 @@
|
||||
<property name="transition-type">crossfade</property>
|
||||
<property name="hexpand">1</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="homogeneous">0</property>
|
||||
<property name="hhomogeneous">0</property>
|
||||
<property name="vhomogeneous">0</property>
|
||||
<child>
|
||||
<object class="GtkStackPage">
|
||||
<property name="name">title</property>
|
||||
|
@ -732,7 +732,8 @@ maybe_rename_property (Element *element, MyParserData *data)
|
||||
{ "GtkWidget", "margin", GTK_TYPE_WIDGET, PROP_KIND_OBJECT, "margin-bottom", { "margin-start", "margin-end", "margin-top" } },
|
||||
{ "GtkWidget", "margin-left", GTK_TYPE_WIDGET, PROP_KIND_OBJECT, "margin-start", { NULL, NULL, NULL } },
|
||||
{ "GtkWidget", "margin-right", GTK_TYPE_WIDGET, PROP_KIND_OBJECT, "margin-end", { NULL, NULL, NULL } },
|
||||
{ "GtkHeaderBar", "show-close-button", GTK_TYPE_HEADER_BAR, PROP_KIND_OBJECT, "show-title-buttons", { NULL, NULL, NULL } }
|
||||
{ "GtkHeaderBar", "show-close-button", GTK_TYPE_HEADER_BAR, PROP_KIND_OBJECT, "show-title-buttons", { NULL, NULL, NULL } },
|
||||
{ "GtkStack", "homogeneous", GTK_TYPE_STACK, PROP_KIND_OBJECT, "hhomogeneous", { "vhomogeneous", NULL, NULL } }
|
||||
};
|
||||
int i, k, l;
|
||||
PropKind kind;
|
||||
|
@ -10,6 +10,8 @@
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkStack" id="stack1">
|
||||
<property name="vhomogeneous">0</property>
|
||||
<property name="hhomogeneous">0</property>
|
||||
<child>
|
||||
<object class="GtkStackPage">
|
||||
<property name="name">page1</property>
|
||||
|
@ -14,6 +14,7 @@
|
||||
<child>
|
||||
<object class="GtkStack" id="stack1">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">0</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="page1">
|
||||
<property name="label" translatable="yes">Yes</property>
|
||||
|
Loading…
Reference in New Issue
Block a user