[evolution-data-server] Bug #655499 - Don't crash when getting contacts before backend is opened
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] Bug #655499 - Don't crash when getting contacts before backend is opened
- Date: Mon, 1 Aug 2011 13:59:51 +0000 (UTC)
commit 68646a998a7b127ac3c683af0995f093753c027c
Author: Milan Crha <mcrha redhat com>
Date: Mon Aug 1 15:58:35 2011 +0200
Bug #655499 - Don't crash when getting contacts before backend is opened
addressbook/backends/file/e-book-backend-file.c | 56 ++++++++++++++++++++++-
addressbook/libebook/e-book-client.c | 1 +
addressbook/libedata-book/e-book-backend.c | 17 +++++++-
addressbook/libedata-book/e-data-book-types.h | 3 +-
addressbook/libedata-book/e-data-book.c | 6 ++-
calendar/libecal/e-cal-client.c | 1 +
calendar/libedata-cal/e-cal-backend.c | 49 +++++++++++++++-----
calendar/libedata-cal/e-data-cal-types.h | 3 +-
calendar/libedata-cal/e-data-cal.c | 6 ++-
libedataserver/e-client.c | 2 +
libedataserver/e-client.h | 3 +-
11 files changed, 126 insertions(+), 21 deletions(-)
---
diff --git a/addressbook/backends/file/e-book-backend-file.c b/addressbook/backends/file/e-book-backend-file.c
index 596c829..643b982 100644
--- a/addressbook/backends/file/e-book-backend-file.c
+++ b/addressbook/backends/file/e-book-backend-file.c
@@ -66,6 +66,7 @@
#define EDB_ERROR(_code) e_data_book_create_error (E_DATA_BOOK_STATUS_ ## _code, NULL)
#define EDB_ERROR_EX(_code, _msg) e_data_book_create_error (E_DATA_BOOK_STATUS_ ## _code, _msg)
+#define EDB_NOT_OPENED_ERROR EDB_ERROR(NOT_OPENED)
G_DEFINE_TYPE (EBookBackendFile, e_book_backend_file, E_TYPE_BOOK_BACKEND_SYNC)
@@ -137,6 +138,11 @@ build_summary (EBookBackendFilePrivate *bfpriv)
gint db_error;
DBT id_dbt, vcard_dbt;
+ if (!db) {
+ g_warning (G_STRLOC ": Not openend yet");
+ return FALSE;
+ }
+
db_error = db->cursor (db, NULL, &dbc, 0);
if (db_error != 0) {
@@ -209,6 +215,11 @@ do_create (EBookBackendFile *bf,
g_assert (vcard_req);
g_assert (contact);
+ if (!db) {
+ g_propagate_error (perror, EDB_NOT_OPENED_ERROR);
+ return FALSE;
+ }
+
id = e_book_backend_file_create_unique_id ();
string_to_dbt (id, &id_dbt);
@@ -275,6 +286,11 @@ e_book_backend_file_remove_contacts (EBookBackendSync *backend,
const GSList *l;
GSList *removed_cards = NULL;
+ if (!db) {
+ g_propagate_error (perror, EDB_NOT_OPENED_ERROR);
+ return;
+ }
+
for (l = id_list; l; l = l->next) {
id = l->data;
@@ -320,6 +336,11 @@ e_book_backend_file_modify_contact (EBookBackendSync *backend,
const gchar *id, *lookup_id;
gchar *vcard_with_rev;
+ if (!db) {
+ g_propagate_error (perror, EDB_NOT_OPENED_ERROR);
+ return;
+ }
+
*contact = e_contact_new_from_vcard (vcard);
id = e_contact_get_const (*contact, E_CONTACT_UID);
@@ -380,6 +401,11 @@ e_book_backend_file_get_contact (EBookBackendSync *backend,
bf = E_BOOK_BACKEND_FILE (backend);
db = bf->priv->file_db;
+ if (!db) {
+ g_propagate_error (perror, EDB_NOT_OPENED_ERROR);
+ return;
+ }
+
string_to_dbt (id, &id_dbt);
memset (&vcard_dbt, 0, sizeof (vcard_dbt));
vcard_dbt.flags = DB_DBT_MALLOC;
@@ -415,6 +441,12 @@ e_book_backend_file_get_contact_list (EBookBackendSync *backend,
GSList *contact_list = NULL;
d(printf ("e_book_backend_file_get_contact_list (%s)\n", search));
+
+ if (!db) {
+ g_propagate_error (perror, EDB_NOT_OPENED_ERROR);
+ return;
+ }
+
if (e_book_backend_summary_is_summary_query (bf->priv->summary, search)) {
/* do a summary query */
@@ -522,6 +554,12 @@ e_book_backend_file_get_contact_list_uids (EBookBackendSync *backend,
GSList *uids = NULL;
d(printf ("e_book_backend_file_get_contact_list (%s)\n", search));
+
+ if (!db) {
+ g_propagate_error (perror, EDB_NOT_OPENED_ERROR);
+ return;
+ }
+
if (e_book_backend_summary_is_summary_query (bf->priv->summary, search)) {
/* do a summary query */
GPtrArray *ids = e_book_backend_summary_search (bf->priv->summary, search);
@@ -662,6 +700,12 @@ book_view_thread (gpointer data)
e_data_book_view_ref (book_view);
db = bf->priv->file_db;
+ if (!db) {
+ e_data_book_view_notify_complete (book_view, EDB_NOT_OPENED_ERROR);
+ e_data_book_view_unref (book_view);
+ return NULL;
+ }
+
query = e_data_book_view_get_card_query (book_view);
if ( !strcmp (query, "(contains \"x-evolution-any-field\" \"\")")) {
@@ -751,8 +795,6 @@ done:
if (e_flag_is_set (closure->running))
e_data_book_view_notify_complete (book_view, NULL /* Success */);
- /* unref the */
- printf("book_view file uref \n");
e_data_book_view_unref (book_view);
d(printf ("finished population of book view\n"));
@@ -865,6 +907,11 @@ e_book_backend_file_upgrade_db (EBookBackendFile *bf, gchar *old_version)
gint db_error;
DBT version_name_dbt, version_dbt;
+ if (!db) {
+ g_warning (G_STRLOC ": No DB opened");
+ return FALSE;
+ }
+
if (strcmp (old_version, "0.0")
&& strcmp (old_version, "0.1")) {
g_warning ("unsupported version '%s' found in PAS backend file\n",
@@ -953,6 +1000,11 @@ e_book_backend_file_maybe_upgrade_db (EBookBackendFile *bf)
gchar *version;
gboolean ret_val = TRUE;
+ if (!db) {
+ g_warning (G_STRLOC ": No DB opened");
+ return FALSE;
+ }
+
string_to_dbt (E_BOOK_BACKEND_FILE_VERSION_NAME, &version_name_dbt);
memset (&version_dbt, 0, sizeof (version_dbt));
version_dbt.flags = DB_DBT_MALLOC;
diff --git a/addressbook/libebook/e-book-client.c b/addressbook/libebook/e-book-client.c
index 4ca329d..4899a58 100644
--- a/addressbook/libebook/e-book-client.c
+++ b/addressbook/libebook/e-book-client.c
@@ -146,6 +146,7 @@ unwrap_dbus_error (GError *error, GError **client_error)
{ err ("SearchTimeLimitExceeded", E_CLIENT_ERROR_SEARCH_TIME_LIMIT_EXCEEDED) },
{ err ("InvalidQuery", E_CLIENT_ERROR_INVALID_QUERY) },
{ err ("QueryRefused", E_CLIENT_ERROR_QUERY_REFUSED) },
+ { err ("NotOpened", E_CLIENT_ERROR_NOT_OPENED) },
{ err ("UnsupportedField", E_CLIENT_ERROR_OTHER_ERROR) },
{ err ("InvalidServerVersion", E_CLIENT_ERROR_OTHER_ERROR) },
{ err ("OtherError", E_CLIENT_ERROR_OTHER_ERROR) }
diff --git a/addressbook/libedata-book/e-book-backend.c b/addressbook/libedata-book/e-book-backend.c
index 358f489..49d7359 100644
--- a/addressbook/libedata-book/e-book-backend.c
+++ b/addressbook/libedata-book/e-book-backend.c
@@ -16,7 +16,8 @@
#include "e-data-book.h"
#include "e-book-backend.h"
-#define EDB_OPENING_ERROR e_data_book_create_error (E_DATA_BOOK_STATUS_BUSY, _("Cannot process, book backend is opening"))
+#define EDB_OPENING_ERROR e_data_book_create_error (E_DATA_BOOK_STATUS_BUSY, _("Cannot process, book backend is opening"))
+#define EDB_NOT_OPENED_ERROR e_data_book_create_error (E_DATA_BOOK_STATUS_NOT_OPENED, NULL)
struct _EBookBackendPrivate {
GMutex *clients_mutex;
@@ -436,6 +437,8 @@ e_book_backend_refresh (EBookBackend *backend, EDataBook *book, guint32 opid, GC
e_data_book_respond_refresh (book, opid, EDB_OPENING_ERROR);
else if (!E_BOOK_BACKEND_GET_CLASS (backend)->refresh)
e_data_book_respond_refresh (book, opid, e_data_book_create_error (E_DATA_BOOK_STATUS_NOT_SUPPORTED, NULL));
+ else if (!e_book_backend_is_opened (backend))
+ e_data_book_respond_refresh (book, opid, EDB_NOT_OPENED_ERROR);
else
(* E_BOOK_BACKEND_GET_CLASS (backend)->refresh) (backend, book, opid, cancellable);
}
@@ -466,6 +469,8 @@ e_book_backend_create_contact (EBookBackend *backend,
if (e_book_backend_is_opening (backend))
e_data_book_respond_create (book, opid, EDB_OPENING_ERROR, NULL);
+ else if (!e_book_backend_is_opened (backend))
+ e_data_book_respond_create (book, opid, EDB_NOT_OPENED_ERROR, NULL);
else
(* E_BOOK_BACKEND_GET_CLASS (backend)->create_contact) (backend, book, opid, cancellable, vcard);
}
@@ -496,6 +501,8 @@ e_book_backend_remove_contacts (EBookBackend *backend,
if (e_book_backend_is_opening (backend))
e_data_book_respond_remove_contacts (book, opid, EDB_OPENING_ERROR, NULL);
+ else if (!e_book_backend_is_opened (backend))
+ e_data_book_respond_remove_contacts (book, opid, EDB_NOT_OPENED_ERROR, NULL);
else
(* E_BOOK_BACKEND_GET_CLASS (backend)->remove_contacts) (backend, book, opid, cancellable, id_list);
}
@@ -526,6 +533,8 @@ e_book_backend_modify_contact (EBookBackend *backend,
if (e_book_backend_is_opening (backend))
e_data_book_respond_modify (book, opid, EDB_OPENING_ERROR, NULL);
+ else if (!e_book_backend_is_opened (backend))
+ e_data_book_respond_modify (book, opid, EDB_NOT_OPENED_ERROR, NULL);
else
(* E_BOOK_BACKEND_GET_CLASS (backend)->modify_contact) (backend, book, opid, cancellable, vcard);
}
@@ -556,6 +565,8 @@ e_book_backend_get_contact (EBookBackend *backend,
if (e_book_backend_is_opening (backend))
e_data_book_respond_get_contact (book, opid, EDB_OPENING_ERROR, NULL);
+ else if (!e_book_backend_is_opened (backend))
+ e_data_book_respond_get_contact (book, opid, EDB_NOT_OPENED_ERROR, NULL);
else
(* E_BOOK_BACKEND_GET_CLASS (backend)->get_contact) (backend, book, opid, cancellable, id);
}
@@ -586,6 +597,8 @@ e_book_backend_get_contact_list (EBookBackend *backend,
if (e_book_backend_is_opening (backend))
e_data_book_respond_get_contact_list (book, opid, EDB_OPENING_ERROR, NULL);
+ else if (!e_book_backend_is_opened (backend))
+ e_data_book_respond_get_contact_list (book, opid, EDB_NOT_OPENED_ERROR, NULL);
else
(* E_BOOK_BACKEND_GET_CLASS (backend)->get_contact_list) (backend, book, opid, cancellable, query);
}
@@ -618,6 +631,8 @@ e_book_backend_get_contact_list_uids (EBookBackend *backend,
if (e_book_backend_is_opening (backend))
e_data_book_respond_get_contact_list_uids (book, opid, EDB_OPENING_ERROR, NULL);
+ else if (!e_book_backend_is_opened (backend))
+ e_data_book_respond_get_contact_list_uids (book, opid, EDB_NOT_OPENED_ERROR, NULL);
else
(* E_BOOK_BACKEND_GET_CLASS (backend)->get_contact_list_uids) (backend, book, opid, cancellable, query);
}
diff --git a/addressbook/libedata-book/e-data-book-types.h b/addressbook/libedata-book/e-data-book-types.h
index 6a8a0dd..42a1522 100644
--- a/addressbook/libedata-book/e-data-book-types.h
+++ b/addressbook/libedata-book/e-data-book-types.h
@@ -70,7 +70,8 @@ typedef enum {
E_DATA_BOOK_STATUS_INVALID_SERVER_VERSION,
E_DATA_BOOK_STATUS_NO_SPACE,
E_DATA_BOOK_STATUS_INVALID_ARG,
- E_DATA_BOOK_STATUS_NOT_SUPPORTED
+ E_DATA_BOOK_STATUS_NOT_SUPPORTED,
+ E_DATA_BOOK_STATUS_NOT_OPENED
} EDataBookStatus;
G_END_DECLS
diff --git a/addressbook/libedata-book/e-data-book.c b/addressbook/libedata-book/e-data-book.c
index 6e75ae7..26c10ab 100644
--- a/addressbook/libedata-book/e-data-book.c
+++ b/addressbook/libedata-book/e-data-book.c
@@ -320,7 +320,8 @@ e_data_book_status_to_string (EDataBookStatus status)
{ E_DATA_BOOK_STATUS_NO_SPACE, N_("No space") },
{ E_DATA_BOOK_STATUS_INVALID_ARG, N_("Invalid argument") },
/* Translators: The string for NOT_SUPPORTED error */
- { E_DATA_BOOK_STATUS_NOT_SUPPORTED, N_("Not supported") }
+ { E_DATA_BOOK_STATUS_NOT_SUPPORTED, N_("Not supported") },
+ { E_DATA_BOOK_STATUS_NOT_OPENED, N_("Backend is not opened yet") }
};
for (i = 0; i < G_N_ELEMENTS (statuses); i++) {
@@ -361,7 +362,8 @@ e_data_book_error_quark (void)
{ E_DATA_BOOK_STATUS_INVALID_SERVER_VERSION, ERR_PREFIX "InvalidServerVersion" },
{ E_DATA_BOOK_STATUS_NO_SPACE, ERR_PREFIX "NoSpace" },
{ E_DATA_BOOK_STATUS_INVALID_ARG, ERR_PREFIX "InvalidArg" },
- { E_DATA_BOOK_STATUS_NOT_SUPPORTED, ERR_PREFIX "NotSupported" }
+ { E_DATA_BOOK_STATUS_NOT_SUPPORTED, ERR_PREFIX "NotSupported" },
+ { E_DATA_BOOK_STATUS_NOT_OPENED, ERR_PREFIX "NotOpened" }
};
#undef ERR_PREFIX
diff --git a/calendar/libecal/e-cal-client.c b/calendar/libecal/e-cal-client.c
index 71e22c9..64be096 100644
--- a/calendar/libecal/e-cal-client.c
+++ b/calendar/libecal/e-cal-client.c
@@ -191,6 +191,7 @@ unwrap_dbus_error (GError *error, GError **client_error)
{ err ("SearchTimeLimitExceeded", E_CLIENT_ERROR_SEARCH_TIME_LIMIT_EXCEEDED) },
{ err ("InvalidQuery", E_CLIENT_ERROR_INVALID_QUERY) },
{ err ("QueryRefused", E_CLIENT_ERROR_QUERY_REFUSED) },
+ { err ("NotOpened", E_CLIENT_ERROR_NOT_OPENED) },
{ err ("UnsupportedField", E_CLIENT_ERROR_OTHER_ERROR) },
{ err ("UnsupportedMethod", E_CLIENT_ERROR_OTHER_ERROR) },
{ err ("InvalidServerVersion", E_CLIENT_ERROR_OTHER_ERROR) },
diff --git a/calendar/libedata-cal/e-cal-backend.c b/calendar/libedata-cal/e-cal-backend.c
index f2174f8..277a6f1 100644
--- a/calendar/libedata-cal/e-cal-backend.c
+++ b/calendar/libedata-cal/e-cal-backend.c
@@ -30,8 +30,9 @@
#include "e-cal-backend.h"
#include "e-cal-backend-cache.h"
-#define EDC_ERROR(_code) e_data_cal_create_error (_code, NULL)
-#define EDC_OPENING_ERROR e_data_cal_create_error (Busy, _("Cannot process, calendar backend is opening"))
+#define EDC_ERROR(_code) e_data_cal_create_error (_code, NULL)
+#define EDC_OPENING_ERROR e_data_cal_create_error (Busy, _("Cannot process, calendar backend is opening"))
+#define EDC_NOT_OPENED_ERROR e_data_cal_create_error (NotOpened, NULL)
/* Private part of the CalBackend structure */
struct _ECalBackendPrivate {
@@ -1005,6 +1006,8 @@ e_cal_backend_refresh (ECalBackend *backend, EDataCal *cal, guint32 opid, GCance
e_data_cal_respond_refresh (cal, opid, EDC_OPENING_ERROR);
else if (!E_CAL_BACKEND_GET_CLASS (backend)->refresh)
e_data_cal_respond_refresh (cal, opid, EDC_ERROR (UnsupportedMethod));
+ else if (!e_cal_backend_is_opened (backend))
+ e_data_cal_respond_refresh (cal, opid, EDC_NOT_OPENED_ERROR);
else
(* E_CAL_BACKEND_GET_CLASS (backend)->refresh) (backend, cal, opid, cancellable);
}
@@ -1032,6 +1035,8 @@ e_cal_backend_get_object (ECalBackend *backend, EDataCal *cal, guint32 opid, GCa
if (e_cal_backend_is_opening (backend))
e_data_cal_respond_get_object (cal, opid, EDC_OPENING_ERROR, NULL);
+ else if (!e_cal_backend_is_opened (backend))
+ e_data_cal_respond_get_object (cal, opid, EDC_NOT_OPENED_ERROR, NULL);
else
(* E_CAL_BACKEND_GET_CLASS (backend)->get_object) (backend, cal, opid, cancellable, uid, rid);
}
@@ -1056,6 +1061,8 @@ e_cal_backend_get_object_list (ECalBackend *backend, EDataCal *cal, guint32 opid
if (e_cal_backend_is_opening (backend))
e_data_cal_respond_get_object_list (cal, opid, EDC_OPENING_ERROR, NULL);
+ else if (!e_cal_backend_is_opened (backend))
+ e_data_cal_respond_get_object_list (cal, opid, EDC_NOT_OPENED_ERROR, NULL);
else
(* E_CAL_BACKEND_GET_CLASS (backend)->get_object_list) (backend, cal, opid, cancellable, sexp);
}
@@ -1085,6 +1092,8 @@ e_cal_backend_get_free_busy (ECalBackend *backend, EDataCal *cal, guint32 opid,
if (e_cal_backend_is_opening (backend))
e_data_cal_respond_get_free_busy (cal, opid, EDC_OPENING_ERROR);
+ else if (!e_cal_backend_is_opened (backend))
+ e_data_cal_respond_get_free_busy (cal, opid, EDC_NOT_OPENED_ERROR);
else
(* E_CAL_BACKEND_GET_CLASS (backend)->get_free_busy) (backend, cal, opid, cancellable, users, start, end);
}
@@ -1109,10 +1118,12 @@ e_cal_backend_create_object (ECalBackend *backend, EDataCal *cal, guint32 opid,
if (e_cal_backend_is_opening (backend))
e_data_cal_respond_create_object (cal, opid, EDC_OPENING_ERROR, NULL, NULL);
- else if (E_CAL_BACKEND_GET_CLASS (backend)->create_object)
- (* E_CAL_BACKEND_GET_CLASS (backend)->create_object) (backend, cal, opid, cancellable, calobj);
- else
+ else if (!E_CAL_BACKEND_GET_CLASS (backend)->create_object)
e_data_cal_respond_create_object (cal, opid, EDC_ERROR (UnsupportedMethod), NULL, NULL);
+ else if (!e_cal_backend_is_opened (backend))
+ e_data_cal_respond_create_object (cal, opid, EDC_NOT_OPENED_ERROR, NULL, NULL);
+ else
+ (* E_CAL_BACKEND_GET_CLASS (backend)->create_object) (backend, cal, opid, cancellable, calobj);
}
/**
@@ -1136,10 +1147,12 @@ e_cal_backend_modify_object (ECalBackend *backend, EDataCal *cal, guint32 opid,
if (e_cal_backend_is_opening (backend))
e_data_cal_respond_modify_object (cal, opid, EDC_OPENING_ERROR, NULL, NULL);
- else if (E_CAL_BACKEND_GET_CLASS (backend)->modify_object)
- (* E_CAL_BACKEND_GET_CLASS (backend)->modify_object) (backend, cal, opid, cancellable, calobj, mod);
- else
+ else if (!E_CAL_BACKEND_GET_CLASS (backend)->modify_object)
e_data_cal_respond_modify_object (cal, opid, EDC_ERROR (UnsupportedMethod), NULL, NULL);
+ else if (!e_cal_backend_is_opened (backend))
+ e_data_cal_respond_modify_object (cal, opid, EDC_NOT_OPENED_ERROR, NULL, NULL);
+ else
+ (* E_CAL_BACKEND_GET_CLASS (backend)->modify_object) (backend, cal, opid, cancellable, calobj, mod);
}
/**
@@ -1166,6 +1179,8 @@ e_cal_backend_remove_object (ECalBackend *backend, EDataCal *cal, guint32 opid,
if (e_cal_backend_is_opening (backend))
e_data_cal_respond_remove_object (cal, opid, EDC_OPENING_ERROR, NULL, NULL, NULL);
+ else if (!e_cal_backend_is_opened (backend))
+ e_data_cal_respond_remove_object (cal, opid, EDC_NOT_OPENED_ERROR, NULL, NULL, NULL);
else
(* E_CAL_BACKEND_GET_CLASS (backend)->remove_object) (backend, cal, opid, cancellable, uid, rid, mod);
}
@@ -1191,6 +1206,8 @@ e_cal_backend_receive_objects (ECalBackend *backend, EDataCal *cal, guint32 opid
if (e_cal_backend_is_opening (backend))
e_data_cal_respond_receive_objects (cal, opid, EDC_OPENING_ERROR);
+ else if (!e_cal_backend_is_opened (backend))
+ e_data_cal_respond_receive_objects (cal, opid, EDC_NOT_OPENED_ERROR);
else
(* E_CAL_BACKEND_GET_CLASS (backend)->receive_objects) (backend, cal, opid, cancellable, calobj);
}
@@ -1216,6 +1233,8 @@ e_cal_backend_send_objects (ECalBackend *backend, EDataCal *cal, guint32 opid, G
if (e_cal_backend_is_opening (backend))
e_data_cal_respond_send_objects (cal, opid, EDC_OPENING_ERROR, NULL, NULL);
+ else if (!e_cal_backend_is_opened (backend))
+ e_data_cal_respond_send_objects (cal, opid, EDC_NOT_OPENED_ERROR, NULL, NULL);
else
(* E_CAL_BACKEND_GET_CLASS (backend)->send_objects) (backend, cal, opid, cancellable, calobj);
}
@@ -1243,6 +1262,8 @@ e_cal_backend_get_attachment_uris (ECalBackend *backend, EDataCal *cal, guint32
if (e_cal_backend_is_opening (backend))
e_data_cal_respond_get_attachment_uris (cal, opid, EDC_OPENING_ERROR, NULL);
+ else if (!e_cal_backend_is_opened (backend))
+ e_data_cal_respond_get_attachment_uris (cal, opid, EDC_NOT_OPENED_ERROR, NULL);
else
(* E_CAL_BACKEND_GET_CLASS (backend)->get_attachment_uris) (backend, cal, opid, cancellable, uid, rid);
}
@@ -1271,10 +1292,12 @@ e_cal_backend_discard_alarm (ECalBackend *backend, EDataCal *cal, guint32 opid,
if (e_cal_backend_is_opening (backend))
e_data_cal_respond_discard_alarm (cal, opid, EDC_OPENING_ERROR);
- else if (E_CAL_BACKEND_GET_CLASS (backend)->discard_alarm)
- (* E_CAL_BACKEND_GET_CLASS (backend)->discard_alarm) (backend, cal, opid, cancellable, uid, rid, auid);
- else
+ else if (!E_CAL_BACKEND_GET_CLASS (backend)->discard_alarm)
e_data_cal_respond_discard_alarm (cal, opid, e_data_cal_create_error (NotSupported, NULL));
+ else if (!e_cal_backend_is_opened (backend))
+ e_data_cal_respond_discard_alarm (cal, opid, EDC_NOT_OPENED_ERROR);
+ else
+ (* E_CAL_BACKEND_GET_CLASS (backend)->discard_alarm) (backend, cal, opid, cancellable, uid, rid, auid);
}
/**
@@ -1300,6 +1323,8 @@ e_cal_backend_get_timezone (ECalBackend *backend, EDataCal *cal, guint32 opid, G
if (e_cal_backend_is_opening (backend))
e_data_cal_respond_get_timezone (cal, opid, EDC_OPENING_ERROR, NULL);
+ else if (!e_cal_backend_is_opened (backend))
+ e_data_cal_respond_get_timezone (cal, opid, EDC_NOT_OPENED_ERROR, NULL);
else
(* E_CAL_BACKEND_GET_CLASS (backend)->get_timezone) (backend, cal, opid, cancellable, tzid);
}
@@ -1324,6 +1349,8 @@ e_cal_backend_add_timezone (ECalBackend *backend, EDataCal *cal, guint32 opid, G
if (e_cal_backend_is_opening (backend))
e_data_cal_respond_add_timezone (cal, opid, EDC_OPENING_ERROR);
+ else if (!e_cal_backend_is_opened (backend))
+ e_data_cal_respond_add_timezone (cal, opid, EDC_NOT_OPENED_ERROR);
else
(* E_CAL_BACKEND_GET_CLASS (backend)->add_timezone) (backend, cal, opid, cancellable, tzobject);
}
diff --git a/calendar/libedata-cal/e-data-cal-types.h b/calendar/libedata-cal/e-data-cal-types.h
index d4f75f4..7792b66 100644
--- a/calendar/libedata-cal/e-data-cal-types.h
+++ b/calendar/libedata-cal/e-data-cal-types.h
@@ -36,7 +36,8 @@ typedef enum {
OtherError,
InvalidServerVersion,
InvalidArg,
- NotSupported
+ NotSupported,
+ NotOpened
} EDataCalCallStatus;
typedef enum {
diff --git a/calendar/libedata-cal/e-data-cal.c b/calendar/libedata-cal/e-data-cal.c
index 5e6ac15..ad7a278 100644
--- a/calendar/libedata-cal/e-data-cal.c
+++ b/calendar/libedata-cal/e-data-cal.c
@@ -385,7 +385,8 @@ e_data_cal_error_quark (void)
{ OtherError, ERR_PREFIX "OtherError" },
{ InvalidServerVersion, ERR_PREFIX "InvalidServerVersion" },
{ InvalidArg, ERR_PREFIX "InvalidArg" },
- { NotSupported, ERR_PREFIX "NotSupported" }
+ { NotSupported, ERR_PREFIX "NotSupported" },
+ { NotOpened, ERR_PREFIX "NotOpened" }
};
#undef ERR_PREFIX
@@ -436,7 +437,8 @@ e_data_cal_status_to_string (EDataCalCallStatus status)
{ InvalidServerVersion, N_("Invalid server version") },
{ InvalidArg, N_("Invalid argument") },
/* Translators: The string for NOT_SUPPORTED error */
- { NotSupported, N_("Not supported") }
+ { NotSupported, N_("Not supported") },
+ { NotOpened, N_("Backend is not opened yet") }
};
for (i = 0; i < G_N_ELEMENTS (statuses); i++) {
diff --git a/libedataserver/e-client.c b/libedataserver/e-client.c
index 6c878c2..7a5ec29 100644
--- a/libedataserver/e-client.c
+++ b/libedataserver/e-client.c
@@ -142,6 +142,8 @@ e_client_error_to_string (EClientError code)
return C_("ClientError", "D-Bus error");
case E_CLIENT_ERROR_OTHER_ERROR:
return C_("ClientError", "Other error");
+ case E_CLIENT_ERROR_NOT_OPENED:
+ return C_("ClientError", "Backend is not opened yet");
}
return C_("ClientError", "Unknown error");
diff --git a/libedataserver/e-client.h b/libedataserver/e-client.h
index 1615e49..de78aa3 100644
--- a/libedataserver/e-client.h
+++ b/libedataserver/e-client.h
@@ -66,7 +66,8 @@ typedef enum {
E_CLIENT_ERROR_INVALID_QUERY,
E_CLIENT_ERROR_QUERY_REFUSED,
E_CLIENT_ERROR_DBUS_ERROR,
- E_CLIENT_ERROR_OTHER_ERROR
+ E_CLIENT_ERROR_OTHER_ERROR,
+ E_CLIENT_ERROR_NOT_OPENED
} EClientError;
const gchar * e_client_error_to_string (EClientError code);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]