This wraps the calendar-backend C++ API for adding events to the calendar.
libgoogle_plugin_la_SOURCES = \
src/plugins/google-plugin.c \
+ src/plugins/calendar-backend-adapter.cc \
+ src/plugins/calendar-backend.c \
src/plugins/google-parser.c
libgoogle_plugin_la_VALASOURCES = \
src/plugins/google-plugin.vala \
+ src/plugins/calendar-backend.vala \
src/plugins/google-parser.vala
libgoogle_plugin_la_VALAFLAGS = --vapidir ./vapi --pkg config --pkg cinaest \
--pkg hildon-1 --pkg libosso
libgoogle_plugin_la_CFLAGS = ${CINAEST_CFLAGS} ${HILDON_CFLAGS} ${OSSO_CFLAGS}
-libgoogle_plugin_la_LIBADD = ${CINAEST_LIBS} ${HILDON_LIBS} ${OSSO_LIBS}
+libgoogle_plugin_la_CPPFLAGS = ${CALENDAR_CFLAGS}
+libgoogle_plugin_la_LIBADD = ${CALENDAR_LIBS} ${CINAEST_LIBS} ${HILDON_LIBS} ${OSSO_LIBS}
libgoogle_plugin_la_LDFLAGS = -module
src/plugins/google-plugin.c: ${libgoogle_plugin_la_VALASOURCES}
CLEANFILES = \
${cinaest_SOURCES} \
${libcatalog_plugin_la_SOURCES} \
- ${libgoogle_plugin_la_SOURCES} \
+ $(patsubst %.vala,%.c,${libgoogle_plugin_la_VALASOURCES}) \
${libimdb_plugin_la_SOURCES} \
${imdb_plaintext_downloader_SOURCES} \
${google_poster_downloader_SOURCES}
AC_OUTPUT(cinaest.pc)
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:.
+PKG_CHECK_MODULES(CALENDAR, calendar-backend)
+AC_SUBST(CALENDAR_LIBS)
+AC_SUBST(CALENDAR_CFLAGS)
+
PKG_CHECK_MODULES(CINAEST, cinaest)
AC_SUBST(CINAEST_LIBS)
AC_SUBST(CINAEST_CFLAGS)
--- /dev/null
+/* This file is part of Cinaest.
+ *
+ * Copyright (C) 2009 Philipp Zabel
+ *
+ * Cinaest 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 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Cinaest 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 Cinaest. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <CEvent.h>
+#include <CMulticalendar.h>
+#include <CalendarErrors.h>
+#include <ctime>
+
+using namespace std;
+
+extern "C" {
+
+ int calendar_backend_add_event (char* summary,
+ char* description,
+ char* location,
+ time_t start,
+ time_t end)
+ {
+ CMulticalendar* MC = CMulticalendar::MCInstance ();
+ CCalendar* C = MC->getDefaultCalendar ();
+ int id = C->getCalendarId ();
+ int error = 0;
+
+ CEvent* E = new CEvent (summary, description, location, start, end);
+
+ MC->addEvent (E, id, error);
+
+ delete E;
+
+ if (error != CALENDAR_OPERATION_SUCCESSFUL) {
+ return error;
+ } else {
+ return 0;
+ }
+ }
+
+}
--- /dev/null
+/* This file is part of Cinaest.
+ *
+ * Copyright (C) 2009 Philipp Zabel
+ *
+ * Cinaest 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 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Cinaest 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 Cinaest. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+namespace Calendar {
+ [CCode (cname = "calendar_backend_add_event")]
+ extern int add_event (char* summary, char* description, char* location, time_t start, time_t end);
+}
+