2005-03-20 [colin] 1.9.6cvs6

* src/common/plugin.c
		Check that plugin isn't already loaded
		Patch by Alfons
This commit is contained in:
Colin Leroy 2005-03-20 21:49:06 +00:00
parent 10d0c8d61d
commit 4554f837cd
4 changed files with 27 additions and 4 deletions

View file

@ -1,3 +1,9 @@
2005-03-20 [colin] 1.9.6cvs6
* src/common/plugin.c
Check that plugin isn't already loaded
Patch by Alfons
2005-03-20 [thorsten] 1.9.6cvs5
* src/compose.c

View file

@ -422,3 +422,4 @@
( cvs diff -u -r 1.49.2.36 -r 1.49.2.37 src/procmime.c; ) > 1.9.6cvs3.patchset
( cvs diff -u -r 1.30.2.10 -r 1.30.2.11 src/prefs_toolbar.c; ) > 1.9.6cvs4.patchset
( cvs diff -u -r 1.382.2.112 -r 1.382.2.113 src/compose.c; ) > 1.9.6cvs5.patchset
( cvs diff -u -r 1.13.2.3 -r 1.13.2.4 src/common/plugin.c; ) > 1.9.6cvs6.patchset

View file

@ -11,7 +11,7 @@ MINOR_VERSION=9
MICRO_VERSION=6
INTERFACE_AGE=0
BINARY_AGE=0
EXTRA_VERSION=5
EXTRA_VERSION=6
EXTRA_RELEASE=
EXTRA_GTK2_VERSION=

View file

@ -32,9 +32,9 @@ struct _Plugin
{
gchar *filename;
GModule *module;
gchar *(*name) (void);
gchar *(*desc) (void);
gchar *(*type) (void);
const gchar *(*name) (void);
const gchar *(*desc) (void);
const gchar *(*type) (void);
};
/**
@ -48,6 +48,15 @@ static gint list_find_by_string(gconstpointer data, gconstpointer str)
return strcmp((gchar *)data, (gchar *)str) ? TRUE : FALSE;
}
static gint list_find_by_plugin_filename(const Plugin *plugin, const gchar *filename)
{
g_return_val_if_fail(plugin, 1);
g_return_val_if_fail(plugin->filename, 1);
g_return_val_if_fail(filename, 1);
return strcmp(filename, plugin->filename);
}
void plugin_save_list(void)
{
gchar *rcpath, *block;
@ -98,6 +107,13 @@ gint plugin_load(const gchar *filename, gchar **error)
g_return_val_if_fail(filename != NULL, -1);
g_return_val_if_fail(error != NULL, -1);
/* check duplicate plugin path name */
if (g_slist_find_custom(plugins, filename,
(GCompareFunc)list_find_by_plugin_filename)) {
*error = g_strdup(_("Plugin already loaded"));
return -1;
}
plugin = g_new0(Plugin, 1);
if (plugin == NULL) {