2006-05-21 16:11:05 -07:00
|
|
|
/*
|
2005-09-08 00:46:48 -07:00
|
|
|
* mooplugin.h
|
|
|
|
*
|
2006-02-23 06:03:17 -08:00
|
|
|
* Copyright (C) 2004-2006 by Yevgen Muntyan <muntyan@math.tamu.edu>
|
2005-09-08 00:46:48 -07:00
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* See COPYING file that comes with this distribution.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __MOO_PLUGIN_H__
|
|
|
|
#define __MOO_PLUGIN_H__
|
|
|
|
|
2005-10-13 07:08:18 -07:00
|
|
|
#include <mooedit/mooeditor.h>
|
2005-09-08 00:46:48 -07:00
|
|
|
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
|
|
|
#define MOO_PLUGIN_PREFS_ROOT "Plugins"
|
2005-10-13 07:08:18 -07:00
|
|
|
#define MOO_PLUGIN_DIR_BASENAME "plugins"
|
2005-09-08 00:46:48 -07:00
|
|
|
|
2006-06-14 21:46:46 -07:00
|
|
|
#define MOO_MODULE_VERSION_MAJOR 2
|
2006-05-29 00:43:09 -07:00
|
|
|
#define MOO_MODULE_VERSION_MINOR 0
|
|
|
|
|
|
|
|
#define MOO_PLUGIN_INIT_FUNC moo_module_init
|
|
|
|
#define MOO_PLUGIN_INIT_FUNC_NAME "moo_module_init"
|
2005-09-08 00:46:48 -07:00
|
|
|
|
2005-10-13 07:08:18 -07:00
|
|
|
#define MOO_TYPE_PLUGIN (moo_plugin_get_type ())
|
|
|
|
#define MOO_PLUGIN(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), MOO_TYPE_PLUGIN, MooPlugin))
|
|
|
|
#define MOO_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MOO_TYPE_PLUGIN, MooPluginClass))
|
|
|
|
#define MOO_IS_PLUGIN(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), MOO_TYPE_PLUGIN))
|
|
|
|
#define MOO_IS_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MOO_TYPE_PLUGIN))
|
|
|
|
#define MOO_PLUGIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MOO_TYPE_PLUGIN, MooPluginClass))
|
2005-09-08 00:46:48 -07:00
|
|
|
|
2005-10-13 07:08:18 -07:00
|
|
|
#define MOO_TYPE_WIN_PLUGIN (moo_win_plugin_get_type ())
|
|
|
|
#define MOO_WIN_PLUGIN(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), MOO_TYPE_WIN_PLUGIN, MooWinPlugin))
|
|
|
|
#define MOO_WIN_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MOO_TYPE_WIN_PLUGIN, MooWinPluginClass))
|
|
|
|
#define MOO_IS_WIN_PLUGIN(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), MOO_TYPE_WIN_PLUGIN))
|
|
|
|
#define MOO_IS_WIN_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MOO_TYPE_WIN_PLUGIN))
|
|
|
|
#define MOO_WIN_PLUGIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MOO_TYPE_WIN_PLUGIN, MooWinPluginClass))
|
|
|
|
|
|
|
|
#define MOO_TYPE_DOC_PLUGIN (moo_doc_plugin_get_type ())
|
|
|
|
#define MOO_DOC_PLUGIN(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), MOO_TYPE_DOC_PLUGIN, MooDocPlugin))
|
|
|
|
#define MOO_DOC_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MOO_TYPE_DOC_PLUGIN, MooDocPluginClass))
|
|
|
|
#define MOO_IS_DOC_PLUGIN(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), MOO_TYPE_DOC_PLUGIN))
|
|
|
|
#define MOO_IS_DOC_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MOO_TYPE_DOC_PLUGIN))
|
|
|
|
#define MOO_DOC_PLUGIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MOO_TYPE_DOC_PLUGIN, MooDocPluginClass))
|
2005-09-08 00:46:48 -07:00
|
|
|
|
2006-04-29 19:34:53 -07:00
|
|
|
#define MOO_TYPE_PLUGIN_INFO (moo_plugin_info_get_type ())
|
|
|
|
#define MOO_TYPE_PLUGIN_PARAMS (moo_plugin_params_get_type ())
|
|
|
|
|
2005-09-08 00:46:48 -07:00
|
|
|
|
2005-09-11 23:57:29 -07:00
|
|
|
typedef struct _MooPlugin MooPlugin;
|
|
|
|
typedef struct _MooPluginInfo MooPluginInfo;
|
|
|
|
typedef struct _MooPluginParams MooPluginParams;
|
|
|
|
typedef struct _MooPluginClass MooPluginClass;
|
2005-10-13 07:08:18 -07:00
|
|
|
typedef struct _MooWinPlugin MooWinPlugin;
|
|
|
|
typedef struct _MooWinPluginClass MooWinPluginClass;
|
|
|
|
typedef struct _MooDocPlugin MooDocPlugin;
|
|
|
|
typedef struct _MooDocPluginClass MooDocPluginClass;
|
2006-05-27 01:28:37 -07:00
|
|
|
typedef struct _MooPluginMeth MooPluginMeth;
|
2005-09-08 00:46:48 -07:00
|
|
|
|
|
|
|
|
2005-10-13 07:08:18 -07:00
|
|
|
typedef gboolean (*MooPluginModuleInitFunc) (void);
|
2005-09-08 00:46:48 -07:00
|
|
|
|
2005-10-13 07:08:18 -07:00
|
|
|
typedef gboolean (*MooPluginInitFunc) (MooPlugin *plugin);
|
|
|
|
typedef void (*MooPluginDeinitFunc) (MooPlugin *plugin);
|
|
|
|
typedef void (*MooPluginAttachWinFunc) (MooPlugin *plugin,
|
|
|
|
MooEditWindow *window);
|
|
|
|
typedef void (*MooPluginDetachWinFunc) (MooPlugin *plugin,
|
|
|
|
MooEditWindow *window);
|
|
|
|
typedef void (*MooPluginAttachDocFunc) (MooPlugin *plugin,
|
|
|
|
MooEdit *doc,
|
|
|
|
MooEditWindow *window);
|
|
|
|
typedef void (*MooPluginDetachDocFunc) (MooPlugin *plugin,
|
|
|
|
MooEdit *doc,
|
|
|
|
MooEditWindow *window);
|
2005-09-11 23:57:29 -07:00
|
|
|
|
2005-10-13 07:08:18 -07:00
|
|
|
typedef GtkWidget *(*MooPluginPrefsPageFunc) (MooPlugin *plugin);
|
2005-09-16 15:35:16 -07:00
|
|
|
|
2005-10-13 07:08:18 -07:00
|
|
|
typedef gboolean (*MooWinPluginCreateFunc) (MooWinPlugin *win_plugin);
|
|
|
|
typedef void (*MooWinPluginDestroyFunc) (MooWinPlugin *win_plugin);
|
|
|
|
typedef gboolean (*MooDocPluginCreateFunc) (MooDocPlugin *doc_plugin);
|
|
|
|
typedef void (*MooDocPluginDestroyFunc) (MooDocPlugin *doc_plugin);
|
2005-09-11 23:57:29 -07:00
|
|
|
|
|
|
|
|
2006-05-27 01:28:37 -07:00
|
|
|
struct _MooPluginMeth
|
|
|
|
{
|
|
|
|
GType ptype;
|
|
|
|
GType return_type;
|
|
|
|
guint n_params;
|
|
|
|
GType *param_types;
|
|
|
|
GClosure *closure;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2005-09-11 23:57:29 -07:00
|
|
|
struct _MooPluginParams
|
2005-09-08 00:46:48 -07:00
|
|
|
{
|
2005-09-11 23:57:29 -07:00
|
|
|
gboolean enabled;
|
2005-11-05 07:32:04 -08:00
|
|
|
gboolean visible;
|
2005-09-11 23:57:29 -07:00
|
|
|
};
|
2005-09-08 00:46:48 -07:00
|
|
|
|
2005-09-11 23:57:29 -07:00
|
|
|
struct _MooPluginInfo
|
|
|
|
{
|
2006-04-29 19:34:53 -07:00
|
|
|
char *id;
|
2005-09-08 00:46:48 -07:00
|
|
|
|
2006-04-29 19:34:53 -07:00
|
|
|
char *name;
|
|
|
|
char *description;
|
|
|
|
char *author;
|
|
|
|
char *version;
|
2005-09-08 00:46:48 -07:00
|
|
|
|
2006-04-29 19:34:53 -07:00
|
|
|
char *langs;
|
2005-09-08 00:46:48 -07:00
|
|
|
};
|
|
|
|
|
2005-09-11 23:57:29 -07:00
|
|
|
struct _MooPlugin
|
|
|
|
{
|
|
|
|
GObject parent;
|
|
|
|
|
|
|
|
gboolean initialized;
|
2005-09-08 00:46:48 -07:00
|
|
|
|
2005-10-13 07:08:18 -07:00
|
|
|
GQuark id_quark;
|
2005-09-11 23:57:29 -07:00
|
|
|
MooPluginInfo *info;
|
2006-06-14 21:46:46 -07:00
|
|
|
MooPluginParams *params;
|
2006-04-16 02:57:14 -07:00
|
|
|
GHashTable *langs;
|
|
|
|
GSList *docs;
|
2005-10-13 07:08:18 -07:00
|
|
|
GType win_plugin_type;
|
|
|
|
GType doc_plugin_type;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct _MooWinPlugin
|
|
|
|
{
|
|
|
|
GObject parent;
|
|
|
|
MooEditWindow *window;
|
|
|
|
MooPlugin *plugin;
|
2005-09-11 23:57:29 -07:00
|
|
|
};
|
|
|
|
|
2005-10-13 07:08:18 -07:00
|
|
|
struct _MooDocPlugin
|
2005-09-08 00:46:48 -07:00
|
|
|
{
|
2005-09-11 23:57:29 -07:00
|
|
|
GObject parent;
|
|
|
|
MooEditWindow *window;
|
2005-10-13 07:08:18 -07:00
|
|
|
MooEdit *doc;
|
2005-09-11 23:57:29 -07:00
|
|
|
MooPlugin *plugin;
|
2005-09-08 00:46:48 -07:00
|
|
|
};
|
|
|
|
|
2005-09-11 23:57:29 -07:00
|
|
|
struct _MooPluginClass
|
|
|
|
{
|
|
|
|
GObjectClass parent_class;
|
|
|
|
|
|
|
|
MooPluginInitFunc init;
|
|
|
|
MooPluginDeinitFunc deinit;
|
2005-10-13 07:08:18 -07:00
|
|
|
MooPluginAttachWinFunc attach_win;
|
|
|
|
MooPluginDetachWinFunc detach_win;
|
|
|
|
MooPluginAttachDocFunc attach_doc;
|
|
|
|
MooPluginDetachDocFunc detach_doc;
|
2005-09-16 15:35:16 -07:00
|
|
|
MooPluginPrefsPageFunc create_prefs_page;
|
2005-09-11 23:57:29 -07:00
|
|
|
};
|
2005-09-08 00:46:48 -07:00
|
|
|
|
2005-10-13 07:08:18 -07:00
|
|
|
struct _MooWinPluginClass
|
|
|
|
{
|
|
|
|
GObjectClass parent_class;
|
|
|
|
|
|
|
|
MooWinPluginCreateFunc create;
|
|
|
|
MooWinPluginDestroyFunc destroy;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct _MooDocPluginClass
|
2005-09-08 00:46:48 -07:00
|
|
|
{
|
2005-09-11 23:57:29 -07:00
|
|
|
GObjectClass parent_class;
|
|
|
|
|
2005-10-13 07:08:18 -07:00
|
|
|
MooDocPluginCreateFunc create;
|
|
|
|
MooDocPluginDestroyFunc destroy;
|
2005-09-08 00:46:48 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2005-09-11 23:57:29 -07:00
|
|
|
GType moo_plugin_get_type (void) G_GNUC_CONST;
|
2005-10-13 07:08:18 -07:00
|
|
|
GType moo_win_plugin_get_type (void) G_GNUC_CONST;
|
|
|
|
GType moo_doc_plugin_get_type (void) G_GNUC_CONST;
|
2006-04-29 19:34:53 -07:00
|
|
|
GType moo_plugin_info_get_type (void) G_GNUC_CONST;
|
|
|
|
GType moo_plugin_params_get_type (void) G_GNUC_CONST;
|
2005-09-11 23:57:29 -07:00
|
|
|
|
2006-05-29 00:43:09 -07:00
|
|
|
gboolean moo_module_check_version (guint major,
|
|
|
|
guint minor);
|
|
|
|
|
2006-06-14 21:46:46 -07:00
|
|
|
gboolean moo_plugin_register (GType type,
|
|
|
|
const MooPluginInfo *info,
|
|
|
|
const MooPluginParams *params);
|
2005-11-07 00:36:04 -08:00
|
|
|
void moo_plugin_unregister (GType type);
|
2005-09-08 00:46:48 -07:00
|
|
|
|
2005-09-11 23:57:29 -07:00
|
|
|
gboolean moo_plugin_initialized (MooPlugin *plugin);
|
|
|
|
gboolean moo_plugin_enabled (MooPlugin *plugin);
|
|
|
|
gboolean moo_plugin_set_enabled (MooPlugin *plugin,
|
|
|
|
gboolean enabled);
|
2005-09-08 00:46:48 -07:00
|
|
|
|
2005-09-11 23:57:29 -07:00
|
|
|
MooPlugin *moo_plugin_get (GType type);
|
2005-09-08 00:46:48 -07:00
|
|
|
|
2005-09-11 23:57:29 -07:00
|
|
|
gpointer moo_plugin_lookup (const char *plugin_id);
|
2005-10-13 07:08:18 -07:00
|
|
|
gpointer moo_win_plugin_lookup (const char *plugin_id,
|
|
|
|
MooEditWindow *window);
|
|
|
|
gpointer moo_doc_plugin_lookup (const char *plugin_id,
|
|
|
|
MooEdit *doc);
|
|
|
|
|
2005-09-16 15:35:16 -07:00
|
|
|
/* list of MooPlugin*; list must be freed */
|
2005-09-11 23:57:29 -07:00
|
|
|
GSList *moo_list_plugins (void);
|
2005-09-08 00:46:48 -07:00
|
|
|
|
2005-09-16 15:35:16 -07:00
|
|
|
const char *moo_plugin_id (MooPlugin *plugin);
|
|
|
|
|
|
|
|
const char *moo_plugin_name (MooPlugin *plugin);
|
|
|
|
const char *moo_plugin_description (MooPlugin *plugin);
|
|
|
|
const char *moo_plugin_author (MooPlugin *plugin);
|
|
|
|
const char *moo_plugin_version (MooPlugin *plugin);
|
2005-09-08 00:46:48 -07:00
|
|
|
|
2006-04-05 23:16:29 -07:00
|
|
|
char **moo_plugin_get_dirs (void);
|
2005-12-23 06:31:22 -08:00
|
|
|
void moo_plugin_read_dirs (void);
|
2006-06-09 14:19:25 -07:00
|
|
|
void moo_plugin_shutdown (void);
|
2005-09-08 00:46:48 -07:00
|
|
|
|
2006-04-29 19:34:53 -07:00
|
|
|
void moo_plugin_set_info (MooPlugin *plugin,
|
|
|
|
MooPluginInfo *info);
|
|
|
|
void moo_plugin_set_doc_plugin_type (MooPlugin *plugin,
|
|
|
|
GType type);
|
|
|
|
void moo_plugin_set_win_plugin_type (MooPlugin *plugin,
|
|
|
|
GType type);
|
|
|
|
|
|
|
|
MooPluginInfo *moo_plugin_info_new (const char *id,
|
|
|
|
const char *name,
|
|
|
|
const char *description,
|
|
|
|
const char *author,
|
|
|
|
const char *version,
|
2006-06-14 21:46:46 -07:00
|
|
|
const char *langs);
|
2006-04-29 19:34:53 -07:00
|
|
|
MooPluginInfo *moo_plugin_info_copy (MooPluginInfo *info);
|
|
|
|
void moo_plugin_info_free (MooPluginInfo *info);
|
|
|
|
MooPluginParams *moo_plugin_params_new (gboolean enabled,
|
|
|
|
gboolean visible);
|
|
|
|
MooPluginParams *moo_plugin_params_copy (MooPluginParams *params);
|
|
|
|
void moo_plugin_params_free (MooPluginParams *params);
|
|
|
|
|
2005-09-11 23:57:29 -07:00
|
|
|
void _moo_window_attach_plugins (MooEditWindow *window);
|
2005-10-13 07:08:18 -07:00
|
|
|
void _moo_window_detach_plugins (MooEditWindow *window);
|
|
|
|
void _moo_doc_attach_plugins (MooEditWindow *window,
|
|
|
|
MooEdit *doc);
|
|
|
|
void _moo_doc_detach_plugins (MooEditWindow *window,
|
|
|
|
MooEdit *doc);
|
2005-09-08 00:46:48 -07:00
|
|
|
|
2005-09-16 15:35:16 -07:00
|
|
|
void _moo_plugin_attach_prefs (GtkWidget *prefs_dialog);
|
|
|
|
|
2005-09-08 00:46:48 -07:00
|
|
|
|
2006-05-27 01:28:37 -07:00
|
|
|
MooPluginMeth *moo_plugin_lookup_method (gpointer plugin,
|
|
|
|
const char *name);
|
|
|
|
GSList *moo_plugin_list_methods (gpointer plugin);
|
|
|
|
|
|
|
|
void moo_plugin_call_method (gpointer plugin,
|
|
|
|
const char *name,
|
|
|
|
...);
|
|
|
|
void moo_plugin_call_method_valist (gpointer plugin,
|
|
|
|
const char *name,
|
|
|
|
va_list var_args);
|
|
|
|
void moo_plugin_call_methodv (const GValue *plugin_and_args,
|
|
|
|
const char *name,
|
|
|
|
GValue *return_value);
|
|
|
|
|
|
|
|
void moo_plugin_method_new (const char *name,
|
|
|
|
GType ptype,
|
|
|
|
GCallback method,
|
|
|
|
GClosureMarshal c_marshaller,
|
|
|
|
GType return_type,
|
|
|
|
guint n_params,
|
|
|
|
...);
|
|
|
|
void moo_plugin_method_newv (const char *name,
|
|
|
|
GType ptype,
|
|
|
|
GClosure *closure,
|
|
|
|
GClosureMarshal c_marshaller,
|
|
|
|
GType return_type,
|
|
|
|
guint n_params,
|
|
|
|
const GType *param_types);
|
|
|
|
void moo_plugin_method_new_valist(const char *name,
|
|
|
|
GType ptype,
|
|
|
|
GClosure *closure,
|
|
|
|
GClosureMarshal c_marshaller,
|
|
|
|
GType return_type,
|
|
|
|
guint n_params,
|
|
|
|
va_list args);
|
|
|
|
|
|
|
|
|
2005-09-08 00:46:48 -07:00
|
|
|
G_END_DECLS
|
|
|
|
|
|
|
|
#endif /* __MOO_PLUGIN_H__ */
|