diff options
| author | Cyrille Bagard <nocbos@gmail.com> | 2012-12-18 22:44:24 (GMT) | 
|---|---|---|
| committer | Cyrille Bagard <nocbos@gmail.com> | 2012-12-18 22:44:24 (GMT) | 
| commit | f4dbbab3190d13e61f125eea51a0ecec2ab9e897 (patch) | |
| tree | 2362579b428c363e2cca94e0fa89b1e39b7a50e7 /src/plugins | |
| parent | 64e09a6c3e39785975b5322973ed83734cedb82e (diff) | |
Created a proper panel for the Android permissions in the editor.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@305 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/plugins')
| -rw-r--r-- | src/plugins/pglist.c | 15 | ||||
| -rw-r--r-- | src/plugins/plugin-int.h | 3 | ||||
| -rw-r--r-- | src/plugins/plugin.c | 10 | ||||
| -rw-r--r-- | src/plugins/plugin.h | 2 | 
4 files changed, 15 insertions, 15 deletions
| diff --git a/src/plugins/pglist.c b/src/plugins/pglist.c index bca3e6a..6b51690 100644 --- a/src/plugins/pglist.c +++ b/src/plugins/pglist.c @@ -151,13 +151,10 @@ void browse_directory_for_plugins(plugins_list *list, const char *dir)          else          { -            plugin = g_plugin_module_new(filename, list->ref); +            plugin = g_plugin_module_new(filename);              if (plugin != NULL) -            { -                list->plugins = (GPluginModule **)realloc(list->plugins, ++list->plugins_count * sizeof(GPluginModule *)); -                list->plugins[list->plugins_count - 1] = plugin; -            } +                add_plugin_to_main_list(plugin);          } @@ -253,6 +250,14 @@ void add_plugin_to_main_list(GPluginModule *plugin)      list = &_list; +    if (plugin->init != NULL && !plugin->init(plugin, list->ref)) +    { +        log_variadic_message(LMT_ERROR, _("Initialization of plugin '%s' failed !"), +                             plugin->filename); +        g_object_unref(G_OBJECT(plugin)); +        return; +    } +      list->plugins = (GPluginModule **)realloc(list->plugins, ++list->plugins_count * sizeof(GPluginModule *));      list->plugins[list->plugins_count - 1] = plugin; diff --git a/src/plugins/plugin-int.h b/src/plugins/plugin-int.h index 9a5c37c..055f6ff 100644 --- a/src/plugins/plugin-int.h +++ b/src/plugins/plugin-int.h @@ -37,7 +37,7 @@  /* Précise le nom associé au greffon. */  typedef char * (* get_plugin_name_fc) (void); -/* Procède à l'initialisation du greffon */ +/* Procède à l'initialisation du greffon. */  typedef bool (* init_plugin_fc) (GPluginModule *, GObject *);  /* Fournit une indication sur le type d'opération(s) menée(s). */ @@ -61,6 +61,7 @@ struct _GPluginModule      GModule *module;                        /* Abstration de manipulation  */      char *name;                             /* Nom associé au greffon      */ +    char *filename;                         /* Fichier associé au greffon  */      PluginType type;                        /* Type(s) du greffon          */      init_plugin_fc init;                    /* Procédure d'initialisation  */ diff --git a/src/plugins/plugin.c b/src/plugins/plugin.c index c6a49c6..dabe493 100644 --- a/src/plugins/plugin.c +++ b/src/plugins/plugin.c @@ -90,7 +90,6 @@ static void g_plugin_module_init(GPluginModule *line)  /******************************************************************************  *                                                                             *  *  Paramètres  : filename = nom du fichier à charger.                         * -*                ref      = espace de référencement global.                   *  *                                                                             *  *  Description : Crée un module pour un greffon donné.                        *  *                                                                             * @@ -100,7 +99,7 @@ static void g_plugin_module_init(GPluginModule *line)  *                                                                             *  ******************************************************************************/ -GPluginModule *g_plugin_module_new(const gchar *filename, GObject *ref) +GPluginModule *g_plugin_module_new(const gchar *filename)  {      GPluginModule *result;                  /* Structure à retourner       */      get_plugin_name_fc get_name;            /* Nom du greffon              */ @@ -123,6 +122,7 @@ GPluginModule *g_plugin_module_new(const gchar *filename, GObject *ref)      }      result->name = get_name(); +    result->filename = strdup(filename);      if (!g_module_symbol(result->module, "init_plugin", (gpointer *)&result->init))          result->init = NULL; @@ -170,12 +170,6 @@ GPluginModule *g_plugin_module_new(const gchar *filename, GObject *ref) -    if (result->init != NULL && !result->init(result, ref)) -    { -        log_variadic_message(LMT_ERROR, _("Initialization of plugin '%s' failed !"), filename); -        goto bad_plugin; -    } -      dir = strdup(filename);      dir = dirname(dir); diff --git a/src/plugins/plugin.h b/src/plugins/plugin.h index 6fbba4d..c0f6cd1 100644 --- a/src/plugins/plugin.h +++ b/src/plugins/plugin.h @@ -52,7 +52,7 @@ typedef struct _GPluginModuleClass GPluginModuleClass;  GType g_plugin_module_get_type(void);  /* Crée un module pour un greffon donné. */ -GPluginModule *g_plugin_module_new(const gchar *, GObject *); +GPluginModule *g_plugin_module_new(const gchar *);  /* Fournit le nom associé au greffon. */  const char *g_plugin_module_get_name(const GPluginModule *); | 
