[PATCH 2/7] core: Add library filename to plugin's information



---
 src/grl-media-plugin.c    |   19 +++++++++++++++++++
 src/grl-media-plugin.h    |    8 ++++++--
 src/grl-plugin-registry.c |    2 ++
 src/grl-plugin-registry.h |    4 +++-
 4 files changed, 30 insertions(+), 3 deletions(-)

diff --git a/src/grl-media-plugin.c b/src/grl-media-plugin.c
index d954709..2e5a2cc 100644
--- a/src/grl-media-plugin.c
+++ b/src/grl-media-plugin.c
@@ -84,6 +84,9 @@ grl_media_plugin_finalize (GObject *object)
     g_hash_table_destroy (plugin->priv->info->optional_info);
   }
 
+  g_free (plugin->priv->info->id);
+  g_free (plugin->priv->info->filename);
+
   G_OBJECT_CLASS (grl_media_plugin_parent_class)->finalize (object);
 }
 
@@ -114,6 +117,22 @@ grl_media_plugin_get_id (GrlMediaPlugin *plugin)
 }
 
 /**
+ * grl_media_plugin_get_filename:
+ * @plugin: a plugin
+ *
+ * Get the filename containing the plugin
+ *
+ * Returns: (transfer none): the filename containing @plugin
+ */
+const gchar *
+grl_media_plugin_get_filename (GrlMediaPlugin *plugin)
+{
+  g_return_val_if_fail (GRL_IS_MEDIA_PLUGIN (plugin), NULL);
+
+  return plugin->priv->info->filename;
+}
+
+/**
  * grl_media_plugin_get_rank:
  * @plugin: a plugin
  *
diff --git a/src/grl-media-plugin.h b/src/grl-media-plugin.h
index 5812a92..ca78d83 100644
--- a/src/grl-media-plugin.h
+++ b/src/grl-media-plugin.h
@@ -173,9 +173,13 @@ G_BEGIN_DECLS
 GType grl_media_plugin_get_type (void);
 
 const gchar *grl_media_plugin_get_id (GrlMediaPlugin *plugin);
+
+const gchar *grl_media_plugin_get_filename (GrlMediaPlugin *plugin);
+
 gint grl_media_plugin_get_rank (GrlMediaPlugin *plugin);
-const gchar *
-grl_media_plugin_get_info (GrlMediaPlugin *plugin, const gchar *key);
+
+const gchar *grl_media_plugin_get_info (GrlMediaPlugin *plugin,
+                                        const gchar *key);
 
 G_END_DECLS
 
diff --git a/src/grl-plugin-registry.c b/src/grl-plugin-registry.c
index acddefa..06664d5 100644
--- a/src/grl-plugin-registry.c
+++ b/src/grl-plugin-registry.c
@@ -422,6 +422,8 @@ grl_plugin_registry_load (GrlPluginRegistry *registry, const gchar *path)
     return FALSE;
   }
 
+  plugin->info.filename = g_strdup (path);
+
   xml_path = g_strconcat (GRL_PLUGINS_CONF_DIR,
 			  G_DIR_SEPARATOR_S,
 			  plugin->info.id,
diff --git a/src/grl-plugin-registry.h b/src/grl-plugin-registry.h
index ba7dde0..01bd579 100644
--- a/src/grl-plugin-registry.h
+++ b/src/grl-plugin-registry.h
@@ -94,13 +94,15 @@ typedef struct _GrlPluginRegistry GrlPluginRegistry;
 /**
  * GrlPluginInfo:
  * @id: the module identifier
+ * @filename: the filename containing the plugin
  * @rank: the plugin priority rank
  *
  * This structure stores the information related to a module
 */
 
 typedef struct _GrlPluginInfo {
-  const gchar *id;
+  gchar *id;
+  gchar *filename;
   GHashTable *optional_info;
   gint rank;
 } GrlPluginInfo;
-- 
1.7.0.4



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]