gir_ffi-gtk 0.15.0 → 0.15.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/Changelog.md +6 -0
  3. data/lib/gir_ffi-gtk/base.rb +3 -3
  4. data/lib/gir_ffi-gtk/file_chooser_dialog.rb +4 -0
  5. data/lib/gir_ffi-gtk/gtk2/menu.rb +8 -9
  6. data/lib/gir_ffi-gtk/message_dialog.rb +1 -1
  7. data/lib/gir_ffi-gtk/tree_path.rb +1 -1
  8. data/lib/gir_ffi-gtk/version.rb +5 -0
  9. data/lib/gir_ffi-gtk2.rb +22 -21
  10. data/lib/gir_ffi-gtk3.rb +18 -17
  11. metadata +89 -68
  12. data/Rakefile +0 -10
  13. data/examples/01_empty_window.rb +0 -12
  14. data/examples/02_hello_world.rb +0 -27
  15. data/examples/03_upgraded_hello_world.rb +0 -40
  16. data/examples/04_webkit.rb +0 -18
  17. data/examples/05_notification.rb +0 -33
  18. data/examples/06_treeview.rb +0 -51
  19. data/examples/07_simple_gtk_application.rb +0 -30
  20. data/examples/08_webkit_headless.rb +0 -21
  21. data/examples/09_webkit2_headless.rb +0 -24
  22. data/examples/10_completion_provider.rb +0 -62
  23. data/tasks/test.rake +0 -30
  24. data/test/callback_exceptions_test.rb +0 -56
  25. data/test/gir_ffi-gtk/action_test.rb +0 -19
  26. data/test/gir_ffi-gtk/base_test.rb +0 -49
  27. data/test/gir_ffi-gtk/builder_test.rb +0 -72
  28. data/test/gir_ffi-gtk/button_test.rb +0 -21
  29. data/test/gir_ffi-gtk/container_test.rb +0 -35
  30. data/test/gir_ffi-gtk/dialog_test.rb +0 -15
  31. data/test/gir_ffi-gtk/file_chooser_dialog_test.rb +0 -20
  32. data/test/gir_ffi-gtk/generated_gtk_test.rb +0 -60
  33. data/test/gir_ffi-gtk/image_test.rb +0 -45
  34. data/test/gir_ffi-gtk/list_store_test.rb +0 -40
  35. data/test/gir_ffi-gtk/menu_test.rb +0 -12
  36. data/test/gir_ffi-gtk/message_dialog_test.rb +0 -17
  37. data/test/gir_ffi-gtk/radio_action_test.rb +0 -30
  38. data/test/gir_ffi-gtk/radio_button_test.rb +0 -39
  39. data/test/gir_ffi-gtk/target_entry_test.rb +0 -21
  40. data/test/gir_ffi-gtk/tree_path_test.rb +0 -19
  41. data/test/gir_ffi-gtk/tree_store_test.rb +0 -40
  42. data/test/gir_ffi-gtk/tree_view_column_test.rb +0 -53
  43. data/test/gir_ffi-gtk/widget_test.rb +0 -105
  44. data/test/test_helper.rb +0 -38
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8d45b72cccc0ec948d74f745d823939e5ac7e48ae69d68ff5c97ddf43b39ec01
4
- data.tar.gz: a5249e2bfc4c7473f7bd52c52f8de200f5fa126a07fb53e2b95a0294ef5dacaf
3
+ metadata.gz: 0f8204b8f178dd3105a669419cde269dce4c4ef0ab197a4013751f85fc03c681
4
+ data.tar.gz: d2e212b732094a2a3b769aa6bd08e7ae215ab165b3f0eb5ea18e1348a819d7c0
5
5
  SHA512:
6
- metadata.gz: 74415a42a27ea38dd77dedcbfeb2e429f8c41cd702d9ddcfeb7763c0722a2d40d6c997c0887f2279e86ef98ca298ee899bdc113e795eb4aea0c408148b47b3ef
7
- data.tar.gz: b24ee409eaca856b8c3662fad01b85cecf95cc74add4c9b50dc8dbebebceda61cb74c83407df3e8570891fc7405e5fec92d9d131de1bd379f5b3c310e1acd6e5
6
+ metadata.gz: 0f3b6997995a646ae826954fe25bdcac1c4f3b6687aed8986478a9770ecfb6b22b1ecc7a05149e36f1af86fc4818f850cfd80d688ee3e3d8d9b01a13ac8e1bc8
7
+ data.tar.gz: 3d71a088f9ba042372aeb71e5f0e00671ca64090237176254871026f2eb2d35821db9d91b3143c33e6f21d4487461cfd4a16986b09bdad8d9b72ee96c97ddb2f
data/Changelog.md CHANGED
@@ -3,6 +3,12 @@
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.15.1 / 2022-01-21
7
+
8
+ * Silence warnings about redefining initialize in FileChooserDialog override
9
+ * Depend on GirFFI 0.15.2
10
+ * Target Ruby 2.6+
11
+
6
12
  ## 0.15.0 / 2019-10-19
7
13
 
8
14
  * Fix override for `Gtk::Menu#popup`
@@ -43,7 +43,7 @@ module GirFFIGtk
43
43
  # Implementation of class methods for MainLoopOverride
44
44
  module ClassMethods
45
45
  def main_with_override
46
- GLib::MainLoop::ThreadEnabler.instance.setup_idle_handler if RUBY_ENGINE == 'ruby'
46
+ GLib::MainLoop::ThreadEnabler.instance.setup_idle_handler if RUBY_ENGINE == "ruby"
47
47
  GLib::MainLoop::RUNNING_LOOPS << DummyLoop.new
48
48
  result = main_without_override
49
49
  ex = GLib::MainLoop::EXCEPTIONS.shift
@@ -58,8 +58,8 @@ end
58
58
 
59
59
  # Overrides for Gtk module functions
60
60
  module Gtk
61
- setup_method! 'init'
62
- setup_method! 'main'
61
+ setup_method! "init"
62
+ setup_method! "main"
63
63
 
64
64
  include GirFFIGtk::AutoArgv
65
65
  include GirFFIGtk::MainLoopOverride
@@ -19,6 +19,8 @@ module Gtk
19
19
  obj
20
20
  end
21
21
 
22
+ alias old_initialize initialize
23
+
22
24
  def initialize(title, parent, action, buttons)
23
25
  button_params = buttons.flat_map do |button_text, button_response|
24
26
  [:string, button_text, :int, Gtk::ResponseType.to_int(button_response)]
@@ -27,5 +29,7 @@ module Gtk
27
29
  *button_params, :string, nil)
28
30
  store_pointer(ptr)
29
31
  end
32
+
33
+ remove_method :old_initialize
30
34
  end
31
35
  end
@@ -7,21 +7,20 @@ module Gtk
7
7
  attach_function(:gtk_menu_popup,
8
8
  [:pointer, :pointer, :pointer,
9
9
  :pointer, :pointer,
10
- :uint, :uint32 ],
10
+ :uint, :uint32],
11
11
  :void)
12
12
  end
13
13
 
14
14
  # Overrides for GtkMenu
15
15
  class Menu
16
16
  def popup(parent_menu_shell, parent_menu_item, button, activate_time, &func)
17
- _v1 = Gtk::Widget.from(parent_menu_shell)
18
- _v2 = Gtk::Widget.from(parent_menu_item)
19
- _v3 = Gtk::MenuPositionFunc.from(func)
20
- _v4 = GirFFI::ArgHelper.store(_v3)
21
- _v5 = button
22
- _v6 = activate_time
23
- Gtk::Lib.gtk_menu_popup self, _v1, _v2, _v3, _v4, _v5, _v6
17
+ v1 = Gtk::Widget.from(parent_menu_shell)
18
+ v2 = Gtk::Widget.from(parent_menu_item)
19
+ v3 = Gtk::MenuPositionFunc.from(func)
20
+ v4 = GirFFI::ArgHelper.store(v3)
21
+ v5 = button
22
+ v6 = activate_time
23
+ Gtk::Lib.gtk_menu_popup self, v1, v2, v3, v4, v5, v6
24
24
  end
25
25
  end
26
26
  end
27
-
@@ -19,7 +19,7 @@ module Gtk
19
19
 
20
20
  def initialize(parent, flags, type, buttons, message)
21
21
  ptr = Gtk::Lib.gtk_message_dialog_new(parent, flags, type, buttons,
22
- '%s',
22
+ "%s",
23
23
  :string, message)
24
24
  store_pointer(ptr)
25
25
  end
@@ -26,7 +26,7 @@ module Gtk
26
26
  end
27
27
 
28
28
  if Gtk::MAJOR_VERSION == 2
29
- setup_instance_method! 'get_indices'
29
+ setup_instance_method! "get_indices"
30
30
  remove_method :get_indices
31
31
 
32
32
  def get_indices
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module GirFFIGtk
4
+ VERSION = "0.15.1"
5
+ end
data/lib/gir_ffi-gtk2.rb CHANGED
@@ -1,27 +1,28 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'gir_ffi'
3
+ require "gir_ffi"
4
4
 
5
- GirFFI.setup :Gtk, '2.0'
5
+ GirFFI.setup :Gtk, "2.0"
6
6
 
7
- require 'gir_ffi-gtk/base'
7
+ require "gir_ffi-gtk/base"
8
+ require "gir_ffi-gtk/version"
8
9
 
9
- require 'gir_ffi-gtk/action'
10
- require 'gir_ffi-gtk/builder'
11
- require 'gir_ffi-gtk/container'
12
- require 'gir_ffi-gtk/dialog'
13
- require 'gir_ffi-gtk/file_chooser_dialog'
14
- require 'gir_ffi-gtk/image'
15
- require 'gir_ffi-gtk/list_store'
16
- require 'gir_ffi-gtk/message_dialog'
17
- require 'gir_ffi-gtk/tree_path'
18
- require 'gir_ffi-gtk/tree_store'
19
- require 'gir_ffi-gtk/tree_view_column'
20
- require 'gir_ffi-gtk/widget'
10
+ require "gir_ffi-gtk/action"
11
+ require "gir_ffi-gtk/builder"
12
+ require "gir_ffi-gtk/container"
13
+ require "gir_ffi-gtk/dialog"
14
+ require "gir_ffi-gtk/file_chooser_dialog"
15
+ require "gir_ffi-gtk/image"
16
+ require "gir_ffi-gtk/list_store"
17
+ require "gir_ffi-gtk/message_dialog"
18
+ require "gir_ffi-gtk/tree_path"
19
+ require "gir_ffi-gtk/tree_store"
20
+ require "gir_ffi-gtk/tree_view_column"
21
+ require "gir_ffi-gtk/widget"
21
22
 
22
- require 'gir_ffi-gtk/gtk2/list_store'
23
- require 'gir_ffi-gtk/gtk2/menu'
24
- require 'gir_ffi-gtk/gtk2/radio_action'
25
- require 'gir_ffi-gtk/gtk2/radio_button'
26
- require 'gir_ffi-gtk/gtk2/target_entry'
27
- require 'gir_ffi-gtk/gtk2/tree_store'
23
+ require "gir_ffi-gtk/gtk2/list_store"
24
+ require "gir_ffi-gtk/gtk2/menu"
25
+ require "gir_ffi-gtk/gtk2/radio_action"
26
+ require "gir_ffi-gtk/gtk2/radio_button"
27
+ require "gir_ffi-gtk/gtk2/target_entry"
28
+ require "gir_ffi-gtk/gtk2/tree_store"
data/lib/gir_ffi-gtk3.rb CHANGED
@@ -1,23 +1,24 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'gir_ffi'
3
+ require "gir_ffi"
4
4
 
5
- GirFFI.setup :Gtk, '3.0'
5
+ GirFFI.setup :Gtk, "3.0"
6
6
 
7
- require 'gir_ffi-gtk/base'
7
+ require "gir_ffi-gtk/base"
8
+ require "gir_ffi-gtk/version"
8
9
 
9
- require 'gir_ffi-gtk/action'
10
- require 'gir_ffi-gtk/builder'
11
- require 'gir_ffi-gtk/container'
12
- require 'gir_ffi-gtk/dialog'
13
- require 'gir_ffi-gtk/file_chooser_dialog'
14
- require 'gir_ffi-gtk/image'
15
- require 'gir_ffi-gtk/list_store'
16
- require 'gir_ffi-gtk/message_dialog'
17
- require 'gir_ffi-gtk/tree_path'
18
- require 'gir_ffi-gtk/tree_store'
19
- require 'gir_ffi-gtk/tree_view_column'
20
- require 'gir_ffi-gtk/widget'
10
+ require "gir_ffi-gtk/action"
11
+ require "gir_ffi-gtk/builder"
12
+ require "gir_ffi-gtk/container"
13
+ require "gir_ffi-gtk/dialog"
14
+ require "gir_ffi-gtk/file_chooser_dialog"
15
+ require "gir_ffi-gtk/image"
16
+ require "gir_ffi-gtk/list_store"
17
+ require "gir_ffi-gtk/message_dialog"
18
+ require "gir_ffi-gtk/tree_path"
19
+ require "gir_ffi-gtk/tree_store"
20
+ require "gir_ffi-gtk/tree_view_column"
21
+ require "gir_ffi-gtk/widget"
21
22
 
22
- require 'gir_ffi-gtk/gtk3/button'
23
- require 'gir_ffi-gtk/gtk3/target_entry'
23
+ require "gir_ffi-gtk/gtk3/button"
24
+ require "gir_ffi-gtk/gtk3/target_entry"
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.15.0
4
+ version: 0.15.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matijs van Zuijlen
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-10-19 00:00:00.000000000 Z
11
+ date: 2022-01-21 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.15.0
19
+ version: 0.15.2
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.15.0
26
+ version: 0.15.2
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: minitest
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -53,19 +53,89 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: '13.0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: rr
56
+ name: rake-manifest
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '1.1'
61
+ version: 0.2.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: '1.1'
68
+ version: 0.2.0
69
+ - !ruby/object:Gem::Dependency
70
+ name: rubocop
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 1.25.0
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 1.25.0
83
+ - !ruby/object:Gem::Dependency
84
+ name: rubocop-minitest
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 0.17.0
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 0.17.0
97
+ - !ruby/object:Gem::Dependency
98
+ name: rubocop-packaging
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: 0.5.0
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: 0.5.0
111
+ - !ruby/object:Gem::Dependency
112
+ name: rubocop-performance
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: 1.13.0
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: 1.13.0
125
+ - !ruby/object:Gem::Dependency
126
+ name: simplecov
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: 0.21.0
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: 0.21.0
69
139
  description: Bindings for Gtk+ 2 and 3, generated by GirFFI, with overrides.
70
140
  email:
71
141
  - matijs@matijs.net
@@ -76,17 +146,6 @@ files:
76
146
  - COPYING.LIB
77
147
  - Changelog.md
78
148
  - README.md
79
- - Rakefile
80
- - examples/01_empty_window.rb
81
- - examples/02_hello_world.rb
82
- - examples/03_upgraded_hello_world.rb
83
- - examples/04_webkit.rb
84
- - examples/05_notification.rb
85
- - examples/06_treeview.rb
86
- - examples/07_simple_gtk_application.rb
87
- - examples/08_webkit_headless.rb
88
- - examples/09_webkit2_headless.rb
89
- - examples/10_completion_provider.rb
90
149
  - lib/gir_ffi-gtk/action.rb
91
150
  - lib/gir_ffi-gtk/base.rb
92
151
  - lib/gir_ffi-gtk/builder.rb
@@ -107,36 +166,19 @@ files:
107
166
  - lib/gir_ffi-gtk/tree_path.rb
108
167
  - lib/gir_ffi-gtk/tree_store.rb
109
168
  - lib/gir_ffi-gtk/tree_view_column.rb
169
+ - lib/gir_ffi-gtk/version.rb
110
170
  - lib/gir_ffi-gtk/widget.rb
111
171
  - lib/gir_ffi-gtk2.rb
112
172
  - lib/gir_ffi-gtk3.rb
113
- - tasks/test.rake
114
- - test/callback_exceptions_test.rb
115
- - test/gir_ffi-gtk/action_test.rb
116
- - test/gir_ffi-gtk/base_test.rb
117
- - test/gir_ffi-gtk/builder_test.rb
118
- - test/gir_ffi-gtk/button_test.rb
119
- - test/gir_ffi-gtk/container_test.rb
120
- - test/gir_ffi-gtk/dialog_test.rb
121
- - test/gir_ffi-gtk/file_chooser_dialog_test.rb
122
- - test/gir_ffi-gtk/generated_gtk_test.rb
123
- - test/gir_ffi-gtk/image_test.rb
124
- - test/gir_ffi-gtk/list_store_test.rb
125
- - test/gir_ffi-gtk/menu_test.rb
126
- - test/gir_ffi-gtk/message_dialog_test.rb
127
- - test/gir_ffi-gtk/radio_action_test.rb
128
- - test/gir_ffi-gtk/radio_button_test.rb
129
- - test/gir_ffi-gtk/target_entry_test.rb
130
- - test/gir_ffi-gtk/tree_path_test.rb
131
- - test/gir_ffi-gtk/tree_store_test.rb
132
- - test/gir_ffi-gtk/tree_view_column_test.rb
133
- - test/gir_ffi-gtk/widget_test.rb
134
- - test/test_helper.rb
135
173
  homepage: http://www.github.com/mvz/gir_ffi-gtk
136
174
  licenses:
137
175
  - LGPL-2.1+
138
- metadata: {}
139
- post_install_message:
176
+ metadata:
177
+ homepage_uri: http://www.github.com/mvz/gir_ffi-gtk
178
+ source_code_uri: https://github.com/mvz/gir_ffi-gtk
179
+ changelog_uri: https://github.com/mvz/gir_ffi-gtk/blob/master/Changelog.md
180
+ rubygems_mfa_required: 'true'
181
+ post_install_message:
140
182
  rdoc_options: []
141
183
  require_paths:
142
184
  - lib
@@ -144,36 +186,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
144
186
  requirements:
145
187
  - - ">="
146
188
  - !ruby/object:Gem::Version
147
- version: 2.4.0
189
+ version: 2.6.0
148
190
  required_rubygems_version: !ruby/object:Gem::Requirement
149
191
  requirements:
150
192
  - - ">="
151
193
  - !ruby/object:Gem::Version
152
194
  version: '0'
153
195
  requirements: []
154
- rubygems_version: 3.0.6
155
- signing_key:
196
+ rubygems_version: 3.3.3
197
+ signing_key:
156
198
  specification_version: 4
157
199
  summary: GirFFI-based Ruby bindings for Gtk+ 2 and 3
158
- test_files:
159
- - test/callback_exceptions_test.rb
160
- - test/gir_ffi-gtk/action_test.rb
161
- - test/gir_ffi-gtk/base_test.rb
162
- - test/gir_ffi-gtk/builder_test.rb
163
- - test/gir_ffi-gtk/button_test.rb
164
- - test/gir_ffi-gtk/container_test.rb
165
- - test/gir_ffi-gtk/dialog_test.rb
166
- - test/gir_ffi-gtk/file_chooser_dialog_test.rb
167
- - test/gir_ffi-gtk/generated_gtk_test.rb
168
- - test/gir_ffi-gtk/image_test.rb
169
- - test/gir_ffi-gtk/list_store_test.rb
170
- - test/gir_ffi-gtk/menu_test.rb
171
- - test/gir_ffi-gtk/message_dialog_test.rb
172
- - test/gir_ffi-gtk/radio_action_test.rb
173
- - test/gir_ffi-gtk/radio_button_test.rb
174
- - test/gir_ffi-gtk/target_entry_test.rb
175
- - test/gir_ffi-gtk/tree_path_test.rb
176
- - test/gir_ffi-gtk/tree_store_test.rb
177
- - test/gir_ffi-gtk/tree_view_column_test.rb
178
- - test/gir_ffi-gtk/widget_test.rb
179
- - test/test_helper.rb
200
+ test_files: []
data/Rakefile DELETED
@@ -1,10 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'bundler/gem_helper'
4
- require 'rake/clean'
5
-
6
- Bundler::GemHelper.install_tasks
7
-
8
- load 'tasks/test.rake'
9
-
10
- task default: :test
@@ -1,12 +0,0 @@
1
- #!/usr/bin/env ruby
2
- #
3
- # Based on the empty window Gtk+ tutorial example at
4
- # http://library.gnome.org/devel/gtk-tutorial/2.90/c39.html
5
- #
6
- require 'gir_ffi-gtk3'
7
-
8
- Gtk.init
9
- win = Gtk::Window.new :toplevel
10
- win.show
11
- win.signal_connect("destroy") { Gtk.main_quit }
12
- Gtk.main
@@ -1,27 +0,0 @@
1
- #!/usr/bin/env ruby
2
- #
3
- # Based on the 'Hello world' Gtk+ tutorial example at
4
- # http://library.gnome.org/devel/gtk-tutorial/2.90/c39.html#SEC-HELLOWORLD
5
- #
6
- require 'gir_ffi-gtk3'
7
-
8
- Gtk.init
9
-
10
- win = Gtk::Window.new(:toplevel)
11
- win.signal_connect "delete-event" do
12
- puts "delete event occured"
13
- true
14
- end
15
-
16
- win.signal_connect("destroy") { Gtk.main_quit }
17
- win.border_width = 10
18
-
19
- but = Gtk::Button.new_with_label("Hello World")
20
- but.signal_connect("clicked") { win.destroy }
21
-
22
- win.add but
23
-
24
- but.show
25
- win.show
26
-
27
- Gtk.main
@@ -1,40 +0,0 @@
1
- #!/usr/bin/env ruby
2
- #
3
- # Based on the 'Upgraded Hello world' Gtk+ tutorial example at
4
- # http://library.gnome.org/devel/gtk-tutorial/2.90/x344.html
5
- #
6
- require 'gir_ffi-gtk3'
7
-
8
- callback = lambda { |widget, data|
9
- puts "Hello again - #{data} was pressed"
10
- }
11
-
12
- Gtk.init
13
-
14
- win = Gtk::Window.new(:toplevel)
15
- win.title= "Hello Buttons!"
16
-
17
- win.signal_connect "delete-event" do
18
- Gtk.main_quit
19
- false
20
- end
21
-
22
- win.border_width = 10
23
-
24
- box = Gtk::HBox.new(false, 0)
25
- win.add box
26
-
27
- button = Gtk::Button.new_with_label("Button 1")
28
- button.signal_connect "clicked", "button 1", &callback
29
- box.pack_start button, true, true, 0
30
- button.show
31
-
32
- button = Gtk::Button.new_with_label("Button 2")
33
- button.signal_connect "clicked", "button 2", &callback
34
- box.pack_start button, true, true, 0
35
- button.show
36
-
37
- box.show
38
- win.show
39
-
40
- Gtk.main
@@ -1,18 +0,0 @@
1
- #!/usr/bin/env ruby
2
- #
3
- # Based on https://web.archive.org/web/20110228141616/http://www.idle-hacking.com/2010/02/webkit-ruby-and-gtk/
4
- #
5
-
6
- require 'gir_ffi-gtk3'
7
-
8
- GirFFI.setup :WebKit2, '4.0'
9
-
10
- Gtk.init
11
-
12
- win = Gtk::Window.new :toplevel
13
- wv = WebKit2::WebView.new
14
- win.add(wv)
15
- win.show_all
16
- wv.load_uri('http://www.google.com/')
17
- win.signal_connect('destroy') { Gtk.main_quit }
18
- Gtk.main
@@ -1,33 +0,0 @@
1
- #!/usr/bin/env ruby
2
- #
3
- # Simple notification example.
4
- require 'gir_ffi-gtk3'
5
-
6
- GirFFI.setup :Notify
7
-
8
- # Both Gtk and Notify need to be init'ed.
9
- Gtk.init
10
- Notify.init "notification test"
11
-
12
- # Basic set up of the notification.
13
- nf = Notify::Notification.new "Hello!", "Hi there.", "gtk-dialog-info"
14
- nf.timeout = 3000
15
- nf.urgency = :critical
16
-
17
- # Show a button 'Test' in the notification, with a callback function.
18
- nf.add_action("test", "Test") { |obj, action, user_data|
19
- puts "Action #{action} clicked."
20
- }
21
-
22
- # In this case, we want the program to end once the notification is gone,
23
- # but not before.
24
- nf.signal_connect("closed") {
25
- puts "Notification closed."
26
- Gtk.main_quit
27
- }
28
-
29
- # Show the notification.
30
- nf.show
31
-
32
- # Start a main loop to wait for the notification to be closed.
33
- Gtk.main
@@ -1,51 +0,0 @@
1
- #!/usr/bin/env ruby
2
- #
3
- $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib')
4
- require 'gir_ffi-gtk3'
5
-
6
- Gtk.init
7
-
8
-
9
- #Add window.
10
- win = Gtk::Window.new(:toplevel)
11
- win.resize(640, 480)
12
- win.signal_connect("destroy") { Gtk.main_quit }
13
-
14
-
15
- #Add treeview.
16
- tv = Gtk::TreeView.new
17
-
18
-
19
- #Add store.
20
- ls = Gtk::ListStore.new([GObject::TYPE_STRING])
21
- tv.set_model(ls)
22
-
23
-
24
- #Add column.
25
- lab = Gtk::Label.new("Name")
26
- rend = Gtk::CellRendererText.new
27
-
28
- col = Gtk::TreeViewColumn.new
29
- col.set_widget(lab)
30
- col.pack_start(rend, true)
31
- col.add_attribute(rend, "text", 0)
32
-
33
- lab.show
34
-
35
- tv.append_column(col)
36
-
37
-
38
- #Add rows.
39
- iter = ls.append
40
- ls.set_value(iter, 0, "Kasper")
41
-
42
- iter = ls.append
43
- ls.set_value(iter, 0, "Christina")
44
-
45
-
46
- win.add tv
47
- tv.show
48
-
49
- win.show
50
-
51
- Gtk.main
@@ -1,30 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'gir_ffi-gtk3'
4
-
5
- myapp = Gtk::Application.new('org.gtk.example', :handles_command_line)
6
-
7
- myapp.signal_connect 'command-line' do |app, _command_line|
8
- app.activate
9
- 0
10
- end
11
-
12
- myapp.signal_connect 'activate' do |app|
13
- win = Gtk::ApplicationWindow.new(app)
14
- win.set_title('Gtk Application example')
15
- win.set_default_size(200, 200)
16
-
17
- button_box = Gtk::ButtonBox.new(:horizontal)
18
- win.add(button_box)
19
-
20
- button = Gtk::Button.new_with_label('Hello world')
21
- button.signal_connect 'clicked' do
22
- puts 'Hello World'
23
- app.quit
24
- end
25
-
26
- button_box.add(button)
27
- win.show_all
28
- end
29
-
30
- exit(myapp.run([$PROGRAM_NAME] + ARGV))