[grilo] core: Add function to get a list of defined information keys for a plugin
- From: Juan A. Suarez Romero <jasuarez src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [grilo] core: Add function to get a list of defined information keys for a plugin
- Date: Fri, 16 Jul 2010 11:48:12 +0000 (UTC)
commit 14f4adf658e13346cb22a9cd8f89e827c040f52a
Author: Juan A. Suarez Romero <jasuarez igalia com>
Date: Fri Jul 16 13:15:01 2010 +0200
core: Add function to get a list of defined information keys for a plugin
As plugins can define their own custom information fields, add a new
grl_media_plugin_get_info_keys() which returns a list with those custom fields
the user can then query.
src/grl-media-plugin.c | 23 +++++++++++++++++++++++
src/grl-media-plugin.h | 2 ++
2 files changed, 25 insertions(+), 0 deletions(-)
---
diff --git a/src/grl-media-plugin.c b/src/grl-media-plugin.c
index 2e5a2cc..3e3a603 100644
--- a/src/grl-media-plugin.c
+++ b/src/grl-media-plugin.c
@@ -148,6 +148,29 @@ grl_media_plugin_get_rank (GrlMediaPlugin *plugin)
}
/**
+ * grl_media_plugin_get_info_keys:
+ * @plugin: a plugin
+ *
+ * Returns a list of keys that can be queried to retrieve information about the
+ * plugin.
+ *
+ * Returns: a #GList of strings containing the keys. The content of the list is
+ * owned by the plugin and should not be modified or freed. Use g_list_free()
+ * when done using the list.
+ **/
+GList *
+grl_media_plugin_get_info_keys (GrlMediaPlugin *plugin)
+{
+ g_return_val_if_fail (GRL_IS_MEDIA_PLUGIN (plugin), NULL);
+
+ if (plugin->priv->info->optional_info) {
+ return g_hash_table_get_keys (plugin->priv->info->optional_info);
+ } else {
+ return NULL;
+ }
+}
+
+/**
* grl_media_plugin_get_info:
* @plugin: a plugin
* @key: a key representing information about this plugin
diff --git a/src/grl-media-plugin.h b/src/grl-media-plugin.h
index ca78d83..a60eb8c 100644
--- a/src/grl-media-plugin.h
+++ b/src/grl-media-plugin.h
@@ -178,6 +178,8 @@ const gchar *grl_media_plugin_get_filename (GrlMediaPlugin *plugin);
gint grl_media_plugin_get_rank (GrlMediaPlugin *plugin);
+GList *grl_media_plugin_get_info_keys (GrlMediaPlugin *plugin);
+
const gchar *grl_media_plugin_get_info (GrlMediaPlugin *plugin,
const gchar *key);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]