[gnome-menus] [editor] Respect XDG_MENU_PREFIX when writing user menu file



commit ac425c5ac9e386fd171801496503d591d5c5ade2
Author: Vincent Untz <vuntz gnome org>
Date:   Wed Jun 30 12:31:33 2010 +0200

    [editor] Respect XDG_MENU_PREFIX when writing user menu file
    
    https://bugzilla.gnome.org/show_bug.cgi?id=623197

 simple-editor/GMenuSimpleEditor/menufilewriter.py |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/simple-editor/GMenuSimpleEditor/menufilewriter.py b/simple-editor/GMenuSimpleEditor/menufilewriter.py
index 16bb46a..9f17ab5 100644
--- a/simple-editor/GMenuSimpleEditor/menufilewriter.py
+++ b/simple-editor/GMenuSimpleEditor/menufilewriter.py
@@ -145,6 +145,12 @@ class MenuFileWriter:
 
     def sync (self, iter):
         menu_file = self.model[iter][self.model.COLUMN_MENU_FILE]
+
+        if os.environ.has_key ("XDG_MENU_PREFIX") and menu_file == "applications.menu":
+            prefixed_menu_file = os.environ["XDG_MENU_PREFIX"] + menu_file
+        else:
+            prefixed_menu_file = menu_file
+
         system_menu_file = menutreemodel.lookup_system_menu_file (menu_file)
         
         (contents, has_changes) = self.__append_menu (DTD_DECLARATION,
@@ -154,12 +160,12 @@ class MenuFileWriter:
 
         if not has_changes:
             try:
-                os.remove (get_user_menu_file_path (menu_file))
+                os.remove (get_user_menu_file_path (prefixed_menu_file))
             except:
                 pass
             return
             
-        write_file (get_user_menu_file_path (menu_file), contents)
+        write_file (get_user_menu_file_path (prefixed_menu_file), contents)
 
     def __sync_idle_handler_func (self, iter):
         self.sync (iter)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]