summaryrefslogtreecommitdiff
path: root/Mozo
diff options
context:
space:
mode:
Diffstat (limited to 'Mozo')
-rw-r--r--Mozo/MenuEditor.py50
1 files changed, 25 insertions, 25 deletions
diff --git a/Mozo/MenuEditor.py b/Mozo/MenuEditor.py
index f6068b5..a8e960a 100644
--- a/Mozo/MenuEditor.py
+++ b/Mozo/MenuEditor.py
@@ -110,6 +110,31 @@ class MenuEditor:
self.revertItem(child)
self.revertMenu(menu)
+ def revertItem(self, item):
+ if not self.canRevert(item):
+ return
+ self.__addUndo([item,])
+ try:
+ os.remove(item.get_desktop_file_path())
+ except OSError:
+ pass
+ self.save()
+
+ def revertMenu(self, menu):
+ if not self.canRevert(menu):
+ return
+ #wtf happened here? oh well, just bail
+ if not menu.get_desktop_file_path():
+ return
+ self.__addUndo([menu,])
+ file_id = os.path.split(menu.get_desktop_file_path())[1]
+ path = os.path.join(util.getUserDirectoryPath(), file_id)
+ try:
+ os.remove(path)
+ except OSError:
+ pass
+ self.save()
+
def undo(self):
if len(self.__undo) == 0:
return
@@ -372,31 +397,6 @@ class MenuEditor:
self.__addUndo([self.__getMenu(item.get_parent()),])
self.save()
- def revertItem(self, item):
- if not self.canRevert(item):
- return
- self.__addUndo([item,])
- try:
- os.remove(item.get_desktop_file_path())
- except OSError:
- pass
- self.save()
-
- def revertMenu(self, menu):
- if not self.canRevert(menu):
- return
- #wtf happened here? oh well, just bail
- if not menu.get_desktop_file_path():
- return
- self.__addUndo([menu,])
- file_id = os.path.split(menu.get_desktop_file_path())[1]
- path = os.path.join(util.getUserDirectoryPath(), file_id)
- try:
- os.remove(path)
- except OSError:
- pass
- self.save()
-
#private stuff
def __addUndo(self, items):
self.__undo.append([])