aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2016-06-17 06:15:05 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2016-06-17 06:15:05 +0000
commita9aa586275af6874258d346a88c6147495a0b8c0 (patch)
treed4d3249648cfa9f4678524e2b24aa8e376afecfc
parentd81f66866effd5f0795601fa58a88e40565bfa21 (diff)
added new plug-in APIs.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@3511 ee746299-78ed-0310-b773-934348b2243d
-rw-r--r--ChangeLog21
-rw-r--r--src/main.c13
-rw-r--r--src/plugin.c118
-rw-r--r--src/plugin.h32
4 files changed, 179 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 0e87921a..e7ba2c0b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,24 @@
+2016-06-17
+
+ * src/main.c
+ src/plugin.[ch]: added new plug-in functions and signals.
+
+2016-06-17
+
+ * src/compose.[ch]:
+ added new public fuctions:
+ compose_get_toolbar()
+ compose_get_misc_hbox()
+ compose_get_textview()
+ compose_attach_append()
+ compose_attach_remove_all()
+ compose_send()
+ added Compose pointer return value:
+ compose_reply()
+ compose_forward()
+ compose_redirect()
+ compose_reedit()
+
2016-01-19
* version 3.5.0
diff --git a/src/main.c b/src/main.c
index c4909b32..63a90b81 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1,6 +1,6 @@
/*
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2014 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2016 Hiroyuki Yamamoto
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -1355,6 +1355,7 @@ static void plugin_init(void)
syl_plugin_add_symbol("main_window_menu_factory",
mainwin->menu_factory);
+ syl_plugin_add_symbol("main_window_toolbar", mainwin->toolbar);
syl_plugin_add_symbol("main_window_statusbar", mainwin->statusbar);
ADD_SYM(folderview_get);
@@ -1407,11 +1408,21 @@ static void plugin_init(void)
ADD_SYM(messageview_show);
ADD_SYM(compose_new);
+ ADD_SYM(compose_reply);
+ ADD_SYM(compose_forward);
+ ADD_SYM(compose_redirect);
+ ADD_SYM(compose_reedit);
ADD_SYM(compose_entry_set);
ADD_SYM(compose_entry_append);
ADD_SYM(compose_entry_get_text);
ADD_SYM(compose_lock);
ADD_SYM(compose_unlock);
+ ADD_SYM(compose_get_toolbar);
+ ADD_SYM(compose_get_misc_hbox);
+ ADD_SYM(compose_get_textview);
+ ADD_SYM(compose_attach_append);
+ ADD_SYM(compose_attach_remove_all);
+ ADD_SYM(compose_send);
ADD_SYM(foldersel_folder_sel);
ADD_SYM(foldersel_folder_sel_full);
diff --git a/src/plugin.c b/src/plugin.c
index d78893fc..76134752 100644
--- a/src/plugin.c
+++ b/src/plugin.c
@@ -1,6 +1,6 @@
/*
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2013 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2016 Hiroyuki Yamamoto
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -46,6 +46,8 @@ enum {
PREFS_FILTER_EDIT_OPEN,
PREFS_TEMPLATE_OPEN,
PLUGIN_MANAGER_OPEN,
+ MAIN_WINDOW_TOOLBAR_CHANGED,
+ COMPOSE_TOOLBAR_CHANGED,
LAST_SIGNAL
};
@@ -73,7 +75,7 @@ enum {
#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); }
+ { if (func_ptr) func_ptr(arg1, arg2, arg3, arg4); }
#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) \
@@ -294,6 +296,25 @@ static void syl_plugin_class_init(SylPluginClass *klass)
G_TYPE_NONE,
1,
G_TYPE_POINTER);
+ plugin_signals[MAIN_WINDOW_TOOLBAR_CHANGED] =
+ g_signal_new("main-window-toolbar-changed",
+ G_TYPE_FROM_CLASS(gobject_class),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET(SylPluginClass, main_window_toolbar_changed),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE,
+ 0);
+ plugin_signals[COMPOSE_TOOLBAR_CHANGED] =
+ g_signal_new("compose-toolbar-changed",
+ G_TYPE_FROM_CLASS(gobject_class),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET(SylPluginClass, compose_toolbar_changed),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__POINTER,
+ G_TYPE_NONE,
+ 1,
+ G_TYPE_POINTER);
}
void syl_plugin_signal_connect(const gchar *name, GCallback callback,
@@ -566,6 +587,14 @@ void syl_plugin_main_window_popup(gpointer mainwin)
SAFE_CALL_ARG1(func, mainwin);
}
+GtkWidget *syl_plugin_main_window_get_toolbar(void)
+{
+ gpointer widget;
+
+ widget = syl_plugin_lookup_symbol("main_window_toolbar");
+ return GTK_WIDGET(widget);
+}
+
GtkWidget *syl_plugin_main_window_get_statusbar(void)
{
gpointer widget;
@@ -1066,6 +1095,40 @@ gpointer syl_plugin_compose_new(PrefsAccount *account, FolderItem *item,
return SAFE_CALL_ARG4_RET(func, account, item, mailto, attach_files);
}
+gpointer syl_plugin_compose_reply(MsgInfo *msginfo, FolderItem *item,
+ gint mode, const gchar *body)
+{
+ gpointer (*func)(MsgInfo *, FolderItem *, gint, const gchar *);
+
+ GETFUNC("compose_reply");
+ return SAFE_CALL_ARG4_RET(func, msginfo, item, mode, body);
+}
+
+gpointer syl_plugin_compose_forward(GSList *mlist, FolderItem *item,
+ gboolean as_attach, const gchar *body)
+{
+ gpointer (*func)(GSList *, FolderItem *, gboolean, const gchar *);
+
+ GETFUNC("compose_forward");
+ return SAFE_CALL_ARG4_RET(func, mlist, item, as_attach, body);
+}
+
+gpointer syl_plugin_compose_redirect(MsgInfo *msginfo, FolderItem *item)
+{
+ gpointer (*func)(MsgInfo *, FolderItem *);
+
+ GETFUNC("compose_redirect");
+ return SAFE_CALL_ARG2_RET(func, msginfo, item);
+}
+
+gpointer syl_plugin_compose_reedit(MsgInfo *msginfo)
+{
+ gpointer (*func)(MsgInfo *);
+
+ GETFUNC("compose_reedit");
+ return SAFE_CALL_ARG1_RET(func, msginfo);
+}
+
void syl_plugin_compose_entry_set(gpointer compose, const gchar *text,
gint type)
{
@@ -1108,6 +1171,57 @@ void syl_plugin_compose_unlock(gpointer compose)
SAFE_CALL_ARG1(func, compose);
}
+GtkWidget *syl_plugin_compose_get_toolbar(gpointer compose)
+{
+ GtkWidget * (*func)(gpointer);
+
+ func = syl_plugin_lookup_symbol("compose_get_toolbar");
+ return SAFE_CALL_ARG1_RET(func, compose);
+}
+
+GtkWidget *syl_plugin_compose_get_misc_hbox(gpointer compose)
+{
+ GtkWidget * (*func)(gpointer);
+
+ func = syl_plugin_lookup_symbol("compose_get_misc_hbox");
+ return SAFE_CALL_ARG1_RET(func, compose);
+}
+
+GtkWidget *syl_plugin_compose_get_textview(gpointer compose)
+{
+ GtkWidget * (*func)(gpointer);
+
+ func = syl_plugin_lookup_symbol("compose_get_textview");
+ return SAFE_CALL_ARG1_RET(func, compose);
+}
+
+gint syl_plugin_compose_send(gpointer compose, gboolean close_on_success)
+{
+ gint (*func)(gpointer, gboolean);
+
+ GETFUNC("compose_send");
+ return SAFE_CALL_ARG2_RET_VAL(func, compose, close_on_success, -1);
+}
+
+void syl_plugin_compose_attach_append(gpointer compose,
+ const gchar *file,
+ const gchar *filename,
+ const gchar *content_type)
+{
+ void (*func)(gpointer, const gchar *, const gchar *, const gchar *);
+
+ GETFUNC("compose_attach_append");
+ SAFE_CALL_ARG4(func, compose, file, filename, content_type);
+}
+
+void syl_plugin_compose_attach_remove_all(gpointer compose)
+{
+ void (*func)(gpointer);
+
+ GETFUNC("compose_attach_remove_all");
+ SAFE_CALL_ARG1(func, compose);
+}
+
FolderItem *syl_plugin_folder_sel(Folder *cur_folder, gint sel_type,
const gchar *default_folder)
diff --git a/src/plugin.h b/src/plugin.h
index bf751431..6c6857f3 100644
--- a/src/plugin.h
+++ b/src/plugin.h
@@ -1,6 +1,6 @@
/*
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2013 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2016 Hiroyuki Yamamoto
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -46,7 +46,7 @@ typedef void (*SylPluginLoadFunc) (void);
typedef void (*SylPluginUnloadFunc) (void);
typedef void (*SylPluginCallbackFunc) (void);
-#define SYL_PLUGIN_INTERFACE_VERSION 0x0109
+#define SYL_PLUGIN_INTERFACE_VERSION 0x010a
struct _SylPlugin
{
@@ -107,6 +107,9 @@ struct _SylPluginClass
GtkWidget *window);
void (* plugin_manager_open) (GObject *obj,
GtkWidget *window);
+
+ void (* compose_toolbar_changed) (GObject *obj, gpointer compose);
+ void (* main_window_toolbar_changed) (GObject *obj);
};
struct _SylPluginInfo
@@ -159,6 +162,7 @@ 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_toolbar (void);
GtkWidget *syl_plugin_main_window_get_statusbar (void);
void syl_plugin_app_will_exit (gboolean force);
@@ -246,6 +250,20 @@ gpointer syl_plugin_compose_new (PrefsAccount *account,
FolderItem *item,
const gchar *mailto,
GPtrArray *attach_files);
+/* compose mode:
+ 1: reply 2: reply to sender 3: reply to all 4: reply to list
+ | 1 << 16: with quote */
+gpointer syl_plugin_compose_reply (MsgInfo *msginfo,
+ FolderItem *item,
+ gint mode,
+ const gchar *body);
+gpointer syl_plugin_compose_forward (GSList *mlist,
+ FolderItem *item,
+ gboolean as_attach,
+ const gchar *body);
+gpointer syl_plugin_compose_redirect (MsgInfo *msginfo,
+ FolderItem *item);
+gpointer syl_plugin_compose_reedit (MsgInfo *msginfo);
/* entry type:
0: To 1: Cc 2: Bcc 3: Reply-To 4: Subject 5: Newsgroups 6: Followup-To */
@@ -260,6 +278,16 @@ gchar *syl_plugin_compose_entry_get_text (gpointer compose,
void syl_plugin_compose_lock (gpointer compose);
void syl_plugin_compose_unlock (gpointer compose);
+GtkWidget *syl_plugin_compose_get_toolbar (gpointer compose);
+
+gint syl_plugin_compose_send (gpointer compose,
+ gboolean close_on_success);
+void syl_plugin_compose_attach_append (gpointer compose,
+ const gchar *file,
+ const gchar *filename,
+ const gchar *content_type);
+void syl_plugin_compose_attach_remove_all (gpointer compose);
+
/* Others */
FolderItem *syl_plugin_folder_sel (Folder *cur_folder,
gint sel_type,