diff options
author | Owen Taylor <otaylor@redhat.com> | 2003-01-30 21:57:08 +0000 |
---|---|---|
committer | Owen Taylor <otaylor@src.gnome.org> | 2003-01-30 21:57:08 +0000 |
commit | 5dfb4e676de23d1d14609f7d23bdb31b5f5afdc3 (patch) | |
tree | 9011bfd99f3057208a2520f6a6bd250c7d3e6011 /gtk/gtknotebook.c | |
parent | c6b21200f25940c3c73a9b58b9249334144fa83a (diff) | |
download | gdk-pixbuf-5dfb4e676de23d1d14609f7d23bdb31b5f5afdc3.tar.gz |
Patch from Soeren Sandmann to update the states of the tab label child
Thu Jan 30 16:54:29 2003 Owen Taylor <otaylor@redhat.com>
* gtk/gtknotebook.c: Patch from Soeren Sandmann
to update the states of the tab label child
widgets to match the state of the tabs.
(#93389, Reported by Tommi Komulainen)
Diffstat (limited to 'gtk/gtknotebook.c')
-rw-r--r-- | gtk/gtknotebook.c | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c index b024d0b16..4db8c0c98 100644 --- a/gtk/gtknotebook.c +++ b/gtk/gtknotebook.c @@ -2361,6 +2361,7 @@ gtk_notebook_remove_tab_label (GtkNotebook *notebook, page->mnemonic_activate_signal = 0; gtk_widget_unparent (page->tab_label); + gtk_widget_set_state (page->tab_label, GTK_STATE_NORMAL); } } @@ -3511,6 +3512,25 @@ gtk_notebook_calc_tabs (GtkNotebook *notebook, } } +static void +gtk_notebook_update_tab_states (GtkNotebook *notebook) +{ + GList *list; + + for (list = notebook->children; list != NULL; list = list->next) + { + GtkNotebookPage *page = list->data; + + if (page->tab_label) + { + if (page == notebook->cur_page) + gtk_widget_set_state (page->tab_label, GTK_STATE_NORMAL); + else + gtk_widget_set_state (page->tab_label, GTK_STATE_ACTIVE); + } + } +} + /* Private GtkNotebook Page Switch Methods: * * gtk_notebook_real_switch_page @@ -3552,6 +3572,7 @@ gtk_notebook_real_switch_page (GtkNotebook *notebook, gtk_widget_grab_focus (GTK_WIDGET (notebook)); } + gtk_notebook_update_tab_states (notebook); gtk_widget_queue_resize (GTK_WIDGET (notebook)); g_object_notify (G_OBJECT (notebook), "page"); } @@ -4092,6 +4113,8 @@ gtk_notebook_insert_page_menu (GtkNotebook *notebook, gtk_notebook_switch_focus_tab (notebook, NULL); } + gtk_notebook_update_tab_states (notebook); + if (tab_label) page->mnemonic_activate_signal = g_signal_connect (tab_label, @@ -4780,6 +4803,8 @@ gtk_notebook_set_tab_label (GtkNotebook *notebook, gtk_widget_show (page->tab_label); gtk_widget_queue_resize (GTK_WIDGET (notebook)); } + + gtk_notebook_update_tab_states (notebook); gtk_widget_child_notify (child, "tab_label"); } @@ -4985,7 +5010,8 @@ gtk_notebook_child_reordered (GtkNotebook *notebook, gtk_container_remove (GTK_CONTAINER (notebook->menu), menu_item); gtk_notebook_menu_item_create (notebook, g_list_find (notebook->children, page)); } - + + gtk_notebook_update_tab_states (notebook); gtk_notebook_update_labels (notebook); } |