diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2013-02-16 20:05:52 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2013-02-17 07:57:09 +0800 |
commit | 519a1d0c3b3193a81e849910203e6a7ecc4ecc60 (patch) | |
tree | 9fef95b49f6dfd56794bf2b57f9758ee2d5f1085 /modules/calendar | |
parent | a2c6e4569e99d0029804748a91abf13c8f47b50f (diff) | |
download | gsoc2013-evolution-519a1d0c3b3193a81e849910203e6a7ecc4ecc60.tar.gz gsoc2013-evolution-519a1d0c3b3193a81e849910203e6a7ecc4ecc60.tar.zst gsoc2013-evolution-519a1d0c3b3193a81e849910203e6a7ecc4ecc60.zip |
ETaskShellView: Handle error signals from task list backends.
Diffstat (limited to 'modules/calendar')
-rw-r--r-- | modules/calendar/e-task-shell-view-private.c | 50 | ||||
-rw-r--r-- | modules/calendar/e-task-shell-view-private.h | 3 |
2 files changed, 50 insertions, 3 deletions
diff --git a/modules/calendar/e-task-shell-view-private.c b/modules/calendar/e-task-shell-view-private.c index 562c2a264d..3803e51881 100644 --- a/modules/calendar/e-task-shell-view-private.c +++ b/modules/calendar/e-task-shell-view-private.c @@ -167,6 +167,30 @@ task_shell_view_update_timeout_cb (ETaskShellView *task_shell_view) } static void +task_shell_view_backend_error_cb (EClientCache *client_cache, + EClient *client, + EAlert *alert, + ETaskShellView *task_shell_view) +{ + ETaskShellContent *task_shell_content; + ESource *source; + const gchar *extension_name; + + task_shell_content = task_shell_view->priv->task_shell_content; + + source = e_client_get_source (client); + extension_name = E_SOURCE_EXTENSION_TASK_LIST; + + /* Only submit alerts from task list backends. */ + if (e_source_has_extension (source, extension_name)) { + EAlertSink *alert_sink; + + alert_sink = E_ALERT_SINK (task_shell_content); + e_alert_sink_submit_alert (alert_sink, alert); + } +} + +static void task_shell_view_load_view_collection (EShellViewClass *shell_view_class) { GalViewCollection *collection; @@ -235,16 +259,17 @@ e_task_shell_view_private_constructed (ETaskShellView *task_shell_view) ETaskShellViewPrivate *priv = task_shell_view->priv; ETaskShellContent *task_shell_content; ETaskShellSidebar *task_shell_sidebar; - EShell *shell; - EShellView *shell_view; + EShellSettings *shell_settings; EShellBackend *shell_backend; EShellContent *shell_content; EShellSidebar *shell_sidebar; - EShellSettings *shell_settings; EShellWindow *shell_window; + EShellView *shell_view; + EShell *shell; ETaskTable *task_table; ECalModel *model; ESourceSelector *selector; + gulong handler_id; shell_view = E_SHELL_VIEW (task_shell_view); shell_backend = e_shell_view_get_shell_backend (shell_view); @@ -270,6 +295,16 @@ e_task_shell_view_private_constructed (ETaskShellView *task_shell_view) task_shell_sidebar = E_TASK_SHELL_SIDEBAR (shell_sidebar); selector = e_task_shell_sidebar_get_selector (task_shell_sidebar); + /* Keep our own reference to this so we can + * disconnect our signal handler in dispose(). */ + priv->client_cache = g_object_ref (e_shell_get_client_cache (shell)); + + handler_id = g_signal_connect ( + priv->client_cache, "backend-error", + G_CALLBACK (task_shell_view_backend_error_cb), + task_shell_view); + priv->backend_error_handler_id = handler_id; + g_signal_connect_object ( model, "notify::timezone", G_CALLBACK (e_task_shell_view_update_timezone), @@ -395,10 +430,19 @@ e_task_shell_view_private_dispose (ETaskShellView *task_shell_view) { ETaskShellViewPrivate *priv = task_shell_view->priv; + if (priv->backend_error_handler_id > 0) { + g_signal_handler_disconnect ( + priv->client_cache, + priv->backend_error_handler_id); + priv->backend_error_handler_id = 0; + } + g_clear_object (&priv->task_shell_backend); g_clear_object (&priv->task_shell_content); g_clear_object (&priv->task_shell_sidebar); + g_clear_object (&priv->client_cache); + if (task_shell_view->priv->activity != NULL) { /* XXX Activity is not cancellable. */ e_activity_set_state ( diff --git a/modules/calendar/e-task-shell-view-private.h b/modules/calendar/e-task-shell-view-private.h index c0a38b73d4..14cb4c50a2 100644 --- a/modules/calendar/e-task-shell-view-private.h +++ b/modules/calendar/e-task-shell-view-private.h @@ -86,6 +86,9 @@ struct _ETaskShellViewPrivate { ETaskShellContent *task_shell_content; ETaskShellSidebar *task_shell_sidebar; + EClientCache *client_cache; + gulong backend_error_handler_id; + EActivity *activity; guint update_timeout; guint update_completed_timeout; |