diff options
author | Milan Crha <mcrha@redhat.com> | 2010-12-04 04:33:01 +0800 |
---|---|---|
committer | Rodrigo Moya <rodrigo@gnome-db.org> | 2011-06-30 00:41:07 +0800 |
commit | 989c370729b764423d4528b314cb8490c3df2b3d (patch) | |
tree | 261c88b43904cd7027aa35de8d4e08a76be6acbc /modules/calendar/e-task-shell-sidebar.c | |
parent | 8e848e505983e5fd61b057b38b862c2cc0781873 (diff) | |
download | gsoc2013-evolution-989c370729b764423d4528b314cb8490c3df2b3d.tar.gz gsoc2013-evolution-989c370729b764423d4528b314cb8490c3df2b3d.tar.zst gsoc2013-evolution-989c370729b764423d4528b314cb8490c3df2b3d.zip |
Show calendar backend errors in an alert sink
Diffstat (limited to 'modules/calendar/e-task-shell-sidebar.c')
-rw-r--r-- | modules/calendar/e-task-shell-sidebar.c | 49 |
1 files changed, 21 insertions, 28 deletions
diff --git a/modules/calendar/e-task-shell-sidebar.c b/modules/calendar/e-task-shell-sidebar.c index 52887faf03..99bc67f8ad 100644 --- a/modules/calendar/e-task-shell-sidebar.c +++ b/modules/calendar/e-task-shell-sidebar.c @@ -101,12 +101,24 @@ task_shell_sidebar_emit_status_message (ETaskShellSidebar *task_shell_sidebar, g_signal_emit (task_shell_sidebar, signal_id, 0, status_message, -1.0); } +static EAlertSink * +get_alert_sink (EShellView *shell_view) +{ + EShellWindow *shell_window; + + shell_window = e_shell_view_get_shell_window (shell_view); + + if (g_strcmp0 (e_shell_window_get_active_view (shell_window), "calendar") == 0) + shell_view = e_shell_window_peek_shell_view (shell_window, "calendar"); + + return E_ALERT_SINK (e_shell_view_get_shell_content (shell_view)); +} + static void task_shell_sidebar_backend_died_cb (ETaskShellSidebar *task_shell_sidebar, ECal *client) { EShellView *shell_view; - EShellWindow *shell_window; EShellSidebar *shell_sidebar; GHashTable *client_table; ESource *source; @@ -116,7 +128,6 @@ task_shell_sidebar_backend_died_cb (ETaskShellSidebar *task_shell_sidebar, shell_sidebar = E_SHELL_SIDEBAR (task_shell_sidebar); shell_view = e_shell_sidebar_get_shell_view (shell_sidebar); - shell_window = e_shell_view_get_shell_window (shell_view); source = e_cal_get_source (client); uid = e_source_peek_uid (source); @@ -126,8 +137,7 @@ task_shell_sidebar_backend_died_cb (ETaskShellSidebar *task_shell_sidebar, g_hash_table_remove (client_table, uid); task_shell_sidebar_emit_status_message (task_shell_sidebar, NULL); - e_alert_run_dialog_for_args ( - GTK_WINDOW (shell_window), + e_alert_submit (get_alert_sink (shell_view), "calendar:tasks-crashed", NULL); g_object_unref (source); @@ -139,35 +149,18 @@ task_shell_sidebar_backend_error_cb (ETaskShellSidebar *task_shell_sidebar, ECal *client) { EShellView *shell_view; - EShellWindow *shell_window; EShellSidebar *shell_sidebar; - GtkWidget *dialog; - const gchar *uri; - gchar *uri_no_passwd; + ESourceGroup *source_group; + ESource *source; shell_sidebar = E_SHELL_SIDEBAR (task_shell_sidebar); shell_view = e_shell_sidebar_get_shell_view (shell_sidebar); - shell_window = e_shell_view_get_shell_window (shell_view); - uri = e_cal_get_uri (client); - uri_no_passwd = get_uri_without_password (uri); - - /* Translators: This string is displayed in a message dialog when - * our connection to the calendar service detects an - * out-of-band error. The first string is a URI for - * the source of the error, the second string is the - * error message. */ - dialog = gtk_message_dialog_new ( - GTK_WINDOW (shell_window), - GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, - _("Error on %s\n%s"), - uri_no_passwd, message); - - gtk_dialog_run (GTK_DIALOG (dialog)); - gtk_widget_destroy (dialog); - - g_free (uri_no_passwd); + source = e_cal_get_source (client); + source_group = e_source_peek_group (source); + + e_alert_submit (get_alert_sink (shell_view), + "calendar:backend-error", e_source_group_peek_name (source_group), e_source_peek_name (source), message, NULL); } static void |