gtk4 4.1.1 → 4.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/lib/gtk4/css-provider.rb +9 -5
  3. data/lib/gtk4/loader.rb +2 -1
  4. data/sample/examples/application1/README.md +32 -0
  5. data/sample/examples/application1/exampleapp.png +0 -0
  6. data/sample/examples/application1/exampleapp.rb +50 -0
  7. data/sample/examples/application1/org.gtk.exampleapp.desktop +6 -0
  8. data/sample/examples/application2/README.md +10 -0
  9. data/sample/examples/application2/exampleapp.rb +80 -0
  10. data/sample/examples/application3/README.md +1 -0
  11. data/sample/examples/application3/exampleapp.rb +108 -0
  12. data/sample/examples/application4/README.md +13 -0
  13. data/sample/examples/application4/exampleapp.rb +158 -0
  14. data/sample/examples/application5/README.md +30 -0
  15. data/sample/examples/application5/Rakefile +27 -0
  16. data/sample/examples/application5/exampleapp.rb +171 -0
  17. data/sample/examples/application5/org.gtk.exampleapp.gschema.xml +20 -0
  18. data/sample/examples/application6/README.md +15 -0
  19. data/sample/examples/application6/Rakefile +27 -0
  20. data/sample/examples/application6/exampleapp.rb +265 -0
  21. data/sample/examples/application6/org.gtk.exampleapp.gschema.xml +20 -0
  22. data/sample/examples/application7/README.md +15 -0
  23. data/sample/examples/application7/Rakefile +27 -0
  24. data/sample/examples/application7/exampleapp.rb +307 -0
  25. data/sample/examples/application7/org.gtk.exampleapp.gschema.xml +20 -0
  26. data/sample/examples/application8/README.md +15 -0
  27. data/sample/examples/application8/Rakefile +27 -0
  28. data/sample/examples/application8/exampleapp.rb +357 -0
  29. data/sample/examples/application8/org.gtk.exampleapp.gschema.xml +25 -0
  30. data/sample/examples/application9/README.md +15 -0
  31. data/sample/examples/application9/Rakefile +27 -0
  32. data/sample/examples/application9/exampleapp.rb +387 -0
  33. data/sample/examples/application9/org.gtk.exampleapp.gschema.xml +25 -0
  34. metadata +36 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0ee91802cdf581267a76f217892294080e99031d716301a0e3a57f37294ac440
4
- data.tar.gz: 3f6b70c30240b33914cb26c095140cd2617b5aafba00333ec4dce912cef365c8
3
+ metadata.gz: 90c3fcabed9c80a529fe0f2007ae9eaa93ee5d75182823a532b27425122e5b53
4
+ data.tar.gz: 84dc0413afa122d96df224c91645a954d6d367182bdb4ec833187007e1e6abb9
5
5
  SHA512:
6
- metadata.gz: 44594734987eb9d95937529f0e1d337038d4ae0a8665f7ce1318308ce9a0fbfdc543a8d03fb075de233e772a925fb6a67ca7189f474332e5d63ccc0ce08020b8
7
- data.tar.gz: 3be89b868753ca47ee187a8939d3c2f5e806c56706413985add1f1068afa3a76573fc12c970d3febfe19d490455e43b581c813a116a72fe1b0246897c5b2aea1
6
+ metadata.gz: 5e074e481366cbaa3e6930b71cb5c6c1471460bb2b7d006bef92b6ba4c62af0898094c816b3e4d80363222136bf2d31cf8629a898e25582a791657d4c14d0fa7
7
+ data.tar.gz: ae553d93201f83bdc7727a6b78c17259b2954eb29b6e95309120a86a82fe2e7478e276201f589a8078c316f954ad0c39fde1dc92114600b9a767f173d15f25e9
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2014-2015 Ruby-GNOME2 Project Team
1
+ # Copyright (C) 2014-2023 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
@@ -36,10 +36,14 @@ module Gtk
36
36
  end
37
37
 
38
38
  alias_method :load_from_data_raw, :load_from_data
39
- def load_from_data(data)
40
- if data.is_a?(GLib::Bytes)
41
- load_from_data_raw(data.to_s)
42
- else
39
+ if Version.or_later?(4, 9, 3)
40
+ def load_from_data(data)
41
+ data = data.to_s if data.is_a?(GLib::Bytes)
42
+ load_from_data_raw(data, data.bytesize)
43
+ end
44
+ else
45
+ def load_from_data(data)
46
+ data = data.to_s if data.is_a?(GLib::Bytes)
43
47
  load_from_data_raw(data)
44
48
  end
45
49
  end
data/lib/gtk4/loader.rb CHANGED
@@ -70,6 +70,8 @@ module Gtk
70
70
  end
71
71
 
72
72
  def require_libraries
73
+ require_relative "version"
74
+
73
75
  require_relative "gdk-display"
74
76
 
75
77
  require_relative "about-dialog"
@@ -122,7 +124,6 @@ module Gtk
122
124
  require_relative "tree-store"
123
125
  require_relative "tree-view"
124
126
  require_relative "tree-view-column"
125
- require_relative "version"
126
127
  require_relative "widget"
127
128
 
128
129
  require_relative "deprecated"
@@ -0,0 +1,32 @@
1
+ # Step 1: A trivial application
2
+
3
+ The following is only useful in the desktop system based on [Desktop Entry Specification](https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html) such as GNOME.
4
+
5
+ To make gnome-shell use the desktop file and icon for this example while running it uninstalled, do the following:
6
+
7
+ ```console
8
+ $ mkdir -p ~/.local/share/applications
9
+ $ cp org.gtk.exampleapp.desktop ~/.local/share/applications/org.gtk.exampleapp.desktop
10
+ $ mkdir -p ~/.local/share/icons/hicolor/48x48/apps
11
+ $ cp exampleapp.png ~/.local/share/icons/hicolor/48x48/apps
12
+ ```
13
+
14
+ The file exapmleapp.png is from the GTK GitLab repository.
15
+ The original file is [here](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/examples/application1/exampleapp.png) and the license is LGPL 2.1 or later.
16
+
17
+ Note:
18
+
19
+ 1. You need to install your exampleapp.rb in advance.
20
+
21
+ ```console
22
+ $ cp exampleapp.rb ~/.local/bin/exampleapp.rb
23
+ $ chmod +x ~/.local/bin/exampleapp.rb
24
+ ```
25
+
26
+ 2. If you use rbenv, your ruby executable may not be found.
27
+ You can solve this by creating a symbolic link in `~/.local/bin` to your ruby executable.
28
+ For example,
29
+
30
+ ```console
31
+ $ ln -s $(rbenv which ruby) ~/.local/bin/ruby
32
+ ```
@@ -0,0 +1,50 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # Copyright (C) 2023 Ruby-GNOME Project Team
4
+ #
5
+ # This library is free software; you can redistribute it and/or
6
+ # modify it under the terms of the GNU Lesser General Public
7
+ # License as published by the Free Software Foundation; either
8
+ # version 2.1 of the License, or (at your option) any later version.
9
+ #
10
+ # This library is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ # Lesser General Public License for more details.
14
+ #
15
+ # You should have received a copy of the GNU Lesser General Public
16
+ # License along with this library; if not, write to the Free Software
17
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
+ #
19
+ # Example from:
20
+ # * https://gitlab.gnome.org/GNOME/gtk/-/blob/main/examples/application1/exampleapp.c
21
+ # * https://gitlab.gnome.org/GNOME/gtk/-/blob/main/examples/application1/exampleappwin.c
22
+ # License: LGPL2.1-or-later
23
+
24
+ require "gtk4"
25
+
26
+ class ExampleAppWindow < Gtk::ApplicationWindow
27
+ def open(file)
28
+ end
29
+ end
30
+
31
+ class ExampleApp < Gtk::Application
32
+ def initialize
33
+ super("org.gtk.exampleapp", :handles_open)
34
+
35
+ signal_connect "activate" do |application|
36
+ window = ExampleAppWindow.new(application)
37
+ window.present
38
+ end
39
+ signal_connect "open" do |application, files, hint|
40
+ window = application.windows[0] || ExampleAppWindow.new(application)
41
+ files.each do |file|
42
+ window.open(file)
43
+ end
44
+ window.present
45
+ end
46
+ end
47
+ end
48
+
49
+ app = ExampleApp.new
50
+ app.run
@@ -0,0 +1,6 @@
1
+ [Desktop Entry]
2
+ Type=Application
3
+ Name=Example
4
+ Icon=exampleapp
5
+ StartupNotify=true
6
+ Exec=exampleapp.rb
@@ -0,0 +1,10 @@
1
+ # Step 2: Populating the window
2
+
3
+ The original files are located in the following directory.
4
+
5
+ - https://gitlab.gnome.org/GNOME/gtk/-/blob/main/examples/application2
6
+
7
+ They are written in C language and use GResource because it is the best way in C language.
8
+ But when it comes to Ruby language, GResource is not the best way especially when the resource only includes ui files.
9
+ So, the program here uses a string instead of a resource.
10
+ If you want to know how to program with GResource in Ruby language, see gtk3/sample/tutorial/exampleapp2 directory.
@@ -0,0 +1,80 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # Copyright (C) 2023 Ruby-GNOME Project Team
4
+ #
5
+ # This library is free software; you can redistribute it and/or
6
+ # modify it under the terms of the GNU Lesser General Public
7
+ # License as published by the Free Software Foundation; either
8
+ # version 2.1 of the License, or (at your option) any later version.
9
+ #
10
+ # This library is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ # Lesser General Public License for more details.
14
+ #
15
+ # You should have received a copy of the GNU Lesser General Public
16
+ # License along with this library; if not, write to the Free Software
17
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
+ #
19
+ # Example from:
20
+ # * https://gitlab.gnome.org/GNOME/gtk/-/blob/main/examples/application2/exampleapp.c
21
+ # * https://gitlab.gnome.org/GNOME/gtk/-/blob/main/examples/application2/exampleappwin.c
22
+ # * https://gitlab.gnome.org/GNOME/gtk/-/blob/main/examples/application2/window.ui
23
+ # License: LGPL2.1-or-later
24
+
25
+ require "gtk4"
26
+
27
+ class ExampleAppWindow < Gtk::ApplicationWindow
28
+ type_register
29
+ class << self
30
+ def init
31
+ template = <<~TEMPLATE
32
+ <?xml version="1.0" encoding="UTF-8"?>
33
+ <interface>
34
+ <template class="ExampleAppWindow" parent="GtkApplicationWindow">
35
+ <property name="title" translatable="yes">Example Application</property>
36
+ <property name="default-width">600</property>
37
+ <property name="default-height">400</property>
38
+ <child>
39
+ <object class="GtkBox" id="content_box">
40
+ <property name="orientation">vertical</property>
41
+ <child>
42
+ <object class="GtkStack" id="stack"/>
43
+ </child>
44
+ </object>
45
+ </child>
46
+ </template>
47
+ </interface>
48
+ TEMPLATE
49
+ set_template(data: template)
50
+ end
51
+ end
52
+
53
+ def initialize(application)
54
+ super(application: application)
55
+ end
56
+
57
+ def open(file)
58
+ end
59
+ end
60
+
61
+ class ExampleApp < Gtk::Application
62
+ def initialize
63
+ super("org.gtk.exampleapp", :handles_open)
64
+
65
+ signal_connect "activate" do |application|
66
+ window = ExampleAppWindow.new(application)
67
+ window.present
68
+ end
69
+ signal_connect "open" do |application, files, hint|
70
+ window = application.windows[0] || ExampleAppWindow.new(application)
71
+ files.each do |file|
72
+ window.open(file)
73
+ end
74
+ window.present
75
+ end
76
+ end
77
+ end
78
+
79
+ app = ExampleApp.new
80
+ app.run
@@ -0,0 +1 @@
1
+ # Step 3: Opening files, add a stack switcher
@@ -0,0 +1,108 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # Copyright (C) 2023 Ruby-GNOME Project Team
4
+ #
5
+ # This library is free software; you can redistribute it and/or
6
+ # modify it under the terms of the GNU Lesser General Public
7
+ # License as published by the Free Software Foundation; either
8
+ # version 2.1 of the License, or (at your option) any later version.
9
+ #
10
+ # This library is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ # Lesser General Public License for more details.
14
+ #
15
+ # You should have received a copy of the GNU Lesser General Public
16
+ # License along with this library; if not, write to the Free Software
17
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
+ #
19
+ # Example from:
20
+ # * https://gitlab.gnome.org/GNOME/gtk/-/blob/main/examples/application3/exampleapp.c
21
+ # * https://gitlab.gnome.org/GNOME/gtk/-/blob/main/examples/application3/exampleappwin.c
22
+ # * https://gitlab.gnome.org/GNOME/gtk/-/blob/main/examples/application3/window.ui
23
+ # License: LGPL2.1-or-later
24
+
25
+ require "gtk4"
26
+
27
+ class ExampleAppWindow < Gtk::ApplicationWindow
28
+ type_register
29
+ class << self
30
+ def init
31
+ template = <<~TEMPLATE
32
+ <?xml version="1.0" encoding="UTF-8"?>
33
+ <interface>
34
+ <template class="ExampleAppWindow" parent="GtkApplicationWindow">
35
+ <property name="title" translatable="yes">Example Application</property>
36
+ <property name="default-width">600</property>
37
+ <property name="default-height">400</property>
38
+ <child type="titlebar">
39
+ <object class="GtkHeaderBar" id="header">
40
+ <child type="title">
41
+ <object class="GtkStackSwitcher" id="tabs">
42
+ <property name="stack">stack</property>
43
+ </object>
44
+ </child>
45
+ </object>
46
+ </child>
47
+ <child>
48
+ <object class="GtkBox" id="content_box">
49
+ <property name="orientation">vertical</property>
50
+ <child>
51
+ <object class="GtkStack" id="stack"/>
52
+ </child>
53
+ </object>
54
+ </child>
55
+ </template>
56
+ </interface>
57
+ TEMPLATE
58
+ set_template(data: template)
59
+ bind_template_child("stack")
60
+ end
61
+ end
62
+
63
+ def initialize(application)
64
+ super(application: application)
65
+ end
66
+
67
+ def open(file)
68
+ basename = file.basename
69
+ scrolled = Gtk::ScrolledWindow.new
70
+ scrolled.hexpand = true
71
+ scrolled.vexpand = true
72
+ view = Gtk::TextView.new
73
+ view.editable = false
74
+ view.cursor_visible = false
75
+ scrolled.child = view
76
+ stack.add_titled(scrolled, basename, basename)
77
+ buffer = view.buffer
78
+ file.read do |stream|
79
+ buffer.text = stream.read.force_encoding(Encoding::UTF_8)
80
+ end
81
+ end
82
+ end
83
+
84
+ class ExampleApp < Gtk::Application
85
+ def initialize
86
+ super("org.gtk.exampleapp", :handles_open)
87
+
88
+ signal_connect "activate" do |application|
89
+ window = ExampleAppWindow.new(application)
90
+ window.present
91
+ end
92
+ signal_connect "open" do |application, files, hint|
93
+ window = application.windows[0] || ExampleAppWindow.new(application)
94
+ files.each do |file|
95
+ window.open(file)
96
+ end
97
+ window.present
98
+ end
99
+ end
100
+ end
101
+
102
+ app = ExampleApp.new
103
+
104
+ # Gtk::Application#run needs C style argv ([prog, arg1, arg2, ...,argn]).
105
+ # The ARGV ruby variable only contains the arguments ([arg1, arg2, ...,argb])
106
+ # and not the program name. We have to add it explicitly.
107
+
108
+ app.run([$PROGRAM_NAME] + ARGV)
@@ -0,0 +1,13 @@
1
+ # Step 4: Add a menu
2
+
3
+ The original files are located in the following directory.
4
+
5
+ - https://gitlab.gnome.org/GNOME/gtk/-/blob/main/examples/application4
6
+
7
+ They are written in the C language and use `g_action_map_add_action entries`.
8
+ It is a convenience function for creating multiple GSimpleAction instances and adding them to a GActionMap.
9
+ If you write a program in C, it is the best way.
10
+
11
+ However, the program in this directory doesn't use `add_action_entries` method.
12
+ Instead, it uses `each` method of an array of action names.
13
+ The way above is flexible and simple.
@@ -0,0 +1,158 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # Copyright (C) 2023 Ruby-GNOME Project Team
4
+ #
5
+ # This library is free software; you can redistribute it and/or
6
+ # modify it under the terms of the GNU Lesser General Public
7
+ # License as published by the Free Software Foundation; either
8
+ # version 2.1 of the License, or (at your option) any later version.
9
+ #
10
+ # This library is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ # Lesser General Public License for more details.
14
+ #
15
+ # You should have received a copy of the GNU Lesser General Public
16
+ # License along with this library; if not, write to the Free Software
17
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
+ #
19
+ # Example from:
20
+ # * https://gitlab.gnome.org/GNOME/gtk/-/blob/main/examples/application4/exampleapp.c
21
+ # * https://gitlab.gnome.org/GNOME/gtk/-/blob/main/examples/application4/exampleappwin.c
22
+ # * https://gitlab.gnome.org/GNOME/gtk/-/blob/main/examples/application4/window.ui
23
+ # * https://gitlab.gnome.org/GNOME/gtk/-/blob/main/examples/application4/gears-menu.ui
24
+ # License: LGPL2.1-or-later
25
+
26
+ require "gtk4"
27
+
28
+ class ExampleAppWindow < Gtk::ApplicationWindow
29
+ type_register
30
+ class << self
31
+ def init
32
+ template = <<~TEMPLATE
33
+ <?xml version="1.0" encoding="UTF-8"?>
34
+ <interface>
35
+ <template class="ExampleAppWindow" parent="GtkApplicationWindow">
36
+ <property name="title" translatable="yes">Example Application</property>
37
+ <property name="default-width">600</property>
38
+ <property name="default-height">400</property>
39
+ <child type="titlebar">
40
+ <object class="GtkHeaderBar" id="header">
41
+ <child type="title">
42
+ <object class="GtkStackSwitcher" id="tabs">
43
+ <property name="stack">stack</property>
44
+ </object>
45
+ </child>
46
+ <child type="end">
47
+ <object class="GtkMenuButton" id="gears">
48
+ <property name="direction">none</property>
49
+ </object>
50
+ </child>
51
+ </object>
52
+ </child>
53
+ <child>
54
+ <object class="GtkBox" id="content_box">
55
+ <property name="orientation">vertical</property>
56
+ <child>
57
+ <object class="GtkStack" id="stack"/>
58
+ </child>
59
+ </object>
60
+ </child>
61
+ </template>
62
+ </interface>
63
+ TEMPLATE
64
+ set_template(data: template)
65
+ bind_template_child("stack")
66
+ bind_template_child("gears")
67
+ end
68
+ end
69
+
70
+ def initialize(application)
71
+ menu_ui = <<~MENU
72
+ <?xml version="1.0" encoding="UTF-8"?>
73
+ <interface>
74
+ <menu id="menu">
75
+ <section>
76
+ <item>
77
+ <attribute name="label" translatable="yes">_Preferences</attribute>
78
+ <attribute name="action">app.preferences</attribute>
79
+ </item>
80
+ </section>
81
+ <section>
82
+ <item>
83
+ <attribute name="label" translatable="yes">_Quit</attribute>
84
+ <attribute name="action">app.quit</attribute>
85
+ </item>
86
+ </section>
87
+ </menu>
88
+ </interface>
89
+ MENU
90
+ super(application: application)
91
+ builder = Gtk::Builder.new(string: menu_ui)
92
+ gears.menu_model = builder["menu"]
93
+ end
94
+
95
+ def open(file)
96
+ basename = file.basename
97
+ scrolled = Gtk::ScrolledWindow.new
98
+ scrolled.hexpand = true
99
+ scrolled.vexpand = true
100
+ view = Gtk::TextView.new
101
+ view.editable = false
102
+ view.cursor_visible = false
103
+ scrolled.child = view
104
+ stack.add_titled(scrolled, basename, basename)
105
+ buffer = view.buffer
106
+ file.read do |stream|
107
+ buffer.text = stream.read.force_encoding(Encoding::UTF_8)
108
+ end
109
+ end
110
+ end
111
+
112
+ class ExampleApp < Gtk::Application
113
+ def initialize
114
+ super("org.gtk.exampleapp", :handles_open)
115
+
116
+ signal_connect "startup" do |application|
117
+ [
118
+ "preferences",
119
+ "quit"
120
+ ].each do |action_name|
121
+ action = Gio::SimpleAction.new(action_name)
122
+ action.signal_connect("activate") do |_action, _parameter|
123
+ __send__("#{action_name}_activated")
124
+ end
125
+ application.add_action(action)
126
+ end
127
+ application.set_accels_for_action("app.quit", ["<Control>Q"])
128
+ end
129
+ signal_connect "activate" do |application|
130
+ window = ExampleAppWindow.new(application)
131
+ window.present
132
+ end
133
+ signal_connect "open" do |application, files, hint|
134
+ window = application.windows[0] || ExampleAppWindow.new(application)
135
+ files.each do |file|
136
+ window.open(file)
137
+ end
138
+ window.present
139
+ end
140
+ end
141
+
142
+ private
143
+
144
+ def preferences_activated
145
+ end
146
+
147
+ def quit_activated
148
+ quit
149
+ end
150
+ end
151
+
152
+ app = ExampleApp.new
153
+
154
+ # Gtk::Application#run needs C style argv ([prog, arg1, arg2, ...,argn]).
155
+ # The ARGV ruby variable only contains the arguments ([arg1, arg2, ...,argb])
156
+ # and not the program name. We have to add it explicitly.
157
+
158
+ app.run([$PROGRAM_NAME] + ARGV)
@@ -0,0 +1,30 @@
1
+ # Step 5: Add a GSettings object
2
+
3
+ The original files are located in the following directory.
4
+
5
+ - https://gitlab.gnome.org/GNOME/gtk/-/blob/main/examples/application5
6
+
7
+ The original schema file is [here](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/examples/application5/org.gtk.exampleapp.gschema.xml) and the license is LGPL 2.1 or later.
8
+
9
+ This program uses GSettings object of the GIO library.
10
+ You need to compile the schema file (`org.gtk.exampleapp.gschema.xml`) in advance.
11
+ The instruction is written in the `Rakefile`, so you just run `rake` to compile it.
12
+
13
+ ```console
14
+ $ cd gtk4/sample/examples/application5
15
+ $ rake
16
+ ```
17
+
18
+ The Ruby script `exampleapp.rb` works with `gschemas.compiled`.
19
+
20
+ ```console
21
+ $ ruby exampleapp.rb README.md Rakefile
22
+ ```
23
+
24
+ You will see the contents of the two files `README.md` and `Rakefile` in the window.
25
+
26
+ If you want to remove `gschemas.compiled`, do like this:
27
+
28
+ ```console
29
+ $ rake clean
30
+ ```
@@ -0,0 +1,27 @@
1
+ # Copyright (C) 2023 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
+ require "rake/clean"
18
+
19
+ task :default => "gschemas.compiled"
20
+
21
+ file "gschemas.compiled" => "org.gtk.exampleapp.gschema.xml" do
22
+ sh("glib-compile-schemas", ".")
23
+ end
24
+
25
+ CLEAN << "gschemas.compiled"
26
+
27
+ task :clean