summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/notebook.c32
-rw-r--r--src/notebook.h5
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);