[gedit] Bug 697246 - Fix the sorting of the external tools menu items



commit 7ab82e00873a589c26696d37e7d9feb405665f7f
Author: Garrett Regier <garrettregier gmail com>
Date:   Sat Jun 15 05:03:35 2013 -0700

    Bug 697246  - Fix the sorting of the external tools menu items
    
    Before it was depending on the ToolLibrary to sort the subdirs and
    tools for it. It also seems that reusing action names causes some
    problems.

 plugins/externaltools/tools/windowactivatable.py |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/plugins/externaltools/tools/windowactivatable.py 
b/plugins/externaltools/tools/windowactivatable.py
index 0bc22e9..368cfd7 100644
--- a/plugins/externaltools/tools/windowactivatable.py
+++ b/plugins/externaltools/tools/windowactivatable.py
@@ -67,8 +67,8 @@ class ToolMenu(object):
     def _insert_directory(self, directory, path):
         ui_manager = self._window.get_ui_manager()
 
-        for item in directory.subdirs:
-            action_name = 'ExternalToolDirectory%X' % id(item)
+        for item in sorted(directory.subdirs, key=lambda x: x.name.lower()):
+            action_name = 'ExternalToolDirectory_%X_%X' % (id(item), id(item.name))
             action = Gtk.Action(action_name, item.name.replace('_', '__'), None, None)
             self._action_group.add_action(action)
 
@@ -78,8 +78,8 @@ class ToolMenu(object):
                            
             self._insert_directory(item, path + '/' + action_name)
 
-        for item in directory.tools:
-            action_name = 'ExternalToolTool%X' % id(item)
+        for item in sorted(directory.tools, key=lambda x: x.name.lower()):
+            action_name = 'ExternalToolTool_%X_%X' % (id(item), id(item.name))
             action = Gtk.Action(action_name, item.name.replace('_', '__'), item.comment, None)
             handler = action.connect("activate", capture_menu_action, self._window, self._panel, item)
 


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