summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/notebook.c10
-rw-r--r--src/window.c11
2 files changed, 10 insertions, 11 deletions
diff --git a/src/notebook.c b/src/notebook.c
index 0c70a47..3521c93 100644
--- a/src/notebook.c
+++ b/src/notebook.c
@@ -115,6 +115,13 @@ mq_notebook_class_init(MqNotebookClass *klass)
}
static void
+switch_page_cb(MqNotebook *notebook, MqTabPage *page,
+ guint G_GNUC_UNUSED page_num)
+{
+ mq_window_set_title(notebook->window, mq_tab_page_get_title(page));
+}
+
+static void
mq_notebook_init(MqNotebook *notebook)
{
notebook->tree = MQ_TAB_TREE(mq_tree_insert_root_allocated(
@@ -124,6 +131,9 @@ mq_notebook_init(MqNotebook *notebook)
gtk_notebook_set_scrollable(GTK_NOTEBOOK(notebook), TRUE);
gtk_notebook_set_group_name(GTK_NOTEBOOK(notebook), "mq-tabs");
gtk_widget_set_can_focus(GTK_WIDGET(notebook), FALSE);
+
+ g_signal_connect(notebook, "switch-page",
+ G_CALLBACK(switch_page_cb), NULL);
}
GtkWidget *
diff --git a/src/window.c b/src/window.c
index 0651e95..85450f8 100644
--- a/src/window.c
+++ b/src/window.c
@@ -183,15 +183,6 @@ set_title(MqWindow *window, const gchar *title)
}
static void
-switch_page_cb(GtkNotebook G_GNUC_UNUSED *notebook,
- MqTabPage *page, guint page_num, MqWindow *window)
-{
- window->current_tab = ++page_num;
-
- set_title(window, mq_tab_page_get_title(page));
-}
-
-static void
update_positions(GtkNotebook G_GNUC_UNUSED *notebook,
GtkWidget G_GNUC_UNUSED *child, guint G_GNUC_UNUSED page_num,
MqWindow *window)
@@ -325,8 +316,6 @@ mq_window_init(MqWindow *window)
window->notebook = mq_notebook_new(window);
gtk_container_add(GTK_CONTAINER(window), window->notebook);
- g_signal_connect(window->notebook, "switch-page",
- G_CALLBACK(switch_page_cb), window);
g_signal_connect(window->notebook, "page-reordered",
G_CALLBACK(update_positions), window);
}