diff options
author | Patrick McDermott <pj@pehjota.net> | 2017-10-23 05:59:26 (EDT) |
---|---|---|
committer | Patrick McDermott <pj@pehjota.net> | 2017-10-23 05:59:26 (EDT) |
commit | 415c025725557acd75d86ec87b8bcc09ed66986d (patch) | |
tree | 494a9153b7380bc9542d8b60143598e0af5e3c27 | |
parent | 50804c0dc840e76c3b3203b170ae4a95c2bcee70 (diff) | |
download | marquee-415c025725557acd75d86ec87b8bcc09ed66986d.zip marquee-415c025725557acd75d86ec87b8bcc09ed66986d.tar.gz marquee-415c025725557acd75d86ec87b8bcc09ed66986d.tar.bz2 |
Move page switch cb from MqWindow to MqNotebook
-rw-r--r-- | src/notebook.c | 10 | ||||
-rw-r--r-- | src/window.c | 11 |
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); } |