[gtk+] GtkNotebook: emit child-notify::position on page add/removal
- From: Claudio Saavedra <csaavedra src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] GtkNotebook: emit child-notify::position on page add/removal
- Date: Tue, 14 Feb 2012 23:05:50 +0000 (UTC)
commit cb775a6a6d4d7f81f939e423908f3bd2d117e03f
Author: Claudio Saavedra <csaavedra igalia com>
Date: Fri Feb 10 16:46:57 2012 +0200
GtkNotebook: emit child-notify::position on page add/removal
For each page added/removed, notify all the other children changing
position.
https://bugzilla.gnome.org/show_bug.cgi?id=669116
gtk/gtknotebook.c | 19 +++++++++++++++++--
1 files changed, 17 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c
index 5be5b7a..bd5a3c1 100644
--- a/gtk/gtknotebook.c
+++ b/gtk/gtknotebook.c
@@ -4097,7 +4097,7 @@ gtk_notebook_remove (GtkContainer *container,
GtkNotebook *notebook = GTK_NOTEBOOK (container);
GtkNotebookPrivate *priv = notebook->priv;
GtkNotebookPage *page;
- GList *children;
+ GList *children, *list;
gint page_num = 0;
children = priv->children;
@@ -4117,8 +4117,15 @@ gtk_notebook_remove (GtkContainer *container,
g_object_ref (widget);
+ list = children->next;
gtk_notebook_real_remove (notebook, children);
+ while (list)
+ {
+ gtk_widget_child_notify (((GtkNotebookPage *)list->data)->child, "position");
+ list = list->next;
+ }
+
g_signal_emit (notebook,
notebook_signals[PAGE_REMOVED],
0,
@@ -4566,6 +4573,7 @@ gtk_notebook_real_insert_page (GtkNotebook *notebook,
GtkNotebookPrivate *priv = notebook->priv;
GtkNotebookPage *page;
gint nchildren;
+ GList *list;
gtk_widget_freeze_child_notify (child);
@@ -4648,7 +4656,14 @@ gtk_notebook_real_insert_page (GtkNotebook *notebook,
gtk_widget_child_notify (child, "tab-fill");
gtk_widget_child_notify (child, "tab-label");
gtk_widget_child_notify (child, "menu-label");
- gtk_widget_child_notify (child, "position");
+
+ list = g_list_nth (priv->children, position);
+ while (list)
+ {
+ gtk_widget_child_notify (((GtkNotebookPage *)list->data)->child, "position");
+ list = list->next;
+ }
+
gtk_widget_thaw_child_notify (child);
/* The page-added handler might have reordered the pages, re-get the position */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]