Re: supporting unlisted calendar source uris
- From: Thomas Viehmann <tv+conduit-list beamnet de>
- To: <conduit-list gnome org>
- Subject: Re: supporting unlisted calendar source uris
- Date: Sun, 01 Jul 2007 22:53:51 +0200
Hi John,
thank you for your comments.
John Stowers wrote:
would it be worthwile to support opening calendar uris that are not
listed in the source list?
Im not sure of the use case for this at the moment. Under what
situation is
a source not listed in the source list?
Basically, I want to access and manipulate several calendars not
installed in evolution on a computer that doesn't have evolution
(only eds).
I can understand that one might want to create a calendar with a
source
at a specific filesystem location but I thought that this calendar
source
would then appear in the list of sources the next time
evo_environment_list_cal_sources is called?
Appearantly not unless the location is registered.
I would like to keep the python api similar in appearance to the C
api so I
am not opposed to wrapping e_source_new_with_absolute_uri as a
seperate
function as opposed to kwargs to the current open function.
OK. I've tried to match evo_cal_source_open_source (and copied most
of it) with evo_cal_source_open_new_with_absolute_uri.
This is the attached patch evolution-python.source_new.diff.
Additionally, I've tried to add some ECalComponent methods for due
dates, categories, priorities, and url.
This is the attached patch evolution-python.ecalcomponent.diff.
I'm afraid that it shows that I'm neither an expert at writing python
extensions nor have I wrapped gnome libraries before, but I hope that
I don't have to many routes to SIGSEGV in it. Maybe some parts are
even useful.
Kind regards
T.
--
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
@@ -67,6 +67,38 @@
return cal;
}
+ECal *
+evo_cal_source_open_new_with_absolute_uri(const char *name, const char *uri, ECalSourceType type)
+{
+ ESource *source = NULL;
+ ECal *cal = NULL;
+ GError *gerror = NULL;
+
+ g_debug("Opening new calendar source uri: %s\n", uri);
+
+ source = e_source_new_with_absolute_uri(name, uri);
+
+ if (!source) {
+ g_warning("Unable to open source for calendar (type %u)", type);
+ return NULL;
+ }
+
+ cal = e_cal_new(source, type);
+ if(!cal) {
+ g_warning("Failed to create new calendar (type %u)", type);
+ return NULL;
+ }
+
+ if(!e_cal_open(cal, FALSE, &gerror)) {
+ g_warning("Failed to open calendar (type %u): %s", gerror ? gerror->message : "None", type);
+ g_object_unref(cal);
+ g_clear_error(&gerror);
+ return NULL;
+ }
+
+ return cal;
+}
+
gboolean
evo_cal_source_remove_object(ECal *ecal, ECalComponent *obj)
{
--- evolution-python-0.0.1+svn-20070609.orig/src/evo-calendar.h
+++ evolution-python-0.0.1+svn-20070609/src/evo-calendar.h
@@ -22,6 +22,7 @@
G_BEGIN_DECLS
ECal *evo_cal_source_open_source(const char *uri, ECalSourceType type);
+ECal *evo_cal_source_open_new_with_absolute_uri(const char *name, const char *uri, ECalSourceType type);
void evo_cal_source_print_all_objects(ECal *ecal);
char *evo_cal_component_get_uid(ECalComponent *obj);
glong evo_cal_component_get_modified(ECalComponent *obj);
--- evolution-python-0.0.1+svn-20070609.orig/src/evolution.defs
+++ evolution-python-0.0.1+svn-20070609/src/evolution.defs
@@ -401,4 +401,14 @@
)
)
+(define-function open_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")
+ )
+)
+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]