Patches to split evolution-python in EBook and ECal modules
- From: "Lauro Moura" <lauromoura gmail com>
- To: conduit-list gnome org
- Subject: Patches to split evolution-python in EBook and ECal modules
- Date: Wed, 18 Jul 2007 17:48:35 -0300
So, here they go. =)
These patches will break API (hey, we're at 0.0.2 =) but will make it
more flexible, allowing to disable ECal support (enabled by default)
using --enable-ecal=no at configure time.
Instead of 'import evolution', use 'import evolution.ebook' and
'import evolution.ecal'.
- removeEvolution.diff - Remove evolution module, defs, etc.
- configure.ac - Removed evolution checks, split over ebook and ecal.
Added option using AC_ARG_ENABLE
- srcMakefile.am.diff - Same changes to src/Makefile.am. Modules
installed into gtk-2.0/evolution/
- packageinit.diff - __init__.py file for evolution package.
- ebookmodule.diff - EBook module
- ecalmodule.diff - Ecal module
- envirnomentIncludes.diff - use evo-ebook-enviroment or
evo-ecal-enviroment in headers.
Thanks.
--
Lauro Moura ("lmoura" on Freenode)
INdT - Recife
http://lauro.wordpress.com
Index: configure.ac
===================================================================
--- configure.ac (revision 40)
+++ configure.ac (working copy)
@@ -4,7 +4,7 @@
AC_DEFINE(EVOLUTION_MAJOR_VERSION, 0, [Evolution major version])
AC_DEFINE(EVOLUTION_MINOR_VERSION, 0, [Evolution minor version])
AC_DEFINE(EVOLUTION_PATCH_VERSION, 2, [Evolution patch version])
-AC_CONFIG_SRCDIR([src/evolutionmodule.c])
+AC_CONFIG_SRCDIR([src/ebookmodule.c])
AM_INIT_AUTOMAKE
AM_CONFIG_HEADER([src/config.h])
@@ -18,14 +18,30 @@
PKG_CHECK_MODULES([PYGTK], [pygtk-2.0 >= 2.4.0])
AC_SUBST(PYGTK_CFLAGS)
-PKG_CHECK_MODULES([EVOLUTION],
- [ libebook-1.2 >= 1.8.0
- libecal-1.2 >= 1.8.0
+AC_ARG_ENABLE(ecal,
+ AC_HELP_STRING([--enable-ecal], [Enable ECal support]),
+ enable_ecal=$enableval, enable_ecal=yes)
+
+AM_CONDITIONAL([WANT_ECAL], [test "$enable_ecal" = yes])
+
+if test "$enable_ecal" = yes
+then
+ PKG_CHECK_MODULES([ECAL],
+ [ libecal-1.2 >= 1.4.0
+ gdk-pixbuf-2.0
+ pango
+ pygobject-2.0 >= 2.6])
+ AC_SUBST(ECAL_CFLAGS)
+ AC_SUBST(ECAL_LIBS)
+fi
+
+PKG_CHECK_MODULES([EBOOK],
+ [ libebook-1.2 >= 1.4.0
gdk-pixbuf-2.0
pango
pygobject-2.0 >= 2.6])
-AC_SUBST(EVOLUTION_CFLAGS)
-AC_SUBST(EVOLUTION_LIBS)
+AC_SUBST(EBOOK_CFLAGS)
+AC_SUBST(EBOOK_LIBS)
AC_MSG_CHECKING(for pygtk defs)
PYGTK_DEFSDIR=`$PKG_CONFIG --variable=defsdir pygtk-2.0`
Index: src/ebook.defs
===================================================================
--- src/ebook.defs (revision 0)
+++ src/ebook.defs (revision 0)
@@ -0,0 +1,196 @@
+
+;;------------------------------------------------------------------------------
+;; Object Definitions
+;;------------------------------------------------------------------------------
+(define-object EContact
+ (in-module "EBook")
+ (parent "EVCard")
+ (c-name "EContact")
+ (gtype-id "E_TYPE_CONTACT")
+)
+
+(define-object EVCard
+ (in-module "EBook")
+ (parent "GObject")
+ (c-name "EVCard")
+ (gtype-id "E_TYPE_VCARD")
+)
+
+(define-object EBook
+ (in-module "EBook")
+ (parent "GObject")
+ (c-name "EBook")
+ (gtype-id "E_TYPE_BOOK")
+)
+
+;;------------------------------------------------------------------------------
+;; EVContact
+;;------------------------------------------------------------------------------
+(define-function e_contact_new
+ (c-name "e_contact_new")
+ (is-constructor-of "EContact")
+ (return-type "EContact*")
+)
+
+(define-method get_vcard_string
+ (of-object "EContact")
+ (c-name "evo_contact_get_vcard_string")
+ (return-type "char*")
+ (parameters
+ )
+)
+
+(define-method get_name
+ (of-object "EContact")
+ (c-name "evo_contact_get_name")
+ (return-type "char*")
+ (parameters
+ )
+)
+
+(define-method get_uid
+ (of-object "EContact")
+ (c-name "evo_contact_get_uid")
+ (return-type "char*")
+ (parameters
+ )
+)
+
+(define-method get_modified
+ (of-object "EContact")
+ (c-name "evo_contact_get_modified")
+ (return-type "char*")
+ (parameters
+ )
+)
+
+(define-method get_photo
+ (of-object "EContact")
+ (c-name "evo_contact_get_photo")
+ (return-type "GdkPixbuf*")
+ (parameters
+ '("gint" "pixbuf_size")
+ )
+)
+
+;;------------------------------------------------------------------------------
+;; EBook
+;;------------------------------------------------------------------------------
+(define-function e_book_new
+ (c-name "e_book_new")
+ (is-constructor-of "EBook")
+ (return-type "EBook*")
+ (parameters
+ '("ESource*" "source")
+ '("GError**" "error")
+ )
+)
+
+(define-method get_all_contacts
+ (of-object "EBook")
+ (c-name "evo_addressbook_get_all_contacts")
+ (return-type "GList*")
+ (parameters
+ )
+)
+
+(define-method get_contact
+ (of-object "EBook")
+ (c-name "evo_addressbook_get_contact")
+ (return-type "EContact*")
+ (parameters
+ '("const-char*" "uid")
+ )
+)
+
+(define-method get_changed_contacts
+ (of-object "EBook")
+ (c-name "evo_addressbook_get_changed_contacts")
+ (return-type "GList*")
+ (parameters
+ '("const-char*" "change_id")
+ )
+)
+
+(define-method search
+ (of-object "EBook")
+ (c-name "evo_addressbook_free_text_search")
+ (return-type "GList*")
+ (parameters
+ '("const-char*" "query")
+ )
+)
+
+(define-method remove
+ (of-object "EBook")
+ (c-name "e_book_remove")
+ (return-type "gboolean")
+ (parameters
+ '("GError**" "error")
+ )
+)
+
+(define-method remove_contact
+ (of-object "EBook")
+ (c-name "evo_addressbook_remove_contact")
+ (return-type "gboolean")
+ (parameters
+ '("EContact*" "contact")
+ )
+)
+
+(define-method remove_contact_by_id
+ (of-object "EBook")
+ (c-name "e_book_remove_contact")
+ (return-type "gboolean")
+ (parameters
+ '("const-char*" "id")
+ '("GError**" "error")
+ )
+)
+
+(define-method add_contact
+ (of-object "EBook")
+ (c-name "evo_addressbook_add_contact")
+ (return-type "char*")
+ (parameters
+ '("EContact*" "contact")
+ )
+)
+
+(define-method contact_exists
+ (of-object "EBook")
+ (c-name "evo_addressbook_contact_exists")
+ (return-type "gboolean")
+ (parameters
+ '("EContact*" "contact")
+ )
+)
+
+
+;;------------------------------------------------------------------------------
+;; evo-environment
+;;------------------------------------------------------------------------------
+(define-function list_addressbooks
+ (c-name "evo_environment_list_addressbooks")
+ (return-type "GList*")
+ (parameters
+ )
+)
+
+(define-function get_self_contact
+ (c-name "evo_environment_get_self_contact")
+ (return-type "EContact*")
+ (parameters
+ )
+)
+
+(define-function open_addressbook
+ (c-name "evo_addressbook_open")
+ (return-type "EBook*")
+ (parameters
+ '("const-char*" "uri")
+ )
+)
+
+
Index: src/ebookmodule.c
===================================================================
--- src/ebookmodule.c (revision 0)
+++ src/ebookmodule.c (revision 0)
@@ -0,0 +1,54 @@
+/* evolution-python: Python bindings to libecal and libebook
+ * Copyright (c) 2007 John Stowers <john stowers gmail com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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 Library 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., 51 Franklin Street, Fifth Floor Boston, MA 02110-1301, USA
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <pygobject.h>
+
+void pyebook_register_classes(PyObject *d);
+/*void pyebook_add_constants(PyObject *m, const gchar *strip_prefix);*/
+
+extern PyMethodDef pyebook_functions[];
+
+DL_EXPORT(void)
+initebook(void)
+{
+ PyObject *m, *d;
+
+ /* perform any initialisation required by the library here */
+ init_pygobject();
+ //init();
+
+ m = Py_InitModule("ebook", pyebook_functions);
+ d = PyModule_GetDict(m);
+
+ pyebook_register_classes(d);
+
+ /*pyebook_add_constants(m, "E_");*/
+
+ PyModule_AddObject(m, "__version__",
+ Py_BuildValue("iii",
+ EVOLUTION_MAJOR_VERSION,
+ EVOLUTION_MINOR_VERSION,
+ EVOLUTION_PATCH_VERSION));
+
+ if (PyErr_Occurred())
+ Py_FatalError("could not initialise module _ebook");
+}
Index: src/ebook.override
===================================================================
--- src/ebook.override (revision 0)
+++ src/ebook.override (revision 0)
@@ -0,0 +1,172 @@
+/* -*- Mode: C; c-basic-offset: 4 -*- */
+%%
+headers
+#include <time.h>
+#include <Python.h>
+#include "pygobject.h"
+
+#include "override_common.h"
+
+#include "evo-ebook-environment.h"
+#include "evo-contact.h"
+#include "evo-addressbook.h"
+
+static PyObject *
+_helper_wrap_glist_of_evo_locations(GList *locations)
+{
+ PyObject *result;
+ int i;
+
+ if ((result = PyList_New (g_list_length (locations))) == NULL)
+ return NULL;
+
+ i = 0;
+ for (; locations != NULL; locations = locations->next) {
+ evo_location_t *path = (evo_location_t *) locations->data;
+ PyObject *t = PyTuple_New (2);
+ if (path->name == NULL) {
+ Py_INCREF (Py_None);
+ PyTuple_SET_ITEM (t, 0, Py_None);
+ } else {
+ PyTuple_SET_ITEM (t, 0, PyString_FromString(path->name));
+ }
+
+ if (path->uri == NULL) {
+ Py_INCREF (Py_None);
+ PyTuple_SET_ITEM (t, 1, Py_None);
+ } else {
+ PyTuple_SET_ITEM (t, 1, PyString_FromString(path->uri));
+ }
+
+ PyList_SET_ITEM (result, i, t);
+ i++;
+ }
+ return result;
+}
+
+%%
+modulename ebook
+%%
+import gobject.GObject as PyGObject_Type
+%%
+ignore-glob
+ init
+ free_*
+ *_get_type
+%%
+override evo_environment_list_addressbooks noargs
+static PyObject*
+_wrap_evo_environment_list_addressbooks(PyGObject *self)
+{
+ return _helper_wrap_glist_of_evo_locations(evo_environment_list_addressbooks());
+}
+%%
+override evo_addressbook_get_all_contacts noargs
+static PyObject*
+_wrap_evo_addressbook_get_all_contacts(PyGObject *self)
+{
+ GList *contacts = NULL;
+
+ EBookQuery *query = e_book_query_any_field_contains("");
+ e_book_get_contacts(E_BOOK(self->obj), query, &contacts, NULL);
+
+ e_book_query_unref(query);
+
+ return _helper_wrap_gobject_glist(contacts);
+}
+%%
+override evo_addressbook_free_text_search args
+static PyObject*
+_wrap_evo_addressbook_free_text_search(PyGObject *self, PyObject *args)
+{
+ char *query = NULL;
+ GList *list = NULL;
+
+ if (PyArg_ParseTuple(args, "s",&query))
+ {
+ list = evo_addressbook_free_text_search(E_BOOK(self->obj), query);
+ }
+ return _helper_wrap_gobject_glist(list);
+}
+%%
+override evo_addressbook_get_changed_contacts args
+static PyObject *
+_wrap_evo_addressbook_get_changed_contacts(PyGObject *self, PyObject *args)
+{
+ char *change_id = NULL;
+
+ GList *added = NULL;
+ GList *modified = NULL;
+ GList *deleted = NULL;
+
+ if (PyArg_ParseTuple(args, "s",&change_id)) {
+ evo_addressbook_get_changed_contacts(E_BOOK(self->obj), &added, &modified, &deleted, change_id);
+ }
+
+ return Py_BuildValue("OOO",
+ _helper_wrap_gobject_glist(added),
+ _helper_wrap_gobject_glist(modified),
+ _helper_wrap_gobject_glist(deleted)
+ );
+
+}
+%%
+override e_contact_new kwargs
+static int
+_wrap_e_contact_new(PyGObject *self, PyObject *args, PyObject *kwargs)
+{
+ static char *kwlist[] = { "vcard", NULL };
+ gchar *vcard = NULL;
+ EContact *contact = NULL;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|z:EContact.__init__",
+ kwlist, &vcard))
+ return -1;
+
+ if (vcard)
+ contact = (EContact *) e_contact_new_from_vcard(vcard);
+ else
+ contact = (EContact *) e_contact_new();
+
+ if (!contact) {
+ PyErr_SetString(PyExc_RuntimeError, "could not create EContact object");
+ return -1;
+ } else {
+ self->obj = contact;
+ return 0;
+ }
+
+}
+%%
+override evo_contact_get_modified noargs
+static PyObject *
+_wrap_evo_contact_get_modified(PyGObject *self)
+{
+ EContact *contact = NULL;
+ glong seconds = 0;
+ char *timestr = NULL;
+ struct tm *time = NULL;
+
+ contact = E_CONTACT(self->obj);
+ timestr = (char *)e_contact_get(contact, E_CONTACT_REV);
+
+ if (timestr) {
+ time = g_malloc0 (sizeof (struct tm));
+ /* Evolution stores REV field in the following strftime format
+ "%Y-%m-%dT%H:%M:%SZ"
+ Unparse it and reparse it to time since epoch
+ */
+ if (strptime(timestr, "%Y-%m-%dT%H:%M:%SZ", time)) {
+ char seconds_string[25] = {0};
+
+ strftime (seconds_string, sizeof(seconds_string), "%s", time);
+ seconds = strtol(seconds_string, NULL, 10);
+ }
+ }
+
+ g_free(time);
+ g_free(timestr);
+
+ return PyLong_FromLong((long) seconds);
+}
+
Index: src/evo-ebook-environment.c
===================================================================
--- src/evo-ebook-environment.c (revision 0)
+++ src/evo-ebook-environment.c (revision 0)
@@ -0,0 +1,105 @@
+/* evolution-python: Python bindings to libecal and libebook
+ * Copyright (c) 2007 John Stowers <john stowers gmail com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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 Library 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 "evo-ebook-environment.h"
+
+GList *
+evo_environment_list_addressbooks(void)
+{
+ GList *paths = NULL;
+ ESourceList *sources = NULL;
+ ESource *source = NULL;
+ gboolean first = FALSE;
+
+ if (!e_book_get_addressbooks(&sources, NULL)) {
+ return NULL;
+ }
+
+ GSList *g = NULL;
+ for (g = e_source_list_peek_groups (sources); g; g = g->next) {
+ ESourceGroup *group = E_SOURCE_GROUP (g->data);
+ GSList *s = NULL;
+ for (s = e_source_group_peek_sources (group); s; s = s->next) {
+ source = E_SOURCE (s->data);
+ evo_location_t *path = g_malloc0(sizeof(evo_location_t));
+ if (!first) {
+ first = TRUE;
+ path->uri = g_strdup("default");
+ } else {
+ path->uri = g_strdup(e_source_get_uri(source));
+ }
+ path->name = g_strdup(e_source_peek_name(source));
+ paths = g_list_append(paths, path);
+ }
+ }
+ return paths;
+}
+
+ESource *
+evo_environment_find_source(ESourceList *list, char *uri)
+{
+ GSList *g;
+ for (g = e_source_list_peek_groups (list); g; g = g->next) {
+ ESourceGroup *group = E_SOURCE_GROUP (g->data);
+ GSList *s;
+ for (s = e_source_group_peek_sources (group); s; s = s->next) {
+ ESource *source = E_SOURCE (s->data);
+ if (!strcmp(e_source_get_uri(source), uri))
+ return source;
+ }
+ }
+ return NULL;
+}
+
+EContact *
+evo_environment_get_self_contact(void)
+{
+ EContact *contact = NULL;
+ EBook *book = NULL;
+ GError *error = NULL;
+
+ if (!e_book_get_self (&contact, &book, &error)) {
+ if (error->code == E_BOOK_ERROR_PROTOCOL_NOT_SUPPORTED) {
+ g_warning("There was an error while trying to get the addressbook");
+ g_clear_error (&error);
+ return NULL;
+ }
+
+ g_clear_error (&error);
+
+ contact = e_contact_new ();
+
+ if (book == NULL) {
+ book = e_book_new_system_addressbook (&error);
+ if (book == NULL || error != NULL) {
+ g_error ("%s\n", error->message);
+ g_clear_error (&error);
+ }
+
+ if (e_book_open (book, FALSE, NULL) == FALSE) {
+ g_warning("Unable to open address book");
+ g_clear_error (&error);
+ }
+ }
+ }
+
+ g_object_unref (book);
+ return contact;
+}
+
+
Index: src/evo-ebook-environment.h
===================================================================
--- src/evo-ebook-environment.h (revision 0)
+++ src/evo-ebook-environment.h (revision 0)
@@ -0,0 +1,53 @@
+/* evolution-python: Python bindings to libecal and libebook
+ * Copyright (c) 2007 John Stowers <john stowers gmail com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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 Library 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., 51 Franklin Street, Fifth Floor Boston, MA 02110-1301, USA
+ */
+
+#ifndef EVO_ENVIRONMENT_H
+#define EVO_ENVIRONMENT_H
+
+#include <stdio.h>
+#include <string.h>
+
+#include <glib.h>
+#include <glib-object.h>
+
+#include <libebook/e-book.h>
+#include <libebook/e-vcard.h>
+
+#include <gdk-pixbuf/gdk-pixbuf.h>
+#include <pango/pango.h>
+
+G_BEGIN_DECLS
+
+typedef struct evo2_location {
+ char *name;
+ char *uri;
+} evo_location_t;
+
+typedef enum evo_contact_change_type {
+ CHANGE_ADDED,
+ CHANGE_MODIFIED,
+ CHANGE_DELETED
+} evo_change_t;
+
+GList *evo_environment_list_addressbooks(void);
+ESource *evo_environment_find_source(ESourceList *list, char *uri);
+EContact *evo_environment_get_self_contact(void);
+
+G_END_DECLS
+
+#endif /* EVO_ENVIRONMENT_H */
Index: src/ecal.defs
===================================================================
--- src/ecal.defs (revision 0)
+++ src/ecal.defs (revision 0)
@@ -0,0 +1,291 @@
+;; -*- scheme -*-
+;; Enumerations and flags ...
+;;------------------------------------------------------------------------------
+;; Boxed type definitions
+;;------------------------------------------------------------------------------
+(define-enum SourceType
+ (in-module "ECal")
+ (c-name "ECalSourceType")
+ ;(gtype-id "E_TYPE_CAL_SOURCE_TYPE")
+ (values
+ '("event" "E_CAL_SOURCE_TYPE_EVENT")
+ '("todo" "E_CAL_SOURCE_TYPE_TODO")
+ '("journal" "E_CAL_SOURCE_TYPE_JOURNAL")
+ )
+)
+
+(define-enum ComponentVType
+ (in-module "ECal")
+ (c-name "ECalComponentVType")
+; (gtype-id "E_TYPE_CAL_COMPONENT_VTYPE")
+ (values
+; '("no-type" "E_CAL_COMPONENT_NO_TYPE")
+ '("event" "E_CAL_COMPONENT_EVENT")
+ '("todo" "E_CAL_COMPONENT_TODO")
+ '("journal" "E_CAL_COMPONENT_JOURNAL")
+ '("freebusy" "E_CAL_COMPONENT_FREEBUSY")
+ '("timezone" "E_CAL_COMPONENT_TIMEZONE")
+ )
+)
+
+;;------------------------------------------------------------------------------
+;; Object Definitions
+;;------------------------------------------------------------------------------
+
+(define-object ECal
+ (in-module "ECal")
+ (parent "GObject")
+ (c-name "ECal")
+ (gtype-id "E_TYPE_CAL")
+)
+
+(define-object ECalComponent
+ (in-module "ECal")
+ (parent "GObject")
+ (c-name "ECalComponent")
+ (gtype-id "E_TYPE_CAL_COMPONENT")
+)
+
+;;------------------------------------------------------------------------------
+;; ECal
+;;------------------------------------------------------------------------------
+(define-method get_all_objects
+ (of-object "ECal")
+ (c-name "evo_cal_source_get_all_objects")
+ (return-type "GList*")
+ (parameters
+ )
+)
+
+(define-method remove_object
+ (of-object "ECal")
+ (c-name "evo_cal_source_remove_object")
+ (return-type "gboolean")
+ (parameters
+ '("ECalComponent*" "obj")
+ )
+)
+
+(define-method update_object
+ (of-object "ECal")
+ (c-name "evo_cal_source_update_object")
+ (return-type "gboolean")
+ (parameters
+ '("ECalComponent*" "obj")
+ )
+)
+
+(define-method add_object
+ (of-object "ECal")
+ (c-name "evo_cal_source_add_object")
+ (return-type "char*")
+ (parameters
+ '("ECalComponent*" "obj")
+ )
+)
+
+(define-method get_object
+ (of-object "ECal")
+ (c-name "evo_cal_source_get_object")
+ (return-type "ECalComponent*")
+ (parameters
+ '("const-char*" "uid")
+ '("const-char*" "rid")
+ )
+)
+
+
+;;------------------------------------------------------------------------------
+;; ECalComponent
+;;------------------------------------------------------------------------------
+(define-function e_cal_component_new
+ (c-name "e_cal_component_new")
+ (is-constructor-of "ECalComponent")
+ (return-type "ECalComponent*")
+ (parameters
+ '("const-char*" "icard")
+ '("ECalComponentVType" "type")
+ )
+
+)
+
+(define-method get_as_string
+ (of-object "ECalComponent")
+ (c-name "e_cal_component_get_as_string")
+ (return-type "char*")
+)
+
+(define-method get_uid
+ (of-object "ECalComponent")
+ (c-name "evo_cal_component_get_uid")
+ (return-type "char*")
+)
+
+;(define-method set_uid
+; (of-object "ECalComponent")
+; (c-name "e_cal_component_set_uid")
+; (return-type "none")
+; (parameters
+; '("const-char*" "uid")
+; )
+;)
+
+(define-method get_modified
+ (of-object "ECalComponent")
+ (c-name "evo_cal_component_get_modified")
+ (return-type "glong")
+)
+
+(define-method set_modified
+ (of-object "ECalComponent")
+ (c-name "evo_cal_component_set_modified")
+ (return-type "none")
+ (parameters
+ '("glong" "seconds")
+ )
+)
+
+(define-method get_due
+ (of-object "ECalComponent")
+ (c-name "evo_cal_component_get_due")
+ (return-type "glong")
+)
+
+(define-method set_due
+ (of-object "ECalComponent")
+ (c-name "evo_cal_component_set_due")
+ (return-type "none")
+ (parameters
+ '("glong" "seconds" (null-ok))
+ )
+)
+
+(define-method get_categories_list
+ (of-object "ECalComponent")
+ (c-name "evo_cal_component_get_categories_list")
+ (return-type "GSList*")
+ (parameters
+ )
+)
+
+(define-method set_categories_list
+ (of-object "ECalComponent")
+ (c-name "evo_cal_component_set_categories_list")
+ (return-type "none")
+ (parameters
+ '("GSList*" "categories")
+ )
+)
+
+(define-method get_url
+ (of-object "ECalComponent")
+ (c-name "evo_cal_component_get_url")
+ (return-type "char*")
+ (parameters
+ )
+)
+
+(define-method set_url
+ (of-object "ECalComponent")
+ (c-name "evo_cal_component_set_url")
+ (return-type "none")
+ (parameters
+ '("const-char*" "url" (null-ok))
+ )
+)
+
+(define-method get_summary
+ (of-object "ECalComponent")
+ (c-name "evo_cal_component_get_summary")
+ (return-type "char*")
+ (parameters
+ )
+)
+
+(define-method set_summary
+ (of-object "ECalComponent")
+ (c-name "evo_cal_component_set_summary")
+ (return-type "none")
+ (parameters
+ '("const-char*" "summary")
+ )
+)
+
+(define-method get_priority
+ (of-object "ECalComponent")
+ (c-name "evo_cal_component_get_priority")
+ (return-type "int")
+ (parameters
+ )
+)
+
+(define-method set_priority
+ (of-object "ECalComponent")
+ (c-name "evo_cal_component_set_priority")
+ (return-type "none")
+ (parameters
+ '("int" "priority")
+ )
+)
+
+(define-method get_description
+ (of-object "ECalComponent")
+ (c-name "evo_cal_component_get_description")
+ (return-type "char*")
+ (parameters
+ )
+)
+
+(define-method set_description
+ (of-object "ECalComponent")
+ (c-name "evo_cal_component_set_description")
+ (return-type "none")
+ (parameters
+ '("const-char*" "summary")
+ )
+)
+
+;;------------------------------------------------------------------------------
+;; evo-environment
+;;------------------------------------------------------------------------------
+(define-function list_calendars
+ (c-name "evo_environment_list_calendars")
+ (return-type "GList*")
+ (parameters
+ )
+)
+
+(define-function list_task_sources
+ (c-name "evo_environment_list_task_sources")
+ (return-type "GList*")
+ (parameters
+ )
+)
+
+(define-function list_memo_sources
+ (c-name "evo_environment_list_memo_sources")
+ (return-type "GList*")
+ (parameters
+ )
+)
+
+(define-function open_calendar_source
+ (c-name "evo_cal_source_open_source")
+ (return-type "ECal*")
+ (parameters
+ '("const-char*" "uri")
+ '("ECalSourceType" "type")
+ )
+)
+
+(define-function open_calendar_source_new_with_absolute_uri
+ (c-name "evo_cal_source_open_new_with_absolute_uri")
+ (return-type "ECal*")
+ (parameters
+ '("const-char*" "name")
+ '("const-char*" "uri")
+ '("ECalSourceType" "type")
+ )
+)
+
+
Index: src/ecalmodule.c
===================================================================
--- src/ecalmodule.c (revision 0)
+++ src/ecalmodule.c (revision 0)
@@ -0,0 +1,54 @@
+/* evolution-python: Python bindings to libecal and libebook
+ * Copyright (c) 2007 John Stowers <john stowers gmail com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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 Library 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., 51 Franklin Street, Fifth Floor Boston, MA 02110-1301, USA
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <pygobject.h>
+
+void pyecal_register_classes(PyObject *d);
+void pyecal_add_constants(PyObject *m, const gchar *strip_prefix);
+
+extern PyMethodDef pyecal_functions[];
+
+DL_EXPORT(void)
+initecal(void)
+{
+ PyObject *m, *d;
+
+ /* perform any initialisation required by the library here */
+ init_pygobject();
+ //init();
+
+ m = Py_InitModule("ecal", pyecal_functions);
+ d = PyModule_GetDict(m);
+
+ pyecal_register_classes(d);
+
+ pyecal_add_constants(m, "E_");
+
+ PyModule_AddObject(m, "__version__",
+ Py_BuildValue("iii",
+ EVOLUTION_MAJOR_VERSION,
+ EVOLUTION_MINOR_VERSION,
+ EVOLUTION_PATCH_VERSION));
+
+ if (PyErr_Occurred())
+ Py_FatalError("could not initialise module _ecal");
+}
Index: src/ecal.override
===================================================================
--- src/ecal.override (revision 0)
+++ src/ecal.override (revision 0)
@@ -0,0 +1,254 @@
+/* -*- Mode: C; c-basic-offset: 4 -*- */
+%%
+headers
+#include <time.h>
+#include <Python.h>
+#include "pygobject.h"
+
+#include "override_common.h"
+
+#include "evo-ecal-environment.h"
+#include "evo-calendar.h"
+
+static PyObject *
+_helper_wrap_glist_of_evo_locations(GList *locations)
+{
+ PyObject *result;
+ int i;
+
+ if ((result = PyList_New (g_list_length (locations))) == NULL)
+ return NULL;
+
+ i = 0;
+ for (; locations != NULL; locations = locations->next) {
+ evo_location_t *path = (evo_location_t *) locations->data;
+ PyObject *t = PyTuple_New (2);
+ if (path->name == NULL) {
+ Py_INCREF (Py_None);
+ PyTuple_SET_ITEM (t, 0, Py_None);
+ } else {
+ PyTuple_SET_ITEM (t, 0, PyString_FromString(path->name));
+ }
+
+ if (path->uri == NULL) {
+ Py_INCREF (Py_None);
+ PyTuple_SET_ITEM (t, 1, Py_None);
+ } else {
+ PyTuple_SET_ITEM (t, 1, PyString_FromString(path->uri));
+ }
+
+ PyList_SET_ITEM (result, i, t);
+ i++;
+ }
+ return result;
+}
+
+%%
+modulename ecal
+%%
+import gobject.GObject as PyGObject_Type
+%%
+ignore-glob
+ init
+ free_*
+ *_get_type
+%%
+override evo_environment_list_calendars noargs
+static PyObject*
+_wrap_evo_environment_list_calendars(PyGObject *self)
+{
+ GList *list = NULL;
+ list = evo_environment_list_cal_sources(E_CAL_SOURCE_TYPE_EVENT);
+ return _helper_wrap_glist_of_evo_locations(list);
+}
+%%
+override evo_environment_list_task_sources noargs
+static PyObject*
+_wrap_evo_environment_list_task_sources(PyGObject *self)
+{
+ GList *list = NULL;
+ list = evo_environment_list_cal_sources(E_CAL_SOURCE_TYPE_TODO);
+ return _helper_wrap_glist_of_evo_locations(list);
+}
+%%
+override evo_environment_list_memo_sources noargs
+static PyObject*
+_wrap_evo_environment_list_memo_sources(PyGObject *self)
+{
+ GList *list = NULL;
+ list = evo_environment_list_cal_sources(E_CAL_SOURCE_TYPE_JOURNAL);
+ return _helper_wrap_glist_of_evo_locations(list);
+}
+%%
+override evo_cal_source_get_all_objects noargs
+static PyObject*
+_wrap_evo_cal_source_get_all_objects(PyGObject *self)
+{
+ GList *objects = NULL;
+ GError *error = NULL;
+
+ e_cal_get_object_list_as_comp(
+ E_CAL(self->obj),
+ "#t",
+ &objects,
+ &error);
+
+ //Fixme: Check error
+ //evo_cal_source_print_all_objects(E_CAL(self->obj));
+
+ return _helper_wrap_gobject_glist(objects);
+}
+%%
+override e_cal_component_new kwargs
+static int
+_wrap_e_cal_component_new(PyGObject *self, PyObject *args, PyObject *kwargs)
+{
+ static char *kwlist[] = { "ical", "type", NULL };
+ gchar *ical = NULL;
+ int type = E_CAL_COMPONENT_NO_TYPE;
+ ECalComponent *comp = NULL;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i|z:ECalComponent.__init__",
+ kwlist, &type, &ical))
+ return -1;
+
+ if (ical) {
+ comp = (ECalComponent *) e_cal_component_new_from_string(ical);
+ } else {
+ comp = (ECalComponent *) e_cal_component_new();
+ e_cal_component_set_new_vtype(comp, type);
+
+ }
+
+ if (!comp) {
+ PyErr_SetString(PyExc_RuntimeError, "could not create ECalComponent object");
+ return -1;
+ } else {
+ self->obj = comp;
+ return 0;
+ }
+
+}
+
+%%
+override evo_cal_component_get_due noargs
+static PyObject *
+_wrap_evo_cal_component_get_due(PyGObject *self)
+{
+ ECalComponent *calcomponent;
+ ECalComponentDateTime dt;
+ glong t;
+
+ calcomponent = E_CAL_COMPONENT(self->obj);
+ e_cal_component_get_due(calcomponent, &dt);
+
+ if (dt.value == NULL) {
+ e_cal_component_free_datetime(&dt);
+ Py_INCREF(Py_None);
+ return Py_None;
+ }
+ t = icaltime_as_timet_with_zone(*(dt.value),
+ icaltimezone_get_utc_timezone());
+ e_cal_component_free_datetime(&dt);
+ return PyInt_FromLong(t);
+}
+
+%%
+override evo_cal_component_set_due args
+static PyObject *
+_wrap_evo_cal_component_set_due(PyGObject *self, PyObject *args)
+{
+ ECalComponent *calcomponent;
+ ECalComponentDateTime *dt;
+ PyObject* due;
+
+ if (PyTuple_Size(args) != 1) {
+ PyErr_SetString(PyExc_RuntimeError, "ECalComponent.set_due takes exactly 1 argument");
+ return NULL;
+ }
+ calcomponent = E_CAL_COMPONENT(self->obj);
+ due = PyTuple_GET_ITEM(args, 0);
+
+ if (due == Py_None) {
+ // TV-TODO: how to clear the due date do this? gnome bugzilla #452915
+ //e_cal_component_set_due(calcomponent, NULL);
+ icalcomponent *ic = e_cal_component_get_icalcomponent (calcomponent);
+ icalproperty *ip = icalcomponent_get_first_property(ic, ICAL_DUE_PROPERTY);
+ if (ip != NULL) {
+ icalcomponent_remove_property (ic, ip);
+ icalproperty_free (ip);
+ }
+ e_cal_component_set_icalcomponent(calcomponent, ic);
+ e_cal_component_rescan(calcomponent);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+ }
+ else if (! PyInt_Check(due)) {
+ PyErr_SetString(PyExc_RuntimeError, "due date must be int timestamp or None");
+ return NULL;
+ }
+ dt = g_malloc0 (sizeof (ECalComponentDateTime));
+ dt->value = g_malloc0 (sizeof (struct icaltimetype));
+ (*dt->value) = icaltime_from_timet(PyInt_AsLong(due), TRUE);
+ e_cal_component_set_due(calcomponent, dt);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+
+%%
+override evo_cal_component_get_categories_list noargs
+static PyObject *
+_wrap_evo_cal_component_get_categories_list(PyGObject *self)
+{
+ ECalComponent *calcomponent;
+ GSList* categories;
+ GSList* l;
+ PyObject* res;
+ int i = 0;
+
+ calcomponent = E_CAL_COMPONENT(self->obj);
+ e_cal_component_get_categories_list(calcomponent, &categories);
+ if (categories == NULL)
+ return PyList_New(0);
+ res = PyList_New(g_slist_length(categories));
+ for (l = categories; l; l = l->next, i++)
+ PyList_SetItem(res, i, PyString_FromString(l->data));
+ e_cal_component_free_categories_list(categories);
+ return res;
+}
+
+
+%%
+override evo_cal_component_set_categories_list args
+static PyObject *
+_wrap_evo_cal_component_set_categories_list(PyGObject *self, PyObject *args)
+{
+ ECalComponent *calcomponent;
+ GSList* categories = NULL;
+ PyObject* list;
+ char* item;
+ int i;
+
+ // TV-TODO: allow tuple?
+ if (!PyArg_ParseTuple(args, "O!:ECalComponent.set_categories_list",
+ &PyList_Type,&list))
+ return NULL;
+
+ for (i = PyList_Size(list)-1; i >= 0; i--) {
+ item = PyString_AsString(PyList_GetItem(list, i));
+ if (item == NULL) {
+ g_slist_free(categories);
+ return NULL;
+ }
+ categories = g_slist_prepend(categories, item);
+ }
+
+ calcomponent = E_CAL_COMPONENT(self->obj);
+ e_cal_component_set_categories_list(calcomponent, categories);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+
Index: src/evo-ecal-environment.c
===================================================================
--- src/evo-ecal-environment.c (revision 0)
+++ src/evo-ecal-environment.c (revision 0)
@@ -0,0 +1,70 @@
+/* evolution-python: Python bindings to libecal and libebook
+ * Copyright (c) 2007 John Stowers <john stowers gmail com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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 Library 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 "evo-ecal-environment.h"
+
+GList *
+evo_environment_list_cal_sources(ECalSourceType type)
+{
+ GList *paths = NULL;
+ ESourceList *sources = NULL;
+ ESource *source = NULL;
+ gboolean first = FALSE;
+
+ if (!e_cal_get_sources(&sources, type, NULL)) {
+ return NULL;
+ }
+
+ GSList *g = NULL;
+ for (g = e_source_list_peek_groups (sources); g; g = g->next) {
+ ESourceGroup *group = E_SOURCE_GROUP (g->data);
+ GSList *s = NULL;
+ for (s = e_source_group_peek_sources (group); s; s = s->next) {
+ source = E_SOURCE (s->data);
+ evo_location_t *path = g_malloc0(sizeof(evo_location_t));
+ //FIXME: Word around #442187
+ //if (!first) {
+ // first = TRUE;
+ // path->uri = g_strdup("default");
+ //} else {
+ path->uri = g_strdup(e_source_get_uri(source));
+ //}
+ path->name = g_strdup(e_source_peek_name(source));
+ paths = g_list_append(paths, path);
+ }
+ }
+ return paths;
+}
+
+ESource *
+evo_environment_find_source(ESourceList *list, char *uri)
+{
+ GSList *g;
+ for (g = e_source_list_peek_groups (list); g; g = g->next) {
+ ESourceGroup *group = E_SOURCE_GROUP (g->data);
+ GSList *s;
+ for (s = e_source_group_peek_sources (group); s; s = s->next) {
+ ESource *source = E_SOURCE (s->data);
+ if (!strcmp(e_source_get_uri(source), uri))
+ return source;
+ }
+ }
+ return NULL;
+}
+
+
Index: src/evo-ecal-environment.h
===================================================================
--- src/evo-ecal-environment.h (revision 0)
+++ src/evo-ecal-environment.h (revision 0)
@@ -0,0 +1,45 @@
+/* evolution-python: Python bindings to libecal and libebook
+ * Copyright (c) 2007 John Stowers <john stowers gmail com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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 Library 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., 51 Franklin Street, Fifth Floor Boston, MA 02110-1301, USA
+ */
+
+#ifndef EVO_ENVIRONMENT_H
+#define EVO_ENVIRONMENT_H
+
+#include <stdio.h>
+#include <string.h>
+
+#include <glib.h>
+#include <glib-object.h>
+
+#include <libecal/e-cal.h>
+
+#include <gdk-pixbuf/gdk-pixbuf.h>
+#include <pango/pango.h>
+
+G_BEGIN_DECLS
+
+typedef struct evo2_location {
+ char *name;
+ char *uri;
+} evo_location_t;
+
+GList *evo_environment_list_cal_sources(ECalSourceType type);
+ESource *evo_environment_find_source(ESourceList *list, char *uri);
+
+G_END_DECLS
+
+#endif /* EVO_ENVIRONMENT_H */
Index: src/__init__.py
===================================================================
--- src/__init__.py (revision 0)
+++ src/__init__.py (revision 0)
@@ -0,0 +1,25 @@
+# -*- Mode: Python; py-indent-offset: 4 -*-
+# evolution-python - Python bindings to libecal and libebook.
+# Copyright (C) 2007 John Stowers <john stowers gmail com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library 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
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+# USA
+
+import ebook
+
+try:
+ import ecal
+except ImportError, e:
+ ecal = None
Index: src/evo-calendar.h
===================================================================
--- src/evo-calendar.h (revision 40)
+++ src/evo-calendar.h (working copy)
@@ -19,7 +19,7 @@
#ifndef EVO_CALENDAR_H
#define EVO_CALENDAR_H
-#include "evo-environment.h"
+#include "evo-ecal-environment.h"
G_BEGIN_DECLS
Index: src/evo-addressbook.h
===================================================================
--- src/evo-addressbook.h (revision 40)
+++ src/evo-addressbook.h (working copy)
@@ -19,7 +19,7 @@
#ifndef EVO_ADDRESSBOOK_H
#define EVO_ADDRESSBOOK_H
-#include "evo-environment.h"
+#include "evo-ebook-environment.h"
G_BEGIN_DECLS
Index: src/evo-contact.h
===================================================================
--- src/evo-contact.h (revision 40)
+++ src/evo-contact.h (working copy)
@@ -19,7 +19,7 @@
#ifndef EVO_CONTACT_H
#define EVO_CONTACT_H
-#include "evo-environment.h"
+#include "evo-ebook-environment.h"
G_BEGIN_DECLS
--- src/evolutionmodule.c 2007-07-18 14:59:36.000000000 -0300
+++ src/evolutionmodule.c 1969-12-31 21:00:00.000000000 -0300
@@ -1,54 +0,0 @@
-/* evolution-python: Python bindings to libecal and libebook
- * Copyright (c) 2007 John Stowers <john stowers gmail com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * 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 Library 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., 51 Franklin Street, Fifth Floor Boston, MA 02110-1301, USA
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <pygobject.h>
-
-void pyevolution_register_classes(PyObject *d);
-void pyevolution_add_constants(PyObject *m, const gchar *strip_prefix);
-
-extern PyMethodDef pyevolution_functions[];
-
-DL_EXPORT(void)
-initevolution(void)
-{
- PyObject *m, *d;
-
- /* perform any initialisation required by the library here */
- init_pygobject();
- //init();
-
- m = Py_InitModule("evolution", pyevolution_functions);
- d = PyModule_GetDict(m);
-
- pyevolution_register_classes(d);
-
- pyevolution_add_constants(m, "E_");
-
- PyModule_AddObject(m, "__version__",
- Py_BuildValue("iii",
- EVOLUTION_MAJOR_VERSION,
- EVOLUTION_MINOR_VERSION,
- EVOLUTION_PATCH_VERSION));
-
- if (PyErr_Occurred())
- Py_FatalError("could not initialise module _evolution");
-}
--- src/evo-environment.c 2007-07-18 14:59:36.000000000 -0300
+++ src/evo-environment.c 1969-12-31 21:00:00.000000000 -0300
@@ -1,138 +0,0 @@
-/* evolution-python: Python bindings to libecal and libebook
- * Copyright (c) 2007 John Stowers <john stowers gmail com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * 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 Library 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 "evo-environment.h"
-
-GList *
-evo_environment_list_cal_sources(ECalSourceType type)
-{
- GList *paths = NULL;
- ESourceList *sources = NULL;
- ESource *source = NULL;
- gboolean first = FALSE;
-
- if (!e_cal_get_sources(&sources, type, NULL)) {
- return NULL;
- }
-
- GSList *g = NULL;
- for (g = e_source_list_peek_groups (sources); g; g = g->next) {
- ESourceGroup *group = E_SOURCE_GROUP (g->data);
- GSList *s = NULL;
- for (s = e_source_group_peek_sources (group); s; s = s->next) {
- source = E_SOURCE (s->data);
- evo_location_t *path = g_malloc0(sizeof(evo_location_t));
- //FIXME: Word around #442187
- //if (!first) {
- // first = TRUE;
- // path->uri = g_strdup("default");
- //} else {
- path->uri = g_strdup(e_source_get_uri(source));
- //}
- path->name = g_strdup(e_source_peek_name(source));
- paths = g_list_append(paths, path);
- }
- }
- return paths;
-}
-
-GList *
-evo_environment_list_addressbooks(void)
-{
- GList *paths = NULL;
- ESourceList *sources = NULL;
- ESource *source = NULL;
- gboolean first = FALSE;
-
- if (!e_book_get_addressbooks(&sources, NULL)) {
- return NULL;
- }
-
- GSList *g = NULL;
- for (g = e_source_list_peek_groups (sources); g; g = g->next) {
- ESourceGroup *group = E_SOURCE_GROUP (g->data);
- GSList *s = NULL;
- for (s = e_source_group_peek_sources (group); s; s = s->next) {
- source = E_SOURCE (s->data);
- evo_location_t *path = g_malloc0(sizeof(evo_location_t));
- if (!first) {
- first = TRUE;
- path->uri = g_strdup("default");
- } else {
- path->uri = g_strdup(e_source_get_uri(source));
- }
- path->name = g_strdup(e_source_peek_name(source));
- paths = g_list_append(paths, path);
- }
- }
- return paths;
-}
-
-ESource *
-evo_environment_find_source(ESourceList *list, char *uri)
-{
- GSList *g;
- for (g = e_source_list_peek_groups (list); g; g = g->next) {
- ESourceGroup *group = E_SOURCE_GROUP (g->data);
- GSList *s;
- for (s = e_source_group_peek_sources (group); s; s = s->next) {
- ESource *source = E_SOURCE (s->data);
- if (!strcmp(e_source_get_uri(source), uri))
- return source;
- }
- }
- return NULL;
-}
-
-EContact *
-evo_environment_get_self_contact(void)
-{
- EContact *contact = NULL;
- EBook *book = NULL;
- GError *error = NULL;
-
- if (!e_book_get_self (&contact, &book, &error)) {
- if (error->code == E_BOOK_ERROR_PROTOCOL_NOT_SUPPORTED) {
- g_warning("There was an error while trying to get the addressbook");
- g_clear_error (&error);
- return NULL;
- }
-
- g_clear_error (&error);
-
- contact = e_contact_new ();
-
- if (book == NULL) {
- book = e_book_new_system_addressbook (&error);
- if (book == NULL || error != NULL) {
- g_error ("%s\n", error->message);
- g_clear_error (&error);
- }
-
- if (e_book_open (book, FALSE, NULL) == FALSE) {
- g_warning("Unable to open address book");
- g_clear_error (&error);
- }
- }
- }
-
- g_object_unref (book);
- return contact;
-}
-
-
--- src/evo-environment.h 2007-07-18 14:59:36.000000000 -0300
+++ src/evo-environment.h 1969-12-31 21:00:00.000000000 -0300
@@ -1,55 +0,0 @@
-/* evolution-python: Python bindings to libecal and libebook
- * Copyright (c) 2007 John Stowers <john stowers gmail com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * 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 Library 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., 51 Franklin Street, Fifth Floor Boston, MA 02110-1301, USA
- */
-
-#ifndef EVO_ENVIRONMENT_H
-#define EVO_ENVIRONMENT_H
-
-#include <stdio.h>
-#include <string.h>
-
-#include <glib.h>
-#include <glib-object.h>
-
-#include <libecal/e-cal.h>
-#include <libebook/e-book.h>
-#include <libebook/e-vcard.h>
-
-#include <gdk-pixbuf/gdk-pixbuf.h>
-#include <pango/pango.h>
-
-G_BEGIN_DECLS
-
-typedef struct evo2_location {
- char *name;
- char *uri;
-} evo_location_t;
-
-typedef enum evo_contact_change_type {
- CHANGE_ADDED,
- CHANGE_MODIFIED,
- CHANGE_DELETED
-} evo_change_t;
-
-GList *evo_environment_list_cal_sources(ECalSourceType type);
-GList *evo_environment_list_addressbooks(void);
-ESource *evo_environment_find_source(ESourceList *list, char *uri);
-EContact *evo_environment_get_self_contact(void);
-
-G_END_DECLS
-
-#endif /* EVO_ENVIRONMENT_H */
--- src/evolution.override 2007-07-18 14:59:36.000000000 -0300
+++ src/evolution.override 1969-12-31 21:00:00.000000000 -0300
@@ -1,375 +0,0 @@
-/* -*- Mode: C; c-basic-offset: 4 -*- */
-%%
-headers
-#include <time.h>
-#include <Python.h>
-#include "pygobject.h"
-
-#include "override_common.h"
-
-#include "evo-environment.h"
-#include "evo-contact.h"
-#include "evo-addressbook.h"
-#include "evo-calendar.h"
-
-static PyObject *
-_helper_wrap_glist_of_evo_locations(GList *locations)
-{
- PyObject *result;
- int i;
-
- if ((result = PyList_New (g_list_length (locations))) == NULL)
- return NULL;
-
- i = 0;
- for (; locations != NULL; locations = locations->next) {
- evo_location_t *path = (evo_location_t *) locations->data;
- PyObject *t = PyTuple_New (2);
- if (path->name == NULL) {
- Py_INCREF (Py_None);
- PyTuple_SET_ITEM (t, 0, Py_None);
- } else {
- PyTuple_SET_ITEM (t, 0, PyString_FromString(path->name));
- }
-
- if (path->uri == NULL) {
- Py_INCREF (Py_None);
- PyTuple_SET_ITEM (t, 1, Py_None);
- } else {
- PyTuple_SET_ITEM (t, 1, PyString_FromString(path->uri));
- }
-
- PyList_SET_ITEM (result, i, t);
- i++;
- }
- return result;
-}
-
-%%
-modulename evolution
-%%
-import gobject.GObject as PyGObject_Type
-%%
-ignore-glob
- init
- free_*
- *_get_type
-%%
-override evo_environment_list_calendars noargs
-static PyObject*
-_wrap_evo_environment_list_calendars(PyGObject *self)
-{
- GList *list = NULL;
- list = evo_environment_list_cal_sources(E_CAL_SOURCE_TYPE_EVENT);
- return _helper_wrap_glist_of_evo_locations(list);
-}
-%%
-override evo_environment_list_task_sources noargs
-static PyObject*
-_wrap_evo_environment_list_task_sources(PyGObject *self)
-{
- GList *list = NULL;
- list = evo_environment_list_cal_sources(E_CAL_SOURCE_TYPE_TODO);
- return _helper_wrap_glist_of_evo_locations(list);
-}
-%%
-override evo_environment_list_memo_sources noargs
-static PyObject*
-_wrap_evo_environment_list_memo_sources(PyGObject *self)
-{
- GList *list = NULL;
- list = evo_environment_list_cal_sources(E_CAL_SOURCE_TYPE_JOURNAL);
- return _helper_wrap_glist_of_evo_locations(list);
-}
-%%
-override evo_environment_list_addressbooks noargs
-static PyObject*
-_wrap_evo_environment_list_addressbooks(PyGObject *self)
-{
- return _helper_wrap_glist_of_evo_locations(evo_environment_list_addressbooks());
-}
-%%
-override evo_addressbook_get_all_contacts noargs
-static PyObject*
-_wrap_evo_addressbook_get_all_contacts(PyGObject *self)
-{
- GList *contacts = NULL;
-
- EBookQuery *query = e_book_query_any_field_contains("");
- e_book_get_contacts(E_BOOK(self->obj), query, &contacts, NULL);
-
- e_book_query_unref(query);
-
- return _helper_wrap_gobject_glist(contacts);
-}
-%%
-override evo_cal_source_get_all_objects noargs
-static PyObject*
-_wrap_evo_cal_source_get_all_objects(PyGObject *self)
-{
- GList *objects = NULL;
- GError *error = NULL;
-
- e_cal_get_object_list_as_comp(
- E_CAL(self->obj),
- "#t",
- &objects,
- &error);
-
- //Fixme: Check error
- //evo_cal_source_print_all_objects(E_CAL(self->obj));
-
- return _helper_wrap_gobject_glist(objects);
-}
-
-%%
-override evo_addressbook_free_text_search args
-static PyObject*
-_wrap_evo_addressbook_free_text_search(PyGObject *self, PyObject *args)
-{
- char *query = NULL;
- GList *list = NULL;
-
- if (PyArg_ParseTuple(args, "s",&query))
- {
- list = evo_addressbook_free_text_search(E_BOOK(self->obj), query);
- }
- return _helper_wrap_gobject_glist(list);
-}
-%%
-override evo_addressbook_get_changed_contacts args
-static PyObject *
-_wrap_evo_addressbook_get_changed_contacts(PyGObject *self, PyObject *args)
-{
- char *change_id = NULL;
-
- GList *added = NULL;
- GList *modified = NULL;
- GList *deleted = NULL;
-
- if (PyArg_ParseTuple(args, "s",&change_id)) {
- evo_addressbook_get_changed_contacts(E_BOOK(self->obj), &added, &modified, &deleted, change_id);
- }
-
- return Py_BuildValue("OOO",
- _helper_wrap_gobject_glist(added),
- _helper_wrap_gobject_glist(modified),
- _helper_wrap_gobject_glist(deleted)
- );
-
-}
-%%
-override e_contact_new kwargs
-static int
-_wrap_e_contact_new(PyGObject *self, PyObject *args, PyObject *kwargs)
-{
- static char *kwlist[] = { "vcard", NULL };
- gchar *vcard = NULL;
- EContact *contact = NULL;
-
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|z:EContact.__init__",
- kwlist, &vcard))
- return -1;
-
- if (vcard)
- contact = (EContact *) e_contact_new_from_vcard(vcard);
- else
- contact = (EContact *) e_contact_new();
-
- if (!contact) {
- PyErr_SetString(PyExc_RuntimeError, "could not create EContact object");
- return -1;
- } else {
- self->obj = contact;
- return 0;
- }
-
-}
-%%
-override e_cal_component_new kwargs
-static int
-_wrap_e_cal_component_new(PyGObject *self, PyObject *args, PyObject *kwargs)
-{
- static char *kwlist[] = { "ical", "type", NULL };
- gchar *ical = NULL;
- int type = E_CAL_COMPONENT_NO_TYPE;
- ECalComponent *comp = NULL;
-
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i|z:ECalComponent.__init__",
- kwlist, &type, &ical))
- return -1;
-
- if (ical) {
- comp = (ECalComponent *) e_cal_component_new_from_string(ical);
- } else {
- comp = (ECalComponent *) e_cal_component_new();
- e_cal_component_set_new_vtype(comp, type);
-
- }
-
- if (!comp) {
- PyErr_SetString(PyExc_RuntimeError, "could not create ECalComponent object");
- return -1;
- } else {
- self->obj = comp;
- return 0;
- }
-
-}
-
-%%
-override evo_cal_component_get_due noargs
-static PyObject *
-_wrap_evo_cal_component_get_due(PyGObject *self)
-{
- ECalComponent *calcomponent;
- ECalComponentDateTime dt;
- glong t;
-
- calcomponent = E_CAL_COMPONENT(self->obj);
- e_cal_component_get_due(calcomponent, &dt);
-
- if (dt.value == NULL) {
- e_cal_component_free_datetime(&dt);
- Py_INCREF(Py_None);
- return Py_None;
- }
- t = icaltime_as_timet_with_zone(*(dt.value),
- icaltimezone_get_utc_timezone());
- e_cal_component_free_datetime(&dt);
- return PyInt_FromLong(t);
-}
-
-%%
-override evo_cal_component_set_due args
-static PyObject *
-_wrap_evo_cal_component_set_due(PyGObject *self, PyObject *args)
-{
- ECalComponent *calcomponent;
- ECalComponentDateTime *dt;
- PyObject* due;
-
- if (PyTuple_Size(args) != 1) {
- PyErr_SetString(PyExc_RuntimeError, "ECalComponent.set_due takes exactly 1 argument");
- return NULL;
- }
- calcomponent = E_CAL_COMPONENT(self->obj);
- due = PyTuple_GET_ITEM(args, 0);
-
- if (due == Py_None) {
- // TV-TODO: how to clear the due date do this? gnome bugzilla #452915
- //e_cal_component_set_due(calcomponent, NULL);
- icalcomponent *ic = e_cal_component_get_icalcomponent (calcomponent);
- icalproperty *ip = icalcomponent_get_first_property(ic, ICAL_DUE_PROPERTY);
- if (ip != NULL) {
- icalcomponent_remove_property (ic, ip);
- icalproperty_free (ip);
- }
- e_cal_component_set_icalcomponent(calcomponent, ic);
- e_cal_component_rescan(calcomponent);
-
- Py_INCREF(Py_None);
- return Py_None;
- }
- else if (! PyInt_Check(due)) {
- PyErr_SetString(PyExc_RuntimeError, "due date must be int timestamp or None");
- return NULL;
- }
- dt = g_malloc0 (sizeof (ECalComponentDateTime));
- dt->value = g_malloc0 (sizeof (struct icaltimetype));
- (*dt->value) = icaltime_from_timet(PyInt_AsLong(due), TRUE);
- e_cal_component_set_due(calcomponent, dt);
-
- Py_INCREF(Py_None);
- return Py_None;
-}
-
-%%
-override evo_cal_component_get_categories_list noargs
-static PyObject *
-_wrap_evo_cal_component_get_categories_list(PyGObject *self)
-{
- ECalComponent *calcomponent;
- GSList* categories;
- GSList* l;
- PyObject* res;
- int i = 0;
-
- calcomponent = E_CAL_COMPONENT(self->obj);
- e_cal_component_get_categories_list(calcomponent, &categories);
- if (categories == NULL)
- return PyList_New(0);
- res = PyList_New(g_slist_length(categories));
- for (l = categories; l; l = l->next, i++)
- PyList_SetItem(res, i, PyString_FromString(l->data));
- e_cal_component_free_categories_list(categories);
- return res;
-}
-
-
-%%
-override evo_cal_component_set_categories_list args
-static PyObject *
-_wrap_evo_cal_component_set_categories_list(PyGObject *self, PyObject *args)
-{
- ECalComponent *calcomponent;
- GSList* categories = NULL;
- PyObject* list;
- char* item;
- int i;
-
- // TV-TODO: allow tuple?
- if (!PyArg_ParseTuple(args, "O!:ECalComponent.set_categories_list",
- &PyList_Type,&list))
- return NULL;
-
- for (i = PyList_Size(list)-1; i >= 0; i--) {
- item = PyString_AsString(PyList_GetItem(list, i));
- if (item == NULL) {
- g_slist_free(categories);
- return NULL;
- }
- categories = g_slist_prepend(categories, item);
- }
-
- calcomponent = E_CAL_COMPONENT(self->obj);
- e_cal_component_set_categories_list(calcomponent, categories);
-
- Py_INCREF(Py_None);
- return Py_None;
-}
-
-
-%%
-override evo_contact_get_modified noargs
-static PyObject *
-_wrap_evo_contact_get_modified(PyGObject *self)
-{
- EContact *contact = NULL;
- glong seconds = 0;
- char *timestr = NULL;
- struct tm *time = NULL;
-
- contact = E_CONTACT(self->obj);
- timestr = (char *)e_contact_get(contact, E_CONTACT_REV);
-
- if (timestr) {
- time = g_malloc0 (sizeof (struct tm));
- /* Evolution stores REV field in the following strftime format
- "%Y-%m-%dT%H:%M:%SZ"
- Unparse it and reparse it to time since epoch
- */
- if (strptime(timestr, "%Y-%m-%dT%H:%M:%SZ", time)) {
- char seconds_string[25] = {0};
-
- strftime (seconds_string, sizeof(seconds_string), "%s", time);
- seconds = strtol(seconds_string, NULL, 10);
- }
- }
-
- g_free(time);
- g_free(timestr);
-
- return PyLong_FromLong((long) seconds);
-}
-
--- src/evolution.defs 2007-07-18 14:59:36.000000000 -0300
+++ src/evolution.defs 1969-12-31 21:00:00.000000000 -0300
@@ -1,480 +0,0 @@
-;; -*- scheme -*-
-; object definitions ...
-;; Enumerations and flags ...
-;;------------------------------------------------------------------------------
-;; Boxed type definitions
-;;------------------------------------------------------------------------------
-(define-enum SourceType
- (in-module "ECal")
- (c-name "ECalSourceType")
- ;(gtype-id "E_TYPE_CAL_SOURCE_TYPE")
- (values
- '("event" "E_CAL_SOURCE_TYPE_EVENT")
- '("todo" "E_CAL_SOURCE_TYPE_TODO")
- '("journal" "E_CAL_SOURCE_TYPE_JOURNAL")
- )
-)
-
-(define-enum ComponentVType
- (in-module "ECal")
- (c-name "ECalComponentVType")
-; (gtype-id "E_TYPE_CAL_COMPONENT_VTYPE")
- (values
-; '("no-type" "E_CAL_COMPONENT_NO_TYPE")
- '("event" "E_CAL_COMPONENT_EVENT")
- '("todo" "E_CAL_COMPONENT_TODO")
- '("journal" "E_CAL_COMPONENT_JOURNAL")
- '("freebusy" "E_CAL_COMPONENT_FREEBUSY")
- '("timezone" "E_CAL_COMPONENT_TIMEZONE")
- )
-)
-
-
-;;------------------------------------------------------------------------------
-;; Object Definitions
-;;------------------------------------------------------------------------------
-(define-object EContact
- (in-module "evolution")
- (parent "EVCard")
- (c-name "EContact")
- (gtype-id "E_TYPE_CONTACT")
-)
-
-(define-object EVCard
- (in-module "evolution")
- (parent "GObject")
- (c-name "EVCard")
- (gtype-id "E_TYPE_VCARD")
-)
-
-(define-object EBook
- (in-module "evolution")
- (parent "GObject")
- (c-name "EBook")
- (gtype-id "E_TYPE_BOOK")
-)
-
-(define-object ECal
- (in-module "evolution")
- (parent "GObject")
- (c-name "ECal")
- (gtype-id "E_TYPE_CAL")
-)
-
-(define-object ECalComponent
- (in-module "evolution")
- (parent "GObject")
- (c-name "ECalComponent")
- (gtype-id "E_TYPE_CAL_COMPONENT")
-)
-
-;;------------------------------------------------------------------------------
-;; ECal
-;;------------------------------------------------------------------------------
-(define-method get_all_objects
- (of-object "ECal")
- (c-name "evo_cal_source_get_all_objects")
- (return-type "GList*")
- (parameters
- )
-)
-
-(define-method remove_object
- (of-object "ECal")
- (c-name "evo_cal_source_remove_object")
- (return-type "gboolean")
- (parameters
- '("ECalComponent*" "obj")
- )
-)
-
-(define-method update_object
- (of-object "ECal")
- (c-name "evo_cal_source_update_object")
- (return-type "gboolean")
- (parameters
- '("ECalComponent*" "obj")
- )
-)
-
-(define-method add_object
- (of-object "ECal")
- (c-name "evo_cal_source_add_object")
- (return-type "char*")
- (parameters
- '("ECalComponent*" "obj")
- )
-)
-
-(define-method get_object
- (of-object "ECal")
- (c-name "evo_cal_source_get_object")
- (return-type "ECalComponent*")
- (parameters
- '("const-char*" "uid")
- '("const-char*" "rid")
- )
-)
-
-
-;;------------------------------------------------------------------------------
-;; ECalComponent
-;;------------------------------------------------------------------------------
-(define-function e_cal_component_new
- (c-name "e_cal_component_new")
- (is-constructor-of "ECalComponent")
- (return-type "ECalComponent*")
- (parameters
- '("const-char*" "icard")
- '("ECalComponentVType" "type")
- )
-
-)
-
-(define-method get_as_string
- (of-object "ECalComponent")
- (c-name "e_cal_component_get_as_string")
- (return-type "char*")
-)
-
-(define-method get_uid
- (of-object "ECalComponent")
- (c-name "evo_cal_component_get_uid")
- (return-type "char*")
-)
-
-;(define-method set_uid
-; (of-object "ECalComponent")
-; (c-name "e_cal_component_set_uid")
-; (return-type "none")
-; (parameters
-; '("const-char*" "uid")
-; )
-;)
-
-(define-method get_modified
- (of-object "ECalComponent")
- (c-name "evo_cal_component_get_modified")
- (return-type "glong")
-)
-
-(define-method set_modified
- (of-object "ECalComponent")
- (c-name "evo_cal_component_set_modified")
- (return-type "none")
- (parameters
- '("glong" "seconds")
- )
-)
-
-(define-method get_due
- (of-object "ECalComponent")
- (c-name "evo_cal_component_get_due")
- (return-type "glong")
-)
-
-(define-method set_due
- (of-object "ECalComponent")
- (c-name "evo_cal_component_set_due")
- (return-type "none")
- (parameters
- '("glong" "seconds" (null-ok))
- )
-)
-
-(define-method get_categories_list
- (of-object "ECalComponent")
- (c-name "evo_cal_component_get_categories_list")
- (return-type "GSList*")
- (parameters
- )
-)
-
-(define-method set_categories_list
- (of-object "ECalComponent")
- (c-name "evo_cal_component_set_categories_list")
- (return-type "none")
- (parameters
- '("GSList*" "categories")
- )
-)
-
-(define-method get_url
- (of-object "ECalComponent")
- (c-name "evo_cal_component_get_url")
- (return-type "char*")
- (parameters
- )
-)
-
-(define-method set_url
- (of-object "ECalComponent")
- (c-name "evo_cal_component_set_url")
- (return-type "none")
- (parameters
- '("const-char*" "url" (null-ok))
- )
-)
-
-(define-method get_summary
- (of-object "ECalComponent")
- (c-name "evo_cal_component_get_summary")
- (return-type "char*")
- (parameters
- )
-)
-
-(define-method set_summary
- (of-object "ECalComponent")
- (c-name "evo_cal_component_set_summary")
- (return-type "none")
- (parameters
- '("const-char*" "summary")
- )
-)
-
-(define-method get_priority
- (of-object "ECalComponent")
- (c-name "evo_cal_component_get_priority")
- (return-type "int")
- (parameters
- )
-)
-
-(define-method set_priority
- (of-object "ECalComponent")
- (c-name "evo_cal_component_set_priority")
- (return-type "none")
- (parameters
- '("int" "priority")
- )
-)
-
-(define-method get_description
- (of-object "ECalComponent")
- (c-name "evo_cal_component_get_description")
- (return-type "char*")
- (parameters
- )
-)
-
-(define-method set_description
- (of-object "ECalComponent")
- (c-name "evo_cal_component_set_description")
- (return-type "none")
- (parameters
- '("const-char*" "summary")
- )
-)
-
-;;------------------------------------------------------------------------------
-;; EVContact
-;;------------------------------------------------------------------------------
-(define-function e_contact_new
- (c-name "e_contact_new")
- (is-constructor-of "EContact")
- (return-type "EContact*")
-)
-
-(define-method get_vcard_string
- (of-object "EContact")
- (c-name "evo_contact_get_vcard_string")
- (return-type "char*")
- (parameters
- )
-)
-
-(define-method get_name
- (of-object "EContact")
- (c-name "evo_contact_get_name")
- (return-type "char*")
- (parameters
- )
-)
-
-(define-method get_uid
- (of-object "EContact")
- (c-name "evo_contact_get_uid")
- (return-type "char*")
- (parameters
- )
-)
-
-(define-method get_modified
- (of-object "EContact")
- (c-name "evo_contact_get_modified")
- (return-type "char*")
- (parameters
- )
-)
-
-(define-method get_photo
- (of-object "EContact")
- (c-name "evo_contact_get_photo")
- (return-type "GdkPixbuf*")
- (parameters
- '("gint" "pixbuf_size")
- )
-)
-
-;;------------------------------------------------------------------------------
-;; EBook
-;;------------------------------------------------------------------------------
-(define-function e_book_new
- (c-name "e_book_new")
- (is-constructor-of "EBook")
- (return-type "EBook*")
- (parameters
- '("ESource*" "source")
- '("GError**" "error")
- )
-)
-
-(define-method get_all_contacts
- (of-object "EBook")
- (c-name "evo_addressbook_get_all_contacts")
- (return-type "GList*")
- (parameters
- )
-)
-
-(define-method get_contact
- (of-object "EBook")
- (c-name "evo_addressbook_get_contact")
- (return-type "EContact*")
- (parameters
- '("const-char*" "uid")
- )
-)
-
-(define-method get_changed_contacts
- (of-object "EBook")
- (c-name "evo_addressbook_get_changed_contacts")
- (return-type "GList*")
- (parameters
- '("const-char*" "change_id")
- )
-)
-
-(define-method search
- (of-object "EBook")
- (c-name "evo_addressbook_free_text_search")
- (return-type "GList*")
- (parameters
- '("const-char*" "query")
- )
-)
-
-(define-method remove
- (of-object "EBook")
- (c-name "e_book_remove")
- (return-type "gboolean")
- (parameters
- '("GError**" "error")
- )
-)
-
-(define-method remove_contact
- (of-object "EBook")
- (c-name "evo_addressbook_remove_contact")
- (return-type "gboolean")
- (parameters
- '("EContact*" "contact")
- )
-)
-
-(define-method remove_contact_by_id
- (of-object "EBook")
- (c-name "e_book_remove_contact")
- (return-type "gboolean")
- (parameters
- '("const-char*" "id")
- '("GError**" "error")
- )
-)
-
-(define-method add_contact
- (of-object "EBook")
- (c-name "evo_addressbook_add_contact")
- (return-type "char*")
- (parameters
- '("EContact*" "contact")
- )
-)
-
-(define-method contact_exists
- (of-object "EBook")
- (c-name "evo_addressbook_contact_exists")
- (return-type "gboolean")
- (parameters
- '("EContact*" "contact")
- )
-)
-
-
-;;------------------------------------------------------------------------------
-;; evo-environment
-;;------------------------------------------------------------------------------
-(define-function list_calendars
- (c-name "evo_environment_list_calendars")
- (return-type "GList*")
- (parameters
- )
-)
-
-(define-function list_task_sources
- (c-name "evo_environment_list_task_sources")
- (return-type "GList*")
- (parameters
- )
-)
-
-(define-function list_memo_sources
- (c-name "evo_environment_list_memo_sources")
- (return-type "GList*")
- (parameters
- )
-)
-
-(define-function list_addressbooks
- (c-name "evo_environment_list_addressbooks")
- (return-type "GList*")
- (parameters
- )
-)
-
-(define-function get_self_contact
- (c-name "evo_environment_get_self_contact")
- (return-type "EContact*")
- (parameters
- )
-)
-
-(define-function open_addressbook
- (c-name "evo_addressbook_open")
- (return-type "EBook*")
- (parameters
- '("const-char*" "uri")
- )
-)
-
-(define-function open_calendar_source
- (c-name "evo_cal_source_open_source")
- (return-type "ECal*")
- (parameters
- '("const-char*" "uri")
- '("ECalSourceType" "type")
- )
-)
-
-(define-function open_calendar_source_new_with_absolute_uri
- (c-name "evo_cal_source_open_new_with_absolute_uri")
- (return-type "ECal*")
- (parameters
- '("const-char*" "name")
- '("const-char*" "uri")
- '("ECalSourceType" "type")
- )
-)
-
-
Index: src/Makefile.am
===================================================================
--- src/Makefile.am (revision 40)
+++ src/Makefile.am (working copy)
@@ -1,36 +1,64 @@
-INCLUDES = $(PYTHON_INCLUDES) $(EVOLUTION_CFLAGS)
+INCLUDES = $(PYTHON_INCLUDES)
-pkgpythondir = $(pyexecdir)/gtk-2.0
-pkgpyexecdir = $(pyexecdir)/gtk-2.0
+pkgpythondir = $(pyexecdir)/gtk-2.0/evolution
+pkgpyexecdir = $(pyexecdir)/gtk-2.0/evolution
-pkgpyexec_LTLIBRARIES = evolution.la
-evolution_la_LDFLAGS = -module -avoid-version -export-symbols-regex initevolution
-evolution_la_LIBADD = $(EVOLUTION_LIBS)
-evolution_la_SOURCES = \
- evolutionmodule.c \
+pkgpyexec_LTLIBRARIES = ebook.la
+
+if WANT_ECAL
+pkgpyexec_LTLIBRARIES += ecal.la
+endif
+
+pkgpyexec_DATA = __init__.py
+
+ecal_la_LDFLAGS = -module -avoid-version -export-symbols-regex initecal
+ecal_la_CFLAGS = $(INCLUDES) $(ECAL_CFLAGS)
+ecal_la_LIBADD = $(ECAL_LIBS)
+ecal_la_SOURCES = \
+ ecalmodule.c \
override_common.c \
- evo-environment.c \
+ evo-ecal-environment.c \
+ evo-calendar.c \
+ override_common.h \
+ evo-ecal-environment.h \
+ evo-calendar.h
+
+ebook_la_LDFLAGS = -module -avoid-version -export-symbols-regex initebook
+ebook_la_CFLAGS = $(INCLUDES) $(EBOOK_CFLAGS)
+ebook_la_LIBADD = $(EBOOK_LIBS)
+ebook_la_SOURCES = \
+ ebookmodule.c \
+ override_common.c \
+ evo-ebook-environment.c \
evo-contact.c \
evo-addressbook.c \
- evo-calendar.c \
override_common.h \
- evo-environment.h \
+ evo-ebook-environment.h \
evo-contact.h \
- evo-addressbook.h \
- evo-calendar.h
+ evo-addressbook.h
-nodist_evolution_la_SOURCES = evolution.c
+nodist_ecal_la_SOURCES = ecal.c
+nodist_ebook_la_SOURCES = ebook.c
+
defsdir = $(pkgdatadir)/defs
-defs_DATA = evolution.defs
+defs_DATA = ebook.defs
-CLEANFILES = evolution.c
+if WANT_ECAL
+ defs_DATA += ecal.defs
+endif
+
+
+CLEANFILES = ebook.c ecal.c
EXTRA_DIST = \
- evolution.defs \
- evolution.override \
+ ebook.defs \
+ ecal.defs \
+ ebook.override \
+ ecal.override \
gen-defs.sh
-evolution.c: evolution.defs evolution.override
+ebook.c: ebook.defs ebook.override
+ecal.c: ecal.defs ecal.override
.defs.c:
(cd $(srcdir) \
&& $(PYGTK_CODEGEN) \
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]