aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJani Välimaa <wally@mageia.org>2013-06-24 15:18:52 +0000
committerJani Välimaa <wally@mageia.org>2013-06-24 15:18:52 +0000
commit0a7158761a5b014f4f8a2fd9847b905ac89e0cc3 (patch)
treedb83485487f1aa6401fb236f3254999b1d8b9a93
parent90aa69c6ffeb4593cd7ebc4cee912250502a3a57 (diff)
downloadcommon-data-0a7158761a5b014f4f8a2fd9847b905ac89e0cc3.tar
common-data-0a7158761a5b014f4f8a2fd9847b905ac89e0cc3.tar.gz
common-data-0a7158761a5b014f4f8a2fd9847b905ac89e0cc3.tar.bz2
common-data-0a7158761a5b014f4f8a2fd9847b905ac89e0cc3.tar.xz
common-data-0a7158761a5b014f4f8a2fd9847b905ac89e0cc3.zip
xdg_menu: fix dynamic menu creation for openbox (mga#10598)
-rwxr-xr-xmenu/xdg_menu31
1 files changed, 26 insertions, 5 deletions
diff --git a/menu/xdg_menu b/menu/xdg_menu
index 931b373..06e1b20 100755
--- a/menu/xdg_menu
+++ b/menu/xdg_menu
@@ -1809,6 +1809,26 @@ sub output_openbox3_menu ($;$)
return $output;
}
+sub output_openbox3_submenu ($;$)
+{
+ 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 .= "</openbox_menu>\n";
+ return $output;
+}
+
+
sub output_openbox3_pipe_menu ($;$)
{
my ($menu, $indent) = @_;
@@ -1823,7 +1843,7 @@ sub output_openbox3_pipe_menu ($;$)
sub output_openbox3_inner_menu ($;$)
{
- my ($menu, $indent) = @_;
+ my ($menu, $indent, $lastmenu) = @_;
my $output = '';
@@ -1831,9 +1851,10 @@ sub output_openbox3_inner_menu ($;$)
my $menu_name = $menu->{'PrepName'};
$output .= ' ' x $indent;
- $output .= "<menu id=\"" . quote_xml($menu_name) . "\" label=\"".quote_xml($menu_name) . "\">\n";
+ $output .= "<menu id=\"" . quote_xml($menu_name) . quote_xml($lastmenu) . "\" label=\"".quote_xml($menu_name) . "\">\n";
# $output .= "<menu label=\"".quote_xml($menu_name) . "\">\n";
-
+ $lastmenu = $menu_name;
+
foreach my $entry (@{$menu->{'entries'}}) {
if ($entry->{type} eq 'desktop') {
my $desktop = $entry->{desktop};
@@ -1847,7 +1868,7 @@ sub output_openbox3_inner_menu ($;$)
$output .= " </item>\n";
}
elsif ($entry->{type} eq 'menu') {
- $output .= output_openbox3_inner_menu ($entry->{'menu'}, $indent + 1);
+ $output .= output_openbox3_inner_menu ($entry->{'menu'}, $indent + 1, $lastmenu);
}
else {
print STDERR "wrong menu entry type: $entry->{type}";
@@ -2267,7 +2288,7 @@ elsif ($format eq 'openbox3') {
}
else
{
- $output = output_openbox3_inner_menu($menu)
+ $output = output_openbox3_submenu($menu)
}
}
elsif ($format eq 'openbox3-pipe') {