diff options
-rw-r--r-- | libcaja-private/caja-extensions.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/libcaja-private/caja-extensions.c b/libcaja-private/caja-extensions.c index 7f4791ec..78b4af06 100644 --- a/libcaja-private/caja-extensions.c +++ b/libcaja-private/caja-extensions.c @@ -192,13 +192,23 @@ caja_extensions_get_list (void) void caja_extension_register (gchar *filename, GObject *module) { - gboolean state = TRUE; // new extensions are enabled by default. - gchar *extname; + gboolean ext_state = TRUE; // new extensions are enabled by default. + gchar *ext_filename; + GList *l; - extname = g_strndup (filename, strlen(filename) - 3); - state = caja_extension_get_state (extname); + ext_filename = g_strndup (filename, strlen(filename) - 3); + ext_state = caja_extension_get_state (ext_filename); + + /* Do not attempt to register already registered extensions */ + for (l = caja_extensions; l != NULL; l = l->next) + { + Extension *r = l->data; + if (g_ascii_strcasecmp (r->filename, ext_filename) == 0) { + return; + } + } - Extension *ext = extension_new (extname, state, module); + Extension *ext = extension_new (ext_filename, ext_state, module); caja_extensions = g_list_append (caja_extensions, ext); } |