[Telepathy-commits] [telepathy-gabble/master] Location: Try to implement D-Bus properties of the Location interface
Alban Crequy
alban.crequy at collabora.co.uk
Sun Feb 1 05:23:56 PST 2009
---
src/conn-location.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++
src/conn-location.h | 6 ++++--
src/connection.c | 10 ++++++++++
3 files changed, 61 insertions(+), 2 deletions(-)
diff --git a/src/conn-location.c b/src/conn-location.c
index 71e835f..9b02c4d 100644
--- a/src/conn-location.c
+++ b/src/conn-location.c
@@ -4,6 +4,10 @@
#include <stdlib.h>
+#define DEBUG_FLAG GABBLE_DEBUG_LOCATION
+
+#include "debug.h"
+#include "extensions/extensions.h"
#include "namespaces.h"
#include "pubsub.h"
@@ -237,3 +241,46 @@ location_iface_init (gpointer g_iface, gpointer iface_data)
#undef IMPLEMENT
}
+void
+conn_location_propeties_getter (GObject *object,
+ GQuark interface,
+ GQuark name,
+ GValue *value,
+ gpointer getter_data)
+{
+ /* GabbleConnection *conn = GABBLE_CONNECTION (object); */
+ GabbleRichPresenceAccessControlType access_control_type =
+ GABBLE_RICH_PRESENCE_ACCESS_CONTROL_TYPE_PUBLISH_LIST;
+
+ if (!tp_strdiff (g_quark_to_string (name), "LocationAccessControlTypes"))
+ {
+ GArray *access_control = g_array_sized_new (FALSE, FALSE,
+ sizeof (GabbleRichPresenceAccessControlType), 1);
+ g_array_append_val (access_control, access_control_type);
+ g_value_take_boxed (value, access_control);
+ }
+ else if (!tp_strdiff (g_quark_to_string (name), "LocationAccessControl"))
+ {
+ GValueArray *access_control = g_value_array_new (2);
+ GValue variant = {0,};
+
+ DEBUG ("%s", g_type_name (G_VALUE_TYPE (value)));
+
+ g_value_init (&variant, G_TYPE_INT); /* random type, it is not used */
+ g_value_set_int (&variant, 1);
+ g_value_array_append (access_control, &variant);
+ g_value_unset (&variant);
+
+ g_value_init (&variant, G_TYPE_STRING); /* random type, it is not used */
+ g_value_set_string (&variant, "");
+ g_value_array_append (access_control, &variant);
+ g_value_unset (&variant);
+
+ g_value_take_boxed (value, access_control);
+ }
+ else
+ {
+ g_assert_not_reached ();
+ }
+}
+
diff --git a/src/conn-location.h b/src/conn-location.h
index 3ec03e0..c041101 100644
--- a/src/conn-location.h
+++ b/src/conn-location.h
@@ -6,8 +6,10 @@
G_BEGIN_DECLS
-void
-location_iface_init (gpointer g_iface, gpointer iface_data);
+void location_iface_init (gpointer g_iface, gpointer iface_data);
+
+void conn_location_propeties_getter (GObject *object, GQuark interface,
+ GQuark name, GValue *value, gpointer getter_data);
G_END_DECLS
diff --git a/src/connection.c b/src/connection.c
index 476263d..eab0313 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -536,12 +536,22 @@ gabble_connection_class_init (GabbleConnectionClass *gabble_connection_class)
{ "GadgetAvailable", NULL, NULL },
{ NULL }
};
+ static TpDBusPropertiesMixinPropImpl location_props[] = {
+ { "LocationAccessControlTypes", NULL, NULL },
+ { "LocationAccessControl", NULL, NULL },
+ { NULL }
+ };
static TpDBusPropertiesMixinIfaceImpl prop_interfaces[] = {
{ GABBLE_IFACE_OLPC_GADGET,
conn_olpc_gadget_properties_getter,
NULL,
olpc_gadget_props,
},
+ { GABBLE_IFACE_CONNECTION_INTERFACE_LOCATION,
+ conn_location_propeties_getter,
+ NULL,
+ location_props,
+ },
{ NULL }
};
--
1.5.6.5
More information about the Telepathy-commits
mailing list