[grilo-plugins] vimeo: Add format configuration
- From: Juan A. Suarez Romero <jasuarez src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [grilo-plugins] vimeo: Add format configuration
- Date: Thu, 29 Nov 2012 16:12:53 +0000 (UTC)
commit 9bd4cd20ede5203e002c2397bfc048015c5164f0
Author: Juan A. Suarez Romero <jasuarez igalia com>
Date: Thu Nov 29 15:59:44 2012 +0000
vimeo: Add format configuration
"format" which would be passed to quvi.
src/vimeo/grl-vimeo.c | 7 +++++++
src/vimeo/gvimeo.c | 37 +++++++++++++++++++++++++++++++++++++
2 files changed, 44 insertions(+), 0 deletions(-)
---
diff --git a/src/vimeo/grl-vimeo.c b/src/vimeo/grl-vimeo.c
index d86550b..a9f02ac 100644
--- a/src/vimeo/grl-vimeo.c
+++ b/src/vimeo/grl-vimeo.c
@@ -102,6 +102,7 @@ grl_vimeo_plugin_init (GrlRegistry *registry,
{
gchar *vimeo_key;
gchar *vimeo_secret;
+ gchar *format;
GrlConfig *config;
gint config_count;
gboolean init_result = FALSE;
@@ -141,6 +142,12 @@ grl_vimeo_plugin_init (GrlRegistry *registry,
source = grl_vimeo_source_new ();
source->priv->vimeo = g_vimeo_new (vimeo_key, vimeo_secret);
+ format = grl_config_get_string (config, "format");
+ if (format) {
+ g_object_set (source->priv->vimeo, "quvi-format", format, NULL);
+ g_free (format);
+ }
+
grl_registry_register_source (registry,
plugin,
GRL_SOURCE (source),
diff --git a/src/vimeo/gvimeo.c b/src/vimeo/gvimeo.c
index e8f595d..45f6de2 100644
--- a/src/vimeo/gvimeo.c
+++ b/src/vimeo/gvimeo.c
@@ -58,6 +58,11 @@
"&per_page=%d" \
"&query=%s"
+enum {
+ PROP_0,
+ PROP_QUVI_FORMAT
+};
+
typedef struct {
GVimeo *vimeo;
GVimeoVideoSearchCb search_cb;
@@ -100,6 +105,10 @@ static VideoInfo video_info[] = {{SIMPLE, VIMEO_VIDEO_TITLE},
static void g_vimeo_finalize (GObject *object);
static void g_vimeo_dispose (GObject *object);
+static void g_vimeo_set_property (GObject *object,
+ guint propid,
+ const GValue *value,
+ GParamSpec *spc);
static gchar * encode_uri (const gchar *uri);
/* -------------------- GOBJECT -------------------- */
@@ -112,6 +121,17 @@ g_vimeo_class_init (GVimeoClass *klass)
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
gobject_class->finalize = g_vimeo_finalize;
gobject_class->dispose = g_vimeo_dispose;
+ gobject_class->set_property = g_vimeo_set_property;
+
+ g_object_class_install_property (gobject_class,
+ PROP_QUVI_FORMAT,
+ g_param_spec_string ("quvi-format",
+ "quvi-format",
+ "URL requested format",
+ NULL,
+ G_PARAM_WRITABLE |
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_NAME));
g_type_class_add_private (klass, sizeof (GVimeoPrivate));
}
@@ -166,6 +186,23 @@ g_vimeo_new (const gchar *api_key, const gchar *auth_secret)
return vimeo;
}
+static void
+g_vimeo_set_property (GObject *object,
+ guint propid,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ switch (propid) {
+ case PROP_QUVI_FORMAT:
+ quvi_setopt (G_VIMEO (object)->priv->quvi_handler,
+ QUVIOPT_FORMAT,
+ g_value_get_string (value));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, propid, pspec);
+ }
+}
+
/* -------------------- PRIVATE API -------------------- */
static gchar *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]