[Telepathy-commits] [telepathy-glib/master] contactlist CM: use tp_g_value_slice_new_*()

Simon McVittie simon.mcvittie at collabora.co.uk
Thu Mar 5 03:22:27 PST 2009


---
 examples/cm/contactlist/conn.c                 |    9 ++++-----
 examples/cm/contactlist/contact-list-manager.c |   18 ++++++++----------
 2 files changed, 12 insertions(+), 15 deletions(-)

diff --git a/examples/cm/contactlist/conn.c b/examples/cm/contactlist/conn.c
index 335520e..2349dd7 100644
--- a/examples/cm/contactlist/conn.c
+++ b/examples/cm/contactlist/conn.c
@@ -280,13 +280,12 @@ aliasing_fill_contact_attributes (GObject *object,
   for (i = 0; i < contacts->len; i++)
     {
       TpHandle contact = g_array_index (contacts, guint, i);
-      GValue *value = tp_g_value_slice_new (G_TYPE_STRING);
 
-      g_value_set_string (value,
-          example_contact_list_manager_get_alias (self->priv->list_manager,
-            contact));
       tp_contacts_mixin_set_contact_attribute (attributes, contact,
-          TP_IFACE_CONNECTION_INTERFACE_ALIASING "/alias", value);
+          TP_IFACE_CONNECTION_INTERFACE_ALIASING "/alias",
+          tp_g_value_slice_new_string (
+            example_contact_list_manager_get_alias (self->priv->list_manager,
+              contact)));
     }
 }
 
diff --git a/examples/cm/contactlist/contact-list-manager.c b/examples/cm/contactlist/contact-list-manager.c
index 5a4e380..e522073 100644
--- a/examples/cm/contactlist/contact-list-manager.c
+++ b/examples/cm/contactlist/contact-list-manager.c
@@ -841,18 +841,16 @@ example_contact_list_manager_foreach_channel_class (TpChannelManager *manager,
 {
     GHashTable *table = g_hash_table_new_full (g_str_hash, g_str_equal,
         NULL, (GDestroyNotify) tp_g_value_slice_free);
-    GValue *ctype, *htype;
 
-    ctype = tp_g_value_slice_new (G_TYPE_STRING);
-    g_value_set_static_string (ctype, TP_IFACE_CHANNEL_TYPE_CONTACT_LIST);
-    g_hash_table_insert (table, TP_IFACE_CHANNEL ".ChannelType", ctype);
-
-    htype = tp_g_value_slice_new (G_TYPE_UINT); /* initialized later */
-    g_hash_table_insert (table, TP_IFACE_CHANNEL ".TargetHandleType", htype);
-
-    g_value_set_uint (htype, TP_HANDLE_TYPE_LIST);
+    g_hash_table_insert (table, TP_IFACE_CHANNEL ".ChannelType",
+        tp_g_value_slice_new_static_string (
+          TP_IFACE_CHANNEL_TYPE_CONTACT_LIST));
+    g_hash_table_insert (table, TP_IFACE_CHANNEL ".TargetHandleType",
+        tp_g_value_slice_new_uint (TP_HANDLE_TYPE_LIST));
     func (manager, table, allowed_properties, user_data);
-    g_value_set_uint (htype, TP_HANDLE_TYPE_GROUP);
+
+    g_hash_table_insert (table, TP_IFACE_CHANNEL ".TargetHandleType",
+        tp_g_value_slice_new_uint (TP_HANDLE_TYPE_GROUP));
     func (manager, table, allowed_properties, user_data);
 
     g_hash_table_destroy (table);
-- 
1.5.6.5




More information about the telepathy-commits mailing list