[libgd] header-bar: use label requisition in size requests



commit 374c25dbafd08e91a99522e8152ea7d9d83dd098
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Mon Mar 4 19:40:16 2013 -0500

    header-bar: use label requisition in size requests
    
    Fix some FIXMEs.

 libgd/gd-header-bar.c |   17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)
---
diff --git a/libgd/gd-header-bar.c b/libgd/gd-header-bar.c
index 2560d9c..2f96dbd 100644
--- a/libgd/gd-header-bar.c
+++ b/libgd/gd-header-bar.c
@@ -166,6 +166,13 @@ gd_header_bar_get_size (GtkWidget      *widget,
   minimum = natural = 0;
   nvis_children = 0;
 
+  if (orientation == GTK_ORIENTATION_HORIZONTAL)
+    gtk_widget_get_preferred_width (priv->label,
+                                    &minimum, &natural);
+  else
+    gtk_widget_get_preferred_height (priv->label,
+                                     &minimum, &natural);
+
   for (l = priv->children; l; l = l->next)
     {
       Child *child = l->data;
@@ -259,7 +266,10 @@ gd_header_bar_compute_size_for_orientation (GtkWidget *widget,
         }
     }
 
-  /* FIXME label size */
+  gtk_widget_get_preferred_width (priv->label,
+                                  &child_size, &child_natural);
+  required_size += child_size;
+  required_natural += child_natural;
 
   if (nvis_children > 0)
     {
@@ -361,6 +371,11 @@ gd_header_bar_compute_size_for_opposing_orientation (GtkWidget *widget,
       i += 1;
     }
 
+  gtk_widget_get_preferred_height (priv->label,
+                                   &child_minimum, &child_natural);
+  computed_minimum = MAX (computed_minimum, child_minimum);
+  computed_natural = MAX (computed_natural, child_natural);
+
   get_css_padding_and_border (widget, &css_borders);
 
   computed_minimum += 2 * priv->vpadding + css_borders.top + css_borders.bottom;


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