~ubuntu-branches/ubuntu/maverick/telepathy-salut/maverick

« back to all changes in this revision

Viewing changes to src/salut-contact-channel.c

  • Committer: Bazaar Package Importer
  • Author(s): Laurent Bigonville
  • Date: 2008-09-17 19:03:47 UTC
  • mfrom: (7.1.8 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080917190347-fhkvbcpf8jp8wxkw
Tags: 0.3.3-2
* Use my debian.org address in Uploaders
* debian/patches/fix-activity-announce.patch:
  - Only announce OLPC activity we actually joined (dev.laptop.org #8441)

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
#include <telepathy-glib/util.h>
32
32
 
33
33
static void
34
 
channel_iface_init(gpointer g_iface, gpointer iface_data);
 
34
channel_iface_init (gpointer g_iface, gpointer iface_data);
35
35
 
36
36
G_DEFINE_TYPE_WITH_CODE(SalutContactChannel, salut_contact_channel,
37
37
  G_TYPE_OBJECT,
88
88
 
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);
92
92
 
93
93
  priv = SALUT_CONTACT_CHANNEL_GET_PRIVATE (SALUT_CONTACT_CHANNEL (obj));
94
94
 
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);
98
98
 
99
99
  /* Ref our handle */
100
100
  base_conn = TP_BASE_CONNECTION(priv->conn);
101
101
 
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);
105
106
 
106
 
  tp_handle_ref(handle_repo, priv->handle);
 
107
  tp_handle_ref (handle_repo, priv->handle);
107
108
 
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);
112
113
 
113
 
  tp_group_mixin_change_flags(obj, 0, 0);
 
114
  tp_group_mixin_change_flags (obj, 0, 0);
114
115
  return obj;
115
116
}
116
117
 
171
172
      priv->conn = g_value_get_object (value);
172
173
      break;
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);
176
177
      break;
177
178
    case PROP_CHANNEL_TYPE:
178
 
      tmp = g_value_get_string(value);
179
 
      g_assert(tmp == NULL
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));
182
183
      break;
183
184
    default:
212
213
                                    G_PARAM_STATIC_BLURB);
213
214
  g_object_class_install_property (object_class, PROP_CONNECTION, param_spec);
214
215
 
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,
 
217
      "object-path");
 
218
  g_object_class_override_property (object_class, PROP_CHANNEL_TYPE,
 
219
      "channel-type");
 
220
  g_object_class_override_property (object_class, PROP_HANDLE_TYPE,
 
221
      "handle-type");
218
222
  g_object_class_override_property (object_class, PROP_HANDLE, "handle");
219
223
 
220
 
  tp_group_mixin_class_init(object_class,
221
 
    G_STRUCT_OFFSET(SalutContactChannelClass, group_class),
222
 
    NULL, NULL);
 
224
  tp_group_mixin_class_init (object_class,
 
225
      G_STRUCT_OFFSET (SalutContactChannelClass, group_class),
 
226
      NULL, NULL);
223
227
}
224
228
 
225
229
void
236
240
 
237
241
  priv->dispose_has_run = TRUE;
238
242
 
239
 
  tp_svc_channel_emit_closed(TP_SVC_CHANNEL(object));
 
243
  tp_svc_channel_emit_closed (TP_SVC_CHANNEL (object));
240
244
 
241
 
  tp_handle_unref(handle_repo, priv->handle);
 
245
  tp_handle_unref (handle_repo, priv->handle);
242
246
 
243
247
 
244
248
  /* release any references held by the object here */
254
258
  SalutContactChannelPrivate *priv = SALUT_CONTACT_CHANNEL_GET_PRIVATE (self);
255
259
 
256
260
  /* free any data held directly by the object here */
257
 
  g_free(priv->object_path);
 
261
  g_free (priv->object_path);
258
262
 
259
 
  tp_group_mixin_finalize(object);
 
263
  tp_group_mixin_finalize (object);
260
264
 
261
265
  G_OBJECT_CLASS (salut_contact_channel_parent_class)->finalize (object);
262
266
}
275
279
 */
276
280
static void
277
281
salut_contact_channel_get_channel_type (TpSvcChannel *iface,
278
 
                                        DBusGMethodInvocation *context)
 
282
    DBusGMethodInvocation *context)
279
283
{
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);
282
286
}
283
287
 
328
332
 
329
333
 
330
334
static void
331
 
channel_iface_init(gpointer g_iface, gpointer iface_data)
 
335
channel_iface_init (gpointer g_iface, gpointer iface_data)
332
336
{
333
337
  TpSvcChannelClass *klass = (TpSvcChannelClass *)g_iface;
334
338
 
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);
340
344
#undef IMPLEMENT
341
345
}