[gtk+/gtk-3-20] headerbar: don't allocate both label and custom title



commit 02a5fe87da4774be072098b0fb196d901b197ecd
Author: Ray Strode <rstrode redhat com>
Date:   Thu Jun 23 08:57:55 2016 -0400

    headerbar: don't allocate both label and custom title
    
    It's only possible to have a label or a custom title, not both.
    The size allocate code confusingly treats them as independent.
    
    That is confusing, because, as the code is written, it makes it
    look like the space for the custom title isn't getting accounted
    for.
    
    This commit else-ifies some parts of the size allocate code for
    clarity.

 gtk/gtkheaderbar.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)
---
diff --git a/gtk/gtkheaderbar.c b/gtk/gtkheaderbar.c
index 819fc4a..59709cd 100644
--- a/gtk/gtkheaderbar.c
+++ b/gtk/gtkheaderbar.c
@@ -1035,8 +1035,7 @@ gtk_header_bar_allocate_contents (GtkCssGadget        *gadget,
                                                  &title_minimum_size,
                                                  &title_natural_size);
     }
-
-  if (priv->label_box != NULL)
+  else if (priv->label_box != NULL)
     {
       gtk_widget_get_preferred_width_for_height (priv->label_box,
                                                  height,
@@ -1150,8 +1149,7 @@ gtk_header_bar_allocate_contents (GtkCssGadget        *gadget,
   if (priv->custom_title != NULL &&
       gtk_widget_get_visible (priv->custom_title))
     gtk_widget_size_allocate (priv->custom_title, &child_allocation);
-
-  if (priv->label_box != NULL)
+  else if (priv->label_box != NULL)
     gtk_widget_size_allocate (priv->label_box, &child_allocation);
 
   child_allocation.y = allocation->y;


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