gtk4 4.2.0 → 4.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ec9b10aa7054fab09d360709b7ca2c0fd0e705d3d12d0303e8e3eac7d68bfb43
4
- data.tar.gz: 54ed4b6d3dedbb1aac4de7a233a609bfe64041f4a2814275ddc53a5c5f5a335f
3
+ metadata.gz: ee3cc60156eca6c427677ae1510a7c9f09f9eaaccedc335e3ecd1d7c0d65f2ac
4
+ data.tar.gz: d6884900e2efae9edf179ccca61c067bade58ba008e8e566cde03224f7355b60
5
5
  SHA512:
6
- metadata.gz: bb2d32137980420631438e1ee528984c1260457fe0018575203d9deea5bd28452be8c74d75e65dab5526ccd47ae9f120a07b69c760add815d34abfb717ec2fc5
7
- data.tar.gz: '08a632bb2e7527d4cd4e9b33908ede6bb9858ba4655c7c5f13a872a69a8ac62c42d3948dfb8b7995ca295ee1e8a4758ccf85cac9f922da7f8d2b606624c35ff8'
6
+ metadata.gz: 5081feb21a29911f714a3fbed55830ecc3bbdbe1a27210d0106ac4ae2b8d62522371ab276ae3c5212ba7073d4db6d9999b36e6cdb6e60235136e7892fd61137a
7
+ data.tar.gz: d78d34de8d259e1c565a037fdd5363cfd56f4782f4d8dc72c2f046e851c63c309813bffd0c078561a9e3170220d6a030b4549bd8256ae9894b0faaef540fcd14
@@ -0,0 +1,36 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
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,
18
+ * MA 02110-1301 USA
19
+ */
20
+
21
+ #include "rb-gtk4-private.h"
22
+
23
+ static void
24
+ rb_gtk4_column_view_mark(gpointer object)
25
+ {
26
+ GtkSelectionModel *model = gtk_column_view_get_model(object);
27
+ if (model) {
28
+ rbgobj_gc_mark_instance(model);
29
+ }
30
+ }
31
+
32
+ void
33
+ rb_gtk4_column_view_init(void)
34
+ {
35
+ rbgobj_register_mark_func(GTK_TYPE_COLUMN_VIEW, rb_gtk4_column_view_mark);
36
+ }
@@ -0,0 +1,36 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
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,
18
+ * MA 02110-1301 USA
19
+ */
20
+
21
+ #include "rb-gtk4-private.h"
22
+
23
+ static void
24
+ rb_gtk4_image_mark(gpointer object)
25
+ {
26
+ GdkPaintable *paintable = gtk_image_get_paintable(object);
27
+ if (paintable) {
28
+ rbgobj_gc_mark_instance(paintable);
29
+ }
30
+ }
31
+
32
+ void
33
+ rb_gtk4_image_init(void)
34
+ {
35
+ rbgobj_register_mark_func(GTK_TYPE_IMAGE, rb_gtk4_image_mark);
36
+ }
@@ -0,0 +1,36 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
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,
18
+ * MA 02110-1301 USA
19
+ */
20
+
21
+ #include "rb-gtk4-private.h"
22
+
23
+ static void
24
+ rb_gtk4_picture_mark(gpointer object)
25
+ {
26
+ GdkPaintable *paintable = gtk_picture_get_paintable(object);
27
+ if (paintable) {
28
+ rbgobj_gc_mark_instance(paintable);
29
+ }
30
+ }
31
+
32
+ void
33
+ rb_gtk4_picture_init(void)
34
+ {
35
+ rbgobj_register_mark_func(GTK_TYPE_PICTURE, rb_gtk4_picture_mark);
36
+ }
@@ -1,6 +1,6 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
2
  /*
3
- * Copyright (C) 2022 Ruby-GNOME Project Team
3
+ * Copyright (C) 2022-2023 Ruby-GNOME Project Team
4
4
  *
5
5
  * This library is free software; you can redistribute it and/or
6
6
  * modify it under the terms of the GNU Lesser General Public
@@ -30,6 +30,10 @@
30
30
  #include "rb-gtk4.h"
31
31
 
32
32
  G_GNUC_INTERNAL void rb_gtk4_cell_layout_init(void);
33
+ G_GNUC_INTERNAL void rb_gtk4_column_view_init(void);
34
+ G_GNUC_INTERNAL void rb_gtk4_image_init(void);
35
+ G_GNUC_INTERNAL void rb_gtk4_picture_init(void);
36
+ G_GNUC_INTERNAL void rb_gtk4_single_selection_init(void);
33
37
  G_GNUC_INTERNAL void rb_gtk4_tree_view_init(void);
34
38
  G_GNUC_INTERNAL void rb_gtk4_widget_init(void);
35
39
  G_GNUC_INTERNAL void rb_gtk4_window_init(void);
@@ -0,0 +1,37 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
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,
18
+ * MA 02110-1301 USA
19
+ */
20
+
21
+ #include "rb-gtk4-private.h"
22
+
23
+ static void
24
+ rb_gtk4_single_selection_mark(gpointer object)
25
+ {
26
+ GListModel *model = gtk_single_selection_get_model(object);
27
+ if (model) {
28
+ rbgobj_gc_mark_instance(model);
29
+ }
30
+ }
31
+
32
+ void
33
+ rb_gtk4_single_selection_init(void)
34
+ {
35
+ rbgobj_register_mark_func(GTK_TYPE_SINGLE_SELECTION,
36
+ rb_gtk4_single_selection_mark);
37
+ }
data/ext/gtk4/rb-gtk4.c CHANGED
@@ -1,6 +1,6 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
2
  /*
3
- * Copyright (C) 2022 Ruby-GNOME Project Team
3
+ * Copyright (C) 2022-2023 Ruby-GNOME Project Team
4
4
  *
5
5
  * This library is free software; you can redistribute it and/or
6
6
  * modify it under the terms of the GNU Lesser General Public
@@ -24,6 +24,10 @@ void
24
24
  Init_gtk4(void)
25
25
  {
26
26
  rb_gtk4_cell_layout_init();
27
+ rb_gtk4_image_init();
28
+ rb_gtk4_column_view_init();
29
+ rb_gtk4_picture_init();
30
+ rb_gtk4_single_selection_init();
27
31
  rb_gtk4_tree_view_init();
28
32
  rb_gtk4_widget_init();
29
33
  rb_gtk4_window_init();
@@ -241,15 +241,15 @@ module Gtk
241
241
  define_deprecated_signal :released, :warn => "Use 'Gtk::Widget::button-release-event' signal."
242
242
  define_deprecated_method_by_hash_args :initialize,
243
243
  'label_or_stock_id, use_underline = nil',
244
- ':label => nil, :use_underline => nil, :stock_id => nil' do
245
- |_self, label_or_stock_id, use_underline|
246
- case label_or_stock_id
244
+ ':label => nil, :use_underline => nil, :icon_name: => nil' do
245
+ |_self, label_or_icon_name, use_underline|
246
+ case label_or_icon_name
247
247
  when String
248
- [{:label => label_or_stock_id, :use_underline => use_underline}]
248
+ [{label: label_or_icon_name, use_underline: use_underline}]
249
249
  when Symbol
250
- [{:stock_id => label_or_stock_id}]
250
+ [{icon_name: label_or_icon_name}]
251
251
  else
252
- [label_or_stock_id]
252
+ [label_or_icon_name]
253
253
  end
254
254
  end
255
255
  end
@@ -0,0 +1,29 @@
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
+ module Gtk
18
+ class DropTarget
19
+ alias_method :initialize_raw, :initialize
20
+ def initialize(type, actions)
21
+ if type.is_a?(Array)
22
+ initialize_raw(GLib::Type::INVALID, actions)
23
+ set_gtypes(type)
24
+ else
25
+ initialize_raw(type, actions)
26
+ end
27
+ end
28
+ end
29
+ end
data/lib/gtk4/loader.rb CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2014-2022 Ruby-GNOME 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
@@ -87,6 +87,7 @@ module Gtk
87
87
  require_relative "combo-box-text"
88
88
  require_relative "css-provider"
89
89
  require_relative "dialog"
90
+ require_relative "drop-target"
90
91
  require_relative "entry"
91
92
  require_relative "entry-buffer"
92
93
  require_relative "file-chooser-dialog"
@@ -0,0 +1,50 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # Copyright (C) 2020,2023 ToshioCP (Toshio Sekiya)
4
+ # Copyright (C) 2023 Ruby-GNOME2 Project Team
5
+ #
6
+ # This program is free software: you can redistribute it and/or modify
7
+ # it under the terms of the GNU General Public License as published by
8
+ # the Free Software Foundation, either version 3 of the License, or
9
+ # (at your option) any later version.
10
+ #
11
+ # This program is distributed in the hope that it will be useful,
12
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ # GNU General Public License for more details.
15
+ # You should have received a copy of the GNU General Public License
16
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
17
+
18
+ # Ruby implementation of the C example in:
19
+ # https://toshiocp.github.io/Gtk4-tutorial/sec17.html
20
+
21
+ require_relative "utils"
22
+
23
+ require_gtk4
24
+
25
+ app = Gtk::Application.new("org.gtk.example", :flags_none)
26
+
27
+ app.signal_connect "activate" do
28
+ window = Gtk::ApplicationWindow.new(app)
29
+ window.application = app
30
+
31
+ act_quit = Gio::SimpleAction.new("quit")
32
+ app.add_action(act_quit)
33
+ act_quit.signal_connect "activate" do |_simple_action, _parameter|
34
+ window.destroy
35
+ end
36
+
37
+ menubar = Gio::Menu.new
38
+ menu_item_menu = Gio::MenuItem.new("Menu")
39
+ menu = Gio::Menu.new
40
+ menu_item_quit = Gio::MenuItem.new("Quit", "app.quit")
41
+ menu.append_item(menu_item_quit)
42
+ menu_item_menu.submenu = menu
43
+ menubar.append_item(menu_item_menu)
44
+ app.menubar = menubar
45
+ window.show_menubar = true
46
+
47
+ window.show
48
+ end
49
+
50
+ app.run
@@ -35,7 +35,7 @@ When creating a Gtk::Application you need to pick an application identifier (a n
35
35
 
36
36
  Lastly `Gtk::Application#new` takes a `Gio::ApplicationFlags` constant as input for your application, if your application would have special needs (those constants can be replaced by theirs respective symbol ie. `Gio::ApplicationFlags::FLAGS_NONE` == `:flags_none`). You must know that `Gio:::Application` ignores arguments passed to `Gio::Application#run` on the Windows systems. It always uses command line arguments even when we pass an empty array to `Gio::Application#run`.
37
37
 
38
- If you plan to create a cross-platform application, it is recommanded to use the `:handles_command_line` flags and the *command-line* signal. (reference : https://github.com/ruby-gnome/ruby-gnome/issues/721 ).
38
+ If you plan to create a cross-platform application, it is recommended to use the `:handles_command_line` flags and the *command-line* signal. (reference : https://github.com/ruby-gnome/ruby-gnome/issues/721 ).
39
39
 
40
40
  Next we add instructions for the "activate" event of the `Gtk::Application` instance we created. The activate signal will be sent when your application is launched with the method `Gtk::Application#run` on the line below. This method also takes as arguments a ruby array of string. This allows GTK to parse specific command line arguments that control the behavior of GTK itself. Your application can override the command line handling, e.g. to open files passed on the commandline.
41
41
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gtk4
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.2.0
4
+ version: 4.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - The Ruby-GNOME Project Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-08-19 00:00:00.000000000 Z
11
+ date: 2024-02-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: atk
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 4.2.0
19
+ version: 4.2.1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 4.2.0
26
+ version: 4.2.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: gdk4
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 4.2.0
33
+ version: 4.2.1
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 4.2.0
40
+ version: 4.2.1
41
41
  description: Ruby/GTK4 is a Ruby binding of GTK+-4.x.
42
42
  email: ruby-gnome2-devel-en@lists.sourceforge.net
43
43
  executables: []
@@ -50,7 +50,11 @@ files:
50
50
  - Rakefile
51
51
  - ext/gtk4/extconf.rb
52
52
  - ext/gtk4/rb-gtk4-cell-layout.c
53
+ - ext/gtk4/rb-gtk4-column-view.c
54
+ - ext/gtk4/rb-gtk4-image.c
55
+ - ext/gtk4/rb-gtk4-picture.c
53
56
  - ext/gtk4/rb-gtk4-private.h
57
+ - ext/gtk4/rb-gtk4-single-selection.c
54
58
  - ext/gtk4/rb-gtk4-tree-view.c
55
59
  - ext/gtk4/rb-gtk4-widget.c
56
60
  - ext/gtk4/rb-gtk4-window.c
@@ -72,6 +76,7 @@ files:
72
76
  - lib/gtk4/css-provider.rb
73
77
  - lib/gtk4/deprecated.rb
74
78
  - lib/gtk4/dialog.rb
79
+ - lib/gtk4/drop-target.rb
75
80
  - lib/gtk4/entry-buffer.rb
76
81
  - lib/gtk4/entry.rb
77
82
  - lib/gtk4/file-chooser-dialog.rb
@@ -152,6 +157,7 @@ files:
152
157
  - sample/examples/drawing.rb
153
158
  - sample/examples/grid_packing.rb
154
159
  - sample/examples/hello_world.rb
160
+ - sample/examples/menubar.rb
155
161
  - sample/examples/utils.rb
156
162
  - sample/examples/window_default.rb
157
163
  - sample/getting-started/README.md
@@ -178,7 +184,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
178
184
  - !ruby/object:Gem::Version
179
185
  version: '0'
180
186
  requirements: []
181
- rubygems_version: 3.5.0.dev
187
+ rubygems_version: 3.5.1
182
188
  signing_key:
183
189
  specification_version: 4
184
190
  summary: Ruby/GTK4 is a Ruby binding of GTK+-4.x.