Class | GnomeSSHMenu::HostDialog |
In: |
lib/gnome-sshmenu.rb
(Git)
|
Parent: | SSHMenu::HostDialog |
The GnomeSSHMenu::HostDialog class builds on SSHMenu::HostDialog to add support for gnome-terminal profiles.
Adds a drop-down menu for selecting a terminal profile and then delegates to SSHMenu::HostDialog#add_other_inputs.
# File lib/gnome-sshmenu.rb, line 255 def add_other_inputs @profiles = @config.list_profiles prof_menu = Gtk::ComboBox.new(true) prof_menu.append_text('< None >') prof_menu.active = 0 @profiles.each_index { |i| prof_menu.append_text(@profiles[i]) prof_menu.active = i + 1 if @profiles[i] == @host.profile } @profile_menu = add_input('Profile', @host.profile, prof_menu) super() end
Delegates to SSHMenu::HostDialog#dialog_to_host and adds suport for saving the profile name.
# File lib/gnome-sshmenu.rb, line 285 def dialog_to_host(host=nil) host = super(host) host.profile = selected_profile return host end
Helper routine for dialog_to_host. Returns the name of the profile currently selected in the drop-down menu.
# File lib/gnome-sshmenu.rb, line 273 def selected_profile i = @profile_menu.active if i > 0 return @profiles[i-1] else return '' end end