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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
# File 'lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/advanced/gtkmucclient.rb', line 21
def initialize
super(Gtk::Window::TOPLEVEL)
self.title = "GtkMUCClient setup"
signal_connect("delete_event") { cancel }
vbox = Gtk::VBox.new
vbox.set_border_width(4)
add(vbox)
vbox.show
frame1 = Gtk::Frame.new('Jabber Account Settings')
frame1.set_border_width(4)
frame1.show
vbox.add(frame1)
layout1 = Gtk::Table.new(4, 2)
layout1.row_spacings = 4
layout1.column_spacings = 8
layout1.show
frame1.add(layout1)
layout1.attach(Gtk::Label.new_show('Jabber ID:'), 0, 1, 1, 2)
@entry_jid = Gtk::Entry.new
@entry_jid.text = '[email protected]'
@entry_jid.show
layout1.attach(@entry_jid, 1, 2, 1, 2)
layout1.attach(Gtk::Label.new_show('Password:'), 0, 1, 2, 3)
@entry_password = Gtk::Entry.new
@entry_password.visibility = false
@entry_password.show
layout1.attach(@entry_password, 1, 2, 2, 3)
layout1.attach(Gtk::Label.new_show('Resource:'), 0, 1, 3, 4)
@entry_resource = Gtk::Entry.new
@entry_resource.text = 'gtkmucclient'
@entry_resource.show
layout1.attach(@entry_resource, 1, 2, 3, 4)
frame2 = Gtk::Frame.new('Multi-User Chat Settings')
frame2.set_border_width(4)
frame2.show
vbox.add(frame2)
layout2 = Gtk::Table.new(3, 2)
layout2.row_spacings = 4
layout2.column_spacings = 8
layout2.show
frame2.add(layout2)
layout2.attach(Gtk::Label.new_show('Room:'), 0, 1, 1, 2)
@entry_room = Gtk::Entry.new
@entry_room.text = '[email protected]'
@entry_room.show
layout2.attach(@entry_room, 1, 2, 1, 2)
layout2.attach(Gtk::Label.new_show('Nick:'), 0, 1, 2, 3)
@entry_nick = Gtk::Entry.new
@entry_nick.text = 'XMPP4R-Fan'
@entry_nick.show
layout2.attach(@entry_nick, 1, 2, 2, 3)
hbox = Gtk::HBox.new
hbox.show
vbox.add(hbox)
button_ok = Gtk::Button.new("Ok")
button_ok.set_border_width(4)
hbox.add(button_ok)
button_ok.signal_connect("clicked") { ok }
button_ok.can_default = true
button_ok.grab_default
button_ok.show
button_cancel = Gtk::Button.new("Cancel")
button_cancel.set_border_width(4)
hbox.add(button_cancel)
button_cancel.signal_connect("clicked") { cancel }
button_cancel.show
end
|