summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick McDermott <pj@pehjota.net>2017-09-27 01:06:45 (EDT)
committer Patrick McDermott <pj@pehjota.net>2017-09-27 01:06:45 (EDT)
commitcbf28f6fa88d349a6fa5485c7fbae7eeab292aac (patch)
tree163efc8c5e573bf274b5e6e27b4c6065fb494120
parentb1f56c59e3619ae32565fff79b2c33adb3dd8332 (diff)
downloadmarquee-cbf28f6fa88d349a6fa5485c7fbae7eeab292aac.zip
marquee-cbf28f6fa88d349a6fa5485c7fbae7eeab292aac.tar.gz
marquee-cbf28f6fa88d349a6fa5485c7fbae7eeab292aac.tar.bz2
mq_tab_new*(): Drop MqWindow parameter
Instead get it through the tree.
-rw-r--r--src/tab.c26
-rw-r--r--src/tab.h4
-rw-r--r--src/window.c4
3 files changed, 20 insertions, 14 deletions
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);