aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2010-07-14 07:06:31 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2010-07-14 07:06:31 +0000
commitb7fb2e449b2f2e3749651610f4ae752a71367d94 (patch)
treec0b922bd30bdde7c07e2645c899605845d18ddd9
parentd74b2239157d36b8b8795c5eda4bc0315a6ec76e (diff)
added syl_plugin_summary_show_queued_msgs() and cleanup the code.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@2616 ee746299-78ed-0310-b773-934348b2243d
-rw-r--r--ChangeLog6
-rw-r--r--src/main.c1
-rw-r--r--src/plugin.c108
-rw-r--r--src/plugin.h2
4 files changed, 45 insertions, 72 deletions
diff --git a/ChangeLog b/ChangeLog
index 8cfa9031..a1447058 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2010-07-14
+ * src/plugin.[ch]
+ src/main.c: added syl_plugin_summary_show_queued_msgs() and cleanup
+ the code.
+
+2010-07-14
+
* src/gtkutils.[ch]
src/addressbook.c
src/compose.c
diff --git a/src/main.c b/src/main.c
index df7cec6c..d3a7c94f 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1174,6 +1174,7 @@ static void plugin_init(void)
ADD_SYM(summary_get_selection_type);
ADD_SYM(summary_get_selected_msg_list);
ADD_SYM(summary_get_msg_list);
+ ADD_SYM(summary_show_queued_msgs);
ADD_SYM(messageview_create_with_new_window);
ADD_SYM(messageview_show);
diff --git a/src/plugin.c b/src/plugin.c
index 3e83a221..7a73b6bc 100644
--- a/src/plugin.c
+++ b/src/plugin.c
@@ -63,6 +63,18 @@ enum {
#define SAFE_CALL_ARG4_RET(func_ptr, arg1, arg2, arg3, arg4) \
(func_ptr ? func_ptr(arg1, arg2, arg3, arg4) : NULL)
+#define CALL_VOID_POINTER(getobj, sym) \
+{ \
+ void (*func)(gpointer); \
+ gpointer obj; \
+ obj = getobj(); \
+ if (obj) { \
+ GETFUNC(sym); \
+ SAFE_CALL_ARG1(func, obj); \
+ } \
+}
+
+
static guint plugin_signals[LAST_SIGNAL] = { 0 };
static GHashTable *sym_table = NULL;
@@ -376,26 +388,14 @@ const gchar *syl_plugin_get_prog_version(void)
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);
- }
+ CALL_VOID_POINTER(syl_plugin_main_window_get,
+ "main_window_lock");
}
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);
- }
+ CALL_VOID_POINTER(syl_plugin_main_window_get,
+ "main_window_unlock");
}
gpointer syl_plugin_main_window_get(void)
@@ -589,26 +589,14 @@ void syl_plugin_folderview_select(FolderItem *item)
void syl_plugin_folderview_unselect(void)
{
- void (*func)(gpointer);
- gpointer folderview;
-
- folderview = syl_plugin_folderview_get();
- if (folderview) {
- GETFUNC("folderview_unselect");
- SAFE_CALL_ARG1(func, folderview);
- }
+ CALL_VOID_POINTER(syl_plugin_folderview_get,
+ "folderview_unselect");
}
void syl_plugin_folderview_select_next_unread(void)
{
- void (*func)(gpointer);
- gpointer folderview;
-
- folderview = syl_plugin_folderview_get();
- if (folderview) {
- GETFUNC("folderview_select_next_unread");
- SAFE_CALL_ARG1(func, folderview);
- }
+ CALL_VOID_POINTER(syl_plugin_folderview_get,
+ "folderview_select_next_unread");
}
FolderItem *syl_plugin_folderview_get_selected_item(void)
@@ -671,14 +659,8 @@ void syl_plugin_folderview_update_all_updated(gboolean update_summary)
void syl_plugin_folderview_check_new_selected(void)
{
- void (*func)(gpointer);
- gpointer folderview;
-
- folderview = syl_plugin_folderview_get();
- if (folderview) {
- GETFUNC("folderview_check_new_selected");
- SAFE_CALL_ARG1(func, folderview);
- }
+ CALL_VOID_POINTER(syl_plugin_folderview_get,
+ "folderview_check_new_selected");
}
gpointer syl_plugin_summary_view_get(void)
@@ -731,28 +713,22 @@ void syl_plugin_open_message(const gchar *folder_id, guint msgnum)
}
}
-void syl_plugin_summary_lock(void)
+void syl_plugin_summary_show_queued_msgs(void)
{
- void (*func)(gpointer);
- gpointer summary;
+ CALL_VOID_POINTER(syl_plugin_summary_view_get,
+ "summary_show_queued_msgs");
+}
- summary = syl_plugin_summary_view_get();
- if (summary) {
- GETFUNC("summary_lock");
- SAFE_CALL_ARG1(func, summary);
- }
+void syl_plugin_summary_lock(void)
+{
+ CALL_VOID_POINTER(syl_plugin_summary_view_get,
+ "summary_lock");
}
void syl_plugin_summary_unlock(void)
{
- void (*func)(gpointer);
- gpointer summary;
-
- summary = syl_plugin_summary_view_get();
- if (summary) {
- GETFUNC("summary_unlock");
- SAFE_CALL_ARG1(func, summary);
- }
+ CALL_VOID_POINTER(syl_plugin_summary_view_get,
+ "summary_unlock");
}
gboolean syl_plugin_summary_is_locked(void)
@@ -785,26 +761,14 @@ gboolean syl_plugin_summary_is_read_locked(void)
void syl_plugin_summary_write_lock(void)
{
- void (*func)(gpointer);
- gpointer summary;
-
- summary = syl_plugin_summary_view_get();
- if (summary) {
- GETFUNC("summary_write_lock");
- SAFE_CALL_ARG1(func, summary);
- }
+ CALL_VOID_POINTER(syl_plugin_summary_view_get,
+ "summary_write_lock");
}
void syl_plugin_summary_write_unlock(void)
{
- void (*func)(gpointer);
- gpointer summary;
-
- summary = syl_plugin_summary_view_get();
- if (summary) {
- GETFUNC("summary_write_unlock");
- SAFE_CALL_ARG1(func, summary);
- }
+ CALL_VOID_POINTER(syl_plugin_summary_view_get,
+ "summary_write_unlock");
}
gboolean syl_plugin_summary_is_write_locked(void)
diff --git a/src/plugin.h b/src/plugin.h
index f7c29ed2..d7cf11bc 100644
--- a/src/plugin.h
+++ b/src/plugin.h
@@ -168,6 +168,8 @@ gboolean syl_plugin_summary_select_by_msginfo (MsgInfo *msginfo);
void syl_plugin_open_message (const gchar *folder_id,
guint msgnum);
+void syl_plugin_summary_show_queued_msgs (void);
+
void syl_plugin_summary_lock (void);
void syl_plugin_summary_unlock (void);
gboolean syl_plugin_summary_is_locked (void);