gtk3 3.0.9-x86-mingw32 → 3.1.0-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. data/ext/gtk3/rb-gtk3-private.h +1 -0
  3. data/ext/gtk3/rb-gtk3-spin-button.c +85 -0
  4. data/ext/gtk3/rb-gtk3.c +3 -0
  5. data/lib/2.2/gtk3.so +0 -0
  6. data/lib/2.3/gtk3.so +0 -0
  7. data/lib/gtk3/deprecated.rb +0 -8
  8. data/lib/gtk3/loader.rb +1 -7
  9. data/lib/gtk3/tree-model.rb +2 -0
  10. data/sample/gtk-demo/TODO +10 -10
  11. data/sample/gtk-demo/assistant.rb +44 -39
  12. data/sample/gtk-demo/builder.rb +71 -50
  13. data/sample/gtk-demo/button_box.rb +39 -28
  14. data/sample/gtk-demo/clipboard.rb +139 -46
  15. data/sample/gtk-demo/colorsel.rb +50 -36
  16. data/sample/gtk-demo/css_accordion.rb +18 -17
  17. data/sample/gtk-demo/css_basics.rb +60 -47
  18. data/sample/gtk-demo/css_multiplebgs.rb +92 -71
  19. data/sample/gtk-demo/css_pixbufs.rb +61 -48
  20. data/sample/gtk-demo/css_shadows.rb +63 -50
  21. data/sample/gtk-demo/cursors.rb +95 -64
  22. data/sample/gtk-demo/dialog.rb +95 -78
  23. data/sample/gtk-demo/drawingarea.rb +138 -171
  24. data/sample/gtk-demo/editable_cells.rb +169 -130
  25. data/sample/gtk-demo/entry_buffer.rb +15 -13
  26. data/sample/gtk-demo/entry_completion.rb +22 -17
  27. data/sample/gtk-demo/expander.rb +39 -31
  28. data/sample/gtk-demo/filtermodel.rb +67 -63
  29. data/sample/gtk-demo/font_features.rb +91 -60
  30. data/sample/gtk-demo/glarea.rb +277 -0
  31. data/sample/gtk-demo/headerbar.rb +17 -15
  32. data/sample/gtk-demo/hypertext.rb +146 -167
  33. data/sample/gtk-demo/iconview.rb +132 -91
  34. data/sample/gtk-demo/iconview_edit.rb +49 -38
  35. data/sample/gtk-demo/infobar.rb +81 -62
  36. data/sample/gtk-demo/links.rb +35 -30
  37. data/sample/gtk-demo/list_store.rb +169 -114
  38. data/sample/gtk-demo/listbox.rb +183 -0
  39. data/sample/gtk-demo/main.rb +32 -21
  40. data/sample/gtk-demo/markup.rb +65 -52
  41. data/sample/gtk-demo/menus.rb +57 -58
  42. data/sample/gtk-demo/modelbutton.rb +11 -9
  43. data/sample/gtk-demo/modelbutton.ui +3 -0
  44. data/sample/gtk-demo/overlay.rb +39 -32
  45. data/sample/gtk-demo/overlay2.rb +68 -54
  46. data/sample/gtk-demo/panes.rb +56 -68
  47. data/sample/gtk-demo/pickers.rb +46 -45
  48. data/sample/gtk-demo/pixbufs.rb +27 -25
  49. data/sample/gtk-demo/popover.rb +70 -63
  50. data/sample/gtk-demo/printing.rb +94 -69
  51. data/sample/gtk-demo/revealer.rb +46 -38
  52. data/sample/gtk-demo/rotated_text.rb +75 -54
  53. data/sample/gtk-demo/scale.rb +10 -8
  54. data/sample/gtk-demo/search_entry.rb +195 -0
  55. data/sample/gtk-demo/search_entry2.rb +71 -59
  56. data/sample/gtk-demo/sidebar.rb +20 -19
  57. data/sample/gtk-demo/sizegroup.rb +36 -35
  58. data/sample/gtk-demo/spinbutton.rb +128 -0
  59. data/sample/gtk-demo/spinner.rb +55 -40
  60. data/sample/gtk-demo/stack.rb +11 -8
  61. data/sample/gtk-demo/textmask.rb +14 -13
  62. data/sample/gtk-demo/textscroll.rb +16 -12
  63. data/sample/gtk-demo/theming_style_classes.rb +14 -12
  64. data/sample/gtk-demo/transparent.rb +17 -13
  65. data/sample/misc/treemodelfilter.rb +1 -1
  66. metadata +24 -19
@@ -66,6 +66,7 @@
66
66
  <object class="GtkModelButton">
67
67
  <property name="visible">1</property>
68
68
  <property name="action-name">win.color</property>
69
+ <property name="action-target">'red'</property>
69
70
  <property name="text">Red</property>
70
71
  <property name="inverted">1</property>
71
72
  </object>
@@ -74,6 +75,7 @@
74
75
  <object class="GtkModelButton">
75
76
  <property name="visible">1</property>
76
77
  <property name="action-name">win.color</property>
78
+ <property name="action-target">'green'</property>
77
79
  <property name="text">Green</property>
78
80
  <property name="inverted">1</property>
79
81
  </object>
@@ -82,6 +84,7 @@
82
84
  <object class="GtkModelButton">
83
85
  <property name="visible">1</property>
84
86
  <property name="action-name">win.color</property>
87
+ <property name="action-target">'blue'</property>
85
88
  <property name="text">Blue</property>
86
89
  <property name="inverted">1</property>
87
90
  </object>
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2015 Ruby-GNOME2 Project Team
1
+ # Copyright (c) 2015-2016 Ruby-GNOME2 Project Team
2
2
  # This program is licenced under the same licence as Ruby-GNOME2.
3
3
  #
4
4
  =begin
@@ -10,52 +10,59 @@ The overlayed widgets can be interactive controls such
10
10
  as the entry in this example, or just decorative, like
11
11
  the big blue label.
12
12
  =end
13
- module OverlayDemo
14
- def self.run_demo(main_window)
15
- window = Gtk::Window.new(:toplevel)
16
- window.set_default_size(500, 510)
17
- window.set_title("Interactive Overlay")
18
- window.screen = main_window.screen
13
+ class OverlayDemo
14
+ def initialize(main_window)
15
+ @window = Gtk::Window.new(:toplevel)
16
+ @window.set_default_size(500, 510)
17
+ @window.title = "Interactive Overlay"
18
+ @window.screen = main_window.screen
19
19
 
20
20
  overlay = Gtk::Overlay.new
21
- grid = Gtk::Grid.new
22
- overlay.add(grid)
21
+ initialize_grid
22
+ overlay.add(@grid)
23
23
 
24
- entry = Gtk::Entry.new
25
-
26
- (0..4).each do |i|
27
- (0..4).each do |j|
28
- text = "#{5 * j + i}"
29
- button = Gtk::Button.new(:label => text)
30
- button.set_hexpand(true)
31
- button.set_vexpand(true)
32
- button.signal_connect "clicked" do |widget|
33
- entry.text = widget.label
34
- end
35
- grid.attach(button, i, j, 1, 1)
36
- end
37
- end
24
+ @entry = Gtk::Entry.new
25
+ @entry.placeholder_text = "Your Lucky Number"
38
26
 
39
27
  vbox = Gtk::Box.new(:vertical, 10)
40
28
  overlay.add_overlay(vbox)
41
29
  overlay.set_overlay_pass_through(vbox, true)
42
- vbox.set_halign(:center)
43
- vbox.set_valign(:center)
30
+ vbox.halign = :center
31
+ vbox.valign = :center
44
32
 
45
33
  label = Gtk::Label.new("<span foreground='blue' weight='ultrabold' font='40'>Numbers</span>")
46
- label.set_use_markup(true)
34
+ label.use_markup = true
47
35
  vbox.pack_start(label, :expand => false, :fill => false, :padding => 8)
48
36
 
49
- entry.set_placeholder_text("Your Lucky Number")
50
- vbox.pack_start(entry, :expand => false, :fill => false, :padding => 8)
37
+ vbox.pack_start(@entry, :expand => false, :fill => false, :padding => 8)
51
38
 
52
- window.add(overlay)
39
+ @window.add(overlay)
53
40
  overlay.show_all
41
+ end
54
42
 
55
- if !window.visible?
56
- window.show_all
43
+ def run
44
+ if !@window.visible?
45
+ @window.show_all
57
46
  else
58
- window.destroy
47
+ @window.destroy
48
+ end
49
+ end
50
+
51
+ private
52
+
53
+ def initialize_grid
54
+ @grid = Gtk::Grid.new
55
+ (0..4).each do |i|
56
+ (0..4).each do |j|
57
+ text = (5 * j + i).to_s
58
+ button = Gtk::Button.new(:label => text)
59
+ button.hexpand = true
60
+ button.vexpand = true
61
+ button.signal_connect "clicked" do |widget|
62
+ @entry.text = widget.label
63
+ end
64
+ @grid.attach(button, i, j, 1, 1)
65
+ end
59
66
  end
60
67
  end
61
68
  end
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2015 Ruby-GNOME2 Project Team
1
+ # Copyright (c) 2015-2016 Ruby-GNOME2 Project Team
2
2
  # This program is licenced under the same licence as Ruby-GNOME2.
3
3
  #
4
4
  =begin
@@ -7,69 +7,83 @@
7
7
  Another example of an overlay with some decorative
8
8
  and some interactive controls.
9
9
  =end
10
- module Overlay2Demo
11
- def self.run_demo(_main_window)
12
- window = Gtk::Window.new(:toplevel)
13
- window.set_default_size(500, 510)
14
- window.set_title("Decorative Overlay")
10
+ class Overlay2Demo
11
+ def initialize(_main_window)
12
+ @window = Gtk::Window.new(:toplevel)
13
+ @window.set_default_size(500, 510)
14
+ @window.title = "Decorative Overlay"
15
15
 
16
- overlay = Gtk::Overlay.new
16
+ @overlay = Gtk::Overlay.new
17
17
 
18
18
  sw = Gtk::ScrolledWindow.new
19
19
  sw.set_policy(:automatic, :automatic)
20
20
 
21
- text = Gtk::TextView.new
22
- buffer = text.buffer
23
- buffer.text = "Dear Diary..."
21
+ initialize_textview
24
22
 
25
- tag = buffer.create_tag("top-margin", "pixels-above-lines" => 0)
23
+ @window.add(@overlay)
24
+ @overlay.add(sw)
25
+ sw.add(@text)
26
26
 
27
- word_end = buffer.start_iter
28
- word_end.forward_word_end
29
- buffer.apply_tag(tag, buffer.start_iter, word_end)
30
-
31
- window.add(overlay)
32
- overlay.add(sw)
33
- sw.add(text)
34
-
35
- image = Gtk::Image.new(:resource => "/overlay2/decor1.png")
36
- overlay.add_overlay(image)
37
- overlay.set_overlay_pass_through(image, true)
38
- image.set_halign(:start)
39
- image.set_valign(:start)
40
-
41
- image = Gtk::Image.new(:resource => "/overlay2/decor2.png")
42
- overlay.add_overlay(image)
43
- overlay.set_overlay_pass_through(image, true)
44
- image.set_halign(:end)
45
- image.set_valign(:end)
46
-
47
- adjustment = Gtk::Adjustment.new(0, 0, 100, 1, 1, 0)
48
- adjustment.signal_connect "value-changed" do |widget|
27
+ generate_image_in_overlay("/overlay2/decor1.png", :start)
28
+ generate_image_in_overlay("/overlay2/decor2.png", :end)
29
+
30
+ generate_adjustment
31
+ generate_scale_in_overlay
32
+
33
+ @overlay.show_all
34
+ end
35
+
36
+ def run
37
+ if !@window.visible?
38
+ @window.show_all
39
+ else
40
+ @window.destroy
41
+ end
42
+ @window
43
+ end
44
+
45
+ private
46
+
47
+ def generate_image_in_overlay(resource, position)
48
+ image = Gtk::Image.new(:resource => resource)
49
+ @overlay.add_overlay(image)
50
+ @overlay.set_overlay_pass_through(image, true)
51
+ image.halign = position
52
+ image.valign = position
53
+ end
54
+
55
+ def generate_adjustment
56
+ @adjustment = Gtk::Adjustment.new(0, 0, 100, 1, 1, 0)
57
+ @adjustment.signal_connect "value-changed" do |widget|
49
58
  value = widget.value
50
- text.set_left_margin(value)
51
- tag.set_property("pixels-above-lines", value)
59
+ @text.set_left_margin(value)
60
+ @tag.set_property("pixels-above-lines", value)
52
61
  end
62
+ @adjustment.value = 100
63
+ end
53
64
 
54
- scale = Gtk::Scale.new(:horizontal, adjustment)
55
- scale.set_draw_value(false)
65
+ def generate_scale_in_overlay
66
+ scale = Gtk::Scale.new(:horizontal, @adjustment)
67
+ scale.draw_value = false
56
68
  scale.set_size_request(120, -1)
57
- scale.set_margin_start(20)
58
- scale.set_margin_end(20)
59
- scale.set_margin_bottom(20)
60
- overlay.add_overlay(scale)
61
- scale.set_halign(:start)
62
- scale.set_valign(:end)
63
- scale.set_tooltip_text("Margin")
64
-
65
- adjustment.value = 100
66
- overlay.show_all
67
-
68
- if !window.visible?
69
- window.show_all
70
- else
71
- window.destroy
72
- end
73
- window
69
+ scale.margin_start = 20
70
+ scale.margin_end = 20
71
+ scale.margin_bottom = 20
72
+ @overlay.add_overlay(scale)
73
+ scale.halign = :start
74
+ scale.valign = :end
75
+ scale.tooltip_text = "Margin"
76
+ end
77
+
78
+ def initialize_textview
79
+ @text = Gtk::TextView.new
80
+ buffer = @text.buffer
81
+ buffer.text = "Dear Diary..."
82
+
83
+ @tag = buffer.create_tag("top-margin", "pixels-above-lines" => 0)
84
+
85
+ word_end = buffer.start_iter
86
+ word_end.forward_word_end
87
+ buffer.apply_tag(@tag, buffer.start_iter, word_end)
74
88
  end
75
89
  end
@@ -14,27 +14,27 @@
14
14
  widget, and allows you to adjust the options for each side of
15
15
  each widget.
16
16
  =end
17
- module PanesDemo
18
- def self.run_demo(main_window)
19
- window = Gtk::Window.new(:toplevel)
20
- window.screen = main_window.screen
21
- window.title = "Paned Widgets"
22
- window.border_width = 0
17
+ class PanesDemo
18
+ def initialize(main_window)
19
+ @window = Gtk::Window.new(:toplevel)
20
+ @window.screen = main_window.screen
21
+ @window.title = "Paned Widgets"
22
+ @window.border_width = 0
23
23
 
24
24
  vbox = Gtk::Box.new(:vertical, 0)
25
- window.add(vbox)
25
+ @window.add(vbox)
26
26
 
27
27
  vpaned = Gtk::Paned.new(:vertical)
28
28
  vbox.pack_start(vpaned, :expand => true, :fill => true, :padding => 0)
29
29
  vpaned.border_width = 5
30
30
 
31
- hpaned = Gtk::Paned.new(:horizontal)
32
- vpaned.add1(hpaned)
31
+ @hpaned = Gtk::Paned.new(:horizontal)
32
+ vpaned.add1(@hpaned)
33
33
 
34
34
  frame = Gtk::Frame.new
35
35
  frame.shadow_type = :in
36
36
  frame.set_size_request(60, 60)
37
- hpaned.add1(frame)
37
+ @hpaned.add1(frame)
38
38
 
39
39
  button = Gtk::Button.new(:label => "_Hi there", :use_underline => true)
40
40
  frame.add(button)
@@ -42,7 +42,7 @@ module PanesDemo
42
42
  frame = Gtk::Frame.new
43
43
  frame.shadow_type = :in
44
44
  frame.set_size_request(80, 60)
45
- hpaned.add2(frame)
45
+ @hpaned.add2(frame)
46
46
 
47
47
  frame = Gtk::Frame.new
48
48
  frame.shadow_type = :in
@@ -50,88 +50,76 @@ module PanesDemo
50
50
  vpaned.add2(frame)
51
51
 
52
52
  # Now create toggle buttons to control sizing
53
- buttons = create_pane_options(hpaned,
54
- "Horizontal",
53
+ buttons = create_pane_options("Horizontal",
55
54
  "Left",
56
55
  "Right")
57
56
  vbox.pack_start(buttons, :expand => false, :fill => false, :padding => 0)
58
- buttons = create_pane_options(hpaned,
59
- "Vertical",
57
+ buttons = create_pane_options("Vertical",
60
58
  "Top",
61
59
  "Bottom")
62
60
  vbox.pack_start(buttons, :expand => false, :fill => false, :padding => 0)
63
61
  vbox.show_all
62
+ end
64
63
 
65
- if !window.visible?
66
- window.show_all
64
+ def run
65
+ if !@window.visible?
66
+ @window.show_all
67
67
  else
68
- window.destroy
68
+ @window.destroy
69
69
  end
70
- window
70
+ @window
71
71
  end
72
72
 
73
- def self.create_pane_options(paned, frame_label, label1, label2)
74
- child1 = paned.child1
75
- child2 = paned.child2
73
+ private
76
74
 
75
+ def create_pane_options(frame_label, label1, label2)
76
+ child1 = @hpaned.child1
77
+ child2 = @hpaned.child2
77
78
  frame = Gtk::Frame.new(frame_label)
78
79
  frame.border_width = 4
79
80
 
80
- table = Gtk::Grid.new
81
- frame.add(table)
81
+ @table = Gtk::Grid.new
82
+ frame.add(@table)
82
83
 
83
84
  label = Gtk::Label.new(label1)
84
- table.attach(label, 0, 0, 1, 1)
85
-
86
- check_button = Gtk::CheckButton.new("_Resize")
87
- check_button.use_underline = true
88
- table.attach(check_button, 0, 1, 1, 1)
89
- check_button.signal_connect "toggled" do
90
- resize = paned.child_get_property(child1, "resize")
91
- shrink = paned.child_get_property(child1, "shrink")
92
-
93
- paned.remove(child1)
94
- paned.pack1(child1, :resize => !resize, :shrink => shrink)
95
- end
96
-
97
- check_button = Gtk::CheckButton.new("_Shrink")
98
- check_button.use_underline = true
99
- table.attach(check_button, 0, 2, 1, 1)
100
- check_button.active = true
101
- check_button.signal_connect "toggled" do
102
- resize = paned.child_get_property(child1, "resize")
103
- shrink = paned.child_get_property(child1, "shrink")
85
+ @table.attach(label, 0, 0, 1, 1)
104
86
 
105
- paned.remove(child1)
106
- paned.pack1(child1, :resize => resize, :shrink => !shrink)
107
- end
87
+ check_button(:resize, false, child1, 0, 1)
88
+ check_button(:shrink, true, child1, 0, 2)
108
89
 
109
90
  label = Gtk::Label.new(label2)
110
- table.attach(label, 1, 0, 1, 1)
91
+ @table.attach(label, 1, 0, 1, 1)
111
92
 
112
- check_button = Gtk::CheckButton.new("_Resize")
113
- check_button.use_underline = true
114
- table.attach(check_button, 1, 1, 1, 1)
115
- check_button.active = true
116
- check_button.signal_connect "toggled" do
117
- resize = paned.child_get_property(child2, "resize")
118
- shrink = paned.child_get_property(child2, "shrink")
119
-
120
- paned.remove(child2)
121
- paned.pack2(child2, :resize => !resize, :shrink => shrink)
122
- end
93
+ check_button(:resize, true, child2, 1, 1)
94
+ check_button(:shrink, true, child2, 1, 2)
95
+ frame
96
+ end
123
97
 
124
- check_button = Gtk::CheckButton.new("_Shrink")
98
+ def check_button(type, active, child, xposition, yposition)
99
+ is_resize = (type == :resize)
100
+ label = is_resize ? "_Resize" : "_Shrink"
101
+ check_button = Gtk::CheckButton.new(label)
125
102
  check_button.use_underline = true
126
- table.attach(check_button, 1, 2, 1, 1)
127
- check_button.active = true
103
+ check_button.active = active
104
+ @table.attach(check_button, xposition, yposition, 1, 1)
128
105
  check_button.signal_connect "toggled" do
129
- resize = paned.child_get_property(child2, "resize")
130
- shrink = paned.child_get_property(child2, "shrink")
131
-
132
- paned.remove(child2)
133
- paned.pack2(child2, :resize => resize, :shrink => !shrink)
106
+ is_child1 = (@hpaned.child1 == child)
107
+
108
+ resize = @hpaned.child_get_property(child, "resize")
109
+ shrink = @hpaned.child_get_property(child, "shrink")
110
+
111
+ if is_resize
112
+ resize = !resize
113
+ else
114
+ shrink = !shrink
115
+ end
116
+
117
+ @hpaned.remove(child)
118
+ if is_child1
119
+ @hpaned.pack1(child, :resize => resize, :shrink => shrink)
120
+ else
121
+ @hpaned.pack2(child, :resize => resize, :shrink => shrink)
122
+ end
134
123
  end
135
- frame
136
124
  end
137
125
  end
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2015 Ruby-GNOME2 Project Team
1
+ # Copyright (c) 2015-2016 Ruby-GNOME2 Project Team
2
2
  # This program is licenced under the same licence as Ruby-GNOME2.
3
3
  #
4
4
  =begin
@@ -7,64 +7,65 @@
7
7
  These widgets are mainly intended for use in preference dialogs.
8
8
  They allow to select colors, fonts, files, directories and applications.
9
9
  =end
10
- module PickersDemo
11
- def self.run_demo(main_window)
12
- window = Gtk::Window.new(:toplevel)
13
- window.screen = main_window.screen
14
- window.set_title("Pickers")
15
- window.set_border_width(10)
10
+ class PickersDemo
11
+ def initialize(main_window)
12
+ @window = Gtk::Window.new(:toplevel)
13
+ @window.screen = main_window.screen
14
+ @window.title = "Pickers"
15
+ @window.border_width = 10
16
16
 
17
- table = Gtk::Grid.new
18
- table.set_row_spacing(3)
19
- table.set_column_spacing(10)
20
- window.add(table)
17
+ initialize_grid
21
18
 
22
- label = Gtk::Label.new("Color:")
23
- label.set_halign(:start)
24
- label.set_valign(:center)
25
- label.set_hexpand(true)
19
+ label = generate_label("Color:")
26
20
  picker = Gtk::ColorButton.new
27
- table.attach(label, 0, 0, 1, 1)
28
- table.attach(picker, 1, 0, 1, 1)
21
+ @table.attach(label, 0, 0, 1, 1)
22
+ @table.attach(picker, 1, 0, 1, 1)
29
23
 
30
- label = Gtk::Label.new("Font:")
31
- label.set_halign(:start)
32
- label.set_valign(:center)
33
- label.set_hexpand(true)
24
+ label = generate_label("Font:")
34
25
  picker = Gtk::FontButton.new
35
- table.attach(label, 0, 1, 1, 1)
36
- table.attach(picker, 1, 1, 1, 1)
26
+ @table.attach(label, 0, 1, 1, 1)
27
+ @table.attach(picker, 1, 1, 1, 1)
37
28
 
38
- label = Gtk::Label.new("File:")
39
- label.set_halign(:start)
40
- label.set_valign(:center)
41
- label.set_hexpand(true)
29
+ label = generate_label("File:")
42
30
  picker = Gtk::FileChooserButton.new("Pick a file", :open)
43
- table.attach(label, 0, 2, 1, 1)
44
- table.attach(picker, 1, 2, 1, 1)
31
+ @table.attach(label, 0, 2, 1, 1)
32
+ @table.attach(picker, 1, 2, 1, 1)
45
33
 
46
- label = Gtk::Label.new("Folder:")
47
- label.set_halign(:start)
48
- label.set_valign(:center)
49
- label.set_hexpand(true)
34
+ label = generate_label("Folder:")
50
35
  picker = Gtk::FileChooserButton.new("Pick a folder", :select_folder)
51
- table.attach(label, 0, 3, 1, 1)
52
- table.attach(picker, 1, 3, 1, 1)
36
+ @table.attach(label, 0, 3, 1, 1)
37
+ @table.attach(picker, 1, 3, 1, 1)
53
38
 
54
- label = Gtk::Label.new("Mail:")
55
- label.set_halign(:start)
56
- label.set_valign(:center)
57
- label.set_hexpand(true)
39
+ label = generate_label("Mail:")
58
40
  picker = Gtk::AppChooserButton.new("x-scheme-handler/mailto")
59
41
  picker.set_show_dialog_item(true)
60
- table.attach(label, 0, 4, 1, 1)
61
- table.attach(picker, 1, 4, 1, 1)
42
+ @table.attach(label, 0, 4, 1, 1)
43
+ @table.attach(picker, 1, 4, 1, 1)
44
+ end
62
45
 
63
- if !window.visible?
64
- window.show_all
46
+ def run
47
+ if !@window.visible?
48
+ @window.show_all
65
49
  else
66
- window.destroy
50
+ @window.destroy
67
51
  end
68
- window
52
+ @window
53
+ end
54
+
55
+ private
56
+
57
+ def initialize_grid
58
+ @table = Gtk::Grid.new
59
+ @table.row_spacing = 3
60
+ @table.column_spacing = 10
61
+ @window.add(@table)
62
+ end
63
+
64
+ def generate_label(label)
65
+ label = Gtk::Label.new(label)
66
+ label.set_halign(:start)
67
+ label.set_valign(:center)
68
+ label.set_hexpand(true)
69
+ label
69
70
  end
70
71
  end