diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main.c | 11 | ||||
-rw-r--r-- | src/plugin.c | 95 | ||||
-rw-r--r-- | src/plugin.h | 32 |
3 files changed, 136 insertions, 2 deletions
@@ -1181,6 +1181,12 @@ static void plugin_init(void) ADD_SYM(summary_get_selected_msg_list); ADD_SYM(summary_get_msg_list); ADD_SYM(summary_show_queued_msgs); + ADD_SYM(summary_redisplay_msg); + ADD_SYM(summary_open_msg); + ADD_SYM(summary_view_source); + ADD_SYM(summary_reedit); + ADD_SYM(summary_update_selected_rows); + ADD_SYM(summary_update_by_msgnum); ADD_SYM(messageview_create_with_new_window); ADD_SYM(messageview_show); @@ -1215,6 +1221,11 @@ static void plugin_init(void) ADD_SYM(update_check_get_jump_url); #endif + ADD_SYM(alertpanel_full); + ADD_SYM(alertpanel); + ADD_SYM(alertpanel_message); + ADD_SYM(alertpanel_message_with_disable); + syl_plugin_signal_connect("plugin-load", G_CALLBACK(load_cb), NULL); /* loading plug-ins from user plug-in directory */ diff --git a/src/plugin.c b/src/plugin.c index 7a73b6bc..ea45a9ee 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -58,10 +58,14 @@ enum { { if (func_ptr) func_ptr(arg1, arg2, arg3); } #define SAFE_CALL_ARG3_RET(func_ptr, arg1, arg2, arg3) \ (func_ptr ? func_ptr(arg1, arg2, arg3) : NULL) +#define SAFE_CALL_ARG3_RET_VAL(func_ptr, arg1, arg2, arg3, retval) \ + (func_ptr ? func_ptr(arg1, arg2, arg3) : retval) #define SAFE_CALL_ARG4(func_ptr, arg1, arg2, arg3, arg4) \ { if (func_ptr) func_ptr(arg1, arg2, arg3); } #define SAFE_CALL_ARG4_RET(func_ptr, arg1, arg2, arg3, arg4) \ (func_ptr ? func_ptr(arg1, arg2, arg3, arg4) : NULL) +#define SAFE_CALL_ARG4_RET_VAL(func_ptr, arg1, arg2, arg3, arg4, retval) \ + (func_ptr ? func_ptr(arg1, arg2, arg3, arg4) : retval) #define CALL_VOID_POINTER(getobj, sym) \ { \ @@ -671,7 +675,7 @@ gpointer syl_plugin_summary_view_get(void) return sym; } -void syl_plugin_sumary_select_by_msgnum(guint msgnum) +void syl_plugin_summary_select_by_msgnum(guint msgnum) { void (*func)(gpointer, guint); gpointer summary; @@ -827,6 +831,48 @@ GSList *syl_plugin_summary_get_msg_list(void) return NULL; } +void syl_plugin_summary_redisplay_msg(void) +{ + CALL_VOID_POINTER(syl_plugin_summary_view_get, + "summary_redisplay_msg"); +} + +void syl_plugin_summary_open_msg(void) +{ + CALL_VOID_POINTER(syl_plugin_summary_view_get, + "summary_open_msg"); +} + +void syl_plugin_summary_view_source(void) +{ + CALL_VOID_POINTER(syl_plugin_summary_view_get, + "summary_view_source"); +} + +void syl_plugin_summary_reedit(void) +{ + CALL_VOID_POINTER(syl_plugin_summary_view_get, + "summary_reedit"); +} + +void syl_plugin_summary_update_selected_rows(void) +{ + CALL_VOID_POINTER(syl_plugin_summary_view_get, + "summary_update_selected_rows"); +} + +void syl_plugin_summary_update_by_msgnum(guint msgnum) +{ + void (*func)(gpointer, guint); + gpointer summary; + + summary = syl_plugin_summary_view_get(); + if (summary) { + func = syl_plugin_lookup_symbol("summary_update_by_msgnum"); + SAFE_CALL_ARG2(func, summary, msgnum); + } +} + gpointer syl_plugin_messageview_create_with_new_window(void) { gpointer (*func)(void); @@ -1035,3 +1081,50 @@ const gchar *syl_plugin_update_check_get_jump_url(void) func = syl_plugin_lookup_symbol("update_check_get_jump_url"); return SAFE_CALL_RET(func); } + +gint syl_plugin_alertpanel_full(const gchar *title, const gchar *message, + gint type, gint default_value, + gboolean can_disable, + const gchar *btn1_label, + const gchar *btn2_label, + const gchar *btn3_label) +{ + gint (*func)(const gchar *, const gchar *, gint, gint, gboolean, + const gchar *, const gchar *, const gchar *); + + GETFUNC("alertpanel_full"); + return func ? func(title, message, type, default_value, can_disable, + btn1_label, btn2_label, btn3_label) : -1; +} + +gint syl_plugin_alertpanel(const gchar *title, const gchar *message, + const gchar *btn1_label, + const gchar *btn2_label, + const gchar *btn3_label) +{ + gint (*func)(const gchar *, const gchar *, + const gchar *, const gchar *, const gchar *); + + GETFUNC("alertpanel"); + return func ? func(title, message, btn1_label, btn2_label, btn3_label) + : -1; +} + +void syl_plugin_alertpanel_message(const gchar *title, const gchar *message, + gint type) +{ + void (*func)(const gchar *, const gchar *, gint); + + GETFUNC("alertpanel_message"); + SAFE_CALL_ARG3(func, title, message, type); +} + +gint syl_plugin_alertpanel_message_with_disable(const gchar *title, + const gchar *message, + gint type) +{ + gint (*func)(const gchar *, const gchar *, gint); + + GETFUNC("alertpanel_message_with_disable"); + return SAFE_CALL_ARG3_RET_VAL(func, title, message, type, 0); +} diff --git a/src/plugin.h b/src/plugin.h index d7cf11bc..eb53e0c3 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 0x0105 +#define SYL_PLUGIN_INTERFACE_VERSION 0x0106 struct _SylPlugin { @@ -182,6 +182,14 @@ gint syl_plugin_summary_get_selection_type (void); GSList *syl_plugin_summary_get_selected_msg_list(void); GSList *syl_plugin_summary_get_msg_list (void); +void syl_plugin_summary_redisplay_msg (void); +void syl_plugin_summary_open_msg (void); +void syl_plugin_summary_view_source (void); +void syl_plugin_summary_reedit (void); + +void syl_plugin_summary_update_selected_rows (void); +void syl_plugin_summary_update_by_msgnum (guint msgnum); + /* MessageView */ gpointer syl_plugin_messageview_create_with_new_window (void); @@ -238,4 +246,26 @@ const gchar *syl_plugin_update_check_get_check_url (void); void syl_plugin_update_check_set_jump_url (const gchar *url); const gchar *syl_plugin_update_check_get_jump_url (void); +/* type corresponds to AlertType + * default_value and return value corresponds to AlertValue */ +gint syl_plugin_alertpanel_full (const gchar *title, + const gchar *message, + gint type, + gint default_value, + gboolean can_disable, + const gchar *btn1_label, + const gchar *btn2_label, + const gchar *btn3_label); +gint syl_plugin_alertpanel (const gchar *title, + const gchar *message, + const gchar *btn1_label, + const gchar *btn2_label, + const gchar *btn3_label); +void syl_plugin_alertpanel_message (const gchar *title, + const gchar *message, + gint type); +gint syl_plugin_alertpanel_message_with_disable (const gchar *title, + const gchar *message, + gint type); + #endif /* __PLUGIN_H__ */ |