-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgui.rb
More file actions
76 lines (50 loc) · 1.27 KB
/
gui.rb
File metadata and controls
76 lines (50 loc) · 1.27 KB
1
2
3
4
5
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
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
require './toot.rb'
require 'gtk2'
vis = "public"
cw = ""
account = {
:token => "",
:host => ""
}
body = "test"
account[:host] = "https://" + account[:host] + "/api/v1/statuses"
button_toot = Gtk::Button.new("Toot!")
button_exit = Gtk::Button.new("Exit")
button_toot.signal_connect("clicked") {
body = $text_area.buffer.text
PostToot(vis, cw, account, body)
$text_area.buffer.text = ""
$log_area.buffer.text = "#{$http_status_code}\n#{$http_msg}\n#{$http_body}"
}
button_exit.signal_connect("clicked") {
Gtk.main_quit
false
}
window = Gtk::Window.new
window.signal_connect("delete_event") {
puts "delete event occurred"
#true
false
}
window.signal_connect("destroy") {
puts "destroy event occurred"
Gtk.main_quit
}
$text_area = Gtk::TextView.new
$text_area.set_size_request(200, 200)
$text_area.wrap_mode
$log_area = Gtk::TextView.new
$log_area.set_size_request(230, 200)
fixed = Gtk::Fixed.new
fixed.put($text_area, 5, 220)
box1 = Gtk::HBox.new(false, 0)
window.add(box1)
box1.pack_start(fixed, true, true, 0)
box1.pack_start($log_area, true, true, 0)
box1.pack_start(button_toot, true, true, 0)
box1.pack_start(button_exit, true, true, 0)
window.set_size_request(480, 600)
window.title = "RubyTooter"
window.border_width = 10
window.show_all
Gtk.main