From 61479a2347ba289d618602dfb14a0c1c76da614a Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Wed, 18 Oct 2017 03:34:09 -0400 Subject: MqTabPage: Add to tree before adding to notebook gtk_notebook_insert_page() causes the "switch-page" signal to be emitted, and MqWindow's callback looks for the newly inserted tab page in the tree. --- diff --git a/src/tab-page.c b/src/tab-page.c index 27c6ae9..3ffdfe7 100644 --- a/src/tab-page.c +++ b/src/tab-page.c @@ -149,12 +149,7 @@ static void init_root(MqTabPage *tab_page) { tab_page->root = tab_page; - tab_page->parent = NULL; - tab_page->prev = NULL; - tab_page->next = NULL; - tab_page->first_child = tab_page->last_child = NULL; tab_page->position = 0; - tab_page->tree_size = 1; } static void @@ -163,13 +158,6 @@ init_non_root(MqTabPage *tab_page) GtkWidget *navigation_toolbar; GtkWidget *find_toolbar; - tab_page->parent = NULL; - tab_page->prev = NULL; - tab_page->next = NULL; - tab_page->first_child = tab_page->last_child = NULL; - tab_page->tree_size = 1; - tab_page->title = "New tab"; - tab_page->window = tab_page->source->window; tab_page->application = mq_window_get_application(tab_page->window); @@ -215,12 +203,12 @@ constructed(GObject *object) init_root(tab_page); break; case CREATE_SIBLING: - init_non_root(tab_page); append_sibling(tab_page); + init_non_root(tab_page); break; case CREATE_CHILD: - init_non_root(tab_page); append_child(tab_page); + init_non_root(tab_page); break; case CREATE_NONE: case N_CREATE_TYPES: @@ -326,8 +314,14 @@ mq_tab_page_class_init(MqTabPageClass *klass) } static void -mq_tab_page_init(MqTabPage G_GNUC_UNUSED *tab_page) +mq_tab_page_init(MqTabPage *tab_page) { + tab_page->parent = NULL; + tab_page->prev = NULL; + tab_page->next = NULL; + tab_page->first_child = tab_page->last_child = NULL; + tab_page->tree_size = 1; + tab_page->title = "New tab"; } MqTabPage * -- cgit v0.9.1