Statistics
| Revision:

root / src / plugin.h @ 2886

History | View | Annotate | Download (10 KB)

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

    
31
/* SylPlugin object */
32

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

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

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

    
48
#define SYL_PLUGIN_INTERFACE_VERSION        0x0108
49

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

    
55
struct _SylPluginClass
56
{
57
        GObjectClass parent_class;
58

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

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

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

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

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

    
83
struct _SylPluginInfo
84
{
85
        gchar *name;
86
        gchar *version;
87
        gchar *author;
88
        gchar *description;
89

    
90
        gpointer pad1;
91
        gpointer pad2;
92
        gpointer pad3;
93
        gpointer pad4;
94
};
95

    
96
GType syl_plugin_get_type        (void);
97

    
98
void syl_plugin_signal_connect                (const gchar *name, GCallback callback,
99
                                         gpointer data);
100
void syl_plugin_signal_disconnect        (gpointer func, gpointer data);
101
void syl_plugin_signal_emit                (const gchar *name, ...);
102

    
103
/* Used by Sylpheed */
104

    
105
gint syl_plugin_init_lib        (void);
106

    
107
gint syl_plugin_load                (const gchar *file);
108
gint syl_plugin_load_all        (const gchar *dir);
109
void syl_plugin_unload_all        (void);
110

    
111
GSList *syl_plugin_get_module_list        (void);
112
SylPluginInfo *syl_plugin_get_info        (GModule *module);
113
gboolean syl_plugin_check_version        (GModule *module);
114

    
115
gint syl_plugin_add_symbol                (const gchar *name, gpointer sym);
116
gpointer syl_plugin_lookup_symbol        (const gchar *name);
117

    
118
/* Interfaces which should be implemented by plug-ins
119
     void plugin_load(void);
120
     void plugin_unload(void);
121
     SylPluginInfo *plugin_info(void);
122
     gint plugin_interface_version(void);
123
 */
124

    
125
/* Plug-in API (used by plug-ins) */
126

    
127
const gchar *syl_plugin_get_prog_version        (void);
128

    
129
void syl_plugin_main_window_lock                (void);
130
void syl_plugin_main_window_unlock                (void);
131
gpointer syl_plugin_main_window_get                (void);
132
void syl_plugin_main_window_popup                (gpointer mainwin);
133
GtkWidget *syl_plugin_main_window_get_statusbar        (void);
134

    
135
void syl_plugin_app_will_exit                        (gboolean force);
136

    
137
/* Menu */
138
gint syl_plugin_add_menuitem                        (const gchar *parent,
139
                                                 const gchar *label,
140
                                                 SylPluginCallbackFunc func,
141
                                                 gpointer data);
142
gint syl_plugin_add_factory_item                (const gchar *menu,
143
                                                 const gchar *label,
144
                                                 SylPluginCallbackFunc func,
145
                                                 gpointer data);
146

    
147
void syl_plugin_menu_set_sensitive                (const gchar        *path,
148
                                                 gboolean         sensitive);
149
void syl_plugin_menu_set_sensitive_all                (GtkMenuShell        *menu_shell,
150
                                                 gboolean         sensitive);
151
void syl_plugin_menu_set_active                        (const gchar        *path,
152
                                                 gboolean         is_active);
153

    
154

    
155
/* FolderView */
156
gpointer syl_plugin_folderview_get                (void);
157

    
158
void syl_plugin_folderview_add_sub_widget        (GtkWidget        *widget);
159

    
160
void syl_plugin_folderview_select                (FolderItem        *item);
161
void syl_plugin_folderview_unselect                (void);
162
void syl_plugin_folderview_select_next_unread        (void);
163
FolderItem *syl_plugin_folderview_get_selected_item
164
                                                (void);
165

    
166
gint syl_plugin_folderview_check_new                (Folder         *folder);
167
gint syl_plugin_folderview_check_new_item        (FolderItem     *item);
168
gint syl_plugin_folderview_check_new_all        (void);
169

    
170
void syl_plugin_folderview_update_item                (FolderItem        *item,
171
                                                 gboolean         update_summary);
172
void syl_plugin_folderview_update_item_foreach        (GHashTable        *table,
173
                                                 gboolean         update_summary);
174
void syl_plugin_folderview_update_all_updated        (gboolean         update_summary);
175
void syl_plugin_folderview_check_new_selected        (void);
176

    
177
/* SummaryView */
178
gpointer syl_plugin_summary_view_get                (void);
179
void syl_plugin_summary_select_by_msgnum        (guint msgnum);
180
gboolean syl_plugin_summary_select_by_msginfo        (MsgInfo *msginfo);
181

    
182
void syl_plugin_open_message                        (const gchar *folder_id,
183
                                                 guint msgnum);
184

    
185
void syl_plugin_summary_show_queued_msgs        (void);
186

    
187
void syl_plugin_summary_lock                        (void);
188
void syl_plugin_summary_unlock                        (void);
189
gboolean syl_plugin_summary_is_locked                (void);
190
gboolean syl_plugin_summary_is_read_locked        (void);
191
void syl_plugin_summary_write_lock                (void);
192
void syl_plugin_summary_write_unlock                (void);
193
gboolean syl_plugin_summary_is_write_locked        (void);
194

    
195
FolderItem *syl_plugin_summary_get_current_folder
196
                                                (void);
197

    
198
gint syl_plugin_summary_get_selection_type        (void);
199
GSList *syl_plugin_summary_get_selected_msg_list(void);
200
GSList *syl_plugin_summary_get_msg_list                (void);
201

    
202
void syl_plugin_summary_redisplay_msg                (void);
203
void syl_plugin_summary_open_msg                (void);
204
void syl_plugin_summary_view_source                (void);
205
void syl_plugin_summary_reedit                        (void);
206

    
207
void syl_plugin_summary_update_selected_rows        (void);
208
void syl_plugin_summary_update_by_msgnum        (guint msgnum);
209

    
210
/* MessageView */
211
gpointer syl_plugin_messageview_create_with_new_window
212
                                                (void);
213
void syl_plugin_open_message_by_new_window        (MsgInfo *msginfo);
214

    
215
/* Compose */
216
gpointer syl_plugin_compose_new                        (PrefsAccount *account,
217
                                                 FolderItem *item,
218
                                                 const gchar *mailto,
219
                                                 GPtrArray *attach_files);
220

    
221
/* entry type:
222
   0: To 1: Cc 2: Bcc 3: Reply-To 4: Subject 5: Newsgroups 6: Followup-To */
223
void syl_plugin_compose_entry_set                (gpointer compose,
224
                                                 const gchar *text,
225
                                                 gint type);
226
void syl_plugin_compose_entry_append                (gpointer compose,
227
                                                 const gchar *text,
228
                                                 gint type);
229
gchar *syl_plugin_compose_entry_get_text        (gpointer compose,
230
                                                 gint type);
231
void syl_plugin_compose_lock                        (gpointer compose);
232
void syl_plugin_compose_unlock                        (gpointer compose);
233

    
234
/* Others */
235
FolderItem *syl_plugin_folder_sel                (Folder *cur_folder,
236
                                                 gint sel_type,
237
                                                 const gchar *default_folder);
238
FolderItem *syl_plugin_folder_sel_full                (Folder *cur_folder,
239
                                                 gint sel_type,
240
                                                 const gchar *default_folder,
241
                                                 const gchar *message);
242

    
243
gchar *syl_plugin_input_dialog                        (const gchar *title,
244
                                                 const gchar *message,
245
                                                 const gchar *default_string);
246
gchar *syl_plugin_input_dialog_with_invisible        (const gchar *title,
247
                                                 const gchar *message,
248
                                                 const gchar *default_string);
249

    
250
void syl_plugin_manage_window_set_transient        (GtkWindow *window);
251
void syl_plugin_manage_window_signals_connect        (GtkWindow *window);
252
GtkWidget *syl_plugin_manage_window_get_focus_window
253
                                                (void);
254

    
255
void syl_plugin_inc_mail                        (void);
256
gboolean syl_plugin_inc_is_active                (void);
257
void syl_plugin_inc_lock                        (void);
258
void syl_plugin_inc_unlock                        (void);
259

    
260
void syl_plugin_update_check                        (gboolean show_dialog_always);
261
void syl_plugin_update_check_set_check_url                (const gchar *url);
262
const gchar *syl_plugin_update_check_get_check_url        (void);
263
void syl_plugin_update_check_set_download_url                (const gchar *url);
264
const gchar *syl_plugin_update_check_get_download_url        (void);
265
void syl_plugin_update_check_set_jump_url                (const gchar *url);
266
const gchar *syl_plugin_update_check_get_jump_url        (void);
267
void syl_plugin_update_check_set_check_plugin_url        (const gchar *url);
268
const gchar *syl_plugin_update_check_get_check_plugin_url(void);
269
void syl_plugin_update_check_set_jump_plugin_url        (const gchar *url);
270
const gchar *syl_plugin_update_check_get_jump_plugin_url(void);
271

    
272
/* type corresponds to AlertType
273
 * default_value and return value corresponds to AlertValue */
274
gint syl_plugin_alertpanel_full                        (const gchar *title,
275
                                                 const gchar *message,
276
                                                 gint type,
277
                                                 gint default_value,
278
                                                 gboolean can_disable,
279
                                                 const gchar *btn1_label,
280
                                                 const gchar *btn2_label,
281
                                                 const gchar *btn3_label);
282
gint syl_plugin_alertpanel                        (const gchar *title,
283
                                                 const gchar *message,
284
                                                 const gchar *btn1_label,
285
                                                 const gchar *btn2_label,
286
                                                 const gchar *btn3_label);
287
void syl_plugin_alertpanel_message                (const gchar *title,
288
                                                 const gchar *message,
289
                                                 gint type);
290
gint syl_plugin_alertpanel_message_with_disable        (const gchar *title,
291
                                                 const gchar *message,
292
                                                 gint type);
293

    
294
/* Send message */
295
gint syl_plugin_send_message                        (const gchar        *file,
296
                                                 PrefsAccount        *ac,
297
                                                 GSList                *to_list);
298
gint syl_plugin_send_message_queue_all                (FolderItem        *queue,
299
                                                 gboolean         save_msgs,
300
                                                 gboolean         filter_msgs);
301
gint syl_plugin_send_message_set_reply_flag        (const gchar        *reply_target,
302
                                                 const gchar        *msgid);
303
gint syl_plugin_send_message_set_forward_flags        (const gchar        *forward_targets);
304

    
305
#endif /* __PLUGIN_H__ */