Class: Ig3tool::LoginWindow

Inherits:
GladeHelper show all
Includes:
GetText
Defined in:
lib/ui/loginwindow.rb

Constant Summary collapse

["Login", "Login"]
ICON =
"stock_print.png"

Constants inherited from GladeHelper

GladeHelper::GLADE_DIR

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from GladeHelper

#_get_widget, #add_window_colorer, #load_sounds, #make_debugger_combo, #make_eval_widget, #make_status_combo, #number_eval_widget, #play, #present, #show, #speak

Constructor Details

#initialize(client, &block) ⇒ LoginWindow

Returns a new instance of LoginWindow.



10
11
12
13
14
15
16
17
18
19
# File 'lib/ui/loginwindow.rb', line 10

def initialize(client, &block)
    super("loginwindow.glade", "loginwindow")

	@username = @glade.get_widget("username")
	@password = @glade.get_widget("password")
	@apply    = @glade.get_widget("apply")
	@loginwin = @glade.get_widget("loginwindow")
	@success  = block

end

Instance Attribute Details

#gladeObject (readonly)

Returns the value of attribute glade.



8
9
10
# File 'lib/ui/loginwindow.rb', line 8

def glade
  @glade
end

Instance Method Details

#apply(widget) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
# File 'lib/ui/loginwindow.rb', line 24

def apply(widget)
	h = {"username" => @username.text, "password" => @password.text}
    @username.text = ""
    @password.text = ""
	$client.wannabe!(h)
    @loginwin.hide
	@success.call
rescue Token => t
	puts "ERROR: #{t.message}"
	Ig3tool::error_dialog(nil, t)
end

#cancel(widget) ⇒ Object



35
36
37
38
39
40
41
# File 'lib/ui/loginwindow.rb', line 35

def cancel(widget)
    @username.text = ""
    @password.text = ""
    @loginwin.hide
    Gtk.main_quit
	return nil
end

#delete_event(widget, arg0) ⇒ Object



47
48
49
50
51
# File 'lib/ui/loginwindow.rb', line 47

def delete_event(widget, arg0)
    @username.text = ""
    @password.text = ""
    @loginwin.hide
end

#destroy_event(widget, arg0) ⇒ Object



42
43
44
45
46
# File 'lib/ui/loginwindow.rb', line 42

def destroy_event(widget, arg0)
    @username.text = ""
    @password.text = ""
    @loginwin.hide
end

#password_activate(widget) ⇒ Object



21
22
23
# File 'lib/ui/loginwindow.rb', line 21

def password_activate(widget)
	@apply.activate
end

#username_activate(widget) ⇒ Object



52
53
54
# File 'lib/ui/loginwindow.rb', line 52

def username_activate(widget)
	@password.grab_focus
end