summaryrefslogtreecommitdiff
path: root/src/plugin.h
diff options
context:
space:
mode:
authorSimeon Simeonov2018-02-26 11:23:00 +0100
committerSimeon Simeonov2018-02-26 11:23:00 +0100
commit0b3cbf57875fd692e4ba0b336fefa4bee1ed00dc (patch)
treeaf916a30553c78ce9d4f2d8658656a175c5b6921 /src/plugin.h
Initial commit for sylpheed 3.7.0
Diffstat (limited to 'src/plugin.h')
-rw-r--r--src/plugin.h376
1 files changed, 376 insertions, 0 deletions
diff --git a/src/plugin.h b/src/plugin.h
new file mode 100644
index 0000000..9b28dc5
--- /dev/null
+++ b/src/plugin.h
@@ -0,0 +1,376 @@
1/*
2 * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3 * Copyright (C) 1999-2016 Hiroyuki Yamamoto
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 */
19
20#ifndef __PLUGIN_H__
21#define __PLUGIN_H__
22
23#include <glib.h>
24#include <glib-object.h>
25#include <gmodule.h>
26#include <gtk/gtk.h>
27
28#include "procmsg.h"
29#include "folder.h"
30#include "filter.h"
31#include "plugin-types.h"
32
33/* SylPlugin object */
34
35#define SYL_TYPE_PLUGIN (syl_plugin_get_type())
36#define SYL_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), SYL_TYPE_PLUGIN, SylPlugin))
37#define SYL_IS_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), SYL_TYPE_PLUGIN))
38#define SYL_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), SYL_TYPE_PLUGIN, SylPluginClass))
39#define SYL_IS_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), SYL_TYPE_PLUGIN))
40#define SYL_PLUGIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), SYL_TYPE_PLUGIN, SylPluginClass))
41
42typedef struct _SylPlugin SylPlugin;
43typedef struct _SylPluginClass SylPluginClass;
44typedef struct _SylPluginInfo SylPluginInfo;
45
46typedef void (*SylPluginLoadFunc) (void);
47typedef void (*SylPluginUnloadFunc) (void);
48typedef void (*SylPluginCallbackFunc) (void);
49
50#define SYL_PLUGIN_INTERFACE_VERSION 0x010a
51
52struct _SylPlugin
53{
54 GObject parent_instance;
55};
56
57struct _SylPluginClass
58{
59 GObjectClass parent_class;
60
61 void (* plugin_load) (GObject *obj, GModule *module);
62 void (* plugin_unload) (GObject *obj, GModule *module);
63
64 void (* folderview_menu_popup) (GObject *obj, gpointer ifactory);
65 void (* summaryview_menu_popup) (GObject *obj, gpointer ifactory);
66
67 void (* compose_created) (GObject *obj, gpointer compose);
68 void (* compose_destroy) (GObject *obj, gpointer compose);
69
70 void (* textview_menu_popup) (GObject *obj,
71 GtkMenu *menu,
72 GtkTextView *textview,
73 const gchar *uri,
74 const gchar *selected_text,
75 MsgInfo *msginfo);
76
77 gboolean (* compose_send) (GObject *obj,
78 gpointer compose,
79 gint compose_mode,
80 gint send_mode,
81 const gchar *msg_file,
82 GSList *to_list);
83
84 void (* messageview_show) (GObject *obj,
85 gpointer msgview,
86 MsgInfo *msginfo,
87 gboolean all_headers);
88
89 void (* inc_mail_start) (GObject *obj,
90 PrefsAccount *account);
91 void (* inc_mail_finished) (GObject *obj,
92 gint new_messages);
93
94 /* Prefs dialogs */
95 void (* prefs_common_open) (GObject *obj,
96 GtkWidget *window);
97 void (* prefs_account_open) (GObject *obj,
98 PrefsAccount *account,
99 GtkWidget *window);
100 void (* prefs_filter_open) (GObject *obj,
101 GtkWidget *window);
102 void (* prefs_filter_edit_open) (GObject *obj,
103 FilterRule *rule,
104 const gchar *header,
105 const gchar *key,
106 GtkWidget *window);
107 void (* prefs_template_open) (GObject *obj,
108 GtkWidget *window);
109 void (* plugin_manager_open) (GObject *obj,
110 GtkWidget *window);
111
112 void (* main_window_toolbar_changed) (GObject *obj);
113 void (* compose_toolbar_changed) (GObject *obj, gpointer compose);
114 void (* compose_attach_changed) (GObject *obj, gpointer compose);
115};
116
117struct _SylPluginInfo
118{
119 gchar *name;
120 gchar *version;
121 gchar *author;
122 gchar *description;
123
124 gpointer pad1;
125 gpointer pad2;
126 gpointer pad3;
127 gpointer pad4;
128};
129
130GType syl_plugin_get_type (void);
131
132void syl_plugin_signal_connect (const gchar *name, GCallback callback,
133 gpointer data);
134void syl_plugin_signal_disconnect (gpointer func, gpointer data);
135void syl_plugin_signal_emit (const gchar *name, ...);
136
137/* Used by Sylpheed */
138
139gint syl_plugin_init_lib (void);
140
141gint syl_plugin_load (const gchar *file);
142gint syl_plugin_load_all (const gchar *dir);
143void syl_plugin_unload_all (void);
144
145GSList *syl_plugin_get_module_list (void);
146SylPluginInfo *syl_plugin_get_info (GModule *module);
147gboolean syl_plugin_check_version (GModule *module);
148
149gint syl_plugin_add_symbol (const gchar *name, gpointer sym);
150gpointer syl_plugin_lookup_symbol (const gchar *name);
151
152/* Interfaces which should be implemented by plug-ins
153 void plugin_load(void);
154 void plugin_unload(void);
155 SylPluginInfo *plugin_info(void);
156 gint plugin_interface_version(void);
157 */
158
159/* Plug-in API (used by plug-ins) */
160
161const gchar *syl_plugin_get_prog_version (void);
162
163void syl_plugin_main_window_lock (void);
164void syl_plugin_main_window_unlock (void);
165gpointer syl_plugin_main_window_get (void);
166void syl_plugin_main_window_popup (gpointer mainwin);
167GtkWidget *syl_plugin_main_window_get_toolbar (void);
168GtkWidget *syl_plugin_main_window_get_statusbar (void);
169
170void syl_plugin_app_will_exit (gboolean force);
171
172/* Menu */
173gint syl_plugin_add_menuitem (const gchar *parent,
174 const gchar *label,
175 SylPluginCallbackFunc func,
176 gpointer data);
177gint syl_plugin_add_factory_item (const gchar *menu,
178 const gchar *label,
179 SylPluginCallbackFunc func,
180 gpointer data);
181
182void syl_plugin_menu_set_sensitive (const gchar *path,
183 gboolean sensitive);
184void syl_plugin_menu_set_sensitive_all (GtkMenuShell *menu_shell,
185 gboolean sensitive);
186void syl_plugin_menu_set_active (const gchar *path,
187 gboolean is_active);
188
189
190/* FolderView */
191gpointer syl_plugin_folderview_get (void);
192
193void syl_plugin_folderview_add_sub_widget (GtkWidget *widget);
194
195void syl_plugin_folderview_select (FolderItem *item);
196void syl_plugin_folderview_unselect (void);
197void syl_plugin_folderview_select_next_unread (void);
198FolderItem *syl_plugin_folderview_get_selected_item
199 (void);
200
201gint syl_plugin_folderview_check_new (Folder *folder);
202gint syl_plugin_folderview_check_new_item (FolderItem *item);
203gint syl_plugin_folderview_check_new_all (void);
204
205void syl_plugin_folderview_update_item (FolderItem *item,
206 gboolean update_summary);
207void syl_plugin_folderview_update_item_foreach (GHashTable *table,
208 gboolean update_summary);
209void syl_plugin_folderview_update_all_updated (gboolean update_summary);
210void syl_plugin_folderview_check_new_selected (void);
211
212/* SummaryView */
213gpointer syl_plugin_summary_view_get (void);
214void syl_plugin_summary_select_by_msgnum (guint msgnum);
215gboolean syl_plugin_summary_select_by_msginfo (MsgInfo *msginfo);
216
217void syl_plugin_open_message (const gchar *folder_id,
218 guint msgnum);
219
220void syl_plugin_summary_show_queued_msgs (void);
221
222void syl_plugin_summary_lock (void);
223void syl_plugin_summary_unlock (void);
224gboolean syl_plugin_summary_is_locked (void);
225gboolean syl_plugin_summary_is_read_locked (void);
226void syl_plugin_summary_write_lock (void);
227void syl_plugin_summary_write_unlock (void);
228gboolean syl_plugin_summary_is_write_locked (void);
229
230FolderItem *syl_plugin_summary_get_current_folder
231 (void);
232
233gint syl_plugin_summary_get_selection_type (void);
234GSList *syl_plugin_summary_get_selected_msg_list(void);
235GSList *syl_plugin_summary_get_msg_list (void);
236
237void syl_plugin_summary_redisplay_msg (void);
238void syl_plugin_summary_open_msg (void);
239void syl_plugin_summary_view_source (void);
240void syl_plugin_summary_reedit (void);
241
242void syl_plugin_summary_update_selected_rows (void);
243void syl_plugin_summary_update_by_msgnum (guint msgnum);
244
245/* MessageView */
246gpointer syl_plugin_messageview_create_with_new_window
247 (void);
248void syl_plugin_open_message_by_new_window (MsgInfo *msginfo);
249
250/* Compose */
251gpointer syl_plugin_compose_new (PrefsAccount *account,
252 FolderItem *item,
253 const gchar *mailto,
254 GPtrArray *attach_files);
255/* compose mode:
256 1: reply 2: reply to sender 3: reply to all 4: reply to list
257 | 1 << 16: with quote */
258gpointer syl_plugin_compose_reply (MsgInfo *msginfo,
259 FolderItem *item,
260 gint mode,
261 const gchar *body);
262gpointer syl_plugin_compose_forward (GSList *mlist,
263 FolderItem *item,
264 gboolean as_attach,
265 const gchar *body);
266gpointer syl_plugin_compose_redirect (MsgInfo *msginfo,
267 FolderItem *item);
268gpointer syl_plugin_compose_reedit (MsgInfo *msginfo);
269
270/* entry type:
271 0: To 1: Cc 2: Bcc 3: Reply-To 4: Subject 5: Newsgroups 6: Followup-To */
272void syl_plugin_compose_entry_set (gpointer compose,
273 const gchar *text,
274 gint type);
275void syl_plugin_compose_entry_append (gpointer compose,
276 const gchar *text,
277 gint type);
278gchar *syl_plugin_compose_entry_get_text (gpointer compose,
279 gint type);
280void syl_plugin_compose_lock (gpointer compose);
281void syl_plugin_compose_unlock (gpointer compose);
282
283GtkWidget *syl_plugin_compose_get_toolbar (gpointer compose);
284GtkWidget *syl_plugin_compose_get_misc_hbox (gpointer compose);
285GtkWidget *syl_plugin_compose_get_textview (gpointer compose);
286
287gint syl_plugin_compose_send (gpointer compose,
288 gboolean close_on_success);
289void syl_plugin_compose_attach_append (gpointer compose,
290 const gchar *file,
291 const gchar *filename,
292 const gchar *content_type);
293void syl_plugin_compose_attach_remove_all (gpointer compose);
294/* returns list of SylPluginAttachInfo (GSList must be freed by caller) */
295GSList *syl_plugin_get_attach_list (gpointer compose);
296
297/* Others */
298FolderItem *syl_plugin_folder_sel (Folder *cur_folder,
299 gint sel_type,
300 const gchar *default_folder);
301FolderItem *syl_plugin_folder_sel_full (Folder *cur_folder,
302 gint sel_type,
303 const gchar *default_folder,
304 const gchar *message);
305
306gchar *syl_plugin_input_dialog (const gchar *title,
307 const gchar *message,
308 const gchar *default_string);
309gchar *syl_plugin_input_dialog_with_invisible (const gchar *title,
310 const gchar *message,
311 const gchar *default_string);
312
313void syl_plugin_manage_window_set_transient (GtkWindow *window);
314void syl_plugin_manage_window_signals_connect (GtkWindow *window);
315GtkWidget *syl_plugin_manage_window_get_focus_window
316 (void);
317
318void syl_plugin_inc_mail (void);
319gboolean syl_plugin_inc_is_active (void);
320void syl_plugin_inc_lock (void);
321void syl_plugin_inc_unlock (void);
322
323void syl_plugin_update_check (gboolean show_dialog_always);
324void syl_plugin_update_check_set_check_url (const gchar *url);
325const gchar *syl_plugin_update_check_get_check_url (void);
326void syl_plugin_update_check_set_download_url (const gchar *url);
327const gchar *syl_plugin_update_check_get_download_url (void);
328void syl_plugin_update_check_set_jump_url (const gchar *url);
329const gchar *syl_plugin_update_check_get_jump_url (void);
330void syl_plugin_update_check_set_check_plugin_url (const gchar *url);
331const gchar *syl_plugin_update_check_get_check_plugin_url(void);
332void syl_plugin_update_check_set_jump_plugin_url (const gchar *url);
333const gchar *syl_plugin_update_check_get_jump_plugin_url(void);
334
335/* type corresponds to AlertType
336 * default_value and return value corresponds to AlertValue */
337gint syl_plugin_alertpanel_full (const gchar *title,
338 const gchar *message,
339 gint type,
340 gint default_value,
341 gboolean can_disable,
342 const gchar *btn1_label,
343 const gchar *btn2_label,
344 const gchar *btn3_label);
345gint syl_plugin_alertpanel (const gchar *title,
346 const gchar *message,
347 const gchar *btn1_label,
348 const gchar *btn2_label,
349 const gchar *btn3_label);
350void syl_plugin_alertpanel_message (const gchar *title,
351 const gchar *message,
352 gint type);
353gint syl_plugin_alertpanel_message_with_disable (const gchar *title,
354 const gchar *message,
355 gint type);
356
357/* Send message */
358gint syl_plugin_send_message (const gchar *file,
359 PrefsAccount *ac,
360 GSList *to_list);
361gint syl_plugin_send_message_queue_all (FolderItem *queue,
362 gboolean save_msgs,
363 gboolean filter_msgs);
364gint syl_plugin_send_message_set_reply_flag (const gchar *reply_target,
365 const gchar *msgid);
366gint syl_plugin_send_message_set_forward_flags (const gchar *forward_targets);
367
368/* Notification window */
369gint syl_plugin_notification_window_open (const gchar *message,
370 const gchar *submessage,
371 guint timeout);
372void syl_plugin_notification_window_set_message (const gchar *message,
373 const gchar *submessage);
374void syl_plugin_notification_window_close (void);
375
376#endif /* __PLUGIN_H__ */