From df2584b6d2a1934bfd4f04795484147e48cfaef2 Mon Sep 17 00:00:00 2001 From: Duncan Ferguson Date: Thu, 17 Sep 2009 19:07:29 +0100 Subject: [PATCH] Allow tearoff in xml at top level Allow for 'detach' on the send menu itself within the xml config file, rather than just sub menus --- src/cssh.pl | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/cssh.pl b/src/cssh.pl index 2724170..94bd51c 100755 --- a/src/cssh.pl +++ b/src/cssh.pl @@ -2045,10 +2045,8 @@ sub populate_send_menu_entries_from_xml { if ( $menu_ref->{menu} ) { $menus{ $menu_ref->{title} } = $menu->cascade( -label => $menu_ref->{title}, ); - populate_send_menu_entries_from_xml( - $menus{ $menu_ref->{title} }, - $menu_ref, - ); + populate_send_menu_entries_from_xml( $menus{ $menu_ref->{title} }, + $menu_ref, ); if ( $menu_ref->{detach} && $menu_ref->{detach} =~ m/y/i ) { $menus{ $menu_ref->{title} }->menu->tearOffMenu()->raise; } @@ -2098,11 +2096,15 @@ sub populate_send_menu { die 'Cannot load XML::Simple - has it been installed? ', $@ if ($@); my $xml = XML::Simple->new( ForceArray => 1, ); - my $xml_data = $xml->XMLin( $config{send_menu_xml_file} ); + my $menu_xml = $xml->XMLin( $config{send_menu_xml_file} ); - logmsg( 3, 'xml send menu: ', $/, $xml->XMLout($xml_data) ); + logmsg( 3, 'xml send menu: ', $/, $xml->XMLout($menu_xml) ); - populate_send_menu_entries_from_xml( $menus{send}, $xml_data ); + if ( $menu_xml->{detach} && $menu_xml->{detach} =~ m/y/i ) { + $menus{send}->menu->tearOffMenu()->raise; + } + + populate_send_menu_entries_from_xml( $menus{send}, $menu_xml ); } return;