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
This commit is contained in:
Icius 2010-03-24 18:50:34 -04:00 committed by Clement Lefebvre
parent dbeaa2f32b
commit a3ea227f21

View File

@ -13,6 +13,7 @@ import gnomevfs
import threading import threading
import commands import commands
import subprocess import subprocess
import filecmp
from easybuttons import * from easybuttons import *
from execute import Execute from execute import Execute
@ -874,6 +875,8 @@ class pluginclass( object ):
def onPropsApp( self, menu, widget ): def onPropsApp( self, menu, widget ):
newFileFlag = False
sysPaths = get_system_item_paths() sysPaths = get_system_item_paths()
for path in sysPaths: for path in sysPaths:
@ -892,14 +895,39 @@ class pluginclass( object ):
if not os.path.isfile(filePath): if not os.path.isfile(filePath):
data = open(widget.desktopFile).read() data = open(widget.desktopFile).read()
open(filePath, 'w').write(data) open(filePath, 'w').write(data)
newFileFlag = True
break break
else: else:
filePath = widget.desktopFile filePath = widget.desktopFile
pid = subprocess.Popen(["/usr/bin/gnome-desktop-item-edit", filePath]).pid
self.mintMenuWin.hide() 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 ): def onUninstallApp( self, menu, widget ):
widget.uninstall() widget.uninstall()