gtk3 3.0.7-x64-mingw32 → 3.0.8-x64-mingw32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/ext/gtk3/extconf.rb +1 -0
- data/ext/gtk3/rb-gtk3-tree-view.c +4 -0
- data/ext/gtk3/rb-gtk3.c +245 -60
- data/lib/2.2/gtk3.so +0 -0
- data/lib/2.3/gtk3.so +0 -0
- data/lib/gtk3/box.rb +22 -0
- data/lib/gtk3/builder.rb +50 -29
- data/lib/gtk3/deprecated.rb +7 -0
- data/lib/gtk3/entry-buffer.rb +28 -0
- data/lib/gtk3/list-store.rb +2 -20
- data/lib/gtk3/loader.rb +6 -0
- data/lib/gtk3/menu-item.rb +8 -7
- data/lib/gtk3/tree-iter.rb +25 -1
- data/lib/gtk3/tree-model.rb +41 -0
- data/lib/gtk3/tree-store.rb +7 -6
- data/lib/gtk3/widget.rb +18 -1
- data/sample/gtk-demo/TODO +45 -39
- data/sample/gtk-demo/assistant.rb +123 -0
- data/sample/gtk-demo/builder.rb +75 -38
- data/sample/gtk-demo/button_box.rb +100 -0
- data/sample/gtk-demo/colorsel.rb +49 -65
- data/sample/gtk-demo/css_accordion.rb +33 -55
- data/sample/gtk-demo/css_basics.rb +55 -80
- data/sample/gtk-demo/css_multiplebgs.rb +112 -0
- data/sample/gtk-demo/css_pixbufs.rb +84 -0
- data/sample/gtk-demo/css_shadows.rb +101 -0
- data/sample/gtk-demo/cursors.rb +114 -0
- data/sample/gtk-demo/dialog.rb +105 -115
- data/sample/gtk-demo/entry_buffer.rb +44 -0
- data/sample/gtk-demo/entry_completion.rb +40 -52
- data/sample/gtk-demo/expander.rb +60 -26
- data/sample/gtk-demo/filtermodel.rb +119 -0
- data/sample/gtk-demo/font_features.rb +117 -0
- data/sample/gtk-demo/headerbar.rb +57 -0
- data/sample/gtk-demo/iconview_edit.rb +79 -0
- data/sample/gtk-demo/infobar.rb +75 -59
- data/sample/gtk-demo/links.rb +53 -40
- data/sample/gtk-demo/main.rb +353 -43
- data/sample/gtk-demo/main.ui +9 -9
- data/sample/gtk-demo/markup.rb +46 -0
- data/sample/gtk-demo/menus.rb +111 -162
- data/sample/gtk-demo/modelbutton.rb +47 -0
- data/sample/gtk-demo/overlay.rb +61 -0
- data/sample/gtk-demo/overlay2.rb +75 -0
- data/sample/gtk-demo/panes.rb +114 -133
- data/sample/gtk-demo/pickers.rb +70 -0
- data/sample/gtk-demo/popover.rb +110 -0
- data/sample/gtk-demo/printing.rb +68 -83
- data/sample/gtk-demo/revealer.rb +53 -0
- data/sample/gtk-demo/scale.rb +26 -0
- data/sample/gtk-demo/search_entry2.rb +107 -0
- data/sample/gtk-demo/sidebar.rb +68 -0
- data/sample/gtk-demo/sizegroup.rb +93 -105
- data/sample/gtk-demo/spinner.rb +53 -50
- data/sample/gtk-demo/stack.rb +28 -0
- data/sample/gtk-demo/test_mod.rb +22 -0
- data/sample/gtk-demo/textmask.rb +61 -0
- data/sample/gtk-demo/theming_style_classes.rb +16 -12
- data/sample/misc/app-menu.ui +19 -0
- data/sample/misc/button-menu.ui +19 -0
- data/sample/misc/icons-theme-viewer.rb +65 -0
- data/sample/misc/menu.rb +3 -3
- data/sample/misc/menus_from_resources.gresource.xml +8 -0
- data/sample/misc/menus_from_resources.rb +91 -0
- data/sample/misc/statusicon.rb +1 -1
- data/sample/misc/toolbar-menu.ui +23 -0
- data/sample/misc/treestore.rb +63 -0
- data/sample/tutorial/README.md +368 -6
- data/test/test-gtk-box.rb +13 -0
- data/test/test-gtk-builder.rb +1 -1
- data/test/test-gtk-clipboard.rb +124 -0
- data/test/test-gtk-container.rb +3 -3
- data/test/test-gtk-entry-buffer.rb +32 -0
- data/test/test-gtk-list-store.rb +30 -12
- data/test/test-gtk-menu.rb +32 -0
- data/test/test-gtk-tree-iter.rb +61 -5
- data/test/test-gtk-tree-path.rb +26 -1
- data/test/test-gtk-tree-sortable.rb +35 -0
- data/test/test-gtk-tree-store.rb +34 -0
- data/test/test-gtk-widget.rb +33 -2
- metadata +57 -22
- data/lib/2.0/gtk3.so +0 -0
- data/lib/2.1/gtk3.so +0 -0
- data/sample/gtk-demo/button-box.rb +0 -82
@@ -1,75 +1,53 @@
|
|
1
|
-
#
|
2
|
-
#
|
3
|
-
# They are licensed under the terms of the GNU Lesser General Public
|
4
|
-
# License, version 2.1 or (at your option) later.
|
1
|
+
# Copyright (c) 2015 Ruby-GNOME2 Project Team
|
2
|
+
# This program is licenced under the same licence as Ruby-GNOME2.
|
5
3
|
#
|
6
|
-
# Copyright (C) 2013-2015 Ruby-GNOME2 Project Team
|
7
|
-
#
|
8
|
-
# This library is free software; you can redistribute it and/or
|
9
|
-
# modify it under the terms of the GNU Lesser General Public
|
10
|
-
# License as published by the Free Software Foundation; either
|
11
|
-
# version 2.1 of the License, or (at your option) any later version.
|
12
|
-
#
|
13
|
-
# This library is distributed in the hope that it will be useful,
|
14
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
16
|
-
# Lesser General Public License for more details.
|
17
|
-
#
|
18
|
-
# You should have received a copy of the GNU Lesser General Public
|
19
|
-
# License along with this library; if not, write to the Free Software
|
20
|
-
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
21
4
|
=begin
|
22
5
|
= CSS Theming/CSS Accordion
|
23
6
|
|
24
7
|
A simple accordion demo written using CSS transitions and multiple backgrounds
|
25
8
|
=end
|
9
|
+
module CssAccordionDemo
|
10
|
+
def self.run_demo(main_window)
|
11
|
+
window = Gtk::Window.new(:toplevel)
|
12
|
+
window.screen = main_window.screen
|
26
13
|
|
27
|
-
|
28
|
-
|
29
|
-
module Demo
|
30
|
-
class CssAccordion < BasicWindow
|
31
|
-
def initialize
|
32
|
-
super("CSS Accordion")
|
33
|
-
set_default_size(600, 300)
|
34
|
-
|
35
|
-
container = Gtk::Box.new(:horizontal, 0)
|
36
|
-
container.set_halign(:center)
|
37
|
-
container.set_valign(:center)
|
38
|
-
add(container)
|
39
|
-
|
40
|
-
child = Gtk::Button.new(:label => "This")
|
41
|
-
container.add(child)
|
14
|
+
window.set_title("CSS Accordion")
|
15
|
+
window.set_default_size(600, 300)
|
42
16
|
|
43
|
-
|
44
|
-
|
17
|
+
container = Gtk::Box.new(:horizontal, 0)
|
18
|
+
container.set_halign(:center)
|
19
|
+
container.set_valign(:center)
|
45
20
|
|
46
|
-
|
47
|
-
container.add(child)
|
21
|
+
window.add(container)
|
48
22
|
|
49
|
-
|
23
|
+
%w(This Is A CSS Accordion :-).each do |label|
|
24
|
+
child = Gtk::Button.new(:label => label)
|
50
25
|
container.add(child)
|
26
|
+
end
|
51
27
|
|
52
|
-
|
53
|
-
|
28
|
+
provider = Gtk::CssProvider.new
|
29
|
+
provider.load_from_resource("/css_accordion/css_accordion.css")
|
54
30
|
|
55
|
-
|
56
|
-
|
31
|
+
style_context = window.style_context
|
32
|
+
style_context.add_provider(provider, Gtk::StyleProvider::PRIORITY_USER)
|
57
33
|
|
58
|
-
|
59
|
-
Dir.chdir(__dir__) do
|
60
|
-
provider.load(:data => File.read("css_accordion.css"))
|
61
|
-
end
|
34
|
+
apply_style(window, provider)
|
62
35
|
|
63
|
-
|
36
|
+
if !window.visible?
|
37
|
+
window.show_all
|
38
|
+
else
|
39
|
+
window.destroy
|
64
40
|
end
|
65
41
|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
42
|
+
window
|
43
|
+
end
|
44
|
+
|
45
|
+
def self.apply_style(widget, provider)
|
46
|
+
style_context = widget.style_context
|
47
|
+
style_context.add_provider(provider, Gtk::StyleProvider::PRIORITY_USER)
|
48
|
+
return unless widget.respond_to?(:children)
|
49
|
+
widget.children.each do |child|
|
50
|
+
apply_style(child, provider)
|
73
51
|
end
|
74
52
|
end
|
75
53
|
end
|
@@ -1,103 +1,78 @@
|
|
1
|
+
# Copyright (c) 2015 Ruby-GNOME2 Project Team
|
2
|
+
# This program is licenced under the same licence as Ruby-GNOME2.
|
1
3
|
#
|
2
|
-
# This sample code is a port of gtk3/demos/gtk-demo/css_basic.c. The
|
3
|
-
# CSS file used in this sample code is copied from gtk3/demos/gtk-demo.
|
4
|
-
# They are licensed under the terms of the GNU Lesser General Public
|
5
|
-
# License, version 2.1 or (at your option) later.
|
6
|
-
#
|
7
|
-
# Copyright (C) 2013 Ruby-GNOME2 Project Team
|
8
|
-
#
|
9
|
-
# This library is free software; you can redistribute it and/or
|
10
|
-
# modify it under the terms of the GNU Lesser General Public
|
11
|
-
# License as published by the Free Software Foundation; either
|
12
|
-
# version 2.1 of the License, or (at your option) any later version.
|
13
|
-
#
|
14
|
-
# This library is distributed in the hope that it will be useful,
|
15
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
16
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
17
|
-
# Lesser General Public License for more details.
|
18
|
-
#
|
19
|
-
# You should have received a copy of the GNU Lesser General Public
|
20
|
-
# License along with this library; if not, write to the Free Software
|
21
|
-
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
22
4
|
=begin
|
23
5
|
= CSS Theming/CSS Basics
|
24
6
|
|
25
7
|
Gtk themes are written using CSS. Every widget is build of multiple items
|
26
8
|
that you can style very similarly to a regular website.
|
27
9
|
=end
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
10
|
+
module CssBasicsDemo
|
11
|
+
def self.run_demo(main_window)
|
12
|
+
window = Gtk::Window.new(:toplevel)
|
13
|
+
window.set_title("CSS Basics")
|
14
|
+
window.set_transient_for(main_window)
|
15
|
+
window.set_default_size(400, 300)
|
16
|
+
|
17
|
+
text = Gtk::TextBuffer.new
|
18
|
+
text.create_tag("warning", "underline" => Pango::UNDERLINE_SINGLE)
|
19
|
+
text.create_tag("error", "underline" => Pango::UNDERLINE_ERROR)
|
20
|
+
default_css = Gio::Resources.lookup_data("/css_basics/css_basics.css", 0)
|
21
|
+
text.text = default_css
|
22
|
+
|
23
|
+
provider = Gtk::CssProvider.new
|
24
|
+
provider.load_from_data(default_css)
|
25
|
+
|
26
|
+
container = Gtk::ScrolledWindow.new
|
27
|
+
window.add(container)
|
28
|
+
|
29
|
+
child = Gtk::TextView.new(text)
|
30
|
+
container.add(child)
|
31
|
+
|
32
|
+
text.signal_connect "changed" do |buffer|
|
33
|
+
buffer.remove_all_tags(buffer.start_iter, buffer.end_iter)
|
34
|
+
modified_text = buffer.get_text(buffer.start_iter,
|
35
|
+
buffer.end_iter,
|
36
|
+
false)
|
37
|
+
begin
|
38
|
+
provider.load_from_data(modified_text)
|
39
|
+
rescue
|
40
|
+
provider.load_from_data(default_css)
|
49
41
|
end
|
50
42
|
|
51
|
-
|
52
|
-
|
53
|
-
provider.signal_connect("parsing-error") do |_provider, section, error|
|
54
|
-
p section
|
55
|
-
p error
|
56
|
-
show_parsing_error(section, error, child.buffer)
|
57
|
-
end
|
58
|
-
|
59
|
-
apply_css(self, provider)
|
43
|
+
Gtk::StyleContext.reset_widgets
|
60
44
|
end
|
61
45
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
section.end_position)
|
70
|
-
|
71
|
-
if error == Gtk::CssProvider::ERROR ||
|
72
|
-
error == Gtk::CssProvider::ERROR_DEPRECATED
|
46
|
+
provider.signal_connect "parsing-error" do |_css_provider, section, error|
|
47
|
+
start_i = text.get_iter_at(:line => section.start_line,
|
48
|
+
:index => section.start_position)
|
49
|
+
end_i = text.get_iter_at(:line => section.end_line,
|
50
|
+
:index => section.end_position)
|
51
|
+
tag_name = nil
|
52
|
+
if error == Gtk::CssProviderError::DEPRECATED
|
73
53
|
tag_name = "warning"
|
74
54
|
else
|
75
55
|
tag_name = "error"
|
76
56
|
end
|
77
|
-
|
78
|
-
buffer.apply_tag_by_name(buffer, tag_name, start, end_)
|
57
|
+
text.apply_tag_by_name(tag_name, start_i, end_i)
|
79
58
|
end
|
80
59
|
|
81
|
-
|
82
|
-
start = buffer.start_iter
|
83
|
-
end_ = buffer.end_iter
|
84
|
-
buffer.remove_all_tags(start, end_)
|
60
|
+
apply_style(window, provider)
|
85
61
|
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
Gtk::StyleContext.reset_widgets
|
62
|
+
if !window.visible?
|
63
|
+
window.show_all
|
64
|
+
else
|
65
|
+
window.destroy
|
92
66
|
end
|
67
|
+
window
|
68
|
+
end
|
93
69
|
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
end
|
70
|
+
def self.apply_style(widget, provider)
|
71
|
+
style_context = widget.style_context
|
72
|
+
style_context.add_provider(provider, Gtk::StyleProvider::PRIORITY_USER)
|
73
|
+
return unless widget.respond_to?(:children)
|
74
|
+
widget.children.each do |child|
|
75
|
+
apply_style(child, provider)
|
101
76
|
end
|
102
77
|
end
|
103
78
|
end
|
@@ -0,0 +1,112 @@
|
|
1
|
+
# Copyright (c) 2015 Ruby-GNOME2 Project Team
|
2
|
+
# This program is licenced under the same licence as Ruby-GNOME2.
|
3
|
+
#
|
4
|
+
=begin
|
5
|
+
= CSS Theming/Multiple Backgrounds
|
6
|
+
|
7
|
+
Gtk themes are written using CSS. Every widget is build of multiple items
|
8
|
+
that you can style very similarly to a regular website.
|
9
|
+
=end
|
10
|
+
module CssMultiplebgsDemo
|
11
|
+
def self.run_demo(main_window)
|
12
|
+
window = Gtk::Window.new(:toplevel)
|
13
|
+
window.screen = main_window.screen
|
14
|
+
window.title = "Mutiple Backgrounds"
|
15
|
+
window.transient_for = main_window
|
16
|
+
window.set_default_size(400, 300)
|
17
|
+
|
18
|
+
container = Gtk::Overlay.new
|
19
|
+
container.add_events([:enter_notify_mask, :leave_notify_mask, :pointer_motion_mask])
|
20
|
+
window.add(container)
|
21
|
+
|
22
|
+
child = Gtk::DrawingArea.new
|
23
|
+
child.name = "canvas"
|
24
|
+
|
25
|
+
child.signal_connect "draw" do |widget, cr|
|
26
|
+
context = widget.style_context
|
27
|
+
Gtk.render_background(context, cr, 0, 0,
|
28
|
+
widget.allocated_width,
|
29
|
+
widget.allocated_height)
|
30
|
+
Gtk.render_frame(context, cr, 0, 0,
|
31
|
+
widget.allocated_width,
|
32
|
+
widget.allocated_height)
|
33
|
+
false
|
34
|
+
end
|
35
|
+
container.add(child)
|
36
|
+
|
37
|
+
child = Gtk::Button.new
|
38
|
+
child.add_events([:enter_notify_mask, :leave_notify_mask, :pointer_motion_mask])
|
39
|
+
child.name = "bricks-button"
|
40
|
+
child.halign = :center
|
41
|
+
child.valign = :center
|
42
|
+
child.set_size_request(250, 84)
|
43
|
+
container.add_overlay(child)
|
44
|
+
|
45
|
+
paned = Gtk::Paned.new(:vertical)
|
46
|
+
container.add_overlay(paned)
|
47
|
+
|
48
|
+
# Need a filler so we get a handle
|
49
|
+
child = Gtk::Box.new(:vertical, 0)
|
50
|
+
paned.add(child)
|
51
|
+
|
52
|
+
text = Gtk::TextBuffer.new
|
53
|
+
text.create_tag("warning", "underline" => :single)
|
54
|
+
text.create_tag("error", "underline" => :error)
|
55
|
+
default_css = Gio::Resources.lookup_data("/css_multiplebgs/css_multiplebgs.css")
|
56
|
+
text.text = default_css
|
57
|
+
|
58
|
+
provider = Gtk::CssProvider.new
|
59
|
+
provider.load_from_data(default_css)
|
60
|
+
|
61
|
+
container = Gtk::ScrolledWindow.new
|
62
|
+
paned.add(container)
|
63
|
+
|
64
|
+
child = Gtk::TextView.new(text)
|
65
|
+
container.add(child)
|
66
|
+
|
67
|
+
text.signal_connect "changed" do |buffer|
|
68
|
+
buffer.remove_all_tags(buffer.start_iter, buffer.end_iter)
|
69
|
+
modified_text = buffer.get_text(buffer.start_iter,
|
70
|
+
buffer.end_iter,
|
71
|
+
false)
|
72
|
+
begin
|
73
|
+
provider.load_from_data(modified_text)
|
74
|
+
rescue
|
75
|
+
provider.load_from_data(default_css)
|
76
|
+
end
|
77
|
+
|
78
|
+
Gtk::StyleContext.reset_widgets
|
79
|
+
end
|
80
|
+
|
81
|
+
provider.signal_connect "parsing-error" do |_css_provider, section, error|
|
82
|
+
start_i = text.get_iter_at(:line => section.start_line,
|
83
|
+
:index => section.start_position)
|
84
|
+
end_i = text.get_iter_at(:line => section.end_line,
|
85
|
+
:index => section.end_position)
|
86
|
+
tag_name = nil
|
87
|
+
if error == Gtk::CssProviderError::DEPRECATED
|
88
|
+
tag_name = "warning"
|
89
|
+
else
|
90
|
+
tag_name = "error"
|
91
|
+
end
|
92
|
+
text.apply_tag_by_name(tag_name, start_i, end_i)
|
93
|
+
end
|
94
|
+
apply_style(window, provider)
|
95
|
+
|
96
|
+
if !window.visible?
|
97
|
+
window.show_all
|
98
|
+
else
|
99
|
+
window.destroy
|
100
|
+
end
|
101
|
+
window
|
102
|
+
end
|
103
|
+
|
104
|
+
def self.apply_style(widget, provider)
|
105
|
+
style_context = widget.style_context
|
106
|
+
style_context.add_provider(provider, Gtk::StyleProvider::PRIORITY_USER)
|
107
|
+
return unless widget.respond_to?(:children)
|
108
|
+
widget.children.each do |child|
|
109
|
+
apply_style(child, provider)
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
@@ -0,0 +1,84 @@
|
|
1
|
+
# Copyright (c) 2015 Ruby-GNOME2 Project Team
|
2
|
+
# This program is licenced under the same licence as Ruby-GNOME2.
|
3
|
+
#
|
4
|
+
=begin
|
5
|
+
= CSS Theming/Animated Backgrounds
|
6
|
+
|
7
|
+
This demo is done in honour of the Pixbufs demo further down.
|
8
|
+
It is done exclusively with CSS as the background of the window.
|
9
|
+
=end
|
10
|
+
module CssPixbufsDemo
|
11
|
+
def self.run_demo(main_window)
|
12
|
+
window = Gtk::Window.new(:toplevel)
|
13
|
+
window.set_title("Animated Backgrounds")
|
14
|
+
window.set_transient_for(main_window)
|
15
|
+
window.set_default_size(400, 300)
|
16
|
+
|
17
|
+
text = Gtk::TextBuffer.new
|
18
|
+
text.create_tag("warning", "underline" => Pango::UNDERLINE_SINGLE)
|
19
|
+
text.create_tag("error", "underline" => Pango::UNDERLINE_ERROR)
|
20
|
+
default_css = Gio::Resources.lookup_data("/css_pixbufs/gtk.css", 0)
|
21
|
+
text.text = default_css
|
22
|
+
|
23
|
+
provider = Gtk::CssProvider.new
|
24
|
+
provider.load_from_data(default_css)
|
25
|
+
|
26
|
+
paned = Gtk::Paned.new(:vertical)
|
27
|
+
window.add(paned)
|
28
|
+
|
29
|
+
child = Gtk::Box.new(:vertical, 0)
|
30
|
+
paned.add(child)
|
31
|
+
|
32
|
+
container = Gtk::ScrolledWindow.new
|
33
|
+
paned.add(container)
|
34
|
+
|
35
|
+
child = Gtk::TextView.new(text)
|
36
|
+
container.add(child)
|
37
|
+
|
38
|
+
text.signal_connect "changed" do |buffer|
|
39
|
+
buffer.remove_all_tags(buffer.start_iter, buffer.end_iter)
|
40
|
+
modified_text = buffer.get_text(buffer.start_iter,
|
41
|
+
buffer.end_iter,
|
42
|
+
false)
|
43
|
+
begin
|
44
|
+
provider.load_from_data(modified_text)
|
45
|
+
rescue
|
46
|
+
provider.load_from_data(default_css)
|
47
|
+
end
|
48
|
+
|
49
|
+
Gtk::StyleContext.reset_widgets
|
50
|
+
end
|
51
|
+
|
52
|
+
provider.signal_connect "parsing-error" do |_css_provider, section, error|
|
53
|
+
start_i = text.get_iter_at(:line => section.start_line,
|
54
|
+
:index => section.start_position)
|
55
|
+
end_i = text.get_iter_at(:line => section.end_line,
|
56
|
+
:index => section.end_position)
|
57
|
+
tag_name = nil
|
58
|
+
if error == Gtk::CssProviderError::DEPRECATED
|
59
|
+
tag_name = "warning"
|
60
|
+
else
|
61
|
+
tag_name = "error"
|
62
|
+
end
|
63
|
+
text.apply_tag_by_name(tag_name, start_i, end_i)
|
64
|
+
end
|
65
|
+
|
66
|
+
apply_style(window, provider)
|
67
|
+
|
68
|
+
if !window.visible?
|
69
|
+
window.show_all
|
70
|
+
else
|
71
|
+
window.destroy
|
72
|
+
end
|
73
|
+
window
|
74
|
+
end
|
75
|
+
|
76
|
+
def self.apply_style(widget, provider)
|
77
|
+
style_context = widget.style_context
|
78
|
+
style_context.add_provider(provider, Gtk::StyleProvider::PRIORITY_USER)
|
79
|
+
return unless widget.respond_to?(:children)
|
80
|
+
widget.children.each do |child|
|
81
|
+
apply_style(child, provider)
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|