mirror of
https://github.com/duncs/clusterssh.git
synced 2025-07-03 09:53:23 +00:00
Add in list of clusters to 'Add Host' window
- thanks for Stanislas Rouvelin for the idea
This commit is contained in:
parent
70d96b54b6
commit
6eaa511fd8
3 changed files with 94 additions and 46 deletions
|
@ -1,3 +1,8 @@
|
|||
??? Duncan Ferguson <duncan_ferguson@user.sf.net> - v3.27-1
|
||||
|
||||
* Add in list of clusters to 'Add Host' window
|
||||
- thanks for Stanislas Rouvelin for the idea
|
||||
|
||||
2009-06-02 Duncan Ferguson <duncan_ferguson@user.sf.net> - v3.26-1
|
||||
|
||||
* Allow user to set a different ConnectTimeout and -o string (Tony Mancill)
|
||||
|
|
|
@ -28,5 +28,6 @@ Peter Palfrader
|
|||
David F. Skoll
|
||||
Bogdan Pintea
|
||||
Gerfried Fuchs
|
||||
Stanislas Rouvelin
|
||||
|
||||
$Id$
|
||||
|
|
|
@ -266,6 +266,8 @@ sub load_config_defaults() {
|
|||
|
||||
$config{command} = q{};
|
||||
$config{max_host_menu_items} = 30;
|
||||
|
||||
$config{max_addhost_menu_cluster_items} = 6;
|
||||
}
|
||||
|
||||
# load in config file settings
|
||||
|
@ -1474,10 +1476,17 @@ sub add_host_by_name() {
|
|||
return;
|
||||
}
|
||||
|
||||
logmsg( 2, "host=$menus{host_entry}" );
|
||||
|
||||
if ( $menus{host_entry} ) {
|
||||
logmsg( 2, "host=", $menus{host_entry} );
|
||||
open_client_windows(
|
||||
resolve_names( split( /\s+/, $menus{host_entry} ) ) );
|
||||
}
|
||||
|
||||
if ( $menus{listbox}->curselection() ) {
|
||||
my @hosts = $menus{listbox}->get( $menus{listbox}->curselection() );
|
||||
logmsg( 2, "host=", join( ' ', @hosts ) );
|
||||
open_client_windows( resolve_names(@hosts) );
|
||||
}
|
||||
|
||||
build_hosts_menu();
|
||||
$menus{host_entry} = "";
|
||||
|
@ -1671,7 +1680,9 @@ sub create_windows() {
|
|||
my $paste_text = '';
|
||||
|
||||
# SelectionGet is fatal if no selection is given
|
||||
Tk::catch { $paste_text = $windows{main_window}->SelectionGet };
|
||||
Tk::catch {
|
||||
$paste_text = $windows{main_window}->SelectionGet;
|
||||
};
|
||||
|
||||
if ( !length($paste_text) ) {
|
||||
warn("Got empty paste event\n");
|
||||
|
@ -1724,6 +1735,27 @@ sub create_windows() {
|
|||
-default_button => 'Add',
|
||||
);
|
||||
|
||||
if ( $config{max_addhost_menu_cluster_items}
|
||||
&& scalar keys %clusters )
|
||||
{
|
||||
if ( scalar keys %clusters < $config{max_addhost_menu_cluster_items} )
|
||||
{
|
||||
$menus{listbox} = $windows{addhost}->Listbox(
|
||||
-selectmode => 'extended',
|
||||
-height => scalar keys %clusters,
|
||||
)->pack();
|
||||
}
|
||||
else {
|
||||
$menus{listbox} = $windows{addhost}->Scrolled(
|
||||
'Listbox',
|
||||
-scrollbars => 'e',
|
||||
-selectmode => 'extended',
|
||||
-height => $config{max_addhost_menu_cluster_items},
|
||||
)->pack();
|
||||
}
|
||||
$menus{listbox}->insert( 'end', sort keys %clusters );
|
||||
}
|
||||
|
||||
$windows{host_entry} = $windows{addhost}->add(
|
||||
'LabEntry',
|
||||
-textvariable => \$menus{host_entry},
|
||||
|
@ -1848,9 +1880,12 @@ sub key_event {
|
|||
if ( $combo =~ /^$key$/ ) {
|
||||
if ( $event eq "KeyRelease" ) {
|
||||
logmsg( 2, "Received hotkey: $hotkey" );
|
||||
send_clientname() if ( $hotkey eq "key_clientname" );
|
||||
add_host_by_name() if ( $hotkey eq "key_addhost" );
|
||||
retile_hosts("force") if ( $hotkey eq "key_retilehosts" );
|
||||
send_clientname()
|
||||
if ( $hotkey eq "key_clientname" );
|
||||
add_host_by_name()
|
||||
if ( $hotkey eq "key_addhost" );
|
||||
retile_hosts("force")
|
||||
if ( $hotkey eq "key_retilehosts" );
|
||||
show_history() if ( $hotkey eq "key_history" );
|
||||
exit_prog() if ( $hotkey eq "key_quit" );
|
||||
}
|
||||
|
@ -1860,7 +1895,8 @@ sub key_event {
|
|||
}
|
||||
|
||||
# look for a <Control>-d and no hosts, so quit
|
||||
exit_prog() if ( $state =~ /Control/ && $keysym eq "d" and !%servers );
|
||||
exit_prog()
|
||||
if ( $state =~ /Control/ && $keysym eq "d" and !%servers );
|
||||
|
||||
update_display_text( $keycodetosym{$keysymdec} )
|
||||
if ( $event eq "KeyPress" && $keycodetosym{$keysymdec} );
|
||||
|
@ -1978,7 +2014,8 @@ sub create_menubar() {
|
|||
|
||||
# Note: getopts returned "" if it finds any options it doesnt recognise
|
||||
# so use this to print out basic help
|
||||
pod2usage( -verbose => 1 ) if ( !GetOptions( \%options, @options_spec ) );
|
||||
pod2usage( -verbose => 1 )
|
||||
if ( !GetOptions( \%options, @options_spec ) );
|
||||
pod2usage( -verbose => 1 ) if ( $options{'?'} || $options{help} );
|
||||
pod2usage( -verbose => 2 ) if ( $options{H} || $options{man} );
|
||||
|
||||
|
@ -2492,6 +2529,11 @@ See below notes on shortcuts.
|
|||
|
||||
Default key sequence to retile host windows. See below notes on shortcuts.
|
||||
|
||||
=item max_addhost_menu_cluster_items = 6
|
||||
|
||||
Maximum number of entries in the 'Add Host' menu cluster list before
|
||||
scrollbars are used
|
||||
|
||||
=item max_host_menu_items = 30
|
||||
|
||||
Maximum number of hosts to put into the host menu before starting a new column
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue