[gtk/drop-stack-homogeneous: 1/2] Drop GtkStack:homogeneous



commit 5f01f6f36b08b3615e129525b341f9446ae32954
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Apr 28 19:53:33 2020 -0400

    Drop GtkStack:homogeneous
    
    We have hhomogeneous and vhomogeneous properties
    that can be set individually.
    
    Fixes: #2673

 docs/reference/gtk/gtk4-sections.txt |  2 -
 gtk/gtkemojicompletion.c             |  3 +-
 gtk/gtkshortcutssection.c            |  3 +-
 gtk/gtkshortcutswindow.c             |  3 +-
 gtk/gtkstack.c                       | 79 ------------------------------------
 gtk/inspector/window.ui              |  6 ++-
 6 files changed, 10 insertions(+), 86 deletions(-)
---
diff --git a/docs/reference/gtk/gtk4-sections.txt b/docs/reference/gtk/gtk4-sections.txt
index 5e67701836..bb3488926e 100644
--- a/docs/reference/gtk/gtk4-sections.txt
+++ b/docs/reference/gtk/gtk4-sections.txt
@@ -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
diff --git a/gtk/gtkemojicompletion.c b/gtk/gtkemojicompletion.c
index 11a1946e27..810d6c1729 100644
--- a/gtk/gtkemojicompletion.c
+++ b/gtk/gtkemojicompletion.c
@@ -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);
diff --git a/gtk/gtkshortcutssection.c b/gtk/gtkshortcutssection.c
index 337ece2539..348889996a 100644
--- a/gtk/gtkshortcutssection.c
+++ b/gtk/gtkshortcutssection.c
@@ -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,
diff --git a/gtk/gtkshortcutswindow.c b/gtk/gtkshortcutswindow.c
index a2d580f0eb..935c0c3c74 100644
--- a/gtk/gtkshortcutswindow.c
+++ b/gtk/gtkshortcutswindow.c
@@ -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));
diff --git a/gtk/gtkstack.c b/gtk/gtkstack.c
index 2efdd2be06..d2f455af65 100644
--- a/gtk/gtkstack.c
+++ b/gtk/gtkstack.c
@@ -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
diff --git a/gtk/inspector/window.ui b/gtk/inspector/window.ui
index 4fc07bcfc8..e469cb23c2 100644
--- a/gtk/inspector/window.ui
+++ b/gtk/inspector/window.ui
@@ -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>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]