[gtk+] notebook: Sync menu labels with page list in visibile_cb
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] notebook: Sync menu labels with page list in visibile_cb
- Date: Sat, 19 Dec 2015 05:14:56 +0000 (UTC)
commit 35e98dce9ba645d35697a9e757437d0e2599de83
Author: Benjamin Otte <otte redhat com>
Date: Sat Dec 19 05:47:48 2015 +0100
notebook: Sync menu labels with page list in visibile_cb
It's where it changes. Size requests have nothing to do with that.
gtk/gtknotebook.c | 32 ++++++++++++--------------------
1 files changed, 12 insertions(+), 20 deletions(-)
---
diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c
index 361d477..0da495c 100644
--- a/gtk/gtknotebook.c
+++ b/gtk/gtknotebook.c
@@ -2298,7 +2298,6 @@ gtk_notebook_size_request (GtkWidget *widget,
for (children = priv->children, vis_pages = 0; children;
children = children->next)
{
- GtkWidget *parent;
page = children->data;
if (gtk_widget_get_visible (page->child))
@@ -2314,25 +2313,11 @@ gtk_notebook_size_request (GtkWidget *widget,
*minimum = MAX (*minimum, child_minimum);
*natural = MAX (*natural, child_natural);
-
- if (priv->menu && page->menu_label)
- {
- parent = gtk_widget_get_parent (page->menu_label);
- if (parent && !gtk_widget_get_visible (parent))
- gtk_widget_show (parent);
- }
}
else
{
if (page == priv->cur_page)
switch_page = TRUE;
-
- if (priv->menu && page->menu_label)
- {
- parent = gtk_widget_get_parent (page->menu_label);
- if (parent && gtk_widget_get_visible (parent))
- gtk_widget_hide (parent);
- }
}
}
@@ -4795,18 +4780,25 @@ gtk_notebook_child_type (GtkContainer *container)
* gtk_notebook_real_insert_page
*/
static void
-page_visible_cb (GtkWidget *page,
+page_visible_cb (GtkWidget *child,
GParamSpec *arg,
gpointer data)
{
GtkNotebook *notebook = GTK_NOTEBOOK (data);
GtkNotebookPrivate *priv = notebook->priv;
- GList *list;
+ GList *list = gtk_notebook_find_child (notebook, GTK_WIDGET (child));
+ GtkNotebookPage *page = list->data;
GList *next = NULL;
- if (priv->cur_page &&
- priv->cur_page->child == page &&
- !gtk_widget_get_visible (page))
+ if (priv->menu && page->menu_label)
+ {
+ GtkWidget *parent = gtk_widget_get_parent (page->menu_label);
+ if (parent)
+ gtk_widget_set_visible (parent, gtk_widget_get_visible (child));
+ }
+
+ if (priv->cur_page == page &&
+ !gtk_widget_get_visible (child))
{
list = g_list_find (priv->children, priv->cur_page);
if (list)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]