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.
This commit is contained in:
parent
49d24e0f4c
commit
17159d0492
@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
from gi.repository import Gtk, GdkPixbuf, Gdk
|
from gi.repository import Gtk, GdkPixbuf, Gdk, GLib
|
||||||
from gi.repository import Pango
|
from gi.repository import Pango
|
||||||
#import matedesktop
|
#import matedesktop
|
||||||
from gi.repository import GObject
|
from gi.repository import GObject
|
||||||
@ -244,7 +244,7 @@ class ApplicationLauncher( easyButton ):
|
|||||||
|
|
||||||
base = os.path.basename( self.desktopFile )
|
base = os.path.basename( self.desktopFile )
|
||||||
for dir in self.appDirs:
|
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 )
|
easyButton.__init__( self, self.appIconName, iconSize )
|
||||||
self.setupLabels()
|
self.setupLabels()
|
||||||
@ -434,6 +434,9 @@ class ApplicationLauncher( easyButton ):
|
|||||||
for id in self.desktopEntryMonitors:
|
for id in self.desktopEntryMonitors:
|
||||||
filemonitor.removeMonitor( id )
|
filemonitor.removeMonitor( id )
|
||||||
|
|
||||||
|
def desktopEntryFileChangedCallback (self):
|
||||||
|
GLib.timeout_add(200, self.onDesktopEntryFileChanged)
|
||||||
|
|
||||||
def onDesktopEntryFileChanged( self ):
|
def onDesktopEntryFileChanged( self ):
|
||||||
exists = False
|
exists = False
|
||||||
base = os.path.basename( self.desktopFile )
|
base = os.path.basename( self.desktopFile )
|
||||||
@ -454,6 +457,7 @@ class ApplicationLauncher( easyButton ):
|
|||||||
if not exists:
|
if not exists:
|
||||||
# FIXME: What to do in this case?
|
# FIXME: What to do in this case?
|
||||||
self.destroy()
|
self.destroy()
|
||||||
|
return False
|
||||||
|
|
||||||
class MenuApplicationLauncher( ApplicationLauncher ):
|
class MenuApplicationLauncher( ApplicationLauncher ):
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user