diff options
author | Patrick McDermott <pj@pehjota.net> | 2017-09-27 01:06:45 (EDT) |
---|---|---|
committer | Patrick McDermott <pj@pehjota.net> | 2017-09-27 01:06:45 (EDT) |
commit | cbf28f6fa88d349a6fa5485c7fbae7eeab292aac (patch) | |
tree | 163efc8c5e573bf274b5e6e27b4c6065fb494120 /src | |
parent | b1f56c59e3619ae32565fff79b2c33adb3dd8332 (diff) | |
download | marquee-cbf28f6fa88d349a6fa5485c7fbae7eeab292aac.zip marquee-cbf28f6fa88d349a6fa5485c7fbae7eeab292aac.tar.gz marquee-cbf28f6fa88d349a6fa5485c7fbae7eeab292aac.tar.bz2 |
mq_tab_new*(): Drop MqWindow parameter
Instead get it through the tree.
Diffstat (limited to 'src')
-rw-r--r-- | src/tab.c | 26 | ||||
-rw-r--r-- | src/tab.h | 4 | ||||
-rw-r--r-- | src/window.c | 4 |
3 files changed, 20 insertions, 14 deletions
@@ -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; } @@ -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); |