[evolution-data-server] Fix "system" EBook/ECal creation functions.
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] Fix "system" EBook/ECal creation functions.
- Date: Thu, 22 Jul 2010 14:13:13 +0000 (UTC)
commit 979f72b7cd4e3316bf9dd861543db8438e451919
Author: Matthew Barnes <mbarnes redhat com>
Date: Thu Jul 22 10:00:34 2010 -0400
Fix "system" EBook/ECal creation functions.
The local "system" URIs are trivial now, it's just "local:system".
e_book_new_system_addressbook()
e_cal_new_system_calendar()
e_cal_new_system_tasks()
e_cal_new_system_memos()
addressbook/libebook/e-book.c | 16 +-----------
calendar/libecal/e-cal.c | 51 ++--------------------------------------
2 files changed, 5 insertions(+), 62 deletions(-)
---
diff --git a/addressbook/libebook/e-book.c b/addressbook/libebook/e-book.c
index 5dd73a8..91c0dad 100644
--- a/addressbook/libebook/e-book.c
+++ b/addressbook/libebook/e-book.c
@@ -3258,24 +3258,14 @@ e_book_new_system_addressbook (GError **error)
GError *err = NULL;
ESource *system_source = NULL;
EBook *book;
- gchar *uri, *filename;
- const gchar *user_data_dir;
struct check_system_data csd;
- user_data_dir = e_get_user_data_dir ();
- filename = g_build_filename (
- user_data_dir, "addressbook", "local", "system", NULL);
- uri = g_filename_to_uri (filename, NULL, NULL);
- g_free (filename);
-
- csd.uri = uri;
+ csd.uri = "system:local";
csd.uri_source = NULL;
system_source = search_known_sources (check_system, &csd, &err);
if (err) {
g_propagate_error (error, err);
- g_free (uri);
-
return NULL;
}
@@ -3288,14 +3278,12 @@ e_book_new_system_addressbook (GError **error)
book = e_book_new (system_source, &err);
g_object_unref (system_source);
} else {
- book = e_book_new_from_uri (uri, &err);
+ book = e_book_new_from_uri (csd.uri, &err);
}
if (csd.uri_source)
g_object_unref (csd.uri_source);
- g_free (uri);
-
if (err)
g_propagate_error (error, err);
diff --git a/calendar/libecal/e-cal.c b/calendar/libecal/e-cal.c
index 48344bc..0b9e83f 100644
--- a/calendar/libecal/e-cal.c
+++ b/calendar/libecal/e-cal.c
@@ -958,22 +958,7 @@ e_cal_new_from_uri (const gchar *uri, ECalSourceType type)
ECal *
e_cal_new_system_calendar (void)
{
- ECal *ecal;
- const gchar *user_data_dir;
- gchar *filename;
- gchar *uri;
-
- user_data_dir = e_get_user_data_dir ();
- filename = g_build_filename (
- user_data_dir, "calendar", "local", "system", NULL);
-
- uri = g_filename_to_uri (filename, NULL, NULL);
- ecal = e_cal_new_from_uri (uri, E_CAL_SOURCE_TYPE_EVENT);
-
- g_free (filename);
- g_free (uri);
-
- return ecal;
+ return e_cal_new_from_uri ("local:system", E_CAL_SOURCE_TYPE_EVENT);
}
/**
@@ -989,22 +974,7 @@ e_cal_new_system_calendar (void)
ECal *
e_cal_new_system_tasks (void)
{
- ECal *ecal;
- const gchar *user_data_dir;
- gchar *filename;
- gchar *uri;
-
- user_data_dir = e_get_user_data_dir ();
- filename = g_build_filename (
- user_data_dir, "tasks", "local", "system", NULL);
-
- uri = g_filename_to_uri (filename, NULL, NULL);
- ecal = e_cal_new_from_uri (uri, E_CAL_SOURCE_TYPE_TODO);
-
- g_free (filename);
- g_free (uri);
-
- return ecal;
+ return e_cal_new_from_uri ("local:system", E_CAL_SOURCE_TYPE_TODO);
}
/**
@@ -1020,22 +990,7 @@ e_cal_new_system_tasks (void)
ECal *
e_cal_new_system_memos (void)
{
- ECal *ecal;
- const gchar *user_data_dir;
- gchar *filename;
- gchar *uri;
-
- user_data_dir = e_get_user_data_dir ();
- filename = g_build_filename (
- user_data_dir, "memos", "local", "system", NULL);
-
- uri = g_filename_to_uri (filename, NULL, NULL);
- ecal = e_cal_new_from_uri (uri, E_CAL_SOURCE_TYPE_JOURNAL);
-
- g_free (filename);
- g_free (uri);
-
- return ecal;
+ return e_cal_new_from_uri ("local:system", E_CAL_SOURCE_TYPE_JOURNAL);
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]