1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362
|
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);
|