gtk3 3.0.9 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) 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/gtk3/deprecated.rb +0 -8
  6. data/lib/gtk3/loader.rb +1 -7
  7. data/lib/gtk3/tree-model.rb +2 -0
  8. data/sample/gtk-demo/TODO +10 -10
  9. data/sample/gtk-demo/assistant.rb +44 -39
  10. data/sample/gtk-demo/builder.rb +71 -50
  11. data/sample/gtk-demo/button_box.rb +39 -28
  12. data/sample/gtk-demo/clipboard.rb +139 -46
  13. data/sample/gtk-demo/colorsel.rb +50 -36
  14. data/sample/gtk-demo/css_accordion.rb +18 -17
  15. data/sample/gtk-demo/css_basics.rb +60 -47
  16. data/sample/gtk-demo/css_multiplebgs.rb +92 -71
  17. data/sample/gtk-demo/css_pixbufs.rb +61 -48
  18. data/sample/gtk-demo/css_shadows.rb +63 -50
  19. data/sample/gtk-demo/cursors.rb +95 -64
  20. data/sample/gtk-demo/dialog.rb +95 -78
  21. data/sample/gtk-demo/drawingarea.rb +138 -171
  22. data/sample/gtk-demo/editable_cells.rb +169 -130
  23. data/sample/gtk-demo/entry_buffer.rb +15 -13
  24. data/sample/gtk-demo/entry_completion.rb +22 -17
  25. data/sample/gtk-demo/expander.rb +39 -31
  26. data/sample/gtk-demo/filtermodel.rb +67 -63
  27. data/sample/gtk-demo/font_features.rb +91 -60
  28. data/sample/gtk-demo/glarea.rb +277 -0
  29. data/sample/gtk-demo/headerbar.rb +17 -15
  30. data/sample/gtk-demo/hypertext.rb +146 -167
  31. data/sample/gtk-demo/iconview.rb +132 -91
  32. data/sample/gtk-demo/iconview_edit.rb +49 -38
  33. data/sample/gtk-demo/infobar.rb +81 -62
  34. data/sample/gtk-demo/links.rb +35 -30
  35. data/sample/gtk-demo/list_store.rb +169 -114
  36. data/sample/gtk-demo/listbox.rb +183 -0
  37. data/sample/gtk-demo/main.rb +32 -21
  38. data/sample/gtk-demo/markup.rb +65 -52
  39. data/sample/gtk-demo/menus.rb +57 -58
  40. data/sample/gtk-demo/modelbutton.rb +11 -9
  41. data/sample/gtk-demo/modelbutton.ui +3 -0
  42. data/sample/gtk-demo/overlay.rb +39 -32
  43. data/sample/gtk-demo/overlay2.rb +68 -54
  44. data/sample/gtk-demo/panes.rb +56 -68
  45. data/sample/gtk-demo/pickers.rb +46 -45
  46. data/sample/gtk-demo/pixbufs.rb +27 -25
  47. data/sample/gtk-demo/popover.rb +70 -63
  48. data/sample/gtk-demo/printing.rb +94 -69
  49. data/sample/gtk-demo/revealer.rb +46 -38
  50. data/sample/gtk-demo/rotated_text.rb +75 -54
  51. data/sample/gtk-demo/scale.rb +10 -8
  52. data/sample/gtk-demo/search_entry.rb +195 -0
  53. data/sample/gtk-demo/search_entry2.rb +71 -59
  54. data/sample/gtk-demo/sidebar.rb +20 -19
  55. data/sample/gtk-demo/sizegroup.rb +36 -35
  56. data/sample/gtk-demo/spinbutton.rb +128 -0
  57. data/sample/gtk-demo/spinner.rb +55 -40
  58. data/sample/gtk-demo/stack.rb +11 -8
  59. data/sample/gtk-demo/textmask.rb +14 -13
  60. data/sample/gtk-demo/textscroll.rb +16 -12
  61. data/sample/gtk-demo/theming_style_classes.rb +14 -12
  62. data/sample/gtk-demo/transparent.rb +17 -13
  63. data/sample/misc/treemodelfilter.rb +1 -1
  64. metadata +21 -16
@@ -6,72 +6,44 @@
6
6
 
7
7
  This demo shows how to use CSS shadows.
8
8
  =end
9
- module CssShadowsDemo
10
- def self.run_demo(main_window)
11
- window = Gtk::Window.new(:toplevel)
12
- window.set_title("Shadows")
13
- window.set_transient_for(main_window)
14
- window.set_default_size(400, 300)
9
+ class CssShadowsDemo
10
+ def initialize(main_window)
11
+ @window = Gtk::Window.new(:toplevel)
12
+ @window.title = "Shadows"
13
+ @window.transient_for = main_window
14
+ @window.set_default_size(400, 300)
15
15
 
16
16
  paned = Gtk::Paned.new(:vertical)
17
- window.add(paned)
17
+ @window.add(paned)
18
18
 
19
19
  child = create_toolbar
20
20
  paned.add(child)
21
21
 
22
- text = Gtk::TextBuffer.new
23
- text.create_tag("warning", "underline" => :single)
24
- text.create_tag("error", "underline" => :error)
25
- default_css = Gio::Resources.lookup_data("/css_shadows/gtk.css")
26
- text.text = default_css
27
-
28
- provider = Gtk::CssProvider.new
29
- provider.load_from_data(default_css)
22
+ @default_css = Gio::Resources.lookup_data("/css_shadows/gtk.css")
23
+ initialize_text_buffer
24
+ initialize_provider
30
25
 
31
26
  container = Gtk::ScrolledWindow.new
32
27
  paned.add(container)
33
28
 
34
- child = Gtk::TextView.new(text)
29
+ child = Gtk::TextView.new(@text)
35
30
  container.add(child)
36
31
 
37
- text.signal_connect "changed" do |buffer|
38
- buffer.remove_all_tags(buffer.start_iter, buffer.end_iter)
39
- modified_text = buffer.get_text(buffer.start_iter,
40
- buffer.end_iter,
41
- false)
42
- begin
43
- provider.load_from_data(modified_text)
44
- rescue
45
- provider.load_from_data(default_css)
46
- end
47
-
48
- Gtk::StyleContext.reset_widgets
49
- end
50
-
51
- provider.signal_connect "parsing-error" do |_css_provider, section, error|
52
- start_i = text.get_iter_at(:line => section.start_line,
53
- :index => section.start_position)
54
- end_i = text.get_iter_at(:line => section.end_line,
55
- :index => section.end_position)
56
- tag_name = nil
57
- if error == Gtk::CssProviderError::DEPRECATED
58
- tag_name = "warning"
59
- else
60
- tag_name = "error"
61
- end
62
- text.apply_tag_by_name(tag_name, start_i, end_i)
63
- end
64
- apply_style(window, provider)
32
+ apply_style(@window, @provider)
33
+ end
65
34
 
66
- if !window.visible?
67
- window.show_all
35
+ def run
36
+ if !@window.visible?
37
+ @window.show_all
68
38
  else
69
- window.destroy
39
+ @window.destroy
70
40
  end
71
- window
41
+ @window
72
42
  end
73
43
 
74
- def self.create_toolbar
44
+ private
45
+
46
+ def create_toolbar
75
47
  toolbar = Gtk::Toolbar.new
76
48
  toolbar.set_valign(:center)
77
49
 
@@ -90,7 +62,7 @@ module CssShadowsDemo
90
62
  toolbar
91
63
  end
92
64
 
93
- def self.apply_style(widget, provider)
65
+ def apply_style(widget, provider)
94
66
  style_context = widget.style_context
95
67
  style_context.add_provider(provider, Gtk::StyleProvider::PRIORITY_USER)
96
68
  return unless widget.respond_to?(:children)
@@ -98,4 +70,45 @@ module CssShadowsDemo
98
70
  apply_style(child, provider)
99
71
  end
100
72
  end
73
+
74
+ def initialize_text_buffer
75
+ @text = Gtk::TextBuffer.new
76
+ @text.create_tag("warning", "underline" => Pango::UNDERLINE_SINGLE)
77
+ @text.create_tag("error", "underline" => Pango::UNDERLINE_ERROR)
78
+ @text.text = @default_css
79
+ text_buffer_signal_connect_changed
80
+ end
81
+
82
+ def text_buffer_signal_connect_changed
83
+ @text.signal_connect "changed" do |buffer|
84
+ buffer.remove_all_tags(buffer.start_iter, buffer.end_iter)
85
+ modified_text = buffer.get_text(buffer.start_iter,
86
+ buffer.end_iter,
87
+ false)
88
+ begin
89
+ @provider.load_from_data(modified_text)
90
+ rescue
91
+ @provider.load_from_data(@default_css)
92
+ end
93
+
94
+ Gtk::StyleContext.reset_widgets
95
+ end
96
+ end
97
+
98
+ def initialize_provider
99
+ @provider = Gtk::CssProvider.new
100
+ @provider.load_from_data(@default_css)
101
+ provider_signal_connect_parsing_error
102
+ end
103
+
104
+ def provider_signal_connect_parsing_error
105
+ @provider.signal_connect "parsing-error" do |_css_provider, section, error|
106
+ start_i = @text.get_iter_at(:line => section.start_line,
107
+ :index => section.start_position)
108
+ end_i = @text.get_iter_at(:line => section.end_line,
109
+ :index => section.end_position)
110
+ tag = error == Gtk::CssProviderError::DEPRECATED ? "warning" : "error"
111
+ @text.apply_tag_by_name(tag, start_i, end_i)
112
+ end
113
+ end
101
114
  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
@@ -6,109 +6,140 @@
6
6
 
7
7
  Demonstrates a useful set of available cursors.
8
8
  =end
9
- module CursorsDemo
10
- def self.run_demo(main_window)
11
- window = Gtk::Window.new(:toplevel)
12
- window.screen = main_window.screen
13
- window.set_title("Cursors")
14
- window.set_default_size(500, 500)
9
+ class CursorsDemo
10
+ def initialize(main_window)
11
+ @window = Gtk::Window.new(:toplevel)
12
+ @window.screen = main_window.screen
13
+ @window.title = "Cursors"
14
+ @window.set_default_size(500, 500)
15
15
 
16
16
  sw = Gtk::ScrolledWindow.new(nil, nil)
17
17
  sw.set_policy(:never, :automatic)
18
- window.add(sw)
18
+ @window.add(sw)
19
19
 
20
- box = Gtk::Box.new(:vertical, 0)
21
- box.set_property("margin-start", 20)
22
- box.set_property("margin-end", 20)
23
- box.set_property("margin-bottom", 20)
24
- sw.add(box)
20
+ initialize_box
21
+ sw.add(@box)
25
22
 
26
- section = Section.new(box, "General")
23
+ add_general_section
24
+ add_link_and_status_section
25
+ add_selection_section
26
+ add_drag_and_drop_section
27
+ add_resize_and_scrolling_section
28
+ add_zoom_section
29
+ end
30
+
31
+ def run
32
+ if !@window.visible?
33
+ @window.show_all
34
+ else
35
+ @window.destroy
36
+ end
37
+ @window
38
+ end
39
+
40
+ private
41
+
42
+ def initialize_box
43
+ @box = Gtk::Box.new(:vertical, 0)
44
+ @box.margin_start = 20
45
+ @box.margin_end = 20
46
+ @box.margin_bottom = 20
47
+ end
48
+
49
+ def add_general_section
50
+ section = Section.new(@box, "General")
27
51
  %w(default none).each do |cursor_name|
28
52
  section.add_button(cursor_name)
29
53
  end
54
+ end
30
55
 
31
- section = Section.new(box, "Link & Status")
56
+ def add_link_and_status_section
57
+ section = Section.new(@box, "Link & Status")
32
58
  %w(context-menu help
33
59
  pointer progress wait).each do |cursor_name|
34
60
  section.add_button(cursor_name)
35
61
  end
62
+ end
36
63
 
37
- section = Section.new(box, "Selection")
64
+ def add_selection_section
65
+ section = Section.new(@box, "Selection")
38
66
  %w(cell crosshair text vertical-text).each do |cursor_name|
39
67
  section.add_button(cursor_name)
40
68
  end
69
+ end
41
70
 
42
- section = Section.new(box, "Drag & Drop")
71
+ def add_drag_and_drop_section
72
+ section = Section.new(@box, "Drag & Drop")
43
73
  %w(alias copy move no-drop
44
74
  not-allowed grab grabbing).each do |cursor_name|
45
75
  section.add_button(cursor_name)
46
76
  end
77
+ end
47
78
 
48
- section = Section.new(box, "Resize & Scrolling")
79
+ def add_resize_and_scrolling_section
80
+ section = Section.new(@box, "Resize & Scrolling")
49
81
  %w(all-scroll col-resize row-resize n-resize
50
82
  e-resize s-resize w-resize ne-resize nw-resize
51
83
  se-resize sw-resize ew-resize ns-resize nesw-resize
52
84
  nwse-resize).each do |cursor_name|
53
85
  section.add_button(cursor_name)
54
86
  end
87
+ end
55
88
 
56
- section = Section.new(box, "Zoom")
89
+ def add_zoom_section
90
+ section = Section.new(@box, "Zoom")
57
91
  %w(zoom-in zoom-out).each do |cursor_name|
58
92
  section.add_button(cursor_name)
59
93
  end
94
+ end
95
+ end
60
96
 
61
- if !window.visible?
62
- window.show_all
63
- else
64
- window.destroy
65
- end
66
- window
97
+ class Section
98
+ def initialize(container, title)
99
+ label = Gtk::Label.new(title)
100
+ label.xalign = 0
101
+ label.margin_top = 10
102
+ label.margin_bottom = 10
103
+ container.pack_start(label, :expand => false, :fill => true, :padding => 0)
104
+ initialize_section
105
+ container.pack_start(@section,
106
+ :expand => false, :fill => true, :padding => 0)
67
107
  end
68
108
 
69
- class Section
70
- def initialize(container, title)
71
- label = Gtk::Label.new(title)
72
- label.set_xalign(0.0)
73
- label.set_margin_top(10)
74
- label.set_margin_bottom(10)
75
- container.pack_start(label, :expand => false, :fill => true, :padding => 0)
76
-
77
- @section = Gtk::FlowBox.new
78
- @section.set_halign(:start)
79
- @section.set_selection_mode(:none)
80
- @section.set_min_children_per_line(2)
81
- @section.set_min_children_per_line(20)
82
- container.pack_start(@section, :expand => false, :fill => true, :padding => 0)
109
+ def add_button(css_name)
110
+ cursor = Gdk::Cursor.new(css_name)
111
+ image = nil
112
+ if !cursor
113
+ image = Gtk::Image.new(:icon_name => "image-missing", :size => :menu)
114
+ else
115
+ path = "/cursors/#{css_name.tr('-', '_')}_cursor.png"
116
+ image = Gtk::Image.new(:resource => path)
83
117
  end
118
+ image.set_size_request(32, 32)
84
119
 
85
- def add_button(css_name)
86
- cursor = Gdk::Cursor.new(css_name)
87
- image = nil
88
- if !cursor
89
- image = Gtk::Image.new(:icon_name => "image-missing", :size => :menu)
90
- else
91
- path = "/cursors/#{css_name.tr('-', '_')}_cursor.png"
92
- image = Gtk::Image.new(:resource => path)
93
- end
94
- image.set_size_request(32, 32)
95
-
96
- button = Gtk::Button.new
97
- button.add(image)
98
- button.style_context.add_class("image-button")
99
- button.signal_connect("clicked") do |_widget|
100
- apply_cursor(cursor)
101
- end
102
- button.set_tooltip_text(css_name)
103
- @section.add(button)
120
+ button = Gtk::Button.new
121
+ button.add(image)
122
+ button.style_context.add_class("image-button")
123
+ button.signal_connect("clicked") do |_widget|
124
+ apply_cursor(cursor)
104
125
  end
126
+ button.set_tooltip_text(css_name)
127
+ @section.add(button)
128
+ end
105
129
 
106
- private
130
+ private
107
131
 
108
- def apply_cursor(cursor)
109
- toplevel = @section.toplevel
110
- window = toplevel.window
111
- window.set_cursor(cursor)
112
- end
132
+ def initialize_section
133
+ @section = Gtk::FlowBox.new
134
+ @section.set_halign(:start)
135
+ @section.set_selection_mode(:none)
136
+ @section.set_min_children_per_line(2)
137
+ @section.set_min_children_per_line(20)
138
+ end
139
+
140
+ def apply_cursor(cursor)
141
+ toplevel = @section.toplevel
142
+ window = toplevel.window
143
+ window.set_cursor(cursor)
113
144
  end
114
145
  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
@@ -6,15 +6,15 @@
6
6
 
7
7
  Dialog widgets are used to pop up a transient window for user feedback.
8
8
  =end
9
- module DialogDemo
10
- def self.run_demo(main_window)
11
- window = Gtk::Window.new(:toplevel)
12
- window.screen = main_window.screen
13
- window.title = "Dialogs and Message Boxes"
14
- window.border_width = 8
9
+ class DialogDemo
10
+ def initialize(main_window)
11
+ @window = Gtk::Window.new(:toplevel)
12
+ @window.screen = main_window.screen
13
+ @window.title = "Dialogs and Message Boxes"
14
+ @window.border_width = 8
15
15
 
16
16
  frame = Gtk::Frame.new("Dialogs")
17
- window.add(frame)
17
+ @window.add(frame)
18
18
 
19
19
  vbox = Gtk::Box.new(:vertical, 8)
20
20
  vbox.border_width = 8
@@ -23,25 +23,8 @@ module DialogDemo
23
23
  # Standard message dialog
24
24
  hbox = Gtk::Box.new(:horizontal, 8)
25
25
  vbox.pack_start(hbox, :expand => false, :fill => false, :padding => 0)
26
- button = Gtk::Button.new(:label => "_Message Dialog",
27
- :use_underline => true)
28
- i = 0
29
-
30
- button.signal_connect "clicked" do
31
- dialog = Gtk::MessageDialog.new(:parent => window,
32
- :flags => [:modal, :destroy_with_parent],
33
- :type => :info,
34
- :buttons => :ok_cancel,
35
- :message => <<-MESSAGE)
36
- This message has been popped up the following
37
- number of times:
38
- MESSAGE
39
- dialog.secondary_text = "#{i}"
40
- dialog.run
41
- dialog.destroy
42
- i += 1
43
- end
44
26
 
27
+ button = initialize_standard_message_button
45
28
  hbox.pack_start(button, :expand => false, :fill => false, :padding => 0)
46
29
  vbox.pack_start(Gtk::Separator.new(:horizontal),
47
30
  :expand => false,
@@ -53,16 +36,94 @@ MESSAGE
53
36
  vbox.pack_start(hbox, :expand => false, :fill => false, :padding => 0)
54
37
  vbox2 = Gtk::Box.new(:vertical, 0)
55
38
 
39
+ hbox.pack_start(vbox2, :expand => false, :fill => false, :padding => 0)
40
+ button = initialize_interactive_message_button
41
+ vbox2.pack_start(button, :expand => false, :fill => false, :padding => 0)
42
+
43
+ table, @entry1, @entry2 = initialize_grid_with_entries
44
+ hbox.pack_start(table, :expand => false, :fill => false, :padding => 0)
45
+ end
46
+
47
+ def run
48
+ if !@window.visible?
49
+ @window.show_all
50
+ else
51
+ @window.destroy
52
+ end
53
+ @window
54
+ end
55
+
56
+ private
57
+
58
+ def initialize_standard_message_button
59
+ button = Gtk::Button.new(:label => "_Message Dialog",
60
+ :use_underline => true)
61
+ @counter = 0
62
+ button.signal_connect "clicked" do
63
+ show_standard_message_dialog
64
+ end
65
+ button
66
+ end
67
+
68
+ def initialize_interactive_message_button
56
69
  button = Gtk::Button.new(:label => "_Interactive Dialog",
57
70
  :use_underline => true)
71
+ button.signal_connect "clicked" do
72
+ show_interactive_message_dialog
73
+ end
74
+ button
75
+ end
58
76
 
59
- hbox.pack_start(vbox2, :expand => false, :fill => false, :padding => 0)
60
- vbox2.pack_start(button, :expand => false, :fill => false, :padding => 0)
77
+ def show_standard_message_dialog
78
+ dialog = Gtk::MessageDialog.new(:parent => @window,
79
+ :flags => [:modal, :destroy_with_parent],
80
+ :type => :info,
81
+ :buttons => :ok_cancel,
82
+ :message => <<-MESSAGE)
83
+ This message has been popped up the following
84
+ number of times:
85
+ MESSAGE
86
+ dialog.secondary_text = @counter.to_s
87
+ dialog.run
88
+ dialog.destroy
89
+ @counter += 1
90
+ end
91
+
92
+ def show_interactive_message_dialog
93
+ dialog = Gtk::Dialog.new(:parent => @window,
94
+ :title => "Interactive Dialog",
95
+ :flags => [:modal, :destroy_with_parent],
96
+ :buttons => [["_OK", :ok],
97
+ ["_Cancel", :cancel]])
98
+ content_area = dialog.content_area
99
+ hbox = initialize_interactive_dialog_interface
100
+ content_area.pack_start(hbox)
101
+
102
+ response = dialog.run
103
+
104
+ if response == :ok
105
+ @entry1.text = @dialog_entry1.text
106
+ @entry2.text = @dialog_entry2.text
107
+ end
61
108
 
109
+ dialog.destroy
110
+ end
111
+
112
+ def initialize_interactive_dialog_interface
113
+ hbox = Gtk::Box.new(:horizontal, 8)
114
+ hbox.border_width = 8
115
+ image = Gtk::Image.new(:icon_name => "dialog-question", :size => :dialog)
116
+ hbox.pack_start(image)
117
+ table, @dialog_entry1, @dialog_entry2 = initialize_grid_with_entries
118
+ hbox.pack_start(table, :expand => false, :fill => false, :padding => 0)
119
+ hbox.show_all
120
+ hbox
121
+ end
122
+
123
+ def initialize_grid_with_entries
62
124
  table = Gtk::Grid.new
63
125
  table.row_spacing = 4
64
126
  table.column_spacing = 4
65
- hbox.pack_start(table, :expand => false, :fill => false, :padding => 0)
66
127
 
67
128
  label = Gtk::Label.new("_Entry 1", :use_underline => true)
68
129
  table.attach(label, 0, 0, 1, 1)
@@ -71,57 +132,13 @@ MESSAGE
71
132
  table.attach(entry1, 1, 0, 1, 1)
72
133
  label.set_mnemonic_widget(entry1)
73
134
 
74
- entry2 = Gtk::Entry.new
75
135
  label = Gtk::Label.new("E_ntry 2", :use_underline => true)
76
- table.attach(entry2, 1, 1, 1, 1)
136
+ table.attach(label, 0, 1, 1, 1)
77
137
 
78
- button.signal_connect "clicked" do
79
- dialog = Gtk::Dialog.new(:parent => window,
80
- :title => "Interactive Dialog",
81
- :flags => [:modal, :destroy_with_parent],
82
- :buttons => [["_OK", :ok],
83
- ["_Cancel", :cancel]]
84
- )
85
- content_area = dialog.content_area
86
- local_hbox = Gtk::Box.new(:horizontal, 8)
87
- local_hbox.border_width = 8
88
- content_area.pack_start(local_hbox)
89
-
90
- image = Gtk::Image.new(:icon_name => "dialog-question", :size => :dialog)
91
- local_hbox.pack_start(image)
92
-
93
- local_table = Gtk::Grid.new
94
- local_table.row_spacing = 4
95
- local_table.column_spacing = 4
96
- local_hbox.pack_start(local_table, :expand => false, :fill => false, :padding => 0)
97
-
98
- label = Gtk::Label.new("_Entry 1", :use_underline => true)
99
- local_table.attach(label, 0, 0, 1, 1)
100
-
101
- local_entry1 = Gtk::Entry.new
102
- local_table.attach(local_entry1, 1, 0, 1, 1)
103
- label.set_mnemonic_widget(local_entry1)
104
-
105
- local_entry2 = Gtk::Entry.new
106
- label = Gtk::Label.new("E_ntry 2", :use_underline => true)
107
- local_table.attach(local_entry2, 1, 1, 1, 1)
108
-
109
- local_hbox.show_all
110
- response = dialog.run
111
-
112
- if response == :ok
113
- entry1.text = local_entry1.text
114
- entry2.text = local_entry2.text
115
- end
116
-
117
- dialog.destroy
118
- end
138
+ entry2 = Gtk::Entry.new
139
+ table.attach(entry2, 1, 1, 1, 1)
140
+ label.set_mnemonic_widget(entry2)
119
141
 
120
- if !window.visible?
121
- window.show_all
122
- else
123
- window.destroy
124
- end
125
- window
142
+ [table, entry1, entry2]
126
143
  end
127
144
  end