No issues found
1 /*
2 * This program is free software; you can redistribute it and/or
3 * modify it under the terms of the GNU Lesser General Public
4 * License as published by the Free Software Foundation; either
5 * version 2 of the License, or (at your option) version 3.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10 * Lesser General Public License for more details.
11 *
12 * You should have received a copy of the GNU Lesser General Public
13 * License along with the program; if not, see <http://www.gnu.org/licenses/>
14 *
15 *
16 * Authors:
17 * David Trowbridge <trowbrds@cs.colorado.edu>
18 *
19 * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
20 *
21 */
22
23 #ifdef HAVE_CONFIG_H
24 #include <config.h>
25 #endif
26
27 #include "e-cal-event.h"
28
29 G_DEFINE_TYPE (ECalEvent, e_cal_event, E_TYPE_EVENT)
30
31 static void
32 ece_target_free (EEvent *ev,
33 EEventTarget *t)
34 {
35 switch (t->type) {
36 case E_CAL_EVENT_TARGET_BACKEND: {
37 ECalEventTargetBackend *s = (ECalEventTargetBackend *) t;
38 if (s->shell_backend)
39 g_object_unref (s->shell_backend);
40 break; }
41 }
42
43 E_EVENT_CLASS (e_cal_event_parent_class)->target_free (ev, t);
44 }
45
46 static void
47 e_cal_event_class_init (ECalEventClass *class)
48 {
49 EEventClass *event_class;
50
51 event_class = E_EVENT_CLASS (class);
52 event_class->target_free = ece_target_free;
53 }
54
55 static void
56 e_cal_event_init (ECalEvent *event)
57 {
58 }
59
60 ECalEvent *
61 e_cal_event_peek (void)
62 {
63 static ECalEvent *e_cal_event = NULL;
64 if (!e_cal_event) {
65 e_cal_event = g_object_new (e_cal_event_get_type (), NULL);
66 e_event_construct (
67 &e_cal_event->event,
68 "org.gnome.evolution.calendar.events");
69 }
70 return e_cal_event;
71 }
72
73 ECalEventTargetBackend *
74 e_cal_event_target_new_module (ECalEvent *ece,
75 EShellBackend *shell_backend,
76 guint32 flags)
77 {
78 ECalEventTargetBackend *t;
79
80 t = e_event_target_new (
81 &ece->event, E_CAL_EVENT_TARGET_BACKEND, sizeof (*t));
82
83 t->shell_backend = g_object_ref (shell_backend);
84 t->target.mask = ~flags;
85
86 return t;
87 }