Class: GNetvibes::LoginDialog
- Inherits:
-
Gtk::Dialog
- Object
- Gtk::Dialog
- GNetvibes::LoginDialog
- Defined in:
- lib/gnetvibes/login.rb
Instance Attribute Summary collapse
-
#login(obj, ev) ⇒ Object
readonly
Returns the value of attribute login.
-
#password ⇒ Object
readonly
Returns the value of attribute password.
Instance Method Summary collapse
-
#initialize(api) ⇒ LoginDialog
constructor
A new instance of LoginDialog.
Constructor Details
#initialize(api) ⇒ LoginDialog
Returns a new instance of LoginDialog.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/gnetvibes/login.rb', line 6 def initialize(api) @api = api # Login Dialog super("#{NAME} Authentification", nil, Gtk::Dialog::MODAL, [Gtk::Stock::OK, Gtk::Dialog::RESPONSE_ACCEPT], [Gtk::Stock::CANCEL, Gtk::Dialog::RESPONSE_REJECT]) self.icon = ICON self.has_separator = false self.resizable = false @login = Gtk::Entry.new @password = Gtk::Entry.new @remember = Gtk::CheckButton.new('Remember me') table = Gtk::Table.new(2, 3) table.border_width = 5 image = Gtk::Image.new(Gtk::Stock::DIALOG_AUTHENTICATION, Gtk::IconSize::DIALOG) table.attach(image, 0, 1, 0, 2, nil, nil, 10, 10) table.attach_defaults(Gtk::Label.new("Login:"), 1, 2, 0, 1) table.attach_defaults(@login, 2, 3, 0, 1) table.attach_defaults(Gtk::Label.new("Password:"), 1, 2, 1, 2) @password.visibility = false table.attach_defaults(@password, 2, 3, 1, 2) self.vbox.pack_start(table) self.signal_connect("key_release_event", &method(:login)) table.attach_defaults(@remember, 2, 3, 2, 3) if not ARGV.empty? @login.editable = false @login.text = ARGV.shift @password.text = ARGV.shift if not ARGV.empty? @password.grab_focus else @login.grab_focus end self.signal_connect('response', &method(:login)) self.show_all end |
Instance Attribute Details
#login(obj, ev) ⇒ Object (readonly)
Returns the value of attribute login.
4 5 6 |
# File 'lib/gnetvibes/login.rb', line 4 def login @login end |
#password ⇒ Object (readonly)
Returns the value of attribute password.
4 5 6 |
# File 'lib/gnetvibes/login.rb', line 4 def password @password end |