aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/pcs/cal-backend-file-events.c
blob: a7cf56fac6c3411675de87a3a7cfae251904e36b (plain) (blame)
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
/* Evolution calendar - iCalendar file backend
 *
 * Copyright (C) 2000 Ximian, Inc.
 * Copyright (C) 2000 Ximian, Inc.
 *
 * Authors: Federico Mena-Quintero <federico@ximian.com>
 *          Rodrigo Moya <rodrigo@ximian.com>
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of version 2 of the GNU General Public
 * License as published by the Free Software Foundation.
 *
 * This program 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
 */

#include <config.h>
#include <string.h>
#include <unistd.h>
#include <bonobo/bonobo-exception.h>
#include <bonobo/bonobo-moniker-util.h>
#include <libgnome/gnome-i18n.h>
#include <libgnomevfs/gnome-vfs.h>
#include "e-util/e-xml-hash-utils.h"
#include "cal-util/cal-recur.h"
#include "cal-util/cal-util.h"
#include "cal-backend-file-events.h"
#include "cal-backend-util.h"



/* Private part of the CalBackendFileEvents structure */
struct _CalBackendFileEventsPrivate {
};



static void cal_backend_file_events_class_init (CalBackendFileEventsClass *class);
static void cal_backend_file_events_init (CalBackendFileEvents *cbfile, CalBackendFileEventsClass *class);
static void cal_backend_file_events_dispose (GObject *object);
static void cal_backend_file_events_finalize (GObject *object);

static GObjectClass *parent_class;



/**
 * cal_backend_file_events_get_type:
 * @void: 
 * 
 * Registers the #CalBackendFileEvents class if necessary, and returns the type ID
 * associated to it.
 * 
 * Return value: The type ID of the #CalBackendFileEvents class.
 **/
GType
cal_backend_file_events_get_type (void)
{
    static GType cal_backend_file_events_type = 0;

    if (!cal_backend_file_events_type) {
        static GTypeInfo info = {
                        sizeof (CalBackendFileEventsClass),
                        (GBaseInitFunc) NULL,
                        (GBaseFinalizeFunc) NULL,
                        (GClassInitFunc) cal_backend_file_events_class_init,
                        NULL, NULL,
                        sizeof (CalBackendFileEvents),
                        0,
                        (GInstanceInitFunc) cal_backend_file_events_init
                };
        cal_backend_file_events_type = g_type_register_static (CAL_BACKEND_FILE_TYPE,
                                      "CalBackendFileEvents", &info, 0);
    }

    return cal_backend_file_events_type;
}

/* Class initialization function for the file backend */
static void
cal_backend_file_events_class_init (CalBackendFileEventsClass *klass)
{
    GObjectClass *object_class;
    CalBackendClass *backend_class;

    object_class = G_OBJECT_CLASS (klass);
    backend_class = CAL_BACKEND_CLASS (klass);

    parent_class = g_type_class_peek_parent (klass);

    object_class->dispose = cal_backend_file_events_dispose;
    object_class->finalize = cal_backend_file_events_finalize;

//  backend_class->get_uri = cal_backend_file_events_get_uri;
}

/* Object initialization function for the file backend */
static void
cal_backend_file_events_init (CalBackendFileEvents *cbfile, CalBackendFileEventsClass *class)
{
    CalBackendFileEventsPrivate *priv;

    priv = g_new0 (CalBackendFileEventsPrivate, 1);
    cbfile->priv = priv;

    cal_backend_file_set_file_name (CAL_BACKEND_FILE (cbfile), "calendar.ics");
}

/* Dispose handler for the file backend */
static void
cal_backend_file_events_dispose (GObject *object)
{
    CalBackendFileEvents *cbfile;
    CalBackendFileEventsPrivate *priv;

    cbfile = CAL_BACKEND_FILE_EVENTS (object);
    priv = cbfile->priv;

    if (G_OBJECT_CLASS (parent_class)->dispose)
        (* G_OBJECT_CLASS (parent_class)->dispose) (object);
}

/* Finalize handler for the file backend */
static void
cal_backend_file_events_finalize (GObject *object)
{
    CalBackendFileEvents *cbfile;
    CalBackendFileEventsPrivate *priv;

    g_return_if_fail (object != NULL);
    g_return_if_fail (IS_CAL_BACKEND_FILE_EVENTS (object));

    cbfile = CAL_BACKEND_FILE_EVENTS (object);
    priv = cbfile->priv;

    if (G_OBJECT_CLASS (parent_class)->finalize)
        (* G_OBJECT_CLASS (parent_class)->finalize) (object);
}