1
/* libtinymailui - The Tiny Mail user interface library
2
* Copyright (C) 2006-2007 Philip Van Hoof <pvanhoof@gnome.org>
4
* This library is free software; you can redistribute it and/or
5
* modify it under the terms of the GNU Lesser General Public
6
* License as published by the Free Software Foundation; either
7
* version 2 of the License, or (at your option) any later version.
9
* This library is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
* Lesser General Public License for more details.
14
* You should have received a copy of the GNU Lesser General Public
15
* License along with self library; if not, write to the
16
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17
* Boston, MA 02111-1307, USA.
20
/* The reason why this type is defined in libtinymailui rather than libtinymail
21
is because the factory also returns types defined in libtinymailui */
25
#include <tny-platform-factory.h>
29
* tny_platform_factory_new_msg:
30
* @self: a TnyPlatformFactory object
32
* Create a new #TnyMsg instance. The returned instance must be
33
* unreferenced after use.
35
* Implementors: when implementing a platform-specific library, return a
36
* new #TnyMsg instance.
38
* Return value: a #TnyMsg instance
41
tny_platform_factory_new_msg (TnyPlatformFactory *self)
44
if (!TNY_PLATFORM_FACTORY_GET_IFACE (self)->new_msg_func)
45
g_critical ("You must implement tny_platform_factory_new_msg\n");
48
return TNY_PLATFORM_FACTORY_GET_IFACE (self)->new_msg_func (self);
53
* tny_platform_factory_new_password_getter:
54
* @self: a TnyPlatformFactory object
56
* Create a new #TnyPasswordGetter instance. The returned instance must be
57
* unreferenced after use.
59
* Implementors: when implementing a platform-specific library, return a
60
* new #TnyPasswordGetter instance.
62
* Return value: a #TnyPasswordGetter instance
65
tny_platform_factory_new_password_getter (TnyPlatformFactory *self)
68
if (!TNY_PLATFORM_FACTORY_GET_IFACE (self)->new_password_getter_func)
69
g_critical ("You must implement tny_platform_factory_new_password_getter\n");
72
return TNY_PLATFORM_FACTORY_GET_IFACE (self)->new_password_getter_func (self);
76
* tny_platform_factory_new_mime_part:
77
* @self: a TnyPlatformFactory object
79
* Create a new #TnyMimePart instance. The returned instance must be
80
* unreferenced after use.
82
* Implementors: when implementing a platform-specific library, return a
83
* new #TnyMimePart instance.
85
* Return value: a #TnyMimePart instance
88
tny_platform_factory_new_mime_part (TnyPlatformFactory *self)
91
if (!TNY_PLATFORM_FACTORY_GET_IFACE (self)->new_mime_part_func)
92
g_critical ("You must implement tny_platform_factory_new_mime_part\n");
95
return TNY_PLATFORM_FACTORY_GET_IFACE (self)->new_mime_part_func (self);
100
* tny_platform_factory_new_account_store:
101
* @self: a TnyPlatformFactory object
103
* Create a new #TnyAccountStore instance. The returned instance must be
104
* unreferenced after use.
106
* Implementors: when implementing a platform-specific library, return a
107
* new #TnyAccountStore instance. It's allowed to reuse one instance, just
108
* make sure that you add a reference then.
110
* Return value: a #TnyAccountStore instance
113
tny_platform_factory_new_account_store (TnyPlatformFactory *self)
116
if (!TNY_PLATFORM_FACTORY_GET_IFACE (self)->new_account_store_func)
117
g_critical ("You must implement tny_platform_factory_new_account_store\n");
120
return TNY_PLATFORM_FACTORY_GET_IFACE (self)->new_account_store_func (self);
124
* tny_platform_factory_new_device:
125
* @self: a TnyPlatformFactory object
127
* Create a new #TnyDevice instance. The returned instance must be
128
* unreferenced after use.
130
* Implementors: when implementing a platform-specific library, return a
131
* new #TnyDevice instance. It's allowed to reuse one instance, just
132
* make sure that you add a reference then.
134
* Return value: a #TnyDevice instance
138
tny_platform_factory_new_device (TnyPlatformFactory *self)
141
if (!TNY_PLATFORM_FACTORY_GET_IFACE (self)->new_device_func)
142
g_critical ("You must implement tny_platform_factory_new_device\n");
145
return TNY_PLATFORM_FACTORY_GET_IFACE (self)->new_device_func (self);
149
* tny_platform_factory_new_msg_view:
150
* @self: a TnyPlatformFactory object
152
* Create a new #TnyMsgView instance. The returned instance must be
153
* unreferenced after use.
155
* Implementors: when implementing a platform-specific library, return a
156
* new #TnyMsgView instance. It's allowed to reuse one instance, just
157
* make sure that you add a reference then.
159
* Return value: a #TnyMsgView instance
162
tny_platform_factory_new_msg_view (TnyPlatformFactory *self)
165
if (!TNY_PLATFORM_FACTORY_GET_IFACE (self)->new_msg_view_func)
166
g_warning ("You must implement tny_platform_factory_new_msg_view\n");
169
return TNY_PLATFORM_FACTORY_GET_IFACE (self)->new_msg_view_func (self);
174
tny_platform_factory_base_init (gpointer g_class)
176
static gboolean initialized = FALSE;
183
tny_platform_factory_get_type (void)
185
static GType type = 0;
187
if (G_UNLIKELY(type == 0))
189
static const GTypeInfo info =
191
sizeof (TnyPlatformFactoryIface),
192
tny_platform_factory_base_init, /* base_init */
193
NULL, /* base_finalize */
194
NULL, /* class_init */
195
NULL, /* class_finalize */
196
NULL, /* class_data */
199
NULL /* instance_init */
201
type = g_type_register_static (G_TYPE_INTERFACE,
202
"TnyPlatformFactory", &info, 0);
204
g_type_interface_add_prerequisite (type, G_TYPE_OBJECT);