diff options
Diffstat (limited to 'src/tab.c')
-rw-r--r-- | src/tab.c | 36 |
1 files changed, 27 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) { |