diff options
-rw-r--r-- | src/main.c | 3 | ||||
-rw-r--r-- | src/plugin.c | 37 | ||||
-rw-r--r-- | src/plugin.h | 5 |
3 files changed, 43 insertions, 2 deletions
@@ -1088,6 +1088,8 @@ static void plugin_init(void) } syl_plugin_add_symbol("prog_version", prog_version); + syl_plugin_add_symbol("main_window_lock", main_window_lock); + syl_plugin_add_symbol("main_window_unlock", main_window_unlock); syl_plugin_add_symbol("main_window_get", main_window_get); syl_plugin_add_symbol("main_window_popup", main_window_popup); syl_plugin_add_symbol("app_will_exit", app_will_exit); @@ -1134,6 +1136,7 @@ static void plugin_init(void) manage_window_get_focus_window); syl_plugin_add_symbol("inc_mail", inc_mail); + syl_plugin_add_symbol("inc_is_active", inc_is_active); syl_plugin_add_symbol("inc_lock", inc_lock); syl_plugin_add_symbol("inc_unlock", inc_unlock); diff --git a/src/plugin.c b/src/plugin.c index 1078f78f..51968572 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -36,6 +36,8 @@ enum { #define SAFE_CALL(func_ptr) { if (func_ptr) func_ptr(); } #define SAFE_CALL_RET(func_ptr) (func_ptr ? func_ptr() : NULL) +#define SAFE_CALL_RET_VAL(func_ptr, retval) \ + (func_ptr ? func_ptr() : retval) #define SAFE_CALL_ARG1(func_ptr, arg1) { if (func_ptr) func_ptr(arg1); } #define SAFE_CALL_ARG1_RET(func_ptr, arg1) \ (func_ptr ? func_ptr(arg1) : NULL) @@ -119,7 +121,8 @@ void syl_plugin_signal_emit(const gchar *name, ...) guint signal_id; if (g_signal_parse_name(name, G_TYPE_FROM_INSTANCE(plugin_obj), &signal_id, NULL, FALSE)) { - va_list var_args; + \ + va_list var_args; va_start(var_args, name); g_signal_emit_valist(plugin_obj, signal_id, 0, var_args); va_end(var_args); @@ -335,6 +338,30 @@ const gchar *syl_plugin_get_prog_version(void) return (gchar *)sym; } +void syl_plugin_main_window_lock(void) +{ + void (*func)(gpointer); + gpointer mainwin; + + mainwin = syl_plugin_main_window_get(); + if (mainwin) { + func = syl_plugin_lookup_symbol("main_window_lock"); + SAFE_CALL_ARG1(func, mainwin); + } +} + +void syl_plugin_main_window_unlock(void) +{ + void (*func)(gpointer); + gpointer mainwin; + + mainwin = syl_plugin_main_window_get(); + if (mainwin) { + func = syl_plugin_lookup_symbol("main_window_unlock"); + SAFE_CALL_ARG1(func, mainwin); + } +} + gpointer syl_plugin_main_window_get(void) { gpointer (*func)(void); @@ -692,6 +719,14 @@ void syl_plugin_inc_mail(void) SAFE_CALL_ARG1(func, syl_plugin_main_window_get()); } +gboolean syl_plugin_inc_is_active(void) +{ + gboolean (*func)(void); + + func = syl_plugin_lookup_symbol("inc_is_active"); + return SAFE_CALL_RET_VAL(func, FALSE); +} + void syl_plugin_inc_lock(void) { void (*func)(void); diff --git a/src/plugin.h b/src/plugin.h index 622dd8a7..94ea652d 100644 --- a/src/plugin.h +++ b/src/plugin.h @@ -45,7 +45,7 @@ typedef void (*SylPluginLoadFunc) (void); typedef void (*SylPluginUnloadFunc) (void); typedef void (*SylPluginCallbackFunc) (void); -#define SYL_PLUGIN_INTERFACE_VERSION 0x0102 +#define SYL_PLUGIN_INTERFACE_VERSION 0x0103 struct _SylPlugin { @@ -107,6 +107,8 @@ gpointer syl_plugin_lookup_symbol (const gchar *name); const gchar *syl_plugin_get_prog_version (void); +void syl_plugin_main_window_lock (void); +void syl_plugin_main_window_unlock (void); gpointer syl_plugin_main_window_get (void); void syl_plugin_main_window_popup (gpointer mainwin); GtkWidget *syl_plugin_main_window_get_statusbar (void); @@ -175,6 +177,7 @@ GtkWidget *syl_plugin_manage_window_get_focus_window (void); void syl_plugin_inc_mail (void); +gboolean syl_plugin_inc_is_active (void); void syl_plugin_inc_lock (void); void syl_plugin_inc_unlock (void); |