gtk3 3.0.8-x86-mingw32 → 3.0.9-x86-mingw32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. checksums.yaml +4 -4
  2. data/ext/gtk3/rb-gtk3.c +17 -0
  3. data/lib/2.2/gtk3.so +0 -0
  4. data/lib/2.3/gtk3.so +0 -0
  5. data/lib/gtk3/container.rb +0 -7
  6. data/lib/gtk3/deprecated.rb +3 -3
  7. data/lib/gtk3/image.rb +7 -7
  8. data/lib/gtk3/loader.rb +11 -5
  9. data/lib/gtk3/text-buffer.rb +33 -12
  10. data/lib/gtk3/text-view.rb +53 -0
  11. data/lib/gtk3/tree-model.rb +5 -0
  12. data/lib/gtk3/tree-view.rb +25 -0
  13. data/lib/gtk3/widget.rb +0 -5
  14. data/sample/gtk-demo/TODO +10 -6
  15. data/sample/gtk-demo/application.ui +93 -70
  16. data/sample/gtk-demo/appmenu.ui +19 -0
  17. data/sample/gtk-demo/assistant.rb +1 -0
  18. data/sample/gtk-demo/css_accordion.css +8 -8
  19. data/sample/gtk-demo/css_accordion.rb +2 -2
  20. data/sample/gtk-demo/css_basics.css +1 -1
  21. data/sample/gtk-demo/css_basics.rb +2 -2
  22. data/sample/gtk-demo/css_multiplebgs.rb +2 -2
  23. data/sample/gtk-demo/css_pixbufs.css +2 -2
  24. data/sample/gtk-demo/css_pixbufs.rb +2 -2
  25. data/sample/gtk-demo/css_shadows.css +5 -5
  26. data/sample/gtk-demo/css_shadows.rb +2 -2
  27. data/sample/gtk-demo/cssview.css +5 -5
  28. data/sample/gtk-demo/data/16x16/gtk3-demo-symbolic.symbolic.png +0 -0
  29. data/sample/gtk-demo/data/16x16/gtk3-demo.png +0 -0
  30. data/sample/gtk-demo/data/22x22/gtk3-demo-symbolic.symbolic.png +0 -0
  31. data/sample/gtk-demo/data/22x22/gtk3-demo.png +0 -0
  32. data/sample/gtk-demo/data/24x24/gtk3-demo-symbolic.symbolic.png +0 -0
  33. data/sample/gtk-demo/data/24x24/gtk3-demo.png +0 -0
  34. data/sample/gtk-demo/data/256x256/gtk3-demo-symbolic.symbolic.png +0 -0
  35. data/sample/gtk-demo/data/256x256/gtk3-demo.png +0 -0
  36. data/sample/gtk-demo/data/32x32/gtk3-demo-symbolic.symbolic.png +0 -0
  37. data/sample/gtk-demo/data/32x32/gtk3-demo.png +0 -0
  38. data/sample/gtk-demo/data/48x48/gtk3-demo-symbolic.symbolic.png +0 -0
  39. data/sample/gtk-demo/data/48x48/gtk3-demo.png +0 -0
  40. data/sample/gtk-demo/data/512x512/gtk3-demo-symbolic.symbolic.png +0 -0
  41. data/sample/gtk-demo/data/512x512/gtk3-demo.png +0 -0
  42. data/sample/gtk-demo/data/source.svg +2886 -0
  43. data/sample/gtk-demo/data/symbolic-source.svg +29 -0
  44. data/sample/gtk-demo/demo.gresource.xml +16 -5
  45. data/sample/gtk-demo/demo.ui +1 -0
  46. data/sample/gtk-demo/font_features.rb +1 -1
  47. data/sample/gtk-demo/main.rb +2 -2
  48. data/sample/gtk-demo/main.ui +18 -36
  49. data/sample/gtk-demo/markup.rb +53 -8
  50. data/sample/gtk-demo/markup.txt +2 -2
  51. data/sample/gtk-demo/org.gtk.Demo.gschema.xml +9 -0
  52. data/sample/gtk-demo/pixbufs.rb +105 -145
  53. data/sample/gtk-demo/reset.css +1 -58
  54. data/sample/gtk-demo/rotated_text.rb +119 -55
  55. data/sample/gtk-demo/shortcuts-boxes.ui +167 -0
  56. data/sample/gtk-demo/shortcuts-builder.ui +547 -0
  57. data/sample/gtk-demo/shortcuts-clocks.ui +166 -0
  58. data/sample/gtk-demo/shortcuts-gedit.ui +172 -0
  59. data/sample/gtk-demo/shortcuts.ui +65 -0
  60. data/sample/gtk-demo/stack.ui +5 -5
  61. data/sample/gtk-demo/textscroll.rb +106 -0
  62. data/sample/gtk-demo/theming.ui +58 -22
  63. data/sample/gtk-demo/theming_style_classes.rb +5 -4
  64. data/sample/gtk-demo/transparent.rb +143 -0
  65. data/sample/misc/aboutdialog.rb +1 -1
  66. data/sample/misc/bindings.rb +36 -15
  67. data/sample/misc/combobox.rb +1 -1
  68. data/sample/misc/dnd.rb +3 -3
  69. data/sample/misc/icons-theme-viewer.rb +1 -1
  70. data/sample/misc/iconview.rb +2 -2
  71. data/sample/misc/textbuffer-serialize.rb +18 -14
  72. data/sample/misc/to-drawable.rb +2 -2
  73. data/sample/misc/tooltips.rb +1 -0
  74. data/sample/misc/treeview.rb +1 -1
  75. data/sample/tutorial/README.md +18 -18
  76. data/test/test-gtk-clipboard.rb +1 -1
  77. data/test/test-gtk-combo-box.rb +2 -2
  78. data/test/test-gtk-icon-view.rb +2 -2
  79. data/test/test-gtk-image.rb +1 -1
  80. data/test/test-gtk-list-store.rb +9 -3
  81. data/test/test-gtk-text-view.rb +64 -0
  82. data/test/test-gtk-tree-path.rb +1 -3
  83. data/test/test-gtk-tree-view.rb +97 -0
  84. data/test/test-gtk-window.rb +2 -2
  85. data/test/test-pango-context.rb +56 -0
  86. metadata +46 -19
@@ -1,10 +1,10 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <interface>
3
3
  <object class="GtkGrid" id="grid">
4
- <property name="row-spacing">6</property>
4
+ <property name="row-spacing">10</property>
5
5
  <property name="orientation">vertical</property>
6
6
  <child>
7
- <object class="GtkToolbar" id="toolbar1">
7
+ <object class="GtkToolbar">
8
8
  <property name="visible">1</property>
9
9
  <property name="hexpand">1</property>
10
10
  <property name="show-arrow">0</property>
@@ -12,7 +12,7 @@
12
12
  <class name="primary-toolbar"/>
13
13
  </style>
14
14
  <child>
15
- <object class="GtkToggleToolButton" id="toolbutton1">
15
+ <object class="GtkToggleToolButton">
16
16
  <property name="use_action_appearance">0</property>
17
17
  <property name="visible">1</property>
18
18
  <property name="use_action_appearance">0</property>
@@ -26,7 +26,7 @@
26
26
  </packing>
27
27
  </child>
28
28
  <child>
29
- <object class="GtkToggleToolButton" id="toolbutton2">
29
+ <object class="GtkToggleToolButton">
30
30
  <property name="use_action_appearance">0</property>
31
31
  <property name="visible">1</property>
32
32
  <property name="use_action_appearance">0</property>
@@ -41,7 +41,7 @@
41
41
  </packing>
42
42
  </child>
43
43
  <child>
44
- <object class="GtkToggleToolButton" id="toolbutton3">
44
+ <object class="GtkToggleToolButton">
45
45
  <property name="use_action_appearance">0</property>
46
46
  <property name="visible">1</property>
47
47
  <property name="sensitive">0</property>
@@ -55,7 +55,7 @@
55
55
  </packing>
56
56
  </child>
57
57
  <child>
58
- <object class="GtkToggleToolButton" id="toolbutton5">
58
+ <object class="GtkToggleToolButton">
59
59
  <property name="use_action_appearance">0</property>
60
60
  <property name="visible">1</property>
61
61
  <property name="label" translatable="yes">Raised</property>
@@ -71,7 +71,7 @@
71
71
  </packing>
72
72
  </child>
73
73
  <child>
74
- <object class="GtkToggleToolButton" id="toolbutton6">
74
+ <object class="GtkToggleToolButton">
75
75
  <property name="use_action_appearance">0</property>
76
76
  <property name="visible">1</property>
77
77
  <property name="label" translatable="yes">Raised Active</property>
@@ -88,7 +88,7 @@
88
88
  </packing>
89
89
  </child>
90
90
  <child>
91
- <object class="GtkToggleToolButton" id="toolbutton4">
91
+ <object class="GtkToggleToolButton">
92
92
  <property name="use_action_appearance">0</property>
93
93
  <property name="visible">1</property>
94
94
  <property name="sensitive">0</property>
@@ -103,7 +103,7 @@
103
103
  </packing>
104
104
  </child>
105
105
  <child>
106
- <object class="GtkToolItem" id="toolitementry">
106
+ <object class="GtkToolItem">
107
107
  <property name="use_action_appearance">0</property>
108
108
  <property name="visible">1</property>
109
109
  <child>
@@ -118,7 +118,7 @@
118
118
  </object>
119
119
  </child>
120
120
  <child>
121
- <object class="GtkToolItem" id="toolitemswitch">
121
+ <object class="GtkToolItem">
122
122
  <property name="use_action_appearance">0</property>
123
123
  <property name="visible">1</property>
124
124
  <child>
@@ -132,7 +132,7 @@
132
132
  </object>
133
133
  </child>
134
134
  <child>
135
- <object class="GtkBox" id="box1">
135
+ <object class="GtkBox">
136
136
  <property name="visible">1</property>
137
137
  <property name="valign">center</property>
138
138
  <property name="halign">center</property>
@@ -140,7 +140,7 @@
140
140
  <class name="linked"/>
141
141
  </style>
142
142
  <child>
143
- <object class="GtkButton" id="button1">
143
+ <object class="GtkButton">
144
144
  <property name="label" translatable="yes">Hi, I am a button</property>
145
145
  <property name="use_action_appearance">0</property>
146
146
  <property name="visible">1</property>
@@ -150,8 +150,8 @@
150
150
  </object>
151
151
  </child>
152
152
  <child>
153
- <object class="GtkButton" id="button2">
154
- <property name="label" translatable="yes">And I&apos;m another button</property>
153
+ <object class="GtkButton">
154
+ <property name="label" translatable="yes">And I'm another button</property>
155
155
  <property name="use_action_appearance">0</property>
156
156
  <property name="visible">1</property>
157
157
  <property name="can_focus">1</property>
@@ -163,7 +163,7 @@
163
163
  </packing>
164
164
  </child>
165
165
  <child>
166
- <object class="GtkButton" id="button3">
166
+ <object class="GtkButton">
167
167
  <property name="label" translatable="yes">This is a button party!</property>
168
168
  <property name="use_action_appearance">0</property>
169
169
  <property name="visible">1</property>
@@ -178,15 +178,16 @@
178
178
  </object>
179
179
  </child>
180
180
  <child>
181
- <object class="GtkToolbar" id="itoolbar1">
181
+ <object class="GtkToolbar">
182
182
  <property name="visible">1</property>
183
183
  <property name="hexpand">1</property>
184
184
  <property name="icon_size">1</property>
185
+ <property name="toolbar-style">icons</property>
185
186
  <style>
186
187
  <class name="inline-toolbar"/>
187
188
  </style>
188
189
  <child>
189
- <object class="GtkToggleToolButton" id="itoolbutton1">
190
+ <object class="GtkToggleToolButton">
190
191
  <property name="use_action_appearance">0</property>
191
192
  <property name="visible">1</property>
192
193
  <property name="use_action_appearance">0</property>
@@ -199,7 +200,7 @@
199
200
  </packing>
200
201
  </child>
201
202
  <child>
202
- <object class="GtkToggleToolButton" id="itoolbutton2">
203
+ <object class="GtkToggleToolButton">
203
204
  <property name="use_action_appearance">0</property>
204
205
  <property name="visible">1</property>
205
206
  <property name="use_action_appearance">0</property>
@@ -212,7 +213,7 @@
212
213
  </packing>
213
214
  </child>
214
215
  <child>
215
- <object class="GtkToggleToolButton" id="itoolbutton3">
216
+ <object class="GtkToggleToolButton">
216
217
  <property name="use_action_appearance">0</property>
217
218
  <property name="visible">1</property>
218
219
  <property name="use_action_appearance">0</property>
@@ -226,7 +227,7 @@
226
227
  </packing>
227
228
  </child>
228
229
  <child>
229
- <object class="GtkToggleToolButton" id="itoolbutton4">
230
+ <object class="GtkToggleToolButton">
230
231
  <property name="use_action_appearance">0</property>
231
232
  <property name="visible">1</property>
232
233
  <property name="use_action_appearance">0</property>
@@ -240,7 +241,7 @@
240
241
  </packing>
241
242
  </child>
242
243
  <child>
243
- <object class="GtkToggleToolButton" id="itoolbutton5">
244
+ <object class="GtkToggleToolButton">
244
245
  <property name="use_action_appearance">0</property>
245
246
  <property name="visible">1</property>
246
247
  <property name="sensitive">0</property>
@@ -254,7 +255,7 @@
254
255
  </packing>
255
256
  </child>
256
257
  <child>
257
- <object class="GtkToggleToolButton" id="itoolbutton6">
258
+ <object class="GtkToggleToolButton">
258
259
  <property name="use_action_appearance">0</property>
259
260
  <property name="visible">1</property>
260
261
  <property name="sensitive">0</property>
@@ -270,5 +271,40 @@
270
271
  </child>
271
272
  </object>
272
273
  </child>
274
+ <child>
275
+ <object class="GtkBox">
276
+ <property name="visible">1</property>
277
+ <property name="spacing">10</property>
278
+ <property name="orientation">horizontal</property>
279
+ <child>
280
+ <object class="GtkButton">
281
+ <property name="visible">1</property>
282
+ <property name="label">Plain</property>
283
+ <property name="halign">end</property>
284
+ </object>
285
+ <packing>
286
+ <property name="expand">1</property>
287
+ </packing>
288
+ </child>
289
+ <child>
290
+ <object class="GtkButton">
291
+ <property name="visible">1</property>
292
+ <property name="label">Destructive</property>
293
+ <style>
294
+ <class name="destructive-action"/>
295
+ </style>
296
+ </object>
297
+ </child>
298
+ <child>
299
+ <object class="GtkButton">
300
+ <property name="visible">1</property>
301
+ <property name="label">Suggested</property>
302
+ <style>
303
+ <class name="suggested-action"/>
304
+ </style>
305
+ </object>
306
+ </child>
307
+ </object>
308
+ </child>
273
309
  </object>
274
310
  </interface>
@@ -4,7 +4,7 @@
4
4
  # This is licensed under the terms of the GNU Lesser General Public
5
5
  # License, version 2.1 or (at your option) later.
6
6
  #
7
- # Copyright (C) 2014-2015 Ruby-GNOME2 Project Team
7
+ # Copyright (C) 2014-2016 Ruby-GNOME2 Project Team
8
8
  #
9
9
  # This library is free software; you can redistribute it and/or
10
10
  # modify it under the terms of the GNU Lesser General Public
@@ -20,7 +20,7 @@
20
20
  # License along with this library; if not, write to the Free Software
21
21
  # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22
22
  =begin
23
- = CSS Theming/Style Classes
23
+ = Theming/Style Classes
24
24
 
25
25
  GTK+ uses CSS for theming. Style classes can be associated
26
26
  with widgets to inform the theme about intended rendering.
@@ -34,8 +34,9 @@ module ThemingStyleClassesDemo
34
34
  def self.run_demo(main_window)
35
35
  window = Gtk::Window.new(:toplevel)
36
36
  window.screen = main_window.screen
37
- window.set_title("Style Classes")
38
- window.set_border_width(12)
37
+ window.title = "Style Classes"
38
+ window.resizable = false
39
+ window.border_width = 12
39
40
 
40
41
  builder = Gtk::Builder.new(:resource => "/theming_style_classes/theming.ui")
41
42
  grid = builder["grid"]
@@ -0,0 +1,143 @@
1
+ # Copyright (c) 2016 Ruby-GNOME2 Project Team
2
+ # This program is licenced under the same licence as Ruby-GNOME2.
3
+ #
4
+ =begin
5
+ = Overlay/Transparency
6
+
7
+ Use transparent background on GdkWindows to create a shadow effect on a GtkOverlay widget.
8
+ =end
9
+ module TransparentDemo
10
+ SHADOW_OFFSET_X = 7
11
+ SHADOW_OFFSET_Y = 7
12
+ SHADOW_RADIUS = 5
13
+
14
+ def self.run_demo(main_window)
15
+ window = Gtk::Window.new(:toplevel)
16
+ window.screen = main_window.screen
17
+ window.set_default_size(450, 450)
18
+ window.title = "Transparency"
19
+ window.border_width = 0
20
+
21
+ view = Gtk::TextView.new
22
+ sw = Gtk::ScrolledWindow.new
23
+ sw.set_policy(:automatic, :automatic)
24
+ sw.add(view)
25
+
26
+ overlay = Gtk::Overlay.new
27
+ overlay.add(sw)
28
+ window.add(overlay)
29
+
30
+ entry = Gtk::Entry.new
31
+ css = <<-CSS
32
+ * { border-width: 0px #{SHADOW_OFFSET_X}px #{SHADOW_OFFSET_Y}px 0px; }
33
+ CSS
34
+ provider = Gtk::CssProvider.new
35
+ provider.load_from_data(css)
36
+ style_context = entry.style_context
37
+ style_context.add_provider(provider,
38
+ Gtk::StyleProvider::PRIORITY_APPLICATION)
39
+ entry.signal_connect "draw" do |widget, cr|
40
+ allocation = widget.allocation
41
+ rect = [allocation.x + SHADOW_OFFSET_X,
42
+ allocation.y + SHADOW_OFFSET_Y,
43
+ allocation.width - SHADOW_OFFSET_X,
44
+ allocation.height - SHADOW_OFFSET_Y
45
+ ]
46
+ draw_shadow_box(cr, rect, SHADOW_RADIUS, 0.4)
47
+ false
48
+ end
49
+
50
+ overlay.add_overlay(entry)
51
+ entry.valign = :center
52
+ entry.halign = :start
53
+ overlay.show_all
54
+
55
+ if !window.visible?
56
+ window.show_all
57
+ else
58
+ window.destroy
59
+ end
60
+ window
61
+ end
62
+
63
+ def self.draw_shadow_box(cr, rect, radius, transparency)
64
+ x0 = rect[0]
65
+ x1 = rect[0] + radius
66
+ x2 = rect[0] + rect[2] - radius
67
+ x3 = rect[0] + rect[2]
68
+
69
+ y0 = rect[1]
70
+ y1 = rect[1] + radius
71
+ y2 = rect[1] + rect[3] - radius
72
+ y3 = rect[1] + rect[3]
73
+
74
+ # Fill non-border part
75
+ cr.set_source_rgba(0, 0, 0, transparency)
76
+ cr.rectangle(x1, y1, x2 - x1, y2 - y1)
77
+
78
+ # Upper border
79
+ pattern = Cairo::LinearPattern.new(0, y0, 0, y1)
80
+ pattern.add_color_stop_rgba(0.0, 0.0, 0.0, 0.0)
81
+ pattern.add_color_stop_rgba(1.0, 0.0, 0.0, transparency)
82
+
83
+ cr.set_source(pattern)
84
+ cr.rectangle(x1, y0, x2 - x1, y1 - y0)
85
+ cr.fill
86
+
87
+ # Bottom border
88
+ pattern = Cairo::LinearPattern.new(0, y2, 0, y3)
89
+ pattern.add_color_stop_rgba(0.0, 0.0, 0.0, transparency)
90
+ pattern.add_color_stop_rgba(1.0, 0.0, 0.0, 0.0)
91
+ cr.set_source(pattern)
92
+ cr.rectangle(x1, y2, x2 - x1, y3 - y2)
93
+ cr.fill
94
+
95
+ # Left border
96
+ pattern = Cairo::LinearPattern.new(x0, 0, x1, 0)
97
+ pattern.add_color_stop_rgba(0.0, 0.0, 0.0, 0.0)
98
+ pattern.add_color_stop_rgba(1.0, 0.0, 0.0, transparency)
99
+ cr.set_source(pattern)
100
+ cr.rectangle(x0, y1, x1 - x0, y2 - y1)
101
+ cr.fill
102
+
103
+ # Right border
104
+ pattern = Cairo::LinearPattern.new(x2, 0, x3, 0)
105
+ pattern.add_color_stop_rgba(0.0, 0.0, 0.0, transparency)
106
+ pattern.add_color_stop_rgba(1.0, 0.0, 0.0, 0.0)
107
+ cr.set_source(pattern)
108
+ cr.rectangle(x2, y1, x3 - x2, y2 - y1)
109
+ cr.fill
110
+
111
+ # NW corner
112
+ pattern = Cairo::RadialPattern.new(x1, y1, 0, x1, y1, radius)
113
+ pattern.add_color_stop_rgba(0.0, 0.0, 0.0, transparency)
114
+ pattern.add_color_stop_rgba(1.0, 0.0, 0.0, 0.0)
115
+ cr.set_source(pattern)
116
+ cr.rectangle(x0, y0, x1 - x0, y1 - y0)
117
+ cr.fill
118
+
119
+ # NE corner
120
+ pattern = Cairo::RadialPattern.new(x2, y1, 0, x2, y1, radius)
121
+ pattern.add_color_stop_rgba(0.0, 0.0, 0.0, transparency)
122
+ pattern.add_color_stop_rgba(1.0, 0.0, 0.0, 0.0)
123
+ cr.set_source(pattern)
124
+ cr.rectangle(x2, y0, x3 - x2, y1 - y0)
125
+ cr.fill
126
+
127
+ # SW corner
128
+ pattern = Cairo::RadialPattern.new(x1, y2, 0, x1, y2, radius)
129
+ pattern.add_color_stop_rgba(0.0, 0.0, 0.0, transparency)
130
+ pattern.add_color_stop_rgba(1.0, 0.0, 0.0, 0.0)
131
+ cr.set_source(pattern)
132
+ cr.rectangle(x0, y2, x1 - x0, y3 - y2)
133
+ cr.fill
134
+
135
+ # SE corner
136
+ pattern = Cairo::RadialPattern.new(x2, y2, 0, x2, y2, radius)
137
+ pattern.add_color_stop_rgba(0.0, 0.0, 0.0, transparency)
138
+ pattern.add_color_stop_rgba(1.0, 0.0, 0.0, 0.0)
139
+ cr.set_source(pattern)
140
+ cr.rectangle(x2, y2, x3 - x2, y3 - y2)
141
+ cr.fill
142
+ end
143
+ end
@@ -19,7 +19,7 @@ a.comments = "This is a sample script for Gtk::AboutDialog"
19
19
  a.copyright = "Copyright (C) 2005 Ruby-GNOME2 Project"
20
20
  a.documenters = ["Documenter 1 <no1@foo.bar.com>", "Documenter 2 <no2@foo.bar.com>"]
21
21
  a.license = "This program is licenced under the same licence as Ruby-GNOME2."
22
- a.logo = Gdk::Pixbuf.new(File.join(__dir__, "gnome-logo-icon.png"))
22
+ a.logo = GdkPixbuf::Pixbuf.new(:file => File.join(__dir__, "gnome-logo-icon.png"))
23
23
  a.program_name = "Gtk::AboutDialog sample"
24
24
  a.translator_credits = "Translator 1\nTranslator 2\n"
25
25
  a.version = "1.0.0"
@@ -50,22 +50,43 @@ window = Gtk::Window.new
50
50
  window.name = "pager_window"
51
51
 
52
52
  css_provider = Gtk::CssProvider.new
53
- css_provider.load(:data => <<CSS)
54
- @binding-set MoveCursor {
55
- bind "<Control>j" { "move-cursor" (display-lines, 1, 0) };
56
- bind "<Control>k" { "move-cursor" (display-lines, -1, 0) };
57
- bind "<Control>l" { "move-cursor" (buffer-ends, 1, 0) };
58
- bind "<Control>m" { "move-cursor" (buffer-ends, -1, 0) };
59
- }
60
- GtkTextView {
61
- -GtkWidget-cursor-color: green;
62
- -GtkWidget-aspect-ratio: 1.0;
63
- font: 20 Sans;
64
- color: #aaa;
65
- background-color: #333 ;
66
- gtk-key-bindings: MoveCursor;
67
- }
53
+
54
+ if Gtk::Version.or_later?(3, 20, 0)
55
+ css_provider.load(:data => <<CSS)
56
+ @binding-set MoveCursor {
57
+ bind "<Control>j" { "move-cursor" (display-lines, 1, 0) };
58
+ bind "<Control>k" { "move-cursor" (display-lines, -1, 0) };
59
+ bind "<Control>l" { "move-cursor" (buffer-ends, 1, 0) };
60
+ bind "<Control>m" { "move-cursor" (buffer-ends, -1, 0) };
61
+ }
62
+ textview {
63
+ caret-color: green;
64
+ -GtkWidget-aspect-ratio: 1.0;
65
+ font: 20 Sans;
66
+ color: #aaa;
67
+ background-color: #333 ;
68
+ -gtk-key-bindings: MoveCursor;
69
+ }
70
+ CSS
71
+ else
72
+ css_provider.load(:data => <<CSS)
73
+ @binding-set MoveCursor {
74
+ bind "<Control>j" { "move-cursor" (display-lines, 1, 0) };
75
+ bind "<Control>k" { "move-cursor" (display-lines, -1, 0) };
76
+ bind "<Control>l" { "move-cursor" (buffer-ends, 1, 0) };
77
+ bind "<Control>m" { "move-cursor" (buffer-ends, -1, 0) };
78
+ }
79
+ GtkTextView {
80
+ -GtkWidget-cursor-color: green;
81
+ -GtkWidget-aspect-ratio: 1.0;
82
+ font: 20 Sans;
83
+ color: #aaa;
84
+ background-color: #333 ;
85
+ gtk-key-bindings: MoveCursor;
86
+ }
68
87
  CSS
88
+ end
89
+
69
90
  hbox = Gtk::Box.new(:horizontal)
70
91
 
71
92
  hbox.add(button1 = Gtk::Button.new(:label => "Ctrl + l"))
@@ -32,7 +32,7 @@ end
32
32
  #
33
33
  # Icon and text
34
34
  #
35
- model = Gtk::ListStore.new(Gdk::Pixbuf, String)
35
+ model = Gtk::ListStore.new(GdkPixbuf::Pixbuf, String)
36
36
  [[Gtk::Stock::QUIT, "quit"],
37
37
  [Gtk::Stock::CANCEL, "cancel"],
38
38
  [Gtk::Stock::OK, "ok"]].each do |stock, name|
data/sample/misc/dnd.rb CHANGED
@@ -2,7 +2,7 @@
2
2
  dnd.rb - Drag and Drop sample script.
3
3
 
4
4
  Copyright (C) 2002-2015 Masao Mutoh
5
- Copyright (c) 2002-2015 Ruby-GNOME2 Project Team
5
+ Copyright (c) 2002-2016 Ruby-GNOME2 Project Team
6
6
  This program is licenced under the same licence as Ruby-GNOME2.
7
7
  =end
8
8
 
@@ -44,9 +44,9 @@ class DestWindow < Gtk::Window
44
44
  context.targets.each do |target|
45
45
  if target.name == "test" ||
46
46
  selection_data.type == Gdk::Selection::TYPE_STRING
47
- data_len = selection_data.data[1]
47
+ data_len = selection_data.data.size
48
48
  puts "drag-data-received signal:"
49
- puts selection_data.data[0].pack("C#{data_len}")
49
+ puts selection_data.data.pack("C#{data_len}")
50
50
  puts selection_data.text
51
51
  else
52
52
  next
@@ -9,7 +9,7 @@
9
9
  require "gtk3"
10
10
 
11
11
  def fill_model(icons)
12
- model = Gtk::ListStore.new(String, Gdk::Pixbuf)
12
+ model = Gtk::ListStore.new(String, GdkPixbuf::Pixbuf)
13
13
  icons.each do |icon|
14
14
  pixbuf = Gtk::IconTheme.default.load_icon(icon, 32, 0)
15
15
  iter = model.append
@@ -11,7 +11,7 @@ require "gtk3"
11
11
  TEXT_COLUMN = 0
12
12
  PIXBUF_COLUMN = 1
13
13
 
14
- model = Gtk::ListStore.new(String, Gdk::Pixbuf)
14
+ model = Gtk::ListStore.new(String, GdkPixbuf::Pixbuf)
15
15
 
16
16
  iv = Gtk::IconView.new
17
17
  iv.set_model(model)
@@ -21,7 +21,7 @@ iv.pixbuf_column = PIXBUF_COLUMN
21
21
  Dir.glob("#{File.expand_path(File.dirname(__FILE__))}/../gtk-demo/gnome*.png").each do |f|
22
22
  iter = model.append
23
23
  iter[TEXT_COLUMN] = File.basename(f)
24
- iter[PIXBUF_COLUMN] = Gdk::Pixbuf.new(f)
24
+ iter[PIXBUF_COLUMN] = GdkPixbuf::Pixbuf.new(:file => f)
25
25
  end
26
26
 
27
27
  iv.signal_connect("item_activated") do |iv, path|
@@ -84,16 +84,18 @@ button_color = Gtk::ToolButton.new(:icon_widget => nil, :label => "Color the reg
84
84
  button_color.signal_connect "clicked" do
85
85
  dialog = Gtk::ColorChooserDialog.new(:title => "Color the region", :parent => window)
86
86
  if dialog.run == Gtk::ResponseType::OK
87
- bounds = buffer.selection_bounds # returns an array [Gtk::TextIter, Gtk::TextIter]
88
- rgba = dialog.rgba
89
- color = Gdk::Color.new(rgba.red*65535, rgba.green*65535, rgba.blue*65535)
90
- tag_name = color.to_s
91
- unless tag = buffer.tag_table.lookup(tag_name)
92
- tag = Gtk::TextTag.new(tag_name)
93
- tag.set_foreground_gdk(color)
87
+ bounds = buffer.selection_bounds # returns an array [Gtk::TextIter, Gtk::TextIter] or nil
88
+ if bounds
89
+ rgba = dialog.rgba
90
+ color = Gdk::Color.new(rgba.red*65535, rgba.green*65535, rgba.blue*65535)
91
+ tag_name = color.to_s
92
+ unless tag = buffer.tag_table.lookup(tag_name)
93
+ tag = Gtk::TextTag.new(tag_name)
94
+ tag.set_foreground_gdk(color)
95
+ end
96
+ buffer.tag_table.add(tag)
97
+ buffer.apply_tag(tag, bounds[0], bounds[1])
94
98
  end
95
- buffer.tag_table.add(tag)
96
- buffer.apply_tag(tag, bounds[0], bounds[1])
97
99
  end
98
100
  dialog.destroy
99
101
  end
@@ -103,12 +105,14 @@ button_font.signal_connect "clicked" do
103
105
  dialog = Gtk::FontChooserDialog.new(:label => "Set font to the region", :parent => window)
104
106
  if dialog.run == Gtk::ResponseType::OK
105
107
  bounds = buffer.selection_bounds
106
- font = dialog.font
107
- unless tag = buffer.tag_table.lookup(font)
108
- tag = Gtk::TextTag.new(font).set_font(font)
108
+ if bounds
109
+ font = dialog.font
110
+ unless tag = buffer.tag_table.lookup(font)
111
+ tag = Gtk::TextTag.new(font).set_font(font)
112
+ end
113
+ buffer.tag_table.add(tag)
114
+ buffer.apply_tag(tag, bounds[0], bounds[1])
109
115
  end
110
- buffer.tag_table.add(tag)
111
- buffer.apply_tag(tag, bounds[0], bounds[1])
112
116
  end
113
117
  dialog.destroy
114
118
  end
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  =begin
3
- to_drawable.rb - Gdk::Pixbuf(GDK methods) sample script.
3
+ to_drawable.rb - GdkPixbuf::Pixbuf(GDK methods) sample script.
4
4
 
5
5
  Copyright (c) 2002-2015 Ruby-GNOME2 Project Team
6
6
  This program is licenced under the same licence as Ruby-GNOME2.
@@ -13,7 +13,7 @@ filename = "#{File.expand_path(File.dirname(__FILE__))}/gnome-logo-icon.png"
13
13
  window = Gtk::Window.new("Drawable sample")
14
14
  window.set_border_width(10)
15
15
 
16
- pixbuf = Gdk::Pixbuf.new(filename)
16
+ pixbuf = GdkPixbuf::Pixbuf.new(:file => filename)
17
17
 
18
18
  drawing_area = Gtk::DrawingArea.new
19
19
  window.add(drawing_area)
@@ -41,6 +41,7 @@ def textview_query_tooltip(textview, keyboard_tip, x, y, tooltip, tag)
41
41
  else
42
42
  bx, by = textview.window_to_buffer_coords(Gtk::TextWindowType::TEXT, x, y)
43
43
  iter, = textview.get_iter_at_position(bx, by)
44
+ return false if iter.nil?
44
45
  end
45
46
  if iter.has_tag?(tag)
46
47
  tooltip.text = 'Tooltip on text tag'
@@ -10,7 +10,7 @@ require "gtk3"
10
10
  window = Gtk::Window.new("Gtk::TreeView sample")
11
11
 
12
12
  # Create data
13
- model = Gtk::TreeStore.new(String, String, Gdk::RGBA, Float, Gdk::Pixbuf)
13
+ model = Gtk::TreeStore.new(String, String, Gdk::RGBA, Float, GdkPixbuf::Pixbuf)
14
14
 
15
15
  # column 1
16
16
  root_iter = model.append(nil)