Patch from Ubuntu. As attachment. -- PaulLiu (劉穎駿) E-mail: Ying-Chun Liu (PaulLiu) <paul...@debian.org>
Index: jana-0.0.0+git20091215.9ec1da8a/bindings/vala/libjana-ecal.gi =================================================================== --- jana-0.0.0+git20091215.9ec1da8a.orig/bindings/vala/libjana-ecal.gi 2013-09-21 03:16:14.000000000 +0800 +++ jana-0.0.0+git20091215.9ec1da8a/bindings/vala/libjana-ecal.gi 2013-09-21 03:16:14.000000000 +0800 @@ -139,10 +139,10 @@ <parameter name="type" type="JanaComponentType"/> </parameters> </constructor> - <constructor name="new_from_uri" symbol="jana_ecal_store_new_from_uri"> + <constructor name="new_from_uid" symbol="jana_ecal_store_new_from_uid"> <return-type type="JanaStore*"/> <parameters> - <parameter name="uri" type="gchar*"/> + <parameter name="uid" type="gchar*"/> <parameter name="type" type="JanaComponentType"/> </parameters> </constructor> Index: jana-0.0.0+git20091215.9ec1da8a/libjana-ecal/doc/reference/libjana-ecal-sections.txt =================================================================== --- jana-0.0.0+git20091215.9ec1da8a.orig/libjana-ecal/doc/reference/libjana-ecal-sections.txt 2013-09-21 03:16:14.000000000 +0800 +++ jana-0.0.0+git20091215.9ec1da8a/libjana-ecal/doc/reference/libjana-ecal-sections.txt 2013-09-21 03:16:14.000000000 +0800 @@ -75,7 +75,7 @@ <TITLE>JanaEcalStore</TITLE> JanaEcalStore jana_ecal_store_new -jana_ecal_store_new_from_uri +jana_ecal_store_new_from_uid <SUBSECTION Standard> JANA_ECAL_STORE JANA_ECAL_IS_STORE Index: jana-0.0.0+git20091215.9ec1da8a/libjana-ecal/jana-ecal-component.h =================================================================== --- jana-0.0.0+git20091215.9ec1da8a.orig/libjana-ecal/jana-ecal-component.h 2013-09-21 03:16:14.000000000 +0800 +++ jana-0.0.0+git20091215.9ec1da8a/libjana-ecal/jana-ecal-component.h 2013-09-21 03:16:14.000000000 +0800 @@ -22,7 +22,7 @@ #define JANA_ECAL_COMPONENT_H #include <glib-object.h> -#include <libecal/e-cal-component.h> +#include <libecal/libecal.h> #include <libjana/jana-time.h> #include <libjana/jana-component.h> Index: jana-0.0.0+git20091215.9ec1da8a/libjana-ecal/jana-ecal-event.h =================================================================== --- jana-0.0.0+git20091215.9ec1da8a.orig/libjana-ecal/jana-ecal-event.h 2013-09-21 03:16:14.000000000 +0800 +++ jana-0.0.0+git20091215.9ec1da8a/libjana-ecal/jana-ecal-event.h 2013-09-21 03:16:14.000000000 +0800 @@ -22,7 +22,7 @@ #define JANA_ECAL_EVENT_H #include <glib-object.h> -#include <libecal/e-cal-component.h> +#include <libecal/libecal.h> #include <libjana/jana-component.h> #include <libjana/jana-event.h> Index: jana-0.0.0+git20091215.9ec1da8a/libjana-ecal/jana-ecal-note.h =================================================================== --- jana-0.0.0+git20091215.9ec1da8a.orig/libjana-ecal/jana-ecal-note.h 2013-09-21 03:16:14.000000000 +0800 +++ jana-0.0.0+git20091215.9ec1da8a/libjana-ecal/jana-ecal-note.h 2013-09-21 03:16:14.000000000 +0800 @@ -22,7 +22,7 @@ #define JANA_ECAL_NOTE_H #include <glib-object.h> -#include <libecal/e-cal-component.h> +#include <libecal/libecal.h> #include <libjana/jana-component.h> #include <libjana/jana-note.h> Index: jana-0.0.0+git20091215.9ec1da8a/libjana-ecal/jana-ecal-store.c =================================================================== --- jana-0.0.0+git20091215.9ec1da8a.orig/libjana-ecal/jana-ecal-store.c 2013-09-21 03:16:14.000000000 +0800 +++ jana-0.0.0+git20091215.9ec1da8a/libjana-ecal/jana-ecal-store.c 2013-09-21 03:16:14.000000000 +0800 @@ -194,27 +194,6 @@ /*JanaEcalStorePrivate *priv = STORE_PRIVATE (self);*/ } -#ifndef HAVE_ECAL_NEW_SYSTEM_MEMOS -/* Taken from eds libecal */ -static ECal * -e_cal_new_system_memos (void) -{ - ECal *ecal; - char *uri; - char *filename; - - filename = g_build_filename (g_get_home_dir (), - ".evolution/memos/local/system", - NULL); - uri = g_filename_to_uri (filename, NULL, NULL); - g_free (filename); - ecal = e_cal_new_from_uri (uri, E_CAL_SOURCE_TYPE_JOURNAL); - g_free (uri); - - return ecal; -} -#endif - /** * jana_ecal_store_new: * @type: The type of store to create/open @@ -228,25 +207,47 @@ JanaStore * jana_ecal_store_new (JanaComponentType type) { - ECal *ecal; + ESourceRegistry *registry; + ESource *source; + JanaStore *store; + GError *error = NULL; + + registry = e_source_registry_new_sync (NULL, &error); + if (!registry) { + g_warning ("%s: Cannot open ESourceRegistry: %s", G_STRFUNC, error ? error->message : "Unknown error"); + g_clear_error (&error); + + return NULL; + } switch (type) { case JANA_COMPONENT_EVENT : - ecal = e_cal_new_system_calendar (); + source = e_source_registry_ref_builtin_calendar (registry); break; case JANA_COMPONENT_NOTE : - ecal = e_cal_new_system_memos (); + source = e_source_registry_ref_builtin_memo_list (registry); break; case JANA_COMPONENT_TASK : - ecal = e_cal_new_system_tasks (); + source = e_source_registry_ref_builtin_task_list (registry); break; default : g_warning ("%s called with invalid type", G_STRFUNC); + g_object_unref (registry); return NULL; } - - return JANA_STORE (g_object_new (JANA_ECAL_TYPE_STORE, - "ecal", ecal, "type", type, NULL)); + + if (!source) { + g_warning ("%s: Cannot find builtin source", G_STRFUNC); + g_object_unref (registry); + return NULL; + } + + store = jana_ecal_store_new_from_uid (e_source_get_uid (source), type); + + g_object_unref (source); + g_object_unref (registry); + + return store; } static gboolean @@ -266,22 +267,25 @@ } /** - * jana_ecal_store_new_from_uri: - * @uri: The uri to the store + * jana_ecal_store_new_from_uid: + * @uid: The uid to the store * @type: The type of store to create/open * - * Opens or creates an evolution-data-server storage at the given uri for the + * Opens or creates an evolution-data-server storage for the given uid and the * specified type of component. * * Returns: A #JanaEcalStore that wraps an evolution-data-server storage of - * the specified component type at the given uri, cast as a #JanaStore. + * the specified component type for the given uid, cast as a #JanaStore. */ JanaStore * -jana_ecal_store_new_from_uri (const gchar *uri, JanaComponentType type) +jana_ecal_store_new_from_uid (const gchar *uid, JanaComponentType type) { + ESourceRegistry *registry; + ESource *source; ECal *ecal; ECalSourceType etype; - + GError *error = NULL; + switch (type) { case JANA_COMPONENT_EVENT : etype = E_CAL_SOURCE_TYPE_EVENT; @@ -297,29 +301,48 @@ return NULL; } - if ((ecal = e_cal_new_from_uri (uri, etype))) { + registry = e_source_registry_new_sync (NULL, &error); + if (!registry) { + g_warning ("%s: Cannot open ESourceRegistry: %s", G_STRFUNC, error ? error->message : "Unknown error"); + g_clear_error (&error); + + return NULL; + } + + source = e_source_registry_ref_source (registry, uid); + if (!source) { + g_warning ("%s: Failed to find source with uid '%s'", G_STRFUNC, uid); + g_object_unref (registry); + return NULL; + } + + if ((ecal = e_cal_new (source, etype))) { + g_object_unref (source); + g_object_unref (registry); return JANA_STORE (g_object_new (JANA_ECAL_TYPE_STORE, "ecal", ecal, "type", type, NULL)); } else { + g_object_unref (source); + g_object_unref (registry); g_warning ("Could not create ECal in %s", G_STRFUNC); return NULL; } } /** - * jana_ecal_store_get_uri - * @store: The store to get the uri of. + * jana_ecal_store_get_uid + * @store: The store to get the uid of. * - * Returns: The uri of the calendar that this store represents. + * Returns: The uid of the calendar that this store represents. */ const gchar * -jana_ecal_store_get_uri (JanaEcalStore *store) +jana_ecal_store_get_uid (JanaEcalStore *store) { JanaEcalStorePrivate *priv = STORE_PRIVATE (store); g_return_val_if_fail (JANA_ECAL_IS_STORE (store), NULL); - return e_cal_get_uri (priv->ecal); + return e_source_get_uid (priv->ecal); } static void Index: jana-0.0.0+git20091215.9ec1da8a/libjana-ecal/jana-ecal-store.h =================================================================== --- jana-0.0.0+git20091215.9ec1da8a.orig/libjana-ecal/jana-ecal-store.h 2013-09-21 03:16:14.000000000 +0800 +++ jana-0.0.0+git20091215.9ec1da8a/libjana-ecal/jana-ecal-store.h 2013-09-21 03:16:14.000000000 +0800 @@ -22,8 +22,7 @@ #define JANA_ECAL_STORE_H #include <glib-object.h> -#include <libecal/e-cal.h> -#include <libecal/e-cal-view.h> +#include <libecal/libecal.h> #include <libjana/jana-store.h> #include <libjana-ecal/jana-ecal-store.h> @@ -61,9 +60,9 @@ GType jana_ecal_store_get_type (void); JanaStore *jana_ecal_store_new (JanaComponentType type); -JanaStore *jana_ecal_store_new_from_uri (const gchar *uri, +JanaStore *jana_ecal_store_new_from_uid (const gchar *uid, JanaComponentType type); -const gchar *jana_ecal_store_get_uri (JanaEcalStore *store); +const gchar *jana_ecal_store_get_uid (JanaEcalStore *store); #endif /* JANA_ECAL_STORE_H */ Index: jana-0.0.0+git20091215.9ec1da8a/libjana-ecal/jana-ecal-store-view.c =================================================================== --- jana-0.0.0+git20091215.9ec1da8a.orig/libjana-ecal/jana-ecal-store-view.c 2013-09-21 03:16:14.000000000 +0800 +++ jana-0.0.0+git20091215.9ec1da8a/libjana-ecal/jana-ecal-store-view.c 2013-09-21 03:16:14.000000000 +0800 @@ -33,8 +33,7 @@ #define HANDLE_LIBICAL_MEMORY 1 #include <string.h> -#include <libecal/e-cal.h> -#include <libecal/e-cal-time-util.h> +#include <libecal/libecal.h> #include <libjana/jana-utils.h> #include "jana-ecal-component.h" #include "jana-ecal-event.h" Index: jana-0.0.0+git20091215.9ec1da8a/libjana-ecal/jana-ecal-store-view.h =================================================================== --- jana-0.0.0+git20091215.9ec1da8a.orig/libjana-ecal/jana-ecal-store-view.h 2013-09-21 03:16:14.000000000 +0800 +++ jana-0.0.0+git20091215.9ec1da8a/libjana-ecal/jana-ecal-store-view.h 2013-09-21 03:16:14.000000000 +0800 @@ -22,7 +22,7 @@ #define JANA_ECAL_STORE_VIEW_H #include <glib-object.h> -#include <libecal/e-cal-view.h> +#include <libecal/libecal.h> #include <libjana/jana-store-view.h> #include <libjana-ecal/jana-ecal-store.h> Index: jana-0.0.0+git20091215.9ec1da8a/libjana-ecal/jana-ecal-task.h =================================================================== --- jana-0.0.0+git20091215.9ec1da8a.orig/libjana-ecal/jana-ecal-task.h 2013-09-21 03:16:14.000000000 +0800 +++ jana-0.0.0+git20091215.9ec1da8a/libjana-ecal/jana-ecal-task.h 2013-09-21 03:16:14.000000000 +0800 @@ -22,7 +22,7 @@ #define JANA_ECAL_TASK_H #include <glib-object.h> -#include <libecal/e-cal-component.h> +#include <libecal/libecal.h> #include <libjana/jana-component.h> #include <libjana/jana-task.h> Index: jana-0.0.0+git20091215.9ec1da8a/libjana-ecal/jana-ecal-time.h =================================================================== --- jana-0.0.0+git20091215.9ec1da8a.orig/libjana-ecal/jana-ecal-time.h 2013-09-21 03:16:14.000000000 +0800 +++ jana-0.0.0+git20091215.9ec1da8a/libjana-ecal/jana-ecal-time.h 2013-09-21 03:16:14.000000000 +0800 @@ -24,7 +24,7 @@ #include <glib-object.h> #include <libical/ical.h> #include <libjana/jana-time.h> -#include <libecal/e-cal-component.h> +#include <libecal/libecal.h> #define JANA_ECAL_TYPE_TIME (jana_ecal_time_get_type ()) #define JANA_ECAL_TIME(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ Index: jana-0.0.0+git20091215.9ec1da8a/libjana-ecal/jana-ecal-utils.c =================================================================== --- jana-0.0.0+git20091215.9ec1da8a.orig/libjana-ecal/jana-ecal-utils.c 2013-09-21 03:16:14.000000000 +0800 +++ jana-0.0.0+git20091215.9ec1da8a/libjana-ecal/jana-ecal-utils.c 2013-09-21 03:16:14.000000000 +0800 @@ -30,7 +30,7 @@ #include <string.h> #include <libical/icaltime.h> #include <libjana/jana-utils.h> -#include <libecal/e-cal-time-util.h> +#include <libecal/libecal.h> #include <libjana-ecal/jana-ecal-time.h> #include <gconf/gconf-client.h> #include "jana-ecal-utils.h" Index: jana-0.0.0+git20091215.9ec1da8a/tests/test-jana-ecal-store-view.c =================================================================== --- jana-0.0.0+git20091215.9ec1da8a.orig/tests/test-jana-ecal-store-view.c 2013-09-21 03:16:14.000000000 +0800 +++ jana-0.0.0+git20091215.9ec1da8a/tests/test-jana-ecal-store-view.c 2013-09-21 03:16:14.000000000 +0800 @@ -193,7 +193,7 @@ main (int argc, char **argv) { JanaStore *store; - gchar *uri; + gchar *uid; ECal *ecal; GError *error = NULL; @@ -201,10 +201,10 @@ g_type_init (); - uri = g_strdup_printf ("file://%s%slibjana-test", + uid = g_strdup_printf ("file://%s%slibjana-test", g_get_tmp_dir (), G_DIR_SEPARATOR_S); - store = jana_ecal_store_new_from_uri (uri, JANA_COMPONENT_EVENT); - g_free (uri); + store = jana_ecal_store_new_from_uid (uid, JANA_COMPONENT_EVENT); + g_free (uid); g_signal_connect (G_OBJECT (store), "opened", G_CALLBACK (opened_cb), NULL);
signature.asc
Description: OpenPGP digital signature