Allow for configurable max number of hosts within hosts menu before starting a new column - see .csshrc doc for "max_host_menu_items". This is until Tk allows for scrollable menus

This commit is contained in:
duncan_ferguson 2009-04-22 18:58:24 +00:00
parent 090819a731
commit d4436cd9eb
2 changed files with 22 additions and 4 deletions

View file

@ -19,6 +19,9 @@
* Allow use of long options (swap Getopt::Std to Getopt::Long)
* Remove deprecated '-i' option
* Deprecate -d and -D, replaced with --debug
* Allow for configurable max number of hosts within hosts menu before
starting a new column - see .csshrc doc for "max_host_menu_items".
This is until Tk allows for scrollable menus
2009-03-26 Duncan Ferguson <duncan_ferguson@user.sf.net> - v3.25-1

View file

@ -264,7 +264,8 @@ sub load_config_defaults() {
$config{history_width} = 40;
$config{history_height} = 10;
$config{command} = q{};
$config{command} = q{};
$config{max_host_menu_items} = 30;
}
# load in config file settings
@ -1492,7 +1493,8 @@ sub build_hosts_menu() {
# first, empty the hosts menu from the 4th entry on
my $menu = $menus{bar}->entrycget( 'Hosts', -menu );
$menu->delete( 6, 'end' );
my $host_menu_static_items = 5;
$menu->delete( $host_menu_static_items, 'end' );
logmsg( 3, "Menu deleted" );
@ -1500,12 +1502,21 @@ sub build_hosts_menu() {
$menus{hosts}->separator;
logmsg( 3, "Parsing list" );
my $menu_item_counter = $host_menu_static_items;
foreach my $svr ( sort( keys(%servers) ) ) {
logmsg( 3, "Checking $svr and restoring active value" );
my $colbreak = 0;
if ( $menu_item_counter > $config{max_host_menu_items} ) {
$colbreak = 1;
$menu_item_counter = 1;
}
$menus{hosts}->checkbutton(
-label => $svr,
-variable => \$servers{$svr}{active},
-label => $svr,
-variable => \$servers{$svr}{active},
-columnbreak => $colbreak,
);
$menu_item_counter++;
}
logmsg( 3, "Changing window title" );
change_main_window_title();
@ -2467,6 +2478,10 @@ See below notes on shortcuts.
Default key sequence to retile host windows. See below notes on shortcuts.
=item max_host_menu_items = 30
Maximum number of hosts to put into the host menu before starting a new column
=item mouse_paste = Button-2 (middle mouse button)
Default key sequence to paste text into the console window using the mouse.