diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/notebook.c | 25 | ||||
-rw-r--r-- | src/notebook.h | 5 |
2 files changed, 30 insertions, 0 deletions
diff --git a/src/notebook.c b/src/notebook.c index 7b846f4..9970a57 100644 --- a/src/notebook.c +++ b/src/notebook.c @@ -46,6 +46,8 @@ struct _MqNotebook { MqTabTree *found_node; MqTabPage *current_page; GtkWidget *tab_tree_popover; + gboolean (*foreach_cb)(MqTabPage *page, gpointer user_data); + gpointer foreach_data; }; enum { @@ -481,3 +483,26 @@ mq_notebook_update_tab_title(MqNotebook *notebook, MqTabPage *tab_page, mq_window_set_title(notebook->window, title); } } + +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, + notebook->foreach_data); +} + +void +mq_notebook_foreach_page(MqNotebook *notebook, + gboolean (*cb)(MqTabPage *page, gpointer user_data), + gpointer user_data) +{ + notebook->foreach_cb = cb; + notebook->foreach_data = user_data; + mq_tree_foreach(MQ_TREE(notebook->tree), foreach_page, notebook); + notebook->foreach_cb = NULL; + notebook->foreach_data = NULL; +} diff --git a/src/notebook.h b/src/notebook.h index 6538eb8..746a67a 100644 --- a/src/notebook.h +++ b/src/notebook.h @@ -78,6 +78,11 @@ void mq_notebook_update_tab_title(MqNotebook *notebook, MqTabPage *tab_page, const gchar *title); +void +mq_notebook_foreach_page(MqNotebook *notebook, + gboolean (*cb)(MqTabPage *page, gpointer user_data), + gpointer user_data); + G_END_DECLS #endif /* MQ_NOTEBOOK_H */ |