ECalComponent patch (Re: supporting unlisted calendar source uris)
- From: Thomas Viehmann <tv+conduit-list beamnet de>
- To: <conduit-list gnome org>, <conduit-list gnome org>
- Subject: ECalComponent patch (Re: supporting unlisted calendar source uris)
- Date: Sun, 01 Jul 2007 22:56:15 +0200
On 2007-07-01 22:53:51.00 Thomas Viehmann
<tv+conduit-list beamnet de> wrote:
This is the attached patch evolution-python.ecalcomponent.diff.
--
Thomas Viehmann, http://thomas.viehmann.net/
--- evolution-python-0.0.1+svn-20070609.orig/src/evo-calendar.c
+++ evolution-python-0.0.1+svn-20070609/src/evo-calendar.c
@@ -192,6 +224,49 @@
e_cal_component_set_last_modified(obj, &tt);
}
+int
+evo_cal_component_get_priority(ECalComponent *comp)
+{
+ int* pp;
+ int p;
+
+ e_cal_component_get_priority(comp, &pp);
+ if (pp == NULL)
+ return 0; // default taken from Ross Burton's tasks
+ p = *pp;
+ e_cal_component_free_priority(pp);
+ return p;
+}
+
+void
+evo_cal_component_set_priority(ECalComponent *comp, int priority)
+{
+ if (priority == 0) // 0 means no priority
+ e_cal_component_set_priority(comp, NULL);
+ else
+ e_cal_component_set_priority(comp, &priority);
+}
+
+char *
+evo_cal_component_get_url(ECalComponent *obj)
+{
+ const char* url;
+
+ e_cal_component_get_url(obj, &url);
+
+ if (url == NULL)
+ return NULL;
+
+ return g_strdup(url);
+}
+
+void
+evo_cal_component_set_url(ECalComponent *obj, const char *url)
+{
+ e_cal_component_set_url(obj, url);
+}
+
+
char *
evo_cal_component_get_summary(ECalComponent *obj)
{
--- evolution-python-0.0.1+svn-20070609.orig/src/evolution.override
+++ evolution-python-0.0.1+svn-20070609/src/evolution.override
@@ -216,6 +216,130 @@
}
}
+
+%%
+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 *
--- evolution-python-0.0.1+svn-20070609.orig/src/evolution.defs
+++ evolution-python-0.0.1+svn-20070609/src/evolution.defs
@@ -167,6 +167,55 @@
)
)
+(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")
@@ -184,6 +233,23 @@
)
)
+(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")
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]