From 8a3bccf0dc619caaa0d912409cd24eddff7cb3b5 Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Mon, 23 Oct 2017 06:08:16 -0400 Subject: mq_notebook_update_tab_title(): New function --- diff --git a/src/notebook.c b/src/notebook.c index 3521c93..1a33a4c 100644 --- a/src/notebook.c +++ b/src/notebook.c @@ -42,6 +42,7 @@ struct _MqNotebook { MqWindow *window; MqTabTree *tree; MqTabTree *found_node; + MqTabPage *current_page; }; enum { @@ -118,6 +119,8 @@ static void switch_page_cb(MqNotebook *notebook, MqTabPage *page, guint G_GNUC_UNUSED page_num) { + notebook->current_page = page; + mq_window_set_title(notebook->window, mq_tab_page_get_title(page)); } @@ -243,3 +246,12 @@ mq_notebook_insert_child(MqNotebook *notebook, const gchar *uri, return node->page; } + +void +mq_notebook_update_tab_title(MqNotebook *notebook, MqTabPage *tab_page, + const gchar *title) +{ + if (tab_page == notebook->current_page) { + mq_window_set_title(notebook->window, title); + } +} diff --git a/src/notebook.h b/src/notebook.h index 47c1e5d..4cb696e 100644 --- a/src/notebook.h +++ b/src/notebook.h @@ -64,6 +64,10 @@ MqTabPage * mq_notebook_insert_child(MqNotebook *notebook, const gchar *uri, MqTabPage *child); +void +mq_notebook_update_tab_title(MqNotebook *notebook, MqTabPage *tab_page, + const gchar *title); + G_END_DECLS #endif /* MQ_NOTEBOOK_H */ -- cgit v0.9.1