Fixed tab hiding
This commit is contained in:
parent
3cfc360dc6
commit
9c9176912e
|
@ -165,16 +165,26 @@ gm_world_view_switch_page(GtkNotebook *notebook, GtkNotebookPage *page,
|
||||||
if (GTK_NOTEBOOK_CLASS(gm_world_view_parent_class)->switch_page) {
|
if (GTK_NOTEBOOK_CLASS(gm_world_view_parent_class)->switch_page) {
|
||||||
GTK_NOTEBOOK_CLASS(gm_world_view_parent_class)->switch_page(notebook, page, page_num);
|
GTK_NOTEBOOK_CLASS(gm_world_view_parent_class)->switch_page(notebook, page, page_num);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gtk_notebook_get_n_pages(notebook) == 1) {
|
|
||||||
gtk_notebook_set_show_tabs(notebook, FALSE);
|
|
||||||
}
|
|
||||||
if (page_num == 0) {
|
if (page_num == 0) {
|
||||||
g_idle_add((GSourceFunc)gm_world_view_input_grab_focus,
|
g_idle_add((GSourceFunc)gm_world_view_input_grab_focus,
|
||||||
GM_WORLD_VIEW(notebook));
|
GM_WORLD_VIEW(notebook));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gm_world_view_remove_page(GtkContainer *container, GtkWidget *page) {
|
||||||
|
GtkNotebook *notebook = GTK_NOTEBOOK(container);
|
||||||
|
|
||||||
|
if (GTK_CONTAINER_CLASS(gm_world_view_parent_class)->remove) {
|
||||||
|
GTK_CONTAINER_CLASS(gm_world_view_parent_class)->remove(container, page);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gtk_notebook_get_n_pages(notebook) == 1) {
|
||||||
|
gtk_notebook_set_show_tabs(notebook, FALSE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gm_world_view_show(GtkWidget *widget) {
|
gm_world_view_show(GtkWidget *widget) {
|
||||||
GmWorldView *view = GM_WORLD_VIEW(widget);
|
GmWorldView *view = GM_WORLD_VIEW(widget);
|
||||||
|
@ -196,11 +206,13 @@ gm_world_view_class_init(GmWorldViewClass *klass) {
|
||||||
GObjectClass *object_class = G_OBJECT_CLASS(klass);
|
GObjectClass *object_class = G_OBJECT_CLASS(klass);
|
||||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass);
|
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass);
|
||||||
GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS(klass);
|
GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS(klass);
|
||||||
|
GtkContainerClass *container_class = GTK_CONTAINER_CLASS(klass);
|
||||||
|
|
||||||
object_class->finalize = gm_world_view_finalize;
|
object_class->finalize = gm_world_view_finalize;
|
||||||
widget_class->show = gm_world_view_show;
|
widget_class->show = gm_world_view_show;
|
||||||
gtk_object_class->destroy = gm_world_view_destroy;
|
gtk_object_class->destroy = gm_world_view_destroy;
|
||||||
GTK_NOTEBOOK_CLASS(klass)->switch_page = gm_world_view_switch_page;
|
GTK_NOTEBOOK_CLASS(klass)->switch_page = gm_world_view_switch_page;
|
||||||
|
container_class->remove = gm_world_view_remove_page;
|
||||||
|
|
||||||
g_type_class_add_private(object_class, sizeof(GmWorldViewPrivate));
|
g_type_class_add_private(object_class, sizeof(GmWorldViewPrivate));
|
||||||
}
|
}
|
||||||
|
|
Reference in New Issue