[Telepathy-commits] [telepathy-gabble/master] Implement a stub setter to prevent crashing on set fix a type in function names

Pierre-Luc Beaudoin pierre-luc.beaudoin at collabora.co.uk
Sun Feb 1 05:24:02 PST 2009


---
 src/conn-location.c            |   31 ++++++++++++++++++++++++++-----
 src/conn-location.h            |    4 +++-
 src/connection.c               |    4 ++--
 tests/twisted/test-location.py |    4 ++++
 4 files changed, 35 insertions(+), 8 deletions(-)

diff --git a/src/conn-location.c b/src/conn-location.c
index d3280b7..d430987 100644
--- a/src/conn-location.c
+++ b/src/conn-location.c
@@ -212,11 +212,11 @@ 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)
+conn_location_properties_getter (GObject *object,
+                                 GQuark interface,
+                                 GQuark name,
+                                 GValue *value,
+                                 gpointer getter_data)
 {
   if (!tp_strdiff (g_quark_to_string (name), "LocationAccessControlTypes"))
     {
@@ -259,6 +259,27 @@ conn_location_propeties_getter (GObject *object,
     }
 }
 
+gboolean
+conn_location_properties_setter (GObject *object,
+                                GQuark interface,
+                                GQuark name,
+                                const GValue *value,
+                                gpointer setter_data,
+                                GError **error)
+{
+  g_return_val_if_fail (interface ==
+      GABBLE_IFACE_QUARK_CONNECTION_INTERFACE_LOCATION, FALSE);
+
+  if (name != g_quark_from_static_string ("LocationAccessControlType") ||
+      name != g_quark_from_static_string ("LocationAccessControle"))
+    {
+      // Access Control is not yet implemented in conn-location
+      return TRUE;
+    }
+
+  return TRUE;
+}
+
 static gboolean
 update_location_from_msg (GabbleConnection *conn,
                           const gchar *from,
diff --git a/src/conn-location.h b/src/conn-location.h
index 32cf0cc..b773a78 100644
--- a/src/conn-location.h
+++ b/src/conn-location.h
@@ -9,8 +9,10 @@ G_BEGIN_DECLS
 
 void location_iface_init (gpointer g_iface, gpointer iface_data);
 
-void conn_location_propeties_getter (GObject *object, GQuark interface,
+void conn_location_properties_getter (GObject *object, GQuark interface,
     GQuark name, GValue *value, gpointer getter_data);
+gboolean conn_location_properties_setter (GObject *object, GQuark interface,
+    GQuark name, const GValue *value, gpointer setter_data, GError **error);
 
 gboolean geolocation_event_handler (GabbleConnection *conn,
     LmMessage *msg, TpHandle handle);
diff --git a/src/connection.c b/src/connection.c
index eab0313..45a5fdf 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -548,8 +548,8 @@ gabble_connection_class_init (GabbleConnectionClass *gabble_connection_class)
           olpc_gadget_props,
         },
         { GABBLE_IFACE_CONNECTION_INTERFACE_LOCATION,
-          conn_location_propeties_getter,
-          NULL,
+          conn_location_properties_getter,
+          conn_location_properties_setter,
           location_props,
         },
         { NULL }
diff --git a/tests/twisted/test-location.py b/tests/twisted/test-location.py
index 6825bf6..bf82e60 100644
--- a/tests/twisted/test-location.py
+++ b/tests/twisted/test-location.py
@@ -46,6 +46,10 @@ def test(q, bus, conn, stream):
     assert properties.get('LocationAccessControlTypes') == access_control_types
     assert properties.get('LocationAccessControl') == access_control
 
+    # Test setting the properties (even if unimplemented)
+    conn.Set (location_iface, 'LocationAccessControl', access_control,
+        dbus_interface ='org.freedesktop.DBus.Properties')
+
     conn.Location.SetLocation({
         'lat': dbus.Double(0.0, variant_level=1), 'lon': 0.0})
 
-- 
1.5.6.5




More information about the Telepathy-commits mailing list