[libsocialweb: 3/7] flickr: Use sw_service_map_params()
- From: Eitan Isaacson <eitani src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libsocialweb: 3/7] flickr: Use sw_service_map_params()
- Date: Tue, 1 Mar 2011 21:28:28 +0000 (UTC)
commit 3f5912812d88d934046498266bde96070370b750
Author: Eitan Isaacson <eitan isaacson collabora co uk>
Date: Mon Feb 21 17:17:53 2011 -0800
flickr: Use sw_service_map_params()
services/flickr/flickr.c | 30 +++++++++++++++---------------
1 files changed, 15 insertions(+), 15 deletions(-)
---
diff --git a/services/flickr/flickr.c b/services/flickr/flickr.c
index dc8a795..3cfb449 100644
--- a/services/flickr/flickr.c
+++ b/services/flickr/flickr.c
@@ -65,6 +65,18 @@ struct _SwServiceFlickrPrivate {
gboolean authorised; /* Set if the tokens are valid */
};
+static const ParameterNameMapping upload_params[] = {
+ { "title", "title" },
+ { "description", "description" },
+ { "x-flickr-is-public", "is_public" },
+ { "x-flickr-is-friend", "is_friend" },
+ { "x-flickr-is-family", "is_family" },
+ { "x-flickr-safety-level", "safety_level" },
+ { "x-flickr-content-type", "content_type" },
+ { "x-flickr-hidden", "hidden" },
+ { NULL, NULL }
+};
+
static const char **
get_static_caps (SwService *service)
{
@@ -364,16 +376,6 @@ query_iface_init (gpointer g_iface,
_flickr_query_open_view);
}
-/* If @param_name exists in the DBus parameters, set @flickr_name on the
- RestProxyCall */
-#define MAP_PARAM(param_name, flickr_name) \
- { \
- const char *param; \
- param = g_hash_table_lookup (params_in, param_name); \
- if (param) \
- rest_proxy_call_add_param (call, flickr_name, param); \
- }
-
static gint
_flickr_upload (SwServiceFlickr *self,
const gchar *filename,
@@ -393,11 +395,9 @@ _flickr_upload (SwServiceFlickr *self,
return -1;
}
- /* Now add the parameters that we support */
- MAP_PARAM ("title", "title");
- MAP_PARAM ("x-flickr-is-public", "is_public");
- MAP_PARAM ("x-flickr-is-friend", "is_friend");
- MAP_PARAM ("x-flickr-is-family", "is_family");
+ sw_service_map_params (upload_params, params_in,
+ (SwServiceSetParamFunc) rest_proxy_call_add_param,
+ call);
opid = sw_next_opid ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]