31
31
#include <telepathy-glib/util.h>
34
channel_iface_init(gpointer g_iface, gpointer iface_data);
34
channel_iface_init (gpointer g_iface, gpointer iface_data);
36
36
G_DEFINE_TYPE_WITH_CODE(SalutContactChannel, salut_contact_channel,
89
89
/* Parent constructor chain */
90
90
obj = G_OBJECT_CLASS(salut_contact_channel_parent_class)->
91
constructor(type, n_props, props);
91
constructor (type, n_props, props);
93
93
priv = SALUT_CONTACT_CHANNEL_GET_PRIVATE (SALUT_CONTACT_CHANNEL (obj));
95
95
/* Connect to the bus */
96
96
bus = tp_get_bus ();
97
dbus_g_connection_register_g_object(bus, priv->object_path, obj);
97
dbus_g_connection_register_g_object (bus, priv->object_path, obj);
99
99
/* Ref our handle */
100
100
base_conn = TP_BASE_CONNECTION(priv->conn);
102
handle_repo = tp_base_connection_get_handles(base_conn, TP_HANDLE_TYPE_LIST);
103
contact_repo = tp_base_connection_get_handles(base_conn,
102
handle_repo = tp_base_connection_get_handles (base_conn,
103
TP_HANDLE_TYPE_LIST);
104
contact_repo = tp_base_connection_get_handles (base_conn,
104
105
TP_HANDLE_TYPE_CONTACT);
106
tp_handle_ref(handle_repo, priv->handle);
107
tp_handle_ref (handle_repo, priv->handle);
108
109
/* Impossible to add/remove/rescind on any of our lists */
109
tp_group_mixin_init(obj,
110
G_STRUCT_OFFSET(SalutContactChannel, group),
110
tp_group_mixin_init (obj,
111
G_STRUCT_OFFSET (SalutContactChannel, group),
111
112
contact_repo, base_conn->self_handle);
113
tp_group_mixin_change_flags(obj, 0, 0);
114
tp_group_mixin_change_flags (obj, 0, 0);
171
172
priv->conn = g_value_get_object (value);
173
174
case PROP_HANDLE_TYPE:
174
g_assert(g_value_get_uint(value) == 0
175
|| g_value_get_uint(value) == TP_HANDLE_TYPE_LIST);
175
g_assert (g_value_get_uint (value) == 0
176
|| g_value_get_uint (value) == TP_HANDLE_TYPE_LIST);
177
178
case PROP_CHANNEL_TYPE:
178
tmp = g_value_get_string(value);
180
|| !tp_strdiff(g_value_get_string(value),
179
tmp = g_value_get_string (value);
180
g_assert (tmp == NULL
181
|| !tp_strdiff (g_value_get_string (value),
181
182
TP_IFACE_CHANNEL_TYPE_CONTACT_LIST));
212
213
G_PARAM_STATIC_BLURB);
213
214
g_object_class_install_property (object_class, PROP_CONNECTION, param_spec);
215
g_object_class_override_property (object_class, PROP_OBJECT_PATH, "object-path");
216
g_object_class_override_property (object_class, PROP_CHANNEL_TYPE, "channel-type");
217
g_object_class_override_property (object_class, PROP_HANDLE_TYPE, "handle-type");
216
g_object_class_override_property (object_class, PROP_OBJECT_PATH,
218
g_object_class_override_property (object_class, PROP_CHANNEL_TYPE,
220
g_object_class_override_property (object_class, PROP_HANDLE_TYPE,
218
222
g_object_class_override_property (object_class, PROP_HANDLE, "handle");
220
tp_group_mixin_class_init(object_class,
221
G_STRUCT_OFFSET(SalutContactChannelClass, group_class),
224
tp_group_mixin_class_init (object_class,
225
G_STRUCT_OFFSET (SalutContactChannelClass, group_class),
237
241
priv->dispose_has_run = TRUE;
239
tp_svc_channel_emit_closed(TP_SVC_CHANNEL(object));
243
tp_svc_channel_emit_closed (TP_SVC_CHANNEL (object));
241
tp_handle_unref(handle_repo, priv->handle);
245
tp_handle_unref (handle_repo, priv->handle);
244
248
/* release any references held by the object here */
254
258
SalutContactChannelPrivate *priv = SALUT_CONTACT_CHANNEL_GET_PRIVATE (self);
256
260
/* free any data held directly by the object here */
257
g_free(priv->object_path);
261
g_free (priv->object_path);
259
tp_group_mixin_finalize(object);
263
tp_group_mixin_finalize (object);
261
265
G_OBJECT_CLASS (salut_contact_channel_parent_class)->finalize (object);
277
281
salut_contact_channel_get_channel_type (TpSvcChannel *iface,
278
DBusGMethodInvocation *context)
282
DBusGMethodInvocation *context)
280
tp_svc_channel_return_from_get_channel_type(context,
284
tp_svc_channel_return_from_get_channel_type (context,
281
285
TP_IFACE_CHANNEL_TYPE_CONTACT_LIST);
331
channel_iface_init(gpointer g_iface, gpointer iface_data)
335
channel_iface_init (gpointer g_iface, gpointer iface_data)
333
337
TpSvcChannelClass *klass = (TpSvcChannelClass *)g_iface;
335
339
#define IMPLEMENT(x) tp_svc_channel_implement_##x (\
336
340
klass, salut_contact_channel_##x)
337
IMPLEMENT(get_channel_type);
338
IMPLEMENT(get_handle);
339
IMPLEMENT(get_interfaces);
341
IMPLEMENT (get_channel_type);
342
IMPLEMENT (get_handle);
343
IMPLEMENT (get_interfaces);