gtk4 3.5.1 → 4.0.2
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.
- checksums.yaml +4 -4
- data/gtk4.gemspec +1 -5
- data/lib/gtk4/{menu-item.rb → application.rb} +11 -10
- data/lib/gtk4/box.rb +1 -1
- data/lib/gtk4/builder.rb +14 -61
- data/lib/gtk4/button.rb +1 -2
- data/lib/gtk4/combo-box.rb +1 -6
- data/lib/gtk4/deprecated.rb +234 -246
- data/lib/gtk4/dialog.rb +10 -21
- data/lib/gtk4/{action.rb → entry.rb} +11 -8
- data/lib/gtk4/{gdk-drag-context.rb → gdk-display.rb} +12 -10
- data/lib/gtk4/icon-theme.rb +9 -12
- data/lib/gtk4/image.rb +12 -56
- data/lib/gtk4/list-store.rb +8 -0
- data/lib/gtk4/loader.rb +153 -27
- data/lib/gtk4/message-dialog.rb +1 -1
- data/lib/gtk4/paned.rb +17 -11
- data/lib/gtk4/{clipboard.rb → response-type.rb} +11 -6
- data/lib/gtk4/ruby-builder-scope.rb +47 -0
- data/lib/gtk4/scale-button.rb +6 -13
- data/lib/gtk4/stack.rb +23 -27
- data/lib/gtk4/style-context.rb +20 -4
- data/lib/gtk4/text-buffer.rb +14 -10
- data/lib/gtk4/{style-properties.rb → tree-model-sort.rb} +7 -9
- data/lib/gtk4/tree-model.rb +21 -1
- data/lib/gtk4/{target-list.rb → tree-sortable.rb} +8 -11
- data/lib/gtk4/tree-view-column.rb +9 -1
- data/lib/gtk4/version.rb +2 -2
- data/lib/gtk4/widget.rb +44 -71
- data/lib/gtk4.rb +4 -35
- data/sample/demos/README.md +4 -0
- data/sample/examples/README.md +4 -0
- data/sample/{action-namespace.rb → examples/action-namespace.rb} +0 -0
- data/sample/{builder.rb → examples/builder.rb} +0 -0
- data/sample/{builder.ui → examples/builder.ui} +0 -0
- data/sample/{drawing.rb → examples/drawing.rb} +0 -0
- data/sample/{grid_packing.rb → examples/grid_packing.rb} +0 -0
- data/sample/{hello_world.rb → examples/hello_world.rb} +0 -0
- data/sample/{utils.rb → examples/utils.rb} +0 -0
- data/sample/getting-started/README.md +4 -0
- metadata +26 -92
- data/lib/gtk4/action-group.rb +0 -131
- data/lib/gtk4/calendar.rb +0 -30
- data/lib/gtk4/check-menu-item.rb +0 -34
- data/lib/gtk4/container.rb +0 -62
- data/lib/gtk4/icon-size.rb +0 -32
- data/lib/gtk4/image-menu-item.rb +0 -37
- data/lib/gtk4/radio-action.rb +0 -28
- data/lib/gtk4/radio-button.rb +0 -49
- data/lib/gtk4/recent-chooser-dialog.rb +0 -38
- data/lib/gtk4/selection-data.rb +0 -42
- data/lib/gtk4/stock-item.rb +0 -36
- data/lib/gtk4/stock.rb +0 -70
- data/lib/gtk4/table.rb +0 -43
- data/lib/gtk4/target-entry.rb +0 -27
- data/lib/gtk4/toggle-action.rb +0 -27
- data/lib/gtk4/tool-button.rb +0 -36
- data/lib/gtk4/ui-manager.rb +0 -35
- data/lib/gtk4/window.rb +0 -42
- data/test/fixture/gnome-logo-icon.png +0 -0
- data/test/gtk-test-utils.rb +0 -36
- data/test/run-test.rb +0 -42
- data/test/test-gtk-box.rb +0 -36
- data/test/test-gtk-button.rb +0 -46
- data/test/test-gtk-dialog.rb +0 -74
- data/test/test-gtk-menu-item.rb +0 -42
- data/test/test-gtk-message-dialog.rb +0 -62
- data/test/test-gtk-version.rb +0 -47
- data/test/test-gtk-window.rb +0 -34
data/lib/gtk4/dialog.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2015-
|
1
|
+
# Copyright (C) 2015-2022 Ruby-GNOME 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,16 +38,6 @@ module Gtk
|
|
38
38
|
add_buttons(*buttons) if buttons
|
39
39
|
end
|
40
40
|
|
41
|
-
alias_method :run_raw, :run
|
42
|
-
def run
|
43
|
-
response_id = run_raw
|
44
|
-
if response_id < 0
|
45
|
-
ResponseType.new(response_id)
|
46
|
-
else
|
47
|
-
response_id
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
41
|
def add_buttons(*buttons)
|
52
42
|
buttons.each do |text, response_id|
|
53
43
|
add_button(text, response_id)
|
@@ -56,21 +46,20 @@ module Gtk
|
|
56
46
|
|
57
47
|
alias_method :add_button_raw, :add_button
|
58
48
|
def add_button(text, response_id)
|
59
|
-
|
60
|
-
when Symbol
|
61
|
-
response_id = ResponseType.new(response_id)
|
62
|
-
end
|
63
|
-
add_button_raw(text, response_id)
|
49
|
+
add_button_raw(text, ResponseType.resolve(response_id))
|
64
50
|
end
|
65
51
|
|
66
52
|
alias_method :get_widget_for_response_raw, :get_widget_for_response
|
67
53
|
def get_widget_for_response(response_id)
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
54
|
+
get_widget_for_response_raw(ResponseType.resolve(response_id))
|
55
|
+
end
|
56
|
+
|
57
|
+
alias_method :set_default_response_raw, :set_default_response
|
58
|
+
def set_default_response(response_id)
|
59
|
+
set_default_response_raw(ResponseType.resolve(response_id))
|
73
60
|
end
|
61
|
+
alias_method :default_response_raw=, :default_response=
|
62
|
+
alias_method :default_response=, :set_default_response
|
74
63
|
|
75
64
|
if method_defined?(:use_header_bar)
|
76
65
|
alias_method :use_header_bar_raw, :use_header_bar
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C)
|
1
|
+
# Copyright (C) 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
|
@@ -15,13 +15,16 @@
|
|
15
15
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
16
16
|
|
17
17
|
module Gtk
|
18
|
-
class
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
18
|
+
class Entry
|
19
|
+
# TODO: It's workaround for a GTK+ problem:
|
20
|
+
# It should be removed when GTK+ fix the problem.
|
21
|
+
# https://github.com/ruby-gnome2/ruby-gnome2/issues/1176
|
22
|
+
alias_method :set_attributes_raw, :set_attributes
|
23
|
+
def set_attributes(attrs)
|
24
|
+
attrs ||= Pango::AttrList.new
|
25
|
+
set_attributes_raw(attrs)
|
25
26
|
end
|
27
|
+
remove_method :attributes=
|
28
|
+
alias_method :attributes=, :set_attributes
|
26
29
|
end
|
27
30
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C)
|
1
|
+
# Copyright (C) 2019 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
|
@@ -15,15 +15,17 @@
|
|
15
15
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
16
16
|
|
17
17
|
module Gdk # Not Gtk!
|
18
|
-
class
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
18
|
+
class Display
|
19
|
+
def add_style_provider(provider, priority=nil)
|
20
|
+
Gtk::StyleContext.add_provider_for_display(self, provider, priority)
|
21
|
+
end
|
22
|
+
|
23
|
+
def remove_style_provider(provider)
|
24
|
+
Gtk::StyleContext.remove_provider_for_display(self, provider)
|
25
|
+
end
|
26
|
+
|
27
|
+
def icon_theme
|
28
|
+
Gtk::IconTheme.get_for_display(self)
|
27
29
|
end
|
28
30
|
end
|
29
31
|
end
|
data/lib/gtk4/icon-theme.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2015 Ruby-
|
1
|
+
# Copyright (C) 2015-2022 Ruby-GNOME 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
|
@@ -16,22 +16,19 @@
|
|
16
16
|
|
17
17
|
module Gtk
|
18
18
|
class IconTheme
|
19
|
-
alias_method :choose_icon_raw, :choose_icon
|
20
|
-
def choose_icon(icon_names, size, flags=nil)
|
21
|
-
icon_names = [icon_names] unless icon_names.is_a?(Array)
|
22
|
-
flags ||= 0
|
23
|
-
choose_icon_raw(icon_names, size, flags)
|
24
|
-
end
|
25
|
-
|
26
19
|
alias_method :lookup_icon_raw, :lookup_icon
|
27
|
-
def lookup_icon(icon, size, flags
|
20
|
+
def lookup_icon(icon, size, scale: 1, direction: :none, flags: nil)
|
28
21
|
case icon
|
29
22
|
when String, Symbol
|
30
|
-
flags ||=
|
31
|
-
lookup_icon_raw(icon.to_s, size, flags)
|
23
|
+
flags ||= 0
|
24
|
+
lookup_icon_raw(icon.to_s, nil, size, scale, direction, flags)
|
25
|
+
when Array
|
26
|
+
icon, *fallbacks = *icon
|
27
|
+
flags ||= 0
|
28
|
+
lookup_icon_raw(icon.to_s, fallbacks, size, scale, direction, flags)
|
32
29
|
else
|
33
30
|
flags ||= 0
|
34
|
-
lookup_by_gicon(icon, size, flags)
|
31
|
+
lookup_by_gicon(icon, size, scale, direction, flags)
|
35
32
|
end
|
36
33
|
end
|
37
34
|
end
|
data/lib/gtk4/image.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2014-
|
1
|
+
# Copyright (C) 2014-2022 Ruby-GNOME 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
|
@@ -20,96 +20,52 @@ module Gtk
|
|
20
20
|
# Creates a Gtk::Image. The source of the image depends on the options
|
21
21
|
# given.
|
22
22
|
#
|
23
|
-
# @param Hash{Symbol =>
|
24
|
-
# GdkPixbuf::Pixbuf, GdkPixbuf::PixbufAnimation, Cairo::Surface,
|
25
|
-
# Fixnum}
|
23
|
+
# @param Hash{Symbol => String, Gio::Icon, GdkPixbuf::Pixbuf}
|
26
24
|
#
|
27
25
|
# @example Create an empty image.
|
28
26
|
# image = Gtk::Image.new
|
29
27
|
#
|
30
28
|
# @example Create an image from a file.
|
31
|
-
# image = Gtk::Image.new
|
32
|
-
#
|
33
|
-
# @example Create an image from stock.
|
34
|
-
# image = Gtk::Image.new :stock => Gtk::Stock::OPEN, :size => :dialog
|
29
|
+
# image = Gtk::Image.new(file: 'path/to/the/image.png')
|
35
30
|
#
|
36
31
|
# @example Create an image from icon name.
|
37
|
-
# image = Gtk::Image.new
|
32
|
+
# image = Gtk::Image.new(icon_name: 'gtk-open')
|
38
33
|
#
|
39
34
|
# @example Create an image from a Gio::Icon, that itself is loaded from a
|
40
35
|
# file.
|
41
36
|
# icon = Gio::Icon.new_for_string 'path/to/the/image.png'
|
42
|
-
# image = Gtk::Image.new
|
37
|
+
# image = Gtk::Image.new(icon: icon)
|
43
38
|
#
|
44
39
|
# @example Create an image from from a Gio::Icon that is an Gio::ThemedIcon.
|
45
40
|
# icon = Gio::ThemedIcon.new 'gtk-open'
|
46
|
-
# image = Gtk::Image.new
|
41
|
+
# image = Gtk::Image.new(icon: icon)
|
47
42
|
#
|
48
43
|
# @example Create an image from a GdkPixbuf::Pixbuf.
|
49
44
|
# pixbuf = GdkPixbuf::Pixbuf.new(:file => 'path/to/the/image.png')
|
50
|
-
# image = Gtk::Image.new
|
51
|
-
#
|
52
|
-
# @example Create an image from an Gtk::IconSet, that itself is created
|
53
|
-
# from a GdkPixbuf::Pixbuf.
|
54
|
-
# pixbuf = GdkPixbuf::Pixbuf.new(:file => 'path/to/the/image.png')
|
55
|
-
# iconSet = Gtk::IconSet.new pixbuf
|
56
|
-
# image = Gtk::Image.new :icon_set => iconSet, :size => :dialog
|
57
|
-
#
|
58
|
-
# @example Create an image from a GdkPixbuf::PixbufAnimation
|
59
|
-
# pixAnim = GdkPixbuf::PixbufAnimation.new 'anim.gif'
|
60
|
-
# image = Gtk::Image.new :animation => pixAnim
|
45
|
+
# image = Gtk::Image.new(pixbuf: pixbuf)
|
61
46
|
#
|
62
47
|
# @example Create an image from a file in a resource file
|
63
48
|
# resource = Gio::Resource.load(a_resource_file)
|
64
49
|
# Gio::Resources.register(resource)
|
65
50
|
# resource_path = "/path/to/image.png"
|
66
|
-
# image = Gtk::Image.new
|
67
|
-
#
|
68
|
-
# @example Create an image from a Cairo::Surface that is a
|
69
|
-
# Cairo::ImageSurface.
|
70
|
-
# surface = Cairo::ImageSurface.new :RGB24, 60, 60
|
71
|
-
# context = Cairo::Context.new surface
|
72
|
-
# context.set_source_rgb 0, 1, 0
|
73
|
-
# context.rectangle 10, 10, 40, 40
|
74
|
-
# context.fill.stroke
|
75
|
-
# image = Gtk::Image.new :surface => surface
|
51
|
+
# image = Gtk::Image.new(resource: resource_path)
|
76
52
|
def initialize(options={})
|
77
|
-
stock = options[:stock] || nil
|
78
53
|
icon_name = options[:icon_name] || nil
|
79
|
-
icon_set = options[:icon_set] || nil
|
80
54
|
icon = options[:icon] || options[:gicon] || nil
|
81
55
|
file = options[:file] || nil
|
82
56
|
pixbuf = options[:pixbuf] || nil
|
83
|
-
|
84
|
-
resource = options[:resource] ||nil
|
85
|
-
surface = options[:surface] || nil
|
86
|
-
size = options[:size] || nil
|
87
|
-
|
88
|
-
case size
|
89
|
-
when String, Symbol
|
90
|
-
size = IconSize.new(size)
|
91
|
-
else
|
92
|
-
size ||= IconSize::BUTTON
|
93
|
-
end
|
57
|
+
resource = options[:resource] || nil
|
94
58
|
|
95
|
-
if
|
96
|
-
|
97
|
-
elsif icon_name
|
98
|
-
initialize_new_from_icon_name(icon_name, size)
|
99
|
-
elsif icon_set
|
100
|
-
initialize_new_from_icon_set(icon_set, size)
|
59
|
+
if icon_name
|
60
|
+
initialize_new_from_icon_name(icon_name)
|
101
61
|
elsif icon
|
102
|
-
initialize_new_from_gicon(icon
|
62
|
+
initialize_new_from_gicon(icon)
|
103
63
|
elsif file
|
104
64
|
initialize_new_from_file(file)
|
105
65
|
elsif pixbuf
|
106
66
|
initialize_new_from_pixbuf(pixbuf)
|
107
|
-
elsif animation
|
108
|
-
initialize_new_from_animation(animation)
|
109
67
|
elsif resource
|
110
68
|
initialize_new_from_resource(resource)
|
111
|
-
elsif surface
|
112
|
-
initialize_new_from_surface(surface)
|
113
69
|
else
|
114
70
|
initialize_raw
|
115
71
|
end
|
data/lib/gtk4/list-store.rb
CHANGED
@@ -59,5 +59,13 @@ module Gtk
|
|
59
59
|
setup_iter(iter)
|
60
60
|
iter
|
61
61
|
end
|
62
|
+
|
63
|
+
alias_method :set_column_types_raw, :set_column_types
|
64
|
+
def set_column_types(*types)
|
65
|
+
if types.size == 1 and types[0].is_a?(Array)
|
66
|
+
types = types[0]
|
67
|
+
end
|
68
|
+
set_column_types_raw(types)
|
69
|
+
end
|
62
70
|
end
|
63
71
|
end
|
data/lib/gtk4/loader.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2014-
|
1
|
+
# Copyright (C) 2014-2022 Ruby-GNOME 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
|
@@ -16,31 +16,23 @@
|
|
16
16
|
|
17
17
|
module Gtk
|
18
18
|
class Loader < GObjectIntrospection::Loader
|
19
|
-
def initialize(base_module, init_arguments)
|
20
|
-
super(base_module)
|
21
|
-
@init_arguments = init_arguments
|
22
|
-
end
|
23
|
-
|
24
19
|
def load
|
25
20
|
self.version = "4.0"
|
26
21
|
super("Gtk")
|
27
22
|
end
|
28
23
|
|
29
24
|
private
|
30
|
-
|
31
25
|
def pre_load(repository, namespace)
|
32
26
|
call_init_function(repository, namespace)
|
33
27
|
define_version_module
|
28
|
+
define_methods_modules
|
29
|
+
setup_pending_constants
|
34
30
|
end
|
35
31
|
|
36
32
|
def call_init_function(repository, namespace)
|
37
33
|
init_check = repository.find(namespace, "init_check")
|
38
|
-
|
39
|
-
|
40
|
-
]
|
41
|
-
succeeded, argv = init_check.invoke(arguments)
|
42
|
-
@init_arguments.replace(argv[1..-1]) unless argv.nil?
|
43
|
-
raise InitError, "failed to initialize GTK+" unless succeeded
|
34
|
+
succeeded = init_check.invoke([])
|
35
|
+
raise InitError, "failed to initialize GTK" unless succeeded
|
44
36
|
end
|
45
37
|
|
46
38
|
def define_version_module
|
@@ -48,25 +40,102 @@ module Gtk
|
|
48
40
|
@base_module.const_set("Version", @version_module)
|
49
41
|
end
|
50
42
|
|
43
|
+
def define_methods_modules
|
44
|
+
@widget_methods_module =
|
45
|
+
define_methods_module(:WidgetMethods)
|
46
|
+
end
|
47
|
+
|
48
|
+
def apply_methods_modules
|
49
|
+
apply_methods_module(@widget_methods_module,
|
50
|
+
@base_module::Widget)
|
51
|
+
end
|
52
|
+
|
53
|
+
def level_bar_class
|
54
|
+
@level_bar_class ||= @base_module.const_get(:LevelBar)
|
55
|
+
end
|
56
|
+
|
57
|
+
def style_provider_module
|
58
|
+
@style_provider_module ||= @base_module.const_get(:StyleProvider)
|
59
|
+
end
|
60
|
+
|
51
61
|
def post_load(repository, namespace)
|
62
|
+
apply_pending_constants
|
63
|
+
apply_methods_modules
|
64
|
+
require_extension
|
52
65
|
require_libraries
|
53
66
|
end
|
54
67
|
|
68
|
+
def require_extension
|
69
|
+
require "gtk4.so"
|
70
|
+
end
|
71
|
+
|
55
72
|
def require_libraries
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
73
|
+
require_relative "gdk-display"
|
74
|
+
|
75
|
+
require_relative "about-dialog"
|
76
|
+
require_relative "application"
|
77
|
+
require_relative "binding-set"
|
78
|
+
require_relative "border"
|
79
|
+
require_relative "box"
|
80
|
+
require_relative "button"
|
81
|
+
require_relative "builder"
|
82
|
+
require_relative "cell-layout"
|
83
|
+
require_relative "color-chooser-dialog"
|
84
|
+
require_relative "combo-box"
|
85
|
+
require_relative "combo-box-text"
|
86
|
+
require_relative "css-provider"
|
87
|
+
require_relative "dialog"
|
88
|
+
require_relative "entry"
|
89
|
+
require_relative "entry-buffer"
|
90
|
+
require_relative "file-chooser-dialog"
|
91
|
+
require_relative "font-chooser-dialog"
|
92
|
+
require_relative "gesture-multi-press"
|
93
|
+
require_relative "icon-theme"
|
94
|
+
require_relative "icon-view"
|
95
|
+
require_relative "image"
|
96
|
+
require_relative "label"
|
97
|
+
require_relative "level-bar"
|
98
|
+
require_relative "list-store"
|
99
|
+
require_relative "message-dialog"
|
100
|
+
require_relative "paned"
|
101
|
+
require_relative "response-type"
|
102
|
+
require_relative "scale-button"
|
103
|
+
require_relative "scrolled-window"
|
104
|
+
require_relative "search-bar"
|
105
|
+
require_relative "spin-button"
|
106
|
+
require_relative "show-uri"
|
107
|
+
require_relative "stack"
|
108
|
+
require_relative "style-context"
|
109
|
+
require_relative "text-buffer"
|
110
|
+
require_relative "text-iter"
|
111
|
+
require_relative "text-tag"
|
112
|
+
require_relative "text-tag-table"
|
113
|
+
require_relative "text-view"
|
114
|
+
require_relative "toggle-button"
|
115
|
+
require_relative "tree-iter"
|
116
|
+
require_relative "tree-model"
|
117
|
+
require_relative "tree-model-filter"
|
118
|
+
require_relative "tree-model-sort"
|
119
|
+
require_relative "tree-path"
|
120
|
+
require_relative "tree-selection"
|
121
|
+
require_relative "tree-sortable"
|
122
|
+
require_relative "tree-store"
|
123
|
+
require_relative "tree-view"
|
124
|
+
require_relative "tree-view-column"
|
125
|
+
require_relative "version"
|
126
|
+
require_relative "widget"
|
127
|
+
|
128
|
+
require_relative "deprecated"
|
64
129
|
end
|
65
130
|
|
66
|
-
def
|
67
|
-
|
68
|
-
|
69
|
-
|
131
|
+
def load_function_info(info)
|
132
|
+
name = info.name
|
133
|
+
case name
|
134
|
+
when "init", "init_check"
|
135
|
+
# ignore
|
136
|
+
when /\Atest_widget_/
|
137
|
+
name = $POSTMATCH
|
138
|
+
define_method(info, @widget_methods_module, name)
|
70
139
|
else
|
71
140
|
super
|
72
141
|
end
|
@@ -75,11 +144,68 @@ module Gtk
|
|
75
144
|
def rubyish_method_name(function_info, options={})
|
76
145
|
name = function_info.name
|
77
146
|
case name
|
78
|
-
when
|
79
|
-
|
147
|
+
when "list_toplevels"
|
148
|
+
# To avoid conflict with gtk_window_get_toplevels()
|
149
|
+
name
|
150
|
+
else
|
151
|
+
super
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
def load_method_info(info, klass, method_name)
|
156
|
+
case klass.name
|
157
|
+
when "Gtk::Builder"
|
158
|
+
case method_name
|
159
|
+
when "get_type_from_name"
|
160
|
+
method_name = "get_type"
|
161
|
+
end
|
162
|
+
when "Gtk::Image"
|
163
|
+
method_name = method_name.gsub(/\Agicon/, "icon")
|
164
|
+
when "Gtk::TreePath"
|
165
|
+
case method_name
|
166
|
+
when "next", "prev", "up", "down"
|
167
|
+
method_name += "!"
|
168
|
+
end
|
169
|
+
when "Gtk::TreeSelection"
|
170
|
+
case method_name
|
171
|
+
when "selected_foreach"
|
172
|
+
method_name = "each"
|
173
|
+
end
|
174
|
+
when "Gtk::TreeView"
|
175
|
+
case method_name
|
176
|
+
when "row_expanded"
|
177
|
+
method_name += "?"
|
178
|
+
end
|
179
|
+
end
|
180
|
+
super(info, klass, method_name)
|
181
|
+
end
|
182
|
+
|
183
|
+
def load_constant_info(info)
|
184
|
+
case info.name
|
185
|
+
when /_VERSION\z/
|
186
|
+
@version_module.const_set($PREMATCH, info.value)
|
187
|
+
when /\ALEVEL_BAR_/
|
188
|
+
@pending_constants << info
|
189
|
+
when /\ASTYLE_PROVIDER_/
|
190
|
+
@pending_constants << info
|
80
191
|
else
|
81
192
|
super
|
82
193
|
end
|
83
194
|
end
|
195
|
+
|
196
|
+
def setup_pending_constants
|
197
|
+
@pending_constants = []
|
198
|
+
end
|
199
|
+
|
200
|
+
def apply_pending_constants
|
201
|
+
@pending_constants.each do |info|
|
202
|
+
case info.name
|
203
|
+
when /\ALEVEL_BAR_/
|
204
|
+
level_bar_class.const_set($POSTMATCH, info.value)
|
205
|
+
when /\ASTYLE_PROVIDER_/
|
206
|
+
style_provider_module.const_set($POSTMATCH, info.value)
|
207
|
+
end
|
208
|
+
end
|
209
|
+
end
|
84
210
|
end
|
85
211
|
end
|
data/lib/gtk4/message-dialog.rb
CHANGED
data/lib/gtk4/paned.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2015 Ruby-
|
1
|
+
# Copyright (C) 2015-2022 Ruby-GNOME 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
|
@@ -16,22 +16,28 @@
|
|
16
16
|
|
17
17
|
module Gtk
|
18
18
|
class Paned
|
19
|
-
alias_method :
|
20
|
-
def
|
19
|
+
alias_method :set_start_child_raw, :set_start_child
|
20
|
+
def set_start_child(child, options=nil)
|
21
|
+
set_start_child_raw(child)
|
22
|
+
return self unless options
|
23
|
+
|
21
24
|
resize = options[:resize]
|
22
|
-
resize
|
25
|
+
set_resize_start_child(resize) unless resize.nil?
|
23
26
|
shrink = options[:shrink]
|
24
|
-
shrink
|
25
|
-
|
27
|
+
set_shrink_start_child(shrink) unless shrink.nil?
|
28
|
+
self
|
26
29
|
end
|
27
30
|
|
28
|
-
alias_method :
|
29
|
-
def
|
31
|
+
alias_method :set_end_child_raw, :set_end_child
|
32
|
+
def set_end_child(child, options=nil)
|
33
|
+
set_end_child_raw(child)
|
34
|
+
return self unless options
|
35
|
+
|
30
36
|
resize = options[:resize]
|
31
|
-
resize
|
37
|
+
set_resize_end_child(resize) unless resize.nil?
|
32
38
|
shrink = options[:shrink]
|
33
|
-
shrink
|
34
|
-
|
39
|
+
set_shrink_end_child(shrink) unless shrink.nil?
|
40
|
+
self
|
35
41
|
end
|
36
42
|
end
|
37
43
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C)
|
1
|
+
# Copyright (C) 2020 Ruby-GNOME 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
|
@@ -15,11 +15,16 @@
|
|
15
15
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
16
16
|
|
17
17
|
module Gtk
|
18
|
-
class
|
19
|
-
|
20
|
-
|
21
|
-
|
18
|
+
class ResponseType
|
19
|
+
class << self
|
20
|
+
def resolve(id)
|
21
|
+
case id
|
22
|
+
when Symbol
|
23
|
+
new(id)
|
24
|
+
else
|
25
|
+
id
|
26
|
+
end
|
27
|
+
end
|
22
28
|
end
|
23
|
-
alias_method :text=, :set_text
|
24
29
|
end
|
25
30
|
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# Copyright (C) 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
|
+
|
17
|
+
module Gtk
|
18
|
+
class RubyBuilderScope < GLib::Object
|
19
|
+
type_register
|
20
|
+
|
21
|
+
include Gtk::BuilderScope
|
22
|
+
|
23
|
+
def virtual_do_get_type_from_name(builder, type_name)
|
24
|
+
GLib::Type.try_convert(type_name)
|
25
|
+
end
|
26
|
+
|
27
|
+
def virtual_do_get_type_from_function(builder, function_name)
|
28
|
+
builder.__send__(normalize_name(function_name))
|
29
|
+
end
|
30
|
+
|
31
|
+
def virtual_do_create_closure(builder,
|
32
|
+
function_name,
|
33
|
+
flags,
|
34
|
+
object)
|
35
|
+
object ||= builder.current_object || builder
|
36
|
+
method_name = normalize_name(function_name)
|
37
|
+
GLib::Closure.new do |*args|
|
38
|
+
object.__send__(method_name, *args)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
private
|
43
|
+
def normalize_name(name)
|
44
|
+
name.gsub(/[-\s]+/, "_")
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
data/lib/gtk4/scale-button.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2015 Ruby-
|
1
|
+
# Copyright (C) 2015-2022 Ruby-GNOME 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
|
@@ -18,18 +18,11 @@ module Gtk
|
|
18
18
|
class ScaleButton
|
19
19
|
alias_method :initialize_raw, :initialize
|
20
20
|
def initialize(options={})
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
case icon_size
|
28
|
-
when Symbol, String
|
29
|
-
icon_size = IconSize.new(icon_size.to_s)
|
30
|
-
end
|
31
|
-
|
32
|
-
initialize_raw(icon_size, min, max, step, icons)
|
21
|
+
min = options[:min] || 0
|
22
|
+
max = options[:max] || 100
|
23
|
+
step = options[:step] || 2
|
24
|
+
icons = options[:icons] || nil
|
25
|
+
initialize_raw(min, max, step, icons)
|
33
26
|
end
|
34
27
|
end
|
35
28
|
end
|