[Pkg-owncloud-commits] [owncloud-client] 05/175: shell_integration on OSX: Remove dead code
Sandro Knauß
hefee-guest at moszumanska.debian.org
Sat Aug 8 10:36:20 UTC 2015
This is an automated email from the git hooks/post-receive script.
hefee-guest pushed a commit to branch master
in repository owncloud-client.
commit 04d820f9cf17fa841bc48ac4c6046ba3a4afa0ae
Author: Jocelyn Turcotte <jturcotte at woboq.com>
Date: Wed May 6 12:49:04 2015 +0200
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.
---
.../MacOSX/OwnCloudFinder/ContentManager.h | 3 +-
.../MacOSX/OwnCloudFinder/ContentManager.m | 53 ++++------------------
.../MacOSX/OwnCloudFinder/RequestManager.h | 2 +-
.../MacOSX/OwnCloudFinder/RequestManager.m | 12 ++---
4 files changed, 13 insertions(+), 57 deletions(-)
diff --git a/shell_integration/MacOSX/OwnCloudFinder/ContentManager.h b/shell_integration/MacOSX/OwnCloudFinder/ContentManager.h
index 2de92bc..31d26db 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 5ef4efe..941390d 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 99436dc..130c885 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 888b4d5..52f5d9f 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];
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git
More information about the Pkg-owncloud-commits
mailing list