From a3ea227f211cb449b52d578f5d0547a9d8f9012c Mon Sep 17 00:00:00 2001 From: Icius Date: Wed, 24 Mar 2010 18:50:34 -0400 Subject: [PATCH] Turned the launch of gnome-desktop-item-edit into a synchronous call so that we can wait for it to complete before doing other things Added code to update the favorites file if the user has changed the menu item. Added code to rebuild/redisplay the Favorites box to show changes Added code to remove a custom desktopFile if there have been no changes from the original --- .../mintMenu/plugins/applications.py | 32 +++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/usr/lib/linuxmint/mintMenu/plugins/applications.py b/usr/lib/linuxmint/mintMenu/plugins/applications.py index 271fd91..6b6519b 100755 --- a/usr/lib/linuxmint/mintMenu/plugins/applications.py +++ b/usr/lib/linuxmint/mintMenu/plugins/applications.py @@ -13,6 +13,7 @@ import gnomevfs import threading import commands import subprocess +import filecmp from easybuttons import * from execute import Execute @@ -874,6 +875,8 @@ class pluginclass( object ): def onPropsApp( self, menu, widget ): + newFileFlag = False + sysPaths = get_system_item_paths() for path in sysPaths: @@ -892,14 +895,39 @@ class pluginclass( object ): if not os.path.isfile(filePath): data = open(widget.desktopFile).read() open(filePath, 'w').write(data) + newFileFlag = True break else: filePath = widget.desktopFile - pid = subprocess.Popen(["/usr/bin/gnome-desktop-item-edit", filePath]).pid - self.mintMenuWin.hide() + gtk.gdk.flush() + + editProcess = subprocess.Popen(["/usr/bin/gnome-desktop-item-edit", filePath]) + subprocess.Popen.communicate(editProcess) + + if newFileFlag: + + if filecmp.cmp(widget.desktopFile, filePath): + os.remove(filePath) + + else: + favoriteChange = 0 + + for favorite in self.favorites: + if favorite.type == "location": + if favorite.desktopFile == widget.desktopFile: + favorite.desktopFile = filePath + favoriteChange = 1 + + if favoriteChange == 1: + self.favoritesSave() + self.buildFavorites() + + else: + self.buildFavorites() + def onUninstallApp( self, menu, widget ): widget.uninstall()