Blob Blame History Raw
diff -up evolution-3.8.5/modules/calendar/e-cal-shell-sidebar.c.cal-source-remove evolution-3.8.5/modules/calendar/e-cal-shell-sidebar.c
--- evolution-3.8.5/modules/calendar/e-cal-shell-sidebar.c.cal-source-remove	2014-12-05 11:04:35.184193529 +0100
+++ evolution-3.8.5/modules/calendar/e-cal-shell-sidebar.c	2014-12-05 11:04:35.454191152 +0100
@@ -23,14 +23,15 @@
 #include <config.h>
 #endif
 
-#include "e-cal-shell-sidebar.h"
-
 #include <string.h>
 #include <glib/gi18n.h>
 
 #include "calendar/gui/e-calendar-selector.h"
 #include "calendar/gui/misc.h"
 
+#include "e-cal-shell-content.h"
+#include "e-cal-shell-sidebar.h"
+
 #define E_CAL_SHELL_SIDEBAR_GET_PRIVATE(obj) \
 	(G_TYPE_INSTANCE_GET_PRIVATE \
 	((obj), E_TYPE_CAL_SHELL_SIDEBAR, ECalShellSidebarPrivate))
@@ -883,8 +884,29 @@ e_cal_shell_sidebar_remove_source (ECalS
 
 	selector = e_cal_shell_sidebar_get_selector (cal_shell_sidebar);
 
-	client = e_client_selector_ref_cached_client (
-		E_CLIENT_SELECTOR (selector), source);
+	client = e_client_selector_ref_cached_client (E_CLIENT_SELECTOR (selector), source);
+	if (!client) {
+		EShellView *shell_view;
+		EShellContent *shell_content;
+		ECalModel *model;
+		GList *clients, *link;
+
+		shell_view = e_shell_sidebar_get_shell_view (E_SHELL_SIDEBAR (cal_shell_sidebar));
+		shell_content = e_shell_view_get_shell_content (shell_view);
+		model = e_cal_shell_content_get_model (E_CAL_SHELL_CONTENT (shell_content));
+
+		clients = e_cal_model_list_clients (model);
+		for (link = clients; link; link = g_list_next (link)) {
+			EClient *adept = link->data;
+
+			if (adept && g_strcmp0 (e_source_get_uid (source), e_source_get_uid (e_client_get_source (adept))) == 0) {
+				client = g_object_ref (adept);
+				break;
+			}
+		}
+
+		g_list_free_full (clients, g_object_unref);
+	}
 
 	if (client != NULL) {
 		cal_shell_sidebar_emit_client_removed (
diff -up evolution-3.8.5/modules/calendar/e-memo-shell-sidebar.c.cal-source-remove evolution-3.8.5/modules/calendar/e-memo-shell-sidebar.c
--- evolution-3.8.5/modules/calendar/e-memo-shell-sidebar.c.cal-source-remove	2014-12-05 11:04:35.185193520 +0100
+++ evolution-3.8.5/modules/calendar/e-memo-shell-sidebar.c	2014-12-05 11:04:35.454191152 +0100
@@ -23,8 +23,6 @@
 #include <config.h>
 #endif
 
-#include "e-memo-shell-sidebar.h"
-
 #include <string.h>
 #include <glib/gi18n.h>
 
@@ -32,6 +30,9 @@
 #include "calendar/gui/e-memo-list-selector.h"
 #include "calendar/gui/misc.h"
 
+#include "e-memo-shell-content.h"
+#include "e-memo-shell-sidebar.h"
+
 #define E_MEMO_SHELL_SIDEBAR_GET_PRIVATE(obj) \
 	(G_TYPE_INSTANCE_GET_PRIVATE \
 	((obj), E_TYPE_MEMO_SHELL_SIDEBAR, EMemoShellSidebarPrivate))
@@ -766,8 +767,29 @@ e_memo_shell_sidebar_remove_source (EMem
 
 	selector = e_memo_shell_sidebar_get_selector (memo_shell_sidebar);
 
-	client = e_client_selector_ref_cached_client (
-		E_CLIENT_SELECTOR (selector), source);
+	client = e_client_selector_ref_cached_client (E_CLIENT_SELECTOR (selector), source);
+	if (!client) {
+		EShellView *shell_view;
+		EShellContent *shell_content;
+		ECalModel *model;
+		GList *clients, *link;
+
+		shell_view = e_shell_sidebar_get_shell_view (E_SHELL_SIDEBAR (memo_shell_sidebar));
+		shell_content = e_shell_view_get_shell_content (shell_view);
+		model = e_memo_shell_content_get_memo_model (E_MEMO_SHELL_CONTENT (shell_content));
+
+		clients = e_cal_model_list_clients (model);
+		for (link = clients; link; link = g_list_next (link)) {
+			EClient *adept = link->data;
+
+			if (adept && g_strcmp0 (e_source_get_uid (source), e_source_get_uid (e_client_get_source (adept))) == 0) {
+				client = g_object_ref (adept);
+				break;
+			}
+		}
+
+		g_list_free_full (clients, g_object_unref);
+	}
 
 	if (client != NULL) {
 		memo_shell_sidebar_emit_client_removed (
diff -up evolution-3.8.5/modules/calendar/e-task-shell-sidebar.c.cal-source-remove evolution-3.8.5/modules/calendar/e-task-shell-sidebar.c
--- evolution-3.8.5/modules/calendar/e-task-shell-sidebar.c.cal-source-remove	2014-12-05 11:04:35.185193520 +0100
+++ evolution-3.8.5/modules/calendar/e-task-shell-sidebar.c	2014-12-05 11:04:35.454191152 +0100
@@ -23,8 +23,6 @@
 #include <config.h>
 #endif
 
-#include "e-task-shell-sidebar.h"
-
 #include <string.h>
 #include <glib/gi18n.h>
 
@@ -32,6 +30,9 @@
 #include "calendar/gui/e-task-list-selector.h"
 #include "calendar/gui/misc.h"
 
+#include "e-task-shell-content.h"
+#include "e-task-shell-sidebar.h"
+
 #define E_TASK_SHELL_SIDEBAR_GET_PRIVATE(obj) \
 	(G_TYPE_INSTANCE_GET_PRIVATE \
 	((obj), E_TYPE_TASK_SHELL_SIDEBAR, ETaskShellSidebarPrivate))
@@ -766,8 +767,29 @@ e_task_shell_sidebar_remove_source (ETas
 
 	selector = e_task_shell_sidebar_get_selector (task_shell_sidebar);
 
-	client = e_client_selector_ref_cached_client (
-		E_CLIENT_SELECTOR (selector), source);
+	client = e_client_selector_ref_cached_client (E_CLIENT_SELECTOR (selector), source);
+	if (!client) {
+		EShellView *shell_view;
+		EShellContent *shell_content;
+		ECalModel *model;
+		GList *clients, *link;
+
+		shell_view = e_shell_sidebar_get_shell_view (E_SHELL_SIDEBAR (task_shell_sidebar));
+		shell_content = e_shell_view_get_shell_content (shell_view);
+		model = e_task_shell_content_get_task_model (E_TASK_SHELL_CONTENT (shell_content));
+
+		clients = e_cal_model_list_clients (model);
+		for (link = clients; link; link = g_list_next (link)) {
+			EClient *adept = link->data;
+
+			if (adept && g_strcmp0 (e_source_get_uid (source), e_source_get_uid (e_client_get_source (adept))) == 0) {
+				client = g_object_ref (adept);
+				break;
+			}
+		}
+
+		g_list_free_full (clients, g_object_unref);
+	}
 
 	if (client != NULL) {
 		task_shell_sidebar_emit_client_removed (