[Pkg-owncloud-commits] [owncloud-client] 181/219: Overlays Linux: Add the state to the cache to save calls to add_emblem
Sandro Knauß
hefee-guest at moszumanska.debian.org
Sat Oct 11 14:43:24 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 29987ca2aa727085c4320167e27a0f7c3e74c4d0
Author: Klaas Freitag <freitag at owncloud.com>
Date: Tue Sep 30 13:57:06 2014 +0200
Overlays Linux: Add the state to the cache to save calls to add_emblem
The SocketAPI sends status updates for files without being asked for.
And in order to not draw the emblem again if it had not changed, the
state is compared before calling add_emblem
---
shell_integration/nautilus/syncstate.py | 32 ++++++++++++++++++++------------
1 file changed, 20 insertions(+), 12 deletions(-)
diff --git a/shell_integration/nautilus/syncstate.py b/shell_integration/nautilus/syncstate.py
index 6299e34..1a62550 100755
--- a/shell_integration/nautilus/syncstate.py
+++ b/shell_integration/nautilus/syncstate.py
@@ -71,6 +71,7 @@ class syncStateExtension(GObject.GObject, Nautilus.ColumnProvider, Nautilus.Info
return None
def askForOverlay(self, file):
+ # print("Asking for overlay for "+file)
if os.path.isdir(file):
folderStatus = self.sendCommand("RETRIEVE_FOLDER_STATUS:"+file+"\n");
@@ -79,14 +80,16 @@ class syncStateExtension(GObject.GObject, Nautilus.ColumnProvider, Nautilus.Info
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)
+ if not self.nautilusVFSFile_table:
+ self.askForOverlay(path)
+ else:
+ for p in self.nautilusVFSFile_table:
+ if p == path or p.startswith(path):
+ item = self.nautilusVFSFile_table[p]['item']
+ update_items.append(item)
- for item in update_items:
- item.invalidate_extension_info()
- # self.update_file_info(item)
+ for item in update_items:
+ item.invalidate_extension_info()
# Handles a single line of server respoonse and sets the emblem
def handle_server_response(self, l):
@@ -111,11 +114,16 @@ class syncStateExtension(GObject.GObject, Nautilus.ColumnProvider, Nautilus.Info
# file = parts[1]
# print "Action for " + file + ": "+parts[0]
if action == 'STATUS':
- emblem = Emblems[parts[1]]
+ newState = parts[1]
+ emblem = Emblems[newState]
if emblem:
- item = self.find_item_for_file(parts[2])
- if item:
- item.add_emblem(emblem)
+ itemStore = self.find_item_for_file(parts[2])
+ if itemStore:
+ if( not itemStore['state'] or newState != itemStore['state'] ):
+ item = itemStore['item']
+ item.add_emblem(emblem)
+ # print "Setting emblem on " + parts[2]
+ self.nautilusVFSFile_table[parts[2]] = {'item': item, 'state':newState}
elif action == 'UPDATE_VIEW':
# Search all items underneath this path and invalidate them
@@ -177,7 +185,7 @@ class syncStateExtension(GObject.GObject, Nautilus.ColumnProvider, Nautilus.Info
for reg_path in self.registered_paths:
if filename.startswith(reg_path):
- self.nautilusVFSFile_table[filename] = item
+ self.nautilusVFSFile_table[filename] = {'item': item, 'state':''}
# item.add_string_attribute('share_state', "share state")
self.askForOverlay(filename)
--
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