[PATCH 5/7] [grl-media-plugin] Use grl_media_plugin_get_info to retrieve default info



Uses the mentioned function when retrieving the author, description,
license and site and moves them to the header file as defines.
---
 src/grl-media-plugin.c |   97 ------------------------------------------------
 src/grl-media-plugin.h |   79 +++++++++++++++++++++++++++++++++++---
 2 files changed, 72 insertions(+), 104 deletions(-)

diff --git a/src/grl-media-plugin.c b/src/grl-media-plugin.c
index 6378931..367d7f5 100644
--- a/src/grl-media-plugin.c
+++ b/src/grl-media-plugin.c
@@ -95,103 +95,6 @@ grl_media_plugin_get_id (GrlMediaPlugin *plugin)
 }
 
 /**
- * grl_media_plugin_get_name:
- * @plugin: a plugin
- *
- * Get the name of the plugin
- *
- * Returns: (transfer none): the name of the @plugin
- */
-const gchar *
-grl_media_plugin_get_name (GrlMediaPlugin *plugin)
-{
-  g_return_val_if_fail (GRL_IS_MEDIA_PLUGIN (plugin), NULL);
-
-  return plugin->priv->info->name;
-}
-
-/**
- * grl_media_plugin_get_description:
- * @plugin: a plugin
- *
- * Get the description of the plugin
- *
- * Returns: (transfer none): the description of the @plugin
- */
-const gchar *
-grl_media_plugin_get_description (GrlMediaPlugin *plugin)
-{
-  g_return_val_if_fail (GRL_IS_MEDIA_PLUGIN (plugin), NULL);
-
-  return plugin->priv->info->desc;
-}
-
-/**
- * grl_media_plugin_get_version:
- * @plugin: a plugin
- *
- * Get the version of the plugin
- *
- * Returns: (transfer none): the version of the @plugin
- */
-const gchar *
-grl_media_plugin_get_version (GrlMediaPlugin *plugin)
-{
-  g_return_val_if_fail (GRL_IS_MEDIA_PLUGIN (plugin), NULL);
-
-  return plugin->priv->info->version;
-}
-
-/**
- * grl_media_plugin_get_license:
- * @plugin: a plugin
- *
- * Get the license of the plugin
- *
- * Returns: (transfer none): the license of the @plugin
- */
-const gchar *
-grl_media_plugin_get_license (GrlMediaPlugin *plugin)
-{
-  g_return_val_if_fail (GRL_IS_MEDIA_PLUGIN (plugin), NULL);
-
-  return plugin->priv->info->license;
-}
-
-
-/**
- * grl_media_plugin_get_author:
- * @plugin: a plugin
- *
- * Get the author of the plugin
- *
- * Returns: (transfer none): the author of the @plugin
- */
-const gchar *
-grl_media_plugin_get_author (GrlMediaPlugin *plugin)
-{
-  g_return_val_if_fail (GRL_IS_MEDIA_PLUGIN (plugin), NULL);
-
-  return plugin->priv->info->author;
-}
-
-/**
- * grl_media_plugin_get_site:
- * @plugin: a plugin
- *
- * Get the site of the plugin
- *
- * Returns: (transfer none): the site of the @plugin
- */
-const gchar *
-grl_media_plugin_get_site (GrlMediaPlugin *plugin)
-{
-  g_return_val_if_fail (GRL_IS_MEDIA_PLUGIN (plugin), NULL);
-
-  return plugin->priv->info->site;
-}
-
-/**
  * grl_media_plugin_get_rank:
  * @plugin: a plugin
  *
diff --git a/src/grl-media-plugin.h b/src/grl-media-plugin.h
index 1282de2..5812a92 100644
--- a/src/grl-media-plugin.h
+++ b/src/grl-media-plugin.h
@@ -32,7 +32,6 @@
 
 /* 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"
@@ -95,6 +94,78 @@ struct _GrlMediaPluginClass {
 
 };
 
+/**
+ * grl_media_plugin_get_name:
+ * @plugin: a plugin
+ *
+ * Get the name of the plugin
+ *
+ * Returns: (transfer none): the name of the @plugin
+ */
+#define grl_media_plugin_get_name(plugin)		\
+  grl_media_plugin_get_info(GRL_MEDIA_PLUGIN(plugin),	\
+			    GRL_MEDIA_PLUGIN_NAME)
+
+/**
+ * grl_media_plugin_get_description:
+ * @plugin: a plugin
+ *
+ * Get the description of the plugin
+ *
+ * Returns: (transfer none): the description of the @plugin
+ */
+#define grl_media_plugin_get_description(plugin)      \
+  grl_media_plugin_get_info(GRL_MEDIA_PLUGIN(plugin), \
+			    GRL_MEDIA_PLUGIN_DESCRIPTION)
+
+/**
+ * grl_media_plugin_get_version:
+ * @plugin: a plugin
+ *
+ * Get the version of the plugin
+ *
+ * Returns: (transfer none): the version of the @plugin
+ */
+#define grl_media_plugin_get_version(plugin)	      \
+  grl_media_plugin_get_info(GRL_MEDIA_PLUGIN(plugin), \
+			    GRL_MEDIA_PLUGIN_VERSION)
+
+/**
+ * grl_media_plugin_get_license:
+ * @plugin: a plugin
+ *
+ * Get the license of the plugin
+ *
+ * Returns: (transfer none): the license of the @plugin
+ */
+#define grl_media_plugin_get_license(plugin)	      \
+  grl_media_plugin_get_info(GRL_MEDIA_PLUGIN(plugin), \
+			    GRL_MEDIA_PLUGIN_LICENSE)
+
+/**
+ * grl_media_plugin_get_author:
+ * @plugin: a plugin
+ *
+ * Get the author of the plugin
+ *
+ * Returns: (transfer none): the author of the @plugin
+ */
+#define grl_media_plugin_get_author(plugin)	      \
+  grl_media_plugin_get_info(GRL_MEDIA_PLUGIN(plugin), \
+			    GRL_MEDIA_PLUGIN_AUTHOR)
+
+/**
+ * grl_media_plugin_get_site:
+ * @plugin: a plugin
+ *
+ * Get the site of the plugin
+ *
+ * Returns: (transfer none): the site of the @plugin
+ */
+#define grl_media_plugin_get_site(plugin)	      \
+  grl_media_plugin_get_info(GRL_MEDIA_PLUGIN(plugin), \
+			    GRL_MEDIA_PLUGIN_SITE)
+
 /* Function prototypes */
 
 G_BEGIN_DECLS
@@ -102,12 +173,6 @@ 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_name (GrlMediaPlugin *plugin);
-const gchar *grl_media_plugin_get_description (GrlMediaPlugin *plugin);
-const gchar *grl_media_plugin_get_version (GrlMediaPlugin *plugin);
-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);
-- 
1.7.0.4



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