Class: GloudApp::LoginDialog

Inherits:
Gtk::Dialog
  • Object
show all
Defined in:
lib/gloudapp.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(default_remember = false) ⇒ LoginDialog

Returns a new instance of LoginDialog.



393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
# File 'lib/gloudapp.rb', line 393

def initialize(default_remember = false)
	super("Authentication",
		nil,
		Gtk::Dialog::MODAL,
		["Login", Gtk::Dialog::RESPONSE_ACCEPT],
		[Gtk::Stock::CANCEL, Gtk::Dialog::RESPONSE_REJECT])
	self.icon = GloudApp::Icon.normal
	self.has_separator = false

	@login = Gtk::Entry.new
	@password = Gtk::Entry.new.set_visibility(false)
	@remember = Gtk::CheckButton.new('Remember login')
	@remember.active = default_remember
	image = Gtk::Image.new(Gtk::Stock::DIALOG_AUTHENTICATION, Gtk::IconSize::DIALOG)

	table = Gtk::Table.new(2, 3).set_border_width(5)
	table.attach(image, 0, 1, 0, 2, nil, nil, 10, 10)
	table.attach_defaults(Gtk::Label.new("Username:").set_xalign(1).set_xpad(5), 1, 2, 0, 1)
	table.attach_defaults(@login, 2, 3, 0, 1)
	table.attach_defaults(Gtk::Label.new("Password:").set_xalign(1).set_xpad(5), 1, 2, 1, 2)
	table.attach_defaults(@password, 2, 3, 1, 2)
	table.attach_defaults(@remember, 2, 3, 2, 3)

	self.vbox.add(table)
	self.show_all
	# close dialog on return or enter
	self.signal_connect("key_release_event") do |obj, ev|
		if ev.keyval == Gdk::Keyval::GDK_Return or ev.keyval == Gdk::Keyval::GDK_KP_Enter
			obj.response(Gtk::Dialog::RESPONSE_ACCEPT)
		end
	end
end

Instance Attribute Details

#loginObject (readonly)

Returns the value of attribute login.



391
392
393
# File 'lib/gloudapp.rb', line 391

def 
  @login
end

#passwordObject (readonly)

Returns the value of attribute password.



391
392
393
# File 'lib/gloudapp.rb', line 391

def password
  @password
end

#rememberObject (readonly)

Returns the value of attribute remember.



391
392
393
# File 'lib/gloudapp.rb', line 391

def remember
  @remember
end