diff options
author | P. J. McDermott <pj@pehjota.net> | 2018-10-01 19:10:20 (EDT) |
---|---|---|
committer | P. J. McDermott <pj@pehjota.net> | 2018-10-01 19:10:20 (EDT) |
commit | 86a6adf3b0eb8e69bc5342acedee963cb8a664df (patch) | |
tree | b2c81a3fd951cdf41ce9706f3d447a0f2846c0c2 | |
parent | c5c9684a7cff6cc41520aea66b3ff7b5f79ed2ca (diff) | |
download | marquee-86a6adf3b0eb8e69bc5342acedee963cb8a664df.zip marquee-86a6adf3b0eb8e69bc5342acedee963cb8a664df.tar.gz marquee-86a6adf3b0eb8e69bc5342acedee963cb8a664df.tar.bz2 |
mq_notebook_foreach_label(): New function
-rw-r--r-- | src/notebook.c | 32 | ||||
-rw-r--r-- | src/notebook.h | 5 |
2 files changed, 33 insertions, 4 deletions
diff --git a/src/notebook.c b/src/notebook.c index 9970a57..f432841 100644 --- a/src/notebook.c +++ b/src/notebook.c @@ -46,7 +46,8 @@ struct _MqNotebook { MqTabTree *found_node; MqTabPage *current_page; GtkWidget *tab_tree_popover; - gboolean (*foreach_cb)(MqTabPage *page, gpointer user_data); + gboolean (*foreach_label_cb)(MqTabLabel *label, gpointer user_data); + gboolean (*foreach_page_cb)(MqTabPage *page, gpointer user_data); gpointer foreach_data; }; @@ -485,13 +486,36 @@ mq_notebook_update_tab_title(MqNotebook *notebook, MqTabPage *tab_page, } static gboolean +foreach_label(MqTree *node, gpointer user_data) +{ + MqNotebook *notebook; + + notebook = MQ_NOTEBOOK(user_data); + + return notebook->foreach_label_cb(MQ_TAB_TREE(node)->label, + notebook->foreach_data); +} + +void +mq_notebook_foreach_label(MqNotebook *notebook, + gboolean (*cb)(MqTabLabel *label, gpointer user_data), + gpointer user_data) +{ + notebook->foreach_label_cb = cb; + notebook->foreach_data = user_data; + mq_tree_foreach(MQ_TREE(notebook->tree), foreach_label, notebook); + notebook->foreach_label_cb = NULL; + notebook->foreach_data = NULL; +} + +static gboolean foreach_page(MqTree *node, gpointer user_data) { MqNotebook *notebook; notebook = MQ_NOTEBOOK(user_data); - return notebook->foreach_cb(MQ_TAB_TREE(node)->page, + return notebook->foreach_page_cb(MQ_TAB_TREE(node)->page, notebook->foreach_data); } @@ -500,9 +524,9 @@ mq_notebook_foreach_page(MqNotebook *notebook, gboolean (*cb)(MqTabPage *page, gpointer user_data), gpointer user_data) { - notebook->foreach_cb = cb; + notebook->foreach_page_cb = cb; notebook->foreach_data = user_data; mq_tree_foreach(MQ_TREE(notebook->tree), foreach_page, notebook); - notebook->foreach_cb = NULL; + notebook->foreach_page_cb = NULL; notebook->foreach_data = NULL; } diff --git a/src/notebook.h b/src/notebook.h index 746a67a..8fec0f6 100644 --- a/src/notebook.h +++ b/src/notebook.h @@ -79,6 +79,11 @@ mq_notebook_update_tab_title(MqNotebook *notebook, MqTabPage *tab_page, const gchar *title); void +mq_notebook_foreach_label(MqNotebook *notebook, + gboolean (*cb)(MqTabLabel *label, gpointer user_data), + gpointer user_data); + +void mq_notebook_foreach_page(MqNotebook *notebook, gboolean (*cb)(MqTabPage *page, gpointer user_data), gpointer user_data); |