/[pkgs]/devel/openbox/xdg-menu
ViewVC logotype

Contents of /devel/openbox/xdg-menu

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (show annotations) (download)
Fri Aug 1 12:01:24 2008 UTC (23 months, 4 weeks ago) by mlichvar
Branch: MAIN
CVS Tags: F-12-split, openbox-3_4_7_2-7_fc11, openbox-3_4_11_2-2_fc14, F-13-split, F-10-split, openbox-3_4_11_2-1_fc14, openbox-3_4_10-3_fc13, openbox-3_4_10-2_fc13, F-11-split, openbox-3_4_9-1_fc13, openbox-3_4_7_2-5_fc10, openbox-3_4_7_2-11_fc12, openbox-3_4_10-1_fc13, openbox-3_4_7_2-6_fc10, openbox-3_4_7_2-4_fc10, openbox-3_4_8-1_fc13, openbox-3_4_11-1_fc13, openbox-3_4_9-2_fc13, openbox-3_4_11_1-1_fc14, openbox-3_4_7_2-9_fc12, openbox-3_4_7_2-10_fc12, openbox-3_4_7_2-8_fc11, HEAD
Changes since 1.2: +9 -5 lines
- Remove field codes from commands in xdg-menu (#452403)
- Add support for launching applications in xterm to xdg-menu
1 #!/usr/bin/env python
2 #
3 # Copyright (C) 2008 Red Hat, Inc.
4 #
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
17 #
18 # Author(s): Luke Macken <lmacken@redhat.com>
19 # Miroslav Lichvar <mlichvar@redhat.com>
20
21
22 import gmenu, re, sys
23 from xml.sax.saxutils import escape
24
25 def walk_menu(entry):
26 if entry.get_type() == gmenu.TYPE_DIRECTORY:
27 print '<menu id="%s" label="%s">' \
28 % (escape(entry.menu_id), escape(entry.get_name()))
29 map(walk_menu, entry.get_contents())
30 print '</menu>'
31 elif entry.get_type() == gmenu.TYPE_ENTRY and not entry.is_excluded:
32 print ' <item label="%s">' % escape(entry.get_name())
33 command = re.sub(' [^ ]*%[fFuUdDnNickvm]', '', entry.get_exec())
34 if entry.launch_in_terminal:
35 command = 'xterm -title "%s" -e %s' % \
36 (entry.get_name(), command)
37 print ' <action name="Execute">' + \
38 '<command>%s</command></action>' % escape(command)
39 print ' </item>'
40
41 if len(sys.argv) > 1:
42 menu = sys.argv[1] + '.menu'
43 else:
44 menu = 'applications.menu'
45
46 print '<?xml version="1.0" encoding="UTF-8"?>'
47 print '<openbox_pipe_menu>'
48 map(walk_menu, gmenu.lookup_tree(menu).root.get_contents())
49 print '</openbox_pipe_menu>'

admin@fedoraproject.org
ViewVC Help
Powered by ViewVC 1.1.6