gtk3 3.0.9-x64-mingw32 → 3.1.0-x64-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
@@ -7,72 +7,85 @@
7
7
  Gtk themes are written using CSS. Every widget is build of multiple items
8
8
  that you can style very similarly to a regular website.
9
9
  =end
10
- module CssBasicsDemo
11
- def self.run_demo(main_window)
12
- window = Gtk::Window.new(:toplevel)
13
- window.set_title("CSS Basics")
14
- window.set_transient_for(main_window)
15
- window.set_default_size(400, 300)
10
+ class CssBasicsDemo
11
+ def initialize(main_window)
12
+ @window = Gtk::Window.new(:toplevel)
13
+ @window.title = "CSS Basics"
14
+ @window.transient_for = main_window
15
+ @window.set_default_size(400, 300)
16
16
 
17
- text = Gtk::TextBuffer.new
18
- text.create_tag("warning", "underline" => Pango::UNDERLINE_SINGLE)
19
- text.create_tag("error", "underline" => Pango::UNDERLINE_ERROR)
20
- default_css = Gio::Resources.lookup_data("/css_basics/css_basics.css", 0)
21
- text.text = default_css
22
-
23
- provider = Gtk::CssProvider.new
24
- provider.load_from_data(default_css)
17
+ @default_css = Gio::Resources.lookup_data("/css_basics/css_basics.css", 0)
18
+ initialize_text_buffer
25
19
 
26
20
  container = Gtk::ScrolledWindow.new
27
- window.add(container)
21
+ @window.add(container)
28
22
 
29
- child = Gtk::TextView.new(text)
23
+ child = Gtk::TextView.new(@text)
30
24
  container.add(child)
31
25
 
32
- text.signal_connect "changed" do |buffer|
26
+ initialize_provider
27
+
28
+ apply_style(@window, @provider)
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 apply_style(widget, provider)
43
+ style_context = widget.style_context
44
+ style_context.add_provider(provider, Gtk::StyleProvider::PRIORITY_USER)
45
+ return unless widget.respond_to?(:children)
46
+ widget.children.each do |child|
47
+ apply_style(child, provider)
48
+ end
49
+ end
50
+
51
+ def initialize_text_buffer
52
+ @text = Gtk::TextBuffer.new
53
+ @text.create_tag("warning", "underline" => Pango::UNDERLINE_SINGLE)
54
+ @text.create_tag("error", "underline" => Pango::UNDERLINE_ERROR)
55
+ @text.text = @default_css
56
+ text_buffer_signal_connect_changed
57
+ end
58
+
59
+ def text_buffer_signal_connect_changed
60
+ @text.signal_connect "changed" do |buffer|
33
61
  buffer.remove_all_tags(buffer.start_iter, buffer.end_iter)
34
62
  modified_text = buffer.get_text(buffer.start_iter,
35
63
  buffer.end_iter,
36
64
  false)
37
65
  begin
38
- provider.load_from_data(modified_text)
66
+ @provider.load_from_data(modified_text)
39
67
  rescue
40
- provider.load_from_data(default_css)
68
+ @provider.load_from_data(@default_css)
41
69
  end
42
70
 
43
71
  Gtk::StyleContext.reset_widgets
44
72
  end
73
+ end
45
74
 
46
- provider.signal_connect "parsing-error" do |_css_provider, section, error|
47
- start_i = text.get_iter_at(:line => section.start_line,
48
- :index => section.start_position)
49
- end_i = text.get_iter_at(:line => section.end_line,
50
- :index => section.end_position)
51
- tag_name = nil
52
- if error == Gtk::CssProviderError::DEPRECATED
53
- tag_name = "warning"
54
- else
55
- tag_name = "error"
56
- end
57
- text.apply_tag_by_name(tag_name, start_i, end_i)
58
- end
59
-
60
- apply_style(window, provider)
61
-
62
- if !window.visible?
63
- window.show_all
64
- else
65
- window.destroy
66
- end
67
- window
75
+ def initialize_provider
76
+ @provider = Gtk::CssProvider.new
77
+ @provider.load_from_data(@default_css)
78
+ provider_signal_connect_parsing_error
68
79
  end
69
80
 
70
- def self.apply_style(widget, provider)
71
- style_context = widget.style_context
72
- style_context.add_provider(provider, Gtk::StyleProvider::PRIORITY_USER)
73
- return unless widget.respond_to?(:children)
74
- widget.children.each do |child|
75
- apply_style(child, provider)
81
+ def provider_signal_connect_parsing_error
82
+ @provider.signal_connect "parsing-error" do |_css_provider, section, error|
83
+ start_i = @text.get_iter_at(:line => section.start_line,
84
+ :index => section.start_position)
85
+ end_i = @text.get_iter_at(:line => section.end_line,
86
+ :index => section.end_position)
87
+ tag = error == Gtk::CssProviderError::DEPRECATED ? "warning" : "error"
88
+ @text.apply_tag_by_name(tag, start_i, end_i)
76
89
  end
77
90
  end
78
91
  end
@@ -7,106 +7,127 @@
7
7
  Gtk themes are written using CSS. Every widget is build of multiple items
8
8
  that you can style very similarly to a regular website.
9
9
  =end
10
- module CssMultiplebgsDemo
11
- def self.run_demo(main_window)
12
- window = Gtk::Window.new(:toplevel)
13
- window.screen = main_window.screen
14
- window.title = "Mutiple Backgrounds"
15
- window.transient_for = main_window
16
- window.set_default_size(400, 300)
10
+ class CssMultiplebgsDemo
11
+ def initialize(main_window)
12
+ @window = Gtk::Window.new(:toplevel)
13
+ @window.screen = main_window.screen
14
+ @window.title = "Mutiple Backgrounds"
15
+ @window.transient_for = main_window
16
+ @window.set_default_size(400, 300)
17
17
 
18
18
  container = Gtk::Overlay.new
19
- container.add_events([:enter_notify_mask, :leave_notify_mask, :pointer_motion_mask])
20
- window.add(container)
19
+ container.add_events([:enter_notify_mask, :leave_notify_mask,
20
+ :pointer_motion_mask])
21
+ @window.add(container)
21
22
 
22
- child = Gtk::DrawingArea.new
23
- child.name = "canvas"
23
+ da = initialize_drawing_area
24
+ container.add(da)
24
25
 
25
- child.signal_connect "draw" do |widget, cr|
26
- context = widget.style_context
27
- Gtk.render_background(context, cr, 0, 0,
28
- widget.allocated_width,
29
- widget.allocated_height)
30
- Gtk.render_frame(context, cr, 0, 0,
31
- widget.allocated_width,
32
- widget.allocated_height)
33
- false
34
- end
35
- container.add(child)
36
-
37
- child = Gtk::Button.new
38
- child.add_events([:enter_notify_mask, :leave_notify_mask, :pointer_motion_mask])
39
- child.name = "bricks-button"
40
- child.halign = :center
41
- child.valign = :center
42
- child.set_size_request(250, 84)
43
- container.add_overlay(child)
26
+ button = initialize_bricks_button
27
+ container.add_overlay(button)
44
28
 
45
29
  paned = Gtk::Paned.new(:vertical)
46
30
  container.add_overlay(paned)
47
-
31
+ css = "/css_multiplebgs/css_multiplebgs.css"
32
+ @default_css = Gio::Resources.lookup_data(css)
48
33
  # Need a filler so we get a handle
49
34
  child = Gtk::Box.new(:vertical, 0)
50
35
  paned.add(child)
51
36
 
52
- text = Gtk::TextBuffer.new
53
- text.create_tag("warning", "underline" => :single)
54
- text.create_tag("error", "underline" => :error)
55
- default_css = Gio::Resources.lookup_data("/css_multiplebgs/css_multiplebgs.css")
56
- text.text = default_css
57
-
58
- provider = Gtk::CssProvider.new
59
- provider.load_from_data(default_css)
60
-
37
+ initialize_text_buffer
61
38
  container = Gtk::ScrolledWindow.new
62
39
  paned.add(container)
63
40
 
64
- child = Gtk::TextView.new(text)
41
+ child = Gtk::TextView.new(@text)
65
42
  container.add(child)
66
43
 
67
- text.signal_connect "changed" do |buffer|
44
+ initialize_provider
45
+ apply_style(@window, @provider)
46
+ end
47
+
48
+ def run
49
+ if !@window.visible?
50
+ @window.show_all
51
+ else
52
+ @window.destroy
53
+ end
54
+ @window
55
+ end
56
+
57
+ private
58
+
59
+ def apply_style(widget, provider)
60
+ style_context = widget.style_context
61
+ style_context.add_provider(provider, Gtk::StyleProvider::PRIORITY_USER)
62
+ return unless widget.respond_to?(:children)
63
+ widget.children.each do |child|
64
+ apply_style(child, provider)
65
+ end
66
+ end
67
+
68
+ def initialize_drawing_area
69
+ da = Gtk::DrawingArea.new
70
+ da.name = "canvas"
71
+ da.signal_connect "draw" do |widget, cr|
72
+ context = widget.style_context
73
+ Gtk.render_background(context, cr, 0, 0, widget.allocated_width,
74
+ widget.allocated_height)
75
+ Gtk.render_frame(context, cr, 0, 0, widget.allocated_width,
76
+ widget.allocated_height)
77
+ false
78
+ end
79
+ da
80
+ end
81
+
82
+ def initialize_bricks_button
83
+ button = Gtk::Button.new
84
+ button.add_events([:enter_notify_mask, :leave_notify_mask,
85
+ :pointer_motion_mask])
86
+ button.name = "bricks-button"
87
+ button.halign = :center
88
+ button.valign = :center
89
+ button.set_size_request(250, 84)
90
+ button
91
+ end
92
+
93
+ def initialize_text_buffer
94
+ @text = Gtk::TextBuffer.new
95
+ @text.create_tag("warning", "underline" => Pango::UNDERLINE_SINGLE)
96
+ @text.create_tag("error", "underline" => Pango::UNDERLINE_ERROR)
97
+ @text.text = @default_css
98
+ text_buffer_signal_connect_changed
99
+ end
100
+
101
+ def text_buffer_signal_connect_changed
102
+ @text.signal_connect "changed" do |buffer|
68
103
  buffer.remove_all_tags(buffer.start_iter, buffer.end_iter)
69
104
  modified_text = buffer.get_text(buffer.start_iter,
70
105
  buffer.end_iter,
71
106
  false)
72
107
  begin
73
- provider.load_from_data(modified_text)
108
+ @provider.load_from_data(modified_text)
74
109
  rescue
75
- provider.load_from_data(default_css)
110
+ @provider.load_from_data(@default_css)
76
111
  end
77
112
 
78
113
  Gtk::StyleContext.reset_widgets
79
114
  end
115
+ end
80
116
 
81
- provider.signal_connect "parsing-error" do |_css_provider, section, error|
82
- start_i = text.get_iter_at(:line => section.start_line,
83
- :index => section.start_position)
84
- end_i = text.get_iter_at(:line => section.end_line,
85
- :index => section.end_position)
86
- tag_name = nil
87
- if error == Gtk::CssProviderError::DEPRECATED
88
- tag_name = "warning"
89
- else
90
- tag_name = "error"
91
- end
92
- text.apply_tag_by_name(tag_name, start_i, end_i)
93
- end
94
- apply_style(window, provider)
95
-
96
- if !window.visible?
97
- window.show_all
98
- else
99
- window.destroy
100
- end
101
- window
117
+ def initialize_provider
118
+ @provider = Gtk::CssProvider.new
119
+ @provider.load_from_data(@default_css)
120
+ provider_signal_connect_parsing_error
102
121
  end
103
122
 
104
- def self.apply_style(widget, provider)
105
- style_context = widget.style_context
106
- style_context.add_provider(provider, Gtk::StyleProvider::PRIORITY_USER)
107
- return unless widget.respond_to?(:children)
108
- widget.children.each do |child|
109
- apply_style(child, provider)
123
+ def provider_signal_connect_parsing_error
124
+ @provider.signal_connect "parsing-error" do |_css_provider, section, error|
125
+ start_i = @text.get_iter_at(:line => section.start_line,
126
+ :index => section.start_position)
127
+ end_i = @text.get_iter_at(:line => section.end_line,
128
+ :index => section.end_position)
129
+ tag = error == Gtk::CssProviderError::DEPRECATED ? "warning" : "error"
130
+ @text.apply_tag_by_name(tag, start_i, end_i)
110
131
  end
111
132
  end
112
133
  end
@@ -7,24 +7,20 @@
7
7
  This demo is done in honour of the Pixbufs demo further down.
8
8
  It is done exclusively with CSS as the background of the window.
9
9
  =end
10
- module CssPixbufsDemo
11
- def self.run_demo(main_window)
12
- window = Gtk::Window.new(:toplevel)
13
- window.set_title("Animated Backgrounds")
14
- window.set_transient_for(main_window)
15
- window.set_default_size(400, 300)
16
-
17
- text = Gtk::TextBuffer.new
18
- text.create_tag("warning", "underline" => Pango::UNDERLINE_SINGLE)
19
- text.create_tag("error", "underline" => Pango::UNDERLINE_ERROR)
20
- default_css = Gio::Resources.lookup_data("/css_pixbufs/gtk.css", 0)
21
- text.text = default_css
22
-
23
- provider = Gtk::CssProvider.new
24
- provider.load_from_data(default_css)
10
+ class CssPixbufsDemo
11
+ def initialize(main_window)
12
+ @window = Gtk::Window.new(:toplevel)
13
+ @window.title = "Animated Backgrounds"
14
+ @window.transient_for = main_window
15
+ @window.set_default_size(400, 300)
16
+
17
+ @default_css = Gio::Resources.lookup_data("/css_pixbufs/gtk.css", 0)
18
+
19
+ initialize_text_buffer
20
+ initialize_provider
25
21
 
26
22
  paned = Gtk::Paned.new(:vertical)
27
- window.add(paned)
23
+ @window.add(paned)
28
24
 
29
25
  child = Gtk::Box.new(:vertical, 0)
30
26
  paned.add(child)
@@ -32,53 +28,70 @@ module CssPixbufsDemo
32
28
  container = Gtk::ScrolledWindow.new
33
29
  paned.add(container)
34
30
 
35
- child = Gtk::TextView.new(text)
31
+ child = Gtk::TextView.new(@text)
36
32
  container.add(child)
37
33
 
38
- text.signal_connect "changed" do |buffer|
34
+ apply_style(@window, @provider)
35
+ end
36
+
37
+ def run
38
+ if !@window.visible?
39
+ @window.show_all
40
+ else
41
+ @window.destroy
42
+ end
43
+ @window
44
+ end
45
+
46
+ private
47
+
48
+ def apply_style(widget, provider)
49
+ style_context = widget.style_context
50
+ style_context.add_provider(provider, Gtk::StyleProvider::PRIORITY_USER)
51
+ return unless widget.respond_to?(:children)
52
+ widget.children.each do |child|
53
+ apply_style(child, provider)
54
+ end
55
+ end
56
+
57
+ def initialize_text_buffer
58
+ @text = Gtk::TextBuffer.new
59
+ @text.create_tag("warning", "underline" => Pango::UNDERLINE_SINGLE)
60
+ @text.create_tag("error", "underline" => Pango::UNDERLINE_ERROR)
61
+ @text.text = @default_css
62
+ text_buffer_signal_connect_changed
63
+ end
64
+
65
+ def text_buffer_signal_connect_changed
66
+ @text.signal_connect "changed" do |buffer|
39
67
  buffer.remove_all_tags(buffer.start_iter, buffer.end_iter)
40
68
  modified_text = buffer.get_text(buffer.start_iter,
41
69
  buffer.end_iter,
42
70
  false)
43
71
  begin
44
- provider.load_from_data(modified_text)
72
+ @provider.load_from_data(modified_text)
45
73
  rescue
46
- provider.load_from_data(default_css)
74
+ @provider.load_from_data(@default_css)
47
75
  end
48
76
 
49
77
  Gtk::StyleContext.reset_widgets
50
78
  end
79
+ end
51
80
 
52
- provider.signal_connect "parsing-error" do |_css_provider, section, error|
53
- start_i = text.get_iter_at(:line => section.start_line,
54
- :index => section.start_position)
55
- end_i = text.get_iter_at(:line => section.end_line,
56
- :index => section.end_position)
57
- tag_name = nil
58
- if error == Gtk::CssProviderError::DEPRECATED
59
- tag_name = "warning"
60
- else
61
- tag_name = "error"
62
- end
63
- text.apply_tag_by_name(tag_name, start_i, end_i)
64
- end
65
-
66
- apply_style(window, provider)
67
-
68
- if !window.visible?
69
- window.show_all
70
- else
71
- window.destroy
72
- end
73
- window
81
+ def initialize_provider
82
+ @provider = Gtk::CssProvider.new
83
+ @provider.load_from_data(@default_css)
84
+ provider_signal_connect_parsing_error
74
85
  end
75
86
 
76
- def self.apply_style(widget, provider)
77
- style_context = widget.style_context
78
- style_context.add_provider(provider, Gtk::StyleProvider::PRIORITY_USER)
79
- return unless widget.respond_to?(:children)
80
- widget.children.each do |child|
81
- apply_style(child, provider)
87
+ def provider_signal_connect_parsing_error
88
+ @provider.signal_connect "parsing-error" do |_css_provider, section, error|
89
+ start_i = @text.get_iter_at(:line => section.start_line,
90
+ :index => section.start_position)
91
+ end_i = @text.get_iter_at(:line => section.end_line,
92
+ :index => section.end_position)
93
+ tag = error == Gtk::CssProviderError::DEPRECATED ? "warning" : "error"
94
+ @text.apply_tag_by_name(tag, start_i, end_i)
82
95
  end
83
96
  end
84
97
  end