Fix FSF address (Tobias Mueller, #470445)
[platform/upstream/evolution-data-server.git] / calendar / backends / file / e-cal-backend-file-journal.c
1 /* Evolution calendar - iCalendar file backend for tasks
2  *
3  * Copyright (C) 2005 Novell, Inc.
4  *
5  * Authors: Rodrigo Moya <rodrigo@novell.com>
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of version 2 of the GNU Lesser General Public
9  * License as published by the Free Software Foundation.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19  */
20
21 #include "e-cal-backend-file-journal.h"
22
23 struct _ECalBackendFileJournalPrivate {
24         guint reserved;
25 };
26
27 static void e_cal_backend_file_journal_class_init (ECalBackendFileJournalClass *class);
28 static void e_cal_backend_file_journal_init (ECalBackendFileJournal *cbfile, ECalBackendFileJournalClass *class);
29 static void e_cal_backend_file_journal_dispose (GObject *object);
30 static void e_cal_backend_file_journal_finalize (GObject *object);
31
32 static ECalBackendFileClass *parent_class;
33
34 /**
35  * e_cal_backend_file_journal_get_type:
36  * @void: 
37  * 
38  * Registers the #ECalBackendFileJournal class if necessary, and returns the type ID
39  * associated to it.
40  * 
41  * Return value: The type ID of the #ECalBackendFileJournal class.
42  **/
43 GType
44 e_cal_backend_file_journal_get_type (void)
45 {
46         static GType e_cal_backend_file_journal_type = 0;
47
48         if (!e_cal_backend_file_journal_type) {
49                 static GTypeInfo info = {
50                         sizeof (ECalBackendFileJournalClass),
51                         (GBaseInitFunc) NULL,
52                         (GBaseFinalizeFunc) NULL,
53                         (GClassInitFunc) e_cal_backend_file_journal_class_init,
54                         NULL, NULL,
55                         sizeof (ECalBackendFileJournal),
56                         0,
57                         (GInstanceInitFunc) e_cal_backend_file_journal_init
58                 };
59                 e_cal_backend_file_journal_type = g_type_register_static (E_TYPE_CAL_BACKEND_FILE,
60                                                                           "ECalBackendFileJournal", &info, 0);
61         }
62
63         return e_cal_backend_file_journal_type;
64 }
65
66 /* Class initialization function for the journal file backend */
67 static void
68 e_cal_backend_file_journal_class_init (ECalBackendFileJournalClass *klass)
69 {
70         GObjectClass *object_class;
71         ECalBackendClass *backend_class;
72
73         object_class = G_OBJECT_CLASS (klass);
74         backend_class = E_CAL_BACKEND_CLASS (klass);
75
76         parent_class = g_type_class_peek_parent (klass);
77
78         object_class->dispose = e_cal_backend_file_journal_dispose;
79         object_class->finalize = e_cal_backend_file_journal_finalize;
80 }
81
82 /* Object initialization function for the journal file backend */
83 static void
84 e_cal_backend_file_journal_init (ECalBackendFileJournal *cbfile, ECalBackendFileJournalClass *klass)
85 {
86         ECalBackendFileJournalPrivate *priv;
87
88         priv = g_new0 (ECalBackendFileJournalPrivate, 1);
89         cbfile->priv = priv;
90
91         e_cal_backend_file_set_file_name (E_CAL_BACKEND_FILE (cbfile), "journal.ics");
92 }
93
94 /* Dispose handler for the journal file backend */
95 static void
96 e_cal_backend_file_journal_dispose (GObject *object)
97 {
98         ECalBackendFileJournal *cbfile;
99         ECalBackendFileJournalPrivate *priv;
100
101         cbfile = E_CAL_BACKEND_FILE_JOURNAL (object);
102         priv = cbfile->priv;
103
104         if (G_OBJECT_CLASS (parent_class)->dispose)
105                 (* G_OBJECT_CLASS (parent_class)->dispose) (object);
106 }
107
108 /* Finalize handler for the journal file backend */
109 static void
110 e_cal_backend_file_journal_finalize (GObject *object)
111 {
112         ECalBackendFileJournal *cbfile;
113         ECalBackendFileJournalPrivate *priv;
114
115         g_return_if_fail (object != NULL);
116         g_return_if_fail (E_IS_CAL_BACKEND_FILE_JOURNAL (object));
117
118         cbfile = E_CAL_BACKEND_FILE_JOURNAL (object);
119         priv = cbfile->priv;
120
121         if (G_OBJECT_CLASS (parent_class)->finalize)
122                 (* G_OBJECT_CLASS (parent_class)->finalize) (object);
123 }