aboutsummaryrefslogtreecommitdiff
path: root/src/plugin.h
blob: 70da79f8f3f26d375d291d78f5a7e066b4729cd3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
/*
 * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
 * Copyright (C) 1999-2010 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
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */

#ifndef __PLUGIN_H__
#define __PLUGIN_H__

#include <glib.h>
#include <glib-object.h>
#include <gmodule.h>
#include <gtk/gtk.h>

#include "procmsg.h"
#include "folder.h"

/* SylPlugin object */

#define SYL_TYPE_PLUGIN		(syl_plugin_get_type())
#define SYL_PLUGIN(obj)		(G_TYPE_CHECK_INSTANCE_CAST((obj), SYL_TYPE_PLUGIN, SylPlugin))
#define SYL_IS_PLUGIN(obj)	(G_TYPE_CHECK_INSTANCE_CAST((obj), SYL_TYPE_PLUGIN))
#define SYL_PLUGIN_CLASS(klass)	(G_TYPE_CHECK_CLASS_CAST((klass), SYL_TYPE_PLUGIN, SylPluginClass))
#define SYL_IS_PLUGIN_CLASS(klass)	(G_TYPE_CHECK_CLASS_TYPE((klass), SYL_TYPE_PLUGIN))
#define SYL_PLUGIN_GET_CLASS(obj)	(G_TYPE_INSTANCE_GET_CLASS((obj), SYL_TYPE_PLUGIN, SylPluginClass))

typedef struct _SylPlugin	SylPlugin;
typedef struct _SylPluginClass	SylPluginClass;
typedef struct _SylPluginInfo	SylPluginInfo;

typedef void (*SylPluginLoadFunc)	(void);
typedef void (*SylPluginUnloadFunc)	(void);
typedef void (*SylPluginCallbackFunc)	(void);

#define SYL_PLUGIN_INTERFACE_VERSION	0x0105

struct _SylPlugin
{
	GObject parent_instance;
};

struct _SylPluginClass
{
	GObjectClass parent_class;

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

	void (* folderview_menu_popup)	(GObject *obj, gpointer ifactory);

	void (* compose_created)	(GObject *obj, gpointer compose);
	void (* compose_destroy)	(GObject *obj, gpointer compose);
};

struct _SylPluginInfo
{
	gchar *name;
	gchar *version;
	gchar *author;
	gchar *description;

	gpointer pad1;
	gpointer pad2;
	gpointer pad3;
	gpointer pad4;
};

GType syl_plugin_get_type	(void);

void syl_plugin_signal_connect		(const gchar *name, GCallback callback,
					 gpointer data);
void syl_plugin_signal_disconnect	(gpointer func, gpointer data);
void syl_plugin_signal_emit		(const gchar *name, ...);

/* Used by Sylpheed */

gint syl_plugin_init_lib	(void);

gint syl_plugin_load		(const gchar *file);
gint syl_plugin_load_all	(const gchar *dir);
void syl_plugin_unload_all	(void);

GSList *syl_plugin_get_module_list	(void);
SylPluginInfo *syl_plugin_get_info	(GModule *module);
gboolean syl_plugin_check_version	(GModule *module);

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

/* Interfaces which should be implemented by plug-ins
     void plugin_load(void);
     void plugin_unload(void);
     SylPluginInfo *plugin_info(void);
     gint plugin_interface_version(void);
 */

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

const gchar *syl_plugin_get_prog_version	(void);

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_statusbar	(void);

void syl_plugin_app_will_exit			(gboolean force);

/* Menu */
gint syl_plugin_add_menuitem			(const gchar *parent,
						 const gchar *label,
						 SylPluginCallbackFunc func,
						 gpointer data);
gint syl_plugin_add_factory_item		(const gchar *menu,
						 const gchar *label,
						 SylPluginCallbackFunc func,
						 gpointer data);

void syl_plugin_menu_set_sensitive		(const gchar	*path,
						 gboolean	 sensitive);
void syl_plugin_menu_set_sensitive_all		(GtkMenuShell	*menu_shell,
						 gboolean	 sensitive);
void syl_plugin_menu_set_active			(const gchar	*path,
						 gboolean	 is_active);


/* FolderView */
gpointer syl_plugin_folderview_get		(void);
FolderItem *syl_plugin_folderview_get_selected_item
						(void);

gint syl_plugin_folderview_check_new		(Folder         *folder);
gint syl_plugin_folderview_check_new_item	(FolderItem     *item);
gint syl_plugin_folderview_check_new_all	(void);

void syl_plugin_folderview_update_item		(FolderItem	*item,
						 gboolean	 update_summary);
void syl_plugin_folderview_update_item_foreach	(GHashTable	*table,
						 gboolean	 update_summary);
void syl_plugin_folderview_update_all_updated	(gboolean	 update_summary);

/* SummaryView */
gpointer syl_plugin_summary_view_get		(void);
void syl_plugin_sumary_select_by_msgnum		(guint msgnum);
gboolean syl_plugin_summary_select_by_msginfo	(MsgInfo *msginfo);

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

void syl_plugin_summary_lock			(void);
void syl_plugin_summary_unlock			(void);
gboolean syl_plugin_summary_is_locked		(void);

/* MessageView */
gpointer syl_plugin_messageview_create_with_new_window
						(void);
void syl_plugin_open_message_by_new_window	(MsgInfo *msginfo);

/* Compose */
gpointer syl_plugin_compose_new			(PrefsAccount *account,
						 FolderItem *item,
						 const gchar *mailto,
						 GPtrArray *attach_files);

/* entry type:
   0: To 1: Cc 2: Bcc 3: Reply-To 4: Subject 5: Newsgroups 6: Followup-To */
void syl_plugin_compose_entry_set		(gpointer compose,
						 const gchar *text,
						 gint type);
void syl_plugin_compose_entry_append		(gpointer compose,
						 const gchar *text,
						 gint type);
gchar *syl_plugin_compose_entry_get_text	(gpointer compose,
						 gint type);
void syl_plugin_compose_lock			(gpointer compose);
void syl_plugin_compose_unlock			(gpointer compose);

/* Others */
FolderItem *syl_plugin_folder_sel		(Folder *cur_folder,
						 gint sel_type,
						 const gchar *default_folder);
FolderItem *syl_plugin_folder_sel_full		(Folder *cur_folder,
						 gint sel_type,
						 const gchar *default_folder,
						 const gchar *message);

gchar *syl_plugin_input_dialog			(const gchar *title,
						 const gchar *message,
						 const gchar *default_string);
gchar *syl_plugin_input_dialog_with_invisible	(const gchar *title,
						 const gchar *message,
						 const gchar *default_string);

void syl_plugin_manage_window_set_transient	(GtkWindow *window);
void syl_plugin_manage_window_signals_connect	(GtkWindow *window);
GtkWidget *syl_plugin_manage_window_get_focus_window
						(void);

void syl_plugin_inc_mail			(void);
gboolean syl_plugin_inc_is_active		(void);
void syl_plugin_inc_lock			(void);
void syl_plugin_inc_unlock			(void);

void syl_plugin_update_check			(gboolean show_dialog_always);
void syl_plugin_update_check_set_check_url		(const gchar *url);
const gchar *syl_plugin_update_check_get_check_url	(void);
void syl_plugin_update_check_set_jump_url		(const gchar *url);
const gchar *syl_plugin_update_check_get_jump_url	(void);

#endif /* __PLUGIN_H__ */