[evolution-data-server/eclient] Introduction of e-client-utils.h/.c



commit 5236da6e716f6d6a23766e755ddf5cbbf424f96f
Author: Milan Crha <mcrha redhat com>
Date:   Tue May 10 10:14:31 2011 +0200

    Introduction of e-client-utils.h/.c

 addressbook/libebook/e-book-client.c               |   10 +-
 addressbook/libebook/e-book-client.h               |    4 +-
 addressbook/libebook/e-book.c                      |    4 +-
 addressbook/libedata-book/e-book-backend.c         |   18 +-
 addressbook/libedata-book/e-book-backend.h         |    1 +
 calendar/libecal/e-cal-client.c                    |   34 +-
 calendar/libecal/e-cal-client.h                    |    6 +-
 calendar/libedata-cal/e-cal-backend.c              |   16 +-
 calendar/libedata-cal/e-cal-backend.h              |    1 +
 libedataserverui/Makefile.am                       |    4 +-
 libedataserverui/e-client-authenticate.c           |  185 ---------
 libedataserverui/e-client-authenticate.h           |   37 --
 libedataserverui/e-client-utils.c                  |  414 ++++++++++++++++++++
 libedataserverui/e-client-utils.h                  |   55 +++
 po/POTFILES.in                                     |    2 +-
 tests/libebook/client/client-test-utils.c          |    2 +-
 tests/libebook/client/test-client-async.c          |    2 +-
 tests/libebook/client/test-client-stress-views.c   |    2 +-
 tests/libecal/client/test-client-add-timezone.c    |    4 +-
 tests/libecal/client/test-client-create-object.c   |    4 +-
 tests/libecal/client/test-client-examine.c         |   30 +-
 .../client/test-client-get-attachment-uris.c       |    2 +-
 tests/libecal/client/test-client-get-free-busy.c   |    4 +-
 tests/libecal/client/test-client-get-object-list.c |    2 +-
 tests/libecal/client/test-client-get-view.c        |    2 +-
 tests/libecal/client/test-client-modify-object.c   |    2 +-
 tests/libecal/client/test-client-open.c            |    4 +-
 tests/libecal/client/test-client-receive-objects.c |    2 +-
 tests/libecal/client/test-client-refresh.c         |    2 +-
 tests/libecal/client/test-client-remove-object.c   |    2 +-
 tests/libecal/client/test-client-send-objects.c    |    2 +-
 .../client/test-client-stress-factory--fifo.c      |    2 +-
 .../client/test-client-stress-factory--serial.c    |    2 +-
 .../test-client-stress-factory--single-cal.c       |    2 +-
 tests/libecal/client/test-client-stress-views.c    |    2 +-
 35 files changed, 573 insertions(+), 294 deletions(-)
---
diff --git a/addressbook/libebook/e-book-client.c b/addressbook/libebook/e-book-client.c
index d070f29..c79e37d 100644
--- a/addressbook/libebook/e-book-client.c
+++ b/addressbook/libebook/e-book-client.c
@@ -586,7 +586,7 @@ e_book_client_new_from_uri (const gchar *uri, GError **error)
 }
 
 /**
- * e_book_client_new_system_addressbook:
+ * e_book_client_new_system:
  * @error: A #GError pointer
  *
  * Creates a new #EBookClient corresponding to the user's system
@@ -598,7 +598,7 @@ e_book_client_new_from_uri (const gchar *uri, GError **error)
  * Since: 3.2
  **/
 EBookClient *
-e_book_client_new_system_addressbook (GError **error)
+e_book_client_new_system (GError **error)
 {
 	ESourceList *source_list = NULL;
 	ESource *source;
@@ -624,7 +624,7 @@ e_book_client_new_system_addressbook (GError **error)
 }
 
 /**
- * e_book_client_new_default_addressbook:
+ * e_book_client_new_default:
  * @error: return location for a #GError, or %NULL
  *
  * Creates a new #EBookClient corresponding to the user's default
@@ -636,7 +636,7 @@ e_book_client_new_system_addressbook (GError **error)
  * Since: 3.2
  **/
 EBookClient *
-e_book_client_new_default_addressbook (GError **error)
+e_book_client_new_default (GError **error)
 {
 	ESourceList *source_list = NULL;
 	ESource *source;
@@ -812,7 +812,7 @@ e_book_client_get_self (EContact **contact, EBookClient **client, GError **error
 	g_return_val_if_fail (contact != NULL, FALSE);
 	g_return_val_if_fail (client != NULL, FALSE);
 
-	*client = e_book_client_new_system_addressbook (&local_error);
+	*client = e_book_client_new_system (&local_error);
 	if (!*client) {
 		g_propagate_error (error, local_error);
 		return FALSE;
diff --git a/addressbook/libebook/e-book-client.h b/addressbook/libebook/e-book-client.h
index 5c8910e..17eb9e2 100644
--- a/addressbook/libebook/e-book-client.h
+++ b/addressbook/libebook/e-book-client.h
@@ -79,8 +79,8 @@ GType		e_book_client_get_type				(void);
 /* Creating a new addressbook */
 EBookClient *	e_book_client_new				(ESource *source, GError **error);
 EBookClient *	e_book_client_new_from_uri			(const gchar *uri, GError **error);
-EBookClient *	e_book_client_new_system_addressbook		(GError **error);
-EBookClient *	e_book_client_new_default_addressbook		(GError **error);
+EBookClient *	e_book_client_new_system			(GError **error);
+EBookClient *	e_book_client_new_default			(GError **error);
 
 /* Addressbook discovery */
 gboolean	e_book_client_set_default			(EBookClient *client, GError **error);
diff --git a/addressbook/libebook/e-book.c b/addressbook/libebook/e-book.c
index bc666e8..29fb733 100644
--- a/addressbook/libebook/e-book.c
+++ b/addressbook/libebook/e-book.c
@@ -3537,7 +3537,7 @@ check_system (ESource *source, gpointer data)
  *
  * Returns: a new but unopened #EBook.
  *
- * Deprecated: 3.2: Use e_book_client_new_system_addressbook() instead.
+ * Deprecated: 3.2: Use e_book_client_new_system() instead.
  */
 EBook *
 e_book_new_system_addressbook (GError **error)
@@ -3592,7 +3592,7 @@ e_book_new_system_addressbook (GError **error)
  *
  * Returns: a new but unopened #EBook
  *
- * Deprecated: 3.2: Use e_book_client_new_default_addressbook() instead.
+ * Deprecated: 3.2: Use e_book_client_new_default() instead.
  */
 EBook *
 e_book_new_default_addressbook (GError **error)
diff --git a/addressbook/libedata-book/e-book-backend.c b/addressbook/libedata-book/e-book-backend.c
index 3c272be..54b5cd9 100644
--- a/addressbook/libedata-book/e-book-backend.c
+++ b/addressbook/libedata-book/e-book-backend.c
@@ -80,7 +80,7 @@ book_backend_get_backend_property (EBookBackend *backend, EDataBook *book, guint
 	if (g_str_equal (prop_name, CLIENT_BACKEND_PROPERTY_LOADED)) {
 		e_data_book_respond_get_backend_property (book, opid, NULL, e_book_backend_is_loaded (backend) ? "TRUE" : "FALSE");
 	} else if (g_str_equal (prop_name, CLIENT_BACKEND_PROPERTY_ONLINE)) {
-		e_data_book_respond_get_backend_property (book, opid, NULL, backend->priv->online ? "TRUE" : "FALSE");
+		e_data_book_respond_get_backend_property (book, opid, NULL, e_book_backend_is_online (backend) ? "TRUE" : "FALSE");
 	} else if (g_str_equal (prop_name, CLIENT_BACKEND_PROPERTY_READONLY)) {
 		e_data_book_respond_get_backend_property (book, opid, NULL, e_book_backend_is_readonly (backend) ? "TRUE" : "FALSE");
 	} else if (g_str_equal (prop_name, CLIENT_BACKEND_PROPERTY_CACHE_DIR)) {
@@ -743,6 +743,22 @@ e_book_backend_set_backend_property (EBookBackend *backend, EDataBook *book, gui
 }
 
 /**
+ * e_book_backend_is_online:
+ * @backend: an #EBookBackend
+ *
+ * Checks if @backend's storage is online.
+ *
+ * Returns: %TRUE if loaded, %FALSE otherwise.
+ **/
+gboolean
+e_book_backend_is_online (EBookBackend *backend)
+{
+	g_return_val_if_fail (E_IS_BOOK_BACKEND (backend), FALSE);
+
+	return backend->priv->online;
+}
+
+/**
  * e_book_backend_is_loaded:
  * @backend: an #EBookBackend
  *
diff --git a/addressbook/libedata-book/e-book-backend.h b/addressbook/libedata-book/e-book-backend.h
index 9e9c3a7..cd7ec1c 100644
--- a/addressbook/libedata-book/e-book-backend.h
+++ b/addressbook/libedata-book/e-book-backend.h
@@ -93,6 +93,7 @@ ESource *	e_book_backend_get_source	(EBookBackend *backend);
 gboolean	e_book_backend_add_client	(EBookBackend *backend, EDataBook *book);
 void		e_book_backend_remove_client	(EBookBackend *backend, EDataBook *book);
 
+gboolean	e_book_backend_is_online	(EBookBackend *backend);
 gboolean	e_book_backend_is_loaded	(EBookBackend *backend);
 gboolean	e_book_backend_is_readonly	(EBookBackend *backend);
 gboolean	e_book_backend_is_removed	(EBookBackend *backend);
diff --git a/calendar/libecal/e-cal-client.c b/calendar/libecal/e-cal-client.c
index 87e7365..88c0baf 100644
--- a/calendar/libecal/e-cal-client.c
+++ b/calendar/libecal/e-cal-client.c
@@ -96,10 +96,10 @@ e_cal_client_source_type_enum_get_type (void)
 	if (g_once_init_enter (&enum_type__volatile)) {
 		GType enum_type;
 		static GEnumValue values[] = {
-			{ E_CAL_CLIENT_SOURCE_TYPE_EVENT, "Event", "Event"},
-			{ E_CAL_CLIENT_SOURCE_TYPE_TODO, "ToDo", "ToDo"},
-			{ E_CAL_CLIENT_SOURCE_TYPE_JOURNAL, "Journal", "Journal"},
-			{ E_CAL_CLIENT_SOURCE_TYPE_LAST, "Invalid", "Invalid"},
+			{ E_CAL_CLIENT_SOURCE_TYPE_EVENTS, "Events",  "Events"  },
+			{ E_CAL_CLIENT_SOURCE_TYPE_TASKS,  "Tasks",   "Tasks"   },
+			{ E_CAL_CLIENT_SOURCE_TYPE_MEMOS,  "Memos",   "Memos"   },
+			{ E_CAL_CLIENT_SOURCE_TYPE_LAST,   "Invalid", "Invalid" },
 			{ -1, NULL, NULL}
 		};
 
@@ -517,11 +517,11 @@ static EDataCalObjType
 convert_type (ECalClientSourceType type)
 {
 	switch (type) {
-	case E_CAL_CLIENT_SOURCE_TYPE_EVENT:
+	case E_CAL_CLIENT_SOURCE_TYPE_EVENTS:
 		return Event;
-	case E_CAL_CLIENT_SOURCE_TYPE_TODO:
+	case E_CAL_CLIENT_SOURCE_TYPE_TASKS:
 		return Todo;
-	case E_CAL_CLIENT_SOURCE_TYPE_JOURNAL:
+	case E_CAL_CLIENT_SOURCE_TYPE_MEMOS:
 		return Journal;
 	default:
 		return AnyType;
@@ -555,7 +555,7 @@ e_cal_client_new (ESource *source, ECalClientSourceType source_type, GError **er
 
 	g_return_val_if_fail (source != NULL, NULL);
 	g_return_val_if_fail (E_IS_SOURCE (source), NULL);
-	g_return_val_if_fail (source_type == E_CAL_CLIENT_SOURCE_TYPE_EVENT || source_type == E_CAL_CLIENT_SOURCE_TYPE_TODO || source_type == E_CAL_CLIENT_SOURCE_TYPE_JOURNAL, NULL);
+	g_return_val_if_fail (source_type == E_CAL_CLIENT_SOURCE_TYPE_EVENTS || source_type == E_CAL_CLIENT_SOURCE_TYPE_TASKS || source_type == E_CAL_CLIENT_SOURCE_TYPE_MEMOS, NULL);
 
 	if (!gdbus_cal_factory_activate (&err)) {
 		if (err) {
@@ -858,13 +858,13 @@ e_cal_client_get_sources (ESourceList **sources, ECalClientSourceType source_typ
 	g_return_val_if_fail (sources != NULL, FALSE);
 
 	switch (source_type) {
-	case E_CAL_CLIENT_SOURCE_TYPE_EVENT:
+	case E_CAL_CLIENT_SOURCE_TYPE_EVENTS:
 		key = "/apps/evolution/calendar/sources";
 		break;
-	case E_CAL_CLIENT_SOURCE_TYPE_TODO:
+	case E_CAL_CLIENT_SOURCE_TYPE_TASKS:
 		key = "/apps/evolution/tasks/sources";
 		break;
-	case E_CAL_CLIENT_SOURCE_TYPE_JOURNAL:
+	case E_CAL_CLIENT_SOURCE_TYPE_MEMOS:
 		key = "/apps/evolution/memos/sources";
 		break;
 	default:
@@ -2287,9 +2287,9 @@ complete_get_objects_for_uid (ECalClientSourceType source_type, gboolean res, gc
 		return FALSE;
 
 	kind = icalcomponent_isa (icalcomp);
-	if ((kind == ICAL_VEVENT_COMPONENT && source_type == E_CAL_CLIENT_SOURCE_TYPE_EVENT) ||
-	    (kind == ICAL_VTODO_COMPONENT && source_type == E_CAL_CLIENT_SOURCE_TYPE_TODO) ||
-	    (kind == ICAL_VJOURNAL_COMPONENT && source_type == E_CAL_CLIENT_SOURCE_TYPE_JOURNAL)) {
+	if ((kind == ICAL_VEVENT_COMPONENT && source_type == E_CAL_CLIENT_SOURCE_TYPE_EVENTS) ||
+	    (kind == ICAL_VTODO_COMPONENT && source_type == E_CAL_CLIENT_SOURCE_TYPE_TASKS) ||
+	    (kind == ICAL_VJOURNAL_COMPONENT && source_type == E_CAL_CLIENT_SOURCE_TYPE_MEMOS)) {
 		comp = e_cal_component_new ();
 		e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (icalcomp));
 		*ecalcomps = g_slist_append (NULL, comp);
@@ -2298,13 +2298,13 @@ complete_get_objects_for_uid (ECalClientSourceType source_type, gboolean res, gc
 		icalcomponent_kind kind_to_find;
 
 		switch (source_type) {
-		case E_CAL_CLIENT_SOURCE_TYPE_TODO :
+		case E_CAL_CLIENT_SOURCE_TYPE_TASKS:
 			kind_to_find = ICAL_VTODO_COMPONENT;
 			break;
-		case E_CAL_CLIENT_SOURCE_TYPE_JOURNAL :
+		case E_CAL_CLIENT_SOURCE_TYPE_MEMOS:
 			kind_to_find = ICAL_VJOURNAL_COMPONENT;
 			break;
-		case E_CAL_CLIENT_SOURCE_TYPE_EVENT :
+		case E_CAL_CLIENT_SOURCE_TYPE_EVENTS:
 		default:
 			kind_to_find = ICAL_VEVENT_COMPONENT;
 			break;
diff --git a/calendar/libecal/e-cal-client.h b/calendar/libecal/e-cal-client.h
index ec43d75..2dd7de6 100644
--- a/calendar/libecal/e-cal-client.h
+++ b/calendar/libecal/e-cal-client.h
@@ -44,9 +44,9 @@ G_BEGIN_DECLS
 #define CAL_BACKEND_PROPERTY_DEFAULT_OBJECT		"default-object"
 
 typedef enum {
-	E_CAL_CLIENT_SOURCE_TYPE_EVENT,
-	E_CAL_CLIENT_SOURCE_TYPE_TODO,
-	E_CAL_CLIENT_SOURCE_TYPE_JOURNAL,
+	E_CAL_CLIENT_SOURCE_TYPE_EVENTS,
+	E_CAL_CLIENT_SOURCE_TYPE_TASKS,
+	E_CAL_CLIENT_SOURCE_TYPE_MEMOS,
 	E_CAL_CLIENT_SOURCE_TYPE_LAST
 } ECalClientSourceType;
 
diff --git a/calendar/libedata-cal/e-cal-backend.c b/calendar/libedata-cal/e-cal-backend.c
index 87d3687..244fd79 100644
--- a/calendar/libedata-cal/e-cal-backend.c
+++ b/calendar/libedata-cal/e-cal-backend.c
@@ -195,7 +195,7 @@ cal_backend_get_backend_property (ECalBackend *backend, EDataCal *cal, guint32 o
 	if (g_str_equal (prop_name, CLIENT_BACKEND_PROPERTY_LOADED)) {
 		e_data_cal_respond_get_backend_property (cal, opid, NULL, e_cal_backend_is_loaded (backend) ? "TRUE" : "FALSE");
 	} else if (g_str_equal (prop_name, CLIENT_BACKEND_PROPERTY_ONLINE)) {
-		e_data_cal_respond_get_backend_property (cal, opid, NULL, backend->priv->online ? "TRUE" : "FALSE");
+		e_data_cal_respond_get_backend_property (cal, opid, NULL, e_cal_backend_is_online (backend) ? "TRUE" : "FALSE");
 	} else if (g_str_equal (prop_name, CLIENT_BACKEND_PROPERTY_READONLY)) {
 		e_data_cal_respond_get_backend_property (cal, opid, NULL, e_cal_backend_is_readonly (backend) ? "TRUE" : "FALSE");
 	} else if (g_str_equal (prop_name, CLIENT_BACKEND_PROPERTY_CACHE_DIR)) {
@@ -454,6 +454,20 @@ e_cal_backend_get_kind (ECalBackend *backend)
 }
 
 /**
+ * e_cal_backend_is_online:
+ * @backend: an #ECalBackend
+ *
+ * Returns: Whether is backend online.
+ **/
+gboolean
+e_cal_backend_is_online (ECalBackend *backend)
+{
+	g_return_val_if_fail (E_IS_CAL_BACKEND (backend), FALSE);
+
+	return backend->priv->online;
+}
+
+/**
  * e_cal_backend_is_loaded:
  * @backend: an #ECalBackend
  *
diff --git a/calendar/libedata-cal/e-cal-backend.h b/calendar/libedata-cal/e-cal-backend.h
index 6ce39ca..fdbd849 100644
--- a/calendar/libedata-cal/e-cal-backend.h
+++ b/calendar/libedata-cal/e-cal-backend.h
@@ -102,6 +102,7 @@ GType		e_cal_backend_get_type			(void);
 ESource *	e_cal_backend_get_source		(ECalBackend *backend);
 const gchar *	e_cal_backend_get_uri			(ECalBackend *backend);
 icalcomponent_kind e_cal_backend_get_kind		(ECalBackend *backend);
+gboolean	e_cal_backend_is_online			(ECalBackend *backend);
 gboolean	e_cal_backend_is_loaded			(ECalBackend *backend);
 gboolean	e_cal_backend_is_readonly		(ECalBackend *backend);
 gboolean	e_cal_backend_is_removed		(ECalBackend *backend);
diff --git a/libedataserverui/Makefile.am b/libedataserverui/Makefile.am
index 1fcde30..45d38b5 100644
--- a/libedataserverui/Makefile.am
+++ b/libedataserverui/Makefile.am
@@ -23,7 +23,7 @@ libedataserveruiinclude_HEADERS =	\
 	e-category-completion.h		\
 	e-destination-store.h		\
 	e-book-auth-util.h		\
-	e-client-authenticate.h		\
+	e-client-utils.h		\
 	e-contact-store.h		\
 	e-name-selector.h		\
 	e-name-selector-dialog.h	\
@@ -51,7 +51,7 @@ libedataserverui_3_0_la_SOURCES =	\
 	e-category-completion.c		\
 	e-destination-store.c		\
 	e-book-auth-util.c		\
-	e-client-authenticate.c		\
+	e-client-utils.c		\
 	e-contact-store.c		\
 	e-name-selector.c		\
 	e-name-selector-dialog.c	\
diff --git a/libedataserverui/e-client-utils.c b/libedataserverui/e-client-utils.c
new file mode 100644
index 0000000..d7ad96a
--- /dev/null
+++ b/libedataserverui/e-client-utils.c
@@ -0,0 +1,414 @@
+/*
+ * e-client-utils.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 2011 Red Hat, Inc. (www.redhat.com)
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib.h>
+#include <glib/gi18n-lib.h>
+#include <gtk/gtk.h>
+#include <libsoup/soup.h>
+
+#include <libedataserver/e-client.h>
+#include "libedataserver/e-client-private.h"
+#include <libebook/e-book-client.h>
+#include <libecal/e-cal-client.h>
+
+#include "e-passwords.h"
+#include "e-client-utils.h"
+
+/**
+ * e_client_utils_new:
+ *
+ * Proxy function for e_book_client_utils_new() and e_cal_client_utils_new().
+ **/
+EClient	*
+e_client_utils_new (ESource *source, EClientSourceType source_type, GError **error)
+{
+	EClient *res = NULL;
+
+	g_return_val_if_fail (source != NULL, NULL);
+	g_return_val_if_fail (E_IS_SOURCE (source), NULL);
+
+	switch (source_type) {
+	case E_CLIENT_SOURCE_TYPE_CONTACTS:
+		res = E_CLIENT (e_book_client_new (source, error));
+		break;
+	case E_CLIENT_SOURCE_TYPE_EVENTS:
+		res = E_CLIENT (e_cal_client_new (source, E_CAL_CLIENT_SOURCE_TYPE_EVENTS, error));
+		break;
+	case E_CLIENT_SOURCE_TYPE_MEMOS:
+		res = E_CLIENT (e_cal_client_new (source, E_CAL_CLIENT_SOURCE_TYPE_MEMOS, error));
+		break;
+	case E_CLIENT_SOURCE_TYPE_TASKS:
+		res = E_CLIENT (e_cal_client_new (source, E_CAL_CLIENT_SOURCE_TYPE_TASKS, error));
+		break;
+	default:
+		g_return_val_if_reached (NULL);
+		break;
+	}
+
+	return res;
+}
+
+/**
+ * e_client_utils_new_from_uri:
+ *
+ * Proxy function for e_book_client_utils_new_from_uri() and e_cal_client_utils_new_from_uri().
+ **/
+EClient *
+e_client_utils_new_from_uri (const gchar *uri, EClientSourceType source_type, GError **error)
+{
+	EClient *res = NULL;
+
+	g_return_val_if_fail (uri != NULL, NULL);
+
+	switch (source_type) {
+	case E_CLIENT_SOURCE_TYPE_CONTACTS:
+		res = E_CLIENT (e_book_client_new_from_uri (uri, error));
+		break;
+	case E_CLIENT_SOURCE_TYPE_EVENTS:
+		res = E_CLIENT (e_cal_client_new_from_uri (uri, E_CAL_CLIENT_SOURCE_TYPE_EVENTS, error));
+		break;
+	case E_CLIENT_SOURCE_TYPE_MEMOS:
+		res = E_CLIENT (e_cal_client_new_from_uri (uri, E_CAL_CLIENT_SOURCE_TYPE_MEMOS, error));
+		break;
+	case E_CLIENT_SOURCE_TYPE_TASKS:
+		res = E_CLIENT (e_cal_client_new_from_uri (uri, E_CAL_CLIENT_SOURCE_TYPE_TASKS, error));
+		break;
+	default:
+		g_return_val_if_reached (NULL);
+		break;
+	}
+
+	return res;
+}
+
+/**
+ * e_client_utils_new_system:
+ *
+ * Proxy function for e_book_client_utils_new_system() and e_cal_client_utils_new_system().
+ **/
+EClient *
+e_client_utils_new_system (EClientSourceType source_type, GError **error)
+{
+	EClient *res = NULL;
+
+	switch (source_type) {
+	case E_CLIENT_SOURCE_TYPE_CONTACTS:
+		res = E_CLIENT (e_book_client_new_system (error));
+		break;
+	case E_CLIENT_SOURCE_TYPE_EVENTS:
+		res = E_CLIENT (e_cal_client_new_system (E_CAL_CLIENT_SOURCE_TYPE_EVENTS, error));
+		break;
+	case E_CLIENT_SOURCE_TYPE_MEMOS:
+		res = E_CLIENT (e_cal_client_new_system (E_CAL_CLIENT_SOURCE_TYPE_MEMOS, error));
+		break;
+	case E_CLIENT_SOURCE_TYPE_TASKS:
+		res = E_CLIENT (e_cal_client_new_system (E_CAL_CLIENT_SOURCE_TYPE_TASKS, error));
+		break;
+	default:
+		g_return_val_if_reached (NULL);
+		break;
+	}
+
+	return res;
+}
+
+/**
+ * e_client_utils_new_default:
+ *
+ * Proxy function for e_book_client_utils_new_default() and e_cal_client_utils_new_default().
+ **/
+EClient *
+e_client_utils_new_default (EClientSourceType source_type, GError **error)
+{
+	EClient *res = NULL;
+
+	switch (source_type) {
+	case E_CLIENT_SOURCE_TYPE_CONTACTS:
+		res = E_CLIENT (e_book_client_new_default (error));
+		break;
+	case E_CLIENT_SOURCE_TYPE_EVENTS:
+		res = E_CLIENT (e_cal_client_new_default (E_CAL_CLIENT_SOURCE_TYPE_EVENTS, error));
+		break;
+	case E_CLIENT_SOURCE_TYPE_MEMOS:
+		res = E_CLIENT (e_cal_client_new_default (E_CAL_CLIENT_SOURCE_TYPE_MEMOS, error));
+		break;
+	case E_CLIENT_SOURCE_TYPE_TASKS:
+		res = E_CLIENT (e_cal_client_new_default (E_CAL_CLIENT_SOURCE_TYPE_TASKS, error));
+		break;
+	default:
+		g_return_val_if_reached (NULL);
+		break;
+	}
+
+	return res;
+}
+
+/**
+ * e_client_utils_set_default:
+ *
+ * Proxy function for e_book_client_utils_set_default() and e_book_client_utils_set_default().
+ **/
+gboolean
+e_client_utils_set_default (EClient *client, EClientSourceType source_type, GError **error)
+{
+	gboolean res = FALSE;
+
+	g_return_val_if_fail (client != NULL, FALSE);
+	g_return_val_if_fail (E_IS_CLIENT (client), FALSE);
+
+	switch (source_type) {
+	case E_CLIENT_SOURCE_TYPE_CONTACTS:
+		g_return_val_if_fail (E_IS_BOOK_CLIENT (client), FALSE);
+		res = e_book_client_set_default (E_BOOK_CLIENT (client), error);
+		break;
+	case E_CLIENT_SOURCE_TYPE_EVENTS:
+	case E_CLIENT_SOURCE_TYPE_MEMOS:
+	case E_CLIENT_SOURCE_TYPE_TASKS:
+		g_return_val_if_fail (E_IS_CAL_CLIENT (client), FALSE);
+		res = e_cal_client_set_default (E_CAL_CLIENT (client), error);
+		break;
+	default:
+		g_return_val_if_reached (FALSE);
+		break;
+	}
+
+	return res;
+}
+
+/**
+ * e_client_utils_set_default_source:
+ *
+ * Proxy function for e_book_client_utils_set_default_source() and e_cal_client_utils_set_default_source().
+ **/
+gboolean
+e_client_utils_set_default_source (ESource *source, EClientSourceType source_type, GError **error)
+{
+	gboolean res = FALSE;
+
+	g_return_val_if_fail (source != NULL, FALSE);
+	g_return_val_if_fail (E_IS_SOURCE (source), FALSE);
+
+	switch (source_type) {
+	case E_CLIENT_SOURCE_TYPE_CONTACTS:
+		res = e_book_client_set_default_source (source, error);
+		break;
+	case E_CLIENT_SOURCE_TYPE_EVENTS:
+		res = e_cal_client_set_default_source (source, E_CAL_CLIENT_SOURCE_TYPE_EVENTS, error);
+		break;
+	case E_CLIENT_SOURCE_TYPE_MEMOS:
+		res = e_cal_client_set_default_source (source, E_CAL_CLIENT_SOURCE_TYPE_MEMOS, error);
+		break;
+	case E_CLIENT_SOURCE_TYPE_TASKS:
+		res = e_cal_client_set_default_source (source, E_CAL_CLIENT_SOURCE_TYPE_TASKS, error);
+		break;
+	default:
+		g_return_val_if_reached (FALSE);
+		break;
+	}
+
+	return res;
+}
+
+/**
+ * e_client_utils_get_sources:
+ *
+ * Proxy function for e_book_client_utils_get_sources() and e_cal_client_utils_get_sources().
+ **/
+gboolean
+e_client_utils_get_sources (ESourceList **sources, EClientSourceType source_type, GError **error)
+{
+	gboolean res = FALSE;
+
+	g_return_val_if_fail (sources != NULL, FALSE);
+
+	switch (source_type) {
+	case E_CLIENT_SOURCE_TYPE_CONTACTS:
+		res = e_book_client_get_sources (sources, error);
+		break;
+	case E_CLIENT_SOURCE_TYPE_EVENTS:
+		res = e_cal_client_get_sources (sources, E_CAL_CLIENT_SOURCE_TYPE_EVENTS, error);
+		break;
+	case E_CLIENT_SOURCE_TYPE_MEMOS:
+		res = e_cal_client_get_sources (sources, E_CAL_CLIENT_SOURCE_TYPE_MEMOS, error);
+		break;
+	case E_CLIENT_SOURCE_TYPE_TASKS:
+		res = e_cal_client_get_sources (sources, E_CAL_CLIENT_SOURCE_TYPE_TASKS, error);
+		break;
+	default:
+		g_return_val_if_reached (FALSE);
+		break;
+	}
+
+	return res;
+}
+
+/* This function is suitable as a handler for EClient::authenticate signal.
+   It takes care of all the password prompt and such and returns TRUE if
+   credentials (password) were provided. Thus just connect it to that signal
+   and it'll take care of everything else.
+*/
+gboolean
+e_client_utils_authenticate_handler (EClient *client, ECredentials *credentials, gpointer unused_user_data)
+{
+	ESource *source;
+	gboolean is_book, is_cal, res, remember_password = FALSE;
+
+	g_return_val_if_fail (client != NULL, FALSE);
+	g_return_val_if_fail (credentials != NULL, FALSE);
+
+	is_book = E_IS_BOOK_CLIENT (client);
+	is_cal = !is_book && E_IS_CAL_CLIENT (client);
+	g_return_val_if_fail (is_book || is_cal, FALSE);
+
+	source = e_client_get_source (client);
+	g_return_val_if_fail (source != NULL, FALSE);
+
+	if (!e_credentials_has_key (credentials, E_CREDENTIALS_KEY_USERNAME)) {
+		e_credentials_set (credentials, E_CREDENTIALS_KEY_USERNAME, e_source_get_property (source, "username"));
+
+		/* no username set on the source - deny authentication request until
+		   username will be also enterable with e-passwords */
+		if (!e_credentials_has_key (credentials, E_CREDENTIALS_KEY_USERNAME))
+			return FALSE;
+	}
+
+	if (!e_credentials_has_key (credentials, E_CREDENTIALS_KEY_AUTH_DOMAIN))
+		e_credentials_set (credentials, E_CREDENTIALS_KEY_AUTH_DOMAIN, is_book ? E_CREDENTIALS_AUTH_DOMAIN_ADDRESSBOOK : E_CREDENTIALS_AUTH_DOMAIN_CALENDAR);
+
+	if (!e_credentials_has_key (credentials, E_CREDENTIALS_KEY_PROMPT_TEXT)) {
+		gchar *prompt;
+		gchar *username_markup, *source_name_markup;
+
+		username_markup = g_markup_printf_escaped ("<b>%s</b>", e_credentials_peek (credentials, E_CREDENTIALS_KEY_USERNAME));
+		source_name_markup = g_markup_printf_escaped ("<b>%s</b>", e_source_peek_name (source));
+
+		prompt = g_strdup_printf (_("Enter password for %s (user %s)"), source_name_markup, username_markup);
+
+		e_credentials_set (credentials, E_CREDENTIALS_KEY_PROMPT_TEXT, prompt);
+
+		g_free (username_markup);
+		g_free (source_name_markup);
+		g_free (prompt);
+	}
+
+	if (!e_credentials_has_key (credentials, E_CREDENTIALS_KEY_PROMPT_KEY)) {
+		SoupURI *suri;
+		gchar *uri_str;
+
+		suri = soup_uri_new (e_client_get_uri (client));
+		g_return_val_if_fail (suri != NULL, FALSE);
+
+		soup_uri_set_user (suri, e_credentials_peek (credentials, E_CREDENTIALS_KEY_USERNAME));
+		soup_uri_set_password (suri, NULL);
+		soup_uri_set_fragment (suri, NULL);
+
+		uri_str = soup_uri_to_string (suri, FALSE);
+
+		e_credentials_set (credentials, E_CREDENTIALS_KEY_PROMPT_KEY, uri_str);
+
+		g_free (uri_str);
+		soup_uri_free (suri);
+	}
+
+	remember_password = g_strcmp0 (e_source_get_property (source, "remember_password"), "true") == 0;
+
+	res = e_credentials_authenticate_helper (credentials, NULL, &remember_password);
+
+	if (res)
+		e_source_set_property (source, "remember_password", remember_password ? "true" : NULL);
+
+	e_credentials_clear_peek (credentials);
+
+	return res;
+}
+
+/* Asks for a password based on the provided credentials information.
+   Credentials should have set following keys:
+      E_CREDENTIALS_KEY_USERNAME
+      E_CREDENTIALS_KEY_AUTH_DOMAIN
+      E_CREDENTIALS_KEY_PROMPT_TEXT
+      E_CREDENTIALS_KEY_PROMPT_KEY
+   all other keys are optional. If also E_CREDENTIALS_KEY_PASSWORD key is provided,
+   then it implies a reprompt.
+
+   When this returns TRUE, then the structure contains E_CREDENTIALS_KEY_PASSWORD set
+   as entered by a user.
+*/
+gboolean
+e_credentials_authenticate_helper (ECredentials *credentials, GtkWindow *parent, gboolean *remember_password)
+{
+	gboolean res, fake_remember_password = FALSE;
+	guint prompt_flags;
+	gchar *password = NULL;
+	const gchar *title, *auth_domain, *prompt_key;
+
+	g_return_val_if_fail (credentials != NULL, FALSE);
+	g_return_val_if_fail (e_credentials_has_key (credentials, E_CREDENTIALS_KEY_USERNAME), FALSE);
+	g_return_val_if_fail (e_credentials_has_key (credentials, E_CREDENTIALS_KEY_AUTH_DOMAIN), FALSE);
+	g_return_val_if_fail (e_credentials_has_key (credentials, E_CREDENTIALS_KEY_PROMPT_TEXT), FALSE);
+	g_return_val_if_fail (e_credentials_has_key (credentials, E_CREDENTIALS_KEY_PROMPT_KEY), FALSE);
+
+	if (e_credentials_has_key (credentials, E_CREDENTIALS_KEY_PROMPT_FLAGS)) {
+		prompt_flags = e_credentials_util_string_to_prompt_flags (e_credentials_peek (credentials, E_CREDENTIALS_KEY_PROMPT_FLAGS));
+	} else {
+		prompt_flags = E_CREDENTIALS_PROMPT_FLAG_SECRET | E_CREDENTIALS_PROMPT_FLAG_ONLINE;
+	}
+
+	if (!remember_password) {
+		prompt_flags |= E_CREDENTIALS_PROMPT_FLAG_DISABLE_REMEMBER;
+		remember_password = &fake_remember_password;
+	}
+
+	if (e_credentials_has_key (credentials, E_CREDENTIALS_KEY_PASSWORD))
+		prompt_flags |= E_CREDENTIALS_PROMPT_FLAG_REPROMPT;
+
+	if (e_credentials_has_key (credentials, E_CREDENTIALS_KEY_PROMPT_TITLE))
+		title = e_credentials_peek (credentials, E_CREDENTIALS_KEY_PROMPT_TITLE);
+	else if (prompt_flags & E_CREDENTIALS_PROMPT_FLAG_PASSPHRASE)
+		title = _("Enter Passphrase");
+	else
+		title = _("Enter Password");
+
+	auth_domain = e_credentials_peek (credentials, E_CREDENTIALS_KEY_AUTH_DOMAIN);
+	prompt_key = e_credentials_peek (credentials, E_CREDENTIALS_KEY_PROMPT_KEY);
+
+	if (!(prompt_flags & E_CREDENTIALS_PROMPT_FLAG_REPROMPT))
+		password = e_passwords_get_password (auth_domain, prompt_key);
+
+	if (!password)
+		password = e_passwords_ask_password (title, auth_domain, prompt_key,
+				e_credentials_peek (credentials, E_CREDENTIALS_KEY_PROMPT_TEXT),
+				prompt_flags, remember_password, parent);
+
+	res = password != NULL;
+
+	if (res)
+		e_credentials_set (credentials, E_CREDENTIALS_KEY_PASSWORD, password);
+
+	e_credentials_util_safe_free_string (password);
+	e_credentials_clear_peek (credentials);
+
+	return res;
+}
diff --git a/libedataserverui/e-client-utils.h b/libedataserverui/e-client-utils.h
new file mode 100644
index 0000000..b97c9c0
--- /dev/null
+++ b/libedataserverui/e-client-utils.h
@@ -0,0 +1,55 @@
+/*
+ * e-client-utils.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 2011 Red Hat, Inc. (www.redhat.com)
+ *
+ */
+
+#ifndef E_CLIENT_UTILS_H
+#define E_CLIENT_UTILS_H
+
+#include <glib.h>
+#include <gtk/gtk.h>
+
+#include <libedataserver/e-client.h>
+
+G_BEGIN_DECLS
+
+typedef enum {
+	E_CLIENT_SOURCE_TYPE_CONTACTS,
+	E_CLIENT_SOURCE_TYPE_EVENTS,
+	E_CLIENT_SOURCE_TYPE_MEMOS,
+	E_CLIENT_SOURCE_TYPE_TASKS
+} EClientSourceType;
+
+typedef gboolean (* EClientUtilsAuthenticateHandler) (EClient *client, ECredentials *credentials, gpointer user_data);
+
+EClient	*	e_client_utils_new			(ESource *source, EClientSourceType source_type, GError **error);
+EClient *	e_client_utils_new_from_uri		(const gchar *uri, EClientSourceType source_type, GError **error);
+EClient *	e_client_utils_new_system		(EClientSourceType source_type, GError **error);
+EClient *	e_client_utils_new_default		(EClientSourceType source_type, GError **error);
+
+gboolean	e_client_utils_set_default		(EClient *client, EClientSourceType source_type, GError **error);
+gboolean	e_client_utils_set_default_source	(ESource *source, EClientSourceType source_type, GError **error);
+gboolean	e_client_utils_get_sources		(ESourceList **sources, EClientSourceType source_type, GError **error);
+
+gboolean	e_client_utils_authenticate_handler	(EClient *client, ECredentials *credentials, gpointer unused_user_data);
+gboolean	e_credentials_authenticate_helper	(ECredentials *credentials, GtkWindow *parent, gboolean *remember_password);
+
+G_END_DECLS
+
+#endif /* E_CLIENT_UTILS_H */
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 49e217f..7d7694e 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -194,7 +194,7 @@ libedataserverui/e-book-auth-util.c
 libedataserverui/e-categories-dialog.c
 libedataserverui/e-category-completion.c
 libedataserverui/e-cell-renderer-color.c
-libedataserverui/e-client-authenticate.c
+libedataserverui/e-client-utils.c
 libedataserverui/e-name-selector-dialog.c
 libedataserverui/e-name-selector-entry.c
 libedataserverui/e-name-selector-list.c
diff --git a/tests/libebook/client/client-test-utils.c b/tests/libebook/client/client-test-utils.c
index 4b007e8..6a7004e 100644
--- a/tests/libebook/client/client-test-utils.c
+++ b/tests/libebook/client/client-test-utils.c
@@ -42,7 +42,7 @@ open_system_book (gboolean only_if_exists)
 
 	main_initialize ();
 
-	book_client = e_book_client_new_system_addressbook (&error);
+	book_client = e_book_client_new_system (&error);
 	if (error) {
 		report_error ("create system addressbook", &error);
 		return NULL;
diff --git a/tests/libebook/client/test-client-async.c b/tests/libebook/client/test-client-async.c
index 2b78be6..e3cc419 100644
--- a/tests/libebook/client/test-client-async.c
+++ b/tests/libebook/client/test-client-async.c
@@ -103,7 +103,7 @@ main (gint argc, gchar **argv)
 
 	main_initialize ();
 
-	book_client = e_book_client_new_system_addressbook (&error);
+	book_client = e_book_client_new_system (&error);
 	if (error) {
 		report_error ("create system addressbook", &error);
 		return 1;
diff --git a/tests/libebook/client/test-client-stress-views.c b/tests/libebook/client/test-client-stress-views.c
index 34e83c1..4628e56 100644
--- a/tests/libebook/client/test-client-stress-views.c
+++ b/tests/libebook/client/test-client-stress-views.c
@@ -104,7 +104,7 @@ main (gint argc, gchar **argv)
 
 	printf ("loading addressbook\n");
 
-	book_client = e_book_client_new_system_addressbook (&error);
+	book_client = e_book_client_new_system (&error);
 	if (!book_client) {
 		report_error ("create local addressbook", &error);
 		return 1;
diff --git a/tests/libecal/client/test-client-add-timezone.c b/tests/libecal/client/test-client-add-timezone.c
index b003801..ece2391 100644
--- a/tests/libecal/client/test-client-add-timezone.c
+++ b/tests/libecal/client/test-client-add-timezone.c
@@ -40,7 +40,7 @@ test_sync (icaltimezone *zone)
 
 	g_return_val_if_fail (zone != NULL, FALSE);
 
-	cal_client = new_temp_client (E_CAL_CLIENT_SOURCE_TYPE_EVENT, NULL);
+	cal_client = new_temp_client (E_CAL_CLIENT_SOURCE_TYPE_EVENTS, NULL);
 	g_return_val_if_fail (cal_client != NULL, FALSE);
 
 	if (!e_client_open_sync (E_CLIENT (cal_client), FALSE, NULL, &error)) {
@@ -141,7 +141,7 @@ test_sync_in_idle (gpointer user_data)
 		return FALSE;
 	}
 
-	cal_client = new_temp_client (E_CAL_CLIENT_SOURCE_TYPE_EVENT, NULL);
+	cal_client = new_temp_client (E_CAL_CLIENT_SOURCE_TYPE_EVENTS, NULL);
 	g_return_val_if_fail (cal_client != NULL, FALSE);
 
 	if (!e_client_open_sync (E_CLIENT (cal_client), FALSE, NULL, &error)) {
diff --git a/tests/libecal/client/test-client-create-object.c b/tests/libecal/client/test-client-create-object.c
index dc95a24..25af903 100644
--- a/tests/libecal/client/test-client-create-object.c
+++ b/tests/libecal/client/test-client-create-object.c
@@ -56,7 +56,7 @@ test_sync (icalcomponent *icalcomp)
 
 	g_return_val_if_fail (icalcomp != NULL, FALSE);
 
-	cal_client = new_temp_client (E_CAL_CLIENT_SOURCE_TYPE_EVENT, NULL);
+	cal_client = new_temp_client (E_CAL_CLIENT_SOURCE_TYPE_EVENTS, NULL);
 	g_return_val_if_fail (cal_client != NULL, FALSE);
 
 	if (!e_client_open_sync (E_CLIENT (cal_client), FALSE, NULL, &error)) {
@@ -232,7 +232,7 @@ test_sync_in_idle (gpointer user_data)
 		return FALSE;
 	}
 
-	cal_client = new_temp_client (E_CAL_CLIENT_SOURCE_TYPE_EVENT, NULL);
+	cal_client = new_temp_client (E_CAL_CLIENT_SOURCE_TYPE_EVENTS, NULL);
 	g_return_val_if_fail (cal_client != NULL, FALSE);
 
 	if (!e_client_open_sync (E_CLIENT (cal_client), FALSE, NULL, &error)) {
diff --git a/tests/libecal/client/test-client-examine.c b/tests/libecal/client/test-client-examine.c
index bc690d2..0d994be 100644
--- a/tests/libecal/client/test-client-examine.c
+++ b/tests/libecal/client/test-client-examine.c
@@ -149,13 +149,13 @@ identify_source (ESource *source, ECalClientSourceType source_type)
 	g_return_if_fail (source != NULL);
 
 	switch (source_type) {
-	case E_CAL_CLIENT_SOURCE_TYPE_EVENT:
+	case E_CAL_CLIENT_SOURCE_TYPE_EVENTS:
 		type = "events";
 		break;
-	case E_CAL_CLIENT_SOURCE_TYPE_TODO:
+	case E_CAL_CLIENT_SOURCE_TYPE_TASKS:
 		type = "tasks";
 		break;
-	case E_CAL_CLIENT_SOURCE_TYPE_JOURNAL:
+	case E_CAL_CLIENT_SOURCE_TYPE_MEMOS:
 		type = "memos";
 		break;
 	default:
@@ -435,20 +435,20 @@ static gboolean
 in_main_thread_idle_cb (gpointer unused)
 {
 	g_print ("* run in main thread with mainloop running\n");
-	foreach_configured_source (E_CAL_CLIENT_SOURCE_TYPE_EVENT, check_source_sync);
-	foreach_configured_source (E_CAL_CLIENT_SOURCE_TYPE_TODO, check_source_sync);
-	foreach_configured_source (E_CAL_CLIENT_SOURCE_TYPE_JOURNAL, check_source_sync);
+	foreach_configured_source (E_CAL_CLIENT_SOURCE_TYPE_EVENTS, check_source_sync);
+	foreach_configured_source (E_CAL_CLIENT_SOURCE_TYPE_TASKS, check_source_sync);
+	foreach_configured_source (E_CAL_CLIENT_SOURCE_TYPE_MEMOS, check_source_sync);
 	g_print ("---------------------------------------------------------\n\n");
 
 	g_print ("* run in main thread async\n");
 
-	if (!foreach_async (E_CAL_CLIENT_SOURCE_TYPE_EVENT))
+	if (!foreach_async (E_CAL_CLIENT_SOURCE_TYPE_EVENTS))
 		return FALSE;
 
-	if (!foreach_async (E_CAL_CLIENT_SOURCE_TYPE_TODO))
+	if (!foreach_async (E_CAL_CLIENT_SOURCE_TYPE_TASKS))
 		return FALSE;
 
-	if (!foreach_async (E_CAL_CLIENT_SOURCE_TYPE_JOURNAL))
+	if (!foreach_async (E_CAL_CLIENT_SOURCE_TYPE_MEMOS))
 		return FALSE;
 
 	return FALSE;
@@ -458,9 +458,9 @@ static gpointer
 worker_thread (gpointer unused)
 {
 	g_print ("* run in dedicated thread with mainloop running\n");
-	foreach_configured_source (E_CAL_CLIENT_SOURCE_TYPE_EVENT, check_source_sync);
-	foreach_configured_source (E_CAL_CLIENT_SOURCE_TYPE_TODO, check_source_sync);
-	foreach_configured_source (E_CAL_CLIENT_SOURCE_TYPE_JOURNAL, check_source_sync);
+	foreach_configured_source (E_CAL_CLIENT_SOURCE_TYPE_EVENTS, check_source_sync);
+	foreach_configured_source (E_CAL_CLIENT_SOURCE_TYPE_TASKS, check_source_sync);
+	foreach_configured_source (E_CAL_CLIENT_SOURCE_TYPE_MEMOS, check_source_sync);
 	g_print ("---------------------------------------------------------\n\n");
 
 	g_idle_add (in_main_thread_idle_cb, NULL);
@@ -474,9 +474,9 @@ main (gint argc, gchar **argv)
 	main_initialize ();
 
 	g_print ("* run in main thread without mainloop\n");
-	foreach_configured_source (E_CAL_CLIENT_SOURCE_TYPE_EVENT, check_source_sync);
-	foreach_configured_source (E_CAL_CLIENT_SOURCE_TYPE_TODO, check_source_sync);
-	foreach_configured_source (E_CAL_CLIENT_SOURCE_TYPE_JOURNAL, check_source_sync);
+	foreach_configured_source (E_CAL_CLIENT_SOURCE_TYPE_EVENTS, check_source_sync);
+	foreach_configured_source (E_CAL_CLIENT_SOURCE_TYPE_TASKS, check_source_sync);
+	foreach_configured_source (E_CAL_CLIENT_SOURCE_TYPE_MEMOS, check_source_sync);
 	g_print ("---------------------------------------------------------\n\n");
 
 	start_in_thread_with_main_loop (worker_thread, NULL);
diff --git a/tests/libecal/client/test-client-get-attachment-uris.c b/tests/libecal/client/test-client-get-attachment-uris.c
index f7d9ecc..0d9a5ce 100644
--- a/tests/libecal/client/test-client-get-attachment-uris.c
+++ b/tests/libecal/client/test-client-get-attachment-uris.c
@@ -140,7 +140,7 @@ main (gint argc, gchar **argv)
 
 	main_initialize ();
 
-	cal_client = new_temp_client (E_CAL_CLIENT_SOURCE_TYPE_EVENT, NULL);
+	cal_client = new_temp_client (E_CAL_CLIENT_SOURCE_TYPE_EVENTS, NULL);
 	g_return_val_if_fail (cal_client != NULL, FALSE);
 
 	if (!e_client_open_sync (E_CLIENT (cal_client), FALSE, NULL, &error)) {
diff --git a/tests/libecal/client/test-client-get-free-busy.c b/tests/libecal/client/test-client-get-free-busy.c
index 90466c5..a493c97 100644
--- a/tests/libecal/client/test-client-get-free-busy.c
+++ b/tests/libecal/client/test-client-get-free-busy.c
@@ -25,7 +25,7 @@ test_sync (void)
 	time_t start, end;
 	gulong sig_id;
 
-	cal_client = new_temp_client (E_CAL_CLIENT_SOURCE_TYPE_EVENT, NULL);
+	cal_client = new_temp_client (E_CAL_CLIENT_SOURCE_TYPE_EVENTS, NULL);
 	g_return_val_if_fail (cal_client != NULL, FALSE);
 
 	if (!e_client_open_sync (E_CLIENT (cal_client), FALSE, NULL, &error)) {
@@ -107,7 +107,7 @@ test_async_in_idle (gpointer user_data)
 		return FALSE;
 	}
 
-	cal_client = new_temp_client (E_CAL_CLIENT_SOURCE_TYPE_EVENT, NULL);
+	cal_client = new_temp_client (E_CAL_CLIENT_SOURCE_TYPE_EVENTS, NULL);
 	g_return_val_if_fail (cal_client != NULL, FALSE);
 
 	if (!e_client_open_sync (E_CLIENT (cal_client), FALSE, NULL, &error)) {
diff --git a/tests/libecal/client/test-client-get-object-list.c b/tests/libecal/client/test-client-get-object-list.c
index 15d9832..0566f2e 100644
--- a/tests/libecal/client/test-client-get-object-list.c
+++ b/tests/libecal/client/test-client-get-object-list.c
@@ -155,7 +155,7 @@ main (gint argc, gchar **argv)
 
 	main_initialize ();
 
-	cal_client = new_temp_client (E_CAL_CLIENT_SOURCE_TYPE_EVENT, NULL);
+	cal_client = new_temp_client (E_CAL_CLIENT_SOURCE_TYPE_EVENTS, NULL);
 	g_return_val_if_fail (cal_client != NULL, FALSE);
 
 	if (!e_client_open_sync (E_CLIENT (cal_client), FALSE, NULL, &error)) {
diff --git a/tests/libecal/client/test-client-get-view.c b/tests/libecal/client/test-client-get-view.c
index c0cb076..e85c597 100644
--- a/tests/libecal/client/test-client-get-view.c
+++ b/tests/libecal/client/test-client-get-view.c
@@ -173,7 +173,7 @@ main (gint argc, gchar **argv)
 
 	main_initialize ();
 
-	cal_client = new_temp_client (E_CAL_CLIENT_SOURCE_TYPE_EVENT, NULL);
+	cal_client = new_temp_client (E_CAL_CLIENT_SOURCE_TYPE_EVENTS, NULL);
 	g_return_val_if_fail (cal_client != NULL, FALSE);
 
 	if (!e_client_open_sync (E_CLIENT (cal_client), FALSE, NULL, &error)) {
diff --git a/tests/libecal/client/test-client-modify-object.c b/tests/libecal/client/test-client-modify-object.c
index 75e67e0..f8e9641 100644
--- a/tests/libecal/client/test-client-modify-object.c
+++ b/tests/libecal/client/test-client-modify-object.c
@@ -145,7 +145,7 @@ main (gint argc, gchar **argv)
 
 	main_initialize ();
 
-	cal_client = new_temp_client (E_CAL_CLIENT_SOURCE_TYPE_EVENT, NULL);
+	cal_client = new_temp_client (E_CAL_CLIENT_SOURCE_TYPE_EVENTS, NULL);
 	g_return_val_if_fail (cal_client != NULL, FALSE);
 
 	if (!e_client_open_sync (E_CLIENT (cal_client), FALSE, NULL, &error)) {
diff --git a/tests/libecal/client/test-client-open.c b/tests/libecal/client/test-client-open.c
index 6493ce2..4aa3e21 100644
--- a/tests/libecal/client/test-client-open.c
+++ b/tests/libecal/client/test-client-open.c
@@ -12,7 +12,7 @@ test_sync (void)
 	ECalClient *cal_client;
 	GError *error = NULL;
 
-	cal_client = new_temp_client (E_CAL_CLIENT_SOURCE_TYPE_EVENT, NULL);
+	cal_client = new_temp_client (E_CAL_CLIENT_SOURCE_TYPE_EVENTS, NULL);
 	g_return_val_if_fail (cal_client != NULL, FALSE);
 
 	if (!e_client_open_sync (E_CLIENT (cal_client), FALSE, NULL, &error)) {
@@ -83,7 +83,7 @@ test_sync_in_idle (gpointer user_data)
 		return FALSE;
 	}
 
-	cal_client = new_temp_client (E_CAL_CLIENT_SOURCE_TYPE_EVENT, NULL);
+	cal_client = new_temp_client (E_CAL_CLIENT_SOURCE_TYPE_EVENTS, NULL);
 	g_return_val_if_fail (cal_client != NULL, FALSE);
 
 	e_client_open (E_CLIENT (cal_client), FALSE, NULL, async_open_ready, NULL);
diff --git a/tests/libecal/client/test-client-receive-objects.c b/tests/libecal/client/test-client-receive-objects.c
index a78d490..90858f4 100644
--- a/tests/libecal/client/test-client-receive-objects.c
+++ b/tests/libecal/client/test-client-receive-objects.c
@@ -110,7 +110,7 @@ main (gint argc, gchar **argv)
 
 	main_initialize ();
 
-	cal_client = new_temp_client (E_CAL_CLIENT_SOURCE_TYPE_EVENT, NULL);
+	cal_client = new_temp_client (E_CAL_CLIENT_SOURCE_TYPE_EVENTS, NULL);
 	g_return_val_if_fail (cal_client != NULL, FALSE);
 
 	if (!e_client_open_sync (E_CLIENT (cal_client), FALSE, NULL, &error)) {
diff --git a/tests/libecal/client/test-client-refresh.c b/tests/libecal/client/test-client-refresh.c
index f101411..dc258df 100644
--- a/tests/libecal/client/test-client-refresh.c
+++ b/tests/libecal/client/test-client-refresh.c
@@ -82,7 +82,7 @@ main (gint argc, gchar **argv)
 
 	main_initialize ();
 
-	cal_client = new_temp_client (E_CAL_CLIENT_SOURCE_TYPE_EVENT, NULL);
+	cal_client = new_temp_client (E_CAL_CLIENT_SOURCE_TYPE_EVENTS, NULL);
 	g_return_val_if_fail (cal_client != NULL, FALSE);
 
 	if (!e_client_open_sync (E_CLIENT (cal_client), FALSE, NULL, &error)) {
diff --git a/tests/libecal/client/test-client-remove-object.c b/tests/libecal/client/test-client-remove-object.c
index 6be0beb..6fbd02d 100644
--- a/tests/libecal/client/test-client-remove-object.c
+++ b/tests/libecal/client/test-client-remove-object.c
@@ -124,7 +124,7 @@ main (gint argc, gchar **argv)
 
 	main_initialize ();
 
-	cal_client = new_temp_client (E_CAL_CLIENT_SOURCE_TYPE_EVENT, NULL);
+	cal_client = new_temp_client (E_CAL_CLIENT_SOURCE_TYPE_EVENTS, NULL);
 	g_return_val_if_fail (cal_client != NULL, FALSE);
 
 	if (!e_client_open_sync (E_CLIENT (cal_client), FALSE, NULL, &error)) {
diff --git a/tests/libecal/client/test-client-send-objects.c b/tests/libecal/client/test-client-send-objects.c
index 1484853..f8dfb7a 100644
--- a/tests/libecal/client/test-client-send-objects.c
+++ b/tests/libecal/client/test-client-send-objects.c
@@ -137,7 +137,7 @@ main (gint argc, gchar **argv)
 
 	main_initialize ();
 
-	cal_client = new_temp_client (E_CAL_CLIENT_SOURCE_TYPE_EVENT, NULL);
+	cal_client = new_temp_client (E_CAL_CLIENT_SOURCE_TYPE_EVENTS, NULL);
 	g_return_val_if_fail (cal_client != NULL, FALSE);
 
 	if (!e_client_open_sync (E_CLIENT (cal_client), FALSE, NULL, &error)) {
diff --git a/tests/libecal/client/test-client-stress-factory--fifo.c b/tests/libecal/client/test-client-stress-factory--fifo.c
index 70858ac..5a9db0a 100644
--- a/tests/libecal/client/test-client-stress-factory--fifo.c
+++ b/tests/libecal/client/test-client-stress-factory--fifo.c
@@ -10,7 +10,7 @@
 gint
 main (gint argc, gchar **argv)
 {
-	ECalClientSourceType source_type = E_CAL_CLIENT_SOURCE_TYPE_EVENT;
+	ECalClientSourceType source_type = E_CAL_CLIENT_SOURCE_TYPE_EVENTS;
 	ECalClient *cal_clients[NUM_CLIENTS];
 	GError *error = NULL;
 	gint ii;
diff --git a/tests/libecal/client/test-client-stress-factory--serial.c b/tests/libecal/client/test-client-stress-factory--serial.c
index a3c665e..c178487 100644
--- a/tests/libecal/client/test-client-stress-factory--serial.c
+++ b/tests/libecal/client/test-client-stress-factory--serial.c
@@ -9,7 +9,7 @@
 gint
 main (gint argc, gchar **argv)
 {
-	ECalClientSourceType source_type = E_CAL_CLIENT_SOURCE_TYPE_EVENT;
+	ECalClientSourceType source_type = E_CAL_CLIENT_SOURCE_TYPE_EVENTS;
 	GError *error = NULL;
 	gint ii;
 
diff --git a/tests/libecal/client/test-client-stress-factory--single-cal.c b/tests/libecal/client/test-client-stress-factory--single-cal.c
index 3c43e63..579dffc 100644
--- a/tests/libecal/client/test-client-stress-factory--single-cal.c
+++ b/tests/libecal/client/test-client-stress-factory--single-cal.c
@@ -10,7 +10,7 @@
 gint
 main (gint argc, gchar **argv)
 {
-	ECalClientSourceType source_type = E_CAL_CLIENT_SOURCE_TYPE_EVENT;
+	ECalClientSourceType source_type = E_CAL_CLIENT_SOURCE_TYPE_EVENTS;
 	gchar *uri = NULL;
 	ECalClient *cal_client;
 	GError *error = NULL;
diff --git a/tests/libecal/client/test-client-stress-views.c b/tests/libecal/client/test-client-stress-views.c
index a347bda..f564ea5 100644
--- a/tests/libecal/client/test-client-stress-views.c
+++ b/tests/libecal/client/test-client-stress-views.c
@@ -92,7 +92,7 @@ main (gint argc, gchar **argv)
 
 	main_initialize ();
 
-	cal_client = e_cal_client_new_system (E_CAL_CLIENT_SOURCE_TYPE_EVENT, &error);
+	cal_client = e_cal_client_new_system (E_CAL_CLIENT_SOURCE_TYPE_EVENTS, &error);
 	if (!cal_client) {
 		report_error ("create local calendar", &error);
 		return 1;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]