Blob Blame History Raw
From fd2c16c3929e57f5f2071ed3bc36f02c77930bab Mon Sep 17 00:00:00 2001
From: Matthias Clasen <mclasen@redhat.com>
Date: Wed, 26 Feb 2014 20:29:51 -0500
Subject: [PATCH] Fix creating new menus

We were still creating the .directory file, but some
refactoring dropped the code that inserted the menu
into the menu tree. Bring it back.

https://bugzilla.gnome.org/show_bug.cgi?id=725287
---
 Alacarte/MainWindow.py | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/Alacarte/MainWindow.py b/Alacarte/MainWindow.py
index aa36aaa..a0c884c 100644
--- a/Alacarte/MainWindow.py
+++ b/Alacarte/MainWindow.py
@@ -239,11 +239,19 @@ class MainWindow(object):
             menu_tree.get_selection().select_path((0,))
         else:
             parent = menus[iter][2]
-        file_path = os.path.join(util.getUserDirectoryPath(), util.getUniqueFileId('alacarte-made', '.directory'))
+	file_name = util.getUniqueFileId('alacarte-made', '.directory')
+        file_path = os.path.join(util.getUserDirectoryPath(), file_name)
 
         editor = DirectoryEditor(self.main_window, file_path)
+        editor.file_name = file_name;
+        editor.parent = parent.get_menu_id()
+        editor.connect ('response', self.on_directory_created)
         editor.run()
 
+    def on_directory_created(self, editor, response):
+        if response == True:
+            self.editor.insertExternalMenu(editor.file_name, editor.parent)
+
     def on_new_item_button_clicked(self, button):
         menu_tree = self.tree.get_object('menu_tree')
         menus, iter = menu_tree.get_selection().get_selected()
-- 
1.9.0