[evolution/gnome-3-8] [Addressbook] Show editor errors above editor window



commit c40b539296a04f877861de4610f5c09a7262a31a
Author: Milan Crha <mcrha redhat com>
Date:   Wed Aug 7 09:38:51 2013 +0200

    [Addressbook] Show editor errors above editor window
    
    An address book editor error was shown about active EShell's window,
    which means switching to other application and back made the editor
    in the background, but, more importantly, the editor could be
    selected and the error was in the background, thus it seemed like
    being stuck, it didn't respond to any button click, until the error
    was dismissed.

 addressbook/gui/contact-editor/e-contact-editor.c  |    6 +++---
 .../contact-list-editor/e-contact-list-editor.c    |    6 +++---
 addressbook/gui/widgets/e-addressbook-model.c      |    2 +-
 .../gui/widgets/e-addressbook-table-adapter.c      |    2 +-
 addressbook/gui/widgets/e-addressbook-view.c       |    2 +-
 addressbook/gui/widgets/eab-gui-util.c             |   11 ++++++++---
 addressbook/gui/widgets/eab-gui-util.h             |    1 +
 7 files changed, 18 insertions(+), 12 deletions(-)
---
diff --git a/addressbook/gui/contact-editor/e-contact-editor.c 
b/addressbook/gui/contact-editor/e-contact-editor.c
index a72d783..b9fc5e4 100644
--- a/addressbook/gui/contact-editor/e-contact-editor.c
+++ b/addressbook/gui/contact-editor/e-contact-editor.c
@@ -224,7 +224,7 @@ e_contact_editor_contact_added (EABEditor *editor,
            g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
                return;
 
-       eab_error_dialog (NULL, _("Error adding contact"), error);
+       eab_error_dialog (NULL, eab_editor_get_window (editor), _("Error adding contact"), error);
 }
 
 static void
@@ -239,7 +239,7 @@ e_contact_editor_contact_modified (EABEditor *editor,
            g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
                return;
 
-       eab_error_dialog (NULL, _("Error modifying contact"), error);
+       eab_error_dialog (NULL, eab_editor_get_window (editor), _("Error modifying contact"), error);
 }
 
 static void
@@ -254,7 +254,7 @@ e_contact_editor_contact_deleted (EABEditor *editor,
            g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
                return;
 
-       eab_error_dialog (NULL, _("Error removing contact"), error);
+       eab_error_dialog (NULL, eab_editor_get_window (editor), _("Error removing contact"), error);
 }
 
 static void
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 f58f433..2eac787 100644
--- a/addressbook/gui/contact-list-editor/e-contact-list-editor.c
+++ b/addressbook/gui/contact-list-editor/e-contact-list-editor.c
@@ -1591,7 +1591,7 @@ contact_list_editor_contact_added (EABEditor *editor,
            g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
                return;
 
-       eab_error_dialog (NULL, _("Error adding list"), error);
+       eab_error_dialog (NULL, eab_editor_get_window (editor), _("Error adding list"), error);
 }
 
 static void
@@ -1606,7 +1606,7 @@ contact_list_editor_contact_modified (EABEditor *editor,
            g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
                return;
 
-       eab_error_dialog (NULL, _("Error modifying list"), error);
+       eab_error_dialog (NULL, eab_editor_get_window (editor), _("Error modifying list"), error);
 }
 
 static void
@@ -1621,7 +1621,7 @@ contact_list_editor_contact_deleted (EABEditor *editor,
            g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
                return;
 
-       eab_error_dialog (NULL, _("Error removing list"), error);
+       eab_error_dialog (NULL, eab_editor_get_window (editor), _("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 00c2357..683eed3 100644
--- a/addressbook/gui/widgets/e-addressbook-model.c
+++ b/addressbook/gui/widgets/e-addressbook-model.c
@@ -364,7 +364,7 @@ client_view_ready_cb (GObject *source_object,
                client_view = NULL;
 
        if (error) {
-               eab_error_dialog (NULL, _("Error getting book view"), error);
+               eab_error_dialog (NULL, NULL, _("Error getting book view"), error);
                g_error_free (error);
                return;
        }
diff --git a/addressbook/gui/widgets/e-addressbook-table-adapter.c 
b/addressbook/gui/widgets/e-addressbook-table-adapter.c
index 5bd188c..8871732 100644
--- a/addressbook/gui/widgets/e-addressbook-table-adapter.c
+++ b/addressbook/gui/widgets/e-addressbook-table-adapter.c
@@ -158,7 +158,7 @@ contact_modified_cb (EBookClient *book_client,
                      gpointer user_data)
 {
        if (error)
-               eab_error_dialog (NULL, _("Error modifying card"), error);
+               eab_error_dialog (NULL, 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 5edbf0f..674796f 100644
--- a/addressbook/gui/widgets/e-addressbook-view.c
+++ b/addressbook/gui/widgets/e-addressbook-view.c
@@ -1234,7 +1234,7 @@ report_and_free_error_if_any (GError *error)
                        e_shell_get_active_window (NULL),
                        "addressbook:contact-delete-error-perm", NULL);
        } else {
-               eab_error_dialog (NULL, _("Failed to delete contact"), error);
+               eab_error_dialog (NULL, NULL, _("Failed to delete contact"), error);
        }
 
        g_error_free (error);
diff --git a/addressbook/gui/widgets/eab-gui-util.c b/addressbook/gui/widgets/eab-gui-util.c
index 2967ca9..5f155ad 100644
--- a/addressbook/gui/widgets/eab-gui-util.c
+++ b/addressbook/gui/widgets/eab-gui-util.c
@@ -77,6 +77,7 @@ typedef enum {
 
 void
 eab_error_dialog (EAlertSink *alert_sink,
+                 GtkWindow *parent,
                   const gchar *msg,
                   const GError *error)
 {
@@ -86,11 +87,15 @@ eab_error_dialog (EAlertSink *alert_sink,
                                alert_sink,
                                "addressbook:generic-error",
                                msg, error->message, NULL);
-               else
+               else {
+                       if (!parent)
+                               parent = e_shell_get_active_window (NULL);
+
                        e_alert_run_dialog_for_args (
-                               e_shell_get_active_window (NULL),
+                               parent,
                                "addressbook:generic-error",
                                msg, error->message, NULL);
+               }
        }
 }
 
@@ -490,7 +495,7 @@ contact_added_cb (EBookClient *book_client,
        if (error && !g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) &&
            !g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
                process->book_status = FALSE;
-               eab_error_dialog (process->alert_sink, _("Error adding contact"), error);
+               eab_error_dialog (process->alert_sink, NULL, _("Error adding contact"), error);
        } else if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) ||
            g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
                process->book_status = FALSE;
diff --git a/addressbook/gui/widgets/eab-gui-util.h b/addressbook/gui/widgets/eab-gui-util.h
index d6c6cb2..f169f8b 100644
--- a/addressbook/gui/widgets/eab-gui-util.h
+++ b/addressbook/gui/widgets/eab-gui-util.h
@@ -32,6 +32,7 @@
 G_BEGIN_DECLS
 
 void           eab_error_dialog                (EAlertSink *alert_sink,
+                                                GtkWindow *parent,
                                                 const gchar *msg,
                                                 const GError *error);
 void           eab_load_error_dialog           (GtkWidget *parent,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]