From 17159d049215e737c4b63d783a2e54e1429074cc Mon Sep 17 00:00:00 2001 From: Michael Webster Date: Wed, 8 May 2013 12:27:04 -0400 Subject: [PATCH] Add a slight delay on reloading a changed desktop file, we were trying to read it before it finished writing, and ending up with no entry. --- usr/lib/linuxmint/mintMenu/plugins/easybuttons.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/usr/lib/linuxmint/mintMenu/plugins/easybuttons.py b/usr/lib/linuxmint/mintMenu/plugins/easybuttons.py index b212e6d..4b36bb3 100755 --- a/usr/lib/linuxmint/mintMenu/plugins/easybuttons.py +++ b/usr/lib/linuxmint/mintMenu/plugins/easybuttons.py @@ -1,6 +1,6 @@ #!/usr/bin/env python -from gi.repository import Gtk, GdkPixbuf, Gdk +from gi.repository import Gtk, GdkPixbuf, Gdk, GLib from gi.repository import Pango #import matedesktop from gi.repository import GObject @@ -244,7 +244,7 @@ class ApplicationLauncher( easyButton ): base = os.path.basename( self.desktopFile ) for dir in self.appDirs: - self.desktopEntryMonitors.append( filemonitor.addMonitor( os.path.join(dir, base) , self.onDesktopEntryFileChanged ) ) + self.desktopEntryMonitors.append( filemonitor.addMonitor( os.path.join(dir, base) , self.desktopEntryFileChangedCallback ) ) easyButton.__init__( self, self.appIconName, iconSize ) self.setupLabels() @@ -434,6 +434,9 @@ class ApplicationLauncher( easyButton ): for id in self.desktopEntryMonitors: filemonitor.removeMonitor( id ) + def desktopEntryFileChangedCallback (self): + GLib.timeout_add(200, self.onDesktopEntryFileChanged) + def onDesktopEntryFileChanged( self ): exists = False base = os.path.basename( self.desktopFile ) @@ -454,6 +457,7 @@ class ApplicationLauncher( easyButton ): if not exists: # FIXME: What to do in this case? self.destroy() + return False class MenuApplicationLauncher( ApplicationLauncher ):