[next] telepathy-haze: Take TpDBusPropertiesMixinClass out of HazeConnectionClass

Simon McVittie smcv at kemper.freedesktop.org
Wed May 7 02:18:33 PDT 2014


Module: telepathy-haze
Branch: next
Commit: 9138e3f4cb6dc260293872d5015b98de85a33b0e
URL:    http://cgit.freedesktop.org/telepathy/telepathy-haze/commit/?id=9138e3f4cb6dc260293872d5015b98de85a33b0e

Author: Simon McVittie <simon.mcvittie at collabora.co.uk>
Date:   Tue Apr 22 12:59:49 2014 +0100

Take TpDBusPropertiesMixinClass out of HazeConnectionClass

It has become part of telepathy-glib-dbus.h, which I'd rather not
include in public headers. Moving the
tp_dbus_properties_mixin_implement_interface() calls into
haze_connection_*_class_init() also decouples the interfaces from the
Connection a little bit.

---

 src/connection-aliasing.c |    8 ++++++--
 src/connection-aliasing.h |    4 ----
 src/connection-avatars.c  |    8 ++++++--
 src/connection-avatars.h  |    4 ----
 src/connection.c          |   26 +++++---------------------
 src/connection.h          |    1 -
 6 files changed, 17 insertions(+), 34 deletions(-)

diff --git a/src/connection-aliasing.c b/src/connection-aliasing.c
index e350cc2..9ff8ef7 100644
--- a/src/connection-aliasing.c
+++ b/src/connection-aliasing.c
@@ -48,9 +48,8 @@ static TpDBusPropertiesMixinPropImpl props[] = {
       { "AliasFlags", GINT_TO_POINTER (DP_FLAGS), NULL },
       { NULL }
 };
-TpDBusPropertiesMixinPropImpl *haze_connection_aliasing_properties = props;
 
-void
+static void
 haze_connection_aliasing_properties_getter (GObject *object,
     GQuark interface,
     GQuark name,
@@ -351,6 +350,11 @@ haze_connection_aliasing_class_init (GObjectClass *object_class)
 
     purple_signal_connect (blist_handle, "blist-node-aliased", object_class,
         PURPLE_CALLBACK (blist_node_aliased_cb), NULL);
+
+    tp_dbus_properties_mixin_implement_interface (object_class,
+        TP_IFACE_QUARK_CONNECTION_INTERFACE_ALIASING1,
+        haze_connection_aliasing_properties_getter, NULL,
+        props);
 }
 
 gboolean
diff --git a/src/connection-aliasing.h b/src/connection-aliasing.h
index 82c4fd5..cd2117d 100644
--- a/src/connection-aliasing.h
+++ b/src/connection-aliasing.h
@@ -31,10 +31,6 @@ void haze_connection_aliasing_iface_init (gpointer g_iface,
     gpointer iface_data);
 void haze_connection_aliasing_class_init (GObjectClass *object_class);
 
-extern TpDBusPropertiesMixinPropImpl *haze_connection_aliasing_properties;
-void haze_connection_aliasing_properties_getter (GObject *object,
-    GQuark interface, GQuark name, GValue *value, gpointer getter_data);
-
 gboolean haze_connection_aliasing_fill_contact_attributes (
     HazeConnection *self,
     const gchar *dbus_interface,
diff --git a/src/connection-avatars.c b/src/connection-avatars.c
index 13df60a..35b53bb 100644
--- a/src/connection-avatars.c
+++ b/src/connection-avatars.c
@@ -89,9 +89,8 @@ static TpDBusPropertiesMixinPropImpl props[] = {
       { "SupportedAvatarMIMETypes", GINT_TO_POINTER (DP_TYPES), NULL },
       { NULL }
 };
-TpDBusPropertiesMixinPropImpl *haze_connection_avatars_properties = props;
 
-void
+static void
 haze_connection_avatars_properties_getter (GObject *object,
                                            GQuark interface,
                                            GQuark name,
@@ -511,6 +510,11 @@ haze_connection_avatars_class_init (GObjectClass *object_class)
 
     purple_signal_connect (blist_handle, "buddy-icon-changed", object_class,
         PURPLE_CALLBACK (buddy_icon_changed_cb), NULL);
+
+    tp_dbus_properties_mixin_implement_interface (object_class,
+        TP_IFACE_QUARK_CONNECTION_INTERFACE_AVATARS1,
+        haze_connection_avatars_properties_getter, NULL,
+        props);
 }
 
 gboolean
diff --git a/src/connection-avatars.h b/src/connection-avatars.h
index 471ebd2..a7ba02c 100644
--- a/src/connection-avatars.h
+++ b/src/connection-avatars.h
@@ -32,10 +32,6 @@
 void haze_connection_avatars_iface_init (gpointer g_iface, gpointer iface_data);
 void haze_connection_avatars_class_init (GObjectClass *object_class);
 
-extern TpDBusPropertiesMixinPropImpl *haze_connection_avatars_properties;
-void haze_connection_avatars_properties_getter (GObject *object,
-    GQuark interface, GQuark name, GValue *value, gpointer getter_data);
-
 void haze_connection_get_icon_spec_requirements (PurpleBuddyIconSpec *icon_spec,
     GStrv *mime_types,
     guint *min_height,
diff --git a/src/connection.c b/src/connection.c
index a719b82..7f4a91c 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -848,22 +848,6 @@ haze_connection_class_init (HazeConnectionClass *klass)
         { "MailAddress", NULL, NULL },
         { NULL }
     };
-    static TpDBusPropertiesMixinIfaceImpl prop_interfaces[] = {
-        { TP_IFACE_CONNECTION_INTERFACE_ALIASING1,
-            haze_connection_aliasing_properties_getter,
-            NULL,
-            NULL },     /* initialized a bit later */
-        { TP_IFACE_CONNECTION_INTERFACE_AVATARS1,
-            haze_connection_avatars_properties_getter,
-            NULL,
-            NULL },     /* initialized a bit later */
-        { TP_IFACE_CONNECTION_INTERFACE_MAIL_NOTIFICATION1,
-            haze_connection_mail_properties_getter,
-            NULL,
-            mail_props,
-        },
-        { NULL }
-    };
 
     DEBUG ("Initializing (HazeConnectionClass *)%p", klass);
 
@@ -912,11 +896,11 @@ haze_connection_class_init (HazeConnectionClass *klass)
         G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
     g_object_class_install_property (object_class, PROP_PRPL_INFO, param_spec);
 
-    prop_interfaces[0].props = haze_connection_aliasing_properties;
-    prop_interfaces[1].props = haze_connection_avatars_properties;
-    klass->properties_class.interfaces = prop_interfaces;
-    tp_dbus_properties_mixin_class_init (object_class,
-        G_STRUCT_OFFSET (HazeConnectionClass, properties_class));
+
+    tp_dbus_properties_mixin_class_init (object_class, 0);
+    tp_dbus_properties_mixin_implement_interface (object_class,
+        TP_IFACE_QUARK_CONNECTION_INTERFACE_MAIL_NOTIFICATION1,
+        haze_connection_mail_properties_getter, NULL, mail_props);
 
     tp_base_contact_list_mixin_class_init (base_class);
 
diff --git a/src/connection.h b/src/connection.h
index 97ba309..1b097fa 100644
--- a/src/connection.h
+++ b/src/connection.h
@@ -38,7 +38,6 @@ typedef struct _HazeConnectionClass HazeConnectionClass;
 
 struct _HazeConnectionClass {
     TpBaseConnectionClass parent_class;
-    TpDBusPropertiesMixinClass properties_class;
     TpPresenceMixinClass presence_class;
 };
 



More information about the telepathy-commits mailing list