root / src / plugin.h @ 2164
History | View | Annotate | Download (5.2 kB)
| 1 | /*
|
|---|---|
| 2 | * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client |
| 3 | * Copyright (C) 1999-2009 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 0x0100 |
| 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 | void (* folderview_menu_popup) (GObject *obj, gpointer ifactory);
|
| 62 | }; |
| 63 | |
| 64 | struct _SylPluginInfo
|
| 65 | {
|
| 66 | gchar *name; |
| 67 | gchar *version; |
| 68 | gchar *author; |
| 69 | gchar *description; |
| 70 | |
| 71 | gpointer pad1; |
| 72 | gpointer pad2; |
| 73 | gpointer pad3; |
| 74 | gpointer pad4; |
| 75 | }; |
| 76 | |
| 77 | GType syl_plugin_get_type (void);
|
| 78 | |
| 79 | void syl_plugin_signal_connect (const gchar *name, GCallback callback, |
| 80 | gpointer data); |
| 81 | void syl_plugin_signal_disconnect (gpointer func, gpointer data);
|
| 82 | void syl_plugin_signal_emit (const gchar *name, ...); |
| 83 | |
| 84 | /* Used by Sylpheed */
|
| 85 | |
| 86 | gint syl_plugin_init_lib (void);
|
| 87 | |
| 88 | gint syl_plugin_load (const gchar *file);
|
| 89 | gint syl_plugin_load_all (const gchar *dir);
|
| 90 | void syl_plugin_unload_all (void); |
| 91 | |
| 92 | GSList *syl_plugin_get_module_list (void);
|
| 93 | SylPluginInfo *syl_plugin_get_info (GModule *module); |
| 94 | gboolean syl_plugin_check_version (GModule *module); |
| 95 | |
| 96 | gint syl_plugin_add_symbol (const gchar *name, gpointer sym);
|
| 97 | |
| 98 | /* Interfaces which should be implemented by plug-ins
|
| 99 | void plugin_load(void); |
| 100 | void plugin_unload(void); |
| 101 | SylPluginInfo *plugin_info(void); |
| 102 | gint plugin_interface_version(void); |
| 103 | */ |
| 104 | |
| 105 | /* Plug-in API (used by plug-ins) */
|
| 106 | |
| 107 | const gchar *syl_plugin_get_prog_version (void); |
| 108 | |
| 109 | gpointer syl_plugin_main_window_get (void);
|
| 110 | void syl_plugin_main_window_popup (gpointer mainwin);
|
| 111 | |
| 112 | void syl_plugin_app_will_exit (gboolean force);
|
| 113 | |
| 114 | /* Menu */
|
| 115 | gint syl_plugin_add_menuitem (const gchar *parent,
|
| 116 | const gchar *label,
|
| 117 | SylPluginCallbackFunc func, |
| 118 | gpointer data); |
| 119 | gint syl_plugin_add_factory_item (const gchar *menu,
|
| 120 | const gchar *label,
|
| 121 | SylPluginCallbackFunc func, |
| 122 | gpointer data); |
| 123 | |
| 124 | void syl_plugin_menu_set_sensitive (const gchar *path, |
| 125 | gboolean sensitive); |
| 126 | void syl_plugin_menu_set_sensitive_all (GtkMenuShell *menu_shell,
|
| 127 | gboolean sensitive); |
| 128 | void syl_plugin_menu_set_active (const gchar *path, |
| 129 | gboolean is_active); |
| 130 | |
| 131 | |
| 132 | /* FolderView */
|
| 133 | gpointer syl_plugin_folderview_get (void);
|
| 134 | FolderItem *syl_plugin_folderview_get_selected_item |
| 135 | (void);
|
| 136 | |
| 137 | /* SummaryView */
|
| 138 | gpointer syl_plugin_summary_view_get (void);
|
| 139 | void syl_plugin_sumary_select_by_msgnum (guint msgnum);
|
| 140 | gboolean syl_plugin_summary_select_by_msginfo (MsgInfo *msginfo); |
| 141 | |
| 142 | void syl_plugin_open_message (const gchar *folder_id, |
| 143 | guint msgnum); |
| 144 | |
| 145 | /* MessageView */
|
| 146 | gpointer syl_plugin_messageview_create_with_new_window |
| 147 | (void);
|
| 148 | void syl_plugin_open_message_by_new_window (MsgInfo *msginfo);
|
| 149 | |
| 150 | /* Others */
|
| 151 | FolderItem *syl_plugin_folder_sel (Folder *cur_folder, |
| 152 | gint sel_type, |
| 153 | const gchar *default_folder);
|
| 154 | FolderItem *syl_plugin_folder_sel_full (Folder *cur_folder, |
| 155 | gint sel_type, |
| 156 | const gchar *default_folder,
|
| 157 | const gchar *message);
|
| 158 | |
| 159 | gchar *syl_plugin_input_dialog (const gchar *title,
|
| 160 | const gchar *message,
|
| 161 | const gchar *default_string);
|
| 162 | gchar *syl_plugin_input_dialog_with_invisible (const gchar *title,
|
| 163 | const gchar *message,
|
| 164 | const gchar *default_string);
|
| 165 | |
| 166 | void syl_plugin_manage_window_set_transient (GtkWindow *window);
|
| 167 | void syl_plugin_manage_window_signals_connect (GtkWindow *window);
|
| 168 | GtkWidget *syl_plugin_manage_window_get_focus_window |
| 169 | (void);
|
| 170 | |
| 171 | void syl_plugin_inc_mail (void); |
| 172 | void syl_plugin_inc_lock (void); |
| 173 | void syl_plugin_inc_unlock (void); |
| 174 | |
| 175 | #endif /* __PLUGIN_H__ */ |