[grilo] Add grl_media_plugin_get_info and plugin's keys defines



commit 13d9986564209ffaa79115d19106109307f9ec7c
Author: Joaquim Rocha <jrocha igalia com>
Date:   Fri Jun 11 21:38:21 2010 +0200

    Add grl_media_plugin_get_info and plugin's keys defines
    
    The grl_media_plugin_get_info retrieves the optional info from the plugin,
    which correspond's to the plugin's XML.

 src/grl-media-plugin.c |   21 +++++++++++++++++++++
 src/grl-media-plugin.h |   12 ++++++++++++
 2 files changed, 33 insertions(+), 0 deletions(-)
---
diff --git a/src/grl-media-plugin.c b/src/grl-media-plugin.c
index bd9bdfa..6378931 100644
--- a/src/grl-media-plugin.c
+++ b/src/grl-media-plugin.c
@@ -205,3 +205,24 @@ grl_media_plugin_get_rank (GrlMediaPlugin *plugin)
   g_return_val_if_fail (GRL_IS_MEDIA_PLUGIN (plugin), 0);
   return plugin->priv->info->rank;
 }
+
+/**
+ * grl_media_plugin_get_info:
+ * @plugin: a plugin
+ * @key: a key representing information about this plugin
+ *
+ * Get the information of the @plugin that is associated with the given key
+ *
+ * Returns: the information assigned to the given @key or NULL if there is no such information
+ */
+const gchar *
+grl_media_plugin_get_info (GrlMediaPlugin *plugin, const gchar *key)
+{
+  g_return_val_if_fail (GRL_IS_MEDIA_PLUGIN (plugin), NULL);
+
+  if (!plugin->priv->info->optional_info) {
+    return NULL;
+  }
+
+  return g_hash_table_lookup (plugin->priv->info->optional_info, key);
+}
diff --git a/src/grl-media-plugin.h b/src/grl-media-plugin.h
index c3cb839..1282de2 100644
--- a/src/grl-media-plugin.h
+++ b/src/grl-media-plugin.h
@@ -30,6 +30,16 @@
 #include <glib.h>
 #include <glib-object.h>
 
+/* Info */
+
+#define GRL_MEDIA_PLUGIN_RANK "rank"
+#define GRL_MEDIA_PLUGIN_NAME "name"
+#define GRL_MEDIA_PLUGIN_DESCRIPTION "description"
+#define GRL_MEDIA_PLUGIN_VERSION "version"
+#define GRL_MEDIA_PLUGIN_LICENSE "license"
+#define GRL_MEDIA_PLUGIN_AUTHOR "author"
+#define GRL_MEDIA_PLUGIN_SITE "site"
+
 /* Macros */
 
 #define GRL_TYPE_MEDIA_PLUGIN                   \
@@ -99,6 +109,8 @@ const gchar *grl_media_plugin_get_license (GrlMediaPlugin *plugin);
 const gchar *grl_media_plugin_get_author (GrlMediaPlugin *plugin);
 const gchar *grl_media_plugin_get_site (GrlMediaPlugin *plugin);
 gint grl_media_plugin_get_rank (GrlMediaPlugin *plugin);
+const gchar *
+grl_media_plugin_get_info (GrlMediaPlugin *plugin, const gchar *key);
 
 G_END_DECLS
 



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