1 /* Dia -- an diagram creation/manipulation program
2 * Copyright (C) 1999 Alexander Larsson
4 * plug-ins.h: plugin loading handling interfaces for dia
5 * Copyright (C) 2000 James Henstridge
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
30 * The api version to ensure dia core and the plug-ins agree on
31 * talking about the same thing. If some incompatible change is
32 * made to the interface between plug-ins and core it needs to
33 * be incremented to allow the core to detect outdated plug-ins
34 * and avoid to load them - which otherwise would produce strange
35 * misinterpretations or even crashes.
37 * Some of the things which require a new plug-in api version are :
38 * - Changes to DiaRenderer's vtable, that is adding new methods,
39 * especially if they are shifting the placement of previously
40 * defined ones, see : lib/diarenderer.h
41 * - Changes to lib/object.h:_ObjectOps
42 * - Changes to _DiaExportFilter, _DiaImportFilter, lib/filter.h
43 * - New, incompatibe versions of libraries where both the core
44 * and the plug-in depend on (Dia >0.90 crashing on pygtk 1.x
45 * could have been avoided this way)
46 * The list is by no means complete. If in doubt about your change
47 * please ask on dia-list or alternative increment ;-) --hb
49 #define DIA_PLUGIN_API_VERSION 6
56 typedef PluginInitResult (*PluginInitFunc
) (PluginInfo
*info
);
57 typedef gboolean (*PluginCanUnloadFunc
) (PluginInfo
*info
);
58 typedef void (*PluginUnloadFunc
) (PluginInfo
*info
);
60 /* functions for use by plugins ... */
62 gboolean
dia_plugin_info_init(PluginInfo
*info
, gchar
*name
,
64 PluginCanUnloadFunc can_unload_func
,
65 PluginUnloadFunc unload_func
);
67 gchar
*dia_plugin_check_version(gint version
);
70 /* functiosn for use by dia ... */
71 const gchar
*dia_plugin_get_filename (PluginInfo
*info
);
72 const gchar
*dia_plugin_get_name (PluginInfo
*info
);
73 const gchar
*dia_plugin_get_description (PluginInfo
*info
);
74 const gpointer
*dia_plugin_get_symbol (PluginInfo
*info
, const gchar
*name
);
76 gboolean
dia_plugin_can_unload (PluginInfo
*info
);
77 gboolean
dia_plugin_is_loaded (PluginInfo
*info
);
78 gboolean
dia_plugin_get_inhibit_load (PluginInfo
*info
);
79 void dia_plugin_set_inhibit_load (PluginInfo
*info
, gboolean inhibit_load
);
81 void dia_plugin_load (PluginInfo
*info
);
82 void dia_plugin_unload (PluginInfo
*info
);
84 void dia_register_plugin (const gchar
*filename
);
85 void dia_register_plugins_in_dir (const gchar
*directory
);
86 void dia_register_plugins (void);
87 void dia_register_builtin_plugin (PluginInitFunc init_func
);
89 GList
*dia_list_plugins(void);
91 void dia_pluginrc_write(void);
93 /* macro defining the version check that should be implemented by all
95 #define DIA_PLUGIN_CHECK_INIT \
96 G_MODULE_EXPORT const gchar *g_module_check_init(GModule *gmodule); \
98 g_module_check_init(GModule *gmodule) \
100 return dia_plugin_check_version(DIA_PLUGIN_API_VERSION); \
103 /* prototype for plugin init function (should be implemented by plugin) */
104 G_MODULE_EXPORT PluginInitResult
dia_plugin_init(PluginInfo
*info
);