gir_ffi-gtk 0.11.0 → 0.12.0

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
- SHA1:
3
- metadata.gz: 926702ce42eff09b08c56748b4b16a2a53b71225
4
- data.tar.gz: cfdd9c9c5f5fe243803928b65a63854f774c4318
2
+ SHA256:
3
+ metadata.gz: 70b8158b4866b624d8052257006e3e3679405b0de894644246d6a1dec4312c01
4
+ data.tar.gz: a3ae2ecaa38c55bd7bf54b58ba994ab801460183ad75de5b46f1becb892510c2
5
5
  SHA512:
6
- metadata.gz: c9f69fca003e0c4d653408f01f14d1944e10ad1edac7f74d343e3dc1323fce9c21f152c85d407e65ffa52427fd7f62cc0c97b795c42f2e62eb23375e06c1a8c2
7
- data.tar.gz: a551cb431b11d6e1c6d99e2522d1406b1e79f39f03349b163add05b2d6311ed9d5beb603ad7e4e237b3a744a7c77709139f407ddcaa0f3c9cbb3f1a08fe34ac7
6
+ metadata.gz: eb60974008d5b2801c2575889657577c62590c5b5ce5a135f09bd4d454571e7967c0715cfa11d48af4049d19bda9f1e1e0b75baf0b307d7d8d751f1005ef869b
7
+ data.tar.gz: 87f488e6f3af1297759e3d21b11fec168f7fe2c2758fac9ec69a324cd30c2e8d8901fa9b1c07f508ec8e4c7405ad59adbb2022dbaf16d39750368a75aedf8041
data/Changelog.md CHANGED
@@ -1,8 +1,13 @@
1
- # Change Log
1
+ # Changelog
2
2
 
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.12.0 / 2016-10-16
7
+
8
+ * Depend on GirFFI 0.12.0
9
+ * Drop support for Ruby versions below 2.3
10
+
6
11
  ## 0.11.0 / 2016-10-16
7
12
 
8
13
  * Depend on GirFFI 0.11.0
data/README.md CHANGED
@@ -46,7 +46,7 @@ and for Gtk+ 2:
46
46
 
47
47
  ## License
48
48
 
49
- Copyright © 2012–2016 [Matijs van Zuijlen](http://www.matijs.net)
49
+ Copyright © 2012–2017 [Matijs van Zuijlen](http://www.matijs.net)
50
50
 
51
51
  GirFFI-Gtk is free software, distributed under the terms of the GNU Lesser
52
52
  General Public License, version 2.1 or later. See the file COPYING.LIB for
data/Rakefile CHANGED
@@ -5,4 +5,4 @@ Bundler::GemHelper.install_tasks
5
5
 
6
6
  load 'tasks/test.rake'
7
7
 
8
- task :default => 'test'
8
+ task default: :test
@@ -15,9 +15,9 @@ nf.timeout = 3000
15
15
  nf.urgency = :critical
16
16
 
17
17
  # Show a button 'Test' in the notification, with a callback function.
18
- nf.add_action "test", "Test", Proc.new { |obj, action, user_data|
18
+ nf.add_action("test", "Test") { |obj, action, user_data|
19
19
  puts "Action #{action} clicked."
20
- }, nil, nil
20
+ }
21
21
 
22
22
  # In this case, we want the program to end once the notification is gone,
23
23
  # but not before.
@@ -0,0 +1,62 @@
1
+ require 'gir_ffi-gtk3'
2
+
3
+ # This is an example of creating a derived class with vfunc implementations.
4
+
5
+ GirFFI.setup :GtkSource
6
+
7
+ Gtk.init
8
+
9
+ class TestProvider < GObject::Object
10
+ include GtkSource::CompletionProvider
11
+
12
+ def get_name
13
+ 'Test Provider'
14
+ end
15
+
16
+ def get_priority
17
+ 1
18
+ end
19
+
20
+ def match(_context)
21
+ true
22
+ end
23
+
24
+ def populate(context)
25
+ icon = Gtk::IconTheme.get_default.load_icon(Gtk::STOCK_DIALOG_INFO, 16, 0)
26
+
27
+ proposals = [
28
+ GtkSource::CompletionItem.new("Proposal 1", "Proposal 1", icon, "blah 1"),
29
+ GtkSource::CompletionItem.new("Proposal 2", "Proposal 2", icon, "blah 2"),
30
+ GtkSource::CompletionItem.new("Proposal 3", "Proposal 3", icon, "blah 3"),
31
+ ]
32
+ context.add_proposals(self, proposals, true)
33
+ end
34
+ end
35
+
36
+ GirFFI.define_type TestProvider do |info|
37
+ info.install_vfunc_implementation :get_name
38
+ info.install_vfunc_implementation :get_priority
39
+ info.install_vfunc_implementation :match
40
+ info.install_vfunc_implementation :populate
41
+ end
42
+
43
+ win = Gtk::Window.new :toplevel
44
+ win.show
45
+ GObject.signal_connect(win, "destroy") { Gtk.main_quit }
46
+
47
+ vbox = Gtk::VBox.new(false, 0)
48
+ win.add vbox
49
+
50
+ lm = GtkSource::LanguageManager.get_default
51
+ lang = lm.get_language "ruby"
52
+ buffer = GtkSource::Buffer.new_with_language lang
53
+ @source = GtkSource::View.new_with_buffer buffer
54
+
55
+ test_provider = TestProvider.new
56
+ completion = @source.get_completion
57
+ completion.add_provider test_provider
58
+
59
+ vbox.pack_start @source, true, true, 0
60
+
61
+ win.show_all
62
+ Gtk.main
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module GirFFIGtk
2
4
  # Override init to automatically use ARGV as its argument.
3
5
  module AutoArgv
@@ -22,6 +24,8 @@ module GirFFIGtk
22
24
  # Override main to start an idle thread to allow Ruby threads to run during
23
25
  # the main loop, and to handle exceptions
24
26
  module MainLoopOverride
27
+ # Class to represent a loop-like interface to the main loop exception
28
+ # handing interface in GLib::MainLoop.
25
29
  class DummyLoop
26
30
  def quit
27
31
  Gtk.main_quit
@@ -39,12 +43,7 @@ module GirFFIGtk
39
43
  # Implementation of class methods for MainLoopOverride
40
44
  module ClassMethods
41
45
  def main_with_override
42
- case RUBY_ENGINE
43
- when 'jruby'
44
- when 'rbx'
45
- else # 'ruby' most likely
46
- GLib::MainLoop::ThreadEnabler.instance.setup_idle_handler
47
- end
46
+ GLib::MainLoop::ThreadEnabler.instance.setup_idle_handler if RUBY_ENGINE == 'ruby'
48
47
  GLib::MainLoop::RUNNING_LOOPS << DummyLoop.new
49
48
  result = main_without_override
50
49
  ex = GLib::MainLoop::EXCEPTIONS.shift
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  Gtk.load_class :Builder
2
4
  module Gtk
3
5
  # Overrides for GtkBuilder
@@ -17,7 +19,8 @@ module Gtk
17
19
  AFTER_FLAG = GObject::ConnectFlags[:after]
18
20
 
19
21
  def connect_signals
20
- connect_signals_full do |_builder, object, signal_name, handler_name, _connect_object, flags, _user_data|
22
+ # rubocop:disable Metrics/ParameterLists
23
+ connect_signals_full do |_, object, signal_name, handler_name, _, flags, _|
21
24
  handler = yield handler_name
22
25
  return unless handler
23
26
 
@@ -27,6 +30,7 @@ module Gtk
27
30
  object.signal_connect signal_name, &handler
28
31
  end
29
32
  end
33
+ # rubocop:enable Metrics/ParameterLists
30
34
  end
31
35
  end
32
36
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  Gtk.load_class :Container
2
4
  module Gtk
3
5
  # Overrides for GtkContainer
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  Gtk.load_class :ListStore
2
4
  module Gtk
3
5
  # Overrides for GtkListStore
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  Gtk.load_class :RadioAction
2
4
  module Gtk
3
5
  # Add non-introspected functions to Gtk::Lib
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  Gtk.load_class :RadioButton
2
4
  module Gtk
3
5
  # Add non-introspected functions to Gtk::Lib
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  Gtk.load_class :TargetEntry
2
4
  module Gtk
3
5
  # Overrides for GtkTargetEntry
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  Gtk.load_class :TreeStore
2
4
  module Gtk
3
5
  # Overrides for GtkTreeStore
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  Gtk.load_class :TargetEntry
2
4
  module Gtk
3
5
  # Overrides for GtkTargetEntry
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  Gtk.load_class :ListStore
2
4
  module Gtk
3
5
  # Overrides for GtkListStore
@@ -9,9 +11,7 @@ module Gtk
9
11
  setup_instance_method :set_value
10
12
 
11
13
  def set_value_with_value_conversion(iter, column, value)
12
- if value.nil?
13
- value = GObject::Value.for_gtype get_column_type(column)
14
- end
14
+ value = GObject::Value.for_gtype get_column_type(column) if value.nil?
15
15
  set_value_without_value_conversion iter, column, value
16
16
  end
17
17
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  Gtk.load_class :Menu
2
4
  module Gtk
3
5
  # Overrides for GtkMenu
@@ -11,6 +13,7 @@ module Gtk
11
13
  nil,
12
14
  button, activate_time)
13
15
  end
16
+ # rubocop:enable Metrics/ParameterLists
14
17
  end
15
18
  end
16
19
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  Gtk.load_class :MessageDialog
2
4
 
3
5
  module Gtk
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  Gtk.load_class :TreePath
2
4
  module Gtk
3
5
  # Add non-introspected function to Gtk::Lib
@@ -1,11 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  Gtk.load_class :TreeStore
2
4
  module Gtk
3
5
  # Overrides for GtkTreeStore
4
6
  class TreeStore
5
7
  def set_value_with_value_conversion(iter, column, value)
6
- if value.nil?
7
- value = GObject::Value.for_gtype get_column_type(column)
8
- end
8
+ value = GObject::Value.for_gtype get_column_type(column) if value.nil?
9
9
  set_value_without_value_conversion iter, column, value
10
10
  end
11
11
 
@@ -1,7 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  Gtk.load_class :TreeViewColumn
2
4
  module Gtk
3
5
  # Overrides for Gtk::TreeViewColumn
4
6
  class TreeViewColumn
7
+ setup_method :new
8
+
5
9
  def self.new_with_attributes(*args)
6
10
  obj = allocate
7
11
  obj.send :initialize_with_attributes, *args
data/lib/gir_ffi-gtk2.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'gir_ffi'
2
4
 
3
5
  GirFFI.setup :Gtk, '2.0'
data/lib/gir_ffi-gtk3.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'gir_ffi'
2
4
 
3
5
  GirFFI.setup :Gtk, '3.0'
data/tasks/test.rake CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'rake/testtask'
2
4
 
3
5
  namespace :test do
@@ -39,7 +39,7 @@ describe "In the generated Gtk module" do
39
39
  assert_instance_of Gtk::Button, o
40
40
  assert_equal "clicked", sn
41
41
  assert_equal "on_button_clicked", hn
42
- assert_equal nil, co
42
+ co.must_be_nil
43
43
  assert_equal 0, f
44
44
  ud.wont_be_nil
45
45
  end
@@ -32,7 +32,7 @@ describe Gtk::ListStore do
32
32
  store = Gtk::ListStore.new([GObject::TYPE_STRING, GObject::TYPE_INT])
33
33
  row = store.insert_with_values(0, [0, 1], ['foo', 42])
34
34
  store.set_value(row, 0, nil)
35
- store.get_value(row, 0).must_equal nil
35
+ store.get_value(row, 0).must_be_nil
36
36
  end
37
37
  end
38
38
  end
@@ -32,7 +32,7 @@ describe Gtk::TreeStore do
32
32
  store = Gtk::TreeStore.new([GObject::TYPE_STRING, GObject::TYPE_INT])
33
33
  row = store.insert_with_values(nil, 0, [0, 1], ['foo', 42])
34
34
  store.set_value(row, 0, nil)
35
- store.get_value(row, 0).must_equal nil
35
+ store.get_value(row, 0).must_be_nil
36
36
  end
37
37
  end
38
38
  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.11.0
4
+ version: 0.12.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: 2016-10-16 00:00:00.000000000 Z
11
+ date: 2018-03-25 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.11.0
19
+ version: 0.12.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.11.0
26
+ version: 0.12.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: minitest
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '11.1'
61
+ version: '12.0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '11.1'
68
+ version: '12.0'
69
69
  description: Bindings for Gtk+ 2 and 3, generated by GirFFI, with overrides.
70
70
  email:
71
71
  - matijs@matijs.net
@@ -86,6 +86,7 @@ files:
86
86
  - examples/07_simple_gtk_application.rb
87
87
  - examples/08_webkit_headless.rb
88
88
  - examples/09_webkit2_headless.rb
89
+ - examples/10_completion_provider.rb
89
90
  - lib/gir_ffi-gtk/base.rb
90
91
  - lib/gir_ffi-gtk/builder.rb
91
92
  - lib/gir_ffi-gtk/container.rb
@@ -131,7 +132,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
131
132
  requirements:
132
133
  - - ">="
133
134
  - !ruby/object:Gem::Version
134
- version: 2.0.0
135
+ version: 2.3.0
135
136
  required_rubygems_version: !ruby/object:Gem::Requirement
136
137
  requirements:
137
138
  - - ">="
@@ -139,7 +140,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
139
140
  version: '0'
140
141
  requirements: []
141
142
  rubyforge_project:
142
- rubygems_version: 2.5.1
143
+ rubygems_version: 2.7.6
143
144
  signing_key:
144
145
  specification_version: 4
145
146
  summary: GirFFI-based Ruby bindings for Gtk+ 2 and 3