Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/owncloud/client.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJocelyn Turcotte <jturcotte@woboq.com>2015-05-06 13:49:04 +0300
committerJocelyn Turcotte <jturcotte@woboq.com>2015-05-06 17:56:50 +0300
commit04d820f9cf17fa841bc48ac4c6046ba3a4afa0ae (patch)
tree4a794e80fa2a1ac16c1bd50dd26f4297491156d6 /shell_integration/MacOSX
parent931dd598443390c3897243314207aa6be7a1347c (diff)
shell_integration on OSX: Remove dead code
removeIcons isn't called and clearFileNameCacheForPath was always called with a "nil" path. Remove the return value of askForIcon which was always 0, and use that value explicitly at the only call site. Remove the "-1" code path in iconByPath since setIcons prevents -1 from getting into _fileNamesCache in all cases.
Diffstat (limited to 'shell_integration/MacOSX')
-rw-r--r--shell_integration/MacOSX/OwnCloudFinder/ContentManager.h3
-rw-r--r--shell_integration/MacOSX/OwnCloudFinder/ContentManager.m53
-rw-r--r--shell_integration/MacOSX/OwnCloudFinder/RequestManager.h2
-rw-r--r--shell_integration/MacOSX/OwnCloudFinder/RequestManager.m12
4 files changed, 13 insertions, 57 deletions
diff --git a/shell_integration/MacOSX/OwnCloudFinder/ContentManager.h b/shell_integration/MacOSX/OwnCloudFinder/ContentManager.h
index 2de92bc16..31d26dbf2 100644
--- a/shell_integration/MacOSX/OwnCloudFinder/ContentManager.h
+++ b/shell_integration/MacOSX/OwnCloudFinder/ContentManager.h
@@ -35,10 +35,9 @@
- (void)enableFileIcons:(BOOL)enable;
- (NSNumber*)iconByPath:(NSString*)path isDirectory:(BOOL)isDir;
- (void)removeAllIcons;
-- (void)removeIcons:(NSArray*)paths;
- (void)setIcons:(NSDictionary*)iconDictionary filterByFolder:(NSString*)filterFolder;
- (void)setResultForPath:(NSString*)path result:(NSString*)result;
-- (void)clearFileNameCacheForPath:(NSString*)path;
+- (void)clearFileNameCache;
- (void)reFetchFileNameCacheForPath:(NSString*)path;
- (void)repaintAllWindows;
diff --git a/shell_integration/MacOSX/OwnCloudFinder/ContentManager.m b/shell_integration/MacOSX/OwnCloudFinder/ContentManager.m
index 5ef4efee1..941390ded 100644
--- a/shell_integration/MacOSX/OwnCloudFinder/ContentManager.m
+++ b/shell_integration/MacOSX/OwnCloudFinder/ContentManager.m
@@ -148,46 +148,21 @@ static ContentManager* sharedInstance = nil;
if( result == nil ) {
// start the async call
- NSNumber *askState = [[RequestManager sharedInstance] askForIcon:normalizedPath isDirectory:isDir];
- [_fileNamesCache setObject:askState forKey:normalizedPath];
-
- result = [NSNumber numberWithInt:0];
- } else if( [result intValue] == -1 ) {
- // the socket call is underways.
+ [[RequestManager sharedInstance] askForIcon:normalizedPath isDirectory:isDir];
result = [NSNumber numberWithInt:0];
- } else {
- // there is a proper icon index
+ // Set 0 into the cache, meaning "don't have an icon, but already requested it"
+ [_fileNamesCache setObject:result forKey:normalizedPath];
}
- // NSLog(@"iconByPath return value %d", [result intValue]);
+ // NSLog(@"iconByPath return value %d", [result intValue]);
return result;
}
-// called as a result of an UPDATE_VIEW message.
-// it clears the entries from the hash to make it call again home to the desktop client.
-- (void)clearFileNameCacheForPath:(NSString*)path
+// Clears the entries from the hash to make it call again home to the desktop client.
+- (void)clearFileNameCache
{
- //NSLog(@"%@", NSStringFromSelector(_cmd));
- NSMutableArray *keysToDelete = [NSMutableArray array];
-
- if( path != nil ) {
- for (id p in [_fileNamesCache keyEnumerator]) {
- //do stuff with obj
- if ( [p hasPrefix:path] ) {
- [keysToDelete addObject:p];
- }
- }
- } else {
- // clear the entire fileNameCache
- [_fileNamesCache release];
- _fileNamesCache = [[NSMutableDictionary alloc] init];
- return;
- }
-
- if( [keysToDelete count] > 0 ) {
- NSLog( @"Entries to delete: %lu", (unsigned long)[keysToDelete count]);
- [_fileNamesCache removeObjectsForKeys:keysToDelete];
- }
+ [_fileNamesCache release];
+ _fileNamesCache = [[NSMutableDictionary alloc] init];
}
- (void)reFetchFileNameCacheForPath:(NSString*)path
@@ -218,18 +193,6 @@ static ContentManager* sharedInstance = nil;
[self repaintAllWindows];
}
-- (void)removeIcons:(NSArray*)paths
-{
- for (NSString* path in paths)
- {
- NSString* normalizedPath = [path decomposedStringWithCanonicalMapping];
-
- [_fileNamesCache removeObjectForKey:normalizedPath];
- }
-
- [self repaintAllWindows];
-}
-
- (void)repaintAllWindowsIfNeeded
{
if (!_hasChangedContent) {
diff --git a/shell_integration/MacOSX/OwnCloudFinder/RequestManager.h b/shell_integration/MacOSX/OwnCloudFinder/RequestManager.h
index 99436dcb5..130c885c6 100644
--- a/shell_integration/MacOSX/OwnCloudFinder/RequestManager.h
+++ b/shell_integration/MacOSX/OwnCloudFinder/RequestManager.h
@@ -34,7 +34,7 @@
- (BOOL)isRegisteredPath:(NSString*)path isDirectory:(BOOL)isDir;
- (void)askOnSocket:(NSString*)path query:(NSString*)verb;
-- (NSNumber*)askForIcon:(NSString*)path isDirectory:(BOOL)isDir;
+- (void)askForIcon:(NSString*)path isDirectory:(BOOL)isDir;
- (void)menuItemClicked:(NSDictionary*)actionDictionary;
- (void)start;
diff --git a/shell_integration/MacOSX/OwnCloudFinder/RequestManager.m b/shell_integration/MacOSX/OwnCloudFinder/RequestManager.m
index 888b4d5d7..52f5d9f54 100644
--- a/shell_integration/MacOSX/OwnCloudFinder/RequestManager.m
+++ b/shell_integration/MacOSX/OwnCloudFinder/RequestManager.m
@@ -101,10 +101,9 @@ static RequestManager* sharedInstance = nil;
return registered;
}
-- (NSNumber*)askForIcon:(NSString*)path isDirectory:(BOOL)isDir
+- (void)askForIcon:(NSString*)path isDirectory:(BOOL)isDir
{
NSString *verb = @"RETRIEVE_FILE_STATUS";
- NSNumber *res = [NSNumber numberWithInt:0];
if( [self isRegisteredPath:path isDirectory:isDir] ) {
if( _isConnected ) {
@@ -113,16 +112,11 @@ static RequestManager* sharedInstance = nil;
}
[self askOnSocket:path query:verb];
-
- NSNumber *res_minus_one = [NSNumber numberWithInt:0];
-
- return res_minus_one;
} else {
[_requestQueue addObject:path];
[self start]; // try again to connect
}
}
- return res;
}
@@ -201,7 +195,7 @@ static RequestManager* sharedInstance = nil;
}
ContentManager *contentman = [ContentManager sharedInstance];
- [contentman clearFileNameCacheForPath:nil];
+ [contentman clearFileNameCache];
[contentman repaintAllWindows];
// Read for the UPDATE_VIEW requests
@@ -221,7 +215,7 @@ static RequestManager* sharedInstance = nil;
// clear the caches in conent manager
ContentManager *contentman = [ContentManager sharedInstance];
- [contentman clearFileNameCacheForPath:nil];
+ [contentman clearFileNameCache];
[contentman repaintAllWindows];
}