Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 0.8, 0.8.1, and 0.8.2

nautilus: set emblem and status for file in idle

Changeset 69510f1131aa

Parent ccce661b2753

by Simon Heimberg

Changes to one file · Browse files at 69510f1131aa Showing diff from parent ccce661b2753 Diff from another changeset...

 
45
46
47
 
48
49
50
 
251
252
253
254
255
 
 
 
 
 
 
 
 
 
 
 
256
257
 
258
259
260
261
 
 
 
262
263
264
 
45
46
47
48
49
50
51
 
252
253
254
 
 
255
256
257
258
259
260
261
262
263
264
265
266
 
267
268
269
 
 
270
271
272
273
274
275
@@ -45,6 +45,7 @@
  def __init__(self):   self.cacherepo = None   self.cacheroot = None + self.scanStack = []     # check if nautilus-thg.py is a symlink first   pfile = __file__ @@ -251,14 +252,24 @@
  return emblem, status     def update_file_info(self, file): - '''Return emblem and hg status for this file''' - path = self.get_path_for_vfs_file(file) + '''Queue file for emblem and hg status update''' + self.scanStack.append(file) + if len(self.scanStack) == 1: + gobject.idle_add(self.fileinfo_on_idle) + + def fileinfo_on_idle(self): + '''Update emblem and hg status for files when there is time''' + if not self.scanStack: + return False + vfs_file = self.scanStack.pop() + path = self.get_path_for_vfs_file(vfs_file)   if not path: - return + return True   emblem, status = self._get_file_status(self.cacherepo, path)   if emblem is not None: - file.add_emblem(emblem) - file.add_string_attribute('hg_status', status) + vfs_file.add_emblem(emblem) + vfs_file.add_string_attribute('hg_status', status) + return True     # property page borrowed from http://www.gnome.org/~gpoo/hg/nautilus-hg/   def __add_row(self, row, label_item, label_value):