[Pkg-owncloud-commits] [owncloud-client] 92/219: OS X: Overlay Icons: Load from bundle-specific path
Sandro Knauß
hefee-guest at moszumanska.debian.org
Sat Oct 11 14:43:14 UTC 2014
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 2fddf05515de3850b350ba094d322b452f41d2e6
Author: Markus Goetz <markus at woboq.com>
Date: Fri Sep 12 15:06:51 2014 +0200
OS X: Overlay Icons: Load from bundle-specific path
The client (in this case mirall) tells the Finder plugin where to get the icons.
This enables installation in different locations and in branded clients.
---
.../MacOSX/OwnCloudFinder/ContentManager.h | 2 ++
.../MacOSX/OwnCloudFinder/ContentManager.m | 33 +++++++++++++---------
.../MacOSX/OwnCloudFinder/RequestManager.m | 3 ++
src/mirall/socketapi.cpp | 11 ++++++++
4 files changed, 36 insertions(+), 13 deletions(-)
diff --git a/shell_integration/MacOSX/OwnCloudFinder/ContentManager.h b/shell_integration/MacOSX/OwnCloudFinder/ContentManager.h
index 841d60f..2de92bc 100644
--- a/shell_integration/MacOSX/OwnCloudFinder/ContentManager.h
+++ b/shell_integration/MacOSX/OwnCloudFinder/ContentManager.h
@@ -42,4 +42,6 @@
- (void)reFetchFileNameCacheForPath:(NSString*)path;
- (void)repaintAllWindows;
+- (void)loadIconResourcePath:(NSString*)path;
+
@end
\ No newline at end of file
diff --git a/shell_integration/MacOSX/OwnCloudFinder/ContentManager.m b/shell_integration/MacOSX/OwnCloudFinder/ContentManager.m
index 26b320f..5fd17de 100644
--- a/shell_integration/MacOSX/OwnCloudFinder/ContentManager.m
+++ b/shell_integration/MacOSX/OwnCloudFinder/ContentManager.m
@@ -32,19 +32,6 @@ static ContentManager* sharedInstance = nil;
_fileNamesCache = [[NSMutableDictionary alloc] init];
_fileIconsEnabled = TRUE;
_hasChangedContent = TRUE;
-
- NSString *base = @"/Applications/owncloud.app/Contents/Resources/icons/";
-
- _icnOk = [[IconCache sharedInstance] registerIcon:[base stringByAppendingString:@"ok.icns"]];
- _icnSync = [[IconCache sharedInstance] registerIcon:[base stringByAppendingString:@"sync.icns"]];
- _icnWarn = [[IconCache sharedInstance] registerIcon:[base stringByAppendingString:@"warning.icns"]];
- _icnErr = [[IconCache sharedInstance] registerIcon:[base stringByAppendingString:@"error.icns"]];
- _icnOkSwm = [[IconCache sharedInstance] registerIcon:[base stringByAppendingString:@"ok_swm.icns"]];
- _icnSyncSwm = [[IconCache sharedInstance] registerIcon:[base stringByAppendingString:@"sync_swm.icns"]];
- _icnWarnSwm = [[IconCache sharedInstance] registerIcon:[base stringByAppendingString:@"warning_swm.icns"]];
- _icnErrSwm = [[IconCache sharedInstance] registerIcon:[base stringByAppendingString:@"error_swm.icns"]];
-
- NSLog(@"Icon ok identifier: %d", [_icnOk intValue]);
}
return self;
@@ -72,6 +59,22 @@ static ContentManager* sharedInstance = nil;
return sharedInstance;
}
+- (void)loadIconResourcePath:(NSString*)path
+{
+ NSString *base = path;
+
+ _icnOk = [[IconCache sharedInstance] registerIcon:[base stringByAppendingString:@"ok.icns"]];
+ _icnSync = [[IconCache sharedInstance] registerIcon:[base stringByAppendingString:@"sync.icns"]];
+ _icnWarn = [[IconCache sharedInstance] registerIcon:[base stringByAppendingString:@"warning.icns"]];
+ _icnErr = [[IconCache sharedInstance] registerIcon:[base stringByAppendingString:@"error.icns"]];
+ _icnOkSwm = [[IconCache sharedInstance] registerIcon:[base stringByAppendingString:@"ok_swm.icns"]];
+ _icnSyncSwm = [[IconCache sharedInstance] registerIcon:[base stringByAppendingString:@"sync_swm.icns"]];
+ _icnWarnSwm = [[IconCache sharedInstance] registerIcon:[base stringByAppendingString:@"warning_swm.icns"]];
+ _icnErrSwm = [[IconCache sharedInstance] registerIcon:[base stringByAppendingString:@"error_swm.icns"]];
+
+ NSLog(@"Icon ok identifier: %d from %@", [_icnOk intValue], [base stringByAppendingString:@"ok.icns"]);
+}
+
- (void)enableFileIcons:(BOOL)enable
{
_fileIconsEnabled = enable;
@@ -81,6 +84,10 @@ static ContentManager* sharedInstance = nil;
- (void)setResultForPath:(NSString*)path result:(NSString*)result
{
+ if (_icnOk == nil) {
+ // no icon resource path registered yet
+ return;
+ }
NSNumber *res;
res = [NSNumber numberWithInt:0];
diff --git a/shell_integration/MacOSX/OwnCloudFinder/RequestManager.m b/shell_integration/MacOSX/OwnCloudFinder/RequestManager.m
index 2b720b0..cc139c6 100644
--- a/shell_integration/MacOSX/OwnCloudFinder/RequestManager.m
+++ b/shell_integration/MacOSX/OwnCloudFinder/RequestManager.m
@@ -149,6 +149,9 @@ static RequestManager* sharedInstance = nil;
[_registeredPathes removeObjectForKey:path];
[contentman repaintAllWindows];
+ } else if( [[chunks objectAtIndex:0 ] isEqualToString:@"ICON_PATH"] ) {
+ NSString *path = [chunks objectAtIndex:1];
+ [[ContentManager sharedInstance] loadIconResourcePath:path];
} else {
NSLog(@"Unknown command %@", [chunks objectAtIndex:0]);
}
diff --git a/src/mirall/socketapi.cpp b/src/mirall/socketapi.cpp
index bb86ae6..aec40e2 100644
--- a/src/mirall/socketapi.cpp
+++ b/src/mirall/socketapi.cpp
@@ -246,6 +246,17 @@ void SocketApi::slotNewConnection()
_listeners.append(socket);
+#ifdef Q_OS_MAC
+ // We want to tell our location so it can load the icons
+ // e.g. "/Users/guruz/woboq/owncloud/client/buildmirall/owncloud.app/Contents/MacOS/"
+ QString iconPath = qApp->applicationDirPath() + "/../Resources/icons/";
+ if (!QDir(iconPath).exists()) {
+ DEBUG << "Icon path " << iconPath << " does not exist, did you forget make install?";
+ }
+ broadcastMessage(QLatin1String("ICON_PATH"), iconPath );
+#endif
+
+
foreach( QString alias, FolderMan::instance()->map().keys() ) {
slotRegisterPath(alias);
}
--
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