[evolution] Defer "backend-died" alerts to EShell.



commit 9714a4bbf1a938871240640002c9dd369133c766
Author: Matthew Barnes <mbarnes redhat com>
Date:   Wed Feb 13 16:55:43 2013 -0500

    Defer "backend-died" alerts to EShell.

 addressbook/addressbook.error.xml             |    6 ----
 addressbook/gui/widgets/e-addressbook-model.c |   34 -------------------------
 addressbook/gui/widgets/e-addressbook-model.h |    1 -
 addressbook/gui/widgets/e-addressbook-view.c  |   26 -------------------
 calendar/calendar.error.xml                   |   20 --------------
 calendar/gui/e-cal-model.c                    |    2 +-
 modules/calendar/e-cal-shell-sidebar.c        |   19 ++-----------
 modules/calendar/e-memo-shell-sidebar.c       |   19 ++-----------
 modules/calendar/e-task-shell-sidebar.c       |   19 ++-----------
 9 files changed, 10 insertions(+), 136 deletions(-)
---
diff --git a/addressbook/addressbook.error.xml b/addressbook/addressbook.error.xml
index 8515115..23dd3a2 100644
--- a/addressbook/addressbook.error.xml
+++ b/addressbook/addressbook.error.xml
@@ -92,12 +92,6 @@
     <_secondary>Error saving {0} to {1}: {2}</_secondary>
   </error>
 
-  <error id="backend-died" type="error">
-    <_primary>The Evolution address book has quit unexpectedly.</_primary>
-    <!-- Translators: {0} is replaced with an address book name which will not be available -->
-    <_secondary>Your contacts for {0} will not be available until Evolution is restarted.</_secondary>
-  </error>
-
   <error id="ask-list-add-exists" type="question" default="GTK_RESPONSE_NO">
     <_primary>Address '{0}' already exists.</_primary>
     <_secondary>A contact already exists with this address. Would you like to add a new card with the same 
address anyway?</_secondary>
diff --git a/addressbook/gui/widgets/e-addressbook-model.c b/addressbook/gui/widgets/e-addressbook-model.c
index 1720b19..948c74d 100644
--- a/addressbook/gui/widgets/e-addressbook-model.c
+++ b/addressbook/gui/widgets/e-addressbook-model.c
@@ -52,7 +52,6 @@ struct _EAddressbookModelPrivate {
        gulong status_message_id;
        gulong writable_status_id;
        gulong view_complete_id;
-       gulong backend_died_id;
        guint remove_status_id;
 
        guint search_in_progress        : 1;
@@ -79,7 +78,6 @@ enum {
        CONTACT_CHANGED,
        MODEL_CHANGED,
        STOP_STATE_CHANGED,
-       BACKEND_DIED,
        LAST_SIGNAL
 };
 
@@ -348,13 +346,6 @@ readonly_cb (EBookClient *book_client,
 }
 
 static void
-backend_died_cb (EBookClient *book_client,
-                 EAddressbookModel *model)
-{
-       g_signal_emit (model, signals[BACKEND_DIED], 0);
-}
-
-static void
 client_view_ready_cb (GObject *source_object,
                       GAsyncResult *result,
                       gpointer user_data)
@@ -558,12 +549,6 @@ addressbook_model_dispose (GObject *object)
                                model->priv->writable_status_id);
                model->priv->writable_status_id = 0;
 
-               if (model->priv->backend_died_id)
-                       g_signal_handler_disconnect (
-                               model->priv->book_client,
-                               model->priv->backend_died_id);
-               model->priv->backend_died_id = 0;
-
                g_object_unref (model->priv->book_client);
                model->priv->book_client = NULL;
        }
@@ -747,15 +732,6 @@ e_addressbook_model_class_init (EAddressbookModelClass *class)
                NULL, NULL,
                g_cclosure_marshal_VOID__VOID,
                G_TYPE_NONE, 0);
-
-       signals[BACKEND_DIED] = g_signal_new (
-               "backend_died",
-               G_OBJECT_CLASS_TYPE (object_class),
-               G_SIGNAL_RUN_LAST,
-               G_STRUCT_OFFSET (EAddressbookModelClass, backend_died),
-               NULL, NULL,
-               g_cclosure_marshal_VOID__VOID,
-               G_TYPE_NONE, 0);
 }
 
 static void
@@ -907,12 +883,6 @@ e_addressbook_model_set_client (EAddressbookModel *model,
                                model->priv->writable_status_id);
                model->priv->writable_status_id = 0;
 
-               if (model->priv->backend_died_id != 0)
-                       g_signal_handler_disconnect (
-                               model->priv->book_client,
-                               model->priv->backend_died_id);
-               model->priv->backend_died_id = 0;
-
                g_object_unref (model->priv->book_client);
        }
 
@@ -923,10 +893,6 @@ e_addressbook_model_set_client (EAddressbookModel *model,
                book_client, "notify::readonly",
                G_CALLBACK (readonly_cb), model);
 
-       model->priv->backend_died_id = g_signal_connect (
-               book_client, "backend-died",
-               G_CALLBACK (backend_died_cb), model);
-
        editable = !e_client_is_readonly (E_CLIENT (book_client));
        e_addressbook_model_set_editable (model, editable);
 
diff --git a/addressbook/gui/widgets/e-addressbook-model.h b/addressbook/gui/widgets/e-addressbook-model.h
index c5b6489..0fb7be3 100644
--- a/addressbook/gui/widgets/e-addressbook-model.h
+++ b/addressbook/gui/widgets/e-addressbook-model.h
@@ -76,7 +76,6 @@ struct _EAddressbookModelClass {
                                                 gint index);
        void            (*model_changed)        (EAddressbookModel *model);
        void            (*stop_state_changed)   (EAddressbookModel *model);
-       void            (*backend_died)         (EAddressbookModel *model);
 };
 
 GType          e_addressbook_model_get_type    (void);
diff --git a/addressbook/gui/widgets/e-addressbook-view.c b/addressbook/gui/widgets/e-addressbook-view.c
index 14293f5..3fb30fe 100644
--- a/addressbook/gui/widgets/e-addressbook-view.c
+++ b/addressbook/gui/widgets/e-addressbook-view.c
@@ -62,7 +62,6 @@ static void   folder_bar_message              (EAddressbookView *view,
                                                 const gchar *status);
 static void    stop_state_changed              (GObject *object,
                                                 EAddressbookView *view);
-static void    backend_died                    (EAddressbookView *view);
 static void    command_state_change            (EAddressbookView *view);
 
 struct _EAddressbookViewPrivate {
@@ -913,9 +912,6 @@ e_addressbook_view_new (EShellView *shell_view,
        g_signal_connect_swapped (
                view->priv->model, "writable-status",
                G_CALLBACK (command_state_change), view);
-       g_signal_connect_swapped (
-               view->priv->model, "backend_died",
-               G_CALLBACK (backend_died), view);
 
        return widget;
 }
@@ -1113,28 +1109,6 @@ command_state_change (EAddressbookView *view)
 }
 
 static void
-backend_died (EAddressbookView *view)
-{
-       EShellView *shell_view;
-       EAlertSink *alert_sink;
-       EAddressbookModel *model;
-       EBookClient *book_client;
-       ESource *source;
-
-       shell_view = e_addressbook_view_get_shell_view (view);
-       alert_sink = E_ALERT_SINK (e_shell_view_get_shell_content (shell_view));
-
-       model = e_addressbook_view_get_model (view);
-       book_client = e_addressbook_model_get_client (model);
-       source = e_client_get_source (E_CLIENT (book_client));
-
-       e_alert_submit (
-               alert_sink,
-               "addressbook:backend-died",
-               e_source_get_display_name (source), NULL);
-}
-
-static void
 contact_print_button_draw_page (GtkPrintOperation *operation,
                                 GtkPrintContext *context,
                                 gint page_nr,
diff --git a/calendar/calendar.error.xml b/calendar/calendar.error.xml
index 98ca70b..e58a482 100644
--- a/calendar/calendar.error.xml
+++ b/calendar/calendar.error.xml
@@ -173,26 +173,6 @@
     <button _label="_Send" response="GTK_RESPONSE_YES"/>
   </error>
 
-  <error id="tasks-crashed" type="error">
-    <_primary>The Evolution tasks have quit unexpectedly.</_primary>
-    <_secondary>Your tasks will not be available until Evolution is restarted.</_secondary>
-  </error>
-
-  <error id="calendar-crashed" type="error">
-    <_primary>The Evolution calendar has quit unexpectedly.</_primary>
-    <_secondary>Your calendars will not be available until Evolution is restarted.</_secondary>
-  </error>
-
-  <error id="memos-crashed" type="error">
-    <_primary>The Evolution memo has quit unexpectedly.</_primary>
-    <_secondary>Your memos will not be available until Evolution is restarted.</_secondary>
-  </error>
-
-  <error id="backend_died" type="error">
-   <_primary>The Evolution calendars have quit unexpectedly.</_primary>
-   <_secondary>Your calendars will not be available until Evolution is restarted.</_secondary>
-  </error>
-
   <error id="editor-error" type="error">
     <_primary>Editor could not be loaded.</_primary>
     <secondary>{0}.</secondary>
diff --git a/calendar/gui/e-cal-model.c b/calendar/gui/e-cal-model.c
index 8ed2e52..b94c709 100644
--- a/calendar/gui/e-cal-model.c
+++ b/calendar/gui/e-cal-model.c
@@ -3009,7 +3009,7 @@ add_new_client (ECalModel *model,
        priv->clients = g_list_append (priv->clients, client_data);
 
        g_signal_connect (
-               client_data->client, "backend_died",
+               client_data->client, "backend-died",
                G_CALLBACK (backend_died_cb), model);
 
  load:
diff --git a/modules/calendar/e-cal-shell-sidebar.c b/modules/calendar/e-cal-shell-sidebar.c
index aafae79..b7ab551 100644
--- a/modules/calendar/e-cal-shell-sidebar.c
+++ b/modules/calendar/e-cal-shell-sidebar.c
@@ -162,32 +162,19 @@ static void
 cal_shell_sidebar_backend_died_cb (ECalShellSidebar *cal_shell_sidebar,
                                    ECalClient *client)
 {
-       EShellView *shell_view;
-       EShellContent *shell_content;
-       EShellSidebar *shell_sidebar;
        GHashTable *client_table;
        ESource *source;
-       const gchar *uid;
+       gchar *uid;
 
        client_table = cal_shell_sidebar->priv->client_table;
 
-       shell_sidebar = E_SHELL_SIDEBAR (cal_shell_sidebar);
-       shell_view = e_shell_sidebar_get_shell_view (shell_sidebar);
-       shell_content = e_shell_view_get_shell_content (shell_view);
-
        source = e_client_get_source (E_CLIENT (client));
-       uid = e_source_get_uid (source);
-
-       g_object_ref (source);
+       uid = e_source_dup_uid (source);
 
        g_hash_table_remove (client_table, uid);
        cal_shell_sidebar_emit_status_message (cal_shell_sidebar, NULL);
 
-       e_alert_submit (
-               E_ALERT_SINK (shell_content),
-               "calendar:calendar-crashed", NULL);
-
-       g_object_unref (source);
+       g_free (uid);
 }
 
 static void
diff --git a/modules/calendar/e-memo-shell-sidebar.c b/modules/calendar/e-memo-shell-sidebar.c
index 24e6f84..138b78d 100644
--- a/modules/calendar/e-memo-shell-sidebar.c
+++ b/modules/calendar/e-memo-shell-sidebar.c
@@ -159,32 +159,19 @@ static void
 memo_shell_sidebar_backend_died_cb (EMemoShellSidebar *memo_shell_sidebar,
                                     ECalClient *client)
 {
-       EShellView *shell_view;
-       EShellContent *shell_content;
-       EShellSidebar *shell_sidebar;
        GHashTable *client_table;
        ESource *source;
-       const gchar *uid;
+       gchar *uid;
 
        client_table = memo_shell_sidebar->priv->client_table;
 
-       shell_sidebar = E_SHELL_SIDEBAR (memo_shell_sidebar);
-       shell_view = e_shell_sidebar_get_shell_view (shell_sidebar);
-       shell_content = e_shell_view_get_shell_content (shell_view);
-
        source = e_client_get_source (E_CLIENT (client));
-       uid = e_source_get_uid (source);
-
-       g_object_ref (source);
+       uid = e_source_dup_uid (source);
 
        g_hash_table_remove (client_table, uid);
        memo_shell_sidebar_emit_status_message (memo_shell_sidebar, NULL);
 
-       e_alert_submit (
-               E_ALERT_SINK (shell_content),
-               "calendar:memos-crashed", NULL);
-
-       g_object_unref (source);
+       g_free (uid);
 }
 
 static void
diff --git a/modules/calendar/e-task-shell-sidebar.c b/modules/calendar/e-task-shell-sidebar.c
index dc25f39..b353f8a 100644
--- a/modules/calendar/e-task-shell-sidebar.c
+++ b/modules/calendar/e-task-shell-sidebar.c
@@ -159,32 +159,19 @@ static void
 task_shell_sidebar_backend_died_cb (ETaskShellSidebar *task_shell_sidebar,
                                     ECalClient *client)
 {
-       EShellView *shell_view;
-       EShellContent *shell_content;
-       EShellSidebar *shell_sidebar;
        GHashTable *client_table;
        ESource *source;
-       const gchar *uid;
+       gchar *uid;
 
        client_table = task_shell_sidebar->priv->client_table;
 
-       shell_sidebar = E_SHELL_SIDEBAR (task_shell_sidebar);
-       shell_view = e_shell_sidebar_get_shell_view (shell_sidebar);
-       shell_content = e_shell_view_get_shell_content (shell_view);
-
        source = e_client_get_source (E_CLIENT (client));
-       uid = e_source_get_uid (source);
-
-       g_object_ref (source);
+       uid = e_source_dup_uid (source);
 
        g_hash_table_remove (client_table, uid);
        task_shell_sidebar_emit_status_message (task_shell_sidebar, NULL);
 
-       e_alert_submit (
-               E_ALERT_SINK (shell_content),
-               "calendar:tasks-crashed", NULL);
-
-       g_object_unref (source);
+       g_free (uid);
 }
 
 static void


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