[libsocialweb: 1/7] Added sw_service_map_params for cleanly mapping lsw parameters to service parameters.
- From: Eitan Isaacson <eitani src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libsocialweb: 1/7] Added sw_service_map_params for cleanly mapping lsw parameters to service parameters.
- Date: Tue, 1 Mar 2011 21:28:18 +0000 (UTC)
commit c505cf86812d8eda4a34f0df257d87a979999f73
Author: Eitan Isaacson <eitan isaacson collabora co uk>
Date: Thu Feb 24 10:35:06 2011 -0800
Added sw_service_map_params for cleanly mapping lsw parameters
to service parameters.
libsocialweb/sw-service.c | 16 ++++++++++++++++
libsocialweb/sw-service.h | 15 +++++++++++++++
2 files changed, 31 insertions(+), 0 deletions(-)
---
diff --git a/libsocialweb/sw-service.c b/libsocialweb/sw-service.c
index 79ba587..602db83 100644
--- a/libsocialweb/sw-service.c
+++ b/libsocialweb/sw-service.c
@@ -259,4 +259,20 @@ sw_service_has_cap (const char **caps, const char *cap)
return FALSE;
}
+void
+sw_service_map_params (const ParameterNameMapping *mapping,
+ GHashTable *parameters,
+ SwServiceSetParamFunc set_param_func,
+ gpointer remote_call_object)
+{
+ const ParameterNameMapping *param;
+
+ g_return_if_fail (set_param_func != NULL);
+ for (param=mapping; param->lsw_param != NULL; param++) {
+ const char *value = g_hash_table_lookup (parameters, param->lsw_param);
+ if (value != NULL)
+ set_param_func (remote_call_object, param->service_param, value);
+ }
+
+}
diff --git a/libsocialweb/sw-service.h b/libsocialweb/sw-service.h
index 6c8c1b7..e199d03 100644
--- a/libsocialweb/sw-service.h
+++ b/libsocialweb/sw-service.h
@@ -99,6 +99,21 @@ gboolean sw_service_is_uid_banned (SwService *service,
const gchar *uid);
gboolean sw_service_has_cap (const char **caps, const char *cap);
+
+typedef struct {
+ char *lsw_param;
+ char *service_param;
+} ParameterNameMapping;
+
+typedef void (*SwServiceSetParamFunc) (gpointer object,
+ const gchar *param_name,
+ const gchar *patam_value);
+
+void sw_service_map_params (const ParameterNameMapping *mapping,
+ GHashTable *parameters,
+ SwServiceSetParamFunc set_param_func,
+ gpointer remote_call_object);
+
G_END_DECLS
#endif /* _SW_SERVICE */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]