gtk3 3.2.1-x86-mingw32 → 3.2.2-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: e75338566648513a7022d68cf2b81a8430879922
4
- data.tar.gz: 97a434c892a8e3e3ac5e05d36b16b59d93f55d79
2
+ SHA256:
3
+ metadata.gz: d6658af40fa016ae370bb1daed75882808b7db64bc8bf8af12591ee48e635c99
4
+ data.tar.gz: 9d4ad5adf428df8eaf7c6923e72dba16528a9737f458b2e67fcec29e5f7077ad
5
5
  SHA512:
6
- metadata.gz: 4de6763125842f35326d72345ad11530c74b18b0424644c0b95742a32f82bdf2feb9374850f038dca2862fdd6fd94b8233bb5039e3153c3edc2319507b6e08a7
7
- data.tar.gz: 7669d89361e609ee61d840dfa86a0759ef9c590b1bce85baad701f89841e3183e853effea0b175f7006834aa26d786230f078e0e3494a27363d6e073f3207fc9
6
+ metadata.gz: b2809856ccdca11c321bf290a4c2ac1f37068cc18e1e93a3ceb02005f25da15b4a27fc84430cf16c86dd0ab72de4b19dbb9f2d7b4d16a159891d8b47a8a34458
7
+ data.tar.gz: f1af1f0752b92e9176912434b55a7fe6a9cd6e5ec3d3bd9bec8163ca0a989f2c302c4c2da393416a8661348c2d7278f30e76074f46038bb4aed6159cbcc0f4bd
Binary file
Binary file
Binary file
Binary file
@@ -60,7 +60,6 @@ module Gtk
60
60
  remove_method(:const_missing)
61
61
  remove_method(:method_missing)
62
62
  end
63
- Gio.init if Gio.respond_to?(:init)
64
63
  Gdk.init if Gdk.respond_to?(:init)
65
64
  loader = Loader.new(self, argv)
66
65
  loader.load
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2015 Ruby-GNOME2 Project Team
1
+ # Copyright (C) 2015-2017 Ruby-GNOME2 Project Team
2
2
  #
3
3
  # This library is free software; you can redistribute it and/or
4
4
  # modify it under the terms of the GNU Lesser General Public
@@ -80,7 +80,7 @@ module Gtk
80
80
  :label => translate_string(label),
81
81
  :tooltip => translate_string(tooltip),
82
82
  :stock_id => stock_id)
83
- action.active = is_active
83
+ action.active = true if is_active
84
84
  action.signal_connect("activate") do
85
85
  callback.call(self, action)
86
86
  end
@@ -31,11 +31,11 @@ module Gtk
31
31
  end
32
32
  alias_method :<<, :add
33
33
 
34
- def add_child(*args, &block)
35
- if defined?(super)
36
- super
34
+ def add_child(*args)
35
+ if args.size == 1
36
+ add(*args)
37
37
  else
38
- add(*args, &block)
38
+ super
39
39
  end
40
40
  end
41
41
 
@@ -179,7 +179,9 @@ module Gtk
179
179
  method_name = rubyish_method_name(info)
180
180
  define_method(info, widget_class, method_name)
181
181
  when /\Adrag_/
182
- method_name = rubyish_method_name(info, :prefix => "drag_")
182
+ method_name = rubyish_method_name(info,
183
+ :prefix => "drag_",
184
+ :n_in_args_offset => -1)
183
185
  define_method(info, Gdk::DragContext, method_name)
184
186
  when /\Abinding_/
185
187
  # Ignore because singleton methods are defined.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2015-2016 Ruby-GNOME2 Project Team
1
+ # Copyright (C) 2015-2018 Ruby-GNOME2 Project Team
2
2
  #
3
3
  # This library is free software; you can redistribute it and/or
4
4
  # modify it under the terms of the GNU Lesser General Public
@@ -118,6 +118,11 @@ module Gtk
118
118
  end
119
119
  end
120
120
 
121
+ alias_method :style_context_raw, :style_context
122
+ def style_context
123
+ @style_context ||= style_context_raw
124
+ end
125
+
121
126
  private
122
127
  def initialize_post
123
128
  klass = self.class
@@ -60,6 +60,8 @@ css_blendmodes.c ok ok
60
60
  fishbowl.c ok ok
61
61
  flowbox.c ok ok
62
62
  tree_store.c ok ok
63
+ toolpalette.c ok ok
64
+ shortcuts.c ok ok
63
65
 
64
66
  Remains :
65
67
 
@@ -67,8 +69,6 @@ application.c no no
67
69
  changedisplay.c ok no
68
70
  foreigndrawing no no
69
71
  gestures.c no no
70
- shortcuts.c no no
71
- toolpalette.c no no
72
72
 
73
73
  # Ruby version
74
74
  Check all the ruby demos that doesn't correspond to a C version.
@@ -74,7 +74,7 @@ class DrawingareaDemo
74
74
  j = spacing
75
75
  ycount = xcount % 2 # start with even/odd depending on row
76
76
  while j < da.allocated_height
77
- if ycount % 2
77
+ if ycount % 2 == 0
78
78
  cr.set_source_rgb(0.45777, 0, 0.45777)
79
79
  else
80
80
  cr.set_source_rgb(1, 1, 1)
@@ -83,10 +83,10 @@ class DrawingareaDemo
83
83
  cr.rectangle(i, j, check_size, check_size)
84
84
  cr.fill
85
85
  j += check_size + spacing
86
- ++ycount
86
+ ycount += 1
87
87
  end
88
88
  i += check_size + spacing
89
- ++xcount
89
+ xcount += 1
90
90
  end
91
91
  end
92
92
 
@@ -6,11 +6,19 @@
6
6
 
7
7
  GtkGLArea is a widget that allows custom drawing using OpenGL calls.
8
8
  =end
9
- require "opengl"
9
+
10
+ begin
11
+ require "opengl"
12
+ rescue LoadError
13
+ puts("opengl-bindings gem is required")
14
+ raise
15
+ end
16
+
10
17
  OpenGL.load_lib
11
- include OpenGL
12
18
 
13
19
  class GlareaDemo
20
+ include OpenGL
21
+
14
22
  X_AXIS, Y_AXIS, Z_AXIS = (0..2).to_a
15
23
  # The object we are drawing
16
24
  VERTEX_DATA = [0.0, 0.5, 0.0, 1.0,
@@ -197,7 +197,7 @@ def select_treeview_item(treeview, filename)
197
197
  end
198
198
  end
199
199
  treeview.expand_to_path(to_select)
200
- treeview.set_cursor(to_select, treeview.columns[FILENAME_COLUMN])
200
+ treeview.set_cursor(to_select, nil, false)
201
201
  end
202
202
 
203
203
  class Demo < Gtk::Application
@@ -313,7 +313,7 @@ class Demo < Gtk::Application
313
313
  action.signal_connect "activate" do |_action, _parameter|
314
314
  selection = @treeview.selection
315
315
  iter = selection.selected
316
- filename = iter[1]
316
+ filename = iter[FILENAME_COLUMN]
317
317
  if filename
318
318
  begin
319
319
  run_demo_from_file(filename, windows.first)
@@ -362,7 +362,7 @@ class Demo < Gtk::Application
362
362
 
363
363
  @treeview.signal_connect "row-activated" do |_tree_view, path, _column|
364
364
  iter = model.get_iter(path)
365
- filename = iter[1]
365
+ filename = iter[FILENAME_COLUMN]
366
366
  begin
367
367
  demo = run_demo_from_file(filename, windows.first)
368
368
  rescue => error
@@ -370,9 +370,9 @@ class Demo < Gtk::Application
370
370
  report_error(error)
371
371
  else
372
372
  if demo
373
- iter[2] = Pango::Style::ITALIC
373
+ iter[STYLE_COLUMN] = Pango::Style::ITALIC
374
374
  demo.signal_connect "destroy" do
375
- iter[2] = Pango::Style::NORMAL
375
+ iter[STYLE_COLUMN] = Pango::Style::NORMAL
376
376
  end
377
377
  end
378
378
  end
@@ -382,8 +382,8 @@ class Demo < Gtk::Application
382
382
  treeview_selection.signal_connect "changed" do |selection, _model|
383
383
  iter = selection.selected
384
384
  if iter
385
- filename = iter[1]
386
- title = iter[0]
385
+ filename = iter[FILENAME_COLUMN]
386
+ title = iter[TITLE_COLUMN]
387
387
  load_file(filename) if filename
388
388
  headerbar.set_title(title)
389
389
  end
@@ -0,0 +1,110 @@
1
+ # Copyright (c) 2017 Ruby-GNOME2 Project Team
2
+ # This program is licenced under the same licence as Ruby-GNOME2.
3
+ #
4
+ =begin
5
+ = Shortcuts Window
6
+
7
+ GtkShortcutsWindow is a window that provides a help overlay
8
+ for shortcuts and gestures in an application.
9
+ =end
10
+ class ShortcutsDemo
11
+ def initialize(main_window)
12
+ @icons_added = false
13
+ unless @icons_added
14
+ theme = Gtk::IconTheme.default
15
+ theme.add_resource_path("/icons")
16
+ @icons_added = true
17
+ end
18
+
19
+ ui = "/shortcuts/shortcuts.ui"
20
+ @builder = Gtk::Builder.new(:resource => ui)
21
+ builder_add_callback_symbols
22
+ @builder.connect_signals {}
23
+
24
+ @window = @builder["window1"]
25
+ @window.screen = main_window.screen
26
+ end
27
+
28
+ def run
29
+ if !@window.visible?
30
+ @window.show_all
31
+ else
32
+ @window.destroy
33
+ end
34
+ @window
35
+ end
36
+
37
+ private
38
+
39
+ def builder_add_callback_symbols
40
+ @builder.connect_signals do |name|
41
+ case name
42
+ when "builder_shortcuts"
43
+ builder_shortcuts
44
+ when "gedit_shortcuts"
45
+ gedit_shortcuts
46
+ when "clocks_shortcuts"
47
+ clocks_shortcuts
48
+ when "clocks_shortcuts_stopwatch"
49
+ clocks_shortcuts_stopwatch
50
+ when "boxes_shortcuts"
51
+ boxes_shortcuts
52
+ when "boxes_shortcuts_wizard"
53
+ boxes_shortcuts_wizard
54
+ when "boxes_shortcuts_display"
55
+ boxes_shortcuts_display
56
+ end
57
+ end
58
+ end
59
+
60
+ def show_shortcuts(id, view)
61
+ path = "/shortcuts/#{id}.ui"
62
+ builder = Gtk::Builder.new(:resource => path)
63
+ overlay = builder[id]
64
+ overlay.set_transient_for(@window)
65
+ overlay.view_name = view if view
66
+ overlay.show
67
+ end
68
+
69
+ def builder_shortcuts
70
+ proc do
71
+ show_shortcuts("shortcuts-builder", nil)
72
+ end
73
+ end
74
+
75
+ def gedit_shortcuts
76
+ proc do
77
+ show_shortcuts("shortcuts-gedit", nil)
78
+ end
79
+ end
80
+
81
+ def clocks_shortcuts
82
+ proc do
83
+ show_shortcuts("shortcuts-clocks", nil)
84
+ end
85
+ end
86
+
87
+ def clocks_shortcuts_stopwatch
88
+ proc do
89
+ show_shortcuts("shortcuts-clocks", "stopwatch")
90
+ end
91
+ end
92
+
93
+ def boxes_shortcuts
94
+ proc do
95
+ show_shortcuts("shortcuts-boxes", nil)
96
+ end
97
+ end
98
+
99
+ def boxes_shortcuts_wizard
100
+ proc do
101
+ show_shortcuts("shortcuts-boxes", "wizard")
102
+ end
103
+ end
104
+
105
+ def boxes_shortcuts_display
106
+ proc do
107
+ show_shortcuts("shortcuts-boxes", "display")
108
+ end
109
+ end
110
+ end
@@ -14,49 +14,49 @@
14
14
  <object class="GtkButton">
15
15
  <property name="visible">1</property>
16
16
  <property name="label">Builder</property>
17
- <signal name="clicked" handler="builder_shortcuts" swapped="1" object="window1"/>
17
+ <signal name="clicked" handler="builder_shortcuts" swapped="1"/>
18
18
  </object>
19
19
  </child>
20
20
  <child>
21
21
  <object class="GtkButton">
22
22
  <property name="visible">1</property>
23
23
  <property name="label">GEdit</property>
24
- <signal name="clicked" handler="gedit_shortcuts" swapped="1" object="window1"/>
24
+ <signal name="clicked" handler="gedit_shortcuts" swapped="1"/>
25
25
  </object>
26
26
  </child>
27
27
  <child>
28
28
  <object class="GtkButton">
29
29
  <property name="visible">1</property>
30
30
  <property name="label">Clocks - All</property>
31
- <signal name="clicked" handler="clocks_shortcuts" swapped="1" object="window1"/>
31
+ <signal name="clicked" handler="clocks_shortcuts" swapped="1"/>
32
32
  </object>
33
33
  </child>
34
34
  <child>
35
35
  <object class="GtkButton">
36
36
  <property name="visible">1</property>
37
37
  <property name="label">Clocks - Stopwatch</property>
38
- <signal name="clicked" handler="clocks_shortcuts_stopwatch" swapped="1" object="window1"/>
38
+ <signal name="clicked" handler="clocks_shortcuts_stopwatch" swapped="1"/>
39
39
  </object>
40
40
  </child>
41
41
  <child>
42
42
  <object class="GtkButton">
43
43
  <property name="visible">1</property>
44
44
  <property name="label">Boxes</property>
45
- <signal name="clicked" handler="boxes_shortcuts" swapped="1" object="window1"/>
45
+ <signal name="clicked" handler="boxes_shortcuts" swapped="1"/>
46
46
  </object>
47
47
  </child>
48
48
  <child>
49
49
  <object class="GtkButton">
50
50
  <property name="visible">1</property>
51
51
  <property name="label">Boxes - Wizard</property>
52
- <signal name="clicked" handler="boxes_shortcuts_wizard" swapped="1" object="window1"/>
52
+ <signal name="clicked" handler="boxes_shortcuts_wizard" swapped="1"/>
53
53
  </object>
54
54
  </child>
55
55
  <child>
56
56
  <object class="GtkButton">
57
57
  <property name="visible">1</property>
58
58
  <property name="label">Boxes - Display</property>
59
- <signal name="clicked" handler="boxes_shortcuts_display" swapped="1" object="window1"/>
59
+ <signal name="clicked" handler="boxes_shortcuts_display" swapped="1"/>
60
60
  </object>
61
61
  </child>
62
62
  </object>
@@ -0,0 +1,455 @@
1
+ # Copyright (c) 2017 Ruby-GNOME2 Project Team
2
+ # This program is licenced under the same licence as Ruby-GNOME2.
3
+ #
4
+ =begin
5
+ = Tool Palette
6
+
7
+ A tool palette widget shows groups of toolbar items as a grid of icons
8
+ or a list of names.
9
+ =end
10
+ class ToolpaletteDemo
11
+ def initialize(main_window)
12
+ @window = Gtk::Window.new(:toplevel)
13
+ @window.screen = main_window.screen
14
+ @window.title = "Tool Palette"
15
+ @window.set_default_size(200, 600)
16
+ @canvas_items = []
17
+
18
+ # Add widgets to control the ToolPalette appearance
19
+ @box = Gtk::Box.new(:vertical, 6)
20
+ @box.margin = 6
21
+ @window.add(@box)
22
+
23
+ create_orientation_combobox
24
+ create_style_combobox
25
+
26
+ # Add hbox.
27
+ @hbox = Gtk::Box.new(:horizontal, 5)
28
+ @box.pack_start(@hbox, :expand => true, :fill => true, :padding => 0)
29
+
30
+ create_and_fill_the_toolpalette
31
+ add_comboboxes_signals
32
+
33
+ # Notebook
34
+ create_and_fill_the_notebook
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 create_style_combobox
49
+ style_model = Gtk::ListStore.new(String, Integer)
50
+ iter = style_model.append
51
+ iter[0] = "Text"
52
+ iter[1] = Gtk::ToolbarStyle::TEXT.to_i
53
+ iter = style_model.append
54
+ iter[0] = "Both"
55
+ iter[1] = Gtk::ToolbarStyle::BOTH.to_i
56
+ iter = style_model.append
57
+ iter[0] = "Both: Horizontal"
58
+ iter[1] = Gtk::ToolbarStyle::BOTH_HORIZ.to_i
59
+ iter = style_model.append
60
+ iter[0] = "Icons"
61
+ iter[1] = Gtk::ToolbarStyle::ICONS.to_i
62
+ iter = style_model.append
63
+ iter[0] = "Default"
64
+ iter[1] = -1 # A custom meaning for this demo.
65
+ @combo_style = Gtk::ComboBox.new(:model => style_model)
66
+ cell_renderer = Gtk::CellRendererText.new
67
+ @combo_style.pack_start(cell_renderer, true)
68
+ @combo_style.set_attributes(cell_renderer, "text" => 0)
69
+ @combo_style.active_iter = iter
70
+ @box.pack_start(@combo_style, :expand => false,
71
+ :fill => false,
72
+ :padding => 0)
73
+ end
74
+
75
+ def create_orientation_combobox
76
+ orientation_model = Gtk::ListStore.new(String, Integer)
77
+ iter = orientation_model.append
78
+ iter[0] = "Horizontal"
79
+ iter[1] = Gtk::Orientation::HORIZONTAL
80
+ iter = orientation_model.append
81
+ iter[0] = "Vertical"
82
+ iter[1] = Gtk::Orientation::VERTICAL
83
+
84
+ @combo_orientation = Gtk::ComboBox.new(:model => orientation_model)
85
+ cell_renderer = Gtk::CellRendererText.new
86
+ @combo_orientation.pack_start(cell_renderer, true)
87
+ @combo_orientation.set_attributes(cell_renderer, "text" => 0)
88
+ @combo_orientation.active_iter = iter
89
+ @box.pack_start(@combo_orientation, :expand => false,
90
+ :fill => false,
91
+ :padding => 0)
92
+ end
93
+
94
+ def create_and_fill_the_toolpalette
95
+ @palette = Gtk::ToolPalette.new
96
+ load_icon_items
97
+ load_toggle_items
98
+ load_special_items
99
+
100
+ palette_scroller = Gtk::ScrolledWindow.new
101
+ palette_scroller.set_policy(:never, :automatic)
102
+ palette_scroller.margin = 6
103
+ palette_scroller.hexpand = true
104
+ palette_scroller.add(@palette)
105
+ @hbox.add(palette_scroller)
106
+ @box.show_all
107
+ add_dnd_for_tool_items_to_palette
108
+ end
109
+
110
+ def add_dnd_for_tool_items_to_palette
111
+ @palette.signal_connect "drag-data-received" do |widget, context, x, y|
112
+ drag_item = @drag_palette.drag_item
113
+ drop_group = widget.get_drop_group(x, y)
114
+
115
+ if drag_item.class == Gtk::ToolItemGroup
116
+ palette_drop_group(drag_palette, drag_item, drop_group)
117
+ elsif drag_item.class == Gtk::ToolButton && drop_group
118
+ allocation = drop_group.allocation
119
+ palette_drop_item(drag_item, drop_group, x - allocation.x, y - allocation.y)
120
+ end
121
+ end
122
+
123
+ @palette.add_drag_dest(@palette,
124
+ Gtk::DestDefaults::ALL,
125
+ [Gtk::ToolPaletteDragTargets::ITEMS,
126
+ Gtk::ToolPaletteDragTargets::GROUPS],
127
+ Gdk::DragAction::COPY)
128
+ end
129
+
130
+ def add_comboboxes_signals
131
+ @combo_orientation.signal_connect "changed" do |widget|
132
+ on_combo_orientation_changed(widget)
133
+ end
134
+
135
+ @combo_style.signal_connect "changed" do |widget|
136
+ on_combo_style_changed(widget)
137
+ end
138
+
139
+ # Kepp the widgets in sync
140
+ on_combo_orientation_changed(@combo_orientation)
141
+ end
142
+
143
+ def create_passive_contents
144
+ @passive_contents = Gtk::DrawingArea.new
145
+ @passive_contents.signal_connect "draw" do |widget, cr|
146
+ canvas_draw(widget, cr)
147
+ end
148
+ @passive_contents.signal_connect "drag-data-received" do |widget, _context, x, y, selection, _info, _time|
149
+ tool_item = @palette.get_drag_item(selection)
150
+
151
+ # append a new canvas item when a tool button was found
152
+ if tool_item.class == Gtk::ToolButton
153
+ canvas_item = CanvasItem.new(widget, tool_item, x, y)
154
+ @canvas_items << canvas_item
155
+ widget.queue_draw
156
+ end
157
+ end
158
+ end
159
+
160
+ def create_interactive_contents
161
+ @interactive_contents = Gtk::DrawingArea.new
162
+ @interactive_contents.signal_connect "draw" do |widget, cr|
163
+ canvas_draw(widget, cr)
164
+ end
165
+
166
+ @interactive_contents.signal_connect "drag-motion" do |widget, context, x, y, time|
167
+ if @drop_item
168
+ # already have a drop indicator - just update position
169
+ @drop_item.x = x
170
+ @drop_item.y = y
171
+ widget.queue_draw
172
+ Gdk.drag_status(context, Gdk::DragAction::COPY, time)
173
+ else
174
+ # request DnD data for creating a drop indicator
175
+ target = widget.drag_dest_find_target(context, nil)
176
+ return false unless target
177
+ @drag_data_requested_for_drop = false
178
+ widget.drag_get_data(context, target, time)
179
+ end
180
+ true
181
+ end
182
+
183
+ @interactive_contents.signal_connect "drag-data-received" do |widget, context, x, y, selection, _info, time|
184
+ # find the tool button which is the source of this DnD operation
185
+ tool_item = @palette.get_drag_item(selection)
186
+
187
+ if tool_item.class == Gtk::ToolButton
188
+ item = CanvasItem.new(widget, tool_item, x, y)
189
+
190
+ # Either create a new item or just create a preview item, depending on
191
+ # why the drag data was requested.
192
+ if @drag_data_requested_for_drop
193
+ @canvas_items << item
194
+ context.finish(:success => true, :delete => false, :time => time)
195
+ @drop_item = nil
196
+ else
197
+ @drop_item = item
198
+ Gdk.drag_status(context, Gdk::DragAction::COPY, time)
199
+ end
200
+ widget.queue_draw
201
+ end
202
+ end
203
+
204
+ @interactive_contents.signal_connect "drag-leave" do |widget|
205
+ @drop_item = nil if @drop_item
206
+ widget.queue_draw
207
+ end
208
+
209
+ @interactive_contents.signal_connect "drag-drop" do |widget, context, _x, _y, time|
210
+ target = widget.drag_dest_find_target(context, nil)
211
+ if target
212
+ @drag_data_requested_for_drop = true
213
+ widget.drag_get_data(context, target, time)
214
+ end
215
+ false
216
+ end
217
+ end
218
+
219
+ def create_and_fill_the_notebook
220
+ notebook = Gtk::Notebook.new
221
+ notebook.margin = 6
222
+ @hbox.pack_end(notebook, :expand => false, :fill => false, :padding => false)
223
+
224
+ # Passive DnD dest
225
+ create_passive_contents
226
+ @palette.add_drag_dest(@passive_contents, Gtk::DestDefaults::ALL,
227
+ [Gtk::ToolPaletteDragTargets::ITEMS],
228
+ Gdk::DragAction::COPY)
229
+ contents_scroller = Gtk::ScrolledWindow.new
230
+ contents_scroller.set_policy(:automatic, :always)
231
+ contents_scroller.add(@passive_contents)
232
+ notebook.append_page(contents_scroller, Gtk::Label.new("Passive DnD Mode"))
233
+ contents_scroller.margin = 6
234
+
235
+ # Interactive DnD dest
236
+ create_interactive_contents
237
+ @palette.add_drag_dest(@interactive_contents, Gtk::DestDefaults::HIGHLIGHT,
238
+ [Gtk::ToolPaletteDragTargets::ITEMS],
239
+ Gdk::DragAction::COPY)
240
+ contents_scroller = Gtk::ScrolledWindow.new
241
+ contents_scroller.set_policy(:automatic, :always)
242
+ contents_scroller.add(@interactive_contents)
243
+ notebook.append_page(contents_scroller, Gtk::Label.new("Interactive DnD Mode"))
244
+ end
245
+
246
+ def canvas_draw(widget, cr)
247
+ cr.set_source_rgb(1, 1, 1)
248
+ cr.paint
249
+
250
+ @canvas_items.each do |canvas_item|
251
+ canvas_item.draw(cr, false)
252
+ end
253
+
254
+ @drop_item.draw(cr, true) if @drop_item
255
+ end
256
+
257
+ def palette_drop_group(drag_palette, drag_group, drop_group)
258
+ drop_position = -1
259
+
260
+ drop_position = drag_palette.get_group_position(drop_group) if drop_group
261
+ drag_palette.set_group_position(drag_group, drop_position)
262
+ end
263
+
264
+ def palette_drop_item(drag_item, drop_group, x, y)
265
+ drag_group = drag_item.parent
266
+ drop_item = drop_group.get_drop_item(x, y)
267
+ drop_position = -1
268
+
269
+ drop_position = drop_gropu.get_item_position(drop_item) if drop_item
270
+
271
+ if drag_group != drop_group
272
+ homogeneous = drag_group.child_get_property(drag_item, "homogeneous")
273
+ expand = drag_group.child_get_property(drag_item, "expand")
274
+ fill = drag_group.child_get_property(drag_item, "fill")
275
+ new_row = drag_group.child_get_property(drag_item, "new-row")
276
+ drop_group.insert(drag_item, drop_position)
277
+ drop_group.child_set(drag_item, "homogeneous" => homogeneous,
278
+ "expand" => expand,
279
+ "fill" => fill,
280
+ "new-row" => new_row)
281
+ else
282
+ drop_group.set_item_position(drag_item, drop_position)
283
+ end
284
+ end
285
+
286
+ def on_combo_orientation_changed(combo_box)
287
+ sw = @palette.parent
288
+ iter = combo_box.active_iter
289
+ return unless iter
290
+
291
+ @palette.orientation = iter[1]
292
+
293
+ if @palette.orientation == Gtk::Orientation::HORIZONTAL
294
+ sw.set_policy(:automatic, :never)
295
+ else
296
+ sw.set_policy(:never, :automatic)
297
+ end
298
+ end
299
+
300
+ def on_combo_style_changed(combo_box)
301
+ iter = combo_box.active_iter
302
+ return unless iter
303
+
304
+ if iter[1] == -1
305
+ @palette.unset_style
306
+ else
307
+ @palette.style = iter[1]
308
+ end
309
+ end
310
+
311
+ def load_icon_items
312
+ max_icons = 10
313
+ icons_count = 0
314
+ icon_theme = Gtk::IconTheme.get_for_screen(@palette.screen)
315
+ contexts = icon_theme.contexts
316
+ contexts.each do |context|
317
+ group = Gtk::ToolItemGroup.new(context)
318
+ @palette.add(group)
319
+
320
+ next if context == "Animations"
321
+ puts "Got context '#{context}"
322
+
323
+ icon_names = icon_theme.icons(context)
324
+ icon_names.sort
325
+
326
+ icon_names.each do |icon_name|
327
+ next if icon_name == "emblem-desktop"
328
+ next if icon_name =~ /^.*-symbolic$/
329
+ puts "Got icon name '#{icon_name}'"
330
+
331
+ item = Gtk::ToolButton.new
332
+ item.icon_name = icon_name
333
+ item.tooltip_text = icon_name
334
+ group.insert(item, -1)
335
+
336
+ # Prevent us having an insane number of icons
337
+ icons_count += 1
338
+ break if icons_count >= max_icons
339
+ end
340
+ end
341
+ end
342
+
343
+ def load_toggle_items
344
+ group = Gtk::ToolItemGroup.new("Radio Item")
345
+ @palette.add(group)
346
+
347
+ toggle_group = nil
348
+
349
+ (1..10).each do |i|
350
+ label = "##{i}"
351
+ item = Gtk::RadioToolButton.new(toggle_group)
352
+ item.label = label
353
+ group .insert(item, -1)
354
+ toggle_group = item.group
355
+ end
356
+ end
357
+
358
+ def create_entry_item(text)
359
+ entry = Gtk::Entry.new
360
+ entry.text = text
361
+ entry.width_chars = 5
362
+
363
+ item = Gtk::ToolItem.new
364
+ item.add(entry)
365
+ item
366
+ end
367
+
368
+ def load_special_items
369
+ group = Gtk::ToolItemGroup.new("Advanced Features group")
370
+ label_button = Gtk::Button.new(:label => "Advanced Features")
371
+ label_button.show
372
+ group.label_widget = label_button
373
+ @palette.add(group)
374
+
375
+ item = create_entry_item("homogeneous=FALSE")
376
+ group.insert(item, -1)
377
+ group.child_set_property(item, "homogeneous", false)
378
+
379
+ item = create_entry_item("homogeneous=FALSE, expand=TRUE")
380
+ group.insert(item, -1)
381
+ group.child_set_property(item, "homogeneous", false)
382
+ group.child_set_property(item, "expand", true)
383
+
384
+ item = create_entry_item("homogeneous=FALSE, expand=TRUE, fill=FALSE")
385
+ group.insert(item, -1)
386
+ group.child_set_property(item, "homogeneous", false)
387
+ group.child_set_property(item, "expand", true)
388
+ group.child_set_property(item, "fill", false)
389
+
390
+ item = create_entry_item("homogeneous=FALSE, expand=TRUE, new-row=TRUE")
391
+ group.insert(item, -1)
392
+ group.child_set_property(item, "homogeneous", false)
393
+ group.child_set_property(item, "expand", true)
394
+ group.child_set_property(item, "new-row", true)
395
+
396
+ item = Gtk::ToolButton.new
397
+ item.icon_name = "go-up"
398
+ item.tooltip_text = "Show on vertical palettes only"
399
+ group.insert(item, -1)
400
+ item.visible_horizontal = false
401
+
402
+ item = Gtk::ToolButton.new
403
+ item.icon_name = "go-next"
404
+ item.tooltip_text = "Show on horizontal palettes only"
405
+ group.insert(item, -1)
406
+ item.visible_vertical = false
407
+
408
+ item = Gtk::ToolButton.new
409
+ item.icon_name = "edit-delete"
410
+ item.tooltip_text = "Do not show at all"
411
+ group.insert(item, -1)
412
+ item.no_show_all = true
413
+
414
+ item = Gtk::ToolButton.new
415
+ item.icon_name = "view-fullscreen"
416
+ item.tooltip_text = "Expanded this item"
417
+ group.insert(item, -1)
418
+ group.child_set_property(item, "homogeneous", false)
419
+ group.child_set_property(item, "expand", true)
420
+
421
+ item = Gtk::ToolButton.new
422
+ item.icon_name = "help-browser"
423
+ item.tooltip_text = "A regular item"
424
+ group.insert(item, -1)
425
+ end
426
+ end
427
+
428
+ class CanvasItem
429
+ attr_reader :pixbuf
430
+ attr_accessor :x, :y
431
+
432
+ def initialize(widget, button, x, y)
433
+ icon_name = button.icon_name
434
+ icon_theme = Gtk::IconTheme.get_for_screen(widget.screen)
435
+ width, _height = Gtk::IconSize.lookup(:dialog)
436
+ @pixbuf = icon_theme.load_icon(icon_name,
437
+ width,
438
+ Gtk::IconLookupFlags::GENERIC_FALLBACK)
439
+ return nil unless @pixbuf
440
+ @x = x
441
+ @y = y
442
+ end
443
+
444
+ def draw(cr, preview)
445
+ cx = @pixbuf.width
446
+ cy = @pixbuf.height
447
+ cr.set_source_pixbuf(@pixbuf, @x - cx * 0.5, @y - cy * 0.5)
448
+
449
+ if preview
450
+ cr.paint(0.6)
451
+ else
452
+ cr.paint
453
+ end
454
+ end
455
+ end
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2015 Ruby-GNOME2 Project Team
1
+ # Copyright (C) 2015-2017 Ruby-GNOME2 Project Team
2
2
  #
3
3
  # This library is free software; you can redistribute it and/or
4
4
  # modify it under the terms of the GNU Lesser General Public
@@ -38,4 +38,32 @@ class TestGtkToggleAction < Test::Unit::TestCase
38
38
  assert_equal("gtk-add", action.stock_id)
39
39
  end
40
40
  end
41
+
42
+ sub_test_case("instance methods") do
43
+ def setup
44
+ @action = Gtk::ToggleAction.new("add")
45
+ end
46
+
47
+ sub_test_case("#active=") do
48
+ def test_nil
49
+ assert_raise(ArgumentError) do
50
+ @action.active = nil
51
+ end
52
+ end
53
+
54
+ def test_true
55
+ @action.active = true
56
+ assert do
57
+ @action.active?
58
+ end
59
+ end
60
+
61
+ def test_false
62
+ @action.active = false
63
+ assert do
64
+ not @action.active?
65
+ end
66
+ end
67
+ end
68
+ end
41
69
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gtk3
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.1
4
+ version: 3.2.2
5
5
  platform: x86-mingw32
6
6
  authors:
7
7
  - The Ruby-GNOME2 Project Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-19 00:00:00.000000000 Z
11
+ date: 2018-04-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: glib2
@@ -16,112 +16,112 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 3.2.1
19
+ version: 3.2.2
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 3.2.1
26
+ version: 3.2.2
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: gio2
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 3.2.1
33
+ version: 3.2.2
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 3.2.1
40
+ version: 3.2.2
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: atk
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - '='
46
46
  - !ruby/object:Gem::Version
47
- version: 3.2.1
47
+ version: 3.2.2
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - '='
53
53
  - !ruby/object:Gem::Version
54
- version: 3.2.1
54
+ version: 3.2.2
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: pango
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - '='
60
60
  - !ruby/object:Gem::Version
61
- version: 3.2.1
61
+ version: 3.2.2
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - '='
67
67
  - !ruby/object:Gem::Version
68
- version: 3.2.1
68
+ version: 3.2.2
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: gdk_pixbuf2
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - '='
74
74
  - !ruby/object:Gem::Version
75
- version: 3.2.1
75
+ version: 3.2.2
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - '='
81
81
  - !ruby/object:Gem::Version
82
- version: 3.2.1
82
+ version: 3.2.2
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: gdk3
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - '='
88
88
  - !ruby/object:Gem::Version
89
- version: 3.2.1
89
+ version: 3.2.2
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - '='
95
95
  - !ruby/object:Gem::Version
96
- version: 3.2.1
96
+ version: 3.2.2
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: gobject-introspection
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - '='
102
102
  - !ruby/object:Gem::Version
103
- version: 3.2.1
103
+ version: 3.2.2
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - '='
109
109
  - !ruby/object:Gem::Version
110
- version: 3.2.1
110
+ version: 3.2.2
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: rsvg2
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - '='
116
116
  - !ruby/object:Gem::Version
117
- version: 3.2.1
117
+ version: 3.2.2
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - '='
123
123
  - !ruby/object:Gem::Version
124
- version: 3.2.1
124
+ version: 3.2.2
125
125
  description: Ruby/GTK3 is a Ruby binding of GTK+-3.x.
126
126
  email: ruby-gnome2-devel-en@lists.sourceforge.net
127
127
  executables: []
@@ -145,6 +145,7 @@ files:
145
145
  - lib/2.2/gtk3.so
146
146
  - lib/2.3/gtk3.so
147
147
  - lib/2.4/gtk3.so
148
+ - lib/2.5/gtk3.so
148
149
  - lib/gtk3.rb
149
150
  - lib/gtk3/about-dialog.rb
150
151
  - lib/gtk3/action-group.rb
@@ -401,6 +402,7 @@ files:
401
402
  - sample/gtk-demo/shortcuts-builder.ui
402
403
  - sample/gtk-demo/shortcuts-clocks.ui
403
404
  - sample/gtk-demo/shortcuts-gedit.ui
405
+ - sample/gtk-demo/shortcuts.rb
404
406
  - sample/gtk-demo/shortcuts.ui
405
407
  - sample/gtk-demo/sidebar.rb
406
408
  - sample/gtk-demo/sizegroup.rb
@@ -417,6 +419,7 @@ files:
417
419
  - sample/gtk-demo/textview.rb
418
420
  - sample/gtk-demo/theming.ui
419
421
  - sample/gtk-demo/theming_style_classes.rb
422
+ - sample/gtk-demo/toolpalette.rb
420
423
  - sample/gtk-demo/transparent.rb
421
424
  - sample/gtk-demo/tree_store.rb
422
425
  - sample/gtk-demo/vertical_text_cursor.png
@@ -678,10 +681,10 @@ required_ruby_version: !ruby/object:Gem::Requirement
678
681
  requirements:
679
682
  - - ">="
680
683
  - !ruby/object:Gem::Version
681
- version: '2.1'
684
+ version: '2.2'
682
685
  - - "<"
683
686
  - !ruby/object:Gem::Version
684
- version: '2.5'
687
+ version: '2.6'
685
688
  required_rubygems_version: !ruby/object:Gem::Requirement
686
689
  requirements:
687
690
  - - ">="
@@ -689,7 +692,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
689
692
  version: '0'
690
693
  requirements: []
691
694
  rubyforge_project:
692
- rubygems_version: 2.5.1
695
+ rubygems_version: 2.7.6
693
696
  signing_key:
694
697
  specification_version: 4
695
698
  summary: Ruby/GTK3 is a Ruby binding of GTK+-3.x.