[Pkg-owncloud-commits] [owncloud-client] 179/498: shell_i: Remove the ICON_PATH socket API message #2340

Sandro Knauß hefee-guest at moszumanska.debian.org
Tue Aug 11 14:48:48 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 85938ab1f15c78d86aa80ba1853674810a3afe9e
Author: Jocelyn Turcotte <jturcotte at woboq.com>
Date:   Wed Jun 17 16:08:57 2015 +0200

    shell_i: Remove the ICON_PATH socket API message #2340
    
    It was only used on OS X and couldn't be used by the FinderSync
    extension since that one runs in a sandbox. So use the same system
    to load images in the legacy extension by shipping them in the
    extension bundle instead of the owncloud.app bundle.
    
    This is also given that the legacy extension needs padded icons
    while the FinderSync one needs unpadded icons.
---
 .../MacOSX/OwnCloudFinder/ContentManager.h         |  2 +-
 .../MacOSX/OwnCloudFinder/ContentManager.m         | 27 ++++++------
 .../MacOSX/OwnCloudFinder/IconCache.h              |  4 +-
 .../MacOSX/OwnCloudFinder/IconCache.m              | 50 ++--------------------
 .../OwnCloudFinder.xcodeproj/project.pbxproj       | 38 ++++++++++++++--
 .../MacOSX/OwnCloudFinder/RequestManager.m         |  5 ---
 .../OwnCloudFinderSync/FinderSyncExt/FinderSync.m  |  7 +--
 shell_integration/MacOSX/common/SyncClientProxy.m  |  4 --
 shell_integration/icons/CMakeLists.txt             | 12 ------
 src/gui/socketapi.cpp                              | 10 -----
 10 files changed, 55 insertions(+), 104 deletions(-)

diff --git a/shell_integration/MacOSX/OwnCloudFinder/ContentManager.h b/shell_integration/MacOSX/OwnCloudFinder/ContentManager.h
index a3956ad..763226b 100644
--- a/shell_integration/MacOSX/OwnCloudFinder/ContentManager.h
+++ b/shell_integration/MacOSX/OwnCloudFinder/ContentManager.h
@@ -42,6 +42,6 @@
 - (void)reFetchFileNameCacheForPath:(NSString*)path;
 - (void)repaintAllWindows;
 
-- (void)loadIconResourcePath:(NSString*)path;
+- (void)loadIconResources;
 
 @end
\ No newline at end of file
diff --git a/shell_integration/MacOSX/OwnCloudFinder/ContentManager.m b/shell_integration/MacOSX/OwnCloudFinder/ContentManager.m
index 94d90ef..3a9660d 100644
--- a/shell_integration/MacOSX/OwnCloudFinder/ContentManager.m
+++ b/shell_integration/MacOSX/OwnCloudFinder/ContentManager.m
@@ -33,6 +33,7 @@ static ContentManager* sharedInstance = nil;
 		_oldFileNamesCache = [[NSMutableDictionary alloc] init];
 		_fileIconsEnabled = TRUE;
 		_hasChangedContent = TRUE;
+		[self loadIconResources];
 	}
 
 	return self;
@@ -61,20 +62,20 @@ static ContentManager* sharedInstance = nil;
 	return sharedInstance;
 }
 
-- (void)loadIconResourcePath:(NSString*)path
+- (void)loadIconResources
 {
-	NSString *base = path;
-
-	_icnOk   = [[IconCache sharedInstance] registerIcon:[base stringByAppendingPathComponent:@"ok.icns"]];
-	_icnSync = [[IconCache sharedInstance] registerIcon:[base stringByAppendingPathComponent:@"sync.icns"]];
-	_icnWarn = [[IconCache sharedInstance] registerIcon:[base stringByAppendingPathComponent:@"warning.icns"]];
-	_icnErr  = [[IconCache sharedInstance] registerIcon:[base stringByAppendingPathComponent:@"error.icns"]];
-	_icnOkSwm   = [[IconCache sharedInstance] registerIcon:[base stringByAppendingPathComponent:@"ok_swm.icns"]];
-	_icnSyncSwm = [[IconCache sharedInstance] registerIcon:[base stringByAppendingPathComponent:@"sync_swm.icns"]];
-	_icnWarnSwm = [[IconCache sharedInstance] registerIcon:[base stringByAppendingPathComponent:@"warning_swm.icns"]];
-	_icnErrSwm  = [[IconCache sharedInstance] registerIcon:[base stringByAppendingPathComponent:@"error_swm.icns"]];
-
-	// NSLog(@"Icon ok identifier: %d from %@", [_icnOk intValue], [base stringByAppendingString:@"ok.icns"]);
+	NSBundle *extBundle = [NSBundle bundleForClass:[self class]];
+
+	_icnOk   = [[IconCache sharedInstance] registerIcon:[extBundle imageForResource:@"ok.icns"]];
+	_icnSync = [[IconCache sharedInstance] registerIcon:[extBundle imageForResource:@"sync.icns"]];
+	_icnWarn = [[IconCache sharedInstance] registerIcon:[extBundle imageForResource:@"warning.icns"]];
+	_icnErr  = [[IconCache sharedInstance] registerIcon:[extBundle imageForResource:@"error.icns"]];
+	_icnOkSwm   = [[IconCache sharedInstance] registerIcon:[extBundle imageForResource:@"ok_swm.icns"]];
+	_icnSyncSwm = [[IconCache sharedInstance] registerIcon:[extBundle imageForResource:@"sync_swm.icns"]];
+	_icnWarnSwm = [[IconCache sharedInstance] registerIcon:[extBundle imageForResource:@"warning_swm.icns"]];
+	_icnErrSwm  = [[IconCache sharedInstance] registerIcon:[extBundle imageForResource:@"error_swm.icns"]];
+
+	// NSLog(@"Icon ok: %@ identifier: %d from bundle %@", [extBundle imageForResource:@"ok.icns"], [_icnOk intValue], extBundle);
 }
 
 - (void)enableFileIcons:(BOOL)enable
diff --git a/shell_integration/MacOSX/OwnCloudFinder/IconCache.h b/shell_integration/MacOSX/OwnCloudFinder/IconCache.h
index d07f4d1..1b451d8 100644
--- a/shell_integration/MacOSX/OwnCloudFinder/IconCache.h
+++ b/shell_integration/MacOSX/OwnCloudFinder/IconCache.h
@@ -17,13 +17,11 @@
 @interface IconCache : NSObject {
 	int _currentIconId;
 	NSMutableDictionary* _iconIdDictionary;
-    NSMutableDictionary* _iconPathDictionary;
 }
 
 + (IconCache*)sharedInstance;
 
 - (NSImage*)getIcon:(NSNumber*)iconId;
-- (NSNumber*)registerIcon:(NSString*)path;
-- (void)unregisterIcon:(NSNumber*)iconId;
+- (NSNumber*)registerIcon:(NSImage*)image;
 
 @end
\ No newline at end of file
diff --git a/shell_integration/MacOSX/OwnCloudFinder/IconCache.m b/shell_integration/MacOSX/OwnCloudFinder/IconCache.m
index 3e8cd03..f8370b5 100644
--- a/shell_integration/MacOSX/OwnCloudFinder/IconCache.m
+++ b/shell_integration/MacOSX/OwnCloudFinder/IconCache.m
@@ -25,7 +25,6 @@ static IconCache* sharedInstance = nil;
 	if (self)
 	{
 		_iconIdDictionary = [[NSMutableDictionary alloc] init];
-		_iconPathDictionary = [[NSMutableDictionary alloc] init];
 		_currentIconId = 0;
 	}
 
@@ -35,7 +34,6 @@ static IconCache* sharedInstance = nil;
 - (void)dealloc
 {
 	[_iconIdDictionary release];
-	[_iconPathDictionary release];
 	sharedInstance = nil;
 
 	[super dealloc];
@@ -60,57 +58,15 @@ static IconCache* sharedInstance = nil;
 	return image;
 }
 
-- (NSNumber*)registerIcon:(NSString*)path
+- (NSNumber*)registerIcon:(NSImage*)image
 {
-	if (path == nil)
-	{
-		return [NSNumber numberWithInt:-1];
-	}
-
-	NSImage* image = [[NSImage alloc]initWithContentsOfFile:path];
-
-	if (image == nil)
-	{
-		NSLog(@"%@ Could not load %@", NSStringFromSelector(_cmd), path);
-		return [NSNumber numberWithInt:-1];
-	}
+	_currentIconId++;
 
-	NSNumber* iconId = [_iconPathDictionary objectForKey:path];
-
-	if (iconId == nil)
-	{
-		_currentIconId++;
-
-		iconId = [NSNumber numberWithInt:_currentIconId];
-
-		[_iconPathDictionary setObject:iconId forKey:path];
-	}
+	NSNumber* iconId = [NSNumber numberWithInt:_currentIconId];
 
 	[_iconIdDictionary setObject:image forKey:iconId];
-	[image release];
 
 	return iconId;
 }
 
-- (void)unregisterIcon:(NSNumber*)iconId
-{
-	NSString* path = @"";
-
-	for (NSString* key in _iconPathDictionary)
-	{
-		NSNumber* value = [_iconPathDictionary objectForKey:key];
-
-		if ([value isEqualToNumber:iconId])
-		{
-			path = key;
-
-			break;
-		}
-	}
-
-	[_iconPathDictionary removeObjectForKey:path];
-
-	[_iconIdDictionary removeObjectForKey:iconId];
-}
-
 @end
diff --git a/shell_integration/MacOSX/OwnCloudFinder/OwnCloudFinder.xcodeproj/project.pbxproj b/shell_integration/MacOSX/OwnCloudFinder/OwnCloudFinder.xcodeproj/project.pbxproj
index cd2a61c..d23f229 100644
--- a/shell_integration/MacOSX/OwnCloudFinder/OwnCloudFinder.xcodeproj/project.pbxproj
+++ b/shell_integration/MacOSX/OwnCloudFinder/OwnCloudFinder.xcodeproj/project.pbxproj
@@ -20,6 +20,14 @@
 		8C99F6941622D145002D2135 /* IconCache.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C99F6931622D145002D2135 /* IconCache.m */; };
 		8D576314048677EA00EA77CD /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0AA1909FFE8422F4C02AAC07 /* CoreFoundation.framework */; };
 		8D5B49A804867FD3000E48DA /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 8D5B49A704867FD3000E48DA /* InfoPlist.strings */; };
+		C220057B1B31B04C00A4FB37 /* error_swm.icns in Resources */ = {isa = PBXBuildFile; fileRef = C22005731B31B04C00A4FB37 /* error_swm.icns */; };
+		C220057C1B31B04C00A4FB37 /* error.icns in Resources */ = {isa = PBXBuildFile; fileRef = C22005741B31B04C00A4FB37 /* error.icns */; };
+		C220057D1B31B04C00A4FB37 /* ok_swm.icns in Resources */ = {isa = PBXBuildFile; fileRef = C22005751B31B04C00A4FB37 /* ok_swm.icns */; };
+		C220057E1B31B04C00A4FB37 /* ok.icns in Resources */ = {isa = PBXBuildFile; fileRef = C22005761B31B04C00A4FB37 /* ok.icns */; };
+		C220057F1B31B04C00A4FB37 /* sync_swm.icns in Resources */ = {isa = PBXBuildFile; fileRef = C22005771B31B04C00A4FB37 /* sync_swm.icns */; };
+		C22005801B31B04C00A4FB37 /* sync.icns in Resources */ = {isa = PBXBuildFile; fileRef = C22005781B31B04C00A4FB37 /* sync.icns */; };
+		C22005811B31B04C00A4FB37 /* warning_swm.icns in Resources */ = {isa = PBXBuildFile; fileRef = C22005791B31B04C00A4FB37 /* warning_swm.icns */; };
+		C22005821B31B04C00A4FB37 /* warning.icns in Resources */ = {isa = PBXBuildFile; fileRef = C220057A1B31B04C00A4FB37 /* warning.icns */; };
 		C2B573831B1CD5AE00303B36 /* SyncClientProxy.m in Sources */ = {isa = PBXBuildFile; fileRef = C2B573821B1CD5AE00303B36 /* SyncClientProxy.m */; settings = {COMPILER_FLAGS = "-fobjc-arc"; }; };
 /* End PBXBuildFile section */
 
@@ -48,6 +56,14 @@
 		8C99F6931622D145002D2135 /* IconCache.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IconCache.m; sourceTree = "<group>"; };
 		8D576316048677EA00EA77CD /* SyncStateFinder.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SyncStateFinder.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
 		8D576317048677EA00EA77CD /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
+		C22005731B31B04C00A4FB37 /* error_swm.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; name = error_swm.icns; path = ../../icons/icns/error_swm.icns; sourceTree = "<group>"; };
+		C22005741B31B04C00A4FB37 /* error.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; name = error.icns; path = ../../icons/icns/error.icns; sourceTree = "<group>"; };
+		C22005751B31B04C00A4FB37 /* ok_swm.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; name = ok_swm.icns; path = ../../icons/icns/ok_swm.icns; sourceTree = "<group>"; };
+		C22005761B31B04C00A4FB37 /* ok.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; name = ok.icns; path = ../../icons/icns/ok.icns; sourceTree = "<group>"; };
+		C22005771B31B04C00A4FB37 /* sync_swm.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; name = sync_swm.icns; path = ../../icons/icns/sync_swm.icns; sourceTree = "<group>"; };
+		C22005781B31B04C00A4FB37 /* sync.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; name = sync.icns; path = ../../icons/icns/sync.icns; sourceTree = "<group>"; };
+		C22005791B31B04C00A4FB37 /* warning_swm.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; name = warning_swm.icns; path = ../../icons/icns/warning_swm.icns; sourceTree = "<group>"; };
+		C220057A1B31B04C00A4FB37 /* warning.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; name = warning.icns; path = ../../icons/icns/warning.icns; sourceTree = "<group>"; };
 		C2B573811B1CD5AE00303B36 /* SyncClientProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SyncClientProxy.h; sourceTree = "<group>"; };
 		C2B573821B1CD5AE00303B36 /* SyncClientProxy.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SyncClientProxy.m; sourceTree = "<group>"; };
 /* End PBXFileReference section */
@@ -94,6 +110,14 @@
 		089C167CFE841241C02AAC07 /* Resources */ = {
 			isa = PBXGroup;
 			children = (
+				C22005731B31B04C00A4FB37 /* error_swm.icns */,
+				C22005741B31B04C00A4FB37 /* error.icns */,
+				C22005751B31B04C00A4FB37 /* ok_swm.icns */,
+				C22005761B31B04C00A4FB37 /* ok.icns */,
+				C22005771B31B04C00A4FB37 /* sync_swm.icns */,
+				C22005781B31B04C00A4FB37 /* sync.icns */,
+				C22005791B31B04C00A4FB37 /* warning_swm.icns */,
+				C220057A1B31B04C00A4FB37 /* warning.icns */,
 				8D576317048677EA00EA77CD /* Info.plist */,
 				8D5B49A704867FD3000E48DA /* InfoPlist.strings */,
 			);
@@ -179,7 +203,7 @@
 			attributes = {
 				LastUpgradeCheck = 0460;
 			};
-			buildConfigurationList = 1DEB911E08733D790010E9CD /* Build configuration list for PBXProject "SyncStateFinder" */;
+			buildConfigurationList = 1DEB911E08733D790010E9CD /* Build configuration list for PBXProject "OwnCloudFinder" */;
 			compatibilityVersion = "Xcode 3.2";
 			developmentRegion = English;
 			hasScannedForEncodings = 1;
@@ -189,7 +213,7 @@
 				French,
 				German,
 			);
-			mainGroup = 089C166AFE841209C02AAC07 /* SyncStateFinder` */;
+			mainGroup = 089C166AFE841209C02AAC07 /* SyncStateFinder */;
 			projectDirPath = "";
 			projectRoot = "";
 			targets = (
@@ -203,7 +227,15 @@
 			isa = PBXResourcesBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
+				C220057E1B31B04C00A4FB37 /* ok.icns in Resources */,
+				C22005821B31B04C00A4FB37 /* warning.icns in Resources */,
+				C220057F1B31B04C00A4FB37 /* sync_swm.icns in Resources */,
+				C220057C1B31B04C00A4FB37 /* error.icns in Resources */,
 				8D5B49A804867FD3000E48DA /* InfoPlist.strings in Resources */,
+				C22005801B31B04C00A4FB37 /* sync.icns in Resources */,
+				C220057D1B31B04C00A4FB37 /* ok_swm.icns in Resources */,
+				C220057B1B31B04C00A4FB37 /* error_swm.icns in Resources */,
+				C22005811B31B04C00A4FB37 /* warning_swm.icns in Resources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -318,7 +350,7 @@
 			defaultConfigurationIsVisible = 0;
 			defaultConfigurationName = Release;
 		};
-		1DEB911E08733D790010E9CD /* Build configuration list for PBXProject "SyncStateFinder" */ = {
+		1DEB911E08733D790010E9CD /* Build configuration list for PBXProject "OwnCloudFinder" */ = {
 			isa = XCConfigurationList;
 			buildConfigurations = (
 				1DEB911F08733D790010E9CD /* Debug */,
diff --git a/shell_integration/MacOSX/OwnCloudFinder/RequestManager.m b/shell_integration/MacOSX/OwnCloudFinder/RequestManager.m
index 6d5ae1b..fad2002 100644
--- a/shell_integration/MacOSX/OwnCloudFinder/RequestManager.m
+++ b/shell_integration/MacOSX/OwnCloudFinder/RequestManager.m
@@ -129,11 +129,6 @@ static RequestManager* sharedInstance = nil;
 	_shareMenuTitle = title;
 }
 
-- (void)loadIconResourcePath:(NSString*)path
-{
-	[[ContentManager sharedInstance] loadIconResourcePath:path];
-}
-
 - (void)connectionDidDie
 {
 	// NSLog(@"Socket DISconnected! %@", [err localizedDescription]);
diff --git a/shell_integration/MacOSX/OwnCloudFinderSync/FinderSyncExt/FinderSync.m b/shell_integration/MacOSX/OwnCloudFinderSync/FinderSyncExt/FinderSync.m
index fc4a687..0ffc7c5 100644
--- a/shell_integration/MacOSX/OwnCloudFinderSync/FinderSyncExt/FinderSync.m
+++ b/shell_integration/MacOSX/OwnCloudFinderSync/FinderSyncExt/FinderSync.m
@@ -44,7 +44,7 @@
 	[syncController setBadgeImage:warning label:@"Ignored" forBadgeIdentifier:@"IGNORE+SWM"];
 	[syncController setBadgeImage:error label:@"Error" forBadgeIdentifier:@"ERROR+SWM"];
 	
-	// The Mach post name needs to be prefixed with the code signing Team ID
+	// The Mach port name needs to be prefixed with the code signing Team ID
 	// https://developer.apple.com/library/mac/documentation/Security/Conceptual/AppSandboxDesignGuide/AppSandboxInDepth/AppSandboxInDepth.html#//apple_ref/doc/uid/TP40011183-CH3-SW24
 	NSString *serverName = [[teamIdentifierPrefix stringByAppendingString:[extBundle bundleIdentifier]]
 		stringByReplacingOccurrencesOfString:@".FinderSyncExt" withString:@".socketApi"];
@@ -148,11 +148,6 @@
 	_shareMenuTitle = title;
 }
 
-- (void)loadIconResourcePath:(NSString*)path
-{
-#pragma unused(path)
-}
-
 - (void)connectionDidDie
 {
 	_shareMenuTitle = nil;
diff --git a/shell_integration/MacOSX/common/SyncClientProxy.m b/shell_integration/MacOSX/common/SyncClientProxy.m
index aab9b75..b801e00 100644
--- a/shell_integration/MacOSX/common/SyncClientProxy.m
+++ b/shell_integration/MacOSX/common/SyncClientProxy.m
@@ -119,10 +119,6 @@
 	} else if( [[chunks objectAtIndex:0 ] isEqualToString:@"UNREGISTER_PATH"] ) {
 		NSString *path = [chunks objectAtIndex:1];
 		[_delegate unregisterPath:path];
-	} else if( [[chunks objectAtIndex:0 ] isEqualToString:@"ICON_PATH"] ) {
-		// FIXME: Should also go away once we move icons into the bundle
-		NSString *path = [chunks objectAtIndex:1];
-		[_delegate loadIconResourcePath:path];
 	} else if( [[chunks objectAtIndex:0 ] isEqualToString:@"SHARE_MENU_TITLE"] ) {
 		[_delegate setShareMenuTitle:[chunks objectAtIndex:1]];
 	} else {
diff --git a/shell_integration/icons/CMakeLists.txt b/shell_integration/icons/CMakeLists.txt
index 04174d5..5e2c958 100644
--- a/shell_integration/icons/CMakeLists.txt
+++ b/shell_integration/icons/CMakeLists.txt
@@ -1,12 +1,3 @@
-
-# Install the Mac icon container into the Mac Bundle.
-if( BUILD_OWNCLOUD_OSX_BUNDLE AND NOT BUILD_LIBRARIES_ONLY )
-	set (ICON_DIR ${OWNCLOUD_OSX_BUNDLE}/Contents/Resources/icons)
-	
-	file(GLOB mac_icons "icns/*icns")
-	install(FILES ${mac_icons} DESTINATION ${ICON_DIR})
-endif()
-
 if( UNIX AND NOT APPLE )
 
     SET(ICON_DIR ${DATADIR}/icons/hicolor)
@@ -22,6 +13,3 @@ if( UNIX AND NOT APPLE )
     ENDFOREACH(size)
 
 endif()
-
-
-
diff --git a/src/gui/socketapi.cpp b/src/gui/socketapi.cpp
index aecb2c8..41c5069 100644
--- a/src/gui/socketapi.cpp
+++ b/src/gui/socketapi.cpp
@@ -177,16 +177,6 @@ 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( Folder *f, FolderMan::instance()->map() ) {
         QString message = buildRegisterPathMessage(f->path());
         sendMessage(socket, message);

-- 
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