Blame SOURCES/evolution-3.8.5-cal-source-remove.patch

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