Mageia Bugzilla – Attachment 4156 Details for
Bug 10598
xdg_menu produces bad XML for Openbox
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
New Account
|
Forgot Password
[patch]
Fix XML for Openbox
xdg_menu.patch (text/plain), 2.42 KB, created by
Derek Jennings
on 2013-06-23 12:52:37 CEST
(
hide
)
Description:
Fix XML for Openbox
Filename:
MIME Type:
Creator:
Derek Jennings
Created:
2013-06-23 12:52:37 CEST
Size:
2.42 KB
patch
obsolete
>--- menu/xdg_menu 2013-03-09 16:57:02.000000000 +0000 >+++ menu/xdg_menu 2013-06-19 14:28:21.708060176 +0100 >@@ -13,7 +13,7 @@ > use I18N::Langinfo qw(langinfo CODESET); > use POSIX qw(locale_h); > >-my $Version = "0.2"; >+my $Version = "0.3"; > > my $DefaultAppDirs; > my $DefaultDirectoryDirs; >@@ -1809,6 +1809,26 @@ > 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_inner_menu ($;$) > { >- my ($menu, $indent) = @_; >+ my ($menu, $indent, $lastmenu) = @_; > > my $output = ''; > >@@ -1831,9 +1851,10 @@ > 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 @@ > $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 @@ > } > else > { >- $output = output_openbox3_inner_menu($menu) >+ $output = output_openbox3_submenu($menu) > } > } > elsif ($format eq 'openbox3-pipe') {
--- menu/xdg_menu 2013-03-09 16:57:02.000000000 +0000 +++ menu/xdg_menu 2013-06-19 14:28:21.708060176 +0100 @@ -13,7 +13,7 @@ use I18N::Langinfo qw(langinfo CODESET); use POSIX qw(locale_h); -my $Version = "0.2"; +my $Version = "0.3"; my $DefaultAppDirs; my $DefaultDirectoryDirs; @@ -1809,6 +1809,26 @@ 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_inner_menu ($;$) { - my ($menu, $indent) = @_; + my ($menu, $indent, $lastmenu) = @_; my $output = ''; @@ -1831,9 +1851,10 @@ 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 @@ $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 @@ } else { - $output = output_openbox3_inner_menu($menu) + $output = output_openbox3_submenu($menu) } } elsif ($format eq 'openbox3-pipe') {
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 10598
: 4156