[PATCH] plugins: sync Grilo config usage with rework in core
- From: llandwerlin gmail com
- To: grilo-list gnome org
- Subject: [PATCH] plugins: sync Grilo config usage with rework in core
- Date: Tue, 18 Jan 2011 15:47:08 +0000
From: Lionel Landwerlin <lionel g landwerlin linux intel com>
Signed-off-by: Lionel Landwerlin <lionel g landwerlin linux intel com>
---
src/apple-trailers/grl-apple-trailers.c | 20 +++++++++++++-------
src/filesystem/grl-filesystem.c | 10 ++++------
src/flickr/grl-flickr.c | 13 ++++++++++---
src/vimeo/grl-vimeo.c | 18 ++++++++++++++----
src/youtube/grl-youtube.c | 9 ++++++---
5 files changed, 47 insertions(+), 23 deletions(-)
diff --git a/src/apple-trailers/grl-apple-trailers.c b/src/apple-trailers/grl-apple-trailers.c
index 28764ad..5054853 100644
--- a/src/apple-trailers/grl-apple-trailers.c
+++ b/src/apple-trailers/grl-apple-trailers.c
@@ -114,21 +114,27 @@ grl_apple_trailers_plugin_init (GrlPluginRegistry *registry,
for (; configs; configs = g_list_next (configs)) {
GrlConfig *config;
- const gchar *definition, *poster_size;
+ gchar *definition, *poster_size;
config = GRL_CONFIG (configs->data);
definition = grl_config_get_string (config, "definition");
- if (definition && *definition != '\0') {
- if (g_str_equal (definition, "hd")) {
- hd = TRUE;
+ if (definition) {
+ if (*definition != '\0') {
+ if (g_str_equal (definition, "hd")) {
+ hd = TRUE;
+ }
}
+ g_free (definition);
}
poster_size = grl_config_get_string (config, "poster-size");
- if (poster_size && *poster_size != '\0') {
- if (g_str_equal (poster_size, "xlarge")) {
- xlarge = TRUE;
+ if (poster_size) {
+ if (*poster_size != '\0') {
+ if (g_str_equal (poster_size, "xlarge")) {
+ xlarge = TRUE;
+ }
}
+ g_free (poster_size);
}
}
diff --git a/src/filesystem/grl-filesystem.c b/src/filesystem/grl-filesystem.c
index 3933a6a..475620d 100644
--- a/src/filesystem/grl-filesystem.c
+++ b/src/filesystem/grl-filesystem.c
@@ -152,16 +152,14 @@ grl_filesystem_plugin_init (GrlPluginRegistry *registry,
NULL);
for (; configs; configs = g_list_next (configs)) {
- const gchar *path;
- const GValue *value;
+ gchar *path;
config = GRL_CONFIG (configs->data);
path = grl_config_get_string (config, GRILO_CONF_CHOSEN_PATH);
if (path) {
- chosen_paths = g_list_append (chosen_paths, g_strdup (path));
+ chosen_paths = g_list_append (chosen_paths, path);
}
- value = grl_config_get (config, GRILO_CONF_MAX_SEARCH_DEPTH);
- if (value && G_VALUE_HOLDS_INT (value)) {
- max_search_depth = (guint)g_value_get_int (value);
+ if (grl_config_has_param (config, GRILO_CONF_MAX_SEARCH_DEPTH)) {
+ max_search_depth = (guint)grl_config_get_int (config, GRILO_CONF_MAX_SEARCH_DEPTH);
}
}
source->priv->chosen_paths = chosen_paths;
diff --git a/src/flickr/grl-flickr.c b/src/flickr/grl-flickr.c
index cbd08b6..0869e4f 100644
--- a/src/flickr/grl-flickr.c
+++ b/src/flickr/grl-flickr.c
@@ -117,9 +117,9 @@ grl_flickr_plugin_init (GrlPluginRegistry *registry,
const GrlPluginInfo *plugin,
GList *configs)
{
- const gchar *flickr_key;
- const gchar *flickr_secret;
- const gchar *flickr_token;
+ gchar *flickr_key;
+ gchar *flickr_secret;
+ gchar *flickr_token;
GrlConfig *config;
gboolean public_source_created = FALSE;
@@ -157,6 +157,13 @@ grl_flickr_plugin_init (GrlPluginRegistry *registry,
NULL);
}
+ if (flickr_key != NULL)
+ g_free (flickr_key);
+ if (flickr_token != NULL)
+ g_free (flickr_token);
+ if (flickr_secret != NULL)
+ g_free (flickr_secret);
+
configs = g_list_next (configs);
}
diff --git a/src/vimeo/grl-vimeo.c b/src/vimeo/grl-vimeo.c
index 2664232..f3c513a 100644
--- a/src/vimeo/grl-vimeo.c
+++ b/src/vimeo/grl-vimeo.c
@@ -87,10 +87,11 @@ grl_vimeo_plugin_init (GrlPluginRegistry *registry,
const GrlPluginInfo *plugin,
GList *configs)
{
- const gchar *vimeo_key;
- const gchar *vimeo_secret;
+ gchar *vimeo_key;
+ gchar *vimeo_secret;
GrlConfig *config;
gint config_count;
+ gboolean init_result = FALSE;
GrlVimeoSource *source;
GRL_LOG_DOMAIN_INIT (vimeo_log_domain, "vimeo");
@@ -118,7 +119,7 @@ grl_vimeo_plugin_init (GrlPluginRegistry *registry,
if (!vimeo_key || !vimeo_secret) {
GRL_WARNING ("Required configuration keys not set up");
- return FALSE;
+ goto go_out;
}
source = grl_vimeo_source_new ();
@@ -128,7 +129,16 @@ grl_vimeo_plugin_init (GrlPluginRegistry *registry,
plugin,
GRL_MEDIA_PLUGIN (source),
NULL);
- return TRUE;
+ init_result = TRUE;
+
+ go_out:
+
+ if (vimeo_key != NULL)
+ g_free (vimeo_key);
+ if (vimeo_secret != NULL)
+ g_free (vimeo_secret);
+
+ return init_result;
}
GRL_PLUGIN_REGISTER (grl_vimeo_plugin_init,
diff --git a/src/youtube/grl-youtube.c b/src/youtube/grl-youtube.c
index 8b05047..ccf1a02 100644
--- a/src/youtube/grl-youtube.c
+++ b/src/youtube/grl-youtube.c
@@ -250,7 +250,7 @@ grl_youtube_plugin_init (GrlPluginRegistry *registry,
const GrlPluginInfo *plugin,
GList *configs)
{
- const gchar *api_key;
+ gchar *api_key;
GrlConfig *config;
gint config_count;
@@ -287,6 +287,9 @@ grl_youtube_plugin_init (GrlPluginRegistry *registry,
plugin,
GRL_MEDIA_PLUGIN (source),
NULL);
+
+ g_free (api_key);
+
return TRUE;
}
@@ -655,7 +658,7 @@ build_media_from_entry (GrlMedia *content,
} else if (iter->data == GRL_METADATA_KEY_SITE) {
grl_media_set_site (media, gdata_youtube_video_get_player_uri (video));
} else if (iter->data == GRL_METADATA_KEY_EXTERNAL_URL) {
- grl_media_set_external_url (media,
+ grl_media_set_external_url (media,
gdata_youtube_video_get_player_uri (video));
} else if (iter->data == GRL_METADATA_KEY_RATING) {
gdouble average;
@@ -821,7 +824,7 @@ item_count_cb (GObject *object, GAsyncResult *result, CategoryCountCb *cc)
GDataFeed *feed;
GError *error = NULL;
-
+
feed = gdata_service_query_finish (GDATA_SERVICE (cc->service),
result, &error);
if (error) {
--
1.7.2.3
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]