[alacarte] Fix creating new items



commit 1166883e5d7fcfc24ce24b5f5b158053c59be7a2
Author: Matthias Clasen <mclasen redhat com>
Date:   Thu Feb 27 19:29:49 2014 -0500

    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 files changed, 9 insertions(+), 1 deletions(-)
---
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()


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