[gtk+] Fix gtk_paned_set_position to set position_set consistently



commit 9a03fc906affbe509959b36dcef0eb179876d56b
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon May 2 07:38:26 2016 -0400

    Fix gtk_paned_set_position to set position_set consistently
    
    As pointed out in https://bugzilla.gnome.org/show_bug.cgi?id=765676,
    we were failing to set position_set if the position did not change.

 gtk/gtkpaned.c |   25 ++++++++++++++-----------
 1 files changed, 14 insertions(+), 11 deletions(-)
---
diff --git a/gtk/gtkpaned.c b/gtk/gtkpaned.c
index 0c7bc30..dbde5bd 100644
--- a/gtk/gtkpaned.c
+++ b/gtk/gtkpaned.c
@@ -2355,17 +2355,13 @@ gtk_paned_set_position (GtkPaned *paned,
                        gint      position)
 {
   GtkPanedPrivate *priv;
-  GObject *object;
 
   g_return_if_fail (GTK_IS_PANED (paned));
 
   priv = paned->priv;
 
-  if (priv->child1_size == position)
-    return;
+  g_object_freeze_notify (G_OBJECT (paned));
 
-  object = G_OBJECT (paned);
-  
   if (position >= 0)
     {
       /* We don't clamp here - the assumption is that
@@ -2375,20 +2371,27 @@ gtk_paned_set_position (GtkPaned *paned,
        * then clamping will occur in gtk_paned_calc_position()
        */
 
+      if (!priv->position_set)
+        g_object_notify (G_OBJECT (paned), "position-set");
+
+      if (priv->child1_size != position)
+        {
+          g_object_notify (G_OBJECT (paned), "position");
+          gtk_widget_queue_resize_no_redraw (GTK_WIDGET (paned));
+        }
+
       priv->child1_size = position;
       priv->position_set = TRUE;
     }
   else
     {
+      if (priv->position_set)
+        g_object_notify (G_OBJECT (paned), "position-set");
+
       priv->position_set = FALSE;
     }
 
-  g_object_freeze_notify (object);
-  g_object_notify (object, "position");
-  g_object_notify (object, "position-set");
-  g_object_thaw_notify (object);
-
-  gtk_widget_queue_resize_no_redraw (GTK_WIDGET (paned));
+  g_object_thaw_notify (G_OBJECT (paned));
 
 #ifdef G_OS_WIN32
   /* Hacky work-around for bug #144269 */


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