~ubuntu-branches/ubuntu/precise/telepathy-glib/precise-201202222208

« back to all changes in this revision

Viewing changes to examples/future/call-cm/cm.c

  • Committer: Ken VanDine
  • Date: 2012-02-22 18:08:37 UTC
  • mfrom: (1.6.39)
  • Revision ID: ken.vandine@canonical.com-20120222180837-02um6fex0eg073lf
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * manager.c - an example connection manager
3
 
 *
4
 
 * Copyright © 2007-2009 Collabora Ltd. <http://www.collabora.co.uk/>
5
 
 * Copyright © 2007-2009 Nokia Corporation
6
 
 *
7
 
 * This library is free software; you can redistribute it and/or
8
 
 * modify it under the terms of the GNU Lesser General Public
9
 
 * License as published by the Free Software Foundation; either
10
 
 * version 2.1 of the License, or (at your option) any later version.
11
 
 *
12
 
 * This library is distributed in the hope that it will be useful,
13
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15
 
 * Lesser General Public License for more details.
16
 
 *
17
 
 * You should have received a copy of the GNU Lesser General Public
18
 
 * License along with this library; if not, write to the Free Software
19
 
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
20
 
 */
21
 
 
22
 
#include "cm.h"
23
 
 
24
 
#include <dbus/dbus-glib.h>
25
 
 
26
 
#include <telepathy-glib/dbus.h>
27
 
#include <telepathy-glib/errors.h>
28
 
 
29
 
#include "conn.h"
30
 
#include "protocol.h"
31
 
 
32
 
G_DEFINE_TYPE (ExampleCallConnectionManager,
33
 
    example_call_connection_manager,
34
 
    TP_TYPE_BASE_CONNECTION_MANAGER)
35
 
 
36
 
struct _ExampleCallConnectionManagerPrivate
37
 
{
38
 
  int dummy;
39
 
};
40
 
 
41
 
static void
42
 
example_call_connection_manager_init (ExampleCallConnectionManager *self)
43
 
{
44
 
  self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
45
 
      EXAMPLE_TYPE_CALL_CONNECTION_MANAGER,
46
 
      ExampleCallConnectionManagerPrivate);
47
 
}
48
 
 
49
 
static void
50
 
example_call_connection_manager_constructed (GObject *object)
51
 
{
52
 
  ExampleCallConnectionManager *self =
53
 
    EXAMPLE_CALL_CONNECTION_MANAGER (object);
54
 
  TpBaseConnectionManager *base = (TpBaseConnectionManager *) self;
55
 
  void (*constructed) (GObject *) =
56
 
    ((GObjectClass *) example_call_connection_manager_parent_class)->constructed;
57
 
  TpBaseProtocol *protocol;
58
 
 
59
 
  if (constructed != NULL)
60
 
    constructed (object);
61
 
 
62
 
  protocol = g_object_new (EXAMPLE_TYPE_CALL_PROTOCOL,
63
 
      "name", "example",
64
 
      NULL);
65
 
  tp_base_connection_manager_add_protocol (base, protocol);
66
 
  g_object_unref (protocol);
67
 
}
68
 
 
69
 
static void
70
 
example_call_connection_manager_class_init (
71
 
    ExampleCallConnectionManagerClass *klass)
72
 
{
73
 
  GObjectClass *object_class = (GObjectClass *) klass;
74
 
  TpBaseConnectionManagerClass *base_class =
75
 
      (TpBaseConnectionManagerClass *) klass;
76
 
 
77
 
  g_type_class_add_private (klass,
78
 
      sizeof (ExampleCallConnectionManagerPrivate));
79
 
 
80
 
  object_class->constructed = example_call_connection_manager_constructed;
81
 
  base_class->cm_dbus_name = "example_call";
82
 
}