[evolution] I#139 - Deselects task/memo list when started in Calendar view



commit 04ae14d55aa09dfe2ee21ed608265b20ddac3f4e
Author: Milan Crha <mcrha redhat com>
Date:   Mon Oct 1 11:47:02 2018 +0200

    I#139 - Deselects task/memo list when started in Calendar view
    
    Closes https://gitlab.gnome.org/GNOME/evolution/issues/139

 src/modules/calendar/e-cal-base-shell-sidebar.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
---
diff --git a/src/modules/calendar/e-cal-base-shell-sidebar.c b/src/modules/calendar/e-cal-base-shell-sidebar.c
index 7d181a6961..a0aabc40ac 100644
--- a/src/modules/calendar/e-cal-base-shell-sidebar.c
+++ b/src/modules/calendar/e-cal-base-shell-sidebar.c
@@ -301,6 +301,7 @@ typedef struct _OpenClientData {
        ECalBaseShellSidebar *sidebar;
        ESource *source;
        EClient *client;
+       gboolean was_cancelled;
 } OpenClientData;
 
 static void
@@ -309,9 +310,14 @@ open_client_data_free (gpointer pdata)
        OpenClientData *data = pdata;
 
        if (data) {
+               /* To free the cancellable in the 'value' pair, which is useless now */
+               g_hash_table_insert (data->sidebar->priv->selected_uids,
+                       g_strdup (e_source_get_uid (data->source)),
+                       NULL);
+
                if (data->client) {
                        g_signal_emit (data->sidebar, signals[CLIENT_OPENED], 0, data->client);
-               } else {
+               } else if (!data->was_cancelled) {
                        ESourceSelector *selector = e_cal_base_shell_sidebar_get_selector (data->sidebar);
                        e_source_selector_unselect_source (selector, data->source);
                }
@@ -338,6 +344,7 @@ e_cal_base_shell_sidebar_open_client_thread (EAlertSinkThreadJobData *job_data,
        selector = E_CLIENT_SELECTOR (e_cal_base_shell_sidebar_get_selector (data->sidebar));
        data->client = e_client_selector_get_client_sync (
                selector, data->source, TRUE, (guint32) -1, cancellable, &local_error);
+       data->was_cancelled = g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_CANCELLED);
 
        e_util_propagate_open_source_job_error (job_data, data->extension_name, local_error, error);
 }
@@ -355,6 +362,10 @@ e_cal_base_shell_sidebar_ensure_source_opened (ECalBaseShellSidebar *sidebar,
        g_return_if_fail (E_IS_CAL_BASE_SHELL_SIDEBAR (sidebar));
        g_return_if_fail (E_IS_SOURCE (source));
 
+       /* Skip it when it's already opening or opened */
+       if (g_hash_table_contains (sidebar->priv->selected_uids, e_source_get_uid (source)))
+               return;
+
        shell_view = e_shell_sidebar_get_shell_view (E_SHELL_SIDEBAR (sidebar));
 
        switch (e_cal_base_shell_view_get_source_type (shell_view)) {


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