aboutsummaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2010-12-04 04:33:01 +0800
committerMilan Crha <mcrha@redhat.com>2010-12-04 04:33:01 +0800
commitab0430a3f37b01f104d8a4556fdb527c0bd92116 (patch)
tree2210ef2d1263ec3ca3dc2f2f88310266cdf9dc74 /modules
parenta63688f4e72be7b2b93312e4af0403a4a3e0517b (diff)
downloadgsoc2013-evolution-ab0430a3f37b01f104d8a4556fdb527c0bd92116.tar
gsoc2013-evolution-ab0430a3f37b01f104d8a4556fdb527c0bd92116.tar.gz
gsoc2013-evolution-ab0430a3f37b01f104d8a4556fdb527c0bd92116.tar.bz2
gsoc2013-evolution-ab0430a3f37b01f104d8a4556fdb527c0bd92116.tar.lz
gsoc2013-evolution-ab0430a3f37b01f104d8a4556fdb527c0bd92116.tar.xz
gsoc2013-evolution-ab0430a3f37b01f104d8a4556fdb527c0bd92116.tar.zst
gsoc2013-evolution-ab0430a3f37b01f104d8a4556fdb527c0bd92116.zip
Show calendar backend errors in an alert sink
Diffstat (limited to 'modules')
-rw-r--r--modules/calendar/e-cal-shell-sidebar.c27
-rw-r--r--modules/calendar/e-memo-shell-sidebar.c49
-rw-r--r--modules/calendar/e-task-shell-sidebar.c49
3 files changed, 45 insertions, 80 deletions
diff --git a/modules/calendar/e-cal-shell-sidebar.c b/modules/calendar/e-cal-shell-sidebar.c
index 1e291989cf..81ab858186 100644
--- a/modules/calendar/e-cal-shell-sidebar.c
+++ b/modules/calendar/e-cal-shell-sidebar.c
@@ -111,7 +111,6 @@ cal_shell_sidebar_backend_died_cb (ECalShellSidebar *cal_shell_sidebar,
ECal *client)
{
EShellView *shell_view;
- EShellWindow *shell_window;
EShellSidebar *shell_sidebar;
GHashTable *client_table;
ESource *source;
@@ -121,7 +120,6 @@ cal_shell_sidebar_backend_died_cb (ECalShellSidebar *cal_shell_sidebar,
shell_sidebar = E_SHELL_SIDEBAR (cal_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);
@@ -131,8 +129,7 @@ cal_shell_sidebar_backend_died_cb (ECalShellSidebar *cal_shell_sidebar,
g_hash_table_remove (client_table, uid);
cal_shell_sidebar_emit_status_message (cal_shell_sidebar, NULL);
- e_alert_run_dialog_for_args (
- GTK_WINDOW (shell_window),
+ e_alert_submit (E_ALERT_SINK (e_shell_view_get_shell_content (shell_view)),
"calendar:calendar-crashed", NULL);
g_object_unref (source);
@@ -144,36 +141,18 @@ cal_shell_sidebar_backend_error_cb (ECalShellSidebar *cal_shell_sidebar,
ECal *client)
{
EShellView *shell_view;
- EShellWindow *shell_window;
EShellSidebar *shell_sidebar;
ESourceGroup *source_group;
ESource *source;
- GtkWidget *dialog;
shell_sidebar = E_SHELL_SIDEBAR (cal_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);
source_group = e_source_peek_group (source);
- /* 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 name of
- * group in which calendar for the source of error is
- * defined and the second string is name of calendar
- * and the third 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: %s\n%s"),
- e_source_group_peek_name (source_group),
- e_source_peek_name (source), message);
-
- gtk_dialog_run (GTK_DIALOG (dialog));
- gtk_widget_destroy (dialog);
-
+ e_alert_submit (E_ALERT_SINK (e_shell_view_get_shell_content (shell_view)),
+ "calendar:backend-error", e_source_group_peek_name (source_group), e_source_peek_name (source), message, NULL);
}
static void
diff --git a/modules/calendar/e-memo-shell-sidebar.c b/modules/calendar/e-memo-shell-sidebar.c
index 5bc5dfd132..14d4b36e11 100644
--- a/modules/calendar/e-memo-shell-sidebar.c
+++ b/modules/calendar/e-memo-shell-sidebar.c
@@ -101,12 +101,24 @@ memo_shell_sidebar_emit_status_message (EMemoShellSidebar *memo_shell_sidebar,
g_signal_emit (memo_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
memo_shell_sidebar_backend_died_cb (EMemoShellSidebar *memo_shell_sidebar,
ECal *client)
{
EShellView *shell_view;
- EShellWindow *shell_window;
EShellSidebar *shell_sidebar;
GHashTable *client_table;
ESource *source;
@@ -116,7 +128,6 @@ memo_shell_sidebar_backend_died_cb (EMemoShellSidebar *memo_shell_sidebar,
shell_sidebar = E_SHELL_SIDEBAR (memo_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 @@ memo_shell_sidebar_backend_died_cb (EMemoShellSidebar *memo_shell_sidebar,
g_hash_table_remove (client_table, uid);
memo_shell_sidebar_emit_status_message (memo_shell_sidebar, NULL);
- e_alert_run_dialog_for_args (
- GTK_WINDOW (shell_window),
+ e_alert_submit (get_alert_sink (shell_view),
"calendar:memos-crashed", NULL);
g_object_unref (source);
@@ -139,35 +149,18 @@ memo_shell_sidebar_backend_error_cb (EMemoShellSidebar *memo_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 (memo_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
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