diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/tab.c | 36 | ||||
-rw-r--r-- | src/tab.h | 5 |
2 files changed, 32 insertions, 9 deletions
@@ -21,6 +21,7 @@ #include "tab.h" +#include <stdarg.h> #include <stdlib.h> #include <gtk/gtk.h> @@ -31,15 +32,6 @@ #include "web-view.h" static void -foreach_tab(MqTab *node, void (*cb)(MqTab *node)) -{ - for (; node; node = node->next) { - cb(node); - foreach_tab(node->first_child, cb); - } -} - -static void update_positions(MqTab *node, gint step) { if (node) { @@ -274,6 +266,32 @@ mq_tab_seek(MqTab *node, guint position) return mq_tab_seek(node->first_child, position); } +static void +foreach_tab(MqTab *node, void (*cb)(MqTab *node, va_list ap), va_list ap) +{ + va_list aq; + + for (; node; node = node->next) { + va_copy(ap, aq); + cb(node, aq); + va_end(aq); + + va_copy(ap, aq); + foreach_tab(node->first_child, cb, aq); + va_end(aq); + } +} + +void +mq_tab_foreach(MqTab *node, void (*cb)(MqTab *node, va_list ap), ...) +{ + va_list ap; + + va_start(ap, cb); + foreach_tab(node->root->first_child, cb, ap); + va_end(ap); +} + void mq_tab_scroll_tab_labels(MqTab *node) { @@ -24,6 +24,8 @@ typedef struct MqTab MqTab; #ifndef MQ_TAB_H #define MQ_TAB_H +#include <stdarg.h> + #include <glib.h> #include <gtk/gtk.h> #include <webkit2/webkit2.h> @@ -82,6 +84,9 @@ MqTab * mq_tab_seek(MqTab *node, guint position); void +mq_tab_foreach(MqTab *node, void (*cb)(MqTab *node, va_list ap), ...); + +void mq_tab_scroll_tab_labels(MqTab *node); void |