[gtk+/popovers] header bar: Make it possible to have no title
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/popovers] header bar: Make it possible to have no title
- Date: Sat, 18 Jan 2014 00:46:01 +0000 (UTC)
commit 426acda929ff6607a56842874bc9dfd8eec5af00
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Jan 17 19:43:22 2014 -0500
header bar: Make it possible to have no title
Add a custom title had the side-effect of showing the widget.
That is not right, adding children and managing their visibility
should be independent. The headerbar size allocation code also
made the assumption that a custom title is always visible.
With these changes, GtkHeaderBar should be usable in situations
where the centering functionality is not required, and it is
important to freely pack content at both ends, such as in nautilus.
https://bugzilla.gnome.org/show_bug.cgi?id=722340
gtk/gtkheaderbar.c | 19 ++++++++++---------
1 files changed, 10 insertions(+), 9 deletions(-)
---
diff --git a/gtk/gtkheaderbar.c b/gtk/gtkheaderbar.c
index d1b1c59..f07d23d 100644
--- a/gtk/gtkheaderbar.c
+++ b/gtk/gtkheaderbar.c
@@ -727,8 +727,7 @@ gtk_header_bar_compute_size_for_orientation (GtkWidget *widget,
}
}
- if (priv->label_box != NULL &&
- gtk_widget_get_visible (priv->label_box))
+ if (priv->label_box != NULL)
{
gtk_widget_get_preferred_width (priv->label_sizing_box,
&child_size, &child_natural);
@@ -862,8 +861,7 @@ gtk_header_bar_compute_size_for_opposing_orientation (GtkWidget *widget,
i += 1;
}
- if (priv->label_box != NULL &&
- gtk_widget_get_visible (priv->label_box))
+ if (priv->label_box != NULL)
{
gtk_widget_get_preferred_height (priv->label_sizing_box,
&child_minimum, &child_natural);
@@ -990,14 +988,16 @@ gtk_header_bar_size_allocate (GtkWidget *widget,
i++;
}
- if (priv->custom_title)
+ if (priv->custom_title &&
+ gtk_widget_get_visible (priv->custom_title))
{
gtk_widget_get_preferred_width_for_height (priv->custom_title,
height,
&title_minimum_size,
&title_natural_size);
}
- else
+
+ if (priv->label_box != NULL)
{
gtk_widget_get_preferred_width_for_height (priv->label_box,
height,
@@ -1105,9 +1105,11 @@ gtk_header_bar_size_allocate (GtkWidget *widget,
if (direction == GTK_TEXT_DIR_RTL)
child_allocation.x = allocation->x + allocation->width - (child_allocation.x - allocation->x) -
child_allocation.width;
- if (priv->custom_title)
+ if (priv->custom_title != NULL &&
+ gtk_widget_get_visible (priv->custom_title))
gtk_widget_size_allocate (priv->custom_title, &child_allocation);
- else
+
+ if (priv->label_box != NULL)
gtk_widget_size_allocate (priv->label_box, &child_allocation);
if (priv->titlebar_start_box)
@@ -1295,7 +1297,6 @@ gtk_header_bar_set_custom_title (GtkHeaderBar *bar,
gtk_widget_set_parent (priv->custom_title, GTK_WIDGET (bar));
gtk_widget_set_valign (priv->custom_title, GTK_ALIGN_CENTER);
- gtk_widget_show (title_widget);
if (priv->label_box != NULL)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]