summaryrefslogtreecommitdiff
path: root/src/plugins/pglist.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/pglist.h')
-rw-r--r--src/plugins/pglist.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/plugins/pglist.h b/src/plugins/pglist.h
index ae71458..fd8e30a 100644
--- a/src/plugins/pglist.h
+++ b/src/plugins/pglist.h
@@ -69,6 +69,7 @@ GPluginModule **get_all_plugins_for_action(PluginAction, size_t *);
*/
#define process_all_plugins_for(a, f, ...) \
+ do \
{ \
size_t __count; \
GPluginModule **__list; \
@@ -84,12 +85,34 @@ GPluginModule **get_all_plugins_for_action(PluginAction, size_t *);
} \
while (0)
+#define process_plugins_while_null(a, f, ...) \
+ ({ \
+ void *__result; \
+ size_t __count; \
+ GPluginModule **__list; \
+ size_t __i; \
+ __result = NULL; \
+ __list = get_all_plugins_for_action(a, &__count); \
+ for (__i = 0; __i < __count; __i++) \
+ { \
+ if (__result == NULL) \
+ __result = f(__list[__i], a, __VA_ARGS__); \
+ g_object_unref(G_OBJECT(__list[__i])); \
+ } \
+ if (__list != NULL) \
+ free(__list); \
+ __result; \
+ })
+
/* DPS_PG_MANAGEMENT */
#define notify_native_loaded \
process_all_plugins_for(PGA_NATIVE_LOADED, g_plugin_module_notify_native_loaded, NULL)
+#define build_type_instance(t) \
+ process_plugins_while_null(PGA_TYPE_BUILDING, g_plugin_module_build_type_instance, t)
+
/* DPS_SETUP */
#define include_plugin_theme(d, r, c) \