root/trunk/libtinymail-tp/tny-tp-mail-notifier.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-gtk - The Tiny Mail UI library for Gtk+
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 #include <config.h>
21
22 #include <glib.h>
23 #include <glib/gi18n-lib.h>
24
25 #include <tny-tp-mail-notifier.h>
26
27
28 static GObjectClass *parent_class;
29
30
31 typedef struct _TnyTpMailNotifierPriv TnyTpMailNotifierPriv;
32
33 struct _TnyTpMailNotifierPriv
34 {
35         int *thing;
36 };
37
38 #define TNY_TP_MAIL_NOTIFIER_GET_PRIVATE(o)     \
39         (G_TYPE_INSTANCE_GET_PRIVATE ((o), TNY_TYPE_TP_MAIL_NOTIFIER, TnyTpMailNotifierPriv))
40
41
42 static void
43 tny_tp_mail_notifier_finalize (GObject *object)
44 {
45         /* TnyTpMailNotifierPriv *priv = TNY_TP_MAIL_NOTIFIER_GET_PRIVATE (object); */
46
47         parent_class->finalize (object);
48
49         return;
50 }
51
52
53 static void
54 tny_tp_mail_notifier_class_init (TnyTpMailNotifierClass *klass)
55 {
56         GObjectClass *object_class;
57
58         object_class = (GObjectClass *)klass;
59         parent_class = g_type_class_peek_parent (klass);
60         object_class->finalize = tny_tp_mail_notifier_finalize;
61         g_type_class_add_private (object_class, sizeof (TnyTpMailNotifierPriv));
62
63         return;
64 }
65
66 static void
67 tny_tp_mail_notifier_init (TnySimpleList *self)
68 {
69         TnyTpMailNotifierPriv *priv = TNY_TP_MAIL_NOTIFIER_GET_PRIVATE (self);
70
71         priv->thing = NULL;
72
73         return;
74 }
75
76
77 /**
78  * tny_tp_mail_notifier_new:
79  * @folder: a #TnyFolder
80  *
81  * Create an observable for GMail's Push E-mail
82  *
83  * Return value: A observable for GMail's Push E-mail
84  **/
85 TnyTpMailNotifier*
86 tny_tp_mail_notifier_new (TnyFolder *folder)
87 {
88         TnyTpMailNotifier *self = g_object_new (TNY_TYPE_TP_MAIL_NOTIFIER, NULL);
89
90         return self;
91 }
92
93 static gpointer
94 tny_tp_mail_notifier_register_type (gpointer notused)
95 {
96         GType object_type = 0;
97
98         static const GTypeInfo object_info =
99                 {
100                         sizeof (TnyTpMailNotifierClass),
101                         NULL,           /* base_init */
102                         NULL,           /* base_finalize */
103                         (GClassInitFunc) tny_tp_mail_notifier_class_init,
104                         NULL,           /* class_finalize */
105                         NULL,           /* class_data */
106                         sizeof (TnyTpMailNotifier),
107                         0,              /* n_preallocs */
108                         (GInstanceInitFunc) tny_tp_mail_notifier_init,
109                         NULL
110                 };
111
112         object_type = g_type_register_static (G_TYPE_OBJECT,
113                                               "TnyTpMailNotifier", &object_info, 0);
114
115         return GUINT_TO_POINTER (object_type);
116 }
117
118 GType
119 tny_tp_mail_notifier_get_type (void)
120 {
121         static GOnce once = G_ONCE_INIT;
122         g_once (&once, tny_tp_mail_notifier_register_type, NULL);
123         return GPOINTER_TO_UINT (once.retval);
124 }
Note: See TracBrowser for help on using the browser.