[gtk+/wip/toolbar-regions] toolbar: invalidate order when an item visibility changes
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/toolbar-regions] toolbar: invalidate order when an item visibility changes
- Date: Thu, 30 Jun 2011 20:21:28 +0000 (UTC)
commit 3154b1aab134a11552997a27c447cf0949ed9758
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Thu Jun 30 15:51:10 2011 -0400
toolbar: invalidate order when an item visibility changes
gtk/gtktoolbar.c | 17 +++++++++++++++++
1 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtktoolbar.c b/gtk/gtktoolbar.c
index b79cef9..432e2af 100644
--- a/gtk/gtktoolbar.c
+++ b/gtk/gtktoolbar.c
@@ -3267,6 +3267,16 @@ struct _ToolbarContent
guint has_menu : 2;
};
+static void
+toolbar_item_visiblity_notify_cb (GObject *obj,
+ GParamSpec *pspec,
+ gpointer user_data)
+{
+ GtkToolbar *toolbar = user_data;
+
+ gtk_toolbar_invalidate_order (toolbar);
+}
+
static ToolbarContent *
toolbar_content_new_tool_item (GtkToolbar *toolbar,
GtkToolItem *item,
@@ -3287,6 +3297,9 @@ toolbar_content_new_tool_item (GtkToolbar *toolbar,
gtk_widget_set_parent (GTK_WIDGET (item), GTK_WIDGET (toolbar));
gtk_toolbar_invalidate_order (toolbar);
+ g_signal_connect (content->item, "notify::visible",
+ G_CALLBACK (toolbar_item_visiblity_notify_cb), toolbar);
+
if (!is_placeholder)
{
priv->num_children++;
@@ -3309,6 +3322,10 @@ toolbar_content_remove (ToolbarContent *content,
gtk_toolbar_invalidate_order (toolbar);
gtk_widget_unparent (GTK_WIDGET (content->item));
+ g_signal_handlers_disconnect_by_func (content->item,
+ toolbar_item_visiblity_notify_cb,
+ toolbar);
+
priv->content = g_list_remove (priv->content, content);
if (!toolbar_content_is_placeholder (content))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]