gir_ffi-gtk 0.13.1 → 0.14.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ff690307c8af4d785db6460b4944c73e7f80b0a5d51e58516d2bd18ad18b27cc
4
- data.tar.gz: c428003b8da3caa6e48f1b297c79f9c8482d8cbce82a1c05f0748572efa40af5
3
+ metadata.gz: 281f8a6888138d1e0202fb5db8c0ea53360554105b53d6406341178b0ed78b3f
4
+ data.tar.gz: 962bcd69122c211806c3080b338ab8149db749b4f2e05308054e8a427f5f3f1c
5
5
  SHA512:
6
- metadata.gz: e12f72f2b557f3e7b0ad3880775f4b9e1aacb34c7c9818f8c3c560d305a820bb50f5af9c69cd215c58d479aa60e7d4f7b15fca76a2a9e2291807b65c6d57fa1a
7
- data.tar.gz: 2ffba95ce0d0dbf4771321eec7da295d5febee23ca10593eecde56c1a584757d19bbee37fbe4e5f2f5971470e5f8c84042875cefd982ce0356526ce75e4d4266
6
+ metadata.gz: c22e681ac28ad88e51a77a6abe88537222d9efa0fe559fc5d697810adcfbc3d47aa090e8451f6fd6a93324ace8857805700211913e36da1ff46397ecae34816b
7
+ data.tar.gz: 196ec071a952298f9a9d71769325beb0fbbf696feff3425ffc5057bb6061323495fc8873ab8af905f9b97dffef70a915d4d2e0bfc9453b3f85b1794e4b8e7c95
@@ -3,10 +3,16 @@
3
3
  All notable changes to this project will be documented in this file. See the
4
4
  Git log for all changes.
5
5
 
6
+ ## 0.14.0 / 2018-09-27
7
+
8
+ * Depend on GirFFI 0.14.0
9
+ * Add override for `Gtk::Dialog.new_with_buttons`
10
+ * Add override for `Gtk::FileChooserDialog.new`
11
+
6
12
  ## 0.13.1 / 2018-09-24
7
13
 
8
14
  * Depend on GirFFI 0.13.1
9
- * Add overrides for some methods that take a Gtk::IconSize parameter
15
+ * Add overrides for some methods that take a `Gtk::IconSize` parameter
10
16
 
11
17
  ## 0.13.0 / 2018-09-08
12
18
 
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ Gtk.load_class :Dialog
4
+
5
+ module Gtk
6
+ # Add non-introspected function to Gtk::Lib
7
+ module Lib
8
+ attach_function :gtk_dialog_new_with_buttons, [:string,
9
+ :pointer,
10
+ Gtk::DialogFlags,
11
+ :varargs], :pointer
12
+ end
13
+
14
+ # Overrides for GtkDialog
15
+ class Dialog
16
+ def self.new_with_buttons(*args)
17
+ obj = allocate
18
+ obj.send :initialize_with_buttons, *args
19
+ obj
20
+ end
21
+
22
+ def initialize_with_buttons(title, parent, flags, buttons)
23
+ button_params = buttons.flat_map do |button_text, button_response|
24
+ [:string, button_text, :int, Gtk::ResponseType.to_int(button_response)]
25
+ end
26
+ ptr = Gtk::Lib.gtk_dialog_new_with_buttons(title, parent, flags,
27
+ *button_params, :string, nil)
28
+ store_pointer(ptr)
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ Gtk.load_class :FileChooserDialog
4
+
5
+ module Gtk
6
+ # Add non-introspected function to Gtk::Lib
7
+ module Lib
8
+ attach_function :gtk_file_chooser_dialog_new, [:string,
9
+ :pointer,
10
+ Gtk::FileChooserAction,
11
+ :varargs], :pointer
12
+ end
13
+
14
+ # Overrides for GtkFileChooserDialog
15
+ class FileChooserDialog
16
+ def self.new(*args)
17
+ obj = allocate
18
+ obj.send :initialize, *args
19
+ obj
20
+ end
21
+
22
+ def initialize(title, parent, action, buttons)
23
+ button_params = buttons.flat_map do |button_text, button_response|
24
+ [:string, button_text, :int, Gtk::ResponseType.to_int(button_response)]
25
+ end
26
+ ptr = Gtk::Lib.gtk_file_chooser_dialog_new(title, parent, action,
27
+ *button_params, :string, nil)
28
+ store_pointer(ptr)
29
+ end
30
+ end
31
+ end
@@ -9,6 +9,8 @@ require 'gir_ffi-gtk/base'
9
9
  require 'gir_ffi-gtk/action'
10
10
  require 'gir_ffi-gtk/builder'
11
11
  require 'gir_ffi-gtk/container'
12
+ require 'gir_ffi-gtk/dialog'
13
+ require 'gir_ffi-gtk/file_chooser_dialog'
12
14
  require 'gir_ffi-gtk/image'
13
15
  require 'gir_ffi-gtk/list_store'
14
16
  require 'gir_ffi-gtk/menu'
@@ -9,6 +9,8 @@ require 'gir_ffi-gtk/base'
9
9
  require 'gir_ffi-gtk/action'
10
10
  require 'gir_ffi-gtk/builder'
11
11
  require 'gir_ffi-gtk/container'
12
+ require 'gir_ffi-gtk/dialog'
13
+ require 'gir_ffi-gtk/file_chooser_dialog'
12
14
  require 'gir_ffi-gtk/image'
13
15
  require 'gir_ffi-gtk/list_store'
14
16
  require 'gir_ffi-gtk/menu'
@@ -0,0 +1,13 @@
1
+ require 'test_helper'
2
+
3
+ describe Gtk::Dialog do
4
+ describe '.new_with_buttons' do
5
+ it 'creates a Gtk::Dialog with the right title and buttons' do
6
+ dialog = Gtk::Dialog.new_with_buttons 'Foo', nil, :modal, [['Bar', :yes]]
7
+ dialog.title.must_equal 'Foo'
8
+ button = dialog.action_area.children.first
9
+ button.label.must_equal 'Bar'
10
+ dialog.response_for_widget(button).must_equal Gtk::ResponseType.to_int(:yes)
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,18 @@
1
+ require 'test_helper'
2
+
3
+ describe Gtk::FileChooserDialog do
4
+ describe '.new' do
5
+ it 'creates a Gtk::FileChooserDialog with the right attributes' do
6
+ dialog = Gtk::FileChooserDialog.new 'Foo', nil, :save, [['Bar', :yes]]
7
+ dialog.title.must_equal 'Foo'
8
+ dialog.action.must_equal :save
9
+ button = if Gtk::MAJOR_VERSION == 3 && Gtk::MINOR_VERSION >= 12
10
+ dialog.header_bar.children.to_a.last
11
+ else
12
+ dialog.action_area.children.to_a.last
13
+ end
14
+ button.label.must_equal 'Bar'
15
+ dialog.response_for_widget(button).must_equal Gtk::ResponseType.to_int(:yes)
16
+ end
17
+ end
18
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gir_ffi-gtk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.1
4
+ version: 0.14.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matijs van Zuijlen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-09-24 00:00:00.000000000 Z
11
+ date: 2018-09-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gir_ffi
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.13.1
19
+ version: 0.14.0
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: 0.13.1
26
+ version: 0.14.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: minitest
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -91,6 +91,8 @@ files:
91
91
  - lib/gir_ffi-gtk/base.rb
92
92
  - lib/gir_ffi-gtk/builder.rb
93
93
  - lib/gir_ffi-gtk/container.rb
94
+ - lib/gir_ffi-gtk/dialog.rb
95
+ - lib/gir_ffi-gtk/file_chooser_dialog.rb
94
96
  - lib/gir_ffi-gtk/gtk2/list_store.rb
95
97
  - lib/gir_ffi-gtk/gtk2/radio_action.rb
96
98
  - lib/gir_ffi-gtk/gtk2/radio_button.rb
@@ -114,6 +116,8 @@ files:
114
116
  - test/gir_ffi-gtk/builder_test.rb
115
117
  - test/gir_ffi-gtk/button_test.rb
116
118
  - test/gir_ffi-gtk/container_test.rb
119
+ - test/gir_ffi-gtk/dialog_test.rb
120
+ - test/gir_ffi-gtk/file_chooser_dialog_test.rb
117
121
  - test/gir_ffi-gtk/generated_gtk_test.rb
118
122
  - test/gir_ffi-gtk/image_test.rb
119
123
  - test/gir_ffi-gtk/list_store_test.rb
@@ -157,6 +161,8 @@ test_files:
157
161
  - test/gir_ffi-gtk/builder_test.rb
158
162
  - test/gir_ffi-gtk/button_test.rb
159
163
  - test/gir_ffi-gtk/container_test.rb
164
+ - test/gir_ffi-gtk/dialog_test.rb
165
+ - test/gir_ffi-gtk/file_chooser_dialog_test.rb
160
166
  - test/gir_ffi-gtk/generated_gtk_test.rb
161
167
  - test/gir_ffi-gtk/image_test.rb
162
168
  - test/gir_ffi-gtk/list_store_test.rb