From cbf28f6fa88d349a6fa5485c7fbae7eeab292aac Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Wed, 27 Sep 2017 01:06:45 -0400 Subject: mq_tab_new*(): Drop MqWindow parameter Instead get it through the tree. --- diff --git a/src/tab.c b/src/tab.c index c11ff1b..5fd8f85 100644 --- a/src/tab.c +++ b/src/tab.c @@ -114,7 +114,7 @@ reload_tab_clicked_cb(GtkWidget __attribute__((unused)) *button, MqTab *tab) static void new_tab_clicked_cb(GtkWidget __attribute__((unused)) *button, MqTab *tab) { - mq_tab_new(tab->window, NULL, tab); + mq_tab_new(NULL, tab); gtk_widget_hide(tab->popover); } @@ -297,7 +297,7 @@ title_cb(WebKitWebView __attribute__((unused)) *web_view, } static MqTab * -init_non_root(MqWindow *window, gchar *uri) +init_non_root(gchar *uri) { MqTab *tab; @@ -307,8 +307,6 @@ init_non_root(MqWindow *window, gchar *uri) tab->next = NULL; tab->first_child = tab->last_child = NULL; tab->tree_size = 1; - tab->window = window; - tab->application = mq_window_get_application(window); mq_tab_populate_tab(tab); @@ -331,29 +329,37 @@ init_non_root(MqWindow *window, gchar *uri) } MqTab * -mq_tab_new(MqWindow *window, gchar *uri, MqTab *source) +mq_tab_new(gchar *uri, MqTab *source) { MqTab *tab; - tab = init_non_root(window, uri); + tab = init_non_root(uri); append_sibling(tab, source); - mq_window_insert_tab(window, tab->container, tab->tab, tab->position); + tab->window = source->window; + tab->application = mq_window_get_application(tab->window); + + mq_window_insert_tab(tab->window, tab->container, tab->tab, + tab->position); return tab; } MqTab * -mq_tab_new_relative(MqWindow *window, gchar *uri, MqTab *source) +mq_tab_new_relative(gchar *uri, MqTab *source) { MqTab *tab; - tab = init_non_root(window, uri); + tab = init_non_root(uri); append_child(tab, source); - mq_window_insert_tab(window, tab->container, tab->tab, tab->position); + tab->window = source->window; + tab->application = mq_window_get_application(tab->window); + + mq_window_insert_tab(tab->window, tab->container, tab->tab, + tab->position); return tab; } diff --git a/src/tab.h b/src/tab.h index ce27d73..f2b7b76 100644 --- a/src/tab.h +++ b/src/tab.h @@ -54,10 +54,10 @@ struct MqTab { }; MqTab * -mq_tab_new(MqWindow *window, gchar *uri, MqTab *source); +mq_tab_new(gchar *uri, MqTab *source); MqTab * -mq_tab_new_relative(MqWindow *window, gchar *uri, MqTab *source); +mq_tab_new_relative(gchar *uri, MqTab *source); MqTab * mq_tab_new_root(MqWindow *window); diff --git a/src/window.c b/src/window.c index 2cfbed1..71b0c4e 100644 --- a/src/window.c +++ b/src/window.c @@ -67,10 +67,10 @@ mq_window_new(MqApplication *application, gchar **uris) if (uris && uris[0]) { for (i = 0; uris && uris[i]; ++i) { - mq_tab_new_relative(window, uris[i], window->root_tab); + mq_tab_new_relative(uris[i], window->root_tab); } } else { - mq_tab_new_relative(window, NULL, window->root_tab); + mq_tab_new_relative(NULL, window->root_tab); } gtk_widget_show_all(window->window); -- cgit v0.9.1