aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui/contact-editor
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2010-07-09 20:29:51 +0800
committerMilan Crha <mcrha@redhat.com>2010-07-09 20:29:51 +0800
commit03d626856b294bc98919ac244e04e9b8821a681d (patch)
tree62433e158f1791aa6b9222ecbe05d164c4703f6c /addressbook/gui/contact-editor
parent6d4ce8571ff62a3e489999d2feeac1691e06c59a (diff)
downloadgsoc2013-evolution-03d626856b294bc98919ac244e04e9b8821a681d.tar
gsoc2013-evolution-03d626856b294bc98919ac244e04e9b8821a681d.tar.gz
gsoc2013-evolution-03d626856b294bc98919ac244e04e9b8821a681d.tar.bz2
gsoc2013-evolution-03d626856b294bc98919ac244e04e9b8821a681d.tar.lz
gsoc2013-evolution-03d626856b294bc98919ac244e04e9b8821a681d.tar.xz
gsoc2013-evolution-03d626856b294bc98919ac244e04e9b8821a681d.tar.zst
gsoc2013-evolution-03d626856b294bc98919ac244e04e9b8821a681d.zip
Bug #623204 - Be able to report detailed errors from backends
Diffstat (limited to 'addressbook/gui/contact-editor')
-rw-r--r--addressbook/gui/contact-editor/e-contact-editor.c84
-rw-r--r--addressbook/gui/contact-editor/e-contact-quick-add.c16
-rw-r--r--addressbook/gui/contact-editor/eab-editor.c18
-rw-r--r--addressbook/gui/contact-editor/eab-editor.h12
4 files changed, 65 insertions, 65 deletions
diff --git a/addressbook/gui/contact-editor/e-contact-editor.c b/addressbook/gui/contact-editor/e-contact-editor.c
index 2cb975725f..6ce890c999 100644
--- a/addressbook/gui/contact-editor/e-contact-editor.c
+++ b/addressbook/gui/contact-editor/e-contact-editor.c
@@ -197,44 +197,44 @@ static const gint email_default [] = { 0, 1, 2, 2 };
static void
e_contact_editor_contact_added (EABEditor *editor,
- EBookStatus status,
+ const GError *error,
EContact *contact)
{
- if (status == E_BOOK_ERROR_OK)
+ if (!error)
return;
- if (status == E_BOOK_ERROR_CANCELLED)
+ if (g_error_matches (error, E_BOOK_ERROR, E_BOOK_ERROR_CANCELLED))
return;
- eab_error_dialog (_("Error adding contact"), status);
+ eab_error_dialog (_("Error adding contact"), error);
}
static void
e_contact_editor_contact_modified (EABEditor *editor,
- EBookStatus status,
+ const GError *error,
EContact *contact)
{
- if (status == E_BOOK_ERROR_OK)
+ if (!error)
return;
- if (status == E_BOOK_ERROR_CANCELLED)
+ if (g_error_matches (error, E_BOOK_ERROR, E_BOOK_ERROR_CANCELLED))
return;
- eab_error_dialog (_("Error modifying contact"), status);
+ eab_error_dialog (_("Error modifying contact"), error);
}
static void
e_contact_editor_contact_deleted (EABEditor *editor,
- EBookStatus status,
+ const GError *error,
EContact *contact)
{
- if (status == E_BOOK_ERROR_OK)
+ if (!error)
return;
- if (status == E_BOOK_ERROR_CANCELLED)
+ if (g_error_matches (error, E_BOOK_ERROR, E_BOOK_ERROR_CANCELLED))
return;
- eab_error_dialog (_("Error removing contact"), status);
+ eab_error_dialog (_("Error removing contact"), error);
}
static void
@@ -2691,15 +2691,15 @@ init_all (EContactEditor *editor)
}
static void
-new_target_cb (EBook *new_book, EBookStatus status, EContactEditor *editor)
+new_target_cb (EBook *new_book, const GError *error, EContactEditor *editor)
{
editor->load_source_id = 0;
editor->load_book = NULL;
- if (status != E_BOOK_ERROR_OK || new_book == NULL) {
+ if (error || new_book == NULL) {
GtkWidget *source_combo_box;
- eab_load_error_dialog (NULL, e_book_get_source (new_book), status);
+ eab_load_error_dialog (NULL, e_book_get_source (new_book), error);
source_combo_box = e_builder_get_widget (
editor->builder, "source-combo-box-source");
@@ -2747,7 +2747,7 @@ source_changed (ESourceComboBox *source_combo_box, EContactEditor *editor)
editor->load_book = e_book_new (source, NULL);
editor->load_source_id = addressbook_load (editor->load_book,
- (EBookCallback) new_target_cb, editor);
+ (EBookExCallback) new_target_cb, editor);
}
static void
@@ -3025,7 +3025,7 @@ typedef struct {
} EditorCloseStruct;
static void
-contact_moved_cb (EBook *book, EBookStatus status, EditorCloseStruct *ecs)
+contact_moved_cb (EBook *book, const GError *error, EditorCloseStruct *ecs)
{
EContactEditor *ce = ecs->ce;
gboolean should_close = ecs->should_close;
@@ -3035,7 +3035,7 @@ contact_moved_cb (EBook *book, EBookStatus status, EditorCloseStruct *ecs)
e_contact_set (ce->contact, E_CONTACT_UID, ecs->new_id);
- eab_editor_contact_deleted (EAB_EDITOR (ce), status, ce->contact);
+ eab_editor_contact_deleted (EAB_EDITOR (ce), error, ce->contact);
ce->is_new_contact = FALSE;
@@ -3058,16 +3058,16 @@ contact_moved_cb (EBook *book, EBookStatus status, EditorCloseStruct *ecs)
}
static void
-contact_added_cb (EBook *book, EBookStatus status, const gchar *id, EditorCloseStruct *ecs)
+contact_added_cb (EBook *book, const GError *error, const gchar *id, EditorCloseStruct *ecs)
{
EContactEditor *ce = ecs->ce;
gboolean should_close = ecs->should_close;
if (ce->source_book != ce->target_book && e_book_is_writable (ce->source_book) &&
- status == E_BOOK_ERROR_OK && ce->is_new_contact == FALSE) {
+ !error && ce->is_new_contact == FALSE) {
ecs->new_id = g_strdup (id);
- e_book_async_remove_contact (ce->source_book, ce->contact,
- (EBookCallback) contact_moved_cb, ecs);
+ e_book_async_remove_contact_ex (ce->source_book, ce->contact,
+ (EBookExCallback) contact_moved_cb, ecs);
return;
}
@@ -3076,9 +3076,9 @@ contact_added_cb (EBook *book, EBookStatus status, const gchar *id, EditorCloseS
e_contact_set (ce->contact, E_CONTACT_UID, (gchar *) id);
- eab_editor_contact_added (EAB_EDITOR (ce), status, ce->contact);
+ eab_editor_contact_added (EAB_EDITOR (ce), error, ce->contact);
- if (status == E_BOOK_ERROR_OK) {
+ if (!error) {
ce->is_new_contact = FALSE;
if (should_close) {
@@ -3095,7 +3095,7 @@ contact_added_cb (EBook *book, EBookStatus status, const gchar *id, EditorCloseS
}
static void
-contact_modified_cb (EBook *book, EBookStatus status, EditorCloseStruct *ecs)
+contact_modified_cb (EBook *book, const GError *error, EditorCloseStruct *ecs)
{
EContactEditor *ce = ecs->ce;
gboolean should_close = ecs->should_close;
@@ -3103,9 +3103,9 @@ contact_modified_cb (EBook *book, EBookStatus status, EditorCloseStruct *ecs)
gtk_widget_set_sensitive (ce->app, TRUE);
ce->in_async_call = FALSE;
- eab_editor_contact_modified (EAB_EDITOR (ce), status, ce->contact);
+ eab_editor_contact_modified (EAB_EDITOR (ce), error, ce->contact);
- if (status == E_BOOK_ERROR_OK) {
+ if (!error) {
if (should_close) {
eab_editor_close (EAB_EDITOR (ce));
}
@@ -3137,14 +3137,14 @@ real_save_contact (EContactEditor *ce, gboolean should_close)
if (ce->source_book != ce->target_book) {
/* Two-step move; add to target, then remove from source */
eab_merging_book_add_contact (ce->target_book, ce->contact,
- (EBookIdCallback) contact_added_cb, ecs);
+ (EBookIdExCallback) contact_added_cb, ecs);
} else {
if (ce->is_new_contact)
eab_merging_book_add_contact (ce->target_book, ce->contact,
- (EBookIdCallback) contact_added_cb, ecs);
+ (EBookIdExCallback) contact_added_cb, ecs);
else
eab_merging_book_commit_contact (ce->target_book, ce->contact,
- (EBookCallback) contact_modified_cb, ecs);
+ (EBookExCallback) contact_modified_cb, ecs);
}
}
@@ -3641,7 +3641,7 @@ e_contact_editor_dispose (GObject *object)
}
static void
-supported_fields_cb (EBook *book, EBookStatus status,
+supported_fields_cb (EBook *book, const GError *error,
EList *fields, EContactEditor *ce)
{
if (!g_slist_find (eab_editor_get_all_editors (), ce)) {
@@ -3659,7 +3659,7 @@ supported_fields_cb (EBook *book, EBookStatus status,
}
static void
-required_fields_cb (EBook *book, EBookStatus status,
+required_fields_cb (EBook *book, const GError *error,
EList *fields, EContactEditor *ce)
{
@@ -3697,8 +3697,8 @@ e_contact_editor_new (EShell *shell,
NULL);
if (book)
- e_book_async_get_supported_fields (
- book, (EBookEListCallback)supported_fields_cb, editor);
+ e_book_async_get_supported_fields_ex (
+ book, (EBookEListExCallback)supported_fields_cb, editor);
return editor;
}
@@ -3751,10 +3751,10 @@ e_contact_editor_set_property (GObject *object, guint prop_id, const GValue *val
editor->target_editable_id = g_signal_connect (editor->target_book, "writable_status",
G_CALLBACK (writable_changed), editor);
- e_book_async_get_supported_fields (editor->target_book,
- (EBookEListCallback) supported_fields_cb, editor);
- e_book_async_get_required_fields (editor->target_book,
- (EBookEListCallback) required_fields_cb, editor);
+ e_book_async_get_supported_fields_ex (editor->target_book,
+ (EBookEListExCallback) supported_fields_cb, editor);
+ e_book_async_get_required_fields_ex (editor->target_book,
+ (EBookEListExCallback) required_fields_cb, editor);
}
writable = e_book_is_writable (editor->target_book);
@@ -3790,11 +3790,11 @@ e_contact_editor_set_property (GObject *object, guint prop_id, const GValue *val
editor->target_editable_id = g_signal_connect (editor->target_book, "writable_status",
G_CALLBACK (writable_changed), editor);
- e_book_async_get_supported_fields (editor->target_book,
- (EBookEListCallback) supported_fields_cb, editor);
+ e_book_async_get_supported_fields_ex (editor->target_book,
+ (EBookEListExCallback) supported_fields_cb, editor);
- e_book_async_get_required_fields (editor->target_book,
- (EBookEListCallback) required_fields_cb, editor);
+ e_book_async_get_required_fields_ex (editor->target_book,
+ (EBookEListExCallback) required_fields_cb, editor);
if (!editor->is_new_contact)
editor->changed = TRUE;
diff --git a/addressbook/gui/contact-editor/e-contact-quick-add.c b/addressbook/gui/contact-editor/e-contact-quick-add.c
index 0feced4ca0..032f4ac475 100644
--- a/addressbook/gui/contact-editor/e-contact-quick-add.c
+++ b/addressbook/gui/contact-editor/e-contact-quick-add.c
@@ -121,11 +121,11 @@ quick_add_set_vcard (QuickAdd *qa, const gchar *vcard)
}
static void
-merge_cb (EBook *book, EBookStatus status, gpointer closure)
+merge_cb (EBook *book, const GError *error, gpointer closure)
{
QuickAdd *qa = (QuickAdd *) closure;
- if (status == E_BOOK_ERROR_OK) {
+ if (!error) {
if (e_book_is_writable (book))
eab_merging_book_add_contact (book, qa->contact, NULL, NULL);
else
@@ -186,14 +186,14 @@ editor_closed_cb (GtkWidget *w, gpointer closure)
}
static void
-ce_have_contact (EBook *book, EBookStatus status, EContact *contact, gpointer closure)
+ce_have_contact (EBook *book, const GError *error, EContact *contact, gpointer closure)
{
QuickAdd *qa = (QuickAdd *) closure;
- if (status != E_BOOK_ERROR_OK) {
+ if (error) {
if (book)
g_object_unref (book);
- g_warning ("Failed to find contact, status %d.", status);
+ g_warning ("Failed to find contact, status %d (%s).", error->code, error->message);
quick_add_unref (qa);
} else {
EShell *shell;
@@ -235,14 +235,14 @@ ce_have_contact (EBook *book, EBookStatus status, EContact *contact, gpointer cl
}
static void
-ce_have_book (EBook *book, EBookStatus status, gpointer closure)
+ce_have_book (EBook *book, const GError *error, gpointer closure)
{
QuickAdd *qa = (QuickAdd *) closure;
- if (status != E_BOOK_ERROR_OK) {
+ if (error) {
if (book)
g_object_unref (book);
- g_warning ("Couldn't open local address book.");
+ g_warning ("Couldn't open local address book (%s).", error->message);
quick_add_unref (qa);
} else {
eab_merging_book_find_contact (book, qa->contact, ce_have_contact, qa);
diff --git a/addressbook/gui/contact-editor/eab-editor.c b/addressbook/gui/contact-editor/eab-editor.c
index f53ecc30cd..f2765f40a6 100644
--- a/addressbook/gui/contact-editor/eab-editor.c
+++ b/addressbook/gui/contact-editor/eab-editor.c
@@ -181,7 +181,7 @@ eab_editor_class_init (EABEditorClass *class)
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (EABEditorClass, contact_added),
NULL, NULL,
- e_marshal_NONE__INT_OBJECT,
+ e_marshal_NONE__POINTER_OBJECT,
G_TYPE_NONE, 2,
G_TYPE_INT, G_TYPE_OBJECT);
@@ -191,7 +191,7 @@ eab_editor_class_init (EABEditorClass *class)
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (EABEditorClass, contact_modified),
NULL, NULL,
- e_marshal_NONE__INT_OBJECT,
+ e_marshal_NONE__POINTER_OBJECT,
G_TYPE_NONE, 2,
G_TYPE_INT, G_TYPE_OBJECT);
@@ -201,7 +201,7 @@ eab_editor_class_init (EABEditorClass *class)
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (EABEditorClass, contact_deleted),
NULL, NULL,
- e_marshal_NONE__INT_OBJECT,
+ e_marshal_NONE__POINTER_OBJECT,
G_TYPE_NONE, 2,
G_TYPE_INT, G_TYPE_OBJECT);
@@ -385,35 +385,35 @@ eab_editor_prompt_to_save_changes (EABEditor *editor, GtkWindow *window)
void
eab_editor_contact_added (EABEditor *editor,
- EBookStatus status,
+ const GError *error,
EContact *contact)
{
g_return_if_fail (EAB_IS_EDITOR (editor));
g_return_if_fail (E_IS_CONTACT (contact));
- g_signal_emit (editor, signals[CONTACT_ADDED], 0, status, contact);
+ g_signal_emit (editor, signals[CONTACT_ADDED], 0, error, contact);
}
void
eab_editor_contact_modified (EABEditor *editor,
- EBookStatus status,
+ const GError *error,
EContact *contact)
{
g_return_if_fail (EAB_IS_EDITOR (editor));
g_return_if_fail (E_IS_CONTACT (contact));
- g_signal_emit (editor, signals[CONTACT_MODIFIED], 0, status, contact);
+ g_signal_emit (editor, signals[CONTACT_MODIFIED], 0, error, contact);
}
void
eab_editor_contact_deleted (EABEditor *editor,
- EBookStatus status,
+ const GError *error,
EContact *contact)
{
g_return_if_fail (EAB_IS_EDITOR (editor));
g_return_if_fail (E_IS_CONTACT (contact));
- g_signal_emit (editor, signals[CONTACT_DELETED], 0, status, contact);
+ g_signal_emit (editor, signals[CONTACT_DELETED], 0, error, contact);
}
void
diff --git a/addressbook/gui/contact-editor/eab-editor.h b/addressbook/gui/contact-editor/eab-editor.h
index f3803e7341..5623aa5bd4 100644
--- a/addressbook/gui/contact-editor/eab-editor.h
+++ b/addressbook/gui/contact-editor/eab-editor.h
@@ -72,9 +72,9 @@ struct _EABEditorClass {
GtkWindow* (* get_window) (EABEditor *editor);
/* signals */
- void (* contact_added) (EABEditor *editor, EBookStatus status, EContact *contact);
- void (* contact_modified) (EABEditor *editor, EBookStatus status, EContact *contact);
- void (* contact_deleted) (EABEditor *editor, EBookStatus status, EContact *contact);
+ void (* contact_added) (EABEditor *editor, const GError *error, EContact *contact);
+ void (* contact_modified) (EABEditor *editor, const GError *error, EContact *contact);
+ void (* contact_deleted) (EABEditor *editor, const GError *error, EContact *contact);
void (* editor_closed) (EABEditor *editor);
};
@@ -98,13 +98,13 @@ gboolean eab_editor_prompt_to_save_changes
/* these four generate EABEditor signals */
void eab_editor_contact_added (EABEditor *editor,
- EBookStatus status,
+ const GError *error,
EContact *contact);
void eab_editor_contact_modified (EABEditor *editor,
- EBookStatus status,
+ const GError *error,
EContact *contact);
void eab_editor_contact_deleted (EABEditor *editor,
- EBookStatus status,
+ const GError *error,
EContact *contact);
void eab_editor_closed (EABEditor *editor);