Statistics
| Revision:

root / src / plugin.h @ 3217

History | View | Annotate | Download (11.1 KB)

1
/*
2
 * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3
 * Copyright (C) 1999-2013 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

    
32
/* SylPlugin object */
33

    
34
#define SYL_TYPE_PLUGIN                (syl_plugin_get_type())
35
#define SYL_PLUGIN(obj)                (G_TYPE_CHECK_INSTANCE_CAST((obj), SYL_TYPE_PLUGIN, SylPlugin))
36
#define SYL_IS_PLUGIN(obj)        (G_TYPE_CHECK_INSTANCE_CAST((obj), SYL_TYPE_PLUGIN))
37
#define SYL_PLUGIN_CLASS(klass)        (G_TYPE_CHECK_CLASS_CAST((klass), SYL_TYPE_PLUGIN, SylPluginClass))
38
#define SYL_IS_PLUGIN_CLASS(klass)        (G_TYPE_CHECK_CLASS_TYPE((klass), SYL_TYPE_PLUGIN))
39
#define SYL_PLUGIN_GET_CLASS(obj)        (G_TYPE_INSTANCE_GET_CLASS((obj), SYL_TYPE_PLUGIN, SylPluginClass))
40

    
41
typedef struct _SylPlugin        SylPlugin;
42
typedef struct _SylPluginClass        SylPluginClass;
43
typedef struct _SylPluginInfo        SylPluginInfo;
44

    
45
typedef void (*SylPluginLoadFunc)        (void);
46
typedef void (*SylPluginUnloadFunc)        (void);
47
typedef void (*SylPluginCallbackFunc)        (void);
48

    
49
#define SYL_PLUGIN_INTERFACE_VERSION        0x0109
50

    
51
struct _SylPlugin
52
{
53
        GObject parent_instance;
54
};
55

    
56
struct _SylPluginClass
57
{
58
        GObjectClass parent_class;
59

    
60
        void (* plugin_load)        (GObject *obj, GModule *module);
61
        void (* plugin_unload)        (GObject *obj, GModule *module);
62

    
63
        void (* folderview_menu_popup)        (GObject *obj, gpointer ifactory);
64
        void (* summaryview_menu_popup)        (GObject *obj, gpointer ifactory);
65

    
66
        void (* compose_created)        (GObject *obj, gpointer compose);
67
        void (* compose_destroy)        (GObject *obj, gpointer compose);
68

    
69
        void (* textview_menu_popup)        (GObject        *obj,
70
                                         GtkMenu        *menu,
71
                                         GtkTextView        *textview,
72
                                         const gchar        *uri,
73
                                         const gchar        *selected_text,
74
                                         MsgInfo        *msginfo);
75

    
76
        gboolean (* compose_send)        (GObject        *obj,
77
                                         gpointer         compose,
78
                                         gint                 compose_mode,
79
                                         gint                 send_mode,
80
                                         const gchar        *msg_file,
81
                                         GSList                *to_list);
82

    
83
        void (* messageview_show)        (GObject        *obj,
84
                                         gpointer         msgview,
85
                                         MsgInfo        *msginfo,
86
                                         gboolean         all_headers);
87

    
88
        void (* inc_mail_start)                (GObject        *obj,
89
                                         PrefsAccount        *account);
90
        void (* inc_mail_finished)        (GObject        *obj,
91
                                         gint                 new_messages);
92

    
93
        /* Prefs dialogs */
94
        void (* prefs_common_open)        (GObject        *obj,
95
                                         GtkWidget        *window);
96
        void (* prefs_account_open)        (GObject        *obj,
97
                                         PrefsAccount        *account,
98
                                         GtkWidget        *window);
99
        void (* prefs_filter_open)        (GObject        *obj,
100
                                         GtkWidget        *window);
101
        void (* prefs_filter_edit_open)        (GObject        *obj,
102
                                         FilterRule        *rule,
103
                                         const gchar        *header,
104
                                         const gchar        *key,
105
                                         GtkWidget        *window);
106
        void (* prefs_template_open)        (GObject        *obj,
107
                                         GtkWidget        *window);
108
        void (* plugin_manager_open)        (GObject        *obj,
109
                                         GtkWidget        *window);
110
};
111

    
112
struct _SylPluginInfo
113
{
114
        gchar *name;
115
        gchar *version;
116
        gchar *author;
117
        gchar *description;
118

    
119
        gpointer pad1;
120
        gpointer pad2;
121
        gpointer pad3;
122
        gpointer pad4;
123
};
124

    
125
GType syl_plugin_get_type        (void);
126

    
127
void syl_plugin_signal_connect                (const gchar *name, GCallback callback,
128
                                         gpointer data);
129
void syl_plugin_signal_disconnect        (gpointer func, gpointer data);
130
void syl_plugin_signal_emit                (const gchar *name, ...);
131

    
132
/* Used by Sylpheed */
133

    
134
gint syl_plugin_init_lib        (void);
135

    
136
gint syl_plugin_load                (const gchar *file);
137
gint syl_plugin_load_all        (const gchar *dir);
138
void syl_plugin_unload_all        (void);
139

    
140
GSList *syl_plugin_get_module_list        (void);
141
SylPluginInfo *syl_plugin_get_info        (GModule *module);
142
gboolean syl_plugin_check_version        (GModule *module);
143

    
144
gint syl_plugin_add_symbol                (const gchar *name, gpointer sym);
145
gpointer syl_plugin_lookup_symbol        (const gchar *name);
146

    
147
/* Interfaces which should be implemented by plug-ins
148
     void plugin_load(void);
149
     void plugin_unload(void);
150
     SylPluginInfo *plugin_info(void);
151
     gint plugin_interface_version(void);
152
 */
153

    
154
/* Plug-in API (used by plug-ins) */
155

    
156
const gchar *syl_plugin_get_prog_version        (void);
157

    
158
void syl_plugin_main_window_lock                (void);
159
void syl_plugin_main_window_unlock                (void);
160
gpointer syl_plugin_main_window_get                (void);
161
void syl_plugin_main_window_popup                (gpointer mainwin);
162
GtkWidget *syl_plugin_main_window_get_statusbar        (void);
163

    
164
void syl_plugin_app_will_exit                        (gboolean force);
165

    
166
/* Menu */
167
gint syl_plugin_add_menuitem                        (const gchar *parent,
168
                                                 const gchar *label,
169
                                                 SylPluginCallbackFunc func,
170
                                                 gpointer data);
171
gint syl_plugin_add_factory_item                (const gchar *menu,
172
                                                 const gchar *label,
173
                                                 SylPluginCallbackFunc func,
174
                                                 gpointer data);
175

    
176
void syl_plugin_menu_set_sensitive                (const gchar        *path,
177
                                                 gboolean         sensitive);
178
void syl_plugin_menu_set_sensitive_all                (GtkMenuShell        *menu_shell,
179
                                                 gboolean         sensitive);
180
void syl_plugin_menu_set_active                        (const gchar        *path,
181
                                                 gboolean         is_active);
182

    
183

    
184
/* FolderView */
185
gpointer syl_plugin_folderview_get                (void);
186

    
187
void syl_plugin_folderview_add_sub_widget        (GtkWidget        *widget);
188

    
189
void syl_plugin_folderview_select                (FolderItem        *item);
190
void syl_plugin_folderview_unselect                (void);
191
void syl_plugin_folderview_select_next_unread        (void);
192
FolderItem *syl_plugin_folderview_get_selected_item
193
                                                (void);
194

    
195
gint syl_plugin_folderview_check_new                (Folder         *folder);
196
gint syl_plugin_folderview_check_new_item        (FolderItem     *item);
197
gint syl_plugin_folderview_check_new_all        (void);
198

    
199
void syl_plugin_folderview_update_item                (FolderItem        *item,
200
                                                 gboolean         update_summary);
201
void syl_plugin_folderview_update_item_foreach        (GHashTable        *table,
202
                                                 gboolean         update_summary);
203
void syl_plugin_folderview_update_all_updated        (gboolean         update_summary);
204
void syl_plugin_folderview_check_new_selected        (void);
205

    
206
/* SummaryView */
207
gpointer syl_plugin_summary_view_get                (void);
208
void syl_plugin_summary_select_by_msgnum        (guint msgnum);
209
gboolean syl_plugin_summary_select_by_msginfo        (MsgInfo *msginfo);
210

    
211
void syl_plugin_open_message                        (const gchar *folder_id,
212
                                                 guint msgnum);
213

    
214
void syl_plugin_summary_show_queued_msgs        (void);
215

    
216
void syl_plugin_summary_lock                        (void);
217
void syl_plugin_summary_unlock                        (void);
218
gboolean syl_plugin_summary_is_locked                (void);
219
gboolean syl_plugin_summary_is_read_locked        (void);
220
void syl_plugin_summary_write_lock                (void);
221
void syl_plugin_summary_write_unlock                (void);
222
gboolean syl_plugin_summary_is_write_locked        (void);
223

    
224
FolderItem *syl_plugin_summary_get_current_folder
225
                                                (void);
226

    
227
gint syl_plugin_summary_get_selection_type        (void);
228
GSList *syl_plugin_summary_get_selected_msg_list(void);
229
GSList *syl_plugin_summary_get_msg_list                (void);
230

    
231
void syl_plugin_summary_redisplay_msg                (void);
232
void syl_plugin_summary_open_msg                (void);
233
void syl_plugin_summary_view_source                (void);
234
void syl_plugin_summary_reedit                        (void);
235

    
236
void syl_plugin_summary_update_selected_rows        (void);
237
void syl_plugin_summary_update_by_msgnum        (guint msgnum);
238

    
239
/* MessageView */
240
gpointer syl_plugin_messageview_create_with_new_window
241
                                                (void);
242
void syl_plugin_open_message_by_new_window        (MsgInfo *msginfo);
243

    
244
/* Compose */
245
gpointer syl_plugin_compose_new                        (PrefsAccount *account,
246
                                                 FolderItem *item,
247
                                                 const gchar *mailto,
248
                                                 GPtrArray *attach_files);
249

    
250
/* entry type:
251
   0: To 1: Cc 2: Bcc 3: Reply-To 4: Subject 5: Newsgroups 6: Followup-To */
252
void syl_plugin_compose_entry_set                (gpointer compose,
253
                                                 const gchar *text,
254
                                                 gint type);
255
void syl_plugin_compose_entry_append                (gpointer compose,
256
                                                 const gchar *text,
257
                                                 gint type);
258
gchar *syl_plugin_compose_entry_get_text        (gpointer compose,
259
                                                 gint type);
260
void syl_plugin_compose_lock                        (gpointer compose);
261
void syl_plugin_compose_unlock                        (gpointer compose);
262

    
263
/* Others */
264
FolderItem *syl_plugin_folder_sel                (Folder *cur_folder,
265
                                                 gint sel_type,
266
                                                 const gchar *default_folder);
267
FolderItem *syl_plugin_folder_sel_full                (Folder *cur_folder,
268
                                                 gint sel_type,
269
                                                 const gchar *default_folder,
270
                                                 const gchar *message);
271

    
272
gchar *syl_plugin_input_dialog                        (const gchar *title,
273
                                                 const gchar *message,
274
                                                 const gchar *default_string);
275
gchar *syl_plugin_input_dialog_with_invisible        (const gchar *title,
276
                                                 const gchar *message,
277
                                                 const gchar *default_string);
278

    
279
void syl_plugin_manage_window_set_transient        (GtkWindow *window);
280
void syl_plugin_manage_window_signals_connect        (GtkWindow *window);
281
GtkWidget *syl_plugin_manage_window_get_focus_window
282
                                                (void);
283

    
284
void syl_plugin_inc_mail                        (void);
285
gboolean syl_plugin_inc_is_active                (void);
286
void syl_plugin_inc_lock                        (void);
287
void syl_plugin_inc_unlock                        (void);
288

    
289
void syl_plugin_update_check                        (gboolean show_dialog_always);
290
void syl_plugin_update_check_set_check_url                (const gchar *url);
291
const gchar *syl_plugin_update_check_get_check_url        (void);
292
void syl_plugin_update_check_set_download_url                (const gchar *url);
293
const gchar *syl_plugin_update_check_get_download_url        (void);
294
void syl_plugin_update_check_set_jump_url                (const gchar *url);
295
const gchar *syl_plugin_update_check_get_jump_url        (void);
296
void syl_plugin_update_check_set_check_plugin_url        (const gchar *url);
297
const gchar *syl_plugin_update_check_get_check_plugin_url(void);
298
void syl_plugin_update_check_set_jump_plugin_url        (const gchar *url);
299
const gchar *syl_plugin_update_check_get_jump_plugin_url(void);
300

    
301
/* type corresponds to AlertType
302
 * default_value and return value corresponds to AlertValue */
303
gint syl_plugin_alertpanel_full                        (const gchar *title,
304
                                                 const gchar *message,
305
                                                 gint type,
306
                                                 gint default_value,
307
                                                 gboolean can_disable,
308
                                                 const gchar *btn1_label,
309
                                                 const gchar *btn2_label,
310
                                                 const gchar *btn3_label);
311
gint syl_plugin_alertpanel                        (const gchar *title,
312
                                                 const gchar *message,
313
                                                 const gchar *btn1_label,
314
                                                 const gchar *btn2_label,
315
                                                 const gchar *btn3_label);
316
void syl_plugin_alertpanel_message                (const gchar *title,
317
                                                 const gchar *message,
318
                                                 gint type);
319
gint syl_plugin_alertpanel_message_with_disable        (const gchar *title,
320
                                                 const gchar *message,
321
                                                 gint type);
322

    
323
/* Send message */
324
gint syl_plugin_send_message                        (const gchar        *file,
325
                                                 PrefsAccount        *ac,
326
                                                 GSList                *to_list);
327
gint syl_plugin_send_message_queue_all                (FolderItem        *queue,
328
                                                 gboolean         save_msgs,
329
                                                 gboolean         filter_msgs);
330
gint syl_plugin_send_message_set_reply_flag        (const gchar        *reply_target,
331
                                                 const gchar        *msgid);
332
gint syl_plugin_send_message_set_forward_flags        (const gchar        *forward_targets);
333

    
334
/* Notification window */
335
gint syl_plugin_notification_window_open        (const gchar        *message,
336
                                                 const gchar        *submessage,
337
                                                 guint                 timeout);
338
void syl_plugin_notification_window_set_message        (const gchar        *message,
339
                                                 const gchar        *submessage);
340
void syl_plugin_notification_window_close        (void);
341

    
342
#endif /* __PLUGIN_H__ */