[Pkg-owncloud-commits] [owncloud-client] 95/115: Overlays Nautilus: Handle UNREGISTER_PATH and do proper reconnect.

Sandro Knauß hefee-guest at moszumanska.debian.org
Fri Aug 29 22:04:05 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 fef0d0b31cf2ae13c82da4475e20c495a067905a
Author: Klaas Freitag <freitag at owncloud.com>
Date:   Wed Aug 20 17:31:00 2014 +0200

    Overlays Nautilus: Handle UNREGISTER_PATH and do proper reconnect.
    
    This is needed to fix #2073
---
 shell_integration/nautilus/ownCloud.py | 41 +++++++++++++++++++++-------------
 1 file changed, 26 insertions(+), 15 deletions(-)

diff --git a/shell_integration/nautilus/ownCloud.py b/shell_integration/nautilus/ownCloud.py
index ac04a17..158b015 100755
--- a/shell_integration/nautilus/ownCloud.py
+++ b/shell_integration/nautilus/ownCloud.py
@@ -51,10 +51,7 @@ class ownCloudExtension(GObject.GObject, Nautilus.ColumnProvider, Nautilus.InfoP
 	    return self.nautilusVFSFile_table[path]
 	else:
 	    return None
-    
-    def callback_update_file( self, path ):
-	print "Got an update callback for " + path
-	
+
     def askForOverlay(self, file):
         if os.path.isdir(file):
             folderStatus = self.sendCommand("RETRIEVE_FOLDER_STATUS:"+file+"\n");
@@ -62,6 +59,17 @@ class ownCloudExtension(GObject.GObject, Nautilus.ColumnProvider, Nautilus.InfoP
         if os.path.isfile(file):
             fileStatus = self.sendCommand("RETRIEVE_FILE_STATUS:"+file+"\n");
 
+    def invalidate_items_underneath( self, path ):
+	update_items = []
+	for p in self.nautilusVFSFile_table:
+	    if p == path or p.startswith( path ):
+		item = self.nautilusVFSFile_table[p]
+		update_items.append(item)
+
+	for item in update_items:
+	    item.invalidate_extension_info()
+	    # self.update_file_info(item)
+
     # Handles a single line of server respoonse and sets the emblem
     def handle_server_response(self, l):
         Emblems = { 'OK'        : 'oC_ok',
@@ -94,18 +102,23 @@ class ownCloudExtension(GObject.GObject, Nautilus.ColumnProvider, Nautilus.InfoP
 	    elif action == 'UPDATE_VIEW':
 		# Search all items underneath this path and invalidate them
 		if parts[1] in self.registered_paths:
-		    update_items = []
-		    for p in self.nautilusVFSFile_table:
-			if p == parts[1] or p.startswith( parts[1] ):
-			    item = self.nautilusVFSFile_table[p]
-			    update_items.append(item)
-
-		    for item in update_items:
-			item.invalidate_extension_info()
-			# self.update_file_info(item)
+		    self.invalidate_items_underneath( parts[1] )
 
 	    elif action == 'REGISTER_PATH':
 		self.registered_paths[parts[1]] = 1
+		self.invalidate_items_underneath( parts[1] )
+	    elif action == 'UNREGISTER_PATH':
+		del self.registered_paths[parts[1]]
+		self.invalidate_items_underneath( parts[1] )
+
+		# check if there are non pathes any more, if so, its usual
+		# that mirall went away. Try reconnect.
+		if not self.registered_paths:
+		    self.sock.close()
+		    self.connected = False
+		    GObject.source_remove( self.watch_id )
+                    GObject.timeout_add(5000, self.connectToOwnCloud)
+
             else:
                 # print "We got unknown action " + action
                 1
@@ -136,8 +149,6 @@ class ownCloudExtension(GObject.GObject, Nautilus.ColumnProvider, Nautilus.InfoP
     def get_local_path(self, path):
         return path.replace("file://", "")
 
-   
-
     def update_file_info(self, item):
         if item.get_uri_scheme() != 'file':
             return

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