[alacarte] Use display name instead of name for menu items
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [alacarte] Use display name instead of name for menu items
- Date: Tue, 8 Sep 2009 10:06:14 +0000 (UTC)
commit 1a21a0a5b36b0402b284f364a5e759a3e01a4c76
Author: Vincent Untz <vuntz gnome org>
Date: Tue Sep 8 01:30:19 2009 +0200
Use display name instead of name for menu items
This enables us to display the X-GNOME-FullName key instead of the Name
key when available.
This change requires gnome-menus 2.27.92.
http://bugzilla.gnome.org/show_bug.cgi?id=594443
Alacarte/MainWindow.py | 6 ++++++
Alacarte/MenuEditor.py | 6 +++++-
configure.ac | 2 +-
3 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/Alacarte/MainWindow.py b/Alacarte/MainWindow.py
index 734ba46..72b015b 100644
--- a/Alacarte/MainWindow.py
+++ b/Alacarte/MainWindow.py
@@ -243,6 +243,12 @@ class MainWindow:
if item.get_type() == gmenu.TYPE_SEPARATOR:
name = '---'
icon = None
+ elif item.get_type() == gmenu.TYPE_ENTRY:
+ if show:
+ name = cgi.escape(item.get_display_name())
+ else:
+ name = '<small><i>' + cgi.escape(item.get_display_name()) + '</i></small>'
+ icon = util.getIcon(item)
else:
if show:
name = cgi.escape(item.get_name())
diff --git a/Alacarte/MenuEditor.py b/Alacarte/MenuEditor.py
index 16c732d..73dd6c0 100644
--- a/Alacarte/MenuEditor.py
+++ b/Alacarte/MenuEditor.py
@@ -39,6 +39,8 @@ class MenuEditor:
self.applications = Menu()
self.applications.tree = gmenu.lookup_tree('applications.menu', gmenu.FLAGS_SHOW_EMPTY|gmenu.FLAGS_INCLUDE_EXCLUDED|gmenu.FLAGS_INCLUDE_NODISPLAY|gmenu.FLAGS_SHOW_ALL_SEPARATORS)
self.applications.visible_tree = gmenu.lookup_tree('applications.menu')
+ self.applications.tree.sort_key = gmenu.SORT_DISPLAY_NAME
+ self.applications.visible_tree.sort_key = gmenu.SORT_DISPLAY_NAME
self.applications.path = os.path.join(util.getUserMenuPath(), self.applications.tree.get_menu_file())
if not os.path.isfile(self.applications.path):
self.applications.dom = xml.dom.minidom.parseString(util.getUserMenuXml(self.applications.tree))
@@ -49,6 +51,8 @@ class MenuEditor:
self.settings = Menu()
self.settings.tree = gmenu.lookup_tree('settings.menu', gmenu.FLAGS_SHOW_EMPTY|gmenu.FLAGS_INCLUDE_EXCLUDED|gmenu.FLAGS_INCLUDE_NODISPLAY|gmenu.FLAGS_SHOW_ALL_SEPARATORS)
self.settings.visible_tree = gmenu.lookup_tree('settings.menu')
+ self.settings.tree.sort_key = gmenu.SORT_DISPLAY_NAME
+ self.settings.visible_tree.sort_key = gmenu.SORT_DISPLAY_NAME
self.settings.path = os.path.join(util.getUserMenuPath(), self.settings.tree.get_menu_file())
if not os.path.isfile(self.settings.path):
self.settings.dom = xml.dom.minidom.parseString(util.getUserMenuXml(self.settings.tree))
@@ -250,7 +254,7 @@ class MenuEditor:
def editItem(self, item, icon, name, comment, command, use_term, parent=None, final=True):
#if nothing changed don't make a user copy
- if icon == item.get_icon() and name == item.get_name() and comment == item.get_comment() and command == item.get_exec() and use_term == item.get_launch_in_terminal():
+ if icon == item.get_icon() and name == item.get_display_name() and comment == item.get_comment() and command == item.get_exec() and use_term == item.get_launch_in_terminal():
return
#hack, item.get_parent() seems to fail a lot
if not parent:
diff --git a/configure.ac b/configure.ac
index 1140f45..fa29666 100644
--- a/configure.ac
+++ b/configure.ac
@@ -21,7 +21,7 @@ IT_PROG_INTLTOOL([0.40.0])
AM_PATH_PYTHON_VERSION(2.6, 2.6.0, 2.5, 2.5.0, 2.4, 2.4.0)
-PKG_CHECK_MODULES(ALACARTE, libgnome-menu >= 2.22.2)
+PKG_CHECK_MODULES(ALACARTE, libgnome-menu >= 2.27.92)
dnl Check for correctly installed pygobject
AC_MSG_CHECKING(for pygobject required_pygobject_version installed for python required_python_abi)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]