[Pkg-owncloud-commits] [owncloud-client] 396/498: Nautilus Shell Integration: Only show menu entry for item state OK

Sandro Knauß hefee-guest at moszumanska.debian.org
Tue Aug 11 14:49:10 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 b012fae14463060be4fa7f81b72c6f8d50ffb7b4
Author: Klaas Freitag <freitag at owncloud.com>
Date:   Wed Jul 29 11:29:10 2015 +0200

    Nautilus Shell Integration: Only show menu entry for item state OK
    
    If the file is ignored or errornous, do not add the sharing menu item to
    the context menu.
    
    This is (a partly) solution to bug ä2775
---
 shell_integration/nautilus/syncstate.py | 22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)

diff --git a/shell_integration/nautilus/syncstate.py b/shell_integration/nautilus/syncstate.py
index bfa18ee..15e9699 100755
--- a/shell_integration/nautilus/syncstate.py
+++ b/shell_integration/nautilus/syncstate.py
@@ -48,6 +48,8 @@ class SocketConnect(GObject.GObject):
         self._sock = None
         self._listeners = [self._update_registered_paths]
         self._remainder = ''
+        self.nautilusVFSFile_table = {} # not needed in this object actually but shared 
+                                        # all over the other objects.
 
         # returns true when one should try again!
         if self._connectToSocketServer():
@@ -156,7 +158,9 @@ class MenuExtension(GObject.GObject, Nautilus.MenuProvider):
         syncedFile = False
         for reg_path in socketConnect.registered_paths:
             filename = get_local_path(file.get_uri())
-            if filename.startswith(reg_path):
+            # only show the menu extension if the file is synced and the sync
+            # status is ok. Not for ignored files etc.
+            if filename.startswith(reg_path) and socketConnect.nautilusVFSFile_table[filename]['state'] == 'OK':
                 syncedFile = True
 
         # if it is neither in a synced folder or is a directory
@@ -183,12 +187,12 @@ class SyncStateExtension(GObject.GObject, Nautilus.ColumnProvider, Nautilus.Info
     def __init__(self):
         GObject.GObject.__init__(self)
 
-        self.nautilusVFSFile_table = {}
+        socketConnect.nautilusVFSFile_table = {}
         socketConnect.addListener(self.handle_commands)
 
     def find_item_for_file(self, path):
-        if path in self.nautilusVFSFile_table:
-            return self.nautilusVFSFile_table[path]
+        if path in socketConnect.nautilusVFSFile_table:
+            return socketConnect.nautilusVFSFile_table[path]
         else:
             return None
 
@@ -202,12 +206,12 @@ class SyncStateExtension(GObject.GObject, Nautilus.ColumnProvider, Nautilus.Info
 
     def invalidate_items_underneath(self, path):
         update_items = []
-        if not self.nautilusVFSFile_table:
+        if not socketConnect.nautilusVFSFile_table:
             self.askForOverlay(path)
         else:
-            for p in self.nautilusVFSFile_table:
+            for p in socketConnect.nautilusVFSFile_table:
                 if p == path or p.startswith(path):
-                    item = self.nautilusVFSFile_table[p]['item']
+                    item = socketConnect.nautilusVFSFile_table[p]['item']
                     update_items.append(item)
 
             for item in update_items:
@@ -240,7 +244,7 @@ class SyncStateExtension(GObject.GObject, Nautilus.ColumnProvider, Nautilus.Info
                         item = itemStore['item']
                         item.add_emblem(emblem)
                         # print "Setting emblem on " + args[1]+ "<>"+emblem+"<>"
-                        self.nautilusVFSFile_table[args[1]] = {'item': item, 'state':newState}
+                        socketConnect.nautilusVFSFile_table[args[1]] = {'item': item, 'state':newState}
 
         elif action == 'UPDATE_VIEW':
             # Search all items underneath this path and invalidate them
@@ -262,7 +266,7 @@ class SyncStateExtension(GObject.GObject, Nautilus.ColumnProvider, Nautilus.Info
 
         for reg_path in socketConnect.registered_paths:
             if filename.startswith(reg_path):
-                self.nautilusVFSFile_table[filename] = {'item': item, 'state':''}
+                socketConnect.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