[evolution-patches] VJOURNAL support in file backend
- From: Rodrigo Moya <rodrigo novell com>
- To: Evolution Patches <evolution-patches lists ximian com>
- Subject: [evolution-patches] VJOURNAL support in file backend
- Date: Mon, 16 May 2005 10:25:52 +0200
Hi
I am planning to implement, in my free time, a Notes/Journal component
for Evolution. As a first step, we need to support VJOURNAL in the file
backend, which this patch addresses. Other things might need fixing in
the client API, but I'll fix them as I find them.
Can this be committed to HEAD?
--
Rodrigo Moya <rodrigo novell com>
? config.guess
? config.sub
? depcomp
? install-sh
? ltmain.sh
? missing
? ylwrap
? backends/file/e-cal-backend-file-journal.c
? backends/file/e-cal-backend-file-journal.h
? tests/ecal/test-recur
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/ChangeLog,v
retrieving revision 1.462
diff -u -p -r1.462 ChangeLog
--- ChangeLog 13 May 2005 07:13:29 -0000 1.462
+++ ChangeLog 16 May 2005 08:26:48 -0000
@@ -1,3 +1,15 @@
+xxxx-xx-xx Rodrigo Moya <rodrigo novell com>
+
+ * backends/file/e-cal-backend-file-journal.[ch]: new class to implement
+ VJOURNAL backend.
+
+ * backends/file/e-cal-backend-factory.c (_journal_new_backend,
+ _journal_get_kind, journal_backend_factory_class_init,
+ journal_backend_factory_get_type): new functions for the journal backend.
+ (eds_module_initialize, eds_module_list_types): add the new backend.
+
+ * backends/file/Makefile.am: added new files.
+
2005-05-13 Rodrigo Moya <rodrigo novell com>
* libedata-cal/e-cal-backend.c (e_cal_backend_get_cal_address):
Index: backends/file/Makefile.am
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/backends/file/Makefile.am,v
retrieving revision 1.6
diff -u -p -r1.6 Makefile.am
--- backends/file/Makefile.am 31 Jan 2005 22:48:53 -0000 1.6
+++ backends/file/Makefile.am 16 May 2005 08:26:48 -0000
@@ -17,6 +17,8 @@ libecalbackendfile_la_SOURCES = \
e-cal-backend-file-factory.h\
e-cal-backend-file-events.c\
e-cal-backend-file-events.h\
+ e-cal-backend-file-journal.c\
+ e-cal-backend-file-journal.h\
e-cal-backend-file-todos.c\
e-cal-backend-file-todos.h\
e-cal-backend-file.c \
Index: backends/file/e-cal-backend-file-factory.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/backends/file/e-cal-backend-file-factory.c,v
retrieving revision 1.2
diff -u -p -r1.2 e-cal-backend-file-factory.c
--- backends/file/e-cal-backend-file-factory.c 30 Sep 2004 16:49:48 -0000 1.2
+++ backends/file/e-cal-backend-file-factory.c 16 May 2005 08:26:48 -0000
@@ -16,6 +16,7 @@
#include "e-cal-backend-file-factory.h"
#include "e-cal-backend-file-events.h"
+#include "e-cal-backend-file-journal.h"
#include "e-cal-backend-file-todos.h"
typedef struct {
@@ -53,6 +54,21 @@ _todos_get_kind (ECalBackendFactory *fac
}
static ECalBackend*
+_journal_new_backend (ECalBackendFactory *factory, ESource *source)
+{
+ return g_object_new (e_cal_backend_file_journal_get_type (),
+ "source", source,
+ "kind", ICAL_VJOURNAL_COMPONENT,
+ NULL);
+}
+
+static icalcomponent_kind
+_journal_get_kind (ECalBackendFactory *factory)
+{
+ return ICAL_VJOURNAL_COMPONENT;
+}
+
+static ECalBackend*
_events_new_backend (ECalBackendFactory *factory, ESource *source)
{
return g_object_new (e_cal_backend_file_events_get_type (),
@@ -76,6 +92,14 @@ todos_backend_factory_class_init (ECalBa
}
static void
+journal_backend_factory_class_init (ECalBackendFileFactoryClass *klass)
+{
+ E_CAL_BACKEND_FACTORY_CLASS (klass)->get_protocol = _get_protocol;
+ E_CAL_BACKEND_FACTORY_CLASS (klass)->get_kind = _journal_get_kind;
+ E_CAL_BACKEND_FACTORY_CLASS (klass)->new_backend = _journal_new_backend;
+}
+
+static void
events_backend_factory_class_init (ECalBackendFileFactoryClass *klass)
{
E_CAL_BACKEND_FACTORY_CLASS (klass)->get_protocol = _get_protocol;
@@ -109,6 +133,31 @@ events_backend_factory_get_type (GTypeMo
}
static GType
+journal_backend_factory_get_type (GTypeModule *module)
+{
+ GType type;
+
+ GTypeInfo info = {
+ sizeof (ECalBackendFileFactoryClass),
+ NULL, /* base_class_init */
+ NULL, /* base_class_finalize */
+ (GClassInitFunc) journal_backend_factory_class_init,
+ NULL, /* class_finalize */
+ NULL, /* class_data */
+ sizeof (ECalBackend),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) e_cal_backend_file_factory_instance_init
+ };
+
+ type = g_type_module_register_type (module,
+ E_TYPE_CAL_BACKEND_FACTORY,
+ "ECalBackendFileJournalFactory",
+ &info, 0);
+
+ return type;
+}
+
+static GType
todos_backend_factory_get_type (GTypeModule *module)
{
GType type;
@@ -135,13 +184,14 @@ todos_backend_factory_get_type (GTypeMod
-static GType file_types[2];
+static GType file_types[3];
void
eds_module_initialize (GTypeModule *module)
{
file_types[0] = todos_backend_factory_get_type (module);
file_types[1] = events_backend_factory_get_type (module);
+ file_types[2] = journal_backend_factory_get_type (module);
}
void
@@ -153,5 +203,5 @@ void
eds_module_list_types (const GType **types, int *num_types)
{
*types = file_types;
- *num_types = 2;
+ *num_types = 3;
}
/* Evolution calendar - iCalendar file backend for tasks
*
* Copyright (C) 2005 Novell, Inc.
*
* Authors: Rodrigo Moya <rodrigo novell 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 "e-cal-backend-file-journal.h"
struct _ECalBackendFileJournalPrivate {
};
static void e_cal_backend_file_journal_class_init (ECalBackendFileJournalClass *class);
static void e_cal_backend_file_journal_init (ECalBackendFileJournal *cbfile, ECalBackendFileJournalClass *class);
static void e_cal_backend_file_journal_dispose (GObject *object);
static void e_cal_backend_file_journal_finalize (GObject *object);
static ECalBackendFileClass *parent_class;
/**
* e_cal_backend_file_journal_get_type:
* @void:
*
* Registers the #ECalBackendFileJournal class if necessary, and returns the type ID
* associated to it.
*
* Return value: The type ID of the #ECalBackendFileJournal class.
**/
GType
e_cal_backend_file_journal_get_type (void)
{
static GType e_cal_backend_file_journal_type = 0;
if (!e_cal_backend_file_journal_type) {
static GTypeInfo info = {
sizeof (ECalBackendFileJournalClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) e_cal_backend_file_journal_class_init,
NULL, NULL,
sizeof (ECalBackendFileJournal),
0,
(GInstanceInitFunc) e_cal_backend_file_journal_init
};
e_cal_backend_file_journal_type = g_type_register_static (E_TYPE_CAL_BACKEND_FILE,
"ECalBackendFileJournal", &info, 0);
}
return e_cal_backend_file_journal_type;
}
/* Class initialization function for the journal file backend */
static void
e_cal_backend_file_journal_class_init (ECalBackendFileJournalClass *klass)
{
GObjectClass *object_class;
ECalBackendClass *backend_class;
object_class = G_OBJECT_CLASS (klass);
backend_class = E_CAL_BACKEND_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
object_class->dispose = e_cal_backend_file_journal_dispose;
object_class->finalize = e_cal_backend_file_journal_finalize;
}
/* Object initialization function for the journal file backend */
static void
e_cal_backend_file_journal_init (ECalBackendFileJournal *cbfile, ECalBackendFileJournalClass *klass)
{
ECalBackendFileJournalPrivate *priv;
priv = g_new0 (ECalBackendFileJournalPrivate, 1);
cbfile->priv = priv;
e_cal_backend_file_set_file_name (E_CAL_BACKEND_FILE (cbfile), "journal.ics");
}
/* Dispose handler for the journal file backend */
static void
e_cal_backend_file_journal_dispose (GObject *object)
{
ECalBackendFileJournal *cbfile;
ECalBackendFileJournalPrivate *priv;
cbfile = E_CAL_BACKEND_FILE_JOURNAL (object);
priv = cbfile->priv;
if (G_OBJECT_CLASS (parent_class)->dispose)
(* G_OBJECT_CLASS (parent_class)->dispose) (object);
}
/* Finalize handler for the journal file backend */
static void
e_cal_backend_file_journal_finalize (GObject *object)
{
ECalBackendFileJournal *cbfile;
ECalBackendFileJournalPrivate *priv;
g_return_if_fail (object != NULL);
g_return_if_fail (E_IS_CAL_BACKEND_FILE_JOURNAL (object));
cbfile = E_CAL_BACKEND_FILE_JOURNAL (object);
priv = cbfile->priv;
if (G_OBJECT_CLASS (parent_class)->finalize)
(* G_OBJECT_CLASS (parent_class)->finalize) (object);
}
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* e-cal-backend-file-factory.h
*
* Copyright (C) 2004 Novell, Inc.
*
* 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.
*
* Author: Chris Toshok <toshok ximian com>
*/
#ifndef _E_CAL_BACKEND_FILE_FACTORY_H_
#define _E_CAL_BACKEND_FILE_FACTORY_H_
#include <glib-object.h>
#include "libedata-cal/e-cal-backend-factory.h"
G_BEGIN_DECLS
void eds_module_initialize (GTypeModule *module);
void eds_module_shutdown (void);
void eds_module_list_types (const GType **types, int *num_types);
G_END_DECLS
#endif /* _E_CAL_BACKEND_FILE_FACTORY_H_ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]