aboutsummaryrefslogtreecommitdiffstats
path: root/modules/addressbook/e-book-shell-backend.c
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2011-07-01 12:07:26 +0800
committerMatthew Barnes <mbarnes@redhat.com>2011-08-13 23:27:51 +0800
commitf59681796df8fe0138a1754abbe8ec781bc1535e (patch)
tree0ced0c119ffed095713d7f64732686df9b2d9152 /modules/addressbook/e-book-shell-backend.c
parentbf4a1a13e3295deefc4031a446627ff9b1c95c7a (diff)
downloadgsoc2013-evolution-f59681796df8fe0138a1754abbe8ec781bc1535e.tar
gsoc2013-evolution-f59681796df8fe0138a1754abbe8ec781bc1535e.tar.gz
gsoc2013-evolution-f59681796df8fe0138a1754abbe8ec781bc1535e.tar.bz2
gsoc2013-evolution-f59681796df8fe0138a1754abbe8ec781bc1535e.tar.lz
gsoc2013-evolution-f59681796df8fe0138a1754abbe8ec781bc1535e.tar.xz
gsoc2013-evolution-f59681796df8fe0138a1754abbe8ec781bc1535e.tar.zst
gsoc2013-evolution-f59681796df8fe0138a1754abbe8ec781bc1535e.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.c92
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);
}