diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2013-09-08 00:31:19 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2013-09-08 07:08:54 +0800 |
commit | 3da4948c0fc1f2c21b163f0ec456b2d99c881258 (patch) | |
tree | 479d6153d31e03cb7a65990683b5271402e5ec29 /addressbook/gui/contact-editor | |
parent | 2e5031cb4538b4819e5fce5d717668c3445df80a (diff) | |
download | gsoc2013-evolution-3da4948c0fc1f2c21b163f0ec456b2d99c881258.tar gsoc2013-evolution-3da4948c0fc1f2c21b163f0ec456b2d99c881258.tar.gz gsoc2013-evolution-3da4948c0fc1f2c21b163f0ec456b2d99c881258.tar.bz2 gsoc2013-evolution-3da4948c0fc1f2c21b163f0ec456b2d99c881258.tar.lz gsoc2013-evolution-3da4948c0fc1f2c21b163f0ec456b2d99c881258.tar.xz gsoc2013-evolution-3da4948c0fc1f2c21b163f0ec456b2d99c881258.tar.zst gsoc2013-evolution-3da4948c0fc1f2c21b163f0ec456b2d99c881258.zip |
Miscellaneous cleanups.
Diffstat (limited to 'addressbook/gui/contact-editor')
-rw-r--r-- | addressbook/gui/contact-editor/e-contact-editor.c | 68 | ||||
-rw-r--r-- | addressbook/gui/contact-editor/e-contact-quick-add.c | 8 |
2 files changed, 48 insertions, 28 deletions
diff --git a/addressbook/gui/contact-editor/e-contact-editor.c b/addressbook/gui/contact-editor/e-contact-editor.c index 8e126d0260..bf6cf9e47a 100644 --- a/addressbook/gui/contact-editor/e-contact-editor.c +++ b/addressbook/gui/contact-editor/e-contact-editor.c @@ -217,14 +217,19 @@ e_contact_editor_contact_added (EABEditor *editor, const GError *error, EContact *contact) { - if (!error) + GtkWindow *window; + const gchar *message; + + if (error == NULL) return; - if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) || - g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) + if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) return; - eab_error_dialog (NULL, eab_editor_get_window (editor), _("Error adding contact"), error); + window = eab_editor_get_window (editor); + message = _("Error adding contact"); + + eab_error_dialog (NULL, window, message, error); } static void @@ -232,14 +237,19 @@ e_contact_editor_contact_modified (EABEditor *editor, const GError *error, EContact *contact) { - if (!error) + GtkWindow *window; + const gchar *message; + + if (error == NULL) return; - if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) || - g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) + if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) return; - eab_error_dialog (NULL, eab_editor_get_window (editor), _("Error modifying contact"), error); + window = eab_editor_get_window (editor); + message = _("Error modifying contact"); + + eab_error_dialog (NULL, window, message, error); } static void @@ -247,14 +257,19 @@ e_contact_editor_contact_deleted (EABEditor *editor, const GError *error, EContact *contact) { - if (!error) + GtkWindow *window; + const gchar *message; + + if (error == NULL) return; - if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) || - g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) + if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) return; - eab_error_dialog (NULL, eab_editor_get_window (editor), _("Error removing contact"), error); + window = eab_editor_get_window (editor); + message = _("Error removing contact"); + + eab_error_dialog (NULL, window, message, error); } static void @@ -3063,22 +3078,27 @@ init_all (EContactEditor *editor) } if (requisition.width > 0 && requisition.height > 0) { - GtkWindow *window; + GtkWidget *window; GdkScreen *screen; GdkRectangle monitor_area; gint x = 0, y = 0, monitor, width, height; - window = GTK_WINDOW (e_builder_get_widget (editor->builder, "contact editor")); + window = e_builder_get_widget ( + editor->builder, "contact editor"); - gtk_widget_get_preferred_size (GTK_WIDGET (window), &tab_req, NULL); + gtk_widget_get_preferred_size (window, &tab_req, NULL); width = tab_req.width - 320 + 24; height = tab_req.height - 240 + 24; - screen = gtk_window_get_screen (window); - gtk_window_get_position (window, &x, &y); + screen = gtk_window_get_screen (GTK_WINDOW (window)); + gtk_window_get_position (GTK_WINDOW (window), &x, &y); monitor = gdk_screen_get_monitor_at_point (screen, x, y); - if (monitor < 0 || monitor >= gdk_screen_get_n_monitors (screen)) + + if (monitor < 0) + monitor = 0; + + if (monitor >= gdk_screen_get_n_monitors (screen)) monitor = 0; gdk_screen_get_monitor_workarea (screen, monitor, &monitor_area); @@ -3090,7 +3110,10 @@ init_all (EContactEditor *editor) requisition.height = monitor_area.height - height; if (requisition.width > 0 && requisition.height > 0) - gtk_window_set_default_size (window, width + requisition.width, height + requisition.height); + gtk_window_set_default_size ( + GTK_WINDOW (window), + width + requisition.width, + height + requisition.height); } } @@ -3114,8 +3137,7 @@ contact_editor_get_client_cb (GObject *source_object, ((client != NULL) && (error == NULL)) || ((client == NULL) && (error != NULL))); - if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) || - g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { + if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { g_warn_if_fail (client == NULL); g_error_free (error); goto exit; @@ -3547,7 +3569,7 @@ contact_removed_cb (GObject *source_object, sensitize_all (ce); } - if (error) + if (error != NULL) g_error_free (error); g_object_unref (ce); @@ -3635,7 +3657,7 @@ contact_modified_ready_cb (GObject *source_object, contact_modified_cb (book_client, error, user_data); - if (error) + if (error != NULL) g_error_free (error); } diff --git a/addressbook/gui/contact-editor/e-contact-quick-add.c b/addressbook/gui/contact-editor/e-contact-quick-add.c index 5814205c4d..638bac68e9 100644 --- a/addressbook/gui/contact-editor/e-contact-quick-add.c +++ b/addressbook/gui/contact-editor/e-contact-quick-add.c @@ -137,8 +137,7 @@ merge_cb (GObject *source_object, ((client == NULL) && (error != NULL))); /* Ignore cancellations. */ - if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) || - g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { + if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { g_warn_if_fail (client == NULL); g_error_free (error); return; @@ -239,7 +238,7 @@ ce_have_contact (EBookClient *book_client, { QuickAdd *qa = (QuickAdd *) closure; - if (error) { + if (error != NULL) { if (book_client) g_object_unref (book_client); g_warning ( @@ -305,8 +304,7 @@ ce_have_book (GObject *source_object, ((client == NULL) && (error != NULL))); /* Ignore cancellations. */ - if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) || - g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { + if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { g_warn_if_fail (client == NULL); g_error_free (error); return; |