[evolution/gnome-41] Calendar: Not all task lists included in the task panel



commit f4a6d99f76c6f27a17c731162810f562df62c440
Author: Milan Crha <mcrha redhat com>
Date:   Mon Nov 15 13:29:38 2021 +0100

    Calendar: Not all task lists included in the task panel
    
    This could happen when the Evolution had been started in the Tasks view
    and then switched to the Calendar view, the task panel was left empty.
    It was because all the task lists had been opened already, thus none
    emitted the "client-opened" signal, thus the related data model did
    not have added the clients.
    
    This applies to the memos panel as well.

 src/modules/calendar/e-cal-base-shell-sidebar.c |  2 +-
 src/modules/calendar/e-cal-shell-content.c      | 17 +++++++++++++++++
 2 files changed, 18 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 978e8c540d..1a430d219b 100644
--- a/src/modules/calendar/e-cal-base-shell-sidebar.c
+++ b/src/modules/calendar/e-cal-base-shell-sidebar.c
@@ -312,7 +312,7 @@ open_client_data_free (gpointer pdata)
        OpenClientData *data = pdata;
 
        if (data) {
-               if (data->cb || !data->client) {
+               if (!data->client || (data->cb && g_hash_table_lookup (data->sidebar->priv->selected_uids, 
e_source_get_uid (data->source)))) {
                        g_hash_table_remove (data->sidebar->priv->selected_uids, e_source_get_uid 
(data->source));
                } else {
                        /* To free the cancellable in the 'value' pair, which is useless now */
diff --git a/src/modules/calendar/e-cal-shell-content.c b/src/modules/calendar/e-cal-shell-content.c
index be31341e39..abcdee08e1 100644
--- a/src/modules/calendar/e-cal-shell-content.c
+++ b/src/modules/calendar/e-cal-shell-content.c
@@ -1399,6 +1399,7 @@ cal_shell_content_setup_foreign_sources (EShellWindow *shell_window,
        EShellContent *foreign_content;
        EShellView *foreign_view;
        ECalModel *foreign_model;
+       GList *clients;
        gboolean is_new_view;
 
        g_return_if_fail (E_IS_SHELL_WINDOW (shell_window));
@@ -1444,6 +1445,22 @@ cal_shell_content_setup_foreign_sources (EShellWindow *shell_window,
        g_signal_connect_object (model, "row-appended",
                G_CALLBACK (e_cal_base_shell_view_model_row_appended), foreign_view, G_CONNECT_SWAPPED);
 
+       /* Add clients already opened in the foreign view */
+       clients = e_cal_data_model_get_clients (e_cal_model_get_data_model (foreign_model));
+       if (clients) {
+               ECalDataModel *data_model;
+               GList *link;
+
+               data_model = e_cal_model_get_data_model (model);
+
+               for (link = clients; link; link = g_list_next (link)) {
+                       ECalClient *client = link->data;
+                       e_cal_data_model_add_client (data_model, client);
+               }
+
+               g_list_free_full (clients, g_object_unref);
+       }
+
        /* This makes sure that the local models for memos and tasks
           in the calendar view get populated with the same sources
           as those in the respective views. */


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