gtk4 3.5.1 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/gtk4.gemspec +1 -5
  3. data/lib/gtk4/{menu-item.rb → application.rb} +11 -10
  4. data/lib/gtk4/box.rb +1 -1
  5. data/lib/gtk4/builder.rb +14 -61
  6. data/lib/gtk4/button.rb +1 -2
  7. data/lib/gtk4/combo-box.rb +1 -6
  8. data/lib/gtk4/deprecated.rb +234 -246
  9. data/lib/gtk4/dialog.rb +10 -21
  10. data/lib/gtk4/{action.rb → entry.rb} +11 -8
  11. data/lib/gtk4/{gdk-drag-context.rb → gdk-display.rb} +12 -10
  12. data/lib/gtk4/icon-theme.rb +9 -12
  13. data/lib/gtk4/image.rb +12 -56
  14. data/lib/gtk4/list-store.rb +8 -0
  15. data/lib/gtk4/loader.rb +153 -27
  16. data/lib/gtk4/message-dialog.rb +1 -1
  17. data/lib/gtk4/paned.rb +17 -11
  18. data/lib/gtk4/{clipboard.rb → response-type.rb} +11 -6
  19. data/lib/gtk4/ruby-builder-scope.rb +47 -0
  20. data/lib/gtk4/scale-button.rb +6 -13
  21. data/lib/gtk4/stack.rb +23 -27
  22. data/lib/gtk4/style-context.rb +20 -4
  23. data/lib/gtk4/text-buffer.rb +14 -10
  24. data/lib/gtk4/{style-properties.rb → tree-model-sort.rb} +7 -9
  25. data/lib/gtk4/tree-model.rb +21 -1
  26. data/lib/gtk4/{target-list.rb → tree-sortable.rb} +8 -11
  27. data/lib/gtk4/tree-view-column.rb +9 -1
  28. data/lib/gtk4/version.rb +2 -2
  29. data/lib/gtk4/widget.rb +44 -71
  30. data/lib/gtk4.rb +4 -35
  31. data/sample/demos/README.md +4 -0
  32. data/sample/examples/README.md +4 -0
  33. data/sample/{action-namespace.rb → examples/action-namespace.rb} +0 -0
  34. data/sample/{builder.rb → examples/builder.rb} +0 -0
  35. data/sample/{builder.ui → examples/builder.ui} +0 -0
  36. data/sample/{drawing.rb → examples/drawing.rb} +0 -0
  37. data/sample/{grid_packing.rb → examples/grid_packing.rb} +0 -0
  38. data/sample/{hello_world.rb → examples/hello_world.rb} +0 -0
  39. data/sample/{utils.rb → examples/utils.rb} +0 -0
  40. data/sample/getting-started/README.md +4 -0
  41. metadata +26 -92
  42. data/lib/gtk4/action-group.rb +0 -131
  43. data/lib/gtk4/calendar.rb +0 -30
  44. data/lib/gtk4/check-menu-item.rb +0 -34
  45. data/lib/gtk4/container.rb +0 -62
  46. data/lib/gtk4/icon-size.rb +0 -32
  47. data/lib/gtk4/image-menu-item.rb +0 -37
  48. data/lib/gtk4/radio-action.rb +0 -28
  49. data/lib/gtk4/radio-button.rb +0 -49
  50. data/lib/gtk4/recent-chooser-dialog.rb +0 -38
  51. data/lib/gtk4/selection-data.rb +0 -42
  52. data/lib/gtk4/stock-item.rb +0 -36
  53. data/lib/gtk4/stock.rb +0 -70
  54. data/lib/gtk4/table.rb +0 -43
  55. data/lib/gtk4/target-entry.rb +0 -27
  56. data/lib/gtk4/toggle-action.rb +0 -27
  57. data/lib/gtk4/tool-button.rb +0 -36
  58. data/lib/gtk4/ui-manager.rb +0 -35
  59. data/lib/gtk4/window.rb +0 -42
  60. data/test/fixture/gnome-logo-icon.png +0 -0
  61. data/test/gtk-test-utils.rb +0 -36
  62. data/test/run-test.rb +0 -42
  63. data/test/test-gtk-box.rb +0 -36
  64. data/test/test-gtk-button.rb +0 -46
  65. data/test/test-gtk-dialog.rb +0 -74
  66. data/test/test-gtk-menu-item.rb +0 -42
  67. data/test/test-gtk-message-dialog.rb +0 -62
  68. data/test/test-gtk-version.rb +0 -47
  69. data/test/test-gtk-window.rb +0 -34
@@ -1,21 +1,45 @@
1
+ # Copyright (C) 2011-2022 Ruby-GNOME Project Team
2
+ #
3
+ # This library is free software; you can redistribute it and/or
4
+ # modify it under the terms of the GNU Lesser General Public
5
+ # License as published by the Free Software Foundation; either
6
+ # version 2.1 of the License, or (at your option) any later version.
7
+ #
8
+ # This library is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
+ # Lesser General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
+
1
17
  module Gtk
2
18
  extend GLib::Deprecatable
19
+ define_deprecated_const :AccelGroup, raise: "Don't use this class."
20
+ define_deprecated_const :Action, raise: "Use 'Gio::SimpleAction' instead."
21
+ define_deprecated_const :ActionGroup, raise: "Use 'Gio::SimpleActionGroup' instead."
3
22
  define_deprecated_const :Allocation, "Gdk::Rectangle"
4
-
23
+ define_deprecated_const :Arrow, raise: "Don't use this class."
24
+ define_deprecated_const :ButtonBox, raise: "Don't use this class."
25
+ define_deprecated_const :Clipboard, raise: "Use 'Gdk::Clipboard' instead."
5
26
  define_deprecated_const :Combo, :raise => "Use 'Gtk::ComboBoxText' instead."
6
27
  define_deprecated_const :ComboBoxEntry, :raise => "Use 'Gtk::ComboBox' instead."
7
28
  define_deprecated_const :Curve, :raise => "Don't use this widget anymore."
8
29
  define_deprecated_const :FileSelection, :raise => "Use 'Gtk::FileChooserDialog' instead."
9
30
  define_deprecated_const :FontSelection, :raise => "Use 'Gtk::FontChooserWidget' instead."
10
31
  define_deprecated_const :FontSelectionDialog, :raise => "Use 'Gtk::FontChooserDialog' instead."
11
- remove_const(:ColorSelection)
12
32
  define_deprecated_const :ColorSelection, :raise => "Use 'Gtk::ColorChooserWidget' instead."
13
- remove_const(:ColorSelectionDialog)
14
33
  define_deprecated_const :ColorSelectionDialog, :raise => "Use 'Gtk::ColorChooserDialog' instead."
15
34
  define_deprecated_const :GammaCurve, :raise => "Don't use this widget anymore."
16
35
  define_deprecated_const :HRuler, :raise => "Don't use this widget anymore."
17
36
  define_deprecated_const :InputDialog, :raise => "Don't use this widget anymore."
18
37
  define_deprecated_const :ItemFactory, :raise => "Use 'Gtk::UIManager' instead."
38
+ define_deprecated_const :Menu, raise: "Use 'Gtk::PopoverMenu' instead."
39
+ define_deprecated_const :MenuBar, raise: "Use 'Gtk::PopoverMenuBar' instead."
40
+ define_deprecated_const :MenuItem, raise: "Don't use this class."
41
+ define_deprecated_const :MenuShell, raise: "Don't use this class."
42
+ define_deprecated_const :MenuToolButton, raise: "Don't use this class."
19
43
  define_deprecated_const :OptionMenu, :raise => "Use 'Gtk::ComboBox' instead."
20
44
  define_deprecated_const :PageSetupUnixDialog, :raise => "Use 'Gtk::PrintOperation' instead."
21
45
  define_deprecated_const :Printer, :raise => "Use 'Gtk::PrintOperation' instead."
@@ -23,32 +47,48 @@ module Gtk
23
47
  define_deprecated_const :PrintJob, :raise => "Use 'Gtk::PrintOperation' instead."
24
48
  define_deprecated_const :PrintUnixDialog, :raise => "Use 'Gtk::PrintOperation' instead."
25
49
  define_deprecated_const :RC, :raise => "Use 'Gtk::StyleContext' instead."
50
+ define_deprecated_const :RadioAction, raise: "Don't use this class."
51
+ define_deprecated_const :RadioButton, raise: "Don't use this class."
26
52
  define_deprecated_const :RcStyle, :raise => "Use 'Gtk::CssProvider' instead."
53
+ define_deprecated_const :RecentChooser, raise: "Don't use this class."
54
+ define_deprecated_const :RecentChooserDialog, raise: "Don't use this class."
55
+ define_deprecated_const :RecentFilter, raise: "Don't use this class."
56
+ define_deprecated_const :RecentFilterInfo, raise: "Don't use this class."
27
57
  define_deprecated_const :Ruler, :raise => "Don't use this widget anymore."
58
+ define_deprecated_const :SelectionData, raise: "Use 'Gtk::DragSource' instead."
59
+ define_deprecated_const :Stock, raise: "Use 'Gtk::Image.new(icon_name)' instead."
60
+ define_deprecated_const :StockItem, raise: "Use 'Gtk::Image.new(icon_name)' instead."
28
61
  define_deprecated_const :Style, :raise => "Use 'Gtk::StyleContext' instead."
62
+ define_deprecated_const :StyleProperties, raise: "Don't use this class."
63
+ define_deprecated_const :Table, raise: "Use 'Gtk::Grid' instead."
64
+ define_deprecated_const :TargetEntry, raise: "Use 'Gtk::DragSource' instead."
65
+ define_deprecated_const :TargetList, raise: "Use 'Gtk::DragSource' instead."
66
+ define_deprecated_const :ToggleAction, raise: "Don't use this class."
67
+ define_deprecated_const :ToolButton, raise: "Don't use this class."
29
68
  define_deprecated_const :Tooltips, :raise => "Use 'Gtk::Tooltip' API."
69
+ define_deprecated_const :UIManager, raise: "Use 'Gtk::Builder' instead."
30
70
  define_deprecated_const :VRuler, :raise => "Don't use this widget anymore."
31
- define_deprecated_flags :AccelFlags, 'ACCEL'
32
- define_deprecated_flags :AttachOptions
71
+ define_deprecated_const :AccelFlags, raise: "Don't use this class."
72
+ define_deprecated_const :AttachOptions, raise: "Don't use this class."
33
73
  define_deprecated_enums :CornerType, 'CORNER'
34
74
  define_deprecated_enums :DeleteType, 'DELETE'
35
75
  define_deprecated_enums :DirectionType, 'DIR'
36
- define_deprecated_enums :ExpanderStyle, 'EXPANDER'
76
+ define_deprecated_const :ExpanderStyle, raise: "Don't use this class."
37
77
  define_deprecated_enums :Justification, 'JUSTIFY'
38
78
  define_deprecated_enums :MovementStep, 'MOVEMENT'
39
79
  define_deprecated_enums :Orientation, 'ORIENTATION'
40
80
  define_deprecated_enums :PackType, 'PACK'
41
- define_deprecated_enums :PathPriorityType, 'PATH_PRIO'
42
- define_deprecated_enums :PathType, 'PATH'
81
+ define_deprecated_const :PathPriorityType, raise: "Don't use this class."
82
+ define_deprecated_const :PathType, raise: "Don't use this class."
43
83
  define_deprecated_enums :PolicyType, 'POLICY'
44
84
  define_deprecated_enums :PositionType, 'POS'
45
- define_deprecated_enums :ReliefStyle, 'RELIEF'
46
- define_deprecated_enums :ResizeMode, 'RESIZE'
85
+ define_deprecated_const :ReliefStyle, raise: "Don't use this class."
86
+ define_deprecated_const :ResizeMode, raise: "Don't use this class."
47
87
  define_deprecated_enums :ScrollStep, 'SCROLL'
48
88
  define_deprecated_enums :ScrollType, 'SCROLL'
49
89
  define_deprecated_enums :SelectionMode, 'SELECTION'
50
- define_deprecated_enums :ShadowType, 'SHADOW'
51
- define_deprecated_enums :StateType, 'STATE'
90
+ define_deprecated_const :ShadowType, raise: "Don't use this class."
91
+ define_deprecated_const :StateType, raise: "Don't use this class."
52
92
  define_deprecated_enums :SortType, 'SORT'
53
93
  define_deprecated_const :AnchorType
54
94
  define_deprecated_const :ANCHOR_CENTER
@@ -106,30 +146,11 @@ module Gtk
106
146
  define_deprecated_singleton_method :set_url_hook, :warn => "Use 'activate-link' signal."
107
147
  end
108
148
 
109
- class Action
110
- extend GLib::Deprecatable
111
- define_deprecated_method :connect_proxy, :warn => "Use 'Gtk::Activatable#set_related_action'."
112
- define_deprecated_method :disconnect_proxy, :warn => "Use 'Gtk::Activatable#set_related_action'."
113
- define_deprecated_method :block_activate_from, :warn => "Don't use this method."
114
- define_deprecated_method :unblock_activate_from, :warn => "Don't use this method."
115
- define_deprecated_method_by_hash_args :initialize,
116
- 'name, label, tooltip = nil, stock_id = nil',
117
- 'name, :label => nil, :tooltip => nil, :stock_id => nil', 1 do
118
- |_self, name, label, tooltip, stock_id|
119
- [name, {:label => label, :tooltip => tooltip, :stock_id => stock_id}]
120
- end
121
- end
122
-
123
149
  class Alignment
124
150
  extend GLib::Deprecatable
125
151
  define_deprecated_const :Align, "Gtk::Align"
126
152
  end
127
153
 
128
- class Arrow
129
- extend GLib::Deprecatable
130
- define_deprecated_enums :Type
131
- end
132
-
133
154
  class Assistant
134
155
  extend GLib::Deprecatable
135
156
  define_deprecated_const :PageType, "Gtk::AssistantPageType"
@@ -150,25 +171,61 @@ module Gtk
150
171
 
151
172
  class Box
152
173
  extend GLib::Deprecatable
153
- define_deprecated_method :pack_start_defaults, :pack_start
154
- define_deprecated_method :pack_end_defaults, :pack_end
155
- define_deprecated_method_by_hash_args :pack_start,
156
- 'child, expand = true, fill = true, padding = 0',
157
- 'child, :expand => true, :fill => true, :padding => 0', 1 do
158
- |_self, child, expand, fill, padding|
159
- [child, {:expand => expand, :fill => fill, :padding => padding}]
174
+ define_deprecated_method :add, :append
175
+ define_deprecated_method :pack_start_defaults, :prepend
176
+ define_deprecated_method :pack_end_defaults, :append
177
+ set_pack_properties = lambda do |_self, child, args|
178
+ if args.size == 1 and args[0].is_a?(Hash)
179
+ options = args[0]
180
+ expand = options[:expand]
181
+ fill = options[:fill]
182
+ padding = options[:padding]
183
+ pack_type = options[:pack_type]
184
+ else
185
+ expand, fill, padding, pack_type, = *args
186
+ end
187
+ unless expand.nil?
188
+ if _self.orientation == Orientation::HORIZONTAL
189
+ child.hexpand = expand
190
+ else
191
+ child.vexpand = expand
192
+ end
193
+ end
194
+ if fill
195
+ if _self.orientation == Orientation::HORIZONTAL
196
+ child.halign = :fill
197
+ else
198
+ child.valign = :fill
199
+ end
200
+ end
201
+ unless padding.nil?
202
+ child.margin_top = padding
203
+ child.margin_bottom = padding
204
+ child.margin_start = padding
205
+ child.margin_end = padding
206
+ end
207
+ if pack_type
208
+ if _self.orientation == Orientation::HORIZONTAL
209
+ child.halign = pack_type
210
+ else
211
+ child.valign = pack_type
212
+ end
213
+ end
160
214
  end
161
- define_deprecated_method_by_hash_args :pack_end,
162
- 'child, expand = true, fill = true, padding = 0',
163
- 'child, :expand => true, :fill => true, :padding => 0', 1 do
164
- |_self, child, expand, fill, padding|
165
- [child, {:expand => expand, :fill => fill, :padding => padding}]
215
+ define_deprecated_method :pack_start, :prepend do |_self, child, *args|
216
+ _self.prepend(child)
217
+ set_pack_properties.call(_self, child, args)
166
218
  end
167
- define_deprecated_method_by_hash_args :set_child_packing,
168
- 'child, expand, fill, padding, pack_type',
169
- 'child, :expand => nil, :fill => nil, :padding => nil, :pack_type => nil', 1 do
170
- |_self, child, expand, fill, padding, pack_type|
171
- [child, {:expand => expand, :fill => fill, :padding => padding, :pack_type => pack_type}]
219
+ define_deprecated_method :pack_end, :append do |_self, child, *args|
220
+ _self.append(child)
221
+ set_pack_properties.call(_self, child, args)
222
+ end
223
+ message = "Set child's " +
224
+ "Gtk::Widget::{hexpand,vexpand,halign,valign,margin-*} " +
225
+ "properties instead."
226
+ define_deprecated_method :set_child_packing,
227
+ warn: message do |_self, child, *args|
228
+ set_pack_properties.call(_self, child, args)
172
229
  end
173
230
  end
174
231
 
@@ -197,17 +254,20 @@ module Gtk
197
254
  end
198
255
  end
199
256
 
200
- class ButtonBox
201
- extend GLib::Deprecatable
202
- define_deprecated_const :Style, "Gtk::ButtonBoxStyle"
203
- define_deprecated_enums "Gtk::ButtonBoxStyle", "STYLE"
204
- end
205
-
206
257
  class Calendar
207
258
  extend GLib::Deprecatable
208
- define_deprecated_flags "Gtk::CalendarDisplayOptions"
259
+ define_deprecated_const :CalendarDisplayOptions, raise: "Don't use this class."
209
260
  define_deprecated_method :freeze, :warn => "Don't use this method."
210
261
  define_deprecated_method :thaw, :warn => "Don't use this method."
262
+ define_deprecated_method :select_month, :select_day do |_self, month, year|
263
+ date = _self.date
264
+ _self.select_day(GLib::DateTime.new(year: year,
265
+ month: month,
266
+ day: date.day_of_month,
267
+ hour: date.hour,
268
+ minute: date.minute,
269
+ second: date.second))
270
+ end
211
271
  end
212
272
 
213
273
  class CellRenderer
@@ -282,6 +342,8 @@ module Gtk
282
342
  |_self, title, parent, flags, *buttons|
283
343
  [{:title => title, :parent => parent, :flags => flags, :buttons => buttons}]
284
344
  end
345
+ message = "Use Gtk::Window#set_modal and 'response' signal instead."
346
+ define_deprecated_method :run, raise: message
285
347
  end
286
348
 
287
349
  module Drag
@@ -421,7 +483,7 @@ module Gtk
421
483
  define_deprecated_const :Action, "Gtk::FileChooserAction"
422
484
  define_deprecated_enums :FileChooserAction, 'ACTION'
423
485
  define_deprecated_const :Confirmation, "Gtk::FileChooserConfirmation"
424
- define_deprecated_enums :FileChooserConfirmation, 'CONFIRMATION'
486
+ define_deprecated_const :FileChooserConfirmation, raise: "Don't use this class."
425
487
  end
426
488
 
427
489
  class FileChooserDialog
@@ -442,8 +504,8 @@ module Gtk
442
504
 
443
505
  class FileFilter
444
506
  extend GLib::Deprecatable
445
- define_deprecated_const :Flags, "Gtk::FileFilterFlags"
446
- define_deprecated_flags :FileFilterFlags
507
+ define_deprecated_const :Flags, raise: "Don't use this class."
508
+ define_deprecated_const :FileFilterFlags, raise: "Don't use this class."
447
509
  end
448
510
 
449
511
  class HBox
@@ -490,6 +552,39 @@ module Gtk
490
552
  end
491
553
  end
492
554
 
555
+ class HeaderBar
556
+ extend GLib::Deprecatable
557
+
558
+ define_deprecated_method :title,
559
+ raise: "Use '#{self}#title_widget' instead."
560
+ define_deprecated_method :set_title,
561
+ raise: "Use '#{self}#set_title_widget' instead."
562
+ define_deprecated_method :title=,
563
+ raise: "Use '#{self}#title_widget=' instead."
564
+
565
+ define_deprecated_method :custom_title,
566
+ raise: "Use '#{self}#title_widget' instead."
567
+ define_deprecated_method :set_custom_title,
568
+ raise: "Use '#{self}#set_title_widget' instead."
569
+ define_deprecated_method :custom_title=,
570
+ raise: "Use '#{self}#title_widget=' instead."
571
+
572
+ define_deprecated_method :subtitle, raise: "Don't use this method."
573
+ define_deprecated_method :set_subtitle, raise: "Don't use this method."
574
+ define_deprecated_method :subtitle=, raise: "Don't use this method."
575
+
576
+ define_deprecated_method :show_close_button?, :show_title_buttons?
577
+ define_deprecated_method :set_show_close_button, :set_show_title_buttons
578
+ define_deprecated_method :show_close_button=, :show_title_buttons=
579
+
580
+ define_deprecated_method :spacing,
581
+ raise: "Use 'Gtk::Widget#margin_*' instead."
582
+ define_deprecated_method :set_spacing,
583
+ raise: "Use 'Gtk::Widget#set_margin_*' instead."
584
+ define_deprecated_method :spacing=,
585
+ raise: "Use 'Gtk::Widget#margin_*=' instead."
586
+ end
587
+
493
588
  class IconSet
494
589
  extend GLib::Deprecatable
495
590
  define_deprecated_method :render_icon, :raise => "Use '#{self}#render_icon_pixbuf'."
@@ -498,12 +593,16 @@ module Gtk
498
593
  class IconSize
499
594
  extend GLib::Deprecatable
500
595
  define_deprecated_const :IconSize, "Gtk::IconSize"
596
+ define_deprecated_singleton_method :lookup, raise: "Don't use this method."
501
597
  end
502
598
 
503
599
  class IconTheme
504
600
  extend GLib::Deprecatable
505
601
  define_deprecated_const :LookupFlags, "Gtk::IconLookupFlags"
506
602
  define_deprecated_flags :IconLookupFlags, 'LOOKUP'
603
+ define_deprecated_method :choose_icon, :lookup_icon
604
+ define_deprecated_method :contexts, raise: "Don't use this method."
605
+ define_deprecated_method :icons, :icon_names
507
606
  end
508
607
 
509
608
  class IconView
@@ -515,33 +614,34 @@ module Gtk
515
614
  extend GLib::Deprecatable
516
615
  define_deprecated_const :Type, "Gtk::ImageType"
517
616
  define_deprecated_enums :ImageType
518
- define_deprecated_method :set, :warn => "Use '#{self}#set_stock', '#{self}#set_icon_name', '#{self}#set_icon_set', '#{self}#set_file', '#{self}#set_pixbuf' or '#{self}#set_pixbuf_animation'."
617
+ message = "Use '#{self}#set_icon_name', " +
618
+ "'#{self}#set_file' or '#{self}#set_pixbuf'."
619
+ define_deprecated_method :set, warn: message
519
620
  define_deprecated_method_by_hash_args :initialize,
520
- 'image, size = nil',
521
- ':stock => nil, :icon_name => nil, :icon_set => nil, :icon => nil, :file => nil, :pixbuf => nil, :animation => nil, :surface => nil, :size => nil' do
522
- |_self, image, size|
621
+ 'image',
622
+ 'icon_name: nil, icon: nil, file: nil, pixbuf: nil' do
623
+ |_self, image|
523
624
  case image
524
625
  when String
525
- if size
526
- [{:icon_name => image, :size => size}]
626
+ if File.extname(image).empty?
627
+ [{icon_name: image}]
527
628
  else
528
- [{:file => image}]
629
+ [{file: image}]
529
630
  end
530
631
  when Symbol
531
- [{:stock => image, :size => size}]
632
+ [{icon_name: iamge}]
532
633
  when GdkPixbuf::Pixbuf
533
634
  [{:pixbuf => image}]
534
- when Gtk::IconSet
535
- [{:icon_set => image, :size => size}]
536
635
  when Gio::Icon
537
- [{:icon => image, :size => size}]
636
+ [{icon: image}]
538
637
  else
539
638
  message =
540
- "Image must be String, Symbol, GdkPixbuf::Pixbuf, Gtk::IconSet or " +
639
+ "Image must be String, Symbol, GdkPixbuf::Pixbuf or " +
541
640
  "Gio::Icon: #{image.inspect}"
542
641
  raise ArgumentError, message
543
642
  end
544
643
  end
644
+ define_deprecated_method :pixbuf, :paintable
545
645
  end
546
646
 
547
647
  class ImageMenuItem
@@ -563,48 +663,14 @@ module Gtk
563
663
  end
564
664
  end
565
665
 
566
- class LinkButton
567
- extend GLib::Deprecatable
568
- define_deprecated_singleton_method :set_uri_hook, :warn => "Use 'clicked' signal."
569
- end
570
-
571
- class MenuBar
572
- extend GLib::Deprecatable
573
- define_deprecated_enums :PackDirection, 'PACK_DIRECTION'
574
- end
575
-
576
- class MenuItem
577
- extend GLib::Deprecatable
578
-
579
- define_deprecated_method_by_hash_args :initialize,
580
- "label, use_underline=false",
581
- ":label => label, :use_underline => use_underline" do |_self, label, use_underline|
582
- [{:label => label, :use_underline => use_underline}]
583
- end
584
-
585
- define_deprecated_method :remove_submenu, :warn => "Use '#{self}#set_submenu'." do |_self|
586
- _self.set_submenu(nil)
587
- end
588
- end
589
-
590
- class MenuShell
666
+ class LevelBar
591
667
  extend GLib::Deprecatable
592
- define_deprecated_enums :DirectionType, 'DIR'
668
+ define_deprecated_const :Mode, "Gtk::LevelBarMode"
593
669
  end
594
670
 
595
- class MenuToolButton
671
+ class LinkButton
596
672
  extend GLib::Deprecatable
597
- define_deprecated_method_by_hash_args :initialize,
598
- 'icon_widget_or_stock_id = nil, label = nil',
599
- ':icon_widget => nil, :label => nil, :stock_id => nil' do
600
- |_self, icon_widget_or_stock_id, label|
601
- case icon_widget_or_stock_id
602
- when String, Symbol
603
- [{:stock_id => icon_widget_or_stock_id}]
604
- when Gtk::Widget
605
- [{:icon_widget => icon_widget_or_stock_id, :label => label}]
606
- end
607
- end
673
+ define_deprecated_singleton_method :set_uri_hook, :warn => "Use 'clicked' signal."
608
674
  end
609
675
 
610
676
  class MessageDialog
@@ -633,6 +699,20 @@ module Gtk
633
699
  end
634
700
  end
635
701
 
702
+ class Paned
703
+ extend GLib::Deprecatable
704
+ define_deprecated_method :pack1,
705
+ :set_start_child do |_self, child, options=nil|
706
+ options = {resize: false, shrink: true}.merge(options || {})
707
+ _self.set_start_child(child, options)
708
+ end
709
+ define_deprecated_method :pack2,
710
+ :set_end_child do |_self, child, options=nil|
711
+ options = {resize: true, shrink: true}.merge(options || {})
712
+ _self.set_end_child(child, options)
713
+ end
714
+ end
715
+
636
716
  class PaperSize
637
717
  extend GLib::Deprecatable
638
718
  define_deprecated_enums :Unit, 'UNIT'
@@ -678,37 +758,6 @@ module Gtk
678
758
  end
679
759
  end
680
760
 
681
- class RadioAction
682
- extend GLib::Deprecatable
683
- define_deprecated_method_by_hash_args :initialize,
684
- 'name, label, tooltip, stock_id, value',
685
- 'name, value, :label => nil, :tooltip => nil, :stock_id => nil', 2 do
686
- |_self, name, label, tooltip, stock_id, value|
687
- [name, value, {:label => label, :tooltip => tooltip, :stock_id => stock_id}]
688
- end
689
- end
690
-
691
- class RadioButton
692
- extend GLib::Deprecatable
693
- define_deprecated_method_by_hash_args :initialize,
694
- 'member_or_label, label_or_use_underline, use_underline',
695
- ':label => label, :member => member, :use_underline => use_underline',
696
- 0 do |_self, member_or_label, label_or_use_underline, use_underline|
697
- options = {}
698
- if member_or_label.is_a?(Gtk::RadioButton)
699
- options[:member] = member_or_label
700
- if label_or_use_underline.is_a?(String)
701
- options[:label] = label_or_use_underline
702
- options[:use_underline] = use_underline
703
- end
704
- else
705
- options[:label] = member_or_label
706
- options[:use_underline] = label_or_use_underline
707
- end
708
- [options]
709
- end
710
- end
711
-
712
761
  class Range
713
762
  extend GLib::Deprecatable
714
763
  define_deprecated_enums :SensitivityType, 'SENSITIVITY'
@@ -727,44 +776,6 @@ module Gtk
727
776
  end
728
777
  end
729
778
 
730
- module RecentChooser
731
- extend GLib::Deprecatable
732
- define_deprecated_enums :SortType, 'SORT'
733
- define_deprecated_method :show_numbers, :warn => "Use 'Gtk::RecentChooserMenu#show_numbers?'." do |_self|
734
- false
735
- end
736
- define_deprecated_method :set_show_numbers, :warn => "Use 'Gtk::RecentChooserMenu#set_show_numbers'."
737
- alias :show_numbers= :set_show_numbers
738
- end
739
-
740
- class RecentChooserDialog
741
- extend GLib::Deprecatable
742
- define_deprecated_method_by_hash_args :initialize,
743
- 'title, parent, manager, *buttons',
744
- ':title => nil, :parent => nil, ' +
745
- ':recent_manager => nil, :buttons => nil' do |_self, title, parent, *buttons|
746
- if buttons.first.is_a?(RecentManager)
747
- recent_manager = buttons.shift
748
- else
749
- recent_manager = nil
750
- end
751
- [
752
- {
753
- :title => title,
754
- :parent => parent,
755
- :recent_manager => recent_manager,
756
- :buttons => buttons,
757
- },
758
- ]
759
- end
760
- end
761
-
762
- class RecentFilter
763
- extend GLib::Deprecatable
764
- define_deprecated_const :Flags, "Gtk::RecentFilterFlags"
765
- define_deprecated_flags :RecentFilterFlags
766
- end
767
-
768
779
  class RecentManager
769
780
  extend GLib::Deprecatable
770
781
  define_deprecated_singleton_method :get_for_screen, :warn => "Use '#{self}.default'." do |_self, screen|
@@ -774,6 +785,11 @@ module Gtk
774
785
  alias :screen= :set_screen
775
786
  end
776
787
 
788
+ class Revealer
789
+ extend GLib::Deprecatable
790
+ define_deprecated_const :TransitionType, "Gtk::RevealerTransitionType"
791
+ end
792
+
777
793
  class ProgressBar
778
794
  extend GLib::Deprecatable
779
795
  define_deprecated_method :set_activity_mode, :warn => "Don't use this method."
@@ -812,6 +828,21 @@ module Gtk
812
828
  define_deprecated_enums :SpinButtonUpdatePolicy, 'UPDATE'
813
829
  end
814
830
 
831
+ class Stack
832
+ extend GLib::Deprecatable
833
+ define_deprecated_const :TransitionType, "Gtk::StackTransitionType"
834
+ end
835
+
836
+ class StypeContext
837
+ extend GLib::Deprecatable
838
+ define_deprecated_singleton_method :add_provider_for_screen,
839
+ :add_provider_for_display do |_self, display, provider, priority=nil|
840
+ _self.add_privder_for_display(display, provider, priority)
841
+ end
842
+ define_deprecated_singleton_method :reset_widgets,
843
+ warn: "Don't use this method."
844
+ end
845
+
815
846
  class TextAttributes
816
847
  extend GLib::Deprecatable
817
848
  define_deprecated_method :realized?, :warn => "Don't use this method." do |_self|
@@ -847,9 +878,12 @@ module Gtk
847
878
  :warn => "Use '#{self}#get_iter_at(:anchor => nil)'." do |_self, anchor|
848
879
  _self.get_iter_at(:anchor => anchor)
849
880
  end
850
- define_deprecated_method :insert_pixbuf, :insert
851
881
  define_deprecated_method :insert_child_anchor, :insert
882
+ define_deprecated_method :insert_paintable, :insert
883
+ define_deprecated_method :insert_pixbuf, :insert
852
884
  define_deprecated_method :insert_with_tags, :insert
885
+ define_deprecated_method :deserialize, raise: "Don't use this method."
886
+ define_deprecated_method :serialize, raise: "Don't use this method."
853
887
  end
854
888
 
855
889
  class TextIter
@@ -867,17 +901,7 @@ module Gtk
867
901
 
868
902
  class TextView
869
903
  extend GLib::Deprecatable
870
- define_deprecated_enums :WindowType, 'WINDOW'
871
- end
872
-
873
- class ToggleAction
874
- extend GLib::Deprecatable
875
- define_deprecated_method_by_hash_args :initialize,
876
- 'name, label, tooltip = nil, stock_id = nil',
877
- 'name, :label => nil, :tooltip => nil, :stock_id => nil', 1 do
878
- |_self, name, label, tooltip, stock_id|
879
- [name, {:label => label, :tooltip => tooltip, :stock_id => stock_id}]
880
- end
904
+ define_deprecated_const :WindowType, raise: "Don't use this class."
881
905
  end
882
906
 
883
907
  class ToggleButton
@@ -904,21 +928,6 @@ module Gtk
904
928
  define_deprecated_method :remove_space, :warn => "Don't use this method."
905
929
  end
906
930
 
907
- class ToolButton
908
- extend GLib::Deprecatable
909
- define_deprecated_method_by_hash_args :initialize,
910
- 'icon_widget_or_stock_id = nil, label = nil',
911
- ':icon_widget => nil, :label => nil, :stock_id => nil' do
912
- |_self, icon_widget_or_stock_id, label|
913
- case icon_widget_or_stock_id
914
- when String, Symbol
915
- [{:stock_id => icon_widget_or_stock_id}]
916
- when Gtk::Widget
917
- [{:icon_widget => icon_widget_or_stock_id, :label => label}]
918
- end
919
- end
920
- end
921
-
922
931
  class Tooltip
923
932
  extend GLib::Deprecatable
924
933
  define_deprecated_method :set_icon_from_stock, :warn => "Use '#{self}#set_icon'." do |_self, stock_id, size|
@@ -956,12 +965,6 @@ module Gtk
956
965
  end
957
966
  end
958
967
 
959
- class UIManager
960
- extend GLib::Deprecatable
961
- define_deprecated_const :ItemType, "Gtk::UIManagerItemType"
962
- define_deprecated_flags :UIManagerItemType
963
- end
964
-
965
968
  class VBox
966
969
  extend GLib::Deprecatable
967
970
  define_deprecated_singleton_method :new, :warn => "Use 'Gtk::Box.new(:vertical, spacing)'." do |_self, homogeneous, spacing|
@@ -1010,7 +1013,7 @@ module Gtk
1010
1013
  extend GLib::Deprecatable
1011
1014
  define_deprecated_const :Align, "Gtk::Align"
1012
1015
  define_deprecated_const :HelpType, "Gtk::WidgetHelpType"
1013
- define_deprecated_enums :WidgetHelpType, 'HELP'
1016
+ define_deprecated_const :WidgetHelpType, raise: "Don't use this class."
1014
1017
  define_deprecated_const :TextDirection, "Gtk::TextDIrection"
1015
1018
  define_deprecated_enums "Gtk::TextDirection", 'TEXT_DIR'
1016
1019
  define_deprecated_singleton_method :push_colormap, :warn => "Don't use this method."
@@ -1078,54 +1081,39 @@ module Gtk
1078
1081
  define_deprecated_method :set_requisition, :warn => "Don't use this method."
1079
1082
  define_deprecated_method :saved_state, :raise => "Don't use this method."
1080
1083
  define_deprecated_method :pointer, :raise => "Use 'Gdk::Window#get_device_position'."
1081
-
1082
- alias :__set_allocation__ :set_allocation
1083
- private :__set_allocation__
1084
- def set_allocation(*args)
1085
- case args.size
1086
- when 1
1087
- __set_allocation__(args.first)
1088
- when 4
1089
- warn "#{caller[0]}: '#{self.class}#set_allocation(x, y, width, height)' style has been deprecated. Use '#{self.class}#set_allocation(alloc)' style."
1090
- __set_allocation__(Gtk::Allocation.new(*args))
1091
- else
1092
- raise ArgumentError.new("need 1 or 4 arguments.")
1093
- end
1094
- end
1095
-
1084
+ define_deprecated_method :set_allocation, raise: "Don't use this method."
1096
1085
  define_deprecated_signal :expose_event, :warn => "Use '#{self}::draw' signal."
1097
1086
  define_deprecated_signal :state_changed, :warn => "Use '#{self}::state-flags-changed' signal."
1098
1087
  define_deprecated_signal :style_set, :warn => "Use '#{self}::style-updated' signal."
1088
+
1089
+ define_deprecated_method :events, raise: "Use 'Gtk::EventControllers' instead."
1090
+ define_deprecated_method :add_events, raise: "Use 'Gtk::EventControllers' instead."
1091
+ define_deprecated_method :set_events, raise: "Use 'Gtk::EventControllers' instead."
1092
+ define_deprecated_method :events=, raise: "Use 'Gtk::EventControllers' instead."
1093
+ define_deprecated_method :drag_source_set, raise: "Use 'Gtk::DragSource' instead."
1094
+ define_deprecated_method :drag_dest_set, raise: "Use 'Gtk::DropTarget' instead."
1095
+ define_deprecated_method :style_attach, raise: "Don't use this method."
1096
+ define_deprecated_method :style_get, raise: "Don't use this method."
1097
+ define_deprecated_method :style_get_property, raise: "Don't use this method."
1098
+ define_deprecated_method :render_icon_pixbuf,
1099
+ raise: "Don't use this method."
1100
+ define_deprecated_method :set_icon, raise: "Use '#{self}#set_icon_name' instead."
1101
+ define_deprecated_method :icon=, raise: "Use '#{self}#icon_name=' instead."
1099
1102
  end
1100
1103
 
1101
1104
  class Window
1102
1105
  extend GLib::Deprecatable
1103
- define_deprecated_const :Position, "Gtk::WindowPosition"
1104
- define_deprecated_enums "Gtk::WindowPosition", 'POS'
1105
- define_deprecated_const :Type, "Gtk::WindowType"
1106
- define_deprecated_enums "Gtk::WindowType"
1106
+ define_deprecated_const :Position, raise: "Don't use this class."
1107
+ define_deprecated_const :Type, raise: "Don't use this class."
1107
1108
  define_deprecated_method :active_focus, :activate_focus
1108
1109
  define_deprecated_method :active_default, :activate_default
1109
- end
1110
-
1111
- class RecentFilter
1112
- extend GLib::Deprecatable
1113
- define_deprecated_const :Flags, 'Gtk::RecentFilterFlags'
1110
+ define_deprecated_method :add, :set_child
1114
1111
  end
1115
1112
  end
1116
1113
 
1117
1114
  module Gdk
1118
- class DragContext
1119
- define_deprecated_method_by_hash_args :finish,
1120
- 'success, delete, time',
1121
- ':success => true, :delete => false, :time => Gdk::CURRENT_TIME' do |_self, success, delete, time|
1122
- [{:success => success, :delete => delete, :time => time}]
1123
- end
1124
- end
1125
-
1126
1115
  class Event
1127
- define_deprecated_method :event_widget, :warn => "Use 'Gdk::Event#widget'." do |_self|
1128
- _self.widget
1129
- end
1116
+ define_deprecated_method :event_widget, raise: "Use 'Gtk::EventController#widget' instead."
1117
+ define_deprecated_method :widget, raise: "Use 'Gtk::EventController#widget' instead."
1130
1118
  end
1131
1119
  end