aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2011-06-14 14:54:20 +0800
committerRodrigo Moya <rodrigo@gnome-db.org>2011-06-30 00:42:27 +0800
commit84339b3be5a771406fcd5898bbd21dc1c5b98c82 (patch)
tree15a9cfd61451b56d6b35541b1b1e966a34b17faf /plugins
parentfa4289a2f3c26112c907f283a1fd8ab3fb4f26d6 (diff)
downloadgsoc2013-evolution-84339b3be5a771406fcd5898bbd21dc1c5b98c82.tar
gsoc2013-evolution-84339b3be5a771406fcd5898bbd21dc1c5b98c82.tar.gz
gsoc2013-evolution-84339b3be5a771406fcd5898bbd21dc1c5b98c82.tar.bz2
gsoc2013-evolution-84339b3be5a771406fcd5898bbd21dc1c5b98c82.tar.lz
gsoc2013-evolution-84339b3be5a771406fcd5898bbd21dc1c5b98c82.tar.xz
gsoc2013-evolution-84339b3be5a771406fcd5898bbd21dc1c5b98c82.tar.zst
gsoc2013-evolution-84339b3be5a771406fcd5898bbd21dc1c5b98c82.zip
Do not use deprecated EBook/ECal API
Diffstat (limited to 'plugins')
-rw-r--r--plugins/bbdb/bbdb.c98
-rw-r--r--plugins/bbdb/bbdb.h11
-rw-r--r--plugins/bbdb/gaimbuddies.c63
-rw-r--r--plugins/caldav/caldav-browse-server.c8
-rw-r--r--plugins/caldav/caldav-source.c19
-rw-r--r--plugins/calendar-file/calendar-file.c8
-rw-r--r--plugins/dbx-import/dbx-importer.c3
-rw-r--r--plugins/default-source/default-source.c16
-rw-r--r--plugins/google-account-setup/google-source.c9
-rw-r--r--plugins/itip-formatter/itip-formatter.c244
-rw-r--r--plugins/itip-formatter/itip-view.c22
-rw-r--r--plugins/itip-formatter/itip-view.h6
-rw-r--r--plugins/mail-to-task/Makefile.am1
-rw-r--r--plugins/mail-to-task/mail-to-task.c98
-rw-r--r--plugins/pst-import/pst-importer.c86
-rw-r--r--plugins/publish-calendar/publish-format-fb.c61
-rw-r--r--plugins/publish-calendar/publish-format-ical.c44
-rw-r--r--plugins/save-calendar/csv-format.c30
-rw-r--r--plugins/save-calendar/format-handler.h4
-rw-r--r--plugins/save-calendar/ical-format.c36
-rw-r--r--plugins/save-calendar/rdf-format.c30
-rw-r--r--plugins/save-calendar/save-calendar.c12
-rw-r--r--plugins/vcard-inline/vcard-inline.c62
23 files changed, 526 insertions, 445 deletions
diff --git a/plugins/bbdb/bbdb.c b/plugins/bbdb/bbdb.c
index bfb63c5505..e0005a967e 100644
--- a/plugins/bbdb/bbdb.c
+++ b/plugins/bbdb/bbdb.c
@@ -28,8 +28,9 @@
#include <glib/gi18n.h>
#include <string.h>
-#include <libebook/e-book.h>
+#include <libebook/e-book-client.h>
#include <libedataserverui/e-source-combo-box.h>
+#include <libedataserverui/e-client-utils.h>
#include <e-util/e-config.h>
#include <mail/em-config.h>
@@ -58,7 +59,7 @@ struct bbdb_stuff {
/* Static forward declarations */
static gboolean bbdb_timeout (gpointer data);
-static void bbdb_do_it (EBook *book, const gchar *name, const gchar *email);
+static void bbdb_do_it (EBookClient *client, const gchar *name, const gchar *email);
static void add_email_to_contact (EContact *contact, const gchar *email);
static void enable_toggled_cb (GtkWidget *widget, gpointer data);
static void source_changed_cb (ESourceComboBox *source_combo_box, struct bbdb_stuff *stuff);
@@ -191,10 +192,10 @@ G_LOCK_DEFINE_STATIC (todo);
static gpointer
bbdb_do_in_thread (gpointer data)
{
- EBook *book = data;
+ EBookClient *client = data;
/* Open the addressbook */
- if (!book || !bbdb_open_ebook (book)) {
+ if (!client || !bbdb_open_book_client (client)) {
G_LOCK (todo);
g_slist_foreach (todo, (GFunc) free_todo_struct, NULL);
@@ -214,7 +215,7 @@ bbdb_do_in_thread (gpointer data)
G_UNLOCK (todo);
if (td) {
- bbdb_do_it (book, td->name, td->email);
+ bbdb_do_it (client, td->name, td->email);
free_todo_struct (td);
}
@@ -222,7 +223,7 @@ bbdb_do_in_thread (gpointer data)
}
G_UNLOCK (todo);
- g_object_unref (book);
+ g_object_unref (client);
return NULL;
}
@@ -246,18 +247,18 @@ bbdb_do_thread (const gchar *name, const gchar *email)
todo = g_slist_append (todo, td);
} else {
GError *error = NULL;
- EBook *book = bbdb_create_ebook (AUTOMATIC_CONTACTS_ADDRESSBOOK);
+ EBookClient *client = bbdb_create_book_client (AUTOMATIC_CONTACTS_ADDRESSBOOK);
/* list was empty, add item and create a thread */
todo = g_slist_append (todo, td);
- g_thread_create (bbdb_do_in_thread, book, FALSE, &error);
+ g_thread_create (bbdb_do_in_thread, client, FALSE, &error);
if (error) {
g_warning ("%s: Creation of the thread failed with error: %s", G_STRFUNC, error->message);
g_error_free (error);
G_UNLOCK (todo);
- bbdb_do_in_thread (book);
+ bbdb_do_in_thread (client);
G_LOCK (todo);
}
}
@@ -324,16 +325,15 @@ bbdb_handle_send (EPlugin *ep, EMEventTargetComposer *target)
}
static void
-bbdb_do_it (EBook *book, const gchar *name, const gchar *email)
+bbdb_do_it (EBookClient *client, const gchar *name, const gchar *email)
{
- gchar *query_string, *delim, *temp_name = NULL;
- EBookQuery *query;
- GList *contacts = NULL, *l;
+ gchar *query_string, *delim, *temp_name = NULL, *uid;
+ GSList *contacts = NULL;
gboolean status;
EContact *contact;
GError *error = NULL;
- g_return_if_fail (book != NULL);
+ g_return_if_fail (client != NULL);
if (email == NULL || !strcmp (email, ""))
return;
@@ -349,16 +349,10 @@ bbdb_do_it (EBook *book, const gchar *name, const gchar *email)
/* If any contacts exists with this email address, don't do anything */
query_string = g_strdup_printf ("(contains \"email\" \"%s\")", email);
- query = e_book_query_from_string (query_string);
+ status = e_book_client_get_contacts_sync (client, query_string, &contacts, NULL, NULL);
g_free (query_string);
-
- status = e_book_get_contacts (book, query, &contacts, NULL);
- if (query)
- e_book_query_unref (query);
if (contacts != NULL || !status) {
- for (l = contacts; l != NULL; l = l->next)
- g_object_unref ((GObject *) l->data);
- g_list_free (contacts);
+ e_client_util_free_object_slist (contacts);
g_free (temp_name);
return;
@@ -376,39 +370,31 @@ bbdb_do_it (EBook *book, const gchar *name, const gchar *email)
name = temp_name;
}
+ contacts = NULL;
/* If a contact exists with this name, add the email address to it. */
query_string = g_strdup_printf ("(is \"full_name\" \"%s\")", name);
- query = e_book_query_from_string (query_string);
+ status = e_book_client_get_contacts_sync (client, query_string, &contacts, NULL, NULL);
g_free (query_string);
-
- status = e_book_get_contacts (book, query, &contacts, NULL);
- if (query)
- e_book_query_unref (query);
if (contacts != NULL || !status) {
-
/* FIXME: If there's more than one contact with this
name, just give up; we're not smart enough for
this. */
if (!status || contacts->next != NULL) {
- for (l = contacts; l != NULL; l = l->next)
- g_object_unref ((GObject *) l->data);
- g_list_free (contacts);
+ e_client_util_free_object_slist (contacts);
g_free (temp_name);
return;
}
contact = (EContact *) contacts->data;
add_email_to_contact (contact, email);
- if (!e_book_commit_contact (book, contact, &error)) {
+ if (!e_book_client_modify_contact_sync (client, contact, NULL, &error)) {
g_warning ("bbdb: Could not modify contact: %s\n", error->message);
g_error_free (error);
}
- for (l = contacts; l != NULL; l = l->next)
- g_object_unref ((GObject *) l->data);
- g_list_free (contacts);
-
+ e_client_util_free_object_slist (contacts);
g_free (temp_name);
+ g_free (uid);
return;
}
@@ -418,21 +404,22 @@ bbdb_do_it (EBook *book, const gchar *name, const gchar *email)
add_email_to_contact (contact, email);
g_free (temp_name);
- if (!e_book_add_contact (book, contact, &error)) {
- g_warning ("bbdb: Failed to add new contact: %s\n", error->message);
+ uid = NULL;
+ if (!e_book_client_add_contact_sync (client, contact, &uid, NULL, &error)) {
+ g_warning ("bbdb: Failed to add new contact: %s", error->message);
g_error_free (error);
- return;
}
g_object_unref (G_OBJECT (contact));
+ g_free (uid);
}
-EBook *
-bbdb_create_ebook (gint type)
+EBookClient *
+bbdb_create_book_client (gint type)
{
GConfClient *gconf;
gchar *uri;
- EBook *book = NULL;
+ EBookClient *client = NULL;
GError *error = NULL;
gboolean enable = TRUE;
@@ -454,33 +441,36 @@ bbdb_create_ebook (gint type)
g_object_unref (G_OBJECT (gconf));
if (uri == NULL)
- book = e_book_new_system_addressbook (&error);
+ client = e_book_client_new_system (&error);
else {
- book = e_book_new_from_uri (uri, &error);
+ client = e_book_client_new_from_uri (uri, &error);
g_free (uri);
}
- if (book == NULL) {
- g_warning ("bbdb: failed to get addressbook: %s\n", error->message);
- g_error_free (error);
+ if (client == NULL) {
+ g_warning ("bbdb: failed to get addressbook: %s", error ? error->message : "Unknown error");
+ if (error)
+ g_error_free (error);
return NULL;
}
- return book;
+ return client;
}
gboolean
-bbdb_open_ebook (EBook *book)
+bbdb_open_book_client (EBookClient *client)
{
GError *error = NULL;
- if (!book)
+ if (!client)
return FALSE;
- if (!e_book_open (book, FALSE, &error)) {
- g_warning ("bbdb: failed to open addressbook: %s\n", error->message);
- g_error_free (error);
- g_object_unref (book);
+ g_signal_connect (client, "authenticate", G_CALLBACK (e_client_utils_authenticate_handler), NULL);
+ if (!e_client_open_sync (E_CLIENT (client), FALSE, NULL, &error)) {
+ g_warning ("bbdb: failed to open addressbook: %s", error ? error->message : "Unknown error");
+ if (error)
+ g_error_free (error);
+ g_object_unref (client);
return FALSE;
}
diff --git a/plugins/bbdb/bbdb.h b/plugins/bbdb/bbdb.h
index fe7b998274..cbeb4ebb42 100644
--- a/plugins/bbdb/bbdb.h
+++ b/plugins/bbdb/bbdb.h
@@ -37,14 +37,17 @@
#define GAIM_ADDRESSBOOK 1
#define AUTOMATIC_CONTACTS_ADDRESSBOOK 0
+#include <libebook/e-book-client.h>
+#include <libebook/e-contact.h>
+
/* bbdb.c */
-/* creates an EBook for a given type (gaim or contacts), but doesn't open it;
+/* creates an EBookClient for a given type (gaim or contacts), but doesn't open it;
this function should be called in a main thread. */
-EBook *bbdb_create_ebook (gint type);
+EBookClient *bbdb_create_book_client (gint type);
-/* opens an EBook. Returns false if it fails, and unrefs the book too;
+/* opens an EBookClient. Returns false if it fails, and unrefs the book too;
this function can be called in any thread */
-gboolean bbdb_open_ebook (EBook *book);
+gboolean bbdb_open_book_client (EBookClient *client);
gboolean bbdb_check_gaim_enabled (void);
diff --git a/plugins/bbdb/gaimbuddies.c b/plugins/bbdb/gaimbuddies.c
index f6a048e975..1becdee0ac 100644
--- a/plugins/bbdb/gaimbuddies.c
+++ b/plugins/bbdb/gaimbuddies.c
@@ -42,7 +42,8 @@
#include <glib/gi18n.h>
#include <string.h>
-#include <libebook/e-book.h>
+#include <libebook/e-book-client.h>
+#include <libebook/e-book-query.h>
#include <libedataserverui/e-source-combo-box.h>
#include <sys/time.h>
@@ -60,7 +61,7 @@ typedef struct {
} GaimBuddy;
/* Forward declarations for this file. */
-static gboolean bbdb_merge_buddy_to_contact (EBook *book, GaimBuddy *b, EContact *c);
+static gboolean bbdb_merge_buddy_to_contact (EBookClient *client, GaimBuddy *b, EContact *c);
static GList *bbdb_get_gaim_buddy_list (void);
static gchar *get_node_text (xmlNodePtr node);
static gchar *get_buddy_icon_from_setting (xmlNodePtr setting);
@@ -189,7 +190,7 @@ G_LOCK_DEFINE_STATIC (syncing);
struct sync_thread_data
{
GList *blist;
- EBook *book;
+ EBookClient *client;
};
static gpointer
@@ -200,8 +201,8 @@ bbdb_sync_buddy_list_in_thread (gpointer data)
g_return_val_if_fail (std != NULL, NULL);
- if (!bbdb_open_ebook (std->book)) {
- /* book got freed in bbdb_open_ebook on a failure */
+ if (!bbdb_open_book_client (std->client)) {
+ /* client got freed in bbdb_open_book_client on a failure */
free_buddy_list (std->blist);
g_free (std);
@@ -217,7 +218,8 @@ bbdb_sync_buddy_list_in_thread (gpointer data)
for (l = std->blist; l != NULL; l = l->next) {
GaimBuddy *b = l->data;
EBookQuery *query;
- GList *contacts = NULL;
+ gchar *query_string, *uid;
+ GSList *contacts = NULL;
GError *error = NULL;
EContact *c;
@@ -227,52 +229,59 @@ bbdb_sync_buddy_list_in_thread (gpointer data)
}
/* Look for an exact match full name == buddy alias */
- query = e_book_query_field_test (
- E_CONTACT_FULL_NAME, E_BOOK_QUERY_IS, b->alias);
-
- if (!e_book_get_contacts (std->book, query, &contacts, NULL)) {
- e_book_query_unref (query);
+ query = e_book_query_field_test (E_CONTACT_FULL_NAME, E_BOOK_QUERY_IS, b->alias);
+ query_string = e_book_query_to_string (query);
+ e_book_query_unref (query);
+ if (!e_book_client_get_contacts_sync (std->client, query_string, &contacts, NULL, NULL)) {
+ g_free (query_string);
continue;
}
- e_book_query_unref (query);
+ g_free (query_string);
if (contacts != NULL) {
/* FIXME: If there's more than one contact with this
name, just give up; we're not smart enough for
this. */
- if (contacts->next != NULL)
+ if (contacts->next != NULL) {
+ e_client_util_free_object_slist (contacts);
continue;
+ }
c = E_CONTACT (contacts->data);
- if (!bbdb_merge_buddy_to_contact (std->book, b, c))
+ if (!bbdb_merge_buddy_to_contact (std->client, b, c)) {
+ e_client_util_free_object_slist (contacts);
continue;
+ }
/* Write it out to the addressbook */
- if (!e_book_commit_contact (std->book, c, &error)) {
- g_warning ("bbdb: Could not modify contact: %s\n", error->message);
+ if (!e_book_client_modify_contact_sync (std->client, c, NULL, &error)) {
+ g_warning ("bbdb: Could not modify contact: %s", error->message);
g_error_free (error);
}
+ e_client_util_free_object_slist (contacts);
continue;
}
/* Otherwise, create a new contact. */
c = e_contact_new ();
e_contact_set (c, E_CONTACT_FULL_NAME, (gpointer) b->alias);
- if (!bbdb_merge_buddy_to_contact (std->book, b, c)) {
- g_object_unref (G_OBJECT (c));
+ if (!bbdb_merge_buddy_to_contact (std->client, b, c)) {
+ g_object_unref (c);
continue;
}
- if (!e_book_add_contact (std->book, c, &error)) {
- g_warning ("bbdb: Failed to add new contact: %s\n", error->message);
+ uid = NULL;
+ if (!e_book_client_add_contact_sync (std->client, c, &uid, NULL, &error)) {
+ g_warning ("bbdb: Failed to add new contact: %s", error->message);
g_error_free (error);
goto finish;
}
- g_object_unref (G_OBJECT (c));
+ g_object_unref (c);
+ g_free (uid);
}
g_idle_add (store_last_sync_idle_cb, NULL);
@@ -280,7 +289,7 @@ bbdb_sync_buddy_list_in_thread (gpointer data)
finish:
printf ("bbdb: Done syncing buddy list to contacts.\n");
- g_object_unref (std->book);
+ g_object_unref (std->client);
free_buddy_list (std->blist);
g_free (std);
@@ -296,7 +305,7 @@ bbdb_sync_buddy_list (void)
{
GList *blist;
GError *error = NULL;
- EBook *book = NULL;
+ EBookClient *client = NULL;
struct sync_thread_data *std;
G_LOCK (syncing);
@@ -314,8 +323,8 @@ bbdb_sync_buddy_list (void)
}
/* Open the addressbook */
- book = bbdb_create_ebook (GAIM_ADDRESSBOOK);
- if (book == NULL) {
+ client = bbdb_create_book_client (GAIM_ADDRESSBOOK);
+ if (client == NULL) {
free_buddy_list (blist);
G_UNLOCK (syncing);
return;
@@ -323,7 +332,7 @@ bbdb_sync_buddy_list (void)
std = g_new0 (struct sync_thread_data, 1);
std->blist = blist;
- std->book = book;
+ std->client = client;
syncing = TRUE;
@@ -358,7 +367,7 @@ im_list_contains_buddy (GList *ims, GaimBuddy *b)
}
static gboolean
-bbdb_merge_buddy_to_contact (EBook *book, GaimBuddy *b, EContact *c)
+bbdb_merge_buddy_to_contact (EBookClient *client, GaimBuddy *b, EContact *c)
{
EContactField field;
GList *ims;
diff --git a/plugins/caldav/caldav-browse-server.c b/plugins/caldav/caldav-browse-server.c
index 3a78217b1a..d169dda8f8 100644
--- a/plugins/caldav/caldav-browse-server.c
+++ b/plugins/caldav/caldav-browse-server.c
@@ -32,7 +32,7 @@
#include <libxml/xpath.h>
#include <libxml/xpathInternals.h>
-#include <libecal/e-cal.h>
+#include <libecal/e-cal-client.h>
#include <libedataserver/e-proxy.h>
#include <libedataserverui/e-cell-renderer-color.h>
#include <libedataserverui/e-passwords.h>
@@ -1369,13 +1369,13 @@ init_dialog (GtkDialog *dialog, GtkWidget **new_url_entry, GtkWidget **new_userm
switch (source_type) {
default:
- case E_CAL_SOURCE_TYPE_EVENT:
+ case E_CAL_CLIENT_SOURCE_TYPE_EVENTS:
source_type_str = "VEVENT";
break;
- case E_CAL_SOURCE_TYPE_TODO:
+ case E_CAL_CLIENT_SOURCE_TYPE_TASKS:
source_type_str = "VTODO";
break;
- case E_CAL_SOURCE_TYPE_JOURNAL:
+ case E_CAL_CLIENT_SOURCE_TYPE_MEMOS:
source_type_str = "VJOURNAL";
break;
}
diff --git a/plugins/caldav/caldav-source.c b/plugins/caldav/caldav-source.c
index 11c651f7d9..41cebef760 100644
--- a/plugins/caldav/caldav-source.c
+++ b/plugins/caldav/caldav-source.c
@@ -33,7 +33,7 @@
#include <e-util/e-plugin-util.h>
#include <calendar/gui/e-cal-config.h>
#include <libedataserver/e-account-list.h>
-#include <libecal/e-cal.h>
+#include <libecal/e-cal-client.h>
#include <string.h>
@@ -53,12 +53,15 @@ GtkWidget * oge_caldav (EPlugin *epl,
/* plugin intialization */
static void
-ensure_caldav_source_group (ECalSourceType source_type)
+ensure_caldav_source_group (ECalClientSourceType source_type)
{
- ESourceList *slist;
+ ESourceList *slist;
+ GError *error = NULL;
- if (!e_cal_get_sources (&slist, source_type, NULL)) {
- g_warning ("Could not get calendar source list from GConf!");
+ if (!e_cal_client_get_sources (&slist, source_type, &error)) {
+ g_warning ("Could not get calendar sources: %s", error ? error->message : "Unknown error");
+ if (error)
+ g_error_free (error);
return;
}
@@ -72,9 +75,9 @@ e_plugin_lib_enable (EPlugin *ep, gint enable)
if (enable) {
d(g_print ("CalDAV Eplugin starting up ...\n"));
- ensure_caldav_source_group (E_CAL_SOURCE_TYPE_EVENT);
- ensure_caldav_source_group (E_CAL_SOURCE_TYPE_TODO);
- ensure_caldav_source_group (E_CAL_SOURCE_TYPE_JOURNAL);
+ ensure_caldav_source_group (E_CAL_CLIENT_SOURCE_TYPE_EVENTS);
+ ensure_caldav_source_group (E_CAL_CLIENT_SOURCE_TYPE_TASKS);
+ ensure_caldav_source_group (E_CAL_CLIENT_SOURCE_TYPE_MEMOS);
}
return 0;
diff --git a/plugins/calendar-file/calendar-file.c b/plugins/calendar-file/calendar-file.c
index f162914dd8..a7b821d285 100644
--- a/plugins/calendar-file/calendar-file.c
+++ b/plugins/calendar-file/calendar-file.c
@@ -165,16 +165,16 @@ e_calendar_file_customs (EPlugin *epl, EConfigHookItemFactoryData *data)
const gchar *file_name = NULL;
switch (t->source_type) {
- case E_CAL_SOURCE_TYPE_EVENT:
+ case E_CAL_CLIENT_SOURCE_TYPE_EVENTS:
file_name = "calendar.ics";
break;
- case E_CAL_SOURCE_TYPE_TODO:
+ case E_CAL_CLIENT_SOURCE_TYPE_TASKS:
file_name = "tasks.ics";
break;
- case E_CAL_SOURCE_TYPE_JOURNAL:
+ case E_CAL_CLIENT_SOURCE_TYPE_MEMOS:
file_name = "journal.ics";
break;
- case E_CAL_SOURCE_TYPE_LAST:
+ case E_CAL_CLIENT_SOURCE_TYPE_LAST:
break;
}
diff --git a/plugins/dbx-import/dbx-importer.c b/plugins/dbx-import/dbx-importer.c
index 1c977750b1..3bc70030db 100644
--- a/plugins/dbx-import/dbx-importer.c
+++ b/plugins/dbx-import/dbx-importer.c
@@ -57,9 +57,8 @@
#include <shell/e-shell-view.h>
#include <libebook/e-contact.h>
-#include <libebook/e-book.h>
-#include <libecal/e-cal.h>
+#include <libecal/e-cal-client.h>
#include <libecal/e-cal-component.h>
#include <libedataserver/e-data-server-util.h>
diff --git a/plugins/default-source/default-source.c b/plugins/default-source/default-source.c
index 770dc25852..02a0d42baa 100644
--- a/plugins/default-source/default-source.c
+++ b/plugins/default-source/default-source.c
@@ -30,8 +30,8 @@
#include <calendar/gui/e-cal-config.h>
#include <libedataserver/e-source.h>
#include <addressbook/gui/widgets/eab-config.h>
-#include <libebook/e-book.h>
-#include <libecal/e-cal.h>
+#include <libebook/e-book-client.h>
+#include <libecal/e-cal-client.h>
#include <glib/gi18n.h>
#include <string.h>
@@ -58,7 +58,7 @@ commit_default_calendar (EPlugin *epl, EConfigTarget *target)
cal_target = (ECalConfigTargetSource *) target;
source = cal_target->source;
if (e_source_get_property (source, "default"))
- e_cal_set_default_source (source, cal_target->source_type, NULL);
+ e_cal_client_set_default_source (source, cal_target->source_type, NULL);
}
void
@@ -70,7 +70,7 @@ commit_default_book (EPlugin *epl, EConfigTarget *target)
book_target = (EABConfigTargetSource *) target;
source = book_target->source;
if (e_source_get_property (source, "default"))
- e_book_set_default_source (source, NULL);
+ e_book_client_set_default_source (source, NULL);
}
@@ -101,14 +101,14 @@ org_gnome_autocomplete_book (EPlugin *epl, EConfigHookItemFactoryData *data)
}
static const gchar *
-get_calendar_option_caption (ECalSourceType source_type)
+get_calendar_option_caption (ECalClientSourceType source_type)
{
const gchar *res = "???";
switch (source_type) {
- case E_CAL_SOURCE_TYPE_EVENT: res = _("Mark as _default calendar"); break;
- case E_CAL_SOURCE_TYPE_TODO: res = _("Mark as _default task list"); break;
- case E_CAL_SOURCE_TYPE_JOURNAL: res = _("Mark as _default memo list"); break;
+ case E_CAL_CLIENT_SOURCE_TYPE_EVENTS: res = _("Mark as _default calendar"); break;
+ case E_CAL_CLIENT_SOURCE_TYPE_TASKS: res = _("Mark as _default task list"); break;
+ case E_CAL_CLIENT_SOURCE_TYPE_MEMOS: res = _("Mark as _default memo list"); break;
default: break;
}
diff --git a/plugins/google-account-setup/google-source.c b/plugins/google-account-setup/google-source.c
index 38bbad3385..1fce9858b8 100644
--- a/plugins/google-account-setup/google-source.c
+++ b/plugins/google-account-setup/google-source.c
@@ -42,7 +42,7 @@
#include <libedataserver/e-url.h>
#include <libedataserver/e-account-list.h>
#include <libedataserver/e-proxy.h>
-#include <libecal/e-cal.h>
+#include <libecal/e-cal-client.h>
#include <libedataserverui/e-cell-renderer-color.h>
#include <libedataserverui/e-passwords.h>
@@ -71,9 +71,12 @@ static void
ensure_google_source_group (void)
{
ESourceList *slist;
+ GError *error = NULL;
- if (!e_cal_get_sources (&slist, E_CAL_SOURCE_TYPE_EVENT, NULL)) {
- g_warning ("Could not get calendar source list from GConf!");
+ if (!e_cal_client_get_sources (&slist, E_CAL_CLIENT_SOURCE_TYPE_EVENTS, &error)) {
+ g_debug ("%s: Could not get calendar source list: %s", G_STRFUNC, error ? error->message : "Unknown error");
+ if (error)
+ g_error_free (error);
return;
}
diff --git a/plugins/itip-formatter/itip-formatter.c b/plugins/itip-formatter/itip-formatter.c
index 95c6238c0a..c8adbcf615 100644
--- a/plugins/itip-formatter/itip-formatter.c
+++ b/plugins/itip-formatter/itip-formatter.c
@@ -28,9 +28,10 @@
#include <gtk/gtk.h>
#include <glib/gi18n.h>
#include <gconf/gconf-client.h>
-#include <libecal/e-cal.h>
+#include <libecal/e-cal-client.h>
#include <libecal/e-cal-time-util.h>
#include <libedataserverui/e-source-selector.h>
+#include <libedataserverui/e-client-utils.h>
#include <gtkhtml/gtkhtml-embedded.h>
#include <mail/em-format-hook.h>
#include <mail/em-config.h>
@@ -44,7 +45,6 @@
#include <e-util/e-alert-dialog.h>
#include <e-util/e-mktemp.h>
#include <calendar/gui/itip-utils.h>
-#include <calendar/common/authentication.h>
#include <shell/e-shell.h>
#include <shell/e-shell-utils.h>
#include "itip-view.h"
@@ -66,11 +66,11 @@ struct _itip_puri {
gchar *uid;
GtkWidget *view;
- ESourceList *source_lists[E_CAL_SOURCE_TYPE_LAST];
- GHashTable *ecals[E_CAL_SOURCE_TYPE_LAST];
+ ESourceList *source_lists[E_CAL_CLIENT_SOURCE_TYPE_LAST];
+ GHashTable *ecals[E_CAL_CLIENT_SOURCE_TYPE_LAST];
- ECal *current_ecal;
- ECalSourceType type;
+ ECalClient *current_client;
+ ECalClientSourceType type;
gchar *vcalendar;
ECalComponent *comp;
@@ -145,8 +145,6 @@ typedef struct {
gint count;
} FormatItipFindData;
-typedef void (* FormatItipOpenFunc) (ECal *ecal, const GError *error, gpointer data);
-
static gboolean check_is_instance (icalcomponent *icalcomp);
gint
@@ -419,7 +417,7 @@ get_real_item (struct _itip_puri *pitip)
e_cal_component_get_uid (pitip->comp, &uid);
- found = e_cal_get_object (pitip->current_ecal, uid, NULL, &icalcomp, NULL);
+ found = e_cal_client_get_object_sync (pitip->current_client, uid, NULL, &icalcomp, NULL, NULL);
if (!found)
return NULL;
@@ -465,10 +463,10 @@ set_buttons_sensitive (struct _itip_puri *pitip)
{
gboolean read_only = TRUE;
- if (pitip->current_ecal)
- e_cal_is_read_only (pitip->current_ecal, &read_only, NULL);
+ if (pitip->current_client)
+ read_only = e_client_is_readonly (E_CLIENT (pitip->current_client));
- itip_view_set_buttons_sensitive (ITIP_VIEW (pitip->view), pitip->current_ecal != NULL && !read_only);
+ itip_view_set_buttons_sensitive (ITIP_VIEW (pitip->view), pitip->current_client != NULL && !read_only);
}
static void
@@ -490,32 +488,42 @@ add_failed_to_load_msg (ItipView *view, ESource *source, const GError *error)
}
static void
-cal_opened_cb (ECal *ecal, const GError *error, gpointer data)
+cal_opened_cb (GObject *source_object, GAsyncResult *result, gpointer user_data)
{
- struct _itip_puri *pitip = data;
+ struct _itip_puri *pitip = user_data;
ESource *source;
- ECalSourceType source_type;
+ ECalClientSourceType source_type;
+ ECalClient *client = E_CAL_CLIENT (source_object);
+ GError *error = NULL;
- source_type = e_cal_get_source_type (ecal);
- source = e_cal_get_source (ecal);
+ if (!e_client_open_finish (E_CLIENT (client), result, &error)) {
+ if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_AUTHENTICATION_FAILED)) {
+ g_error_free (error);
+ e_client_open (E_CLIENT (client), TRUE, NULL, cal_opened_cb, user_data);
+ return;
+ }
+ }
- g_signal_handlers_disconnect_matched (ecal, G_SIGNAL_MATCH_FUNC, 0, 0, NULL, cal_opened_cb, NULL);
+ source_type = e_cal_client_get_source_type (client);
+ source = e_client_get_source (E_CLIENT (client));
if (error) {
d(printf ("Failed opening itip formatter calendar '%s' during non-search opening\n", e_source_peek_name (source)));
add_failed_to_load_msg (ITIP_VIEW (pitip->view), source, error);
- if (pitip->current_ecal == ecal) {
- pitip->current_ecal = NULL;
+ if (pitip->current_client == client) {
+ pitip->current_client = NULL;
itip_view_set_buttons_sensitive (ITIP_VIEW (pitip->view), FALSE);
}
g_hash_table_remove (pitip->ecals[source_type], e_source_peek_uid (source));
+
+ g_error_free (error);
return;
}
- if (e_cal_get_static_capability (ecal, CAL_STATIC_CAPABILITY_RECURRENCES_NO_MASTER)) {
+ if (e_cal_client_check_recurrences_no_master (client)) {
icalcomponent *icalcomp = e_cal_component_get_icalcomponent (pitip->comp);
if (check_is_instance (icalcomp))
@@ -524,23 +532,23 @@ cal_opened_cb (ECal *ecal, const GError *error, gpointer data)
itip_view_set_show_recur_check (ITIP_VIEW (pitip->view), FALSE);
}
- if (pitip->type == E_CAL_SOURCE_TYPE_JOURNAL) {
- if (e_cal_get_static_capability (ecal, CAL_STATIC_CAPABILITY_HAS_UNACCEPTED_MEETING))
+ if (pitip->type == E_CAL_CLIENT_SOURCE_TYPE_MEMOS) {
+ if (e_client_check_capability (E_CLIENT (client), CAL_STATIC_CAPABILITY_HAS_UNACCEPTED_MEETING))
itip_view_set_needs_decline (ITIP_VIEW (pitip->view), TRUE);
else
itip_view_set_needs_decline (ITIP_VIEW (pitip->view), FALSE);
itip_view_set_mode (ITIP_VIEW (pitip->view), ITIP_VIEW_MODE_PUBLISH);
}
- pitip->current_ecal = ecal;
+ pitip->current_client = client;
set_buttons_sensitive (pitip);
}
-static ECal *
-start_calendar_server (struct _itip_puri *pitip, ESource *source, ECalSourceType type, FormatItipOpenFunc func, gpointer data)
+static ECalClient *
+start_calendar_server (struct _itip_puri *pitip, ESource *source, ECalClientSourceType type, GAsyncReadyCallback func, gpointer data)
{
- ECal *ecal;
+ ECalClient *client;
EShell *shell;
EShellSettings *shell_settings;
icaltimezone *zone = NULL;
@@ -550,43 +558,41 @@ start_calendar_server (struct _itip_puri *pitip, ESource *source, ECalSourceType
shell = e_shell_get_default ();
shell_settings = e_shell_get_shell_settings (shell);
- ecal = g_hash_table_lookup (pitip->ecals[type], e_source_peek_uid (source));
- if (ecal) {
- pitip->current_ecal = ecal;
+ client = g_hash_table_lookup (pitip->ecals[type], e_source_peek_uid (source));
+ if (client) {
+ pitip->current_client = client;
itip_view_remove_lower_info_item (ITIP_VIEW (pitip->view), pitip->progress_info_id);
pitip->progress_info_id = 0;
set_buttons_sensitive (pitip);
- return ecal;
+ return client;
}
- ecal = e_auth_new_cal_from_source (source, type);
-
- if (!ecal)
+ client = e_cal_client_new (source, type, NULL);
+ if (!client)
return NULL;
- g_signal_connect (G_OBJECT (ecal), "cal_opened_ex", G_CALLBACK (func), data);
+ g_signal_connect (client, "authenticate", G_CALLBACK (e_client_utils_authenticate_handler), NULL);
- g_hash_table_insert (pitip->ecals[type], g_strdup (e_source_peek_uid (source)), ecal);
+ g_hash_table_insert (pitip->ecals[type], g_strdup (e_source_peek_uid (source)), client);
zone = e_shell_settings_get_pointer (shell_settings, "cal-timezone");
- e_cal_set_default_timezone (ecal, zone, NULL);
+ e_cal_client_set_default_timezone (client, zone);
+ e_client_open (E_CLIENT (client), TRUE, NULL, func, data);
- e_cal_open_async (ecal, TRUE);
-
- return ecal;
+ return client;
}
-static ECal *
-start_calendar_server_by_uid (struct _itip_puri *pitip, const gchar *uid, ECalSourceType type)
+static ECalClient *
+start_calendar_server_by_uid (struct _itip_puri *pitip, const gchar *uid, ECalClientSourceType type)
{
gint i;
itip_view_set_buttons_sensitive (ITIP_VIEW (pitip->view), FALSE);
- for (i = 0; i < E_CAL_SOURCE_TYPE_LAST; i++) {
+ for (i = 0; i < E_CAL_CLIENT_SOURCE_TYPE_LAST; i++) {
ESource *source;
source = e_source_list_peek_source_by_uid (pitip->source_lists[i], uid);
@@ -610,21 +616,29 @@ source_selected_cb (ItipView *view, ESource *source, gpointer data)
}
static void
-find_cal_opened_cb (ECal *ecal, const GError *error, gpointer data)
+find_cal_opened_cb (GObject *source_object, GAsyncResult *result, gpointer user_data)
{
- FormatItipFindData *fd = data;
+ FormatItipFindData *fd = user_data;
struct _itip_puri *pitip = fd->puri;
ESource *source;
- ECalSourceType source_type;
+ ECalClientSourceType source_type;
icalcomponent *icalcomp;
- GList *objects = NULL;
+ GSList *objects = NULL;
+ ECalClient *client = E_CAL_CLIENT (source_object);
+ GError *error = NULL;
- source_type = e_cal_get_source_type (ecal);
- source = e_cal_get_source (ecal);
+ if (!e_client_open_finish (E_CLIENT (client), result, &error)) {
+ if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_AUTHENTICATION_FAILED)) {
+ g_error_free (error);
+ e_client_open (E_CLIENT (client), TRUE, NULL, find_cal_opened_cb, user_data);
+ return;
+ }
+ }
- fd->count--;
+ source_type = e_cal_client_get_source_type (client);
+ source = e_client_get_source (E_CLIENT (client));
- g_signal_handlers_disconnect_matched (ecal, G_SIGNAL_MATCH_FUNC, 0, 0, NULL, find_cal_opened_cb, NULL);
+ fd->count--;
if (error) {
/* FIXME Do we really want to warn here? If we fail
@@ -633,31 +647,32 @@ find_cal_opened_cb (ECal *ecal, const GError *error, gpointer data)
d(printf ("Failed opening itip formatter calendar '%s' during search opening... ", e_source_peek_name (source)));
add_failed_to_load_msg (ITIP_VIEW (pitip->view), source, error);
- if (pitip->current_ecal == ecal) {
- pitip->current_ecal = NULL;
+ if (pitip->current_client == client) {
+ pitip->current_client = NULL;
itip_view_set_buttons_sensitive (ITIP_VIEW (pitip->view), FALSE);
}
g_hash_table_remove (pitip->ecals[source_type], e_source_peek_uid (source));
+ g_error_free (error);
goto cleanup;
}
/* Check for conflicts */
/* If the query fails, we'll just ignore it */
/* FIXME What happens for recurring conflicts? */
- if (pitip->type == E_CAL_SOURCE_TYPE_EVENT
+ if (pitip->type == E_CAL_CLIENT_SOURCE_TYPE_EVENTS
&& e_source_get_property (E_SOURCE (source), "conflict")
&& !g_ascii_strcasecmp (e_source_get_property (E_SOURCE (source), "conflict"), "true")
- && e_cal_get_object_list (ecal, fd->sexp, &objects, NULL)
- && g_list_length (objects) > 0) {
+ && e_cal_client_get_object_list_sync (client, fd->sexp, &objects, NULL, NULL)
+ && g_slist_length (objects) > 0) {
itip_view_add_upper_info_item_printf (ITIP_VIEW (pitip->view), ITIP_VIEW_INFO_ITEM_TYPE_WARNING,
_("An appointment in the calendar '%s' conflicts with this meeting"), e_source_peek_name (source));
- e_cal_free_object_list (objects);
+ e_cal_client_free_icalcomp_slist (objects);
}
/* search for a master object if the detached object doesn't exist in the calendar */
- if (!pitip->current_ecal && (e_cal_get_object (ecal, fd->uid, fd->rid, &icalcomp, NULL) || (fd->rid && e_cal_get_object (ecal, fd->uid, NULL, &icalcomp, NULL)))) {
+ if (!pitip->current_client && (e_cal_client_get_object_sync (client, fd->uid, fd->rid, &icalcomp, NULL, NULL) || (fd->rid && e_cal_client_get_object_sync (client, fd->uid, NULL, &icalcomp, NULL, NULL)))) {
if ((pitip->method == ICAL_METHOD_PUBLISH || pitip->method == ICAL_METHOD_REQUEST) &&
(icalcomponent_get_first_component (icalcomp, ICAL_VALARM_COMPONENT) ||
icalcomponent_get_first_component (icalcomp, ICAL_XAUDIOALARM_COMPONENT) ||
@@ -670,7 +685,7 @@ find_cal_opened_cb (ECal *ecal, const GError *error, gpointer data)
icalcomponent_free (icalcomp);
- pitip->current_ecal = ecal;
+ pitip->current_client = client;
/* Provide extra info, since its not in the component */
/* FIXME Check sequence number of meeting? */
@@ -690,11 +705,11 @@ find_cal_opened_cb (ECal *ecal, const GError *error, gpointer data)
_("Found the appointment in the calendar '%s'"), e_source_peek_name (source));
set_buttons_sensitive (pitip);
- } else if (!pitip->current_ecal)
+ } else if (!pitip->current_client)
itip_view_set_show_keep_alarm_check (ITIP_VIEW (pitip->view), FALSE);
- if (pitip->current_ecal) {
- if (e_cal_get_static_capability (pitip->current_ecal, CAL_STATIC_CAPABILITY_RECURRENCES_NO_MASTER)) {
+ if (pitip->current_client) {
+ if (e_cal_client_check_recurrences_no_master (pitip->current_client)) {
icalcomponent *icalcomp = e_cal_component_get_icalcomponent (pitip->comp);
if (check_is_instance (icalcomp))
@@ -703,9 +718,9 @@ find_cal_opened_cb (ECal *ecal, const GError *error, gpointer data)
itip_view_set_show_recur_check (ITIP_VIEW (pitip->view), FALSE);
}
- if (pitip->type == E_CAL_SOURCE_TYPE_JOURNAL) {
+ if (pitip->type == E_CAL_CLIENT_SOURCE_TYPE_MEMOS) {
/* TODO The static capability should be made generic to convey that the calendar contains unaccepted items */
- if (e_cal_get_static_capability (pitip->current_ecal, CAL_STATIC_CAPABILITY_HAS_UNACCEPTED_MEETING))
+ if (e_client_check_capability (E_CLIENT (pitip->current_client), CAL_STATIC_CAPABILITY_HAS_UNACCEPTED_MEETING))
itip_view_set_needs_decline (ITIP_VIEW (pitip->view), TRUE);
else
itip_view_set_needs_decline (ITIP_VIEW (pitip->view), FALSE);
@@ -729,7 +744,7 @@ find_cal_opened_cb (ECal *ecal, const GError *error, gpointer data)
* invitiations (REQUEST), but not replies (REPLY).
* Replies only make sense for events with an organizer.
*/
- if (!e_cal_get_static_capability (ecal, CAL_STATIC_CAPABILITY_SAVE_SCHEDULES) &&
+ if (!e_cal_client_check_save_schedules (client) &&
(pitip->method == ICAL_METHOD_PUBLISH || pitip->method == ICAL_METHOD_REQUEST) &&
pitip->has_organizer) {
rsvp_enabled = TRUE;
@@ -740,7 +755,7 @@ find_cal_opened_cb (ECal *ecal, const GError *error, gpointer data)
itip_view_set_rsvp (ITIP_VIEW (pitip->view), !pitip->no_reply_wanted);
if ((pitip->method == ICAL_METHOD_PUBLISH || pitip->method == ICAL_METHOD_REQUEST)
- && !pitip->current_ecal) {
+ && !pitip->current_client) {
/* Reuse already declared one or rename? */
EShell *shell;
EShellSettings *shell_settings;
@@ -752,15 +767,15 @@ find_cal_opened_cb (ECal *ecal, const GError *error, gpointer data)
shell_settings = e_shell_get_shell_settings (shell);
switch (pitip->type) {
- case E_CAL_SOURCE_TYPE_EVENT:
+ case E_CAL_CLIENT_SOURCE_TYPE_EVENTS:
uid = e_shell_settings_get_string (
shell_settings, "cal-primary-calendar");
break;
- case E_CAL_SOURCE_TYPE_TODO:
+ case E_CAL_CLIENT_SOURCE_TYPE_TASKS:
uid = e_shell_settings_get_string (
shell_settings, "cal-primary-task-list");
break;
- case E_CAL_SOURCE_TYPE_JOURNAL:
+ case E_CAL_CLIENT_SOURCE_TYPE_MEMOS:
uid = e_shell_settings_get_string (
shell_settings, "cal-primary-memo-list");
break;
@@ -789,17 +804,17 @@ find_cal_opened_cb (ECal *ecal, const GError *error, gpointer data)
itip_view_add_lower_info_item (ITIP_VIEW (pitip->view), ITIP_VIEW_INFO_ITEM_TYPE_ERROR, _("Unable to find any calendars"));
itip_view_set_buttons_sensitive (ITIP_VIEW (pitip->view), FALSE);
}
- } else if (!pitip->current_ecal) {
+ } else if (!pitip->current_client) {
switch (pitip->type) {
- case E_CAL_SOURCE_TYPE_EVENT:
+ case E_CAL_CLIENT_SOURCE_TYPE_EVENTS:
itip_view_add_lower_info_item_printf (ITIP_VIEW (pitip->view), ITIP_VIEW_INFO_ITEM_TYPE_WARNING,
_("Unable to find this meeting in any calendar"));
break;
- case E_CAL_SOURCE_TYPE_TODO:
+ case E_CAL_CLIENT_SOURCE_TYPE_TASKS:
itip_view_add_lower_info_item_printf (ITIP_VIEW (pitip->view), ITIP_VIEW_INFO_ITEM_TYPE_WARNING,
_("Unable to find this task in any task list"));
break;
- case E_CAL_SOURCE_TYPE_JOURNAL:
+ case E_CAL_CLIENT_SOURCE_TYPE_MEMOS:
itip_view_add_lower_info_item_printf (ITIP_VIEW (pitip->view), ITIP_VIEW_INFO_ITEM_TYPE_WARNING,
_("Unable to find this memo in any memo list"));
break;
@@ -913,7 +928,7 @@ find_server (struct _itip_puri *pitip, ECalComponent *comp)
d(printf ("Increasing itip formatter search count to %d\n", fd->count));
if (current_source == source)
- pitip->current_ecal = start_calendar_server (pitip, source, pitip->type, find_cal_opened_cb, fd);
+ pitip->current_client = start_calendar_server (pitip, source, pitip->type, find_cal_opened_cb, fd);
else
start_calendar_server (pitip, source, pitip->type, find_cal_opened_cb, fd);
@@ -925,18 +940,6 @@ find_server (struct _itip_puri *pitip, ECalComponent *comp)
g_free (rid);
}
-static void
-cleanup_ecal (gpointer data)
-{
- ECal *ecal = data;
-
- /* Clean up any signals */
- g_signal_handlers_disconnect_matched (ecal, G_SIGNAL_MATCH_FUNC, 0, 0, NULL, cal_opened_cb, NULL);
- g_signal_handlers_disconnect_matched (ecal, G_SIGNAL_MATCH_FUNC, 0, 0, NULL, find_cal_opened_cb, NULL);
-
- g_object_unref (ecal);
-}
-
static gboolean
change_status (icalcomponent *ical_comp, const gchar *address, icalparameter_partstat status)
{
@@ -1167,7 +1170,7 @@ update_item (struct _itip_puri *pitip, ItipViewResponse response)
result = FALSE;
goto cleanup;
}
- source = e_cal_get_source (pitip->current_ecal);
+ source = e_client_get_source (E_CLIENT (pitip->current_client));
if (itip_view_get_keep_alarm_check_state (ITIP_VIEW (pitip->view))) {
ECalComponent *real_comp;
@@ -1250,7 +1253,7 @@ update_item (struct _itip_puri *pitip, ItipViewResponse response)
e_cal_component_set_attachment_list (clone_comp, new_attachments);
}
- if (!e_cal_receive_objects (pitip->current_ecal, pitip->top_level, &error)) {
+ if (!e_cal_client_receive_objects_sync (pitip->current_client, pitip->top_level, NULL, &error)) {
itip_view_add_lower_info_item_printf (ITIP_VIEW (pitip->view), ITIP_VIEW_INFO_ITEM_TYPE_INFO,
_("Unable to send item to calendar '%s'. %s"),
e_source_peek_name (source), error->message);
@@ -1340,7 +1343,7 @@ set_attendee (ECalComponent *comp, const gchar *address)
}
static gboolean
-send_comp_to_attendee (ECalComponentItipMethod method, ECalComponent *comp, const gchar *user, ECal *client, const gchar *comment)
+send_comp_to_attendee (ECalComponentItipMethod method, ECalComponent *comp, const gchar *user, ECalClient *client, const gchar *comment)
{
gboolean status;
ECalComponent *send_comp = e_cal_component_clone (comp);
@@ -1375,9 +1378,9 @@ remove_delegate (struct _itip_puri *pitip, const gchar *delegate, const gchar *d
gchar *comment = g_strdup_printf (_("Organizer has removed the delegate %s "), itip_strip_mailto (delegate));
/* send cancellation notice to delegate */
- status = send_comp_to_attendee (E_CAL_COMPONENT_METHOD_CANCEL, pitip->comp, delegate, pitip->current_ecal, comment);
+ status = send_comp_to_attendee (E_CAL_COMPONENT_METHOD_CANCEL, pitip->comp, delegate, pitip->current_client, comment);
if (status)
- send_comp_to_attendee (E_CAL_COMPONENT_METHOD_REQUEST, pitip->comp, delegator, pitip->current_ecal, comment);
+ send_comp_to_attendee (E_CAL_COMPONENT_METHOD_REQUEST, pitip->comp, delegator, pitip->current_client, comment);
if (status) {
itip_view_add_lower_info_item (ITIP_VIEW (pitip->view), ITIP_VIEW_INFO_ITEM_TYPE_INFO, _("Sent a cancelation notice to the delegate"));
} else
@@ -1424,7 +1427,7 @@ update_attendee_status (struct _itip_puri *pitip)
rid = e_cal_component_get_recurid_as_string (pitip->comp);
/* search for a master object if the detached object doesn't exist in the calendar */
- if (e_cal_get_object (pitip->current_ecal, uid, rid, &icalcomp, NULL) || (rid && e_cal_get_object (pitip->current_ecal, uid, NULL, &icalcomp, NULL))) {
+ if (e_cal_client_get_object_sync (pitip->current_client, uid, rid, &icalcomp, NULL, NULL) || (rid && e_cal_client_get_object_sync (pitip->current_client, uid, NULL, &icalcomp, NULL, NULL))) {
GSList *attendees;
comp = e_cal_component_new ();
@@ -1516,10 +1519,10 @@ update_attendee_status (struct _itip_puri *pitip)
if (itip_view_get_update (ITIP_VIEW (pitip->view))) {
e_cal_component_commit_sequence (comp);
- itip_send_comp (E_CAL_COMPONENT_METHOD_REQUEST, comp, pitip->current_ecal, NULL, NULL, NULL, TRUE, FALSE);
+ itip_send_comp (E_CAL_COMPONENT_METHOD_REQUEST, comp, pitip->current_client, NULL, NULL, NULL, TRUE, FALSE);
}
- if (!e_cal_modify_object (pitip->current_ecal, icalcomp, rid ? CALOBJ_MOD_THIS : CALOBJ_MOD_ALL, &error)) {
+ if (!e_cal_client_modify_object_sync (pitip->current_client, icalcomp, rid ? CALOBJ_MOD_THIS : CALOBJ_MOD_ALL, NULL, &error)) {
itip_view_add_lower_info_item_printf (ITIP_VIEW (pitip->view), ITIP_VIEW_INFO_ITEM_TYPE_ERROR,
_("Unable to update attendee. %s"), error->message);
@@ -1546,17 +1549,17 @@ send_item (struct _itip_puri *pitip)
comp = get_real_item (pitip);
if (comp != NULL) {
- itip_send_comp (E_CAL_COMPONENT_METHOD_REQUEST, comp, pitip->current_ecal, NULL, NULL, NULL, TRUE, FALSE);
+ itip_send_comp (E_CAL_COMPONENT_METHOD_REQUEST, comp, pitip->current_client, NULL, NULL, NULL, TRUE, FALSE);
g_object_unref (comp);
switch (pitip->type) {
- case E_CAL_SOURCE_TYPE_EVENT:
+ case E_CAL_CLIENT_SOURCE_TYPE_EVENTS:
itip_view_add_lower_info_item (ITIP_VIEW (pitip->view), ITIP_VIEW_INFO_ITEM_TYPE_INFO, _("Meeting information sent"));
break;
- case E_CAL_SOURCE_TYPE_TODO:
+ case E_CAL_CLIENT_SOURCE_TYPE_TASKS:
itip_view_add_lower_info_item (ITIP_VIEW (pitip->view), ITIP_VIEW_INFO_ITEM_TYPE_INFO, _("Task information sent"));
break;
- case E_CAL_SOURCE_TYPE_JOURNAL:
+ case E_CAL_CLIENT_SOURCE_TYPE_MEMOS:
itip_view_add_lower_info_item (ITIP_VIEW (pitip->view), ITIP_VIEW_INFO_ITEM_TYPE_INFO, _("Memo information sent"));
break;
default:
@@ -1565,13 +1568,13 @@ send_item (struct _itip_puri *pitip)
}
} else {
switch (pitip->type) {
- case E_CAL_SOURCE_TYPE_EVENT:
+ case E_CAL_CLIENT_SOURCE_TYPE_EVENTS:
itip_view_add_lower_info_item (ITIP_VIEW (pitip->view), ITIP_VIEW_INFO_ITEM_TYPE_ERROR, _("Unable to send meeting information, the meeting does not exist"));
break;
- case E_CAL_SOURCE_TYPE_TODO:
+ case E_CAL_CLIENT_SOURCE_TYPE_TASKS:
itip_view_add_lower_info_item (ITIP_VIEW (pitip->view), ITIP_VIEW_INFO_ITEM_TYPE_ERROR, _("Unable to send task information, the task does not exist"));
break;
- case E_CAL_SOURCE_TYPE_JOURNAL:
+ case E_CAL_CLIENT_SOURCE_TYPE_MEMOS:
itip_view_add_lower_info_item (ITIP_VIEW (pitip->view), ITIP_VIEW_INFO_ITEM_TYPE_ERROR, _("Unable to send memo information, the memo does not exist"));
break;
default:
@@ -1760,7 +1763,7 @@ extract_itip_data (struct _itip_puri *pitip, GtkContainer *container, gboolean *
switch (icalcomponent_isa (pitip->ical_comp)) {
case ICAL_VEVENT_COMPONENT:
- pitip->type = E_CAL_SOURCE_TYPE_EVENT;
+ pitip->type = E_CAL_CLIENT_SOURCE_TYPE_EVENTS;
pitip->has_organizer = icalcomponent_get_first_property (pitip->ical_comp, ICAL_ORGANIZER_PROPERTY) != NULL;
if (icalcomponent_get_first_property (pitip->ical_comp, ICAL_ATTENDEE_PROPERTY) == NULL) {
/* no attendees: assume that that this is not a meeting and organizer doesn't want a reply */
@@ -1773,10 +1776,10 @@ extract_itip_data (struct _itip_puri *pitip, GtkContainer *container, gboolean *
}
break;
case ICAL_VTODO_COMPONENT:
- pitip->type = E_CAL_SOURCE_TYPE_TODO;
+ pitip->type = E_CAL_CLIENT_SOURCE_TYPE_TASKS;
break;
case ICAL_VJOURNAL_COMPONENT:
- pitip->type = E_CAL_SOURCE_TYPE_JOURNAL;
+ pitip->type = E_CAL_CLIENT_SOURCE_TYPE_MEMOS;
break;
default:
set_itip_error (pitip, container,
@@ -2023,8 +2026,8 @@ view_response_cb (GtkWidget *widget, ItipViewResponse response, gpointer data)
e_cal_component_set_transparency (pitip->comp, E_CAL_COMPONENT_TRANSP_OPAQUE);
}
- if (!pitip->to_address && pitip->current_ecal != NULL)
- e_cal_get_cal_address (pitip->current_ecal, &pitip->to_address, NULL);
+ if (!pitip->to_address && pitip->current_client != NULL)
+ e_client_get_backend_property_sync (E_CLIENT (pitip->current_client), CAL_BACKEND_PROPERTY_CAL_EMAIL_ADDRESS, &pitip->to_address, NULL, NULL);
/* check if it is a recur instance (no master object) and
* add a property */
@@ -2035,12 +2038,11 @@ view_response_cb (GtkWidget *widget, ItipViewResponse response, gpointer data)
}
/*FIXME Save schedules is misused here, remove it */
- save_schedules = e_cal_get_static_capability (pitip->current_ecal,
- CAL_STATIC_CAPABILITY_SAVE_SCHEDULES);
+ save_schedules = e_cal_client_check_save_schedules (pitip->current_client);
switch (response) {
case ITIP_VIEW_RESPONSE_ACCEPT:
- if (pitip->type != E_CAL_SOURCE_TYPE_JOURNAL)
+ if (pitip->type != E_CAL_CLIENT_SOURCE_TYPE_MEMOS)
status = change_status (pitip->ical_comp, pitip->to_address,
ICAL_PARTSTAT_ACCEPTED);
else
@@ -2064,7 +2066,7 @@ view_response_cb (GtkWidget *widget, ItipViewResponse response, gpointer data)
}
break;
case ITIP_VIEW_RESPONSE_DECLINE:
- if (pitip->type != E_CAL_SOURCE_TYPE_JOURNAL)
+ if (pitip->type != E_CAL_CLIENT_SOURCE_TYPE_MEMOS)
status = change_status (pitip->ical_comp, pitip->to_address,
ICAL_PARTSTAT_DECLINED);
else {
@@ -2220,7 +2222,7 @@ view_response_cb (GtkWidget *widget, ItipViewResponse response, gpointer data)
}
e_cal_component_rescan (comp);
- if (itip_send_comp (E_CAL_COMPONENT_METHOD_REPLY, comp, pitip->current_ecal, pitip->top_level, NULL, NULL, TRUE, FALSE) && pitip->folder) {
+ if (itip_send_comp (E_CAL_COMPONENT_METHOD_REPLY, comp, pitip->current_client, pitip->top_level, NULL, NULL, TRUE, FALSE) && pitip->folder) {
camel_folder_set_message_flags (
pitip->folder, pitip->uid,
CAMEL_MESSAGE_ANSWERED,
@@ -2323,13 +2325,13 @@ format_itip_object (EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPObject
info->accounts = e_get_account_list ();
/* Source Lists and open ecal clients */
- for (i = 0; i < E_CAL_SOURCE_TYPE_LAST; i++) {
- if (!e_cal_get_sources (&info->source_lists[i], i, NULL))
+ for (i = 0; i < E_CAL_CLIENT_SOURCE_TYPE_LAST; i++) {
+ if (!e_cal_client_get_sources (&info->source_lists[i], i, NULL))
/* FIXME More error handling? */
info->source_lists[i] = NULL;
/* Initialize the ecal hashes */
- info->ecals[i] = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, cleanup_ecal);
+ info->ecals[i] = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref);
}
/* FIXME Handle multiple VEVENTS with the same UID, ie detached instances */
@@ -2587,13 +2589,13 @@ format_itip_object (EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPObject
if (e_cal_component_has_recurrences (info->comp)) {
/* FIXME Tell the user we don't support recurring tasks */
switch (info->type) {
- case E_CAL_SOURCE_TYPE_EVENT:
+ case E_CAL_CLIENT_SOURCE_TYPE_EVENTS:
itip_view_add_upper_info_item (ITIP_VIEW (info->view), ITIP_VIEW_INFO_ITEM_TYPE_INFO, _("This meeting recurs"));
break;
- case E_CAL_SOURCE_TYPE_TODO:
+ case E_CAL_CLIENT_SOURCE_TYPE_TASKS:
itip_view_add_upper_info_item (ITIP_VIEW (info->view), ITIP_VIEW_INFO_ITEM_TYPE_INFO, _("This task recurs"));
break;
- case E_CAL_SOURCE_TYPE_JOURNAL:
+ case E_CAL_CLIENT_SOURCE_TYPE_MEMOS:
itip_view_add_upper_info_item (ITIP_VIEW (info->view), ITIP_VIEW_INFO_ITEM_TYPE_INFO, _("This memo recurs"));
break;
default:
@@ -2605,10 +2607,10 @@ format_itip_object (EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPObject
if (response_enabled) {
g_signal_connect (info->view, "response", G_CALLBACK (view_response_cb), info);
- itip_view_set_show_free_time_check (ITIP_VIEW (info->view), info->type == E_CAL_SOURCE_TYPE_EVENT && (info->method == ICAL_METHOD_PUBLISH || info->method == ICAL_METHOD_REQUEST));
+ itip_view_set_show_free_time_check (ITIP_VIEW (info->view), info->type == E_CAL_CLIENT_SOURCE_TYPE_EVENTS && (info->method == ICAL_METHOD_PUBLISH || info->method == ICAL_METHOD_REQUEST));
if (info->calendar_uid)
- info->current_ecal = start_calendar_server_by_uid (info, info->calendar_uid, info->type);
+ info->current_client = start_calendar_server_by_uid (info, info->calendar_uid, info->type);
else {
find_server (info, info->comp);
set_buttons_sensitive (info);
@@ -2624,7 +2626,7 @@ puri_free (EMFormatPURI *puri)
struct _itip_puri *pitip = (struct _itip_puri*) puri;
gint i;
- for (i = 0; i < E_CAL_SOURCE_TYPE_LAST; i++) {
+ for (i = 0; i < E_CAL_CLIENT_SOURCE_TYPE_LAST; i++) {
if (pitip->source_lists[i])
g_object_unref (pitip->source_lists[i]);
pitip->source_lists[i] = NULL;
@@ -2857,7 +2859,7 @@ itip_formatter_page_factory (EPlugin *ep, EConfigHookItemFactoryData *hook_data)
gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
gtk_box_pack_start (GTK_BOX (inner_vbox), label, FALSE, FALSE, 0);
- if (!e_cal_get_sources (&source_list, E_CAL_SOURCE_TYPE_EVENT, NULL)) {
+ if (!e_cal_client_get_sources (&source_list, E_CAL_CLIENT_SOURCE_TYPE_EVENTS, NULL)) {
/* FIXME Error handling */;
}
diff --git a/plugins/itip-formatter/itip-view.c b/plugins/itip-formatter/itip-view.c
index 70ae97784e..50d0fe3534 100644
--- a/plugins/itip-formatter/itip-view.c
+++ b/plugins/itip-formatter/itip-view.c
@@ -30,7 +30,7 @@
#include <libedataserver/e-time-utils.h>
#include <libedataserver/e-data-server-util.h>
#include <libedataserverui/e-source-combo-box.h>
-#include <libecal/e-cal.h>
+#include <libecal/e-cal-client.h>
#include <libecal/e-cal-time-util.h>
#include <gtkhtml/gtkhtml-embedded.h>
#include <mail/em-format-hook.h>
@@ -54,7 +54,7 @@ typedef struct {
struct _ItipViewPrivate {
ItipViewMode mode;
- ECalSourceType type;
+ ECalClientSourceType type;
GtkWidget *sender_label;
gchar *organizer;
@@ -585,13 +585,13 @@ set_sender_text (ItipView *view)
priv = view->priv;
switch (priv->type) {
- case E_CAL_SOURCE_TYPE_EVENT:
+ case E_CAL_CLIENT_SOURCE_TYPE_EVENTS:
set_calendar_sender_text (view);
break;
- case E_CAL_SOURCE_TYPE_TODO:
+ case E_CAL_CLIENT_SOURCE_TYPE_TASKS:
set_tasklist_sender_text (view);
break;
- case E_CAL_SOURCE_TYPE_JOURNAL:
+ case E_CAL_CLIENT_SOURCE_TYPE_MEMOS:
set_journal_sender_text (view);
break;
default:
@@ -855,7 +855,7 @@ set_buttons (ItipView *view)
set_one_button (view, is_recur_set ? _("A_ccept all") : _("A_ccept"), GTK_STOCK_APPLY, ITIP_VIEW_RESPONSE_ACCEPT);
break;
case ITIP_VIEW_MODE_ADD:
- if (priv->type != E_CAL_SOURCE_TYPE_JOURNAL) {
+ if (priv->type != E_CAL_CLIENT_SOURCE_TYPE_MEMOS) {
set_one_button (view, _("_Decline"), GTK_STOCK_CANCEL, ITIP_VIEW_RESPONSE_DECLINE);
set_one_button (view, _("_Tentative"), GTK_STOCK_DIALOG_QUESTION, ITIP_VIEW_RESPONSE_TENTATIVE);
}
@@ -1232,7 +1232,7 @@ itip_view_get_mode (ItipView *view)
}
void
-itip_view_set_item_type (ItipView *view, ECalSourceType type)
+itip_view_set_item_type (ItipView *view, ECalClientSourceType type)
{
ItipViewPrivate *priv;
@@ -1246,7 +1246,7 @@ itip_view_set_item_type (ItipView *view, ECalSourceType type)
set_sender_text (view);
}
-ECalSourceType
+ECalClientSourceType
itip_view_get_item_type (ItipView *view)
{
ItipViewPrivate *priv;
@@ -1918,11 +1918,11 @@ itip_view_set_source_list (ItipView *view, ESourceList *source_list)
G_CALLBACK (source_changed_cb), view);
if (!priv->escb_header) {
- if (priv->type == E_CAL_SOURCE_TYPE_EVENT)
+ if (priv->type == E_CAL_CLIENT_SOURCE_TYPE_EVENTS)
priv->escb_header = gtk_label_new_with_mnemonic (_("_Calendar:"));
- else if (priv->type == E_CAL_SOURCE_TYPE_TODO)
+ else if (priv->type == E_CAL_CLIENT_SOURCE_TYPE_TASKS)
priv->escb_header = gtk_label_new_with_mnemonic (_("_Tasks:"));
- else if (priv->type == E_CAL_SOURCE_TYPE_JOURNAL)
+ else if (priv->type == E_CAL_CLIENT_SOURCE_TYPE_MEMOS)
priv->escb_header = gtk_label_new_with_mnemonic (_("_Memos:"));
gtk_label_set_selectable (GTK_LABEL (priv->escb_header), TRUE);
diff --git a/plugins/itip-formatter/itip-view.h b/plugins/itip-formatter/itip-view.h
index b9da4eac8b..d68ebdf9a9 100644
--- a/plugins/itip-formatter/itip-view.h
+++ b/plugins/itip-formatter/itip-view.h
@@ -28,7 +28,7 @@
#include <unistd.h>
#include <gtk/gtk.h>
#include <libedataserver/e-source-list.h>
-#include <libecal/e-cal.h>
+#include <libecal/e-cal-client.h>
G_BEGIN_DECLS
@@ -96,8 +96,8 @@ GtkWidget *itip_view_new (void);
void itip_view_set_mode (ItipView *view, ItipViewMode mode);
ItipViewMode itip_view_get_mode (ItipView *view);
-void itip_view_set_item_type (ItipView *view, ECalSourceType type);
-ECalSourceType itip_view_get_item_type (ItipView *view);
+void itip_view_set_item_type (ItipView *view, ECalClientSourceType type);
+ECalClientSourceType itip_view_get_item_type (ItipView *view);
void itip_view_set_organizer (ItipView *view, const gchar *organizer);
const gchar *itip_view_get_organizer (ItipView *view);
diff --git a/plugins/mail-to-task/Makefile.am b/plugins/mail-to-task/Makefile.am
index 481390ced0..c263702904 100644
--- a/plugins/mail-to-task/Makefile.am
+++ b/plugins/mail-to-task/Makefile.am
@@ -21,7 +21,6 @@ liborg_gnome_mail_to_task_la_LIBADD = \
$(top_builddir)/shell/libeshell.la \
$(top_builddir)/em-format/libemformat.la \
$(top_builddir)/calendar/gui/libevolution-calendar.la \
- $(top_builddir)/calendar/common/libevolution-calendarprivate.la \
$(top_builddir)/mail/libevolution-mail.la \
$(top_builddir)/widgets/misc/libemiscwidgets.la \
$(EVOLUTION_CALENDAR_LIBS) \
diff --git a/plugins/mail-to-task/mail-to-task.c b/plugins/mail-to-task/mail-to-task.c
index 3ebc818013..29e0a10e5b 100644
--- a/plugins/mail-to-task/mail-to-task.c
+++ b/plugins/mail-to-task/mail-to-task.c
@@ -34,9 +34,10 @@
#include <gtkhtml/gtkhtml.h>
#include <gconf/gconf-client.h>
-#include <libecal/e-cal.h>
+#include <libecal/e-cal-client.h>
#include <libedataserver/e-account.h>
#include <libedataserverui/e-source-selector-dialog.h>
+#include <libedataserverui/e-client-utils.h>
#include <mail/e-mail-browser.h>
#include <mail/em-utils.h>
@@ -44,7 +45,6 @@
#include <mail/message-list.h>
#include <e-util/e-account-utils.h>
#include <e-util/e-dialog-utils.h>
-#include <calendar/common/authentication.h>
#include <misc/e-popup-action.h>
#include <shell/e-shell-view.h>
#include <shell/e-shell-window-actions.h>
@@ -291,7 +291,7 @@ attachment_save_finished (EAttachmentStore *store,
}
static void
-set_attachments (ECal *client, ECalComponent *comp, CamelMimeMessage *message)
+set_attachments (ECalClient *client, ECalComponent *comp, CamelMimeMessage *message)
{
/* XXX Much of this is copied from CompEditor::get_attachment_list().
* Perhaps it should be split off as a separate utility? */
@@ -321,7 +321,7 @@ set_attachments (ECal *client, ECalComponent *comp, CamelMimeMessage *message)
return;
e_cal_component_get_uid (comp, &comp_uid);
- local_store = e_cal_get_local_attachment_store (client);
+ local_store = e_cal_client_get_local_attachment_store (client);
path = g_build_path ("/", local_store, comp_uid, NULL);
destination = g_file_new_for_path (path);
@@ -438,7 +438,7 @@ report_error_idle (const gchar *format, const gchar *param)
struct _manage_comp
{
- ECal *client;
+ ECalClient *client;
ECalComponent *comp;
icalcomponent *stored_comp; /* the one in client already */
};
@@ -481,18 +481,18 @@ do_ask (const gchar *text, gboolean is_create_edit_add)
}
static const gchar *
-get_question_edit_old (ECalSourceType source_type)
+get_question_edit_old (ECalClientSourceType source_type)
{
const gchar *ask = NULL;
switch (source_type) {
- case E_CAL_SOURCE_TYPE_EVENT:
+ case E_CAL_CLIENT_SOURCE_TYPE_EVENTS:
ask = _("Selected calendar contains event '%s' already. Would you like to edit the old event?");
break;
- case E_CAL_SOURCE_TYPE_TODO:
+ case E_CAL_CLIENT_SOURCE_TYPE_TASKS:
ask = _("Selected task list contains task '%s' already. Would you like to edit the old task?");
break;
- case E_CAL_SOURCE_TYPE_JOURNAL:
+ case E_CAL_CLIENT_SOURCE_TYPE_MEMOS:
ask = _("Selected memo list contains memo '%s' already. Would you like to edit the old memo?");
break;
default:
@@ -504,24 +504,24 @@ get_question_edit_old (ECalSourceType source_type)
}
static const gchar *
-get_question_create_new (ECalSourceType source_type)
+get_question_create_new (ECalClientSourceType source_type)
{
const gchar *ask = NULL;
switch (source_type) {
- case E_CAL_SOURCE_TYPE_EVENT:
+ case E_CAL_CLIENT_SOURCE_TYPE_EVENTS:
/* Translators: Codewise it is impossible to provide separate strings for all
combinations of singular and plural. Please translate it in the way that you
feel is most appropriate for your language. */
ask = _("Selected calendar contains some events for the given mails already. Would you like to create new events anyway?");
break;
- case E_CAL_SOURCE_TYPE_TODO:
+ case E_CAL_CLIENT_SOURCE_TYPE_TASKS:
/* Translators: Codewise it is impossible to provide separate strings for all
combinations of singular and plural. Please translate it in the way that you
feel is most appropriate for your language. */
ask = _("Selected task list contains some tasks for the given mails already. Would you like to create new tasks anyway?");
break;
- case E_CAL_SOURCE_TYPE_JOURNAL:
+ case E_CAL_CLIENT_SOURCE_TYPE_MEMOS:
/* Translators: Codewise it is impossible to provide separate strings for all
combinations of singular and plural. Please translate it in the way that you
feel is most appropriate for your language. */
@@ -536,12 +536,12 @@ get_question_create_new (ECalSourceType source_type)
}
static const gchar *
-get_question_create_new_n (ECalSourceType source_type, gint count)
+get_question_create_new_n (ECalClientSourceType source_type, gint count)
{
const gchar *ask = NULL;
switch (source_type) {
- case E_CAL_SOURCE_TYPE_EVENT:
+ case E_CAL_CLIENT_SOURCE_TYPE_EVENTS:
ask = ngettext (
/* Translators: Codewise it is impossible to provide separate strings for all
combinations of singular and plural. Please translate it in the way that you
@@ -550,7 +550,7 @@ get_question_create_new_n (ECalSourceType source_type, gint count)
"Selected calendar contains events for the given mails already. Would you like to create new events anyway?",
count);
break;
- case E_CAL_SOURCE_TYPE_TODO:
+ case E_CAL_CLIENT_SOURCE_TYPE_TASKS:
ask = ngettext (
/* Translators: Codewise it is impossible to provide separate strings for all
combinations of singular and plural. Please translate it in the way that you
@@ -559,7 +559,7 @@ get_question_create_new_n (ECalSourceType source_type, gint count)
"Selected task list contains tasks for the given mails already. Would you like to create new tasks anyway?",
count);
break;
- case E_CAL_SOURCE_TYPE_JOURNAL:
+ case E_CAL_CLIENT_SOURCE_TYPE_MEMOS:
ask = ngettext (
/* Translators: Codewise it is impossible to provide separate strings for all
combinations of singular and plural. Please translate it in the way that you
@@ -582,7 +582,7 @@ do_manage_comp_idle (GSList *manage_comp_datas)
GError *error = NULL;
guint with_old = 0;
gboolean need_editor = FALSE;
- ECalSourceType source_type = E_CAL_SOURCE_TYPE_LAST;
+ ECalClientSourceType source_type = E_CAL_CLIENT_SOURCE_TYPE_LAST;
GSList *l;
g_return_val_if_fail (manage_comp_datas != NULL, FALSE);
@@ -593,10 +593,10 @@ do_manage_comp_idle (GSList *manage_comp_datas)
if (mc->comp && (e_cal_component_has_attendees (mc->comp) || e_cal_component_has_organizer (mc->comp)))
need_editor = TRUE;
- source_type = e_cal_get_source_type (mc->client);
+ source_type = e_cal_client_get_source_type (mc->client);
}
- if (source_type == E_CAL_SOURCE_TYPE_LAST) {
+ if (source_type == E_CAL_CLIENT_SOURCE_TYPE_LAST) {
g_slist_foreach (manage_comp_datas, (GFunc) free_manage_comp_struct, NULL);
g_slist_free (manage_comp_datas);
@@ -634,7 +634,7 @@ do_manage_comp_idle (GSList *manage_comp_datas)
g_object_unref (edit_comp);
edit_comp = NULL;
- error = g_error_new (E_CALENDAR_ERROR, E_CALENDAR_STATUS_INVALID_OBJECT, "%s", _("Invalid object returned from a server"));
+ error = g_error_new (E_CAL_CLIENT_ERROR, E_CAL_CLIENT_ERROR_INVALID_OBJECT, "%s", _("Invalid object returned from a server"));
}
} else if (chosen == GTK_RESPONSE_NO) {
/* user wants to create a new event, thus generate a new UID */
@@ -686,6 +686,7 @@ do_manage_comp_idle (GSList *manage_comp_datas)
if (can) {
for (l = manage_comp_datas; l && !error; l = l->next) {
struct _manage_comp *mc = l->data;
+ gchar *uid = NULL;
if (!mc)
continue;
@@ -699,7 +700,8 @@ do_manage_comp_idle (GSList *manage_comp_datas)
g_free (new_uid);
}
- e_cal_create_object (mc->client, e_cal_component_get_icalcomponent (mc->comp), NULL, &error);
+ e_cal_client_create_object_sync (mc->client, e_cal_component_get_icalcomponent (mc->comp), &uid, NULL, &error);
+ g_free (uid);
}
}
}
@@ -716,7 +718,7 @@ do_manage_comp_idle (GSList *manage_comp_datas)
}
typedef struct {
- ECal *client;
+ ECalClient *client;
CamelFolder *folder;
GPtrArray *uids;
gchar *selected_text;
@@ -726,27 +728,26 @@ typedef struct {
static gboolean
do_mail_to_event (AsyncData *data)
{
- ECal *client = data->client;
+ ECalClient *client = data->client;
CamelFolder *folder = data->folder;
GPtrArray *uids = data->uids;
GError *err = NULL;
- gboolean readonly = FALSE;
/* open the task client */
- if (!e_cal_open (client, FALSE, &err)) {
+ if (!e_client_open_sync (E_CLIENT (client), FALSE, NULL, &err)) {
report_error_idle (_("Cannot open calendar. %s"), err ? err->message : _("Unknown error."));
- } else if (!e_cal_is_read_only (client, &readonly, &err) || readonly) {
+ } else if (e_client_is_readonly (E_CLIENT (client))) {
if (err)
report_error_idle ("Check readonly failed. %s", err->message);
else {
- switch (e_cal_get_source_type (client)) {
- case E_CAL_SOURCE_TYPE_EVENT:
+ switch (e_cal_client_get_source_type (client)) {
+ case E_CAL_CLIENT_SOURCE_TYPE_EVENTS:
report_error_idle (_("Selected source is read only, thus cannot create event there. Select other source, please."), NULL);
break;
- case E_CAL_SOURCE_TYPE_TODO:
+ case E_CAL_CLIENT_SOURCE_TYPE_TASKS:
report_error_idle (_("Selected source is read only, thus cannot create task there. Select other source, please."), NULL);
break;
- case E_CAL_SOURCE_TYPE_JOURNAL:
+ case E_CAL_CLIENT_SOURCE_TYPE_MEMOS:
report_error_idle (_("Selected source is read only, thus cannot create memo there. Select other source, please."), NULL);
break;
default:
@@ -757,7 +758,7 @@ do_mail_to_event (AsyncData *data)
} else {
GSList *mcs = NULL;
gint i;
- ECalSourceType source_type = e_cal_get_source_type (client);
+ ECalClientSourceType source_type = e_cal_client_get_source_type (client);
ECalComponentDateTime dt, dt2;
struct icaltimetype tt, tt2;
@@ -791,13 +792,13 @@ do_mail_to_event (AsyncData *data)
comp = e_cal_component_new ();
switch (source_type) {
- case E_CAL_SOURCE_TYPE_EVENT:
+ case E_CAL_CLIENT_SOURCE_TYPE_EVENTS:
e_cal_component_set_new_vtype (comp, E_CAL_COMPONENT_EVENT);
break;
- case E_CAL_SOURCE_TYPE_TODO:
+ case E_CAL_CLIENT_SOURCE_TYPE_TASKS:
e_cal_component_set_new_vtype (comp, E_CAL_COMPONENT_TODO);
break;
- case E_CAL_SOURCE_TYPE_JOURNAL:
+ case E_CAL_CLIENT_SOURCE_TYPE_MEMOS:
e_cal_component_set_new_vtype (comp, E_CAL_COMPONENT_JOURNAL);
break;
default:
@@ -808,7 +809,7 @@ do_mail_to_event (AsyncData *data)
e_cal_component_set_uid (comp, camel_mime_message_get_message_id (message));
e_cal_component_set_dtstart (comp, &dt);
- if (source_type == E_CAL_SOURCE_TYPE_EVENT) {
+ if (source_type == E_CAL_CLIENT_SOURCE_TYPE_EVENTS) {
/* make it an all-day event */
e_cal_component_set_dtend (comp, &dt2);
}
@@ -859,7 +860,7 @@ do_mail_to_event (AsyncData *data)
mc->client = g_object_ref (client);
mc->comp = g_object_ref (comp);
- if (!e_cal_get_object (client, icalcomponent_get_uid (icalcomp), NULL, &(mc->stored_comp), NULL))
+ if (!e_cal_client_get_object_sync (client, icalcomponent_get_uid (icalcomp), NULL, &(mc->stored_comp), NULL, NULL))
mc->stored_comp = NULL;
mcs = g_slist_append (mcs, mc);
@@ -937,7 +938,7 @@ get_selected_text (EMailReader *reader)
}
static void
-mail_to_event (ECalSourceType source_type,
+mail_to_event (ECalClientSourceType source_type,
gboolean with_attendees,
EMailReader *reader)
{
@@ -952,7 +953,7 @@ mail_to_event (ECalSourceType source_type,
folder = e_mail_reader_get_folder (reader);
uids = e_mail_reader_get_selected_uids (reader);
- if (!e_cal_get_sources (&source_list, source_type, &error)) {
+ if (!e_cal_client_get_sources (&source_list, source_type, &error)) {
e_notice (NULL, GTK_MESSAGE_ERROR, _("Cannot get source list. %s"), error ? error->message : _("Unknown error."));
if (error)
@@ -999,21 +1000,26 @@ mail_to_event (ECalSourceType source_type,
if (source) {
/* if a source has been selected, perform the mail2event operation */
- ECal *client = NULL;
+ ECalClient *client = NULL;
AsyncData *data = NULL;
GThread *thread = NULL;
+ GError *error = NULL;
- client = e_auth_new_cal_from_source (source, source_type);
+ client = e_cal_client_new (source, source_type, &error);
if (!client) {
gchar *uri = e_source_get_uri (source);
- e_notice (NULL, GTK_MESSAGE_ERROR, "Could not create the client: %s", uri);
+ e_notice (NULL, GTK_MESSAGE_ERROR, "Could not create the client '%s': %s", uri, error ? error->message : "Unknown error");
g_free (uri);
g_object_unref (source_list);
+ if (error)
+ g_error_free (error);
return;
}
+ g_signal_connect (client, "authenticate", G_CALLBACK (e_client_utils_authenticate_handler), NULL);
+
/* Fill the elements in AsynData */
data = g_new0 (AsyncData, 1);
data->client = client;
@@ -1040,28 +1046,28 @@ static void
action_mail_convert_to_event_cb (GtkAction *action,
EMailReader *reader)
{
- mail_to_event (E_CAL_SOURCE_TYPE_EVENT, FALSE, reader);
+ mail_to_event (E_CAL_CLIENT_SOURCE_TYPE_EVENTS, FALSE, reader);
}
static void
action_mail_convert_to_meeting_cb (GtkAction *action,
EMailReader *reader)
{
- mail_to_event (E_CAL_SOURCE_TYPE_EVENT, TRUE, reader);
+ mail_to_event (E_CAL_CLIENT_SOURCE_TYPE_EVENTS, TRUE, reader);
}
static void
action_mail_convert_to_memo_cb (GtkAction *action,
EMailReader *reader)
{
- mail_to_event (E_CAL_SOURCE_TYPE_JOURNAL, FALSE, reader);
+ mail_to_event (E_CAL_CLIENT_SOURCE_TYPE_MEMOS, FALSE, reader);
}
static void
action_mail_convert_to_task_cb (GtkAction *action,
EMailReader *reader)
{
- mail_to_event (E_CAL_SOURCE_TYPE_TODO, FALSE, reader);
+ mail_to_event (E_CAL_CLIENT_SOURCE_TYPE_TASKS, FALSE, reader);
}
/* Note, we're not using EPopupActions here because we update the state
diff --git a/plugins/pst-import/pst-importer.c b/plugins/pst-import/pst-importer.c
index 9ede806b73..201b09df7b 100644
--- a/plugins/pst-import/pst-importer.c
+++ b/plugins/pst-import/pst-importer.c
@@ -44,9 +44,9 @@
#include <e-util/e-plugin.h>
#include <libebook/e-contact.h>
-#include <libebook/e-book.h>
+#include <libebook/e-book-client.h>
-#include <libecal/e-cal.h>
+#include <libecal/e-cal-client.h>
#include <libecal/e-cal-component.h>
#include <libedataserver/e-data-server-util.h>
@@ -125,10 +125,10 @@ struct _PstImporter {
gint folder_count;
gint current_item;
- EBook *addressbook;
- ECal *calendar;
- ECal *tasks;
- ECal *journal;
+ EBookClient *addressbook;
+ ECalClient *calendar;
+ ECalClient *tasks;
+ ECalClient *journal;
};
gboolean
@@ -366,29 +366,41 @@ pst_import_describe (PstImporter *m, gint complete)
return g_strdup (_("Importing Outlook data"));
}
-static ECal*
-open_ecal (ECalSourceType type, const gchar *name)
+static ECalClient *
+open_ecal (ECalClientSourceType type, const gchar *name)
{
/* Hack - grab the first calendar we can find
TODO - add a selection mechanism in get_widget */
ESource *primary;
ESourceList *source_list;
- ECal *cal;
+ ECalClient *cal;
+ GError *error = NULL;
- if ((e_cal_get_sources (&source_list, type, NULL)) == 0) {
- g_warning ("Could not get any sources of type %s.", name);
+ if ((e_cal_client_get_sources (&source_list, type, &error)) == 0) {
+ g_debug ("%s: Could not get any sources of type %s: %s", G_STRFUNC, name, error ? error->message : "Unknown error");
+ if (error)
+ g_error_free (error);
return NULL;
}
primary = e_source_list_peek_source_any (source_list);
- if ((cal = e_cal_new (primary, type)) == NULL) {
- g_warning ("Could not create %s.", name);
+ if ((cal = e_cal_client_new (primary, type, &error)) == NULL) {
+ g_debug ("%s: Could not create %s: %s", G_STRFUNC, name, error ? error->message : "Unknown error");
+ if (error)
+ g_error_free (error);
g_object_unref (source_list);
return NULL;
}
- e_cal_open (cal, TRUE, NULL);
+ if (!e_client_open_sync (E_CLIENT (cal), TRUE, NULL, &error)) {
+ g_debug ("%s: Failed to open %s: %s", G_STRFUNC, name, error ? error->message : "Unknown error");
+ if (error)
+ g_error_free (error);
+ g_object_unref (cal);
+ cal = NULL;
+ }
+
g_object_unref (primary);
g_object_unref (source_list);
@@ -405,32 +417,39 @@ pst_import_import (PstImporter *m,
TODO - add a selection mechanism in get_widget */
ESource *primary;
ESourceList *source_list;
+ GError *error = NULL;
- if (e_book_get_addressbooks (&source_list, NULL)) {
+ if (e_book_client_get_sources (&source_list, &error)) {
primary = e_source_list_peek_source_any (source_list);
- if ((m->addressbook = e_book_new (primary,NULL))) {
- e_book_open (m->addressbook, TRUE, NULL);
+ if ((m->addressbook = e_book_client_new (primary, &error))) {
+ if (!e_client_open_sync (E_CLIENT (m->addressbook), TRUE, NULL, &error)) {
+ g_debug ("%s: Failed to open book client: %s", G_STRFUNC, error ? error->message : "Unknown error");
+ }
+
g_object_unref (primary);
g_object_unref (source_list);
} else {
- g_warning ("Could not create EBook.");
+ g_debug ("%s: Could not create book client: %s", G_STRFUNC, error ? error->message : "Unknown error");
}
} else {
- g_warning ("Could not get address books.");
+ g_debug ("%s: Could not get address books: %s", G_STRFUNC, error ? error->message : "Unknown error");
}
+
+ if (error)
+ g_error_free (error);
}
if (GPOINTER_TO_INT (g_datalist_get_data (&m->target->data, "pst-do-appt"))) {
- m->calendar = open_ecal (E_CAL_SOURCE_TYPE_EVENT, "calendar");
+ m->calendar = open_ecal (E_CAL_CLIENT_SOURCE_TYPE_EVENTS, "calendar");
}
if (GPOINTER_TO_INT (g_datalist_get_data (&m->target->data, "pst-do-task"))) {
- m->tasks = open_ecal (E_CAL_SOURCE_TYPE_TODO, "task list");
+ m->tasks = open_ecal (E_CAL_CLIENT_SOURCE_TYPE_TASKS, "task list");
}
if (GPOINTER_TO_INT (g_datalist_get_data (&m->target->data, "pst-do-journal"))) {
- m->journal = open_ecal (E_CAL_SOURCE_TYPE_JOURNAL, "journal");
+ m->journal = open_ecal (E_CAL_CLIENT_SOURCE_TYPE_MEMOS, "journal");
}
pst_import_file (m);
@@ -1082,6 +1101,8 @@ pst_process_contact (PstImporter *m, pst_item *item)
pst_item_contact *c;
EContact *ec;
GString *notes;
+ gchar *uid = NULL;
+ GError *error = NULL;
c = item->contact;
notes = g_string_sized_new (2048);
@@ -1218,9 +1239,16 @@ pst_process_contact (PstImporter *m, pst_item *item)
contact_set_string (ec, E_CONTACT_NOTE, notes->str);
g_string_free (notes, TRUE);
- e_book_add_contact (m->addressbook, ec, NULL);
+ if (!e_book_client_add_contact_sync (m->addressbook, ec, &uid, NULL, &error))
+ uid = NULL;
+
g_object_unref (ec);
+ g_free (uid);
+ if (error) {
+ g_debug ("%s: Failed to add contact: %s", G_STRFUNC, error->message);
+ g_error_free (error);
+ }
}
/**
@@ -1246,7 +1274,7 @@ get_ical_date (FILETIME *date, gboolean is_date)
}
static void
-set_cal_attachments (ECal *cal, ECalComponent *ec, PstImporter *m, pst_item_attach *attach)
+set_cal_attachments (ECalClient *cal, ECalComponent *ec, PstImporter *m, pst_item_attach *attach)
{
GSList *list = NULL;
const gchar *uid;
@@ -1257,7 +1285,7 @@ set_cal_attachments (ECal *cal, ECalComponent *ec, PstImporter *m, pst_item_atta
}
e_cal_component_get_uid (ec, &uid);
- store_dir = g_filename_from_uri (e_cal_get_local_attachment_store (cal), NULL, NULL);
+ store_dir = g_filename_from_uri (e_cal_client_get_local_attachment_store (cal), NULL, NULL);
while (attach != NULL) {
const gchar * orig_filename;
@@ -1502,9 +1530,10 @@ fill_calcomponent (PstImporter *m, pst_item *item, ECalComponent *ec, const gcha
}
static void
-pst_process_component (PstImporter *m, pst_item *item, const gchar *comp_type, ECal *cal)
+pst_process_component (PstImporter *m, pst_item *item, const gchar *comp_type, ECalClient *cal)
{
ECalComponent *ec;
+ gchar *uid = NULL;
GError *error = NULL;
g_return_if_fail (item->appointment != NULL);
@@ -1515,12 +1544,13 @@ pst_process_component (PstImporter *m, pst_item *item, const gchar *comp_type, E
fill_calcomponent (m, item, ec, comp_type);
set_cal_attachments (cal, ec, m, item->attach);
- if (!e_cal_create_object (cal, e_cal_component_get_icalcomponent (ec), NULL, &error)) {
+ if (!e_cal_client_create_object_sync (cal, e_cal_component_get_icalcomponent (ec), &uid, NULL, &error)) {
+ uid = NULL;
g_warning ("Creation of %s failed: %s", comp_type, error ? error->message : "Unknown error");
}
g_object_unref (ec);
-
+ g_free (uid);
if (error)
g_error_free (error);
}
diff --git a/plugins/publish-calendar/publish-format-fb.c b/plugins/publish-calendar/publish-format-fb.c
index 2f9b0626cf..65762e0c8a 100644
--- a/plugins/publish-calendar/publish-format-fb.c
+++ b/plugins/publish-calendar/publish-format-fb.c
@@ -30,23 +30,38 @@
#include <gconf/gconf-client.h>
#include <libedataserver/e-source.h>
#include <libedataserver/e-source-list.h>
-#include <libecal/e-cal.h>
+#include <libedataserverui/e-client-utils.h>
+#include <libecal/e-cal-client.h>
#include <libecal/e-cal-util.h>
#include <libecal/e-cal-time-util.h>
-#include <calendar/common/authentication.h>
#include "publish-format-fb.h"
+static void
+free_busy_data_cb (ECalClient *client, const GSList *free_busy_ecalcomps, GSList **pobjects)
+{
+ const GSList *iter;
+
+ g_return_if_fail (pobjects != NULL);
+
+ for (iter = free_busy_ecalcomps; iter != NULL; iter = iter->next) {
+ ECalComponent *comp = iter->data;
+
+ if (comp)
+ *pobjects = g_slist_prepend (*pobjects, g_object_ref (comp));
+ }
+}
+
static gboolean
-write_calendar (gchar *uid, ESourceList *source_list, GOutputStream *stream, gint dur_type, gint dur_value, GError **error)
+write_calendar (const gchar *uid, ESourceList *source_list, GOutputStream *stream, gint dur_type, gint dur_value, GError **error)
{
ESource *source;
- ECal *client = NULL;
- GList *objects;
+ ECalClient *client = NULL;
+ GSList *objects = NULL;
icaltimezone *utc;
time_t start = time (NULL), end;
icalcomponent *top_level;
gchar *email = NULL;
- GList *users = NULL;
+ GSList *users = NULL;
gboolean res = FALSE;
utc = icaltimezone_get_utc_timezone ();
@@ -67,46 +82,52 @@ write_calendar (gchar *uid, ESourceList *source_list, GOutputStream *stream, gin
source = e_source_list_peek_source_by_uid (source_list, uid);
if (source)
- client = e_auth_new_cal_from_source (source, E_CAL_SOURCE_TYPE_EVENT);
+ client = e_cal_client_new (source, E_CAL_CLIENT_SOURCE_TYPE_EVENTS, error);
if (!client) {
- if (error)
- *error = g_error_new (e_calendar_error_quark (), E_CALENDAR_STATUS_NO_SUCH_CALENDAR, _("Could not publish calendar: Calendar backend no longer exists"));
+ if (error && !*error)
+ *error = g_error_new (E_CAL_CLIENT_ERROR, E_CAL_CLIENT_ERROR_NO_SUCH_CALENDAR, _("Could not publish calendar: Calendar backend no longer exists"));
return FALSE;
}
- if (!e_cal_open (client, TRUE, error)) {
+ g_signal_connect (client, "authenticate", G_CALLBACK (e_client_utils_authenticate_handler), NULL);
+
+ if (!e_client_open_sync (E_CLIENT (client), TRUE, NULL, error)) {
g_object_unref (client);
return FALSE;
}
- if (e_cal_get_cal_address (client, &email, NULL)) {
+ if (e_client_get_backend_property_sync (E_CLIENT (client), CAL_BACKEND_PROPERTY_CAL_EMAIL_ADDRESS, &email, NULL, NULL)) {
if (email && *email)
- users = g_list_append (users, email);
+ users = g_slist_append (users, email);
}
top_level = e_cal_util_new_top_level ();
- if (e_cal_get_free_busy (client, users, start, end, &objects, error)) {
+ g_signal_connect (client, "free-busy-data", G_CALLBACK (free_busy_data_cb), &objects);
+
+ if (e_cal_client_get_free_busy_sync (client, start, end, users, NULL, error)) {
gchar *ical_string;
+ GSList *iter;
- while (objects) {
+ for (iter = objects; iter; iter = iter->next) {
ECalComponent *comp = objects->data;
icalcomponent *icalcomp = e_cal_component_get_icalcomponent (comp);
icalcomponent_add_component (top_level, icalcomp);
- objects = g_list_remove (objects, comp);
}
ical_string = icalcomponent_as_ical_string_r (top_level);
res = g_output_stream_write_all (stream, ical_string, strlen (ical_string), NULL, NULL, error);
+ e_cal_client_free_ecalcomp_slist (objects);
g_free (ical_string);
}
if (users)
- g_list_free (users);
+ g_slist_free (users);
g_free (email);
g_object_unref (client);
+ icalcomponent_free (top_level);
return res;
}
@@ -116,12 +137,11 @@ publish_calendar_as_fb (GOutputStream *stream, EPublishUri *uri, GError **error)
{
GSList *l;
ESourceList *source_list;
- GConfClient *gconf_client;
- gconf_client = gconf_client_get_default ();
+ if (!e_cal_client_get_sources (&source_list, E_CAL_CLIENT_SOURCE_TYPE_EVENTS, error))
+ return;
/* events */
- source_list = e_source_list_new_for_gconf (gconf_client, "/apps/evolution/calendar/sources");
l = uri->events;
while (l) {
gchar *uid = l->data;
@@ -129,7 +149,6 @@ publish_calendar_as_fb (GOutputStream *stream, EPublishUri *uri, GError **error)
break;
l = g_slist_next (l);
}
- g_object_unref (source_list);
- g_object_unref (gconf_client);
+ g_object_unref (source_list);
}
diff --git a/plugins/publish-calendar/publish-format-ical.c b/plugins/publish-calendar/publish-format-ical.c
index b4b5451a2f..de6b342c3d 100644
--- a/plugins/publish-calendar/publish-format-ical.c
+++ b/plugins/publish-calendar/publish-format-ical.c
@@ -29,14 +29,14 @@
#include <gconf/gconf-client.h>
#include <libedataserver/e-source.h>
#include <libedataserver/e-source-list.h>
-#include <libecal/e-cal.h>
+#include <libedataserverui/e-client-utils.h>
+#include <libecal/e-cal-client.h>
#include <libecal/e-cal-util.h>
-#include <calendar/common/authentication.h>
#include "publish-format-ical.h"
typedef struct {
GHashTable *zones;
- ECal *ecal;
+ ECalClient *client;
} CompTzData;
static void
@@ -53,7 +53,7 @@ insert_tz_comps (icalparameter *param, gpointer cb_data)
if (g_hash_table_lookup (tdata->zones, tzid))
return;
- if (!e_cal_get_timezone (tdata->ecal, tzid, &zone, &error)) {
+ if (!e_cal_client_get_timezone_sync (tdata->client, tzid, &zone, NULL, &error)) {
g_warning ("Could not get the timezone information for %s : %s \n", tzid, error->message);
g_error_free (error);
return;
@@ -70,42 +70,44 @@ append_tz_to_comp (gpointer key, gpointer value, icalcomponent *toplevel)
}
static gboolean
-write_calendar (gchar *uid, ESourceList *source_list, GOutputStream *stream, GError **error)
+write_calendar (const gchar *uid, ESourceList *source_list, GOutputStream *stream, GError **error)
{
ESource *source;
- ECal *client = NULL;
- GList *objects;
+ ECalClient *client = NULL;
+ GSList *objects;
icalcomponent *top_level;
gboolean res = FALSE;
source = e_source_list_peek_source_by_uid (source_list, uid);
if (source)
- client = e_auth_new_cal_from_source (source, E_CAL_SOURCE_TYPE_EVENT);
+ client = e_cal_client_new (source, E_CAL_CLIENT_SOURCE_TYPE_EVENTS, error);
if (!client) {
- if (error)
- *error = g_error_new (e_calendar_error_quark (), E_CALENDAR_STATUS_NO_SUCH_CALENDAR, _("Could not publish calendar: Calendar backend no longer exists"));
+ if (error && !error)
+ *error = g_error_new (E_CAL_CLIENT_ERROR, E_CAL_CLIENT_ERROR_NO_SUCH_CALENDAR, _("Could not publish calendar: Calendar backend no longer exists"));
return FALSE;
}
- if (!e_cal_open (client, TRUE, error)) {
+ g_signal_connect (client, "authenticate", G_CALLBACK (e_client_utils_authenticate_handler), NULL);
+
+ if (!e_client_open_sync (E_CLIENT (client), TRUE, NULL, error)) {
g_object_unref (client);
return FALSE;
}
top_level = e_cal_util_new_top_level ();
- if (e_cal_get_object_list (client, "#t", &objects, error)) {
+ if (e_cal_client_get_object_list_sync (client, "#t", &objects, NULL, error)) {
+ GSList *iter;
gchar *ical_string;
CompTzData tdata;
tdata.zones = g_hash_table_new (g_str_hash, g_str_equal);
- tdata.ecal = client;
+ tdata.client = client;
- while (objects) {
+ for (iter = objects; iter; iter = iter->next) {
icalcomponent *icalcomp = objects->data;
icalcomponent_foreach_tzid (icalcomp, insert_tz_comps, &tdata);
icalcomponent_add_component (top_level, icalcomp);
- objects = g_list_remove (objects, icalcomp);
}
g_hash_table_foreach (tdata.zones, (GHFunc) append_tz_to_comp, top_level);
@@ -116,9 +118,11 @@ write_calendar (gchar *uid, ESourceList *source_list, GOutputStream *stream, GEr
ical_string = icalcomponent_as_ical_string_r (top_level);
res = g_output_stream_write_all (stream, ical_string, strlen (ical_string), NULL, NULL, error);
g_free (ical_string);
+ e_cal_client_free_icalcomp_slist (objects);
}
g_object_unref (client);
+ icalcomponent_free (top_level);
return res;
}
@@ -128,12 +132,11 @@ publish_calendar_as_ical (GOutputStream *stream, EPublishUri *uri, GError **erro
{
GSList *l;
ESourceList *source_list;
- GConfClient *gconf_client;
-
- gconf_client = gconf_client_get_default ();
/* events */
- source_list = e_source_list_new_for_gconf (gconf_client, "/apps/evolution/calendar/sources");
+ if (!e_cal_client_get_sources (&source_list, E_CAL_CLIENT_SOURCE_TYPE_EVENTS, error))
+ return;
+
l = uri->events;
while (l) {
gchar *uid = l->data;
@@ -141,7 +144,6 @@ publish_calendar_as_ical (GOutputStream *stream, EPublishUri *uri, GError **erro
break;
l = g_slist_next (l);
}
- g_object_unref (source_list);
- g_object_unref (gconf_client);
+ g_object_unref (source_list);
}
diff --git a/plugins/save-calendar/csv-format.c b/plugins/save-calendar/csv-format.c
index 15ed83817e..da21588d8c 100644
--- a/plugins/save-calendar/csv-format.c
+++ b/plugins/save-calendar/csv-format.c
@@ -30,8 +30,8 @@
#include <libecal/e-cal-time-util.h>
#include <libedataserver/e-data-server-util.h>
#include <libedataserverui/e-source-selector.h>
-#include <libecal/e-cal.h>
-#include "calendar/common/authentication.h"
+#include <libedataserverui/e-client-utils.h>
+#include <libecal/e-cal-client.h>
#include <string.h>
#include "format-handler.h"
@@ -300,7 +300,7 @@ userstring_to_systemstring (const gchar *userstring)
static void
do_save_calendar_csv (FormatHandler *handler,
ESourceSelector *selector,
- ECalSourceType type,
+ ECalClientSourceType type,
gchar *dest_uri)
{
@@ -314,9 +314,9 @@ do_save_calendar_csv (FormatHandler *handler,
*/
ESource *primary_source;
- ECal *source_client;
+ ECalClient *source_client;
GError *error = NULL;
- GList *objects=NULL;
+ GSList *objects = NULL;
GOutputStream *stream;
GString *line = NULL;
CsvConfig *config = NULL;
@@ -329,12 +329,16 @@ do_save_calendar_csv (FormatHandler *handler,
primary_source = e_source_selector_get_primary_selection (selector);
/* open source client */
- source_client = e_auth_new_cal_from_source (primary_source, type);
- if (!e_cal_open (source_client, TRUE, &error)) {
+ source_client = e_cal_client_new (primary_source, type, &error);
+ if (source_client)
+ g_signal_connect (source_client, "authenticate", G_CALLBACK (e_client_utils_authenticate_handler), NULL);
+
+ if (!source_client || !e_client_open_sync (E_CLIENT (source_client), TRUE, NULL, &error)) {
display_error_message (
gtk_widget_get_toplevel (GTK_WIDGET (selector)),
error);
- g_object_unref (source_client);
+ if (source_client)
+ g_object_unref (source_client);
g_error_free (error);
return;
}
@@ -354,8 +358,8 @@ do_save_calendar_csv (FormatHandler *handler,
GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (selector))),
dest_uri, &error);
- if (stream && e_cal_get_object_list_as_comp (
- source_client, "#t", &objects, NULL)) {
+ if (stream && e_cal_client_get_object_list_as_comps_sync (source_client, "#t", &objects, NULL, NULL)) {
+ GSList *iter;
if (config->header) {
@@ -396,7 +400,7 @@ do_save_calendar_csv (FormatHandler *handler,
g_string_free (line, TRUE);
}
- while (objects != NULL) {
+ for (iter = objects; iter; iter = iter->next) {
ECalComponent *comp = objects->data;
gchar *delimiter_temp = NULL;
const gchar *temp_constchar;
@@ -521,11 +525,11 @@ do_save_calendar_csv (FormatHandler *handler,
/* It's written, so we can free it */
g_string_free (line, TRUE);
-
- objects = g_list_next (objects);
}
g_output_stream_close (stream, NULL, NULL);
+
+ e_cal_client_free_ecalcomp_slist (objects);
}
if (stream)
diff --git a/plugins/save-calendar/format-handler.h b/plugins/save-calendar/format-handler.h
index e04d95fbf1..b7376920ef 100644
--- a/plugins/save-calendar/format-handler.h
+++ b/plugins/save-calendar/format-handler.h
@@ -24,7 +24,7 @@
#include <gio/gio.h>
#include <libedataserver/e-source.h>
#include <libedataserverui/e-source-selector.h>
-#include <libecal/e-cal.h>
+#include <libecal/e-cal-client.h>
typedef struct _FormatHandler FormatHandler;
@@ -39,7 +39,7 @@ struct _FormatHandler
void (*save) (FormatHandler *handler,
ESourceSelector *selector,
- ECalSourceType type,
+ ECalClientSourceType type,
gchar *dest_uri);
};
diff --git a/plugins/save-calendar/ical-format.c b/plugins/save-calendar/ical-format.c
index fa4f6a5515..39cac6f2e0 100644
--- a/plugins/save-calendar/ical-format.c
+++ b/plugins/save-calendar/ical-format.c
@@ -29,9 +29,9 @@
#include <glib/gi18n.h>
#include <libedataserver/e-source.h>
#include <libedataserverui/e-source-selector.h>
-#include <libecal/e-cal.h>
+#include <libedataserverui/e-client-utils.h>
+#include <libecal/e-cal-client.h>
#include <libecal/e-cal-util.h>
-#include <calendar/common/authentication.h>
#include <string.h>
#include "format-handler.h"
@@ -48,7 +48,7 @@ display_error_message (GtkWidget *parent, const gchar *message)
typedef struct {
GHashTable *zones;
- ECal *ecal;
+ ECalClient *client;
} CompTzData;
static void
@@ -65,7 +65,7 @@ insert_tz_comps (icalparameter *param, gpointer cb_data)
if (g_hash_table_lookup (tdata->zones, tzid))
return;
- if (!e_cal_get_timezone (tdata->ecal, tzid, &zone, &error)) {
+ if (!e_cal_client_get_timezone_sync (tdata->client, tzid, &zone, NULL, &error)) {
g_warning ("Could not get the timezone information for %s : %s \n", tzid, error->message);
g_error_free (error);
return;
@@ -82,12 +82,12 @@ append_tz_to_comp (gpointer key, gpointer value, icalcomponent *toplevel)
}
static void
-do_save_calendar_ical (FormatHandler *handler, ESourceSelector *selector, ECalSourceType type, gchar *dest_uri)
+do_save_calendar_ical (FormatHandler *handler, ESourceSelector *selector, ECalClientSourceType type, gchar *dest_uri)
{
ESource *primary_source;
- ECal *source_client;
+ ECalClient *source_client;
GError *error = NULL;
- GList *objects;
+ GSList *objects = NULL;
icalcomponent *top_level = NULL;
primary_source = e_source_selector_get_primary_selection (selector);
@@ -96,10 +96,14 @@ do_save_calendar_ical (FormatHandler *handler, ESourceSelector *selector, ECalSo
return;
/* open source client */
- source_client = (ECal*) e_auth_new_cal_from_source (primary_source, type);
- if (!e_cal_open (source_client, TRUE, &error)) {
+ source_client = e_cal_client_new (primary_source, type, &error);
+ if (source_client)
+ g_signal_connect (source_client, "authenticate", G_CALLBACK (e_client_utils_authenticate_handler), NULL);
+
+ if (!source_client || !e_client_open_sync (E_CLIENT (source_client), TRUE, NULL, &error)) {
display_error_message (gtk_widget_get_toplevel (GTK_WIDGET (selector)), error->message);
- g_object_unref (source_client);
+ if (source_client)
+ g_object_unref (source_client);
g_error_free (error);
return;
}
@@ -108,21 +112,19 @@ do_save_calendar_ical (FormatHandler *handler, ESourceSelector *selector, ECalSo
top_level = e_cal_util_new_top_level ();
error = NULL;
- if (e_cal_get_object_list (source_client, "#t", &objects, &error)) {
+ if (e_cal_client_get_object_list_sync (source_client, "#t", &objects, NULL, &error)) {
CompTzData tdata;
GOutputStream *stream;
+ GSList *iter;
tdata.zones = g_hash_table_new (g_str_hash, g_str_equal);
- tdata.ecal = source_client;
+ tdata.client = source_client;
- while (objects != NULL) {
+ for (iter = objects; iter; iter = iter->next) {
icalcomponent *icalcomp = objects->data;
icalcomponent_foreach_tzid (icalcomp, insert_tz_comps, &tdata);
icalcomponent_add_component (top_level, icalcomp);
-
- /* remove item from the list */
- objects = g_list_remove (objects, icalcomp);
}
g_hash_table_foreach (tdata.zones, (GHFunc) append_tz_to_comp, top_level);
@@ -142,6 +144,8 @@ do_save_calendar_ical (FormatHandler *handler, ESourceSelector *selector, ECalSo
g_object_unref (stream);
g_free (ical_str);
}
+
+ e_cal_client_free_icalcomp_slist (objects);
}
if (error) {
diff --git a/plugins/save-calendar/rdf-format.c b/plugins/save-calendar/rdf-format.c
index 084250e70c..c64b31f055 100644
--- a/plugins/save-calendar/rdf-format.c
+++ b/plugins/save-calendar/rdf-format.c
@@ -27,8 +27,9 @@
#include <gtk/gtk.h>
#include <glib/gi18n.h>
#include <libedataserver/e-source.h>
+#include <libedataserverui/e-client-utils.h>
#include <libedataserverui/e-source-selector.h>
-#include <libecal/e-cal.h>
+#include <libecal/e-cal-client.h>
#include <libecal/e-cal-time-util.h>
#include <libedataserver/e-data-server-util.h>
#include <libxml/xmlmemory.h>
@@ -38,7 +39,6 @@
#include <libxml/xpath.h>
#include <string.h>
-#include "calendar/common/authentication.c"
#include "format-handler.h"
static void
@@ -169,7 +169,7 @@ add_string_to_rdf (xmlNodePtr node, const gchar *tag, const gchar *value)
}
static void
-do_save_calendar_rdf (FormatHandler *handler, ESourceSelector *selector, ECalSourceType type, gchar *dest_uri)
+do_save_calendar_rdf (FormatHandler *handler, ESourceSelector *selector, ECalClientSourceType type, gchar *dest_uri)
{
/*
@@ -182,9 +182,9 @@ do_save_calendar_rdf (FormatHandler *handler, ESourceSelector *selector, ECalSou
*/
ESource *primary_source;
- ECal *source_client;
+ ECalClient *source_client;
GError *error = NULL;
- GList *objects=NULL;
+ GSList *objects = NULL;
gchar *temp = NULL;
GOutputStream *stream;
@@ -194,17 +194,23 @@ do_save_calendar_rdf (FormatHandler *handler, ESourceSelector *selector, ECalSou
primary_source = e_source_selector_get_primary_selection (selector);
/* open source client */
- source_client = e_auth_new_cal_from_source (primary_source, type);
- if (!e_cal_open (source_client, TRUE, &error)) {
+ source_client = e_cal_client_new (primary_source, type, &error);
+ if (source_client)
+ g_signal_connect (source_client, "authenticate", G_CALLBACK (e_client_utils_authenticate_handler), NULL);
+
+ if (!source_client || !e_client_open_sync (E_CLIENT (source_client), TRUE, NULL, &error)) {
display_error_message (gtk_widget_get_toplevel (GTK_WIDGET (selector)), error);
- g_object_unref (source_client);
+ if (source_client)
+ g_object_unref (source_client);
g_error_free (error);
return;
}
stream = open_for_writing (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (selector))), dest_uri, &error);
- if (stream && e_cal_get_object_list_as_comp (source_client, "#t", &objects, NULL)) {
+ if (stream && e_cal_client_get_object_list_as_comps_sync (source_client, "#t", &objects, NULL, NULL)) {
+ GSList *iter;
+
xmlBufferPtr buffer=xmlBufferCreate ();
xmlDocPtr doc = xmlNewDoc((xmlChar *) "1.0");
xmlNodePtr fnode;
@@ -238,7 +244,7 @@ do_save_calendar_rdf (FormatHandler *handler, ESourceSelector *selector, ECalSou
/* Version of this RDF-format */
xmlNewChild (fnode, NULL, (const guchar *)"version", (const guchar *)"2.0");
- while (objects != NULL) {
+ for (iter = objects; iter; iter = iter->next) {
ECalComponent *comp = objects->data;
const gchar *temp_constchar;
gchar *tmp_str = NULL;
@@ -334,8 +340,6 @@ do_save_calendar_rdf (FormatHandler *handler, ESourceSelector *selector, ECalSou
* http://www.gnome.org/projects/evolution/developer-doc/libecal/ECalComponent.html
* #e-cal-component-get-last-modified
*/
-
- objects = g_list_next (objects);
}
/* I used a buffer rather than xmlDocDump: I want gio support */
@@ -344,6 +348,8 @@ do_save_calendar_rdf (FormatHandler *handler, ESourceSelector *selector, ECalSou
g_output_stream_write_all (stream, xmlBufferContent (buffer), xmlBufferLength (buffer), NULL, NULL, &error);
g_output_stream_close (stream, NULL, NULL);
+ e_cal_client_free_ecalcomp_slist (objects);
+
xmlBufferFree (buffer);
xmlFreeDoc (doc);
}
diff --git a/plugins/save-calendar/save-calendar.c b/plugins/save-calendar/save-calendar.c
index 8bf0067b79..a1a48be7cf 100644
--- a/plugins/save-calendar/save-calendar.c
+++ b/plugins/save-calendar/save-calendar.c
@@ -32,7 +32,7 @@
#include <glib/gi18n.h>
#include <libedataserver/e-source.h>
#include <libedataserverui/e-source-selector.h>
-#include <libecal/e-cal.h>
+#include <libecal/e-cal-client.h>
#include <e-util/e-alert-dialog.h>
#include <e-util/e-plugin.h>
#include <string.h>
@@ -113,7 +113,7 @@ format_handlers_foreach_free (gpointer data, gpointer user_data)
}
static void
-ask_destination_and_save (ESourceSelector *selector, ECalSourceType type)
+ask_destination_and_save (ESourceSelector *selector, ECalClientSourceType type)
{
FormatHandler *handler = NULL;
@@ -284,7 +284,7 @@ open_for_writing (GtkWindow *parent, const gchar *uri, GError **error)
static void
save_general (EShellView *shell_view,
- ECalSourceType type)
+ ECalClientSourceType type)
{
EShellSidebar *shell_sidebar;
ESourceSelector *selector = NULL;
@@ -302,21 +302,21 @@ static void
action_calendar_save_as_cb (GtkAction *action,
EShellView *shell_view)
{
- save_general (shell_view, E_CAL_SOURCE_TYPE_EVENT);
+ save_general (shell_view, E_CAL_CLIENT_SOURCE_TYPE_EVENTS);
}
static void
action_memo_list_save_as_cb (GtkAction *action,
EShellView *shell_view)
{
- save_general (shell_view, E_CAL_SOURCE_TYPE_JOURNAL);
+ save_general (shell_view, E_CAL_CLIENT_SOURCE_TYPE_MEMOS);
}
static void
action_task_list_save_as_cb (GtkAction *action,
EShellView *shell_view)
{
- save_general (shell_view, E_CAL_SOURCE_TYPE_TODO);
+ save_general (shell_view, E_CAL_CLIENT_SOURCE_TYPE_TASKS);
}
gboolean
diff --git a/plugins/vcard-inline/vcard-inline.c b/plugins/vcard-inline/vcard-inline.c
index 062f21e598..7e56da440b 100644
--- a/plugins/vcard-inline/vcard-inline.c
+++ b/plugins/vcard-inline/vcard-inline.c
@@ -22,10 +22,10 @@
#include <gtk/gtk.h>
#include <glib/gi18n-lib.h>
-#include <libebook/e-book.h>
+#include <libebook/e-book-client.h>
#include <libebook/e-contact.h>
#include <gtkhtml/gtkhtml-embedded.h>
-#include <libedataserverui/e-book-auth-util.h>
+#include <libedataserverui/e-client-utils.h>
#include <libedataserverui/e-source-selector-dialog.h>
#include "addressbook/gui/merging/eab-contact-merging.h"
@@ -41,7 +41,7 @@ typedef struct _VCardInlinePObject VCardInlinePObject;
struct _VCardInlinePObject {
EMFormatHTMLPObject object;
- GList *contact_list;
+ GSList *contact_list;
ESourceList *source_list;
GtkWidget *contact_display;
GtkWidget *message_label;
@@ -66,10 +66,7 @@ org_gnome_vcard_inline_pobject_free (EMFormatHTMLPObject *object)
vcard_object = (VCardInlinePObject *) object;
- g_list_foreach (
- vcard_object->contact_list,
- (GFunc) g_object_unref, NULL);
- g_list_free (vcard_object->contact_list);
+ e_client_util_free_object_slist (vcard_object->contact_list);
vcard_object->contact_list = NULL;
if (vcard_object->source_list != NULL) {
@@ -95,7 +92,7 @@ org_gnome_vcard_inline_decode (VCardInlinePObject *vcard_object,
CamelDataWrapper *data_wrapper;
CamelMedium *medium;
CamelStream *stream;
- GList *contact_list;
+ GSList *contact_list;
GByteArray *array;
const gchar *string;
const guint8 padding[2] = {0};
@@ -121,37 +118,43 @@ org_gnome_vcard_inline_decode (VCardInlinePObject *vcard_object,
}
static void
-org_gnome_vcard_inline_book_loaded_cb (ESource *source,
- GAsyncResult *result,
- GList *contact_list)
+org_gnome_vcard_inline_client_loaded_cb (GObject *source_object, GAsyncResult *result, gpointer user_data)
{
- EBook *book;
- GList *iter;
-
- book = e_load_book_source_finish (source, result, NULL);
-
- if (book == NULL)
+ EClient *client = NULL;
+ EBookClient *book_client;
+ GSList *contact_list = user_data, *iter;
+ GError *error = NULL;
+
+ if (!e_client_utils_open_new_finish (E_SOURCE (source_object), result, &client, &error))
+ client = NULL;
+
+ if (client == NULL) {
+ g_debug ("%s: Failed to open book client: %s", G_STRFUNC, error ? error->message : "Unknown error");
+ if (error)
+ g_error_free (error);
goto exit;
+ }
+
+ book_client = E_BOOK_CLIENT (client);
for (iter = contact_list; iter != NULL; iter = iter->next) {
EContact *contact;
contact = E_CONTACT (iter->data);
- eab_merging_book_add_contact (book, contact, NULL, NULL);
+ eab_merging_book_add_contact (book_client, contact, NULL, NULL);
}
- g_object_unref (book);
+ g_object_unref (client);
-exit:
- g_list_foreach (contact_list, (GFunc) g_object_unref, NULL);
- g_list_free (contact_list);
+ exit:
+ e_client_util_free_object_slist (contact_list);
}
static void
org_gnome_vcard_inline_save_cb (VCardInlinePObject *vcard_object)
{
ESource *source;
- GList *contact_list;
+ GSList *contact_list;
GtkWidget*dialog;
g_return_if_fail (vcard_object->source_list != NULL);
@@ -173,12 +176,11 @@ org_gnome_vcard_inline_save_cb (VCardInlinePObject *vcard_object)
g_return_if_fail (source != NULL);
- contact_list = g_list_copy (vcard_object->contact_list);
- g_list_foreach (contact_list, (GFunc) g_object_ref, NULL);
+ contact_list = e_client_util_copy_object_slist (NULL, vcard_object->contact_list);
- e_load_book_source_async (
- source, NULL, NULL, (GAsyncReadyCallback)
- org_gnome_vcard_inline_book_loaded_cb, contact_list);
+ e_client_utils_open_new (source, E_CLIENT_SOURCE_TYPE_CONTACTS, FALSE, NULL,
+ e_client_utils_authenticate_handler, NULL,
+ org_gnome_vcard_inline_client_loaded_cb, contact_list);
}
static void
@@ -218,7 +220,7 @@ org_gnome_vcard_inline_embed (EMFormatHTML *format,
guint length;
vcard_object = (VCardInlinePObject *) object;
- length = g_list_length (vcard_object->contact_list);
+ length = g_slist_length (vcard_object->contact_list);
if (vcard_object->contact_list != NULL)
contact = E_CONTACT (vcard_object->contact_list->data);
@@ -328,7 +330,7 @@ org_gnome_vcard_inline_format (gpointer ep, EMFormatHookTarget *target)
vcard_object->object.free = org_gnome_vcard_inline_pobject_free;
org_gnome_vcard_inline_decode (vcard_object, target->part);
- e_book_get_addressbooks (&vcard_object->source_list, NULL);
+ e_book_client_get_sources (&vcard_object->source_list, NULL);
camel_stream_printf (
target->stream, "<object classid=%s></object>", classid);