[Pkg-owncloud-commits] [owncloud-client] 326/332: Shell Integration: Fix Integration bug when explorer starts before OCC

Sandro Knauß hefee-guest at moszumanska.debian.org
Thu Aug 14 21:07:18 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 5306cdc7a1a8e56f3af1d09b7c109f4b5090c993
Author: Daniel Molkentin <danimo at owncloud.com>
Date:   Fri Aug 8 02:39:43 2014 +0200

    Shell Integration: Fix Integration bug when explorer starts before OCC
    
    Also slightly improves performance
---
 .../OCShellExtensions/OCOverlays/OCOverlay.cpp     | 38 +++++++++++++++++++---
 .../OCShellExtensions/OCOverlays/OCOverlay.h       |  2 --
 2 files changed, 34 insertions(+), 6 deletions(-)

diff --git a/shell_integration/windows/OCShellExtensions/OCOverlays/OCOverlay.cpp b/shell_integration/windows/OCShellExtensions/OCOverlays/OCOverlay.cpp
index 20b809b..8e0265d 100644
--- a/shell_integration/windows/OCShellExtensions/OCOverlays/OCOverlay.cpp
+++ b/shell_integration/windows/OCShellExtensions/OCOverlays/OCOverlay.cpp
@@ -14,6 +14,7 @@
 
 #include "OCOverlay.h"
 
+#include "OCOverlayFactory.h"
 #include "RegistryUtil.h"
 #include "StringUtil.h"
 
@@ -35,6 +36,10 @@ extern HINSTANCE instanceHandle;
 #define IDM_DISPLAY 0  
 #define IDB_OK 101
 
+namespace {
+	static std::vector<std::wstring> s_watchedDirectories;
+}
+
 OCOverlay::OCOverlay(int state) 
 	: _communicationSocket(0)
 	, _referenceCount(1)
@@ -42,8 +47,6 @@ OCOverlay::OCOverlay(int state)
 	, _state(state)
 
 {
-	// FIXME: Use Registry instead
-	_watchedDirectories = _checker->WatchedDirectories();
 }
 
 OCOverlay::~OCOverlay(void)
@@ -90,7 +93,28 @@ IFACEMETHODIMP_(ULONG) OCOverlay::Release()
 
 IFACEMETHODIMP OCOverlay::GetPriority(int *pPriority)
 {
-	pPriority = 0;
+	// this defines which handler has prededence, so
+	// we order this in terms of likelyhood
+	switch (_state) {
+	case State_OK:
+		*pPriority = 0;
+	case State_OKShared:
+		*pPriority = 1;
+	case State_Warning:
+		*pPriority = 2;
+	case State_WarningShared:
+		*pPriority = 3;
+	case State_Sync:
+		*pPriority = 4;
+	case State_SyncShared:
+		*pPriority = 5;
+	case State_Error:
+		*pPriority = 6;
+	case State_ErrorShared:
+		*pPriority = 7;
+	default:
+		*pPriority = 8;
+	}
 
 	return S_OK;
 }
@@ -103,11 +127,17 @@ IFACEMETHODIMP OCOverlay::GetPriority(int *pPriority)
 	//	return MAKE_HRESULT(S_FALSE, 0, 0);
 	//}
 
+	// FIXME: Use Registry instead, this will only trigger once
+	// and now follow any user changes in the client
+	if (s_watchedDirectories.empty()) {
+		s_watchedDirectories = _checker->WatchedDirectories();
+	}
+
 	wstring wpath(pwszPath);
 	wpath.append(L"\\");
 	vector<wstring>::iterator it;
 	bool watched = false;
-	for (it = _watchedDirectories.begin(); it != _watchedDirectories.end(); ++it) {
+	for (it = s_watchedDirectories.begin(); it != s_watchedDirectories.end(); ++it) {
 		if (StringUtil::begins_with(wpath, *it)) {
 			watched = true;
 		}
diff --git a/shell_integration/windows/OCShellExtensions/OCOverlays/OCOverlay.h b/shell_integration/windows/OCShellExtensions/OCOverlays/OCOverlay.h
index 801b303..a84bc45 100644
--- a/shell_integration/windows/OCShellExtensions/OCOverlays/OCOverlay.h
+++ b/shell_integration/windows/OCShellExtensions/OCOverlays/OCOverlay.h
@@ -45,8 +45,6 @@ private:
 	CommunicationSocket* _communicationSocket;
 	RemotePathChecker* _checker;
 	int _state;
-
-	std::vector<std::wstring> _watchedDirectories;
 };
 
 #endif
\ No newline at end of file

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