[telepathy-glib/master] Examples: use TP_PROP constants and tp_asv_new
Simon McVittie
simon.mcvittie at collabora.co.uk
Wed Nov 25 03:34:19 PST 2009
---
examples/cm/callable/media-manager.c | 28 +++++++++------------
examples/cm/channelspecific/room-manager.c | 27 +++++++++------------
examples/cm/contactlist/contact-list-manager.c | 30 +++++++++++------------
examples/cm/echo-message-parts/im-manager.c | 26 +++++++++-----------
examples/cm/echo/im-manager.c | 26 +++++++++-----------
5 files changed, 62 insertions(+), 75 deletions(-)
diff --git a/examples/cm/callable/media-manager.c b/examples/cm/callable/media-manager.c
index 5e21c3d..b1646ed 100644
--- a/examples/cm/callable/media-manager.c
+++ b/examples/cm/callable/media-manager.c
@@ -346,14 +346,14 @@ new_channel (ExampleCallableMediaManager *self,
}
static const gchar * const fixed_properties[] = {
- TP_IFACE_CHANNEL ".ChannelType",
- TP_IFACE_CHANNEL ".TargetHandleType",
+ TP_PROP_CHANNEL_CHANNEL_TYPE,
+ TP_PROP_CHANNEL_TARGET_HANDLE_TYPE,
NULL
};
static const gchar * const allowed_properties[] = {
- TP_IFACE_CHANNEL ".TargetHandle",
- TP_IFACE_CHANNEL ".TargetID",
+ TP_PROP_CHANNEL_TARGET_HANDLE,
+ TP_PROP_CHANNEL_TARGET_ID,
NULL
};
@@ -363,15 +363,11 @@ example_callable_media_manager_foreach_channel_class (
TpChannelManagerChannelClassFunc func,
gpointer user_data)
{
- GHashTable *table = g_hash_table_new_full (g_str_hash, g_str_equal,
- NULL, (GDestroyNotify) tp_g_value_slice_free);
-
- g_hash_table_insert (table, TP_IFACE_CHANNEL ".ChannelType",
- tp_g_value_slice_new_static_string (
- TP_IFACE_CHANNEL_TYPE_STREAMED_MEDIA));
-
- g_hash_table_insert (table, TP_IFACE_CHANNEL ".TargetHandleType",
- tp_g_value_slice_new_uint (TP_HANDLE_TYPE_CONTACT));
+ GHashTable *table = tp_asv_new (
+ TP_PROP_CHANNEL_CHANNEL_TYPE,
+ G_TYPE_STRING, TP_IFACE_CHANNEL_TYPE_STREAMED_MEDIA,
+ TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, G_TYPE_UINT, TP_HANDLE_TYPE_CONTACT,
+ NULL);
func (manager, table, allowed_properties, user_data);
@@ -388,20 +384,20 @@ example_callable_media_manager_request (ExampleCallableMediaManager *self,
GError *error = NULL;
if (tp_strdiff (tp_asv_get_string (request_properties,
- TP_IFACE_CHANNEL ".ChannelType"),
+ TP_PROP_CHANNEL_CHANNEL_TYPE),
TP_IFACE_CHANNEL_TYPE_STREAMED_MEDIA))
{
return FALSE;
}
if (tp_asv_get_uint32 (request_properties,
- TP_IFACE_CHANNEL ".TargetHandleType", NULL) != TP_HANDLE_TYPE_CONTACT)
+ TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, NULL) != TP_HANDLE_TYPE_CONTACT)
{
return FALSE;
}
handle = tp_asv_get_uint32 (request_properties,
- TP_IFACE_CHANNEL ".TargetHandle", NULL);
+ TP_PROP_CHANNEL_TARGET_HANDLE, NULL);
g_assert (handle != 0);
if (tp_channel_manager_asv_has_unknown_properties (request_properties,
diff --git a/examples/cm/channelspecific/room-manager.c b/examples/cm/channelspecific/room-manager.c
index 6853354..a0bbf62 100644
--- a/examples/cm/channelspecific/room-manager.c
+++ b/examples/cm/channelspecific/room-manager.c
@@ -246,14 +246,14 @@ new_channel (ExampleCSHRoomManager *self,
}
static const gchar * const fixed_properties[] = {
- TP_IFACE_CHANNEL ".ChannelType",
- TP_IFACE_CHANNEL ".TargetHandleType",
+ TP_PROP_CHANNEL_CHANNEL_TYPE,
+ TP_PROP_CHANNEL_TARGET_HANDLE_TYPE,
NULL
};
static const gchar * const allowed_properties[] = {
- TP_IFACE_CHANNEL ".TargetHandle",
- TP_IFACE_CHANNEL ".TargetID",
+ TP_PROP_CHANNEL_TARGET_HANDLE,
+ TP_PROP_CHANNEL_TARGET_ID,
NULL
};
@@ -262,14 +262,11 @@ example_csh_room_manager_foreach_channel_class (TpChannelManager *manager,
TpChannelManagerChannelClassFunc func,
gpointer user_data)
{
- GHashTable *table = g_hash_table_new_full (g_str_hash, g_str_equal,
- NULL, (GDestroyNotify) tp_g_value_slice_free);
-
- g_hash_table_insert (table, TP_IFACE_CHANNEL ".ChannelType",
- tp_g_value_slice_new_static_string (TP_IFACE_CHANNEL_TYPE_TEXT));
-
- g_hash_table_insert (table, TP_IFACE_CHANNEL ".TargetHandleType",
- tp_g_value_slice_new_uint (TP_HANDLE_TYPE_ROOM));
+ GHashTable *table = tp_asv_new (
+ TP_PROP_CHANNEL_CHANNEL_TYPE,
+ G_TYPE_STRING, TP_IFACE_CHANNEL_TYPE_TEXT,
+ TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, G_TYPE_UINT, TP_HANDLE_TYPE_ROOM,
+ NULL);
func (manager, table, allowed_properties, user_data);
@@ -287,20 +284,20 @@ example_csh_room_manager_request (ExampleCSHRoomManager *self,
GError *error = NULL;
if (tp_strdiff (tp_asv_get_string (request_properties,
- TP_IFACE_CHANNEL ".ChannelType"),
+ TP_PROP_CHANNEL_CHANNEL_TYPE),
TP_IFACE_CHANNEL_TYPE_TEXT))
{
return FALSE;
}
if (tp_asv_get_uint32 (request_properties,
- TP_IFACE_CHANNEL ".TargetHandleType", NULL) != TP_HANDLE_TYPE_ROOM)
+ TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, NULL) != TP_HANDLE_TYPE_ROOM)
{
return FALSE;
}
handle = tp_asv_get_uint32 (request_properties,
- TP_IFACE_CHANNEL ".TargetHandle", NULL);
+ TP_PROP_CHANNEL_TARGET_HANDLE, NULL);
g_assert (handle != 0);
if (tp_channel_manager_asv_has_unknown_properties (request_properties,
diff --git a/examples/cm/contactlist/contact-list-manager.c b/examples/cm/contactlist/contact-list-manager.c
index 05a1982..bbb2718 100644
--- a/examples/cm/contactlist/contact-list-manager.c
+++ b/examples/cm/contactlist/contact-list-manager.c
@@ -827,14 +827,14 @@ ensure_group (ExampleContactListManager *self,
}
static const gchar * const fixed_properties[] = {
- TP_IFACE_CHANNEL ".ChannelType",
- TP_IFACE_CHANNEL ".TargetHandleType",
+ TP_PROP_CHANNEL_CHANNEL_TYPE,
+ TP_PROP_CHANNEL_TARGET_HANDLE_TYPE,
NULL
};
static const gchar * const allowed_properties[] = {
- TP_IFACE_CHANNEL ".TargetHandle",
- TP_IFACE_CHANNEL ".TargetID",
+ TP_PROP_CHANNEL_TARGET_HANDLE,
+ TP_PROP_CHANNEL_TARGET_ID,
NULL
};
@@ -843,17 +843,15 @@ example_contact_list_manager_foreach_channel_class (TpChannelManager *manager,
TpChannelManagerChannelClassFunc func,
gpointer user_data)
{
- GHashTable *table = g_hash_table_new_full (g_str_hash, g_str_equal,
- NULL, (GDestroyNotify) tp_g_value_slice_free);
-
- 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));
+ GHashTable *table = tp_asv_new (
+ TP_PROP_CHANNEL_CHANNEL_TYPE,
+ G_TYPE_STRING, TP_IFACE_CHANNEL_TYPE_CONTACT_LIST,
+ TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, G_TYPE_UINT, TP_HANDLE_TYPE_LIST,
+ NULL);
+
func (manager, table, allowed_properties, user_data);
- g_hash_table_insert (table, TP_IFACE_CHANNEL ".TargetHandleType",
+ g_hash_table_insert (table, TP_PROP_CHANNEL_TARGET_HANDLE_TYPE,
tp_g_value_slice_new_uint (TP_HANDLE_TYPE_GROUP));
func (manager, table, allowed_properties, user_data);
@@ -872,14 +870,14 @@ example_contact_list_manager_request (ExampleContactListManager *self,
GError *error = NULL;
if (tp_strdiff (tp_asv_get_string (request_properties,
- TP_IFACE_CHANNEL ".ChannelType"),
+ TP_PROP_CHANNEL_CHANNEL_TYPE),
TP_IFACE_CHANNEL_TYPE_CONTACT_LIST))
{
return FALSE;
}
handle_type = tp_asv_get_uint32 (request_properties,
- TP_IFACE_CHANNEL ".TargetHandleType", NULL);
+ TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, NULL);
if (handle_type != TP_HANDLE_TYPE_LIST &&
handle_type != TP_HANDLE_TYPE_GROUP)
@@ -888,7 +886,7 @@ example_contact_list_manager_request (ExampleContactListManager *self,
}
handle = tp_asv_get_uint32 (request_properties,
- TP_IFACE_CHANNEL ".TargetHandle", NULL);
+ TP_PROP_CHANNEL_TARGET_HANDLE, NULL);
g_assert (handle != 0);
if (tp_channel_manager_asv_has_unknown_properties (request_properties,
diff --git a/examples/cm/echo-message-parts/im-manager.c b/examples/cm/echo-message-parts/im-manager.c
index f944e3c..dc7140e 100644
--- a/examples/cm/echo-message-parts/im-manager.c
+++ b/examples/cm/echo-message-parts/im-manager.c
@@ -262,14 +262,14 @@ new_channel (ExampleEcho2ImManager *self,
}
static const gchar * const fixed_properties[] = {
- TP_IFACE_CHANNEL ".ChannelType",
- TP_IFACE_CHANNEL ".TargetHandleType",
+ TP_PROP_CHANNEL_CHANNEL_TYPE,
+ TP_PROP_CHANNEL_TARGET_HANDLE_TYPE,
NULL
};
static const gchar * const allowed_properties[] = {
- TP_IFACE_CHANNEL ".TargetHandle",
- TP_IFACE_CHANNEL ".TargetID",
+ TP_PROP_CHANNEL_TARGET_HANDLE,
+ TP_PROP_CHANNEL_TARGET_ID,
NULL
};
@@ -278,13 +278,11 @@ example_echo_2_im_manager_foreach_channel_class (TpChannelManager *manager,
TpChannelManagerChannelClassFunc func,
gpointer user_data)
{
- GHashTable *table = g_hash_table_new_full (g_str_hash, g_str_equal,
- NULL, (GDestroyNotify) tp_g_value_slice_free);
-
- g_hash_table_insert (table, TP_IFACE_CHANNEL ".ChannelType",
- tp_g_value_slice_new_static_string (TP_IFACE_CHANNEL_TYPE_TEXT));
- g_hash_table_insert (table, TP_IFACE_CHANNEL ".TargetHandleType",
- tp_g_value_slice_new_uint (TP_HANDLE_TYPE_CONTACT));
+ GHashTable *table = tp_asv_new (
+ TP_PROP_CHANNEL_CHANNEL_TYPE,
+ G_TYPE_STRING, TP_IFACE_CHANNEL_TYPE_TEXT,
+ TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, G_TYPE_UINT, TP_HANDLE_TYPE_CONTACT,
+ NULL);
func (manager, table, allowed_properties, user_data);
@@ -302,20 +300,20 @@ example_echo_2_im_manager_request (ExampleEcho2ImManager *self,
GError *error = NULL;
if (tp_strdiff (tp_asv_get_string (request_properties,
- TP_IFACE_CHANNEL ".ChannelType"),
+ TP_PROP_CHANNEL_CHANNEL_TYPE),
TP_IFACE_CHANNEL_TYPE_TEXT))
{
return FALSE;
}
if (tp_asv_get_uint32 (request_properties,
- TP_IFACE_CHANNEL ".TargetHandleType", NULL) != TP_HANDLE_TYPE_CONTACT)
+ TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, NULL) != TP_HANDLE_TYPE_CONTACT)
{
return FALSE;
}
handle = tp_asv_get_uint32 (request_properties,
- TP_IFACE_CHANNEL ".TargetHandle", NULL);
+ TP_PROP_CHANNEL_TARGET_HANDLE, NULL);
g_assert (handle != 0);
if (tp_channel_manager_asv_has_unknown_properties (request_properties,
diff --git a/examples/cm/echo/im-manager.c b/examples/cm/echo/im-manager.c
index 81c89ec..050b3f7 100644
--- a/examples/cm/echo/im-manager.c
+++ b/examples/cm/echo/im-manager.c
@@ -262,14 +262,14 @@ new_channel (ExampleEchoImManager *self,
}
static const gchar * const fixed_properties[] = {
- TP_IFACE_CHANNEL ".ChannelType",
- TP_IFACE_CHANNEL ".TargetHandleType",
+ TP_PROP_CHANNEL_CHANNEL_TYPE,
+ TP_PROP_CHANNEL_TARGET_HANDLE_TYPE,
NULL
};
static const gchar * const allowed_properties[] = {
- TP_IFACE_CHANNEL ".TargetHandle",
- TP_IFACE_CHANNEL ".TargetID",
+ TP_PROP_CHANNEL_TARGET_HANDLE,
+ TP_PROP_CHANNEL_TARGET_ID,
NULL
};
@@ -278,14 +278,12 @@ example_echo_im_manager_foreach_channel_class (TpChannelManager *manager,
TpChannelManagerChannelClassFunc func,
gpointer user_data)
{
- GHashTable *table = g_hash_table_new_full (g_str_hash, g_str_equal,
- NULL, (GDestroyNotify) tp_g_value_slice_free);
-
- g_hash_table_insert (table, TP_IFACE_CHANNEL ".ChannelType",
- tp_g_value_slice_new_static_string (TP_IFACE_CHANNEL_TYPE_TEXT));
+ GHashTable *table = tp_asv_new (
+ TP_PROP_CHANNEL_CHANNEL_TYPE,
+ G_TYPE_STRING, TP_IFACE_CHANNEL_TYPE_TEXT,
+ TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, G_TYPE_UINT, TP_HANDLE_TYPE_CONTACT,
+ NULL);
- g_hash_table_insert (table, TP_IFACE_CHANNEL ".TargetHandleType",
- tp_g_value_slice_new_uint (TP_HANDLE_TYPE_CONTACT));
func (manager, table, allowed_properties, user_data);
@@ -303,20 +301,20 @@ example_echo_im_manager_request (ExampleEchoImManager *self,
GError *error = NULL;
if (tp_strdiff (tp_asv_get_string (request_properties,
- TP_IFACE_CHANNEL ".ChannelType"),
+ TP_PROP_CHANNEL_CHANNEL_TYPE),
TP_IFACE_CHANNEL_TYPE_TEXT))
{
return FALSE;
}
if (tp_asv_get_uint32 (request_properties,
- TP_IFACE_CHANNEL ".TargetHandleType", NULL) != TP_HANDLE_TYPE_CONTACT)
+ TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, NULL) != TP_HANDLE_TYPE_CONTACT)
{
return FALSE;
}
handle = tp_asv_get_uint32 (request_properties,
- TP_IFACE_CHANNEL ".TargetHandle", NULL);
+ TP_PROP_CHANNEL_TARGET_HANDLE, NULL);
g_assert (handle != 0);
if (tp_channel_manager_asv_has_unknown_properties (request_properties,
--
1.5.6.5
More information about the telepathy-commits
mailing list