summaryrefslogtreecommitdiff
path: root/telepathy-glib/basic-proxy-factory.c
blob: 6f98799a3698be4d279025c726f7c36f00162f2c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
/*
 * Simple client channel factory creating TpChannel
 *
 * Copyright © 2010 Collabora Ltd.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */

/**
 * SECTION:basic-proxy-factory
 * @title: TpBasicProxyFactory
 * @short_description: channel factory creating TpChannel objects
 * @see_also: #TpAutomaticProxyFactory
 *
 * This factory implements the #TpClientChannelFactory interface to create
 * plain #TpChannel objects. Unlike #TpAutomaticProxyFactory, it will
 * not create higher-level subclasses like #TpStreamTubeChannel.
 * The only feature this factory asks to prepare is #TP_CHANNEL_FEATURE_CORE.
 *
 * TpProxy subclasses other than TpChannel are not currently supported.
 *
 * Since: 0.13.2
 */

/**
 * TpBasicProxyFactory:
 *
 * Data structure representing a #TpBasicProxyFactory
 *
 * Since: 0.13.2
 */

/**
 * TpBasicProxyFactoryClass:
 * @parent_class: the parent class
 *
 * The class of a #TpBasicProxyFactory.
 *
 * Since: 0.13.2
 */

#include "config.h"

#include "telepathy-glib/basic-proxy-factory.h"

#include <telepathy-glib/client-channel-factory.h>

#define DEBUG_FLAG TP_DEBUG_CLIENT
#include "telepathy-glib/debug-internal.h"

/* We rely on the default (lack of) implementation of everything */
G_DEFINE_TYPE_WITH_CODE(TpBasicProxyFactory, tp_basic_proxy_factory, G_TYPE_OBJECT,
    G_IMPLEMENT_INTERFACE (TP_TYPE_CLIENT_CHANNEL_FACTORY, NULL))

static void
tp_basic_proxy_factory_init (TpBasicProxyFactory *self)
{
}

static void
tp_basic_proxy_factory_class_init (TpBasicProxyFactoryClass *cls)
{
}

/**
 * tp_basic_proxy_factory_new:
 *
 * Convenient function to create a new #TpBasicProxyFactory instance.
 *
 * Returns: a new #TpBasicProxyFactory
 *
 * Since: 0.13.2
 * Deprecated: New code should use #TpSimpleClientFactory instead
 */
static TpBasicProxyFactory *
_tp_basic_proxy_factory_new (void)
{
  return g_object_new (TP_TYPE_BASIC_PROXY_FACTORY,
      NULL);
}

TpBasicProxyFactory *
tp_basic_proxy_factory_new (void)
{
  return _tp_basic_proxy_factory_new ();
}

/**
 * tp_basic_proxy_factory_dup:
 *
 * Returns a cached #TpBasicProxyFactory; the same #TpBasicProxyFactory object
 * will be returned by this function repeatedly, as long as at least one
 * reference exists.
 *
 * Returns: (transfer full): a #TpBasicProxyFactory
 *
 * Since: 0.13.2
 * Deprecated: New code should use #TpSimpleClientFactory instead
 */
TpBasicProxyFactory *
tp_basic_proxy_factory_dup (void)
{
  static TpBasicProxyFactory *singleton = NULL;

  if (singleton != NULL)
    return g_object_ref (singleton);

  singleton = _tp_basic_proxy_factory_new ();

  g_object_add_weak_pointer (G_OBJECT (singleton), (gpointer) &singleton);

  return singleton;
}