aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrederic Crozat <fcrozat@mandriva.com>2006-05-04 16:19:04 +0000
committerFrederic Crozat <fcrozat@mandriva.com>2006-05-04 16:19:04 +0000
commit1b23b615b3b37a3b8526e282e6ffec76dbd5d1e5 (patch)
treec3ddce9beac8f4fe66fa82df97be5ac6458bbd3c
parentd16ff49f63476198ee8364e66794d0c38c551701 (diff)
downloadcommon-data-1b23b615b3b37a3b8526e282e6ffec76dbd5d1e5.tar
common-data-1b23b615b3b37a3b8526e282e6ffec76dbd5d1e5.tar.gz
common-data-1b23b615b3b37a3b8526e282e6ffec76dbd5d1e5.tar.bz2
common-data-1b23b615b3b37a3b8526e282e6ffec76dbd5d1e5.tar.xz
common-data-1b23b615b3b37a3b8526e282e6ffec76dbd5d1e5.zip
- Add applications-mdk.menu file for XDG menu system
- Add xdg_menu script from SUSE to support old WM - Don't ship defaultlayout.menu anymore, it is merged into main menu - Fix typo in old menu file
-rw-r--r--desktop-common-data.spec21
-rw-r--r--menu/applications-mdk.menu1117
-rw-r--r--menu/menu2
-rwxr-xr-xmenu/update-menus40
-rwxr-xr-xmenu/xdg_menu2210
5 files changed, 3387 insertions, 3 deletions
diff --git a/desktop-common-data.spec b/desktop-common-data.spec
index 528b673..c08d0ad 100644
--- a/desktop-common-data.spec
+++ b/desktop-common-data.spec
@@ -1,7 +1,7 @@
Summary: Desktop common files
Name: desktop-common-data
Version: 2006
-Release: 2mdk
+Release: %mkrel 3
License: GPL
URL: http://www.mandrivalinux.com/
Group: System/Configuration/Other
@@ -97,9 +97,17 @@ install -m 0644 menu/icons/*.png %buildroot/%_iconsdir
install -m 0644 menu/icons/large/*.png %buildroot/%_liconsdir
install -m 0644 menu/icons/mini/*.png %buildroot/%_miconsdir
install -d -m 0755 %buildroot/%_localstatedir/menu-xdg/menus/applications-mdk-merged %buildroot/%_localstatedir/menu-xdg/menus/applications-simplified-merged
-install -m 0644 menu/defaultlayout.menu %buildroot/%_localstatedir/menu-xdg/menus/applications-mdk-merged
+#install -m 0644 menu/defaultlayout.menu %buildroot/%_localstatedir/menu-xdg/menus/applications-mdk-merged
install -m 0644 menu/defaultlayout-simplified.menu %buildroot/%_localstatedir/menu-xdg/menus/applications-simplified-merged
+# XDG menus
+install -d -m 0755 %buildroot/%_sysconfdir/xdg/menus/applications-merged
+install -d -m 0755 %buildroot/%_sysconfdir/menu.d
+install -m 0644 menu/applications-mdk.menu %buildroot/%_sysconfdir/xdg/
+install -m 0755 menu/xdg_menu %buildroot/%_bindir
+#temporary name
+install -m 0755 menu/update-menus %buildroot/%_bindir/update-menus-xdg
+
#install theme for GDM/KDM
install -d -m 0755 %buildroot/%_datadir/mdk/dm
@@ -139,6 +147,9 @@ rm -fr %buildroot
%_sbindir/*
%_sysconfdir/X11/xinit.d/*
+%dir %_sysconfdir/menu.d
+%_sysconfdir/xdg
+
#
%dir %_datadir/faces/
%dir %_datadir/mdk/
@@ -171,6 +182,12 @@ rm -fr %buildroot
%changelog
+* Thu May 04 2006 Frederic Crozat <fcrozat@mandriva.com> 2006-3mdk
+- Add applications-mdk.menu file for XDG menu system
+- Add xdg_menu script from SUSE to support old WM
+- Don't ship defaultlayout.menu anymore, it is merged into main menu
+- Fix typo in old menu file
+
* Mon Sep 26 2005 Frederic Crozat <fcrozat@mandriva.com> 2006-2mdk
- Fix desktop-directory script (UTF encoded URL, hidden .directory file)
Mdk bug #18853
diff --git a/menu/applications-mdk.menu b/menu/applications-mdk.menu
new file mode 100644
index 0000000..f74e954
--- /dev/null
+++ b/menu/applications-mdk.menu
@@ -0,0 +1,1117 @@
+<?xml version="1.0"?>
+<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN" "http://standards.freedesktop.org/menu-spec/menu-1.0.dtd">
+<Menu>
+ <Name>Mandriva Linux</Name>
+ <Layout>
+ <Menuname>Office</Menuname>
+ <Menuname>Internet</Menuname>
+ <Menuname>Multimedia</Menuname>
+ <Menuname>System</Menuname>
+ <Menuname>More Applications</Menuname>
+ <Menuname>Other</Menuname>
+ <Merge type="menus"/>
+ <Merge type="files"/>
+ </Layout>
+ <DefaultLayout inline="true" inline_limit="1" inline_header="false">
+ <Merge type="menus"/>
+ <Merge type="files"/>
+ </DefaultLayout>
+
+<!-- <DefaultMergeDirs/>-->
+ <AppDir>/var/lib/menu-xdg/applications</AppDir>
+ <DirectoryDir>/var/lib/menu-xdg/desktop-directories</DirectoryDir>
+<!-- <KDELegacyDirs/>-->
+ <DefaultAppDirs/>
+ <DefaultDirectoryDirs/>
+ <Directory>mandrakelinux.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux</Category>
+ </Include>
+ <Menu>
+ <Name>Office</Name>
+ <Layout>
+ <Menuname>Wordprocessors</Menuname>
+ <Menuname>Spreadsheets</Menuname>
+ <Menuname>Presentations</Menuname>
+ <Menuname>Drawing</Menuname>
+ <Menuname>Graphs</Menuname>
+ <Menuname>Publishing</Menuname>
+ <Menuname>Tasks Management</Menuname>
+ <Menuname>Time Management</Menuname>
+ <Menuname>Address Books</Menuname>
+ <Menuname>Communications</Menuname>
+ <Menuname>Accessories</Menuname>
+ <Menuname>Other</Menuname>
+ <Merge type="menus"/>
+ <Merge type="files"/>
+ </Layout>
+ <Directory>mandrakelinux$2doffice.directory</Directory>
+ <Include>
+ <Or>
+ <Category>X-Mandrakelinux-Office</Category>
+ </Or>
+ </Include>
+ <Menu>
+ <Name>Accessories</Name>
+ <Layout>
+ <Merge type="menus"/>
+ <Filename>Mandrakelinux-Office-Accessories-kcalc.desktop</Filename>
+ <Filename>Mandrakelinux-Office-Accessories-oooqs.desktop</Filename>
+ <Merge type="files"/>
+ </Layout>
+ <Directory>mandrakelinux$2doffice$2daccessories.directory</Directory>
+ <Include>
+ <Or>
+ <Category>X-Mandrakelinux-Office-Accessories</Category>
+ <Category>Calculator</Category>
+ </Or>
+ </Include>
+ </Menu>
+ <Menu>
+ <Name>Address Books</Name>
+ <Layout>
+ <Merge type="menus"/>
+ <Filename>Mandrakelinux-Office-AddressBooks-kaddressbook.desktop</Filename>
+ <Merge type="files"/>
+ </Layout>
+ <Directory>mandrakelinux$2doffice$2daddressbooks.directory</Directory>
+ <Include>
+ <Or>
+ <Category>X-Mandrakelinux-Office-AddressBooks</Category>
+ <Category>ContactManagement</Category>
+ </Or>
+ </Include>
+ </Menu>
+ <Menu>
+ <Name>Communications</Name>
+ <Layout>
+ <Menuname>Fax</Menuname>
+ <Menuname>Phone</Menuname>
+ <Menuname>PDA</Menuname>
+ <Menuname>Other</Menuname>
+ <Merge type="menus"/>
+ <Merge type="files"/>
+ </Layout>
+ <Directory>mandrakelinux$2doffice$2dcommunications.directory</Directory>
+ <Include>
+ <Or>
+ <Category>X-Mandrakelinux-Office-Communications</Category>
+ </Or>
+ </Include>
+ <Menu>
+ <Name>Fax</Name>
+ <Directory>mandrakelinux$2doffice$2dcommunications$2dfax.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-Office-Communications-Fax</Category>
+ </Include>
+ </Menu>
+ <Menu>
+ <Name>PDA</Name>
+ <Layout>
+ <Merge type="menus"/>
+ <Filename>Mandrakelinux-Office-Communications-PDA-kpilot.desktop</Filename>
+ <Merge type="files"/>
+ </Layout>
+ <Directory>mandrakelinux$2doffice$2dcommunications$2dpda.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-Office-Communications-PDA</Category>
+ </Include>
+ </Menu>
+ <Menu>
+ <Name>Phone</Name>
+ <Directory>mandrakelinux$2doffice$2dcommunications$2dphone.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-Office-Communications-Phone</Category>
+ </Include>
+ </Menu>
+ <Menu>
+ <Name>Other</Name>
+ <Directory>mandrakelinux$2doffice$2dcommunications$2dother.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-Office-Communications-Other</Category>
+ </Include>
+ </Menu>
+ </Menu>
+ <Menu>
+ <Name>Drawing</Name>
+ <Layout>
+ <Merge type="menus"/>
+ <Filename>Mandrakelinux-Office-Drawing-OpenOffice.org Draw.desktop</Filename>
+ <Merge type="files"/>
+ </Layout>
+ <Directory>mandrakelinux$2doffice$2ddrawing.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-Office-Drawing</Category>
+ </Include>
+ </Menu>
+ <Menu>
+ <Name>Graphs</Name>
+ <Layout>
+ <Merge type="menus"/>
+ <Filename>Mandrakelinux-Office-Graphs-Dia.desktop</Filename>
+ <Merge type="files"/>
+ </Layout>
+ <Directory>mandrakelinux$2doffice$2dgraphs.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-Office-Graphs</Category>
+ </Include>
+ </Menu>
+ <Menu>
+ <Name>Presentations</Name>
+ <Layout>
+ <Merge type="menus"/>
+ <Filename>Mandrakelinux-Office-Presentations-OpenOffice.org Impress.desktop</Filename>
+ <Merge type="files"/>
+ </Layout>
+ <Directory>mandrakelinux$2doffice$2dpresentations.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-Office-Presentations</Category>
+ </Include>
+ </Menu>
+ <Menu>
+ <Name>Publishing</Name>
+ <Layout>
+ <Merge type="menus"/>
+ <Filename>Mandrakelinux-Office-Publishing-Xpdf.desktop</Filename>
+ <Filename>Mandrakelinux-Office-Publishing-GhostView.desktop</Filename>
+ <Merge type="files"/>
+ </Layout>
+ <Directory>mandrakelinux$2doffice$2dpublishing.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-Office-Publishing</Category>
+ </Include>
+ </Menu>
+ <Menu>
+ <Name>Spreadsheets</Name>
+ <Layout>
+ <Merge type="menus"/>
+ <Filename>Mandrakelinux-Office-Spreadsheets-OpenOffice.org Calc.desktop</Filename>
+ <Merge type="files"/>
+ </Layout>
+ <Directory>mandrakelinux$2doffice$2dspreadsheets.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-Office-Spreadsheets</Category>
+ </Include>
+ </Menu>
+ <Menu>
+ <Name>Tasks Management</Name>
+ <Layout>
+ <Merge type="menus"/>
+ <Filename>Mandrakelinux-Office-TasksManagement-Planner.desktop</Filename>
+ <Merge type="files"/>
+ </Layout>
+ <Directory>mandrakelinux$2doffice$2dtasksmanagement.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-Office-TasksManagement</Category>
+ </Include>
+ </Menu>
+ <Menu>
+ <Name>Time Management</Name>
+ <Layout>
+ <Merge type="menus"/>
+ <Filename>Mandrakelinux-Office-TimeManagement-korganizer.desktop</Filename>
+ <Merge type="files"/>
+ </Layout>
+ <Directory>mandrakelinux$2doffice$2dtimemanagement.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-Office-TimeManagement</Category>
+ </Include>
+ </Menu>
+ <Menu>
+ <Name>Other</Name>
+ <Directory>mandrakelinux$2doffice$2dother.directory</Directory>
+ <Include>
+ <Or>
+ <Category>X-Mandrakelinux-Office-Other</Category>
+ </Or>
+ </Include>
+ </Menu>
+ <Menu>
+ <Name>Wordprocessors</Name>
+ <Layout>
+ <Merge type="menus"/>
+ <Filename>Mandrakelinux-Office-Wordprocessors-OpenOffice.org Writer.desktop</Filename>
+ <Filename>Mandrakelinux-Office-Wordprocessors-OpenOffice.org Math.desktop</Filename>
+ <Merge type="files"/>
+ </Layout>
+ <Directory>mandrakelinux$2doffice$2dwordprocessors.directory</Directory>
+ <Include>
+ <Or>
+ <Category>X-Mandrakelinux-Office-Wordprocessors</Category>
+ <Category>Wordprocessor</Category>
+ </Or>
+ </Include>
+ </Menu>
+ </Menu>
+ <Menu>
+ <Name>Internet</Name>
+ <Layout>
+ <Menuname>Web Browsers</Menuname>
+ <Menuname>Mail</Menuname>
+ <Menuname>Instant Messaging</Menuname>
+ <Menuname>Chat</Menuname>
+ <Menuname>News</Menuname>
+ <Menuname>File Transfer</Menuname>
+ <Menuname>Video Conference</Menuname>
+ <Menuname>Web Editors</Menuname>
+ <Menuname>Remote Access</Menuname>
+ <Menuname>Other</Menuname>
+ <Merge type="menus"/>
+ <Merge type="files"/>
+ </Layout>
+ <Directory>mandrakelinux$2dinternet.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-Internet</Category>
+ </Include>
+ <Menu>
+ <Name>Chat</Name>
+ <Layout>
+ <Merge type="menus"/>
+ <Filename>Mandrakelinux-Internet-Chat-ksirc.desktop</Filename>
+ <Merge type="files"/>
+ </Layout>
+ <Directory>mandrakelinux$2dinternet$2dchat.directory</Directory>
+ <Include>
+ <Or>
+ <Category>X-Mandrakelinux-Internet-Chat</Category>
+ <Category>IRCClient</Category>
+ </Or>
+ </Include>
+ </Menu>
+ <Menu>
+ <Name>File Transfer</Name>
+ <Layout>
+ <Merge type="menus"/>
+ <Filename>Mandrakelinux-Internet-FileTransfer-kbear.desktop</Filename>
+ <Filename>Mandrakelinux-Internet-FileTransfer-Gtm.desktop</Filename>
+ <Merge type="files"/>
+ </Layout>
+ <Directory>mandrakelinux$2dinternet$2dfiletransfert.directory</Directory>
+ <Include>
+ <Or>
+ <Category>X-Mandrakelinux-FileTransfer</Category>
+ </Or>
+ </Include>
+ </Menu>
+
+ <Menu>
+ <Name>Instant Messaging</Name>
+ <Layout>
+ <Merge type="menus"/>
+ <Filename>Mandrakelinux-Internet-InstantMessaging-kopete.desktop</Filename>
+ <Filename>Mandrakelinux-Internet-InstantMessaging-Gaim.desktop</Filename>
+ <Merge type="files"/>
+ </Layout>
+ <Directory>mandrakelinux$2dinternet$2dinstantmessaging.directory</Directory>
+ <Include>
+ <Or>
+ <Category>X-Mandrakelinux-Internet-InstantMessaging</Category>
+ <Category>InstantMessaging</Category>
+ </Or>
+ </Include>
+ </Menu>
+ <Menu>
+ <Name>Mail</Name>
+ <Layout>
+ <Merge type="menus"/>
+ <Filename>Mandrakelinux-Internet-Mail-Kontact.desktop</Filename>
+ <Filename>Mandrakelinux-Internet-Mail-Evolution.desktop</Filename>
+ <Filename>Mandrakelinux-Internet-Mail-Mozilla Thunderbird.desktop</Filename>
+ <Merge type="files"/>
+ </Layout>
+ <Directory>mandrakelinux$2dinternet$2dmail.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-Internet-Mail</Category>
+ </Include>
+ </Menu>
+ <Menu>
+ <Name>News</Name>
+ <Layout>
+ <Merge type="menus"/>
+ <Filename>Mandrakelinux-Internet-News-KNode.desktop</Filename>
+ <Merge type="files"/>
+ </Layout>
+ <Directory>mandrakelinux$2dinternet$2dnews.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-Internet-News</Category>
+ </Include>
+ </Menu>
+ <Menu>
+ <Name>Video Conference</Name>
+ <Directory>mandrakelinux$2dinternet$2dkppp.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-Internet-VideoConference</Category>
+ </Include>
+ </Menu>
+ <Menu>
+ <Name>Other</Name>
+ <Directory>mandrakelinux$2dinternet$2dother.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-Internet-Other</Category>
+ </Include>
+ </Menu>
+ <Menu>
+ <Name>Remote Access</Name>
+ <Layout>
+ <Merge type="menus"/>
+ <Filename>Mandrakelinux-Internet-RemoteAccess-Kppp.desktop</Filename>
+ <Merge type="files"/>
+ </Layout>
+ <Directory>mandrakelinux$2dinternet$2dremoteaccess.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-Internet-RemoteAccess</Category>
+ </Include>
+ </Menu>
+ <Menu>
+ <Name>Web Browsers</Name>
+ <Layout>
+ <Merge type="menus"/>
+ <Filename>Mandrakelinux-Internet-WebBrowsers-konqbrowser.desktop</Filename>
+ <Filename>Mandrakelinux-Internet-WebBrowsers-Mozilla.desktop</Filename>
+ <Filename>Mandrakelinux-Internet-WebBrowsers-Mozilla Firefox.desktop</Filename>
+ <Filename>Mandrakelinux-Internet-WebBrowsers-Epiphany Web Browser.desktop</Filename>
+ <Filename>Mandrakelinux-Internet-WebBrowsers-Epiphany Bookmarks Editor.desktop</Filename>
+ <Merge type="files"/>
+ </Layout>
+ <Directory>mandrakelinux$2dinternet$2dwebbrowsers.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-Internet-WebBrowsers</Category>
+ </Include>
+ </Menu>
+ <Menu>
+ <Name>Web Editors</Name>
+ <Directory>mandrakelinux$2dinternet$2dwebeditors.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-Internet-WebEditors</Category>
+ </Include>
+ </Menu>
+ </Menu>
+ <Menu>
+ <Name>More Applications</Name>
+ <Layout>
+ <Menuname>Accessibility</Menuname>
+ <Menuname>Development</Menuname>
+ <Menuname>Editors</Menuname>
+ <Menuname>Emulators</Menuname>
+ <Menuname>Finances</Menuname>
+ <Menuname>Databases</Menuname>
+ <Menuname>Education</Menuname>
+ <Menuname>Sciences</Menuname>
+ <Menuname>Communications</Menuname>
+ <Menuname>Games</Menuname>
+ <Menuname>Documentation</Menuname>
+ <Menuname>Other</Menuname>
+ <Merge type="menus"/>
+ <Merge type="files"/>
+ </Layout>
+ <Directory>mandrakelinux$2dmoreapplications.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-MoreApplications</Category>
+ </Include>
+ <Menu>
+ <Name>Accessibility</Name>
+ <Layout>
+ <Merge type="menus"/>
+ <Filename>Mandrakelinux-MoreApplications-Accessibility-kmag.desktop</Filename>
+ <Merge type="files"/>
+ </Layout>
+ <Directory>mandrakelinux$2dmoreapplications$2daccessibility.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-MoreApplications-Accessibility</Category>
+ </Include>
+ </Menu>
+ <Menu>
+ <Name>Communications</Name>
+ <Directory>mandrakelinux$2dmoreapplications$2dcommunications.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-MoreApplications-Communications</Category>
+ </Include>
+ </Menu>
+ <Menu>
+ <Name>Databases</Name>
+ <Directory>mandrakelinux$2dmoreapplications$2ddatabases.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-MoreApplications-Databases</Category>
+ </Include>
+ </Menu>
+ <Menu>
+ <Name>Development</Name>
+ <Layout>
+ <Menuname>Development Environment</Menuname>
+ <Menuname>Interpreters</Menuname>
+ <Menuname>Tools</Menuname>
+ <Menuname>Code Generators</Menuname>
+ <Merge type="menus"/>
+ <Merge type="files"/>
+ </Layout>
+ <Directory>mandrakelinux$2dmoreapplications$2ddevelopment.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-MoreApplications-Development</Category>
+ </Include>
+ <Menu>
+ <Name>Development Environments</Name>
+ <Layout>
+ <Merge type="menus"/>
+ <Filename>Mandrakelinux-MoreApplications-Development-DevelopmentEnvironments-kdevelop.desktop</Filename>
+ <Merge type="files"/>
+ </Layout>
+ <Directory>mandrakelinux$2dmoreapplications$2ddevelopment$2ddevelopmentenvironments.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-MoreApplications-Development-DevelopmentEnvironments</Category>
+ </Include>
+ </Menu>
+ <Menu>
+ <Name>Interpreters</Name>
+ <Layout>
+ <Merge type="menus"/>
+ <Filename>Mandrakelinux-MoreApplications-Development-Interpreters-GNU Prolog.desktop</Filename>
+ <Merge type="files"/>
+ </Layout>
+ <Directory>mandrakelinux$2dmoreapplications$2ddevelopment$2dinterpreters.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-MoreApplications-Development-Interpreters</Category>
+ </Include>
+ </Menu>
+ <Menu>
+ <Name>Tools</Name>
+ <Layout>
+ <Merge type="menus"/>
+ <Filename>Mandrakelinux-MoreApplications-Development-Tools-Gdb.desktop</Filename>
+ <Merge type="files"/>
+ </Layout>
+ <Directory>mandrakelinux$2dmoreapplications$2ddevelopment$2dtools.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-MoreApplications-Development-Tools</Category>
+ </Include>
+ </Menu>
+ <Menu>
+ <Name>Other</Name>
+ <Directory>mandrakelinux$2dmoreapplications$2ddevelopment$2dother.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-MoreApplications-Development-Other</Category>
+ </Include>
+ </Menu>
+ </Menu>
+ <Menu>
+ <Name>Documentation</Name>
+ <Directory>mandrakelinux$2dmoreapplications$2ddocumentation.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-MoreApplications-Documentation</Category>
+ </Include>
+ </Menu>
+ <Menu>
+ <Name>Other</Name>
+ <Directory>mandrakelinux$2dmoreapplications$2dother.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-MoreApplications-Other</Category>
+ </Include>
+ </Menu>
+ <Menu>
+ <Name>Editors</Name>
+ <Layout>
+ <Merge type="menus"/>
+ <Filename>Mandrakelinux-MoreApplications-Editors-Emacs.desktop</Filename>
+ <Filename>Mandrakelinux-MoreApplications-Editors-XEmacs.desktop</Filename>
+ <Filename>Mandrakelinux-MoreApplications-Editors-VI editor.desktop</Filename>
+ <Merge type="files"/>
+ </Layout>
+ <Directory>mandrakelinux$2dmoreapplications$2deditors.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-MoreApplications-Editors</Category>
+ </Include>
+ </Menu>
+ <Menu>
+ <Name>Education</Name>
+ <Layout>
+ <Menuname>Economy</Menuname>
+ <Menuname>Geography</Menuname>
+ <Menuname>History</Menuname>
+ <Menuname>Languages</Menuname>
+ <Menuname>Literature</Menuname>
+ <Menuname>Sciences</Menuname>
+ <Menuname>Sports</Menuname>
+ <Menuname>Other</Menuname>
+ <Merge type="menus"/>
+ <Merge type="files"/>
+ </Layout>
+ <Directory>mandrakelinux$2dmoreapplications$2deducation.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-MoreApplications-Education</Category>
+ </Include>
+ <Menu>
+ <Name>Economy</Name>
+ <Directory>mandrakelinux$2dmoreapplications$2deducation$2deconomy.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-MoreApplications-Education-Economy</Category>
+ </Include>
+ </Menu>
+ <Menu>
+ <Name>Geography</Name>
+ <Directory>mandrakelinux$2dmoreapplications$2deducatino$2dgeography.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-MoreApplications-Education-Geography</Category>
+ </Include>
+ </Menu>
+ <Menu>
+ <Name>History</Name>
+ <Directory>mandrakelinux$2dmoreapplications$2deducation$2dhistory.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-MoreApplications-Education-History</Category>
+ </Include>
+ </Menu>
+ <Menu>
+ <Name>Languages</Name>
+ <Directory>mandrakelinux$2dmoreapplications$2deducation$2dlanguages.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-MoreApplications-Education-Languages</Category>
+ </Include>
+ </Menu>
+ <Menu>
+ <Name>Literature</Name>
+ <Directory>mandrakelinux$2dmoreapplications$2deducation$2dliterature.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-MoreApplications-Education-Literature</Category>
+ </Include>
+ </Menu>
+ <Menu>
+ <Name>Sciences</Name>
+ <Directory>mandrakelinux$2dmoreapplications$2deducation$2dsciences.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-MoreApplications-Education-Sciences</Category>
+ </Include>
+ </Menu>
+ <Menu>
+ <Name>Sports</Name>
+ <Directory>mandrakelinux$2dmoreapplications$2deducation$2dsports.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-MoreApplications-Education-Sports</Category>
+ </Include>
+ </Menu>
+ <Menu>
+ <Name>Other</Name>
+ <Directory>mandrakelinux$2dmoreapplications$2deducation$2dother.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-MoreApplications-Education-Other</Category>
+ </Include>
+ </Menu>
+ </Menu>
+
+ <Menu>
+ <Name>Games</Name>
+ <Layout>
+ <Menuname>Adventure</Menuname>
+ <Menuname>Arcade</Menuname>
+ <Menuname>Boards</Menuname>
+ <Menuname>Cards</Menuname>
+ <Menuname>Puzzles</Menuname>
+ <Menuname>Sports</Menuname>
+ <Menuname>Strategy</Menuname>
+ <Menuname>Toys</Menuname>
+ <Merge type="menus"/>
+ <Merge type="files"/>
+ </Layout>
+ <Directory>mandrakelinux$2dmoreapplications$2dgames.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-MoreApplications-Games</Category>
+ </Include>
+ <Menu>
+ <Name>Adventure</Name>
+ <Directory>mandrakelinux$2dmoreapplications$2dgames$2dadventure.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-MoreApplications-Games-Adventure</Category>
+ </Include>
+ </Menu>
+ <Menu>
+ <Name>Arcade</Name>
+ <Directory>mandrakelinux$2dmoreapplications$2dgames$2darcade.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-MoreApplications-Games-Arcade</Category>
+ </Include>
+ </Menu>
+ <Menu>
+ <Name>Boards</Name>
+ <Directory>mandrakelinux$2dmoreapplications$2dgames$2dboards.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-MoreApplications-Games-Boards</Category>
+ </Include>
+ </Menu>
+ <Menu>
+ <Name>Cards</Name>
+ <Directory>mandrakelinux$2dmoreapplications$2dgames$2dcards.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-MoreApplications-Games-Cards</Category>
+ </Include>
+ </Menu>
+ <Menu>
+ <Name>Puzzles</Name>
+ <Directory>mandrakelinux$2dmoreapplications$2dgames$2dpuzzles.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-MoreApplications-Games-Puzzles</Category>
+ </Include>
+ </Menu>
+ <Menu>
+ <Name>Sports</Name>
+ <Directory>mandrakelinux$2dmoreapplications$2dgames$2dsports.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-MoreApplications-Games-Sports</Category>
+ </Include>
+ </Menu>
+ <Menu>
+ <Name>Strategy</Name>
+ <Directory>mandrakelinux$2dmoreapplications$2dgames$2dstrategy.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-MoreApplications-Games-Strategy</Category>
+ </Include>
+ </Menu>
+ <Menu>
+ <Name>Other</Name>
+ <Directory>mandrakelinux$2dmoreapplications$2dgames$2dother.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-MoreApplications-Games-Other</Category>
+ </Include>
+ </Menu>
+ <Menu>
+ <Name>Toys</Name>
+ <Directory>mandrakelinux$2dmoreapplications$2dgames$2dtoys.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-MoreApplications-Games-Toys</Category>
+ </Include>
+ </Menu>
+ </Menu>
+ <Menu>
+ <Name>Sciences</Name>
+ <Layout>
+ <Menuname>Artificial Intelligence</Menuname>
+ <Menuname>Astronomy</Menuname>
+ <Menuname>Biology</Menuname>
+ <Menuname>Chemistry</Menuname>
+ <Menuname>Computer Science</Menuname>
+ <Menuname>Data Visualization</Menuname>
+ <Menuname>Electricity</Menuname>
+ <Menuname>Geosciences</Menuname>
+ <Menuname>Image Processing</Menuname>
+ <Menuname>Mathematics</Menuname>
+ <Menuname>Numeric analysis</Menuname>
+ <Menuname>Parallel Computing</Menuname>
+ <Menuname>Physics</Menuname>
+ <Menuname>Robotics</Menuname>
+ <Menuname>Other</Menuname>
+ <Merge type="menus"/>
+ <Merge type="files"/>
+ </Layout>
+ <Directory>mandrakelinux$2dmoreapplications$2dsciences.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-MoreApplications-Sciences</Category>
+ </Include>
+ <Menu>
+ <Name>Artificial Intelligence</Name>
+ <Directory>mandrakelinux$2dmoreapplications$2dsciences$2dartificialintelligence.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-MoreApplications-Sciences-ArtificialIntelligence</Category>
+ </Include>
+ </Menu>
+ <Menu>
+ <Name>Astronomy</Name>
+ <Directory>mandrakelinux$2dmoreapplications$2dsciences$2dastronomy.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-MoreApplications-Sciences-Astronomy</Category>
+ </Include>
+ </Menu>
+ <Menu>
+ <Name>Biology</Name>
+ <Directory>mandrakelinux$2dmoreapplications$2dsciences$2dbiology.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-MoreApplications-Sciences-Biology</Category>
+ </Include>
+ </Menu>
+ <Menu>
+ <Name>Chemistry</Name>
+ <Directory>mandrakelinux$2dmoreapplications$2dsciences$2dchemistry.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-MoreApplications-Sciences-Chemistry</Category>
+ </Include>
+ </Menu>
+ <Menu>
+ <Name>Computer Science</Name>
+ <Directory>mandrakelinux$2dmoreapplications$2dsciences$2dcomputerscience.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-MoreApplications-Sciences-ComputerScience</Category>
+ </Include>
+ </Menu>
+ <Menu>
+ <Name>Data Visualization</Name>
+ <Directory>mandrakelinux$2dmoreapplications$2dsciences$2ddatavisualization.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-MoreApplications-Sciences-DataVisualization</Category>
+ </Include>
+ </Menu>
+ <Menu>
+ <Name>Electricity</Name>
+ <Directory>mandrakelinux$2dmoreapplications$2dsciences$2delectricity.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-MoreApplications-Sciences-Electricity</Category>
+ </Include>
+ </Menu>
+ <Menu>
+ <Name>Geosciences</Name>
+ <Directory>mandrakelinux$2dmoreapplications$2dsciences$2dgeosciences.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-MoreApplications-Sciences-Geosciences</Category>
+ </Include>
+ </Menu>
+ <Menu>
+ <Name>Image Processing</Name>
+ <Directory>mandrakelinux$2dmoreapplications$2dsciences$2dimageprocessing.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-MoreApplications-Sciences-ImageProcessing</Category>
+ </Include>
+ </Menu>
+ <Menu>
+ <Name>Mathematics</Name>
+ <Directory>mandrakelinux$2dmoreapplications$2dsciences$2dmathematics.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-MoreApplications-Sciences-Mathematics</Category>
+ </Include>
+ </Menu>
+ <Menu>
+ <Name>Numeric Analysis</Name>
+ <Directory>mandrakelinux$2dmoreapplications$2dsciences$2dnumericanalysis.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-MoreApplications-Sciences-NumericAnalysis</Category>
+ </Include>
+ </Menu>
+ <Menu>
+ <Name>Parallel Computing</Name>
+ <Directory>mandrakelinux$2dmoreapplications$2dsciences$2dparallelcomputing.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-MoreApplications-Sciences-ParallelComptuting</Category>
+ </Include>
+ </Menu>
+ <Menu>
+ <Name>Physics</Name>
+ <Directory>mandrakelinux$2dmoreapplications$2dsciences$2dphysics.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-MoreApplications-Sciences-Physics</Category>
+ </Include>
+ </Menu>
+ <Menu>
+ <Name>Robotics</Name>
+ <Directory>mandrakelinux$2dmoreapplications$2dsciences$2drobotics.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-MoreApplications-Sciences-Robotics</Category>
+ </Include>
+ </Menu>
+ <Menu>
+ <Name>Other</Name>
+ <Directory>mandrakelinux$2dmoreapplications$2dsciences$2dother.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-MoreApplications-Sciences-Other</Category>
+ </Include>
+ </Menu>
+ </Menu>
+ </Menu>
+ <Menu>
+ <Name>Multimedia</Name>
+ <Layout>
+ <Menuname>Sound</Menuname>
+ <Menuname>Video</Menuname>
+ <Menuname>Graphics</Menuname>
+ <Menuname>Other</Menuname>
+ <Merge type="menus"/>
+ <Merge type="files"/>
+ </Layout>
+ <Directory>mandrakelinux$2dmultimedia.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-Multimedia</Category>
+ </Include>
+ <Menu>
+ <Name>Graphics</Name>
+ <Layout>
+ <Merge type="menus"/>
+ <Filename>Mandrakelinux-Multimedia-Graphics-The GIMP.desktop</Filename>
+ <Filename>Mandrakelinux-Multimedia-Graphics-kooka.desktop</Filename>
+ <Merge type="files"/>
+ </Layout>
+ <Directory>mandrakelinux$2dmultimedia$2dgraphics.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-Multimedia-Graphics</Category>
+ </Include>
+ </Menu>
+ <Menu>
+ <Name>Sound</Name>
+ <Layout>
+ <Merge type="menus"/>
+ <Filename>Mandrakelinux-Multimedia-Sound-kscd.desktop</Filename>
+ <Filename>Mandrakelinux-Multimedia-Sound-Totem Media Player.desktop</Filename>
+ <Merge type="files"/>
+ </Layout>
+ <Directory>mandrakelinux$2dmultimedia$2dsound.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-Multimedia-Sound</Category>
+ </Include>
+ </Menu>
+ <Menu>
+ <Name>Video</Name>
+ <Layout>
+ <Merge type="menus"/>
+ <Filename>Mandrakelinux-Multimedia-Video-Totem Movie Player.desktop</Filename>
+ <Merge type="files"/>
+ </Layout>
+ <Directory>mandrakelinux$2dmultimedia$2dvideo.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-Multimedia-Video</Category>
+ </Include>
+ </Menu>
+ <Menu>
+ <Name>Other</Name>
+ <Directory>mandrakelinux$2dmultimedia$2dother.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-Multimedia-Other</Category>
+ </Include>
+ </Menu>
+ </Menu>
+ <Menu>
+ <Name>System</Name>
+ <Layout>
+ <Menuname>Terminals</Menuname>
+ <Menuname>Text Tools</Menuname>
+ <Menuname>Configuration</Menuname>
+ <Menuname>Archiving</Menuname>
+ <Menuname>File Tools</Menuname>
+ <Menuname>Monitoring</Menuname>
+ <Menuname>Session</Menuname>
+ <Merge type="menus"/>
+ <Merge type="files"/>
+ </Layout>
+ <Directory>mandrakelinux$2dsystem.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-System</Category>
+ </Include>
+ <Menu>
+ <Name>Archiving</Name>
+ <Layout>
+ <Menuname>Backup</Menuname>
+ <Menuname>CD Burning</Menuname>
+ <Menuname>Compression</Menuname>
+ <Menuname>Other</Menuname>
+ <Merge type="menus"/>
+ <Merge type="files"/>
+ </Layout>
+ <Directory>mandrakelinux$2dsystem$2darchiving.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-System-Archiving</Category>
+ </Include>
+ <Menu>
+ <Name>Backup</Name>
+ <Layout>
+ <Merge type="menus"/>
+ <Filename>Mandrakelinux-System-Archiving-Backup-DrakSync.desktop</Filename>
+ <Merge type="files"/>
+ </Layout>
+ <Directory>mandrakelinux$2dsystem$2darchiving$2dbackup.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-System-Archiving-Backup</Category>
+ </Include>
+ </Menu>
+ <Menu>
+ <Name>CD Burning</Name>
+ <Layout>
+ <Merge type="menus"/>
+ <Filename>Mandrakelinux-System-Archiving-CDBurning-k3b.desktop</Filename>
+ <Merge type="files"/>
+ </Layout>
+ <Directory>mandrakelinux$2dsystem$2darchiving$2dcdburning.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-System-Archiving-CDBurning</Category>
+ </Include>
+ </Menu>
+ <Menu>
+ <Name>Compression</Name>
+ <Directory>mandrakelinux$2dsystem$2darchiving$2dcompression.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-System-Archiving-Compression</Category>
+ </Include>
+ </Menu>
+ <Menu>
+ <Name>Other</Name>
+ <Directory>mandrakelinux$2dsystem$2darchiving$2dother.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-System-Archiving-Other</Category>
+ </Include>
+ </Menu>
+ </Menu>
+ <Menu>
+ <Name>Configuration</Name>
+ <Layout>
+ <Filename>Mandrakelinux-System-Configuration-KControl.desktop</Filename>
+ <Filename>Mandrakelinux-System-Configuration-Configure Your Computer.desktop</Filename>
+ <Menuname>Boot and Init</Menuname>
+ <Menuname>KDE</Menuname>
+ <Menuname>GNOME</Menuname>
+ <Menuname>Hardware</Menuname>
+ <Menuname>Networking</Menuname>
+ <Menuname>Packaging</Menuname>
+ <Menuname>Printing</Menuname>
+ <Merge type="menus"/>
+ <Merge type="files"/>
+ </Layout>
+ <Directory>mandrakelinux$2dsystem$2dconfiguration.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-System-Configuration</Category>
+ </Include>
+ <Menu>
+ <Name>Boot and Init</Name>
+ <Directory>mandrakelinux$2dsystem$2dconfiguration$2dbootandinit.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-System-Configuration-BootandInit</Category>
+ </Include>
+ </Menu>
+ <Menu>
+ <Name>GNOME</Name>
+ <Directory>mandrakelinux$2dsystem$2dconfiguration$2dgnome.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-System-Configuration-GNOME</Category>
+ </Include>
+ <Menu>
+ <Name>Advanced</Name>
+ <Directory>mandrakelinux$2dsystem$2dconfiguration$2dgnome$2dadvanced.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-System-Configuration-GNOME-Advanced</Category>
+ </Include>
+ </Menu>
+ </Menu>
+ <Menu>
+ <Name>KDE</Name>
+ <Directory>mandrakelinux$2dsystem$2dconfiguration$2dkde.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-System-Configuration-KDE</Category>
+ </Include>
+ <Menu>
+ <Name>Components</Name>
+ <Directory>mandrakelinux$2dsystem$2dconfiguration$2dkde$2dcomponents.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-System-Configuration-KDE-Components</Category>
+ </Include>
+ </Menu>
+ <Menu>
+ <Name>System</Name>
+ <Directory>mandrakelinux$2dsystem$2dconfiguration$2dkde$2dsystem.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-System-Configuration-KDE-System</Category>
+ </Include>
+ </Menu>
+ </Menu>
+ <Menu>
+ <Name>Networking</Name>
+ <Directory>mandrakelinux$2dsystem$2dconfiguration$2dnetworking.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-System-Configuration-Networking</Category>
+ </Include>
+ </Menu>
+ <Menu>
+ <Name>Packaging</Name>
+ <Directory>mandrakelinux$2dsystem$2dconfiguration$2dpackaging.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-System-Configuration-Packaging</Category>
+ </Include>
+ </Menu>
+ <Menu>
+ <Name>Printing</Name>
+ <Directory>mandrakelinux$2dsystem$2dconfiguration$2dprinting.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-System-Configuration-Printing</Category>
+ </Include>
+ </Menu>
+ <Menu>
+ <Name>Users</Name>
+ <Directory>mandrakelinux$2dsystem$2dconfiguration$2dusers.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-System-Configuration-Users</Category>
+ </Include>
+ </Menu>
+ <Menu>
+ <Name>Other</Name>
+ <Directory>mandrakelinux$2dsystem$2dconfiguration$2dother.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-System-Configuration-Other</Category>
+ </Include>
+ </Menu>
+ </Menu>
+ <Menu>
+ <Name>File Tools</Name>
+ <Layout>
+ <Merge type="menus"/>
+ <Filename>Mandrakelinux-System-FileTools-Kfind.desktop</Filename>
+ <Merge type="files"/>
+ </Layout>
+ <Directory>mandrakelinux$2dsystem$2dfiletools.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-System-FileTools</Category>
+ </Include>
+ </Menu>
+ <Menu>
+ <Name>Monitoring</Name>
+ <Layout>
+ <Merge type="menus"/>
+ <Filename>Mandrakelinux-System-Monitoring-ksysguard.desktop</Filename>
+ <Merge type="files"/>
+ </Layout>
+ <Directory>mandrakelinux$2dsystem$2dmonitoring.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-System-Monitoring</Category>
+ </Include>
+ </Menu>
+ <Menu>
+ <Name>Session</Name>
+ <Directory>mandrakelinux$2dsystem$2dsession.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-System-Session</Category>
+ </Include>
+ <Menu>
+ <Name>Windowmanagers</Name>
+ <Directory>mandrakelinux$2dsystem$2dsession$2dwindowmanagers.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-System-Session-Windowmanagers</Category>
+ </Include>
+ </Menu>
+ </Menu>
+ <Menu>
+ <Name>Terminals</Name>
+ <Layout>
+ <Merge type="menus"/>
+ <Filename>Mandrakelinux-System-Terminals-konsole.desktop</Filename>
+ <Merge type="files"/>
+ </Layout>
+ <Directory>mandrakelinux$2dsystem$2dterminals.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-System-Terminals</Category>
+ </Include>
+ </Menu>
+ <Menu>
+ <Name>Text Tools</Name>
+ <Layout>
+ <Merge type="menus"/>
+ <Filename>Mandrakelinux-System-TextTools-kdict.desktop</Filename>
+ <Merge type="files"/>
+ </Layout>
+ <Directory>mandrakelinux$2dsystem$2dtexttools.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-System-TextTools</Category>
+ </Include>
+ </Menu>
+ </Menu>
+ <Menu>
+ <Name>Other</Name>
+ <Directory>mandrakelinux$2d$2eother.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-Other</Category>
+ </Include>
+ </Menu>
+ <Menu>
+ <Name>.hidden</Name>
+ <Directory>mandrakelinux$2d$2ehidden.directory</Directory>
+ <Include>
+ <Category>X-Mandrakelinux-.hidden</Category>
+ </Include>
+ </Menu>
+</Menu>
diff --git a/menu/menu b/menu/menu
index 6ed4fe7..fb69b89 100644
--- a/menu/menu
+++ b/menu/menu
@@ -69,7 +69,7 @@
?package(menu): needs=x11 section="More Applications" title="Communications" icon="communications_section.png"
?package(menu): needs=x11 section="More Applications" title="Databases" icon="databases_section.png"
#
-?package(menu): needs=x11 section="More Applications" title="Development" icon="development_section.png" order="Development Environment,Interpreter,Tools,Code Generators,_mergemenu_,_mergefile_"
+?package(menu): needs=x11 section="More Applications" title="Development" icon="development_section.png" order="Development Environment,Interpreters,Tools,Code Generators,_mergemenu_,_mergefile_"
?package(menu): needs=x11 section="More Applications/Development" title="Code Generators" icon="code_generator_section.png"
?package(menu): needs=x11 section="More Applications/Development" title="Development Environments" icon="development_environment_section.png" order="_mergemenu_,kdevelop,_mergefile_"
?package(menu): needs=x11 section="More Applications/Development" title="Interpreters" icon="interpreters_section.png" order="_mergemenu_,GNU Prolog,_mergefile_"
diff --git a/menu/update-menus b/menu/update-menus
new file mode 100755
index 0000000..c03fde5
--- /dev/null
+++ b/menu/update-menus
@@ -0,0 +1,40 @@
+#!/bin/sh
+
+usage() {
+echo "Usage: update-menus [options]"
+echo " -v Be verbose about what is going on."
+echo " -u generate only user menu (useful for root user)"
+echo " -h, --help This message."
+
+exit 0
+}
+
+
+VERBOSE=0
+
+if [ "$UID" == "0" ]; then
+ USER_MENU=0
+else
+ USER_MENU=1
+fi
+
+if [ $# != 0 ]; then
+
+while getopts ":vunh" option
+do
+ case $option in
+ v ) VERBOSE=1 ; RUN_PARTS_ARG="--verbose" ;;
+ u ) USER_MENU=1 ;;
+ h ) usage ;;
+ esac
+done
+fi
+
+export VERBOSE
+export USER_MENU
+
+if [ -d /etc/menu.d ]; then
+ run-parts $RUN_PARTS_ARG /etc/menu.d
+ echo
+fi
+
diff --git a/menu/xdg_menu b/menu/xdg_menu
new file mode 100755
index 0000000..b39575b
--- /dev/null
+++ b/menu/xdg_menu
@@ -0,0 +1,2210 @@
+#!/usr/bin/perl
+
+# Copyright (c) 2003 SuSE Linux AG, Nuernberg, Germany. All rights reserved.
+#
+# Author: nadvornik@suse.cz
+#
+#
+
+use strict;
+use Locale::gettext;
+use Getopt::Long;
+use Encode;
+use I18N::Langinfo qw(langinfo CODESET);
+use POSIX qw(locale_h);
+
+my $Version = "0.2";
+
+my $DefaultAppDirs;
+my $DefaultDirectoryDirs;
+my @KDELegacyDirs;
+
+my $format = 'WindowMaker';
+my $desktop_name;
+my $language = '';
+my $charset = 'iso-8859-1';
+my $root_cmd = 'xdg_menu_su';
+
+my $die_on_error = 0;
+my $verbose = 0;
+my $fullmenu = 0;
+
+my @language_keys;
+
+my @accessed_files;
+my @save_ARGV = @ARGV;
+
+
+my %Desktop_entries;
+my %Directory_entries;
+
+sub check_file ($)
+{
+ my ($file) =@_;
+
+ unless (-e $file) {
+ push @accessed_files, "X $file";
+ return '';
+ }
+
+ if (-d $file) {
+ push @accessed_files, "D $file";
+ return 'D';
+ } else {
+ push @accessed_files, "F $file";
+ return 'F';
+ }
+}
+
+sub scan_AppDir ($$;$)
+{
+ my ($pool, $dir, $topdir) = @_;
+
+ check_file($dir);
+ $topdir = $dir unless defined $topdir;
+
+ opendir(DIR, $dir) or return;
+
+ foreach my $entry (readdir(DIR)) {
+
+ if ( -f "$dir/$entry" && $entry =~ /\.desktop$/ ) {
+ read_desktop_entry($pool, "$dir/$entry", $topdir);
+ }
+ elsif ( -d "$dir/$entry" && $entry ne '.' && $entry ne '..' && $entry ne '.hidden') {
+ scan_AppDir ($pool, "$dir/$entry", $topdir);
+ }
+ }
+ closedir DIR;
+}
+
+sub scan_DirectoryDir ($$;$)
+{
+ my ($pool, $dir, $topdir) = @_;
+
+ check_file($dir);
+ $topdir = $dir unless defined $topdir;
+
+ opendir(DIR, $dir) or return;
+
+ foreach my $entry (readdir(DIR)) {
+
+ if ( -f "$dir/$entry" && $entry =~ /\.directory$/ ) {
+ read_directory_entry($pool, "$dir/$entry", $topdir);
+ }
+ elsif ( -d "$dir/$entry" && $entry ne '.' && $entry ne '..' && $entry ne '.hidden') {
+ scan_DirectoryDir ($pool, "$dir/$entry", $topdir);
+ }
+ }
+
+ closedir DIR;
+}
+
+sub read_directory_entry
+{
+ my ($pool, $file, $topdir) = @_;
+
+
+ unless (defined $Directory_entries{$file}) {
+
+ check_file($file);
+
+ open(FILE, "<$file") or return;
+
+ my $in_desktop_entry = 0;
+ my %entry;
+ while (<FILE>) {
+ if (/^\[/) {
+ if (/^\[Desktop Entry\]/) {
+ $in_desktop_entry = 1;
+ }
+ elsif (/^\[.*\]/) {
+ $in_desktop_entry = 0;
+ }
+ }
+ elsif ($in_desktop_entry && /^([^=]*)=([^[:cntrl:]]*)/) {
+ $entry{$1} = $2;
+ }
+ }
+ close(FILE);
+
+ my $id = $file;
+ $id =~ s/^$topdir//;
+ $id =~ s/^\/*//;
+ $id =~ s/\//-/g;
+ $entry{'id'} = $id;
+
+ $Directory_entries{$file} = \%entry;
+ }
+
+ my $entry = $Directory_entries{$file};
+
+ $pool->{'Directory_entries'}{$entry->{'id'}} = $entry;
+}
+
+sub check_show_in ($)
+{
+ my ($entry) = @_;
+
+ return 1 unless defined $entry;
+
+ my %OnlyShowIn;
+ my %NotShowIn;
+
+ if (defined $entry->{'OnlyShowIn'}) {
+ foreach my $showin (split /;/, $entry->{'OnlyShowIn'}) {
+ $OnlyShowIn{$showin} = 1;
+ }
+ return 0 unless defined $OnlyShowIn{$desktop_name};
+ }
+ if (defined $entry->{'NotShowIn'}) {
+ foreach my $showin (split /;/, $entry->{'NotShowIn'}) {
+ $NotShowIn{$showin} = 1;
+ }
+ return 0 if defined $NotShowIn{$desktop_name} ;
+ }
+
+ return 1;
+}
+
+sub read_desktop_entry
+{
+ my ($pool, $file, $topdir) = @_;
+
+
+ unless (defined $Desktop_entries{$file}) {
+
+ check_file($file);
+
+ open(FILE, "<$file") or return;
+
+ my $in_desktop_entry = 0;
+ my %entry;
+ while (<FILE>) {
+ if (/^\[/) {
+ if (/^\[Desktop Entry\]/) {
+ $in_desktop_entry = 1;
+ }
+ elsif (/^\[.*\]/) {
+ $in_desktop_entry = 0;
+ }
+ }
+ elsif ($in_desktop_entry && /^([^=]*)=([^[:cntrl:]]*)/) {
+ $entry{$1} = $2;
+ }
+ }
+ close(FILE);
+
+ my $id = $file;
+ $id =~ s/^$topdir//;
+ $id =~ s/^\/*//;
+ $id =~ s/\//-/g;
+ $entry{'id'} = $id;
+
+ $entry{'refcount'} = 0;
+
+ $Desktop_entries{$file} = \%entry;
+ }
+
+ my $entry = $Desktop_entries{$file};
+
+ return unless defined $entry->{'Name'};
+ return unless defined $entry->{'Exec'};
+ return if $entry->{'Hidden'} eq 'true';
+ return if $entry->{'NoDisplay'} eq 'true';
+
+ return unless check_show_in($entry);
+
+ return if defined $entry->{'NotShowIn'} && $entry->{'NotShowIn'} eq $desktop_name;
+
+
+ if (defined $pool) {
+
+ foreach my $category (split /;/, $entry->{'Categories'}) {
+ $pool->{'Categories'}{$category} = [] unless defined $pool->{'Categories'}{$category};
+ push @{$pool->{'Categories'}{$category}}, $entry;
+ }
+
+ $pool->{'Desktop_entries'}{$entry->{'id'}} = $entry;
+ }
+
+ return $entry;
+}
+
+my $cached_pool;
+
+sub read_desktop_entries ($$)
+{
+ my ($directory_paths, $desktop_paths) = @_;
+
+ if ($cached_pool->{'Directory_paths'} eq $directory_paths &&
+ $cached_pool->{'Desktop_paths'} eq $desktop_paths) {
+
+ return $cached_pool;
+ }
+
+
+ my $pool = {'Desktop_entries' => {},
+ 'Categories' => {},
+ 'Directory_entries' => {},
+ 'Directory_paths' => $directory_paths,
+ 'Desktop_paths' => $desktop_paths
+ };
+
+ foreach my $dir (split /:/, $directory_paths) {
+ next if $dir =~ /^\s*$/;
+ scan_DirectoryDir($pool, $dir);
+ }
+
+ foreach my $dir (split /:/, $desktop_paths) {
+ next if $dir =~ /^\s*$/;
+ scan_AppDir($pool, $dir);
+ }
+
+ $cached_pool = $pool;
+
+ return $pool;
+}
+
+sub dump_entry_list ($)
+{
+ my ($list) = @_;
+
+ print "list: ";
+ foreach my $entry (@$list) {
+ print "$entry->{id} ";
+ }
+ print "\n";
+
+}
+
+sub get_directory_entry ($$)
+{
+ my ($entry, $pool) = @_;
+
+ return $pool->{'Directory_entries'}{$entry};
+}
+
+sub interpret_Include
+{
+ my ($tree, $entries, $pool) = @_;
+ my %exist;
+
+ my $i = 0;
+
+
+ my @list = interpret_entry_node($tree, 'Or', $pool);
+
+ foreach my $e (@$entries) {
+ if ($e->{type} eq 'desktop') {
+ $exist{$e->{desktop}} = 1;
+ }
+ }
+
+
+# dump_entry_list(\@list);
+
+ foreach my $entry (@list) {
+
+ next if $exist{$entry};
+
+ push @$entries, {type => 'desktop', desktop => $entry};
+ $entry->{'refcount'}++;
+
+ $exist{$entry} = 1;
+
+ }
+}
+
+sub interpret_Exclude
+{
+ my ($tree, $entries, $pool) = @_;
+
+ my $i = 0;
+
+ my @list = interpret_entry_node($tree, 'Or', $pool);
+
+
+ foreach my $entry (@list) {
+
+ my $i = 0;
+ while (defined $entries->[$i]) {
+ my $exist = $entries->[$i];
+ if ($exist->{type} eq 'desktop' &&
+ $exist->{desktop} eq $entry) {
+ splice @$entries, $i, 1;
+ $entry->{'refcount'}--;
+ }
+ else {
+ $i++;
+ }
+ }
+ }
+}
+
+
+sub interpret_entry_node ($$$)
+{
+ my ($tree, $node, $pool) = @_;
+
+ my $i = 0;
+ $i++ if (ref($tree->[$i]) eq 'HASH');
+
+ my @subtree;
+
+ while (defined $tree->[$i]) {
+ if ($tree->[$i] eq 'Filename') {
+ $i++;
+ if (ref($tree->[$i][0]) eq 'HASH' and $tree->[$i][1] eq '0') {
+ my $entry = $tree->[$i][2];
+ if (defined $pool->{'Desktop_entries'}{$entry}) {
+ push @subtree, [$pool->{'Desktop_entries'}{$entry}];
+ }
+ else {
+ push @subtree, [];
+ }
+ }
+ else {
+ print STDERR "Filename\n";
+ exit 1 if $die_on_error;
+ }
+ $i++;
+ }
+ elsif ($tree->[$i] eq 'Category') {
+ $i++;
+ if (ref($tree->[$i][0]) eq 'HASH' and $tree->[$i][1] eq '0') {
+ my $category = $tree->[$i][2];
+ if (defined $pool->{'Categories'}{$category}) {
+ push @subtree, $pool->{'Categories'}{$category};
+ }
+ else {
+ push @subtree, [];
+ }
+ }
+ else {
+ print STDERR "Category\n";
+ exit 1 if $die_on_error;
+ }
+ $i++;
+ }
+ elsif ($tree->[$i] eq 'All') {
+ $i++;
+ if (values %{$pool->{'Desktop_entries'}} > 0) {
+ push @subtree, [values %{$pool->{'Desktop_entries'}}];
+ }
+ else {
+ push @subtree, [];
+ }
+ $i++;
+ }
+ elsif ($tree->[$i] eq '0') {
+ $i++;
+ $i++;
+ }
+ else {
+ my @res = interpret_entry_node($tree->[$i+1], $tree->[$i], $pool);
+ push @subtree, \@res;
+ $i++; $i++;
+ }
+ }
+
+ if ($node eq 'Or')
+ {
+# print "or - \n";
+
+ my %used;
+ my @res;
+ foreach my $st (@subtree) {
+# print " st: ";
+# dump_entry_list($st);
+ foreach my $entry (@$st) {
+ if (! defined $used{$entry}) {
+ push @res, $entry;
+ $used{$entry} = 1;
+ }
+ }
+ }
+# print " res: ";
+# dump_entry_list(\@res);
+ return @res;
+ } elsif ($node eq 'And')
+ {
+ my %used;
+ my @res;
+# print "and - \n";
+ my $cnt = @subtree;
+ my $min = @{$subtree[0]};
+ my $min_idx = 0;
+ my $idx = 0;
+
+ foreach my $st (@subtree) {
+# print " st: ";
+# dump_entry_list($st);
+
+ my $num = @$st;
+ if ($num < $min) {
+ $min = $num;
+ $min_idx = $idx;
+ }
+
+ my %dupes;
+ foreach my $entry (@$st) {
+ next if $dupes{$entry};
+ $dupes{$entry} = 1;
+
+ if (! defined $used{$entry}) {
+ $used{$entry} = 1;
+ }
+ else {
+ $used{$entry} ++
+ }
+ }
+
+ $idx ++;
+ }
+ return () if $cnt == 0;
+ foreach my $entry (@{$subtree[$min_idx]}) {
+ push @res, $entry if $used{$entry} == $cnt;
+ }
+
+# print " res: ";
+# dump_entry_list(\@res);
+ return @res;
+ } elsif ($node eq 'Not')
+ {
+ my %used;
+ my @res;
+# print "not - \n";
+ my $cnt = @subtree;
+ foreach my $st (@subtree) {
+# print " st: ";
+# dump_entry_list($st);
+ foreach my $entry (@$st) {
+ $used{$entry} = 1;
+ }
+ }
+ return if $cnt == 0;
+ foreach my $entry (values %{$pool->{'Desktop_entries'}}) {
+ push @res, $entry if !defined $used{$entry};
+ }
+
+# print " res: ";
+# dump_entry_list(\@res);
+ return @res;
+ } else {
+ print STDERR "Can't use '$node' inside <Include> or <Exclude>\n";
+ exit 1 if $die_on_error;
+ return ();
+ }
+}
+
+sub interpret_root ($$)
+{
+ my ($tree, $topdir) = @_;
+ if ($tree->[0] eq 'Menu') {
+ return interpret_menu($tree->[1]);
+ }
+ else {
+ print STDERR "No toplevel Menu\n";
+ exit 1 if $die_on_error;
+ return;
+ }
+}
+
+
+sub interpret_menu ($;$$)
+{
+ my ($tree, $directory_paths, $desktop_paths) = @_;
+
+ $directory_paths = '' unless defined $directory_paths;
+ $desktop_paths = '' unless defined $desktop_paths;
+
+ my %menu = ('entries' => [],
+ 'OnlyUnallocated' => 0,
+ 'DontShowIfEmpty' => 0,
+ 'Deleted' => 0);
+
+ my $i = 0;
+
+ $i++ if (ref($tree->[$i]) eq 'HASH');
+
+ while (defined $tree->[$i]) {
+ if ($tree->[$i] eq 'AppDir') {
+ if (ref($tree->[$i + 1][0]) eq 'HASH' and $tree->[$i + 1][1] eq '0') {
+ $desktop_paths .= ':' . $tree->[$i + 1][2];
+ splice @$tree, $i, 2;
+ }
+ else {
+ print STDERR "wrong AppDir\n";
+ exit 1 if $die_on_error;
+ $i++;
+ $i++;
+ }
+ }
+ elsif ($tree->[$i] eq 'DefaultAppDirs') {
+ $desktop_paths .= ':' . $DefaultAppDirs;
+ splice @$tree, $i, 2;
+ }
+ elsif ($tree->[$i] eq 'DirectoryDir') {
+ if (ref($tree->[$i + 1][0]) eq 'HASH' and $tree->[$i + 1][1] eq '0') {
+ $directory_paths .= ':' . $tree->[$i + 1][2];
+ splice @$tree, $i, 2;
+ }
+ else {
+ print STDERR "wrong DirectoryDir\n";
+ exit 1 if $die_on_error;
+ $i++;
+ $i++;
+ }
+ }
+ elsif ($tree->[$i] eq 'DefaultDirectoryDirs') {
+ $directory_paths .= ':' . $DefaultDirectoryDirs;
+ splice @$tree, $i, 2;
+ }
+ else {
+ $i++;
+ $i++;
+ }
+ }
+
+
+ $menu{directory_paths} = $directory_paths;
+ $menu{desktop_paths} = $desktop_paths;
+
+ my $pool = read_desktop_entries($directory_paths, $desktop_paths);
+
+
+ $i = 0;
+
+ $i++ if (ref($tree->[$i]) eq 'HASH');
+
+ while (defined $tree->[$i]) {
+ if ($tree->[$i] eq 'Menu') {
+ $i++;
+ my $submenu = interpret_menu($tree->[$i], $directory_paths, $desktop_paths);
+ push @{$menu{'entries'}}, {type => 'menu', menu => $submenu};
+ $i++;
+ }
+ elsif ($tree->[$i] eq 'Name') {
+ $i++;
+ if (ref($tree->[$i][0]) eq 'HASH' and $tree->[$i][1] eq '0') {
+ $menu{'Name'} = $tree->[$i][2];
+ }
+ else {
+ print STDERR "wrong Name\n";
+ exit 1 if $die_on_error;
+ }
+ $i++;
+ }
+ elsif ($tree->[$i] eq 'Directory') {
+ $i++;
+ if (ref($tree->[$i][0]) eq 'HASH' and $tree->[$i][1] eq '0') {
+ $menu{'Directory'} = get_directory_entry($tree->[$i][2], $pool);
+# print "Directory " . $tree->[$i][2] . "\n";
+ }
+ else {
+ print STDERR "wrong Directory\n";
+ exit 1 if $die_on_error;
+ }
+ $i++;
+ }
+ elsif ($tree->[$i] eq 'OnlyUnallocated') {
+ $menu{'OnlyUnallocated'} = 1;
+ $i++;
+ $i++;
+ }
+ elsif ($tree->[$i] eq 'DontShowIfEmpty') {
+ $menu{'DontShowIfEmpty'} = 1;
+ $i++;
+ $i++;
+ }
+ elsif ($tree->[$i] eq 'Deleted') {
+ $menu{'Deleted'} = 1;
+ $i++;
+ $i++;
+ }
+ elsif ($tree->[$i] eq 'NotDeleted') {
+ $menu{'Deleted'} = 0;
+ $i++;
+ $i++;
+ }
+ elsif ($tree->[$i] eq 'Include') {
+ $i++;
+ interpret_Include($tree->[$i], $menu{'entries'}, $pool);
+ $i++;
+ }
+ elsif ($tree->[$i] eq 'Exclude') {
+ $i++;
+ interpret_Exclude($tree->[$i], $menu{'entries'}, $pool);
+ $i++;
+ }
+ elsif ($tree->[$i] eq '0') {
+ $i++;
+ if ($tree->[$i] !~ /^\s*$/) {
+ print STDERR "skip '$tree->[$i]'\n" ;
+ exit 1 if $die_on_error;
+ }
+ $i++;
+ }
+ else {
+ print STDERR "Unknown '$tree->[$i]':\n";
+ $i++;
+ print STDERR " '@{$tree->[$i]}'\n";
+ $i++;
+ exit 1 if $die_on_error;
+ }
+ }
+
+ return \%menu;
+}
+
+
+sub read_menu ($;$)
+{
+ my ($file, $basedir) = @_;
+
+
+ if ($file !~ /^\// && defined $basedir) {
+ $file = "$basedir/$file";
+ }
+
+ unless (defined $basedir) {
+ $basedir = $file;
+ $basedir =~ s/\/[^\/]*$//;
+ }
+
+ unless (check_file($file)) {
+ print STDERR "WARNING: '$file' does not exist\n";
+ return ['Menu', [{}]];
+ }
+
+ print STDERR "reading '$file'\n" if $verbose;
+
+ my $parser = new XML::Parser(Style => 'Tree');
+ my $tree = $parser->parsefile($file);
+
+ my $DefaultMergeDir = $file;
+ $DefaultMergeDir =~ s/^.*\///;
+ $DefaultMergeDir =~ s/\.menu$/-merged/;
+
+ read_includes($tree, $basedir, $DefaultMergeDir);
+
+ return $tree
+}
+
+sub read_menu_dir ($;$)
+{
+ my ($dir, $basedir) = @_;
+
+ my @out;
+
+ if ($dir !~ /^\// && defined $basedir) {
+ $dir = "$basedir/$dir";
+ }
+
+
+ check_file($dir);
+
+ opendir(DIR, $dir);
+
+ foreach my $entry (readdir(DIR)) {
+
+ if ( -f "$dir/$entry" && $entry =~ /\.menu$/ ) {
+ my $menu = read_menu("$dir/$entry");
+ $menu = remove_toplevel_Menu($menu);
+ push @out, @$menu;
+ }
+ }
+ closedir DIR;
+
+ return \@out;
+}
+
+sub quote_xml ($)
+{
+ my ($txt) = @_;
+
+ $txt =~ s/&/&amp;/g;
+ $txt =~ s/</&lt;/g;
+ $txt =~ s/>/&gt;/g;
+ return $txt;
+}
+
+sub read_legacy_dir ($;$)
+{
+ my ($dir,$basedir) = @_;
+ my $out;
+
+ $dir =~ s/\/*$//;
+
+ $basedir = $dir unless defined $basedir;
+
+ return "" if check_file($dir) ne 'D';
+
+ $out = "<Menu>\n";
+
+ if ($dir eq $basedir) {
+ my $xmldir = quote_xml($dir);
+
+ $out .= "<AppDir>$xmldir</AppDir>\n";
+ $out .= "<DirectoryDir>$xmldir</DirectoryDir>\n";
+ }
+ else {
+ my $name = $dir;
+ $name =~ s/\/*$//;
+ $name =~ s/^.*\///;
+
+ $name = quote_xml($name);
+
+ $out .= "<Name>$name</Name>\n";
+ }
+
+
+ if (-f "$dir/.directory") {
+
+ my $dir_id = "$dir/.directory";
+ $dir_id =~ s/^$basedir//;
+ $dir_id =~ s/^\///;
+ $dir_id = quote_xml($dir_id);
+
+ $out .= "<Directory>$dir_id</Directory>\n";
+ }
+
+ opendir(DIR, $dir);
+
+ foreach my $entry (readdir(DIR)) {
+
+ if ( -f "$dir/$entry" && $entry =~ /\.desktop$/ ) {
+ my $id = "$dir/$entry";
+ $id =~ s/^$basedir//;
+ $id =~ s/^\///;
+ $id =~ s/\//-/g;
+ $id = quote_xml($id);
+
+ my $desktop = read_desktop_entry(undef, "$dir/$entry", $basedir);
+ $out .= "<Include><Filename>$id</Filename></Include>\n" unless defined $desktop->{'Categories'}
+ }
+ elsif ( -d "$dir/$entry" && $entry ne '.' && $entry ne '..' && $entry ne '.hidden') {
+ $out .= read_legacy_dir("$dir/$entry", $basedir);
+ }
+ }
+ closedir DIR;
+ $out .= "</Menu>\n";
+ return $out;
+}
+
+sub remove_toplevel_Menu ($)
+{
+ my ($tree) = @_;
+ if ($tree->[0] eq 'Menu') {
+ shift @{$tree->[1]} if (ref($tree->[1][0]) eq 'HASH');
+ return $tree->[1];
+ }
+ else {
+ print STDERR "No toplevel Menu\n";
+ exit 1 if $die_on_error;
+ return;
+ }
+}
+
+sub read_includes ($$$)
+{
+ my ($tree, $basedir, $DefaultMergeDir) = @_;
+
+ my $i = 0;
+
+ $i++ if (ref($tree->[$i]) eq 'HASH');
+
+ while (defined $tree->[$i]) {
+ if ($tree->[$i] eq 'MergeFile') {
+ if (ref($tree->[$i + 1][0]) eq 'HASH' and $tree->[$i + 1][1] eq '0') {
+ my $add_tree = read_menu($tree->[$i + 1][2], $basedir);
+ $add_tree = remove_toplevel_Menu($add_tree);
+
+ splice @$tree, $i, 2, @$add_tree;
+
+ }
+ else {
+ print STDERR "wrong MergeFile\n";
+ exit 1 if $die_on_error;
+ $i++;
+ $i++;
+ }
+
+ }
+ elsif ($tree->[$i] eq 'MergeDir') {
+ if (ref($tree->[$i + 1][0]) eq 'HASH' and $tree->[$i + 1][1] eq '0') {
+
+ my $add_tree = read_menu_dir($tree->[$i + 1][2], $basedir);
+
+ splice @$tree, $i, 2, @$add_tree;
+
+ }
+ else {
+ print STDERR "wrong MergeFile\n";
+ exit 1 if $die_on_error;
+ $i++;
+ $i++;
+ }
+
+ }
+ elsif ($tree->[$i] eq 'DefaultMergeDirs') {
+ my $add_tree = read_menu_dir($DefaultMergeDir, $basedir);
+ splice @$tree, $i, 2, @$add_tree;
+ }
+ elsif ($tree->[$i] eq 'LegacyDir') {
+ if (ref($tree->[$i + 1][0]) eq 'HASH' and $tree->[$i + 1][1] eq '0') {
+
+ my $xml = read_legacy_dir($tree->[$i + 1][2]);
+ print STDERR "reading legacy directory '" . $tree->[$i + 1][2] . "'\n" if $verbose;
+
+ my $parser = new XML::Parser(Style => 'Tree');
+ my $add_tree = $parser->parse($xml);
+ $add_tree = remove_toplevel_Menu($add_tree);
+ splice @$tree, $i, 2, @$add_tree;
+
+ }
+ else {
+ print STDERR "wrong LegacyDir\n";
+ exit 1 if $die_on_error;
+ $i++;
+ $i++;
+ }
+
+ }
+ elsif ($tree->[$i] eq 'KDELegacyDirs') {
+ my @out;
+ foreach my $dir (@KDELegacyDirs) {
+ my $xml = read_legacy_dir($dir);
+ print STDERR "reading legacy directory '$dir'\n" if $verbose;
+
+ my $parser = new XML::Parser(Style => 'Tree');
+ my $add_tree = $parser->parse($xml);
+ $add_tree = remove_toplevel_Menu($add_tree);
+ push @out, @$add_tree
+ }
+ splice @$tree, $i, 2, @out;
+ }
+ elsif ($tree->[$i] eq 'Menu') {
+ $i++;
+ read_includes($tree->[$i], $basedir, $DefaultMergeDir);
+ $i++;
+ }
+ else {
+ $i++;
+ $i++;
+ }
+ }
+}
+
+sub get_menu_name ($)
+{
+ my ($tree) = @_;
+ my $name;
+
+ my $i = 0;
+
+ $i++ if (ref($tree->[$i]) eq 'HASH');
+
+ while (defined $tree->[$i]) {
+ if ($tree->[$i] eq 'Name') {
+ $i++;
+ if (ref($tree->[$i][0]) eq 'HASH' and $tree->[$i][1] eq '0') {
+ $name = $tree->[$i][2];
+ last;
+ }
+ else {
+ print STDERR "wrong Name\n";
+ }
+ $i++;
+ }
+ else {
+ $i++;
+ $i++;
+ }
+ }
+
+ unless (defined $name) {
+ print STDERR "Menu has no name element\n";
+ }
+ return $name;
+}
+
+
+sub append_menu ($$)
+{
+ my ($target, $source) = @_;
+
+ my $i = 0;
+
+ $i++ if (ref($source->[$i]) eq 'HASH');
+
+ while (defined $source->[$i]) {
+ if ($source->[$i] ne 'Name') {
+ push @$target, $source->[$i];
+ push @$target, $source->[$i + 1];
+ }
+
+ $i++;
+ $i++;
+ }
+}
+
+
+sub merge_menus ($)
+{
+ my ($tree) = @_;
+
+ my %used; #menu name already used
+
+ my $i = 0;
+
+ $i++ if (ref($tree->[$i]) eq 'HASH');
+
+ while (defined $tree->[$i]) {
+ if ($tree->[$i] eq 'Menu') {
+ my $name = get_menu_name($tree->[$i + 1]);
+ if (defined $used{$name}) { #second menu with the same name
+ my $target = $used{$name};
+
+ append_menu($tree->[$target], $tree->[$i + 1]);
+
+ splice @$tree, $i, 2;
+ }
+ else { # first appearance
+ $used{$name} = $i + 1;
+ $i++;
+ $i++;
+ }
+ }
+ else {
+ $i++;
+ $i++;
+ }
+ }
+
+
+ $i = 0;
+ $i++ if (ref($tree->[$i]) eq 'HASH');
+
+ while (defined $tree->[$i]) {
+ if ($tree->[$i] eq 'Menu') {
+ merge_menus($tree->[$i + 1]);
+ }
+ $i++;
+ $i++;
+ }
+}
+
+sub read_Move ($$)
+{
+ my ($tree, $hash) = @_;
+
+ my $i = 0;
+
+ my $old = '';
+
+
+ $i++ if (ref($tree->[$i]) eq 'HASH');
+
+ while (defined $tree->[$i]) {
+ if ($tree->[$i] eq 'Old') {
+ $i++;
+ if (ref($tree->[$i][0]) eq 'HASH' and $tree->[$i][1] eq '0') {
+ $old = $tree->[$i][2];
+ }
+ else {
+ print STDERR "wrong Old\n";
+ exit 1 if $die_on_error;
+ }
+ $i++;
+ }
+ if ($tree->[$i] eq 'New') {
+ $i++;
+ if (ref($tree->[$i][0]) eq 'HASH' and $tree->[$i][1] eq '0') {
+ $hash->{$old} = $tree->[$i][2];
+ }
+ else {
+ print STDERR "wrong New\n";
+ exit 1 if $die_on_error;
+ }
+ $i++;
+ }
+ else {
+ $i++;
+ $i++;
+ }
+ }
+}
+
+sub find_menu_in_tree ($$)
+{
+ my ($path, $tree) = @_;
+
+ my $root = $path;
+ $root =~ s/\/.*$//;
+
+ my $subpath = $path;
+ $subpath =~ s/^[^\/]*\/*//;
+
+ my $i = 0;
+
+ $i++ if (ref($tree->[$i]) eq 'HASH');
+
+ while (defined $tree->[$i]) {
+ if ($tree->[$i] eq 'Menu') {
+ if ($root eq get_menu_name($tree->[$i + 1])) {
+
+ if ($subpath eq '') {
+ return { 'parent' => $tree, 'index' => $i, 'menu' => $tree->[$i + 1]};
+ }
+ return find_menu_in_tree($subpath, $tree->[$i + 1]);
+ }
+ }
+
+ $i++;
+ $i++;
+ }
+
+ return undef;
+}
+
+sub copy_menu ($$)
+{
+ my ($path, $tree) = @_;
+
+ my $tail;
+ my $child;
+
+ foreach my $elem (reverse split(/\//, $path)) {
+ next if $elem eq '';
+
+ my $menu = [{}, 'Name', [{}, 0, $elem]];
+ push @$menu, ('Menu', $child) if defined $child;
+
+ $tail = $menu unless defined $tail;
+ $child = $menu;
+ }
+
+ append_menu($tail, $tree);
+
+ return $child;
+}
+
+sub move_menus ($)
+{
+ my ($tree) = @_;
+
+# print "@$tree\n";
+ my %move;
+
+ my $i = 0;
+
+ $i++ if (ref($tree->[$i]) eq 'HASH');
+
+ while (defined $tree->[$i]) {
+ if ($tree->[$i] eq 'Move') {
+
+ read_Move($tree->[$i + 1], \%move);
+ splice @$tree, $i, 2;
+ }
+ else {
+ $i++;
+ $i++;
+ }
+ }
+
+ foreach my $source (keys %move) {
+ my $sourceinfo = find_menu_in_tree($source, $tree);
+
+ if (defined $sourceinfo) {
+ my $target = copy_menu($move{$source}, $sourceinfo->{'menu'});
+ splice @{$sourceinfo->{'parent'}}, $sourceinfo->{'index'}, 2;
+ push @$tree, ('Menu', $target);
+ merge_menus($tree);
+ }
+ }
+
+ $i = 0;
+ $i++ if (ref($tree->[$i]) eq 'HASH');
+
+ while (defined $tree->[$i]) {
+ if ($tree->[$i] eq 'Menu') {
+ move_menus($tree->[$i + 1]);
+ }
+ $i++;
+ $i++;
+ }
+}
+
+sub remove_allocated ($)
+{
+ my ($menu) = @_;
+
+
+ my $i = 0;
+ while ($i < @{$menu->{'entries'}}) {
+ my $entry = $menu->{'entries'}[$i];
+
+ if ($entry->{type} eq 'menu') {
+ remove_allocated($entry->{menu});
+ $i++;
+ }
+ elsif ($entry->{type} eq 'desktop' &&
+ $menu->{'OnlyUnallocated'} &&
+ $entry->{desktop}{'refcount'} > 1) {
+
+ $entry->{desktop}{'refcount'}--;
+ splice @{$menu->{'entries'}}, $i, 1;
+ }
+ else {
+ $i++;
+ }
+
+
+ }
+ return 0;
+}
+
+
+sub remove_empty_menus ($)
+{
+ my ($menu) = @_;
+
+
+ my $i = 0;
+ while ($i < @{$menu->{'entries'}}) {
+ my $entry = $menu->{'entries'}[$i];
+
+ if ($entry->{type} eq 'menu' && remove_empty_menus($entry->{menu})) {
+ splice @{$menu->{'entries'}}, $i, 1;
+ }
+ else {
+ $i++;
+ }
+
+
+ }
+
+ return 1 if @{$menu->{'entries'}} == 0; # && $menu->{'DontShowIfEmpty'}; #menu is empty
+
+ return 0;
+}
+
+
+sub prepare_exec ($$)
+{
+ my ($exec, $desktop) = @_;
+
+ $exec =~ s/%f//g;
+ $exec =~ s/%F//g;
+ $exec =~ s/%u//g;
+ $exec =~ s/%U//g;
+ $exec =~ s/%d//g;
+ $exec =~ s/%D//g;
+ $exec =~ s/%n//g;
+ $exec =~ s/%N//g;
+ $exec =~ s/%i//g;
+ $exec =~ s/%k//g;
+ $exec =~ s/%v//g;
+ $exec =~ s/%m//g;
+
+ my $caption = $desktop->{Name};
+
+ $exec =~ s/%c/$caption/g;
+
+ $exec =~ s/%%/%/g;
+
+ $exec = "xterm -e $exec" if $desktop->{Terminal} eq '1' || $desktop->{Terminal} eq 'true';
+
+ $exec = "$root_cmd $exec" if $desktop->{'X-KDE-SubstituteUID'} eq '1' || $desktop->{'X-KDE-SubstituteUID'} eq 'true';
+ return $exec;
+}
+
+sub get_loc_entry ($$)
+{
+ my ($desktop, $entry) = @_;
+
+ foreach my $key (@language_keys) {
+ my $loc_entry = $entry . "[$key]";
+ return $desktop->{$loc_entry} if defined $desktop->{$loc_entry} && $desktop->{$loc_entry} !~ /^\s*$/;
+ }
+
+ return $desktop->{$entry};
+}
+
+sub preprocess_menu ($)
+{
+ # localize, sort, prepare_exec
+ my ($menu) = @_;
+
+ return 0 if $menu->{'Deleted'};
+ return 0 unless check_show_in($menu->{'Directory'});
+ return 0 if defined $menu->{'Directory'} && $menu->{'Directory'}->{'NoDisplay'} eq 'true';
+
+ my $menu_name = $menu->{'Name'};
+ my $menu_icon = "";
+
+ if (defined $menu->{'Directory'}) {
+ my $directory = $menu->{'Directory'};
+ $menu_icon = $menu->{'Directory'}{'Icon'};
+ my $directory_name = get_loc_entry($directory, 'Name');
+
+ if (defined $directory_name) {
+ Encode::from_to($directory_name, "utf8", $charset)
+ if !defined $directory->{"Encoding"} || $directory->{"Encoding"} eq 'UTF-8';
+
+ $menu_name = $directory_name;
+ }
+ }
+
+ $menu->{'PrepName'} = $menu_name;
+ $menu->{'PrepIcon'} = $menu_icon;
+
+ my $i = 0;
+ while (defined $menu->{'entries'}[$i]) {
+ my $entry = $menu->{'entries'}[$i];
+ if ($entry->{'type'} eq 'desktop') {
+ my $desktop = $entry->{desktop};
+
+ my $name = $desktop->{'id'};
+
+ my $desktop_name = get_loc_entry($desktop, 'Name');
+
+ if (defined $desktop_name) {
+ Encode::from_to($desktop_name, "utf8", $charset)
+ if !defined $desktop->{"Encoding"} || $desktop->{"Encoding"} eq 'UTF-8';
+
+ $name = $desktop_name;
+ }
+
+ $desktop->{'PrepName'} = $name;
+ $entry->{'Name'} = $name;
+ $entry->{'PrepName'} = $name;
+
+ $desktop->{'PrepExec'} = prepare_exec($desktop->{Exec}, $desktop);
+ $i++;
+ }
+ elsif ($entry->{type} eq 'menu') {
+ if (preprocess_menu ($entry->{'menu'})) {
+ $entry->{'Name'} = $entry->{'menu'}{'Name'};
+ $entry->{'PrepName'} = $entry->{'menu'}{'PrepName'};
+ $i++;
+ }
+ else {
+ splice @{$menu->{'entries'}}, $i, 1;
+ }
+ }
+ else {
+ print STDERR "wrong menu entry type: $entry->{type}";
+ exit 1 if $die_on_error;
+ splice @{$menu->{'entries'}}, $i, 1;
+ }
+ }
+
+ $menu->{'entries'} = [ sort {$b->{'type'} cmp $a->{'type'} || $a->{'PrepName'} cmp $b->{'PrepName'}} @{$menu->{'entries'}} ];
+
+ my $i = 0;
+ my $prev_entry;
+ while (defined $menu->{'entries'}[$i]) {
+ my $entry = $menu->{'entries'}[$i];
+ if (defined $prev_entry &&
+ $entry->{'type'} eq 'desktop' &&
+ $prev_entry->{'type'} eq 'desktop' &&
+ $prev_entry->{'PrepName'} eq $entry->{'PrepName'} &&
+ $prev_entry->{'desktop'}->{'PrepExec'} eq $entry->{'desktop'}->{'PrepExec'}) {
+ splice @{$menu->{'entries'}}, $i, 1;
+ }
+ else {
+ $prev_entry = $entry;
+ $i++;
+ }
+ }
+
+ return 1;
+}
+
+sub output_twm_menu ($;$$)
+{
+ my ($menu, $toplevel, $path) = @_;
+
+ my $output = '';
+
+ $path = '' unless defined $path;
+
+ $toplevel = 1 unless defined $toplevel;
+
+ my $menu_name = $menu->{'PrepName'};
+ my $menu_id = "$path-" . $menu->{'Name'};
+ $menu_id =~ s/\s/_/g;
+
+ $menu_id = 'xdg_menu' if $toplevel;
+
+ foreach my $entry (@{$menu->{'entries'}}) {
+ if ($entry->{type} eq 'menu') {
+ $output .= output_twm_menu($entry->{'menu'}, 0, $menu_id);
+ }
+ }
+
+ $output .= "menu \"$menu_id\" {\n";
+ $output .= "\"$menu_name\" f.title\n";
+
+ foreach my $entry (@{$menu->{'entries'}}) {
+ if ($entry->{type} eq 'desktop') {
+ my $desktop = $entry->{desktop};
+
+ my $name = $desktop->{'PrepName'};
+ my $exec = $desktop->{'PrepExec'};
+ my $color = '';
+
+ $exec =~ s/"/\\"/g;
+
+ $color = ' ("red":"grey")' if $desktop->{'X-KDE-SubstituteUID'} eq '1' || $desktop->{'X-KDE-SubstituteUID'} eq 'true';
+
+ $output .= "\"$name\"$color f.exec \"$exec&\"\n";
+ }
+ elsif ($entry->{type} eq 'menu') {
+ my $name = $entry->{'menu'}{'PrepName'};
+ my $id = "$menu_id-" . $entry->{'menu'}{'Name'};
+
+ $id =~ s/\s/_/g;
+
+ $output .= "\"$name\" f.menu \"$id\"\n";
+ }
+ else {
+ print STDERR "wrong menu entry type: $entry->{type}";
+ }
+
+ }
+ $output .= "}\n";
+
+ return $output;
+}
+
+sub output_wmaker_menu ($;$)
+{
+ my ($menu, $indent) = @_;
+
+ my $output = '';
+
+ $indent = 0 unless defined $indent;
+
+ my $menu_name = $menu->{'PrepName'};
+
+ $output .= ' ' x $indent;
+ $output .= "\"$menu_name\" MENU\n";
+
+ if ($indent == 0) {
+ $output .= "\n#include \"user.menu\"\n\n";
+ }
+
+
+ foreach my $entry (@{$menu->{'entries'}}) {
+ if ($entry->{type} eq 'desktop') {
+ my $desktop = $entry->{desktop};
+
+ my $name = $desktop->{'PrepName'};
+ my $exec = $desktop->{'PrepExec'};
+
+ $output .= ' ' x $indent;
+ $output .= " \"$name\" EXEC $exec\n";
+ }
+ elsif ($entry->{type} eq 'menu') {
+ $output .= output_wmaker_menu ($entry->{'menu'}, $indent + 1);
+ }
+ else {
+ print STDERR "wrong menu entry type: $entry->{type}";
+ }
+
+ }
+
+ if ($indent == 0) {
+ textdomain("menu-messages");
+
+ my $exit_msg = gettext("Exit");
+ my $restart_msg = gettext("Restart");
+ if (langinfo(CODESET) ne 'UTF-8') {
+ $exit_msg = Encode::encode_utf8($exit_msg);
+ $restart_msg = Encode::encode_utf8($restart_msg);
+ }
+ $output .= "\t\"$exit_msg\" MENU\n\t\t\"$restart_msg\" RESTART\n\t\t\"$exit_msg\" EXIT\n\"$exit_msg\" END\n";
+ }
+
+ $output .= ' ' x $indent;
+ $output .= "\"$menu_name\" END\n";
+
+ return $output;
+}
+
+sub output_fvwm2_menu ($;$$)
+{
+ my ($menu, $toplevel, $path) = @_;
+
+ my $output = '';
+
+ $path = '' unless defined $path;
+
+ $toplevel = 1 unless defined $toplevel;
+
+ my $menu_name = $menu->{'PrepName'};
+ my $menu_id = "$path-" . $menu->{'Name'};
+ $menu_id =~ s/\s/_/g;
+
+ $menu_id = 'xdg_menu' if $toplevel;
+
+ foreach my $entry (@{$menu->{'entries'}}) {
+ if ($entry->{type} eq 'menu') {
+ $output .= output_fvwm2_menu($entry->{'menu'}, 0, $menu_id);
+ }
+ }
+
+ $output .= "DestroyMenu \"$menu_id\"\n";
+ $output .= "AddToMenu \"$menu_id\" \"$menu_name\" Title\n";
+
+ foreach my $entry (@{$menu->{'entries'}}) {
+ if ($entry->{type} eq 'desktop') {
+ my $desktop = $entry->{desktop};
+
+ my $name = $desktop->{'PrepName'};
+ my $exec = $desktop->{'PrepExec'};
+
+ $output .= "+ \"$name\" Exec $exec\n";
+ }
+ elsif ($entry->{type} eq 'menu') {
+ my $name = $entry->{'menu'}{'PrepName'};
+ my $id = "$menu_id-" . $entry->{'menu'}{'Name'};
+ $id =~ s/\s/_/g;
+
+ $output .= "+ \"$name\" Popup \"$id\"\n";
+ }
+ else {
+ print STDERR "wrong menu entry type: $entry->{type}";
+ }
+
+ }
+ $output .= "\n";
+
+ return $output;
+}
+
+sub output_blackbox_menu ($;$)
+{
+ my ($menu, $indent) = @_;
+
+ my $output = '';
+
+ $output .= "[begin] (Menu)\n";
+ $output .= "[exec] (xterm) {xterm}\n[separator]\n";
+ $output .= output_blackbox_inner_menu ($menu, $indent);
+ $output .= "[separator]\n";
+ $output .= '[config] (Configuration)
+ [workspaces] (Workspace)
+ [submenu] (System Styles) {Choose a style...}
+ [stylesdir] (/usr/share/blackbox/styles)
+ [stylesdir] (/usr/share/fluxbox/styles)
+ [stylesdir] (/usr/share/openbox/styles)
+ [end]
+ [submenu] (User Styles) {Choose a style...}
+ [stylesdir] (~/.blackbox/styles)
+ [stylesdir] (~/.fluxbox/styles)
+ [stylesdir] (~/.openbox/styles)
+ [end]
+ [separator]
+ [exec] (Run Command) {bbrun -a -w}
+ [exec] (Lock Screen) {xlock}
+ [restart] (Restart) {}
+ [exit] (Logout)
+[end]
+';
+ $output .= "[end]\n";
+ return $output;
+}
+
+
+sub output_blackbox_inner_menu ($;$)
+{
+ my ($menu, $indent) = @_;
+
+ my $output = '';
+
+ $indent = 0 unless defined $indent;
+
+ my $menu_name = $menu->{'PrepName'};
+
+ $output .= ' ' x $indent;
+ $output .= "[submenu] ($menu_name)\n";
+
+ foreach my $entry (@{$menu->{'entries'}}) {
+ if ($entry->{type} eq 'desktop') {
+ my $desktop = $entry->{desktop};
+
+ my $name = $desktop->{'PrepName'};
+ my $exec = $desktop->{'PrepExec'};
+
+ $output .= ' ' x $indent;
+ $output .= " [exec] ($name) {$exec}\n";
+ }
+ elsif ($entry->{type} eq 'menu') {
+ $output .= output_blackbox_inner_menu ($entry->{'menu'}, $indent + 1);
+ }
+ else {
+ print STDERR "wrong menu entry type: $entry->{type}";
+ }
+
+ }
+ $output .= ' ' x $indent;
+ $output .= "[end] # ($menu_name)\n";
+
+ return $output;
+}
+
+sub output_icewm_menu ($;$)
+{
+ my ($menu, $indent) = @_;
+
+ my $output = '';
+
+ $indent = 0 unless defined $indent;
+
+ my $menu_name = $menu->{'PrepName'};
+ my $menu_icon = $menu->{'PrepIcon'} || "folder" ;
+
+ $output .= ' ' x $indent;
+ $output .= "menu \"$menu_name\" $menu_icon {\n";
+
+ foreach my $entry (@{$menu->{'entries'}}) {
+ if ($entry->{type} eq 'desktop') {
+ my $desktop = $entry->{desktop};
+
+ my $name = $desktop->{'PrepName'};
+ my $exec = $desktop->{'PrepExec'};
+ my $icon = $desktop->{'Icon'};
+
+ $output .= ' ' x $indent;
+ $output .= " prog \"$name\" $icon $exec\n";
+ }
+ elsif ($entry->{type} eq 'menu') {
+ $output .= output_icewm_menu ($entry->{'menu'}, $indent + 1);
+ }
+ else {
+ print STDERR "wrong menu entry type: $entry->{type}";
+ }
+
+ }
+ $output .= ' ' x $indent;
+ $output .= "}\n";
+
+ return $output;
+}
+
+sub prepare_exec_xfce4 ($$)
+{
+ my ($exec, $desktop) = @_;
+
+ $exec =~ s/%f//g;
+ $exec =~ s/%F//g;
+ $exec =~ s/%u//g;
+ $exec =~ s/%U//g;
+ $exec =~ s/%d//g;
+ $exec =~ s/%D//g;
+ $exec =~ s/%n//g;
+ $exec =~ s/%N//g;
+ $exec =~ s/%i//g;
+ $exec =~ s/%k//g;
+ $exec =~ s/%v//g;
+ $exec =~ s/%m//g;
+
+ my $caption = $desktop->{Name};
+
+ $exec =~ s/%c/$caption/g;
+
+ $exec =~ s/%%/%/g;
+
+ $exec =~ s/\"/&quot;/g;
+
+ $exec = "$root_cmd $exec" if $desktop->{'X-KDE-SubstituteUID'} eq '1' || $desktop->{'X-KDE-SubstituteUID'} eq 'true';
+ return $exec;
+}
+
+
+
+sub output_xfce4_menu ($;$)
+{
+ my ($menu, $indent) = @_;
+
+ my $output = '';
+
+ $indent = 0 unless defined $indent;
+
+ if ($indent == 0) {
+ $output .= '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
+ $output .= '<!DOCTYPE xfdesktop-menu [' . "\n";
+ $output .= ' <!ENTITY menu2 SYSTEM "menu2.xml">' . "\n";
+ $output .= ']>' . "\n\n";
+ }
+
+ my $menu_name = $menu->{'PrepName'};
+ my $menu_ico = $menu->{'PrepIcon'};
+ $output .= ' ' x $indent;
+
+ if ($indent == 0) {
+ $output .= "<xfdesktop-menu>\n"
+ }
+ else {
+ $output .= "<menu name=\"" . quote_xml($menu_name) ."\" visible=\"yes\" icon=\"${menu_ico}.png \">\n";
+ }
+
+ foreach my $entry (@{$menu->{'entries'}}) {
+ if ($entry->{type} eq 'desktop') {
+ my $desktop = $entry->{desktop};
+
+ my $name = $desktop->{'PrepName'};
+ my $exec = prepare_exec_xfce4($desktop->{Exec}, $desktop);
+ my $term = ($desktop->{Terminal} eq '1' || $desktop->{Terminal} eq 'true') ? "yes" : "no";
+ my $ico = $desktop->{'Icon'};
+ $output .= ' ' x $indent;
+ $output .= " <app name=\"" . quote_xml($name) ."\" cmd=\"$exec\" icon=\"$ico\" term=\"$term\"/>\n";
+ }
+ elsif ($entry->{type} eq 'menu') {
+ $output .= output_xfce4_menu ($entry->{'menu'}, $indent + 1);
+ }
+ else {
+ print STDERR "wrong menu entry type: $entry->{type}";
+ }
+
+ }
+ $output .= ' ' x $indent;
+
+ if ($indent == 0) {
+ $output .= "</xfdesktop-menu>\n";
+ }
+ else {
+ $output .= "</menu>\n";
+ }
+
+ return $output;
+}
+
+sub output_openbox3_menu ($;$)
+{
+ my ($menu, $indent) = @_;
+
+ my $output = '';
+
+ $output .= '<?xml version="1.0" encoding="UTF-8"?>
+
+<openbox_menu xmlns="http://openbox.org/"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://openbox.org/
+ file:///usr/share/openbox/menu.xsd">';
+ $output .= "<menu id=\"xdg\" label=\"xdg\">\n";
+ $output .= output_openbox3_inner_menu ($menu, $indent);
+ $output .= "</menu>\n";
+ $output .= ' <menu id="root-menu" label="Openbox 3">
+ <item label="xterm">
+ <action name="Execute"><execute>xterm</execute></action> </item>
+ <separator />
+ <menu id="KDE Menu" label="KDE Menu" />
+ <separator />
+ <menu id="client-list-menu" />
+ <separator />
+ <menu id="ob-menu" label="openbox3">
+ <item label="ob conf"><action name="Execute"><execute>obconf</execute></action></item>
+ <item label="reconfigure"><action name="Reconfigure" /></item>
+ </menu>
+ <separator />
+ <item label="lock screen"><action name="Execute"><execute>xlock -remote -nice 19 -mode blank -geometry 1x1 -enablesaver</execute></action></item>
+ <separator />
+ <item label="Exit"><action name="Exit" /></item>
+ </menu>';
+ $output .= "</openbox_menu>\n";
+ return $output;
+}
+
+sub output_openbox3_pipe_menu ($;$)
+{
+ my ($menu, $indent) = @_;
+
+ my $output = '';
+
+ $output .= "<openbox_pipe_menu>\n";
+ $output .= output_openbox3_inner_menu ($menu, $indent);
+ $output .= "</openbox_pipe_menu>\n";
+ return $output;
+}
+
+sub output_openbox3_inner_menu ($;$)
+{
+ my ($menu, $indent) = @_;
+
+ my $output = '';
+
+ $indent = 0 unless defined $indent;
+ my $menu_name = $menu->{'PrepName'};
+
+ $output .= ' ' x $indent;
+ $output .= "<menu id=\"" . quote_xml($menu_name) . "\" label=\"".quote_xml($menu_name) . "\">\n";
+# $output .= "<menu label=\"".quote_xml($menu_name) . "\">\n";
+
+ foreach my $entry (@{$menu->{'entries'}}) {
+ if ($entry->{type} eq 'desktop') {
+ my $desktop = $entry->{desktop};
+
+ my $name = $desktop->{'PrepName'};
+ my $exec = $desktop->{'PrepExec'};
+
+ $output .= ' ' x $indent;
+ $output .= " <item label=\"". quote_xml($name)."\">\n";
+ $output .= " <action name=\"Execute\"><execute>$exec</execute></action>\n";
+ $output .= " </item>\n";
+ }
+ elsif ($entry->{type} eq 'menu') {
+ $output .= output_openbox3_inner_menu ($entry->{'menu'}, $indent + 1);
+ }
+ else {
+ print STDERR "wrong menu entry type: $entry->{type}";
+ }
+
+ }
+ $output .= ' ' x $indent;
+ $output .= "</menu> <!-- $menu_name -->\n";
+
+ return $output;
+}
+
+
+sub output_readable ($;$)
+{
+ my ($menu, $indent) = @_;
+
+ my $output = '';
+
+ $indent = 0 unless defined $indent;
+
+ my $menu_name = $menu->{'Name'};
+
+ $output .= "\t" x $indent;
+ $output .= "\"$menu_name\" MENU\n";
+
+
+ foreach my $entry (@{$menu->{'entries'}}) {
+ if ($entry->{type} eq 'desktop') {
+ my $desktop = $entry->{desktop};
+
+ my $name = $desktop->{Name};
+
+ $output .= "\t" x $indent;
+ $output .= "\t\"$name\"\n";
+
+
+ my @v = %$desktop;
+ $output .= "@v\n" if $name eq '';
+ }
+ elsif ($entry->{type} eq 'menu') {
+ $output .= output_readable ($entry->{menu}, $indent + 1);
+ }
+ else {
+ print STDERR "wrong menu entry type: $entry->{type}";
+ }
+
+ }
+
+ return $output;
+}
+
+sub get_root_menu
+{
+ foreach my $dir (split(/:/, $ENV{XDG_CONFIG_DIRS}), "/etc/xdg") {
+ check_file("$dir/menus/applications.menu");
+ return "$dir/menus/applications.menu" if -f "$dir/menus/applications.menu";
+ }
+ return "";
+}
+
+sub get_app_dirs
+{
+ my %used;
+ my $ret = '';
+ my @kde_xdgdata = split(/:/, `kde-config --path xdgdata-apps`);
+
+ foreach $_ (@kde_xdgdata) {
+ s/\/applications\/*\s*$//;
+ };
+
+ foreach my $d (split(/:/, $ENV{XDG_DATA_DIRS}), @kde_xdgdata, "/usr/share", "/opt/gnome/share") {
+ my $dir = $d;
+ $dir =~ s/\/*$//;
+ next if defined $used{$dir};
+ next if check_file("$dir/applications") ne 'D';
+ $ret .= ':' if $ret ne '';
+ $ret .= "$dir/applications";
+ $used{$dir} = 1;
+ }
+ return $ret;
+}
+
+sub get_desktop_dirs
+{
+ my %used;
+ my $ret = '';
+ foreach my $dir (split(/:/, $ENV{XDG_DATA_DIRS}), "/usr/share", "/opt/kde3/share", "/opt/gnome/share") {
+ next if defined $used{$dir};
+ next if check_file("$dir/desktop-directories") ne 'D';
+ $ret .= ':' if $ret ne '';
+ $ret .= "$dir/desktop-directories";
+ $used{$dir} = 1;
+ }
+ return $ret;
+}
+
+sub get_KDE_legacy_dirs
+{
+ my %used;
+ my @ret;
+ foreach my $d ("/etc/opt/kde3/share/applnk", "/opt/kde3/share/applnk", reverse(split(/:/, `kde-config --path apps`))) {
+ my $dir = $d;
+ chomp $dir;
+ $dir =~ s/\/*$//;
+ next if defined $used{$dir};
+ next if check_file("$dir") ne 'D';
+ $used{$dir} = 1;
+ push @ret, $dir;
+ }
+ return @ret;
+}
+
+sub prepare_language_keys ($)
+{
+ my ($language) = @_;
+
+ my @keys;
+
+ $language =~ s/\.[^@]*//; # remove .ENCODING
+
+ if ($language =~ /^([^_]*)_([^@]*)@(.*)$/) { # LANG_COUNTRY@MODIFIER
+ push @keys, $1 . '_' . $2 . '@' . $3;
+ push @keys, $1 . '_' . $2;
+ push @keys, $1 . '@' . $3;
+ push @keys, $1;
+ }
+ elsif ($language =~ /^([^_]*)_([^@]*)$/) { # LANG_COUNTRY
+ push @keys, $1 . '_' . $2;
+ push @keys, $1;
+ }
+ elsif ($language =~ /^([^_]*)@(.*)$/) { # LANG@MODIFIER
+ push @keys, $1 . '@' . $2;
+ push @keys, $1;
+ }
+ elsif ($language =~ /^([^_@]*)$/) { # LANG
+ push @keys, $1;
+ }
+
+ return @keys;
+}
+
+sub check_cache
+{
+ my $cachedir = $ENV{HOME};
+
+ return unless -d $cachedir;
+
+ $cachedir .= "/.xdg_menu_cache";
+
+ return unless -f "$cachedir/inputs" && -f "$cachedir/output";
+
+ my @st = stat "$cachedir/output";
+ my $ref_time = $st[10]; #ctime
+
+ open(FILE, "<$cachedir/inputs");
+
+ my $num_opts = 0;
+
+ while (<FILE>) {
+ chomp;
+ next if /^\s*$/;
+ next if /^#/;
+
+ if (/^[FD] (.*)$/) {
+ my $file = $1;
+ my @st = stat $file;
+ my $time = $st[10]; #ctime
+
+ if (!defined $time || $time >= $ref_time) {
+# print STDERR "$file: is newer\n";
+ return;
+ }
+ }
+ elsif (/^X (.*)$/) {
+ my $file = $1;
+
+ if (-e $file) {
+# print STDERR "$file: exists\n";
+ return;
+ }
+ }
+ elsif (/^ENV ([^ ]+) (.*)$/) {
+ my $var = $1;
+ my $val = $2;
+
+ if ($ENV{$var} ne $val) {
+# print STDERR "$var: differs\n";
+ return;
+ }
+ }
+ elsif (/^OPT ([0-9]+) (.*)$/) {
+ my $optidx = $1;
+ my $val = $2;
+
+ $num_opts ++;
+ if ($save_ARGV[$optidx] ne $val) {
+# print STDERR "$optidx: differs\n";
+ return;
+ }
+ }
+ elsif (/^CHARSET (.*)$/) {
+ my $charset = $1;
+
+ if ($charset ne langinfo(CODESET)) {
+# print STDERR "charset $charset differs\n";
+ return;
+ }
+ }
+ elsif (/^LANGUAGE (.*)$/) {
+ my $language = $1;
+
+ if ($language ne setlocale(LC_MESSAGES)) {
+# print STDERR "language $language differs\n";
+ return;
+ }
+ }
+ elsif (/^VERSION (.*)$/) {
+ my $v = $1;
+
+ if ($v ne $Version) {
+# print STDERR "Version differs\n";
+ return;
+ }
+ }
+ else {
+ print STDERR "Wrong cache inputs list\n";
+ return;
+ }
+
+
+ }
+
+ return if $num_opts != @save_ARGV;
+
+ open(FILE, "<$cachedir/output") or return;
+
+ print STDERR "Using cached output\n" if $verbose;
+
+ my $buf;
+ while(read(FILE, $buf, 4096)) {
+ print $buf;
+ }
+ close(FILE);
+
+ exit 0;
+}
+
+sub write_cache ($)
+{
+ my ($output) = @_;
+
+ my $cachedir = $ENV{HOME};
+
+ return unless -d $cachedir;
+
+ $cachedir .= "/.xdg_menu_cache";
+
+ mkdir $cachedir;
+ unlink "$cachedir/output";
+
+ open(FILE, ">$cachedir/inputs") or return;
+ print FILE "# this file contains list of inputs xdg_menu\n";
+ print FILE "VERSION $Version\n";
+ print FILE "\n\n";
+ print FILE join("\n", @accessed_files);
+ print FILE "\n\n";
+
+ for (my $i = 0; $i < @save_ARGV; $i++) {
+ print FILE "OPT $i $save_ARGV[$i]\n";
+ }
+
+ print FILE "ENV XDG_CONFIG_DIRS $ENV{XDG_CONFIG_DIRS}\n";
+ print FILE "ENV XDG_DATA_DIRS $ENV{XDG_DATA_DIRS}\n";
+
+ print FILE "CHARSET " . langinfo(CODESET) . "\n";
+ print FILE "LANGUAGE " . setlocale(LC_MESSAGES) . "\n";
+
+ close(FILE);
+ open(FILE, ">$cachedir/output") or return;
+ print FILE $output;
+ close(FILE);
+}
+
+
+check_cache();
+
+use XML::Parser;
+
+$DefaultAppDirs = get_app_dirs();
+$DefaultDirectoryDirs = get_desktop_dirs();
+
+my $root_menu = get_root_menu();
+
+@KDELegacyDirs = get_KDE_legacy_dirs();
+
+$charset = langinfo(CODESET);
+$language = setlocale(LC_MESSAGES);
+
+$root_cmd = "/opt/gnome/bin/gnomesu" if -x '/opt/gnome/bin/gnomesu';
+$root_cmd = "/opt/kde3/bin/kdesu" if -x '/opt/kde3/bin/kdesu';
+
+my $help;
+
+GetOptions("format=s" => \$format,
+ "fullmenu" => \$fullmenu,
+ "desktop=s" => \$desktop_name,
+ "charset=s" => \$charset,
+ "language=s" => \$language,
+ "root-menu=s" => \$root_menu,
+ "die-on-error" => \$die_on_error,
+ "verbose" => \$verbose,
+ "help" => \$help
+ );
+
+@language_keys = prepare_language_keys($language);
+
+$desktop_name = $format unless defined $desktop_name;
+
+if ($help) {
+ print <<"EOF";
+
+xdg-menu - XDG menus for WindowMaker and other window managers
+ http://freedesktop.org/Standards/menu-spec
+
+
+Usage:
+ xdg_menu [--format <format>] [--desktop <desktop>]
+ [--charset <charset>] [--language <language>]
+ [--root-menu <root-menu>] [--die-on-error]
+ [--fullmenu] [--help]
+
+ format - output format
+ possible formats: WindowMaker, fvwm2, icewm,
+ blackbox, fluxbox, openbox,
+ xfce4, openbox3, openbox3-pipe,
+ mwm, readable
+ default: WindowMaker
+
+ fullmenu - output a full menu and not only a submenu
+
+ desktop - desktop name for NotShowIn and OnlyShowIn
+ default: the same as format
+
+ charset - output charset
+ default: $charset
+
+ language - output language
+ default: $language
+
+ root-menu - location of root menu file
+ default: $root_menu
+
+ die-on-error - abort execution on any error,
+ default: try to continue
+
+ verbose - print debugging information
+
+ help - print this text
+
+EOF
+ exit 0;
+}
+
+
+unless ( -f $root_menu) {
+ print STDERR "Can't find root menu file.\n";
+ exit 1;
+}
+
+my $tree = read_menu($root_menu);
+
+merge_menus($tree);
+move_menus($tree);
+
+my $menu = interpret_root($tree, '');
+
+remove_allocated($menu);
+preprocess_menu($menu);
+remove_empty_menus($menu);
+
+my $output;
+
+if ($format eq 'WindowMaker') {
+
+ $output = output_wmaker_menu($menu)
+}
+elsif ($format eq 'fvwm2') {
+
+ $output = output_fvwm2_menu($menu)
+}
+elsif ($format eq 'icewm') {
+ foreach my $entry (@{$menu->{'entries'}}) {
+
+ if ($entry->{type} eq 'menu') {
+ $output .= output_icewm_menu ($entry->{'menu'});
+ }
+ }
+}
+elsif ($format eq 'xfce4') {
+
+ $output = output_xfce4_menu($menu)
+}
+elsif ($format eq 'blackbox' || ($format eq 'openbox') || ($format eq 'fluxbox') ) {
+ if ($fullmenu) {
+ $output = output_blackbox_menu($menu)
+ }
+ else
+ {
+ $output = output_blackbox_inner_menu($menu)
+ }
+}
+elsif ($format eq 'openbox3') {
+ if ($fullmenu) {
+ $output = output_openbox3_menu($menu)
+ }
+ else
+ {
+ $output = output_openbox3_inner_menu($menu)
+ }
+}
+elsif ($format eq 'openbox3-pipe') {
+
+ $output = output_openbox3_pipe_menu($menu)
+}
+elsif ($format eq 'twm') {
+
+ print STDERR "WARNING: twm does not support umlauts. Parameter --language '' to output plain ASCII.\n" unless $language eq '';
+ $output = output_twm_menu($menu)
+}
+elsif ($format eq 'mwm') {
+
+ $output = output_twm_menu($menu)
+}
+elsif ($format eq 'readable') {
+
+ $output = output_readable($menu)
+}
+else
+{
+ print STDERR "Unknown format $format\n";
+ exit 1;
+}
+
+print $output;
+write_cache($output);
+
+exit 0;
+