root / src / plugin.h @ 2821
History | View | Annotate | Download (9.8 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 0x0107 |
| 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 | |
| 76 | struct _SylPluginInfo
|
| 77 | {
|
| 78 | gchar *name; |
| 79 | gchar *version; |
| 80 | gchar *author; |
| 81 | gchar *description; |
| 82 | |
| 83 | gpointer pad1; |
| 84 | gpointer pad2; |
| 85 | gpointer pad3; |
| 86 | gpointer pad4; |
| 87 | }; |
| 88 | |
| 89 | GType syl_plugin_get_type (void);
|
| 90 | |
| 91 | void syl_plugin_signal_connect (const gchar *name, GCallback callback, |
| 92 | gpointer data); |
| 93 | void syl_plugin_signal_disconnect (gpointer func, gpointer data);
|
| 94 | void syl_plugin_signal_emit (const gchar *name, ...); |
| 95 | |
| 96 | /* Used by Sylpheed */
|
| 97 | |
| 98 | gint syl_plugin_init_lib (void);
|
| 99 | |
| 100 | gint syl_plugin_load (const gchar *file);
|
| 101 | gint syl_plugin_load_all (const gchar *dir);
|
| 102 | void syl_plugin_unload_all (void); |
| 103 | |
| 104 | GSList *syl_plugin_get_module_list (void);
|
| 105 | SylPluginInfo *syl_plugin_get_info (GModule *module); |
| 106 | gboolean syl_plugin_check_version (GModule *module); |
| 107 | |
| 108 | gint syl_plugin_add_symbol (const gchar *name, gpointer sym);
|
| 109 | gpointer syl_plugin_lookup_symbol (const gchar *name);
|
| 110 | |
| 111 | /* Interfaces which should be implemented by plug-ins
|
| 112 | void plugin_load(void); |
| 113 | void plugin_unload(void); |
| 114 | SylPluginInfo *plugin_info(void); |
| 115 | gint plugin_interface_version(void); |
| 116 | */ |
| 117 | |
| 118 | /* Plug-in API (used by plug-ins) */
|
| 119 | |
| 120 | const gchar *syl_plugin_get_prog_version (void); |
| 121 | |
| 122 | void syl_plugin_main_window_lock (void); |
| 123 | void syl_plugin_main_window_unlock (void); |
| 124 | gpointer syl_plugin_main_window_get (void);
|
| 125 | void syl_plugin_main_window_popup (gpointer mainwin);
|
| 126 | GtkWidget *syl_plugin_main_window_get_statusbar (void);
|
| 127 | |
| 128 | void syl_plugin_app_will_exit (gboolean force);
|
| 129 | |
| 130 | /* Menu */
|
| 131 | gint syl_plugin_add_menuitem (const gchar *parent,
|
| 132 | const gchar *label,
|
| 133 | SylPluginCallbackFunc func, |
| 134 | gpointer data); |
| 135 | gint syl_plugin_add_factory_item (const gchar *menu,
|
| 136 | const gchar *label,
|
| 137 | SylPluginCallbackFunc func, |
| 138 | gpointer data); |
| 139 | |
| 140 | void syl_plugin_menu_set_sensitive (const gchar *path, |
| 141 | gboolean sensitive); |
| 142 | void syl_plugin_menu_set_sensitive_all (GtkMenuShell *menu_shell,
|
| 143 | gboolean sensitive); |
| 144 | void syl_plugin_menu_set_active (const gchar *path, |
| 145 | gboolean is_active); |
| 146 | |
| 147 | |
| 148 | /* FolderView */
|
| 149 | gpointer syl_plugin_folderview_get (void);
|
| 150 | |
| 151 | void syl_plugin_folderview_add_sub_widget (GtkWidget *widget);
|
| 152 | |
| 153 | void syl_plugin_folderview_select (FolderItem *item);
|
| 154 | void syl_plugin_folderview_unselect (void); |
| 155 | void syl_plugin_folderview_select_next_unread (void); |
| 156 | FolderItem *syl_plugin_folderview_get_selected_item |
| 157 | (void);
|
| 158 | |
| 159 | gint syl_plugin_folderview_check_new (Folder *folder); |
| 160 | gint syl_plugin_folderview_check_new_item (FolderItem *item); |
| 161 | gint syl_plugin_folderview_check_new_all (void);
|
| 162 | |
| 163 | void syl_plugin_folderview_update_item (FolderItem *item,
|
| 164 | gboolean update_summary); |
| 165 | void syl_plugin_folderview_update_item_foreach (GHashTable *table,
|
| 166 | gboolean update_summary); |
| 167 | void syl_plugin_folderview_update_all_updated (gboolean update_summary);
|
| 168 | void syl_plugin_folderview_check_new_selected (void); |
| 169 | |
| 170 | /* SummaryView */
|
| 171 | gpointer syl_plugin_summary_view_get (void);
|
| 172 | void syl_plugin_summary_select_by_msgnum (guint msgnum);
|
| 173 | gboolean syl_plugin_summary_select_by_msginfo (MsgInfo *msginfo); |
| 174 | |
| 175 | void syl_plugin_open_message (const gchar *folder_id, |
| 176 | guint msgnum); |
| 177 | |
| 178 | void syl_plugin_summary_show_queued_msgs (void); |
| 179 | |
| 180 | void syl_plugin_summary_lock (void); |
| 181 | void syl_plugin_summary_unlock (void); |
| 182 | gboolean syl_plugin_summary_is_locked (void);
|
| 183 | gboolean syl_plugin_summary_is_read_locked (void);
|
| 184 | void syl_plugin_summary_write_lock (void); |
| 185 | void syl_plugin_summary_write_unlock (void); |
| 186 | gboolean syl_plugin_summary_is_write_locked (void);
|
| 187 | |
| 188 | FolderItem *syl_plugin_summary_get_current_folder |
| 189 | (void);
|
| 190 | |
| 191 | gint syl_plugin_summary_get_selection_type (void);
|
| 192 | GSList *syl_plugin_summary_get_selected_msg_list(void);
|
| 193 | GSList *syl_plugin_summary_get_msg_list (void);
|
| 194 | |
| 195 | void syl_plugin_summary_redisplay_msg (void); |
| 196 | void syl_plugin_summary_open_msg (void); |
| 197 | void syl_plugin_summary_view_source (void); |
| 198 | void syl_plugin_summary_reedit (void); |
| 199 | |
| 200 | void syl_plugin_summary_update_selected_rows (void); |
| 201 | void syl_plugin_summary_update_by_msgnum (guint msgnum);
|
| 202 | |
| 203 | /* MessageView */
|
| 204 | gpointer syl_plugin_messageview_create_with_new_window |
| 205 | (void);
|
| 206 | void syl_plugin_open_message_by_new_window (MsgInfo *msginfo);
|
| 207 | |
| 208 | /* Compose */
|
| 209 | gpointer syl_plugin_compose_new (PrefsAccount *account, |
| 210 | FolderItem *item, |
| 211 | const gchar *mailto,
|
| 212 | GPtrArray *attach_files); |
| 213 | |
| 214 | /* entry type:
|
| 215 | 0: To 1: Cc 2: Bcc 3: Reply-To 4: Subject 5: Newsgroups 6: Followup-To */ |
| 216 | void syl_plugin_compose_entry_set (gpointer compose,
|
| 217 | const gchar *text,
|
| 218 | gint type); |
| 219 | void syl_plugin_compose_entry_append (gpointer compose,
|
| 220 | const gchar *text,
|
| 221 | gint type); |
| 222 | gchar *syl_plugin_compose_entry_get_text (gpointer compose, |
| 223 | gint type); |
| 224 | void syl_plugin_compose_lock (gpointer compose);
|
| 225 | void syl_plugin_compose_unlock (gpointer compose);
|
| 226 | |
| 227 | /* Others */
|
| 228 | FolderItem *syl_plugin_folder_sel (Folder *cur_folder, |
| 229 | gint sel_type, |
| 230 | const gchar *default_folder);
|
| 231 | FolderItem *syl_plugin_folder_sel_full (Folder *cur_folder, |
| 232 | gint sel_type, |
| 233 | const gchar *default_folder,
|
| 234 | const gchar *message);
|
| 235 | |
| 236 | gchar *syl_plugin_input_dialog (const gchar *title,
|
| 237 | const gchar *message,
|
| 238 | const gchar *default_string);
|
| 239 | gchar *syl_plugin_input_dialog_with_invisible (const gchar *title,
|
| 240 | const gchar *message,
|
| 241 | const gchar *default_string);
|
| 242 | |
| 243 | void syl_plugin_manage_window_set_transient (GtkWindow *window);
|
| 244 | void syl_plugin_manage_window_signals_connect (GtkWindow *window);
|
| 245 | GtkWidget *syl_plugin_manage_window_get_focus_window |
| 246 | (void);
|
| 247 | |
| 248 | void syl_plugin_inc_mail (void); |
| 249 | gboolean syl_plugin_inc_is_active (void);
|
| 250 | void syl_plugin_inc_lock (void); |
| 251 | void syl_plugin_inc_unlock (void); |
| 252 | |
| 253 | void syl_plugin_update_check (gboolean show_dialog_always);
|
| 254 | void syl_plugin_update_check_set_check_url (const gchar *url); |
| 255 | const gchar *syl_plugin_update_check_get_check_url (void); |
| 256 | void syl_plugin_update_check_set_download_url (const gchar *url); |
| 257 | const gchar *syl_plugin_update_check_get_download_url (void); |
| 258 | void syl_plugin_update_check_set_jump_url (const gchar *url); |
| 259 | const gchar *syl_plugin_update_check_get_jump_url (void); |
| 260 | void syl_plugin_update_check_set_check_plugin_url (const gchar *url); |
| 261 | const gchar *syl_plugin_update_check_get_check_plugin_url(void); |
| 262 | void syl_plugin_update_check_set_jump_plugin_url (const gchar *url); |
| 263 | const gchar *syl_plugin_update_check_get_jump_plugin_url(void); |
| 264 | |
| 265 | /* type corresponds to AlertType
|
| 266 | * default_value and return value corresponds to AlertValue */ |
| 267 | gint syl_plugin_alertpanel_full (const gchar *title,
|
| 268 | const gchar *message,
|
| 269 | gint type, |
| 270 | gint default_value, |
| 271 | gboolean can_disable, |
| 272 | const gchar *btn1_label,
|
| 273 | const gchar *btn2_label,
|
| 274 | const gchar *btn3_label);
|
| 275 | gint syl_plugin_alertpanel (const gchar *title,
|
| 276 | const gchar *message,
|
| 277 | const gchar *btn1_label,
|
| 278 | const gchar *btn2_label,
|
| 279 | const gchar *btn3_label);
|
| 280 | void syl_plugin_alertpanel_message (const gchar *title, |
| 281 | const gchar *message,
|
| 282 | gint type); |
| 283 | gint syl_plugin_alertpanel_message_with_disable (const gchar *title,
|
| 284 | const gchar *message,
|
| 285 | gint type); |
| 286 | |
| 287 | /* Send message */
|
| 288 | gint syl_plugin_send_message (const gchar *file,
|
| 289 | PrefsAccount *ac, |
| 290 | GSList *to_list); |
| 291 | gint syl_plugin_send_message_queue_all (FolderItem *queue, |
| 292 | gboolean save_msgs, |
| 293 | gboolean filter_msgs); |
| 294 | gint syl_plugin_send_message_set_reply_flag (const gchar *reply_target,
|
| 295 | const gchar *msgid);
|
| 296 | gint syl_plugin_send_message_set_forward_flags (const gchar *forward_targets);
|
| 297 | |
| 298 | #endif /* __PLUGIN_H__ */ |