diff options
Diffstat (limited to 'addressbook/gui')
-rw-r--r-- | addressbook/gui/contact-editor/e-contact-editor.c | 8 | ||||
-rw-r--r-- | addressbook/gui/contact-list-editor/e-contact-list-editor.c | 8 | ||||
-rw-r--r-- | addressbook/gui/widgets/e-addressbook-model.c | 2 | ||||
-rw-r--r-- | addressbook/gui/widgets/e-addressbook-table-adapter.c | 2 | ||||
-rw-r--r-- | addressbook/gui/widgets/e-addressbook-view.c | 28 | ||||
-rw-r--r-- | addressbook/gui/widgets/eab-gui-util.c | 47 | ||||
-rw-r--r-- | addressbook/gui/widgets/eab-gui-util.h | 9 |
7 files changed, 62 insertions, 42 deletions
diff --git a/addressbook/gui/contact-editor/e-contact-editor.c b/addressbook/gui/contact-editor/e-contact-editor.c index e1794572a5..d071e9bab6 100644 --- a/addressbook/gui/contact-editor/e-contact-editor.c +++ b/addressbook/gui/contact-editor/e-contact-editor.c @@ -208,7 +208,7 @@ e_contact_editor_contact_added (EABEditor *editor, if (g_error_matches (error, E_BOOK_ERROR, E_BOOK_ERROR_CANCELLED)) return; - eab_error_dialog (_("Error adding contact"), error); + eab_error_dialog (NULL, _("Error adding contact"), error); } static void @@ -222,7 +222,7 @@ e_contact_editor_contact_modified (EABEditor *editor, if (g_error_matches (error, E_BOOK_ERROR, E_BOOK_ERROR_CANCELLED)) return; - eab_error_dialog (_("Error modifying contact"), error); + eab_error_dialog (NULL, _("Error modifying contact"), error); } static void @@ -236,7 +236,7 @@ e_contact_editor_contact_deleted (EABEditor *editor, if (g_error_matches (error, E_BOOK_ERROR, E_BOOK_ERROR_CANCELLED)) return; - eab_error_dialog (_("Error removing contact"), error); + eab_error_dialog (NULL, _("Error removing contact"), error); } static void @@ -2735,7 +2735,7 @@ contact_editor_book_loaded_cb (ESource *source, g_warn_if_fail (book == NULL); parent = eab_editor_get_window (EAB_EDITOR (editor)); - eab_load_error_dialog (GTK_WIDGET (parent), source, error); + eab_load_error_dialog (GTK_WIDGET (parent), NULL, source, error); source_combo_box = e_builder_get_widget ( editor->builder, "source-combo-box-source"); diff --git a/addressbook/gui/contact-list-editor/e-contact-list-editor.c b/addressbook/gui/contact-list-editor/e-contact-list-editor.c index 2ffee04b91..7c5d9a9c98 100644 --- a/addressbook/gui/contact-list-editor/e-contact-list-editor.c +++ b/addressbook/gui/contact-list-editor/e-contact-list-editor.c @@ -221,7 +221,7 @@ contact_list_editor_book_loaded_cb (ESource *source, GtkWindow *parent; parent = eab_editor_get_window (EAB_EDITOR (editor)); - eab_load_error_dialog (GTK_WIDGET (parent), source, error); + eab_load_error_dialog (GTK_WIDGET (parent), NULL, source, error); e_source_combo_box_set_active ( E_SOURCE_COMBO_BOX (WIDGET (SOURCE_MENU)), @@ -1157,7 +1157,7 @@ contact_list_editor_contact_added (EABEditor *editor, if (g_error_matches (error, E_BOOK_ERROR, E_BOOK_ERROR_CANCELLED)) return; - eab_error_dialog (_("Error adding list"), error); + eab_error_dialog (NULL, _("Error adding list"), error); } static void @@ -1171,7 +1171,7 @@ contact_list_editor_contact_modified (EABEditor *editor, if (g_error_matches (error, E_BOOK_ERROR, E_BOOK_ERROR_CANCELLED)) return; - eab_error_dialog (_("Error modifying list"), error); + eab_error_dialog (NULL, _("Error modifying list"), error); } static void @@ -1185,7 +1185,7 @@ contact_list_editor_contact_deleted (EABEditor *editor, if (g_error_matches (error, E_BOOK_ERROR, E_BOOK_ERROR_CANCELLED)) return; - eab_error_dialog (_("Error removing list"), error); + eab_error_dialog (NULL, _("Error removing list"), error); } static void diff --git a/addressbook/gui/widgets/e-addressbook-model.c b/addressbook/gui/widgets/e-addressbook-model.c index e6b24abe75..e64848f527 100644 --- a/addressbook/gui/widgets/e-addressbook-model.c +++ b/addressbook/gui/widgets/e-addressbook-model.c @@ -324,7 +324,7 @@ book_view_loaded (EBook *book, EAddressbookModel *model = closure; if (error) { - eab_error_dialog (_("Error getting book view"), error); + eab_error_dialog (NULL, _("Error getting book view"), error); return; } diff --git a/addressbook/gui/widgets/e-addressbook-table-adapter.c b/addressbook/gui/widgets/e-addressbook-table-adapter.c index 156f30753e..aa12810b84 100644 --- a/addressbook/gui/widgets/e-addressbook-table-adapter.c +++ b/addressbook/gui/widgets/e-addressbook-table-adapter.c @@ -147,7 +147,7 @@ contact_modified_cb (EBook* book, const GError *error, gpointer user_data) { if (error) - eab_error_dialog (_("Error modifying card"), error); + eab_error_dialog (NULL, _("Error modifying card"), error); } static void diff --git a/addressbook/gui/widgets/e-addressbook-view.c b/addressbook/gui/widgets/e-addressbook-view.c index 0f7bacd781..5879d9970d 100644 --- a/addressbook/gui/widgets/e-addressbook-view.c +++ b/addressbook/gui/widgets/e-addressbook-view.c @@ -1099,11 +1099,12 @@ search_result (EAddressbookView *view, const gchar *error_msg) { EShellView *shell_view; - EShellWindow *shell_window; + EAlertSink *alert_sink; shell_view = e_addressbook_view_get_shell_view (view); - shell_window = e_shell_view_get_shell_window (shell_view); - eab_search_result_dialog (GTK_WIDGET (shell_window), status, error_msg); + alert_sink = E_ALERT_SINK (e_shell_view_get_shell_content (shell_view)); + + eab_search_result_dialog (alert_sink, status, error_msg); } static void @@ -1141,18 +1142,17 @@ static void backend_died (EAddressbookView *view) { EShellView *shell_view; - EShellWindow *shell_window; + EAlertSink *alert_sink; EAddressbookModel *model; EBook *book; shell_view = e_addressbook_view_get_shell_view (view); - shell_window = e_shell_view_get_shell_window (shell_view); + alert_sink = E_ALERT_SINK (e_shell_view_get_shell_content (shell_view)); model = e_addressbook_view_get_model (view); book = e_addressbook_model_get_book (model); - e_alert_run_dialog_for_args ( - GTK_WINDOW (shell_window), + e_alert_submit (alert_sink, "addressbook:backend-died", e_book_get_uri (book), NULL); } @@ -1277,7 +1277,7 @@ delete_contacts_cb (EBook *book, const GError *error, gpointer closure) break; default : /* Unknown error */ - eab_error_dialog (_("Failed to delete contact"), error); + eab_error_dialog (NULL, _("Failed to delete contact"), error); break; } } @@ -1520,10 +1520,12 @@ view_transfer_contacts (EAddressbookView *view, { EBook *book; GList *contacts = NULL; - GtkWindow *parent; + EShellView *shell_view; + EAlertSink *alert_sink; book = e_addressbook_model_get_book (view->priv->model); - parent = GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (view))); + shell_view = e_addressbook_view_get_shell_view (view); + alert_sink = E_ALERT_SINK (e_shell_view_get_shell_content (shell_view)); if (all) { EBookQuery *query; @@ -1534,8 +1536,8 @@ view_transfer_contacts (EAddressbookView *view, e_book_query_unref (query); if (error) { - e_alert_run_dialog_for_args ( - parent, "addressbook:search-error", + e_alert_submit ( + alert_sink, "addressbook:search-error", error->message, NULL); g_error_free (error); return; @@ -1544,7 +1546,7 @@ view_transfer_contacts (EAddressbookView *view, contacts = e_addressbook_view_get_selected (view); } - eab_transfer_contacts (book, contacts, delete_from_source, parent); + eab_transfer_contacts (book, contacts, delete_from_source, alert_sink); g_object_unref (book); } diff --git a/addressbook/gui/widgets/eab-gui-util.c b/addressbook/gui/widgets/eab-gui-util.c index 51e00fd17d..280758f26d 100644 --- a/addressbook/gui/widgets/eab-gui-util.c +++ b/addressbook/gui/widgets/eab-gui-util.c @@ -47,19 +47,25 @@ #include <camel/camel.h> void -eab_error_dialog (const gchar *msg, const GError *error) +eab_error_dialog (EAlertSink *alert_sink, const gchar *msg, const GError *error) { - if (error && error->message) - e_alert_run_dialog_for_args (e_shell_get_active_window (NULL), - "addressbook:generic-error", - msg, error->message, NULL); + if (error && error->message) { + if (alert_sink) + e_alert_submit (alert_sink, + "addressbook:generic-error", + msg, error->message, NULL); + else + e_alert_run_dialog_for_args ( + e_shell_get_active_window (NULL), + "addressbook:generic-error", + msg, error->message, NULL); + } } void -eab_load_error_dialog (GtkWidget *parent, ESource *source, const GError *error) +eab_load_error_dialog (GtkWidget *parent, EAlertSink *alert_sink, ESource *source, const GError *error) { gchar *label_string, *label = NULL, *uri; - GtkWidget *dialog; gboolean can_detail_error = TRUE; g_return_if_fail (source != NULL); @@ -130,16 +136,22 @@ eab_load_error_dialog (GtkWidget *parent, ESource *source, const GError *error) } } - dialog = e_alert_dialog_new_for_args ((GtkWindow *) parent, "addressbook:load-error", label_string, NULL); - g_signal_connect (dialog, "response", G_CALLBACK (gtk_widget_destroy), NULL); + if (alert_sink) { + e_alert_submit (alert_sink, "addressbook:load-error", label_string, NULL); + } else { + GtkWidget *dialog; + + dialog = e_alert_dialog_new_for_args ((GtkWindow *) parent, "addressbook:load-error", label_string, NULL); + g_signal_connect (dialog, "response", G_CALLBACK (gtk_widget_destroy), NULL); + gtk_widget_show (dialog); + } - gtk_widget_show (dialog); g_free (label); g_free (uri); } void -eab_search_result_dialog (GtkWidget *parent, +eab_search_result_dialog (EAlertSink *alert_sink, EBookViewStatus status, const gchar *error_msg) { @@ -181,7 +193,7 @@ eab_search_result_dialog (GtkWidget *parent, g_return_if_reached (); } - e_alert_run_dialog_for_args ((GtkWindow *) parent, "addressbook:search-error", str, NULL); + e_alert_submit (alert_sink, "addressbook:search-error", str, NULL); g_free (str); } @@ -318,6 +330,7 @@ struct ContactCopyProcess_ { EBook *source; EBook *destination; ContactCopyDone done_cb; + EAlertSink *alert_sink; }; static void @@ -365,7 +378,7 @@ contact_added_cb (EBook* book, const GError *error, const gchar *id, gpointer us if (error && !g_error_matches (error, E_BOOK_ERROR, E_BOOK_ERROR_CANCELLED)) { process->book_status = FALSE; - eab_error_dialog (_("Error adding contact"), error); + eab_error_dialog (process->alert_sink, _("Error adding contact"), error); } else if (g_error_matches (error, E_BOOK_ERROR, E_BOOK_ERROR_CANCELLED)) { process->book_status = FALSE; @@ -421,12 +434,13 @@ void eab_transfer_contacts (EBook *source_book, GList *contacts /* adopted */, gboolean delete_from_source, - GtkWindow *parent_window) + EAlertSink *alert_sink) { ESource *destination; static gchar *last_uid = NULL; ContactCopyProcess *process; gchar *desc; + GtkWindow *window = GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (alert_sink))); g_return_if_fail (E_IS_BOOK (source_book)); @@ -450,7 +464,7 @@ eab_transfer_contacts (EBook *source_book, destination = eab_select_source ( e_book_get_source (source_book), - desc, NULL, last_uid, parent_window); + desc, NULL, last_uid, window); if (!destination) return; @@ -466,6 +480,7 @@ eab_transfer_contacts (EBook *source_book, process->source = g_object_ref (source_book); process->contacts = contacts; process->destination = NULL; + process->alert_sink = alert_sink; if (delete_from_source) process->done_cb = delete_contacts; @@ -473,7 +488,7 @@ eab_transfer_contacts (EBook *source_book, process->done_cb = NULL; e_load_book_source_async ( - destination, parent_window, NULL, + destination, window, NULL, (GAsyncReadyCallback) book_loaded_cb, process); } diff --git a/addressbook/gui/widgets/eab-gui-util.h b/addressbook/gui/widgets/eab-gui-util.h index e1fd43fdf3..45c7d40b79 100644 --- a/addressbook/gui/widgets/eab-gui-util.h +++ b/addressbook/gui/widgets/eab-gui-util.h @@ -26,22 +26,25 @@ #include <gtk/gtk.h> #include <libebook/e-book.h> +#include "e-util/e-alert-sink.h" G_BEGIN_DECLS -void eab_error_dialog (const gchar *msg, +void eab_error_dialog (EAlertSink *alert_sink, + const gchar *msg, const GError *error); void eab_load_error_dialog (GtkWidget *parent, + EAlertSink *alert_sink, ESource *source, const GError *error); -void eab_search_result_dialog (GtkWidget *parent, +void eab_search_result_dialog (EAlertSink *alert_sink, EBookViewStatus status, const gchar *error_msg); gint eab_prompt_save_dialog (GtkWindow *parent); void eab_transfer_contacts (EBook *source_book, GList *contacts, /* adopted */ gboolean delete_from_source, - GtkWindow *parent_window); + EAlertSink *alert_sink); gchar * eab_suggest_filename (GList *contact_list); ESource * eab_select_source (ESource *except_source, const gchar *title, |