diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2011-07-01 12:07:26 +0800 |
---|---|---|
committer | Rodrigo Moya <rodrigo@gnome-db.org> | 2011-09-14 20:08:48 +0800 |
commit | ae9db3ed236b0c734fd12c8dc8c99764626bf0b8 (patch) | |
tree | bd45389467f43a96c36172d8a925dd5df041cf5b /modules/addressbook/e-book-shell-backend.c | |
parent | db969c7f664d0a1d901bedd794b0c7e0762ede33 (diff) | |
download | gsoc2013-evolution-ae9db3ed236b0c734fd12c8dc8c99764626bf0b8.tar.gz gsoc2013-evolution-ae9db3ed236b0c734fd12c8dc8c99764626bf0b8.tar.zst gsoc2013-evolution-ae9db3ed236b0c734fd12c8dc8c99764626bf0b8.zip |
Coding style and whitespace cleanup.
Diffstat (limited to 'modules/addressbook/e-book-shell-backend.c')
-rw-r--r-- | modules/addressbook/e-book-shell-backend.c | 92 |
1 files changed, 55 insertions, 37 deletions
diff --git a/modules/addressbook/e-book-shell-backend.c b/modules/addressbook/e-book-shell-backend.c index d80d9554a0..c52b39b9fa 100644 --- a/modules/addressbook/e-book-shell-backend.c +++ b/modules/addressbook/e-book-shell-backend.c @@ -86,9 +86,13 @@ book_shell_backend_ensure_sources (EShellBackend *shell_backend) priv = E_BOOK_SHELL_BACKEND (shell_backend)->priv; - if (!e_book_client_get_sources (&priv->source_list, &error)) { - g_warning ("Could not get addressbook sources: %s", error ? error->message : "Unknown error"); - g_clear_error (&error); + e_book_client_get_sources (&priv->source_list, &error); + + if (error != NULL) { + g_warning ( + "Could not get addressbook sources: %s", + error->message); + g_error_free (error); return; } @@ -156,68 +160,82 @@ book_shell_backend_init_importers (void) } static void -book_shell_backend_new_contact_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) +book_shell_backend_new_contact_cb (GObject *source_object, + GAsyncResult *result, + gpointer user_data) { + ESource *source = E_SOURCE (source_object); EShell *shell = user_data; EClient *client = NULL; + EContact *contact; + EABEditor *editor; GError *error = NULL; - if (!e_client_utils_open_new_finish (E_SOURCE (source_object), result, &client, &error)) - client = NULL; + e_client_utils_open_new_finish (source, result, &client, &error); /* XXX Handle errors better. */ - if (client == NULL) { - g_debug ("%s: Failed to open book: %s", G_STRFUNC, error ? error->message : "Unknown error"); - g_clear_error (&error); - } else { - EBookClient *book_client = E_BOOK_CLIENT (client); - EContact *contact; - EABEditor *editor; + if (error != NULL) { + g_warn_if_fail (client == NULL); + g_warning ( + "%s: Failed to open book: %s", + G_STRFUNC, error->message); + g_error_free (error); + goto exit; + } - contact = e_contact_new (); + g_return_if_fail (E_IS_CLIENT (client)); - editor = e_contact_editor_new ( - shell, book_client, contact, TRUE, TRUE); + contact = e_contact_new (); - eab_editor_show (editor); + editor = e_contact_editor_new ( + shell, E_BOOK_CLIENT (client), contact, TRUE, TRUE); - g_object_unref (contact); - g_object_unref (book_client); - } + eab_editor_show (editor); + + g_object_unref (contact); + g_object_unref (client); +exit: g_object_unref (shell); } static void -book_shell_backend_new_contact_list_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) +book_shell_backend_new_contact_list_cb (GObject *source_object, + GAsyncResult *result, + gpointer user_data) { + ESource *source = E_SOURCE (source_object); EShell *shell = user_data; EClient *client = NULL; + EContact *contact; + EABEditor *editor; GError *error = NULL; - if (!e_client_utils_open_new_finish (E_SOURCE (source_object), result, &client, &error)) - client = NULL; + e_client_utils_open_new_finish (source, result, &client, &error); /* XXX Handle errors better. */ - if (client == NULL) { - g_debug ("%s: Failed to open book: %s", G_STRFUNC, error ? error->message : "Unknown error"); - g_clear_error (&error); - } else { - EBookClient *book_client = E_BOOK_CLIENT (client); - EContact *contact; - EABEditor *editor; + if (error != NULL) { + g_warn_if_fail (client == NULL); + g_warning ( + "%s: Failed to open book: %s", + G_STRFUNC, error->message); + g_error_free (error); + goto exit; + } - contact = e_contact_new (); + g_return_if_fail (E_IS_CLIENT (client)); - editor = e_contact_list_editor_new ( - shell, book_client, contact, TRUE, TRUE); + contact = e_contact_new (); - eab_editor_show (editor); + editor = e_contact_list_editor_new ( + shell, E_BOOK_CLIENT (client), contact, TRUE, TRUE); - g_object_unref (contact); - g_object_unref (book_client); - } + eab_editor_show (editor); + + g_object_unref (contact); + g_object_unref (client); +exit: g_object_unref (shell); } |