telepathy-glib: example protocols: update to use get_interfaces_array vfunc

Jonny Lamb jonny at kemper.freedesktop.org
Fri Jul 6 09:09:35 PDT 2012


Module: telepathy-glib
Branch: master
Commit: ec9a04f139900957a59630a7f74015f55dffe100
URL:    http://cgit.freedesktop.org/telepathy/telepathy-glib/commit/?id=ec9a04f139900957a59630a7f74015f55dffe100

Author: Jonny Lamb <jonny.lamb at collabora.co.uk>
Date:   Thu Jul  5 16:52:51 2012 +0100

example protocols: update to use get_interfaces_array vfunc

Signed-off-by: Jonny Lamb <jonny.lamb at collabora.co.uk>

---

 examples/cm/call/protocol.c               |    7 -------
 examples/cm/channelspecific/protocol.c    |    7 -------
 examples/cm/contactlist/protocol.c        |    7 -------
 examples/cm/echo-message-parts/protocol.c |   21 ++++++++++++---------
 examples/cm/extended/protocol.c           |    7 -------
 5 files changed, 12 insertions(+), 37 deletions(-)

diff --git a/examples/cm/call/protocol.c b/examples/cm/call/protocol.c
index 4233fde..f65c99f 100644
--- a/examples/cm/call/protocol.c
+++ b/examples/cm/call/protocol.c
@@ -134,12 +134,6 @@ identify_account (TpBaseProtocol *self G_GNUC_UNUSED,
   return NULL;
 }
 
-static GStrv
-get_interfaces (TpBaseProtocol *self)
-{
-  return NULL;
-}
-
 static void
 get_connection_details (TpBaseProtocol *self G_GNUC_UNUSED,
     GStrv *connection_interfaces,
@@ -183,6 +177,5 @@ example_call_protocol_class_init (
 
   base_class->normalize_contact = normalize_contact;
   base_class->identify_account = identify_account;
-  base_class->get_interfaces = get_interfaces;
   base_class->get_connection_details = get_connection_details;
 }
diff --git a/examples/cm/channelspecific/protocol.c b/examples/cm/channelspecific/protocol.c
index 112f7ce..6874689 100644
--- a/examples/cm/channelspecific/protocol.c
+++ b/examples/cm/channelspecific/protocol.c
@@ -174,12 +174,6 @@ identify_account (TpBaseProtocol *self G_GNUC_UNUSED,
   return NULL;
 }
 
-static GStrv
-get_interfaces (TpBaseProtocol *self)
-{
-  return NULL;
-}
-
 static void
 get_connection_details (TpBaseProtocol *self G_GNUC_UNUSED,
     GStrv *connection_interfaces,
@@ -223,6 +217,5 @@ example_csh_protocol_class_init (
 
   base_class->normalize_contact = normalize_contact;
   base_class->identify_account = identify_account;
-  base_class->get_interfaces = get_interfaces;
   base_class->get_connection_details = get_connection_details;
 }
diff --git a/examples/cm/contactlist/protocol.c b/examples/cm/contactlist/protocol.c
index fcc05eb..3f76e17 100644
--- a/examples/cm/contactlist/protocol.c
+++ b/examples/cm/contactlist/protocol.c
@@ -134,12 +134,6 @@ identify_account (TpBaseProtocol *self G_GNUC_UNUSED,
   return NULL;
 }
 
-static GStrv
-get_interfaces (TpBaseProtocol *self)
-{
-  return NULL;
-}
-
 static void
 get_connection_details (TpBaseProtocol *self G_GNUC_UNUSED,
     GStrv *connection_interfaces,
@@ -183,6 +177,5 @@ example_contact_list_protocol_class_init (
 
   base_class->normalize_contact = normalize_contact;
   base_class->identify_account = identify_account;
-  base_class->get_interfaces = get_interfaces;
   base_class->get_connection_details = get_connection_details;
 }
diff --git a/examples/cm/echo-message-parts/protocol.c b/examples/cm/echo-message-parts/protocol.c
index 7981fed..4512216 100644
--- a/examples/cm/echo-message-parts/protocol.c
+++ b/examples/cm/echo-message-parts/protocol.c
@@ -21,11 +21,6 @@ G_DEFINE_TYPE_WITH_CODE (ExampleEcho2Protocol, example_echo_2_protocol,
     TP_TYPE_BASE_PROTOCOL,
     G_IMPLEMENT_INTERFACE (TP_TYPE_PROTOCOL_ADDRESSING, addressing_iface_init))
 
-const gchar * const protocol_interfaces[] = {
-  TP_IFACE_PROTOCOL_INTERFACE_AVATARS,
-  TP_IFACE_PROTOCOL_INTERFACE_ADDRESSING,
-  NULL };
-
 const gchar * const supported_avatar_mime_types[] = {
   "image/png",
   "image/jpeg",
@@ -127,10 +122,18 @@ identify_account (TpBaseProtocol *self G_GNUC_UNUSED,
   return NULL;
 }
 
-static GStrv
-get_interfaces (TpBaseProtocol *self)
+static GPtrArray *
+get_interfaces_array (TpBaseProtocol *self)
 {
-  return g_strdupv ((GStrv) protocol_interfaces);
+  GPtrArray *interfaces;
+
+  interfaces = TP_BASE_PROTOCOL_CLASS (
+      example_echo_2_protocol_parent_class)->get_interfaces_array (self);
+
+  g_ptr_array_add (interfaces, TP_IFACE_PROTOCOL_INTERFACE_AVATARS);
+  g_ptr_array_add (interfaces, TP_IFACE_PROTOCOL_INTERFACE_ADDRESSING);
+
+  return interfaces;
 }
 
 static void
@@ -235,7 +238,7 @@ example_echo_2_protocol_class_init (
 
   base_class->normalize_contact = normalize_contact;
   base_class->identify_account = identify_account;
-  base_class->get_interfaces = get_interfaces;
+  base_class->get_interfaces_array = get_interfaces_array;
   base_class->get_connection_details = get_connection_details;
   base_class->get_avatar_details = get_avatar_details;
 }
diff --git a/examples/cm/extended/protocol.c b/examples/cm/extended/protocol.c
index 0a85a50..0b20659 100644
--- a/examples/cm/extended/protocol.c
+++ b/examples/cm/extended/protocol.c
@@ -106,12 +106,6 @@ identify_account (TpBaseProtocol *self G_GNUC_UNUSED,
   return NULL;
 }
 
-static GStrv
-get_interfaces (TpBaseProtocol *self)
-{
-  return NULL;
-}
-
 static void
 get_connection_details (TpBaseProtocol *self G_GNUC_UNUSED,
     GStrv *connection_interfaces,
@@ -167,6 +161,5 @@ example_extended_protocol_class_init (
 
   base_class->normalize_contact = normalize_contact;
   base_class->identify_account = identify_account;
-  base_class->get_interfaces = get_interfaces;
   base_class->get_connection_details = get_connection_details;
 }



More information about the telepathy-commits mailing list