From 488e8af816d35b8e382e29e898444608e63636ce Mon Sep 17 00:00:00 2001 From: Miltiadis Vasilakis Date: Thu, 5 Apr 2012 13:26:19 +0300 Subject: [PATCH 1/1] Do not allow sync for account containers that clash with "shared to me". --- pithos-macos/PithosAccount.m | 7 ++++--- pithos-macos/PithosPreferencesController.m | 9 +++++++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/pithos-macos/PithosAccount.m b/pithos-macos/PithosAccount.m index 61a5093..c149f32 100644 --- a/pithos-macos/PithosAccount.m +++ b/pithos-macos/PithosAccount.m @@ -188,7 +188,7 @@ if (aSyncAccountsDictionary && ![self.syncAccountsDictionary isEqualToDictionary:aSyncAccountsDictionary]) { [syncAccountsDictionary release]; syncAccountsDictionary = [aSyncAccountsDictionary retain]; - // XXX maybe check also here the validity of the dictionary? + // Validity of the dictionary is checked when loading from user defaults, and when modified in preferences @synchronized(self) { resetSyncDaemonLocalState = YES; @@ -451,8 +451,9 @@ NSDictionary *immutableContainersDictionary = [immutableAccountsDictionary objectForKey:accountName]; NSMutableDictionary *syncContainersDictionary = [NSMutableDictionary dictionary]; for (NSString *containerName in [immutableAccountsDictionary objectForKey:accountName]) { - [syncContainersDictionary setObject:[NSMutableArray arrayWithArray:[immutableContainersDictionary objectForKey:containerName]] - forKey:containerName]; + if (![accountName isEqualToString:@""] || ![[containerName lowercaseString] isEqualToString:@"shared to me"]) + [syncContainersDictionary setObject:[NSMutableArray arrayWithArray:[immutableContainersDictionary objectForKey:containerName]] + forKey:containerName]; } if ([syncContainersDictionary count]) [syncAccountsDictionary setObject:syncContainersDictionary forKey:accountName]; diff --git a/pithos-macos/PithosPreferencesController.m b/pithos-macos/PithosPreferencesController.m index b37c17e..bc2fa33 100644 --- a/pithos-macos/PithosPreferencesController.m +++ b/pithos-macos/PithosPreferencesController.m @@ -233,8 +233,9 @@ NSDictionary *aSyncContainersDictionary = [aSyncAccountsDictionary objectForKey:accountName]; NSMutableDictionary *syncContainersDictionary = [NSMutableDictionary dictionary]; for (NSString *containerName in aSyncContainersDictionary) { - [syncContainersDictionary setObject:[NSMutableArray arrayWithArray:[aSyncContainersDictionary objectForKey:containerName]] - forKey:containerName]; + if (![accountName isEqualToString:@""] || ![[containerName lowercaseString] isEqualToString:@"shared to me"]) + [syncContainersDictionary setObject:[NSMutableArray arrayWithArray:[aSyncContainersDictionary objectForKey:containerName]] + forKey:containerName]; } if ([syncContainersDictionary count]) [syncAccountsDictionary setObject:syncContainersDictionary forKey:accountName]; @@ -591,6 +592,10 @@ accountName = @""; accountNode = syncAccountsMyAccountNode; } + if ([accountName isEqualToString:@""] && [[node.displayName lowercaseString] isEqualToString:@"shared to me"]) { + [outlineView reloadItem:item]; + return; + } NSMutableDictionary *syncContainersDictionary = [syncAccountsDictionary objectForKey:accountName]; if ((newState == NSOnState) || (newState == NSMixedState)) { if (!syncContainersDictionary) { -- 1.7.10.4