[gtk+/gtk-3-18] GtkPaned: Fix gtk_paned_set_child_visible calls



commit 633b08cc8a102fab11e23fb66be3f214eaf37cdf
Author: Timm Bäder <mail baedert org>
Date:   Fri Oct 16 14:44:16 2015 +0200

    GtkPaned: Fix gtk_paned_set_child_visible calls
    
    Use CHILD1/CHILD2 instead of 0 and 1, always use the same order and
    don't check for child NULL-ness, because it will be done in
    gtk_paned_set_child_visible anyways.

 gtk/gtkpaned.c |   23 ++++++++---------------
 1 files changed, 8 insertions(+), 15 deletions(-)
---
diff --git a/gtk/gtkpaned.c b/gtk/gtkpaned.c
index f9fb978..e684edb 100644
--- a/gtk/gtkpaned.c
+++ b/gtk/gtkpaned.c
@@ -1484,9 +1484,8 @@ gtk_paned_size_allocate (GtkWidget     *widget,
 
       if (priv->child1 && gtk_widget_get_visible (priv->child1))
         {
-          gtk_paned_set_child_visible (paned, 0, TRUE);
-          if (priv->child2)
-            gtk_paned_set_child_visible (paned, 1, FALSE);
+          gtk_paned_set_child_visible (paned, CHILD1, TRUE);
+          gtk_paned_set_child_visible (paned, CHILD2, FALSE);
 
           gtk_paned_child_allocate (priv->child1,
                                     priv->child1_window,
@@ -1495,9 +1494,8 @@ gtk_paned_size_allocate (GtkWidget     *widget,
         }
       else if (priv->child2 && gtk_widget_get_visible (priv->child2))
         {
-          gtk_paned_set_child_visible (paned, 1, TRUE);
-          if (priv->child1)
-            gtk_paned_set_child_visible (paned, 0, FALSE);
+          gtk_paned_set_child_visible (paned, CHILD1, FALSE);
+          gtk_paned_set_child_visible (paned, CHILD2, TRUE);
 
           gtk_paned_child_allocate (priv->child2,
                                     priv->child2_window,
@@ -1506,10 +1504,8 @@ gtk_paned_size_allocate (GtkWidget     *widget,
         }
       else
         {
-          if (priv->child1)
-            gtk_paned_set_child_visible (paned, 0, FALSE);
-          if (priv->child2)
-            gtk_paned_set_child_visible (paned, 1, FALSE);
+          gtk_paned_set_child_visible (paned, CHILD1, FALSE);
+          gtk_paned_set_child_visible (paned, CHILD2, FALSE);
         }
     }
 }
@@ -2212,11 +2208,8 @@ gtk_paned_calc_position (GtkPaned *paned,
                               &priv->min_position, &priv->max_position,
                               &priv->child1_size);
 
-  if (priv->child1)
-    gtk_paned_set_child_visible (paned, 0, priv->child1_size != 0);
-  
-  if (priv->child2)
-    gtk_paned_set_child_visible (paned, 1, priv->child1_size != allocation); 
+  gtk_paned_set_child_visible (paned, CHILD1, priv->child1_size != 0);
+  gtk_paned_set_child_visible (paned, CHILD2, priv->child1_size != allocation);
 
   g_object_freeze_notify (G_OBJECT (paned));
   if (priv->child1_size != old_position)


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