root/trunk/libtinymailui/tny-account-store-view.c

Revision 3666 (checked in by jdapena, 7 months ago)

* Use GOnce registering all types in tinymail to make

registering thread-safe.

Line 
1 /* libtinymailui - The Tiny Mail UI library
2  * Copyright (C) 2006-2007 Philip Van Hoof <pvanhoof@gnome.org>
3  *
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.
8  *
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.
13  *
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., 51 Franklin Street, Fifth Floor,
17  * Boston, MA 02110-1301, USA.
18  */
19
20
21 /**
22  * TnyAccountStoreView:
23  *
24  * A view for a #TnyAccountStore
25  *
26  * free-function: g_object_unref
27  **/
28
29 #include <config.h>
30
31 #include <tny-account-store-view.h>
32
33
34 /**
35  * tny_account_store_view_set_account_store:
36  * @self: A #TnyAccountStoreView
37  * @account_store: A #TnyAccountStore
38  *
39  * Set the account store of the view.
40  *
41  * since: 1.0
42  * audience: application-developer, type-implementer
43  **/
44 void
45 tny_account_store_view_set_account_store (TnyAccountStoreView *self, TnyAccountStore *account_store)
46 {
47 #ifdef DBC /* require */
48         g_assert (TNY_IS_ACCOUNT_STORE_VIEW (self));
49         g_assert (TNY_ACCOUNT_STORE_VIEW_GET_IFACE (self)->set_account_store!= NULL);
50 #endif
51
52         TNY_ACCOUNT_STORE_VIEW_GET_IFACE (self)->set_account_store(self, account_store);
53
54         return;
55 }
56
57 static void
58 tny_account_store_view_base_init (gpointer g_class)
59 {
60         static gboolean initialized = FALSE;
61
62         if (!initialized) {
63                 /* create interface signals here. */
64                 initialized = TRUE;
65         }
66 }
67
68 static gpointer
69 tny_account_store_view_register_type (gpointer notused)
70 {
71         GType type = 0;
72
73         static const GTypeInfo info =
74                 {
75                   sizeof (TnyAccountStoreViewIface),
76                   tny_account_store_view_base_init,   /* base_init */
77                   NULL,   /* base_finalize */
78                   NULL,   /* class_init */
79                   NULL,   /* class_finalize */
80                   NULL,   /* class_data */
81                   0,
82                   0,      /* n_preallocs */
83                   NULL    /* instance_init */
84                 };
85         type = g_type_register_static (G_TYPE_INTERFACE,
86                                        "TnyAccountStoreView", &info, 0);
87
88         g_type_interface_add_prerequisite (type, G_TYPE_OBJECT);
89
90         return GUINT_TO_POINTER (type);
91 }
92
93 GType
94 tny_account_store_view_get_type (void)
95 {
96         static GOnce once = G_ONCE_INIT;
97         g_once (&once, tny_account_store_view_register_type, NULL);
98         return GPOINTER_TO_UINT (once.retval);
99 }
Note: See TracBrowser for help on using the browser.