mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-25 13:11:13 +00:00
Properly update internal state when child visibility changes. (#331785,
2006-02-20 Matthias Clasen <mclasen@redhat.com> * gtk/gtknotebook.c: Properly update internal state when child visibility changes. (#331785, Sebastien Bacher)
This commit is contained in:
parent
1bb487a2c7
commit
f6eedc86c3
@ -1,5 +1,8 @@
|
||||
2006-02-20 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* gtk/gtknotebook.c: Properly update internal state
|
||||
when child visibility changes. (#331785, Sebastien Bacher)
|
||||
|
||||
* gdk/gdkgc.c (_gdk_gc_update_context): Obtain the
|
||||
background color from the gc when it is needed. (#331820)
|
||||
|
||||
|
@ -1,5 +1,8 @@
|
||||
2006-02-20 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* gtk/gtknotebook.c: Properly update internal state
|
||||
when child visibility changes. (#331785, Sebastien Bacher)
|
||||
|
||||
* gdk/gdkgc.c (_gdk_gc_update_context): Obtain the
|
||||
background color from the gc when it is needed. (#331820)
|
||||
|
||||
|
@ -112,7 +112,8 @@ struct _GtkNotebookPage
|
||||
GtkRequisition requisition;
|
||||
GtkAllocation allocation;
|
||||
|
||||
guint mnemonic_activate_signal;
|
||||
gulong mnemonic_activate_signal;
|
||||
gulong notify_visible_handler;
|
||||
};
|
||||
|
||||
#ifdef G_DISABLE_CHECKS
|
||||
@ -2714,6 +2715,8 @@ gtk_notebook_real_remove (GtkNotebook *notebook,
|
||||
|
||||
page = list->data;
|
||||
|
||||
g_signal_handler_disconnect (page->child, page->notify_visible_handler);
|
||||
|
||||
if (GTK_WIDGET_VISIBLE (page->child) && GTK_WIDGET_VISIBLE (notebook))
|
||||
need_resize = TRUE;
|
||||
|
||||
@ -4326,6 +4329,33 @@ gtk_notebook_mnemonic_activate_switch_page (GtkWidget *child,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
page_visible_cb (GtkWidget *page,
|
||||
GParamSpec *arg,
|
||||
gpointer data)
|
||||
{
|
||||
GtkNotebook *notebook = (GtkNotebook *)data;
|
||||
GList *list;
|
||||
GList *next = NULL;
|
||||
|
||||
if (notebook->cur_page &&
|
||||
notebook->cur_page->child == page &&
|
||||
!GTK_WIDGET_VISIBLE (page))
|
||||
{
|
||||
list = g_list_find (notebook->children, notebook->cur_page);
|
||||
if (list)
|
||||
{
|
||||
next = gtk_notebook_search_page (notebook, list, STEP_NEXT, TRUE);
|
||||
if (!next)
|
||||
next = gtk_notebook_search_page (notebook, list, STEP_PREV, TRUE);
|
||||
}
|
||||
|
||||
if (next)
|
||||
gtk_notebook_switch_page (notebook, GTK_NOTEBOOK_PAGE (next), -1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_notebook_insert_page_menu:
|
||||
* @notebook: a #GtkNotebook
|
||||
@ -4432,6 +4462,8 @@ gtk_notebook_insert_page_menu (GtkNotebook *notebook,
|
||||
gtk_notebook_switch_focus_tab (notebook, NULL);
|
||||
}
|
||||
|
||||
page->notify_visible_handler = g_signal_connect (G_OBJECT (child), "notify::visible", G_CALLBACK (page_visible_cb), notebook);
|
||||
|
||||
gtk_notebook_update_tab_states (notebook);
|
||||
|
||||
if (tab_label)
|
||||
|
Loading…
Reference in New Issue
Block a user