Blob Blame History Raw
From 1166883e5d7fcfc24ce24b5f5b158053c59be7a2 Mon Sep 17 00:00:00 2001
From: Matthias Clasen <mclasen@redhat.com>
Date: Thu, 27 Feb 2014 19:29:49 -0500
Subject: [PATCH] Fix creating new items

Just as for menus, the code to insert the new item in
the right place was dropped in refactoring.
Bring it back.

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

diff --git a/Alacarte/MainWindow.py b/Alacarte/MainWindow.py
index a0c884c..f52f216 100644
--- a/Alacarte/MainWindow.py
+++ b/Alacarte/MainWindow.py
@@ -261,11 +261,19 @@ class MainWindow(object):
             menu_tree.get_selection().select_path((0,))
         else:
             parent = menus[iter][2]
-        file_path = os.path.join(util.getUserItemPath(), util.getUniqueFileId('alacarte-made', '.desktop'))
+        file_name = util.getUniqueFileId('alacarte-made', '.desktop')
+        file_path = os.path.join(util.getUserItemPath(), file_name)
 
         editor = LauncherEditor(self.main_window, file_path)
+        editor.file_name = file_name;
+        editor.parent = parent.get_menu_id()
+        editor.connect ('response', self.on_item_created)
         editor.run()
 
+    def on_item_created(self, editor, response):
+        if response == True:
+            self.editor.insertExternalItem(editor.file_name, editor.parent)
+
     def on_new_separator_button_clicked(self, button):
         item_tree = self.tree.get_object('item_tree')
         items, iter = item_tree.get_selection().get_selected()
-- 
1.9.0