[gtk+] headerbar: don't throw a warning if title widget is hidden



commit 386d17db6d885376dc028ad862574a69e523eed5
Author: Ray Strode <rstrode redhat com>
Date:   Wed Jun 29 09:20:55 2016 -0400

    headerbar: don't throw a warning if title widget is hidden
    
    commit 0015ebc4a8f269f6888fcacef3e83e3167241d67 reworked
    some of the titlebar size allocation code.  Those changes
    inadvertently introduced a warning when the application sets
    the headerbar title widget to be hidden.
    
    This commit fixes that warning.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=768184

 gtk/gtkheaderbar.c |   16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)
---
diff --git a/gtk/gtkheaderbar.c b/gtk/gtkheaderbar.c
index 47fb70c..8182bec 100644
--- a/gtk/gtkheaderbar.c
+++ b/gtk/gtkheaderbar.c
@@ -997,7 +997,7 @@ gtk_header_bar_allocate_contents (GtkCssGadget        *gadget,
   gint nvis_children;
   gint title_minimum_size;
   gint title_natural_size;
-  gboolean title_expands;
+  gboolean title_expands = FALSE;
   gint start_width, end_width;
   gint uniform_expand_bonus[2] = { 0 };
   gint leftover_expand_bonus[2] = { 0 };
@@ -1051,13 +1051,15 @@ gtk_header_bar_allocate_contents (GtkCssGadget        *gadget,
     title_widget = NULL;
 
   if (title_widget)
-    gtk_widget_get_preferred_width_for_height (title_widget,
-                                               height,
-                                               &title_minimum_size,
-                                               &title_natural_size);
-  width -= title_natural_size;
+    {
+      gtk_widget_get_preferred_width_for_height (title_widget,
+                                                 height,
+                                                 &title_minimum_size,
+                                                 &title_natural_size);
+      width -= title_natural_size;
 
-  title_expands = gtk_widget_compute_expand (title_widget, GTK_ORIENTATION_HORIZONTAL);
+      title_expands = gtk_widget_compute_expand (title_widget, GTK_ORIENTATION_HORIZONTAL);
+    }
 
   start_width = 0;
   if (priv->titlebar_start_box != NULL)


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