gir_ffi 0.9.2 → 0.9.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Changelog.md +7 -0
- data/Gemfile +2 -1
- data/README.md +6 -0
- data/TODO.md +1 -0
- data/examples/clutter.rb +106 -0
- data/examples/main_loop.rb +0 -8
- data/lib/ffi-glib/array.rb +1 -0
- data/lib/ffi-glib/array_methods.rb +1 -0
- data/lib/ffi-glib/byte_array.rb +1 -0
- data/lib/ffi-glib/bytes.rb +1 -0
- data/lib/ffi-glib/container_class_methods.rb +1 -0
- data/lib/ffi-glib/destroy_notify.rb +1 -0
- data/lib/ffi-glib/error.rb +1 -0
- data/lib/ffi-glib/hash_table.rb +2 -1
- data/lib/ffi-glib/iconv.rb +1 -0
- data/lib/ffi-glib/list.rb +1 -0
- data/lib/ffi-glib/list_methods.rb +1 -0
- data/lib/ffi-glib/main_loop.rb +1 -0
- data/lib/ffi-glib/ptr_array.rb +1 -0
- data/lib/ffi-glib/s_list.rb +1 -0
- data/lib/ffi-glib/strv.rb +1 -0
- data/lib/ffi-glib/variant.rb +1 -0
- data/lib/ffi-glib.rb +1 -0
- data/lib/ffi-gobject/base.rb +1 -0
- data/lib/ffi-gobject/closure.rb +1 -0
- data/lib/ffi-gobject/initially_unowned.rb +1 -0
- data/lib/ffi-gobject/object.rb +1 -0
- data/lib/ffi-gobject/object_class.rb +1 -0
- data/lib/ffi-gobject/ruby_closure.rb +1 -0
- data/lib/ffi-gobject/value.rb +1 -0
- data/lib/ffi-gobject.rb +1 -0
- data/lib/ffi-gobject_introspection/g_error.rb +1 -0
- data/lib/ffi-gobject_introspection/i_arg_info.rb +1 -0
- data/lib/ffi-gobject_introspection/i_base_info.rb +1 -0
- data/lib/ffi-gobject_introspection/i_callable_info.rb +5 -0
- data/lib/ffi-gobject_introspection/i_callback_info.rb +1 -0
- data/lib/ffi-gobject_introspection/i_constant_info.rb +1 -0
- data/lib/ffi-gobject_introspection/i_enum_info.rb +1 -0
- data/lib/ffi-gobject_introspection/i_field_info.rb +3 -2
- data/lib/ffi-gobject_introspection/i_flags_info.rb +1 -0
- data/lib/ffi-gobject_introspection/i_function_info.rb +7 -7
- data/lib/ffi-gobject_introspection/i_interface_info.rb +1 -0
- data/lib/ffi-gobject_introspection/i_object_info.rb +1 -0
- data/lib/ffi-gobject_introspection/i_property_info.rb +5 -4
- data/lib/ffi-gobject_introspection/i_registered_type_info.rb +1 -0
- data/lib/ffi-gobject_introspection/i_repository.rb +1 -0
- data/lib/ffi-gobject_introspection/i_signal_info.rb +1 -0
- data/lib/ffi-gobject_introspection/i_struct_info.rb +1 -0
- data/lib/ffi-gobject_introspection/i_type_info.rb +1 -0
- data/lib/ffi-gobject_introspection/i_union_info.rb +1 -0
- data/lib/ffi-gobject_introspection/i_unresolved_info.rb +1 -0
- data/lib/ffi-gobject_introspection/i_value_info.rb +1 -0
- data/lib/ffi-gobject_introspection/i_vfunc_info.rb +1 -0
- data/lib/ffi-gobject_introspection/lib.rb +27 -10
- data/lib/ffi-gobject_introspection.rb +1 -0
- data/lib/gir_ffi/allocation_helper.rb +1 -0
- data/lib/gir_ffi/arg_helper.rb +1 -0
- data/lib/gir_ffi/boxed_base.rb +1 -0
- data/lib/gir_ffi/builder.rb +1 -0
- data/lib/gir_ffi/builder_helper.rb +1 -0
- data/lib/gir_ffi/builders/argument_builder.rb +18 -6
- data/lib/gir_ffi/builders/argument_builder_collection.rb +24 -12
- data/lib/gir_ffi/builders/base_argument_builder.rb +1 -0
- data/lib/gir_ffi/builders/base_method_builder.rb +33 -9
- data/lib/gir_ffi/builders/base_type_builder.rb +1 -0
- data/lib/gir_ffi/builders/boxed_builder.rb +1 -0
- data/lib/gir_ffi/builders/c_to_ruby_convertor.rb +1 -0
- data/lib/gir_ffi/builders/callback_argument_builder.rb +5 -0
- data/lib/gir_ffi/builders/callback_builder.rb +2 -5
- data/lib/gir_ffi/builders/callback_return_value_builder.rb +1 -0
- data/lib/gir_ffi/builders/closure_argument_builder.rb +1 -0
- data/lib/gir_ffi/builders/closure_convertor.rb +1 -0
- data/lib/gir_ffi/builders/closure_return_value_builder.rb +1 -0
- data/lib/gir_ffi/builders/closure_to_pointer_convertor.rb +1 -0
- data/lib/gir_ffi/builders/constant_builder.rb +1 -0
- data/lib/gir_ffi/builders/constructor_builder.rb +2 -0
- data/lib/gir_ffi/builders/enum_builder.rb +2 -1
- data/lib/gir_ffi/builders/field_builder.rb +2 -0
- data/lib/gir_ffi/builders/flags_builder.rb +2 -1
- data/lib/gir_ffi/builders/full_c_to_ruby_convertor.rb +1 -0
- data/lib/gir_ffi/builders/function_builder.rb +2 -3
- data/lib/gir_ffi/builders/initializer_builder.rb +2 -3
- data/lib/gir_ffi/builders/initializer_return_value_builder.rb +1 -0
- data/lib/gir_ffi/builders/interface_builder.rb +1 -0
- data/lib/gir_ffi/builders/mapping_method_builder.rb +15 -37
- data/lib/gir_ffi/builders/marshalling_method_builder.rb +9 -26
- data/lib/gir_ffi/builders/method_template.rb +4 -3
- data/lib/gir_ffi/builders/module_builder.rb +2 -1
- data/lib/gir_ffi/builders/null_argument_builder.rb +1 -0
- data/lib/gir_ffi/builders/null_class_builder.rb +1 -0
- data/lib/gir_ffi/builders/null_convertor.rb +1 -0
- data/lib/gir_ffi/builders/null_return_value_builder.rb +1 -0
- data/lib/gir_ffi/builders/object_builder.rb +1 -0
- data/lib/gir_ffi/builders/property_builder.rb +1 -0
- data/lib/gir_ffi/builders/registered_type_builder.rb +1 -0
- data/lib/gir_ffi/builders/return_value_builder.rb +1 -0
- data/lib/gir_ffi/builders/ruby_to_c_convertor.rb +1 -0
- data/lib/gir_ffi/builders/signal_closure_builder.rb +2 -7
- data/lib/gir_ffi/builders/struct_builder.rb +1 -0
- data/lib/gir_ffi/builders/type_builder.rb +1 -0
- data/lib/gir_ffi/builders/unintrospectable_boxed_builder.rb +1 -0
- data/lib/gir_ffi/builders/unintrospectable_builder.rb +1 -0
- data/lib/gir_ffi/builders/union_builder.rb +1 -0
- data/lib/gir_ffi/builders/user_defined_builder.rb +1 -0
- data/lib/gir_ffi/builders/vfunc_argument_builder.rb +1 -0
- data/lib/gir_ffi/builders/vfunc_builder.rb +2 -9
- data/lib/gir_ffi/builders/with_layout.rb +1 -0
- data/lib/gir_ffi/callback_base.rb +1 -0
- data/lib/gir_ffi/class_base.rb +1 -0
- data/lib/gir_ffi/core.rb +1 -0
- data/lib/gir_ffi/enum_base.rb +1 -0
- data/lib/gir_ffi/error_argument_info.rb +1 -0
- data/lib/gir_ffi/error_type_info.rb +1 -0
- data/lib/gir_ffi/ffi_ext/pointer.rb +1 -0
- data/lib/gir_ffi/ffi_ext.rb +1 -0
- data/lib/gir_ffi/field_argument_info.rb +1 -0
- data/lib/gir_ffi/flags_base.rb +1 -0
- data/lib/gir_ffi/g_type.rb +1 -0
- data/lib/gir_ffi/glib_error.rb +1 -0
- data/lib/gir_ffi/in_out_pointer.rb +1 -0
- data/lib/gir_ffi/in_pointer.rb +1 -0
- data/lib/gir_ffi/info_ext/full_type_name.rb +1 -0
- data/lib/gir_ffi/info_ext/i_arg_info.rb +1 -0
- data/lib/gir_ffi/info_ext/i_callable_info.rb +1 -0
- data/lib/gir_ffi/info_ext/i_callback_info.rb +1 -0
- data/lib/gir_ffi/info_ext/i_field_info.rb +1 -0
- data/lib/gir_ffi/info_ext/i_function_info.rb +1 -0
- data/lib/gir_ffi/info_ext/i_property_info.rb +1 -0
- data/lib/gir_ffi/info_ext/i_registered_type_info.rb +1 -0
- data/lib/gir_ffi/info_ext/i_signal_info.rb +1 -0
- data/lib/gir_ffi/info_ext/i_type_info.rb +1 -1
- data/lib/gir_ffi/info_ext/i_unresolved_info.rb +1 -0
- data/lib/gir_ffi/info_ext/i_vfunc_info.rb +1 -0
- data/lib/gir_ffi/info_ext/safe_constant_name.rb +1 -0
- data/lib/gir_ffi/info_ext/safe_function_name.rb +1 -0
- data/lib/gir_ffi/info_ext.rb +1 -0
- data/lib/gir_ffi/interface_base.rb +1 -0
- data/lib/gir_ffi/lib_c.rb +1 -0
- data/lib/gir_ffi/method_stubber.rb +1 -0
- data/lib/gir_ffi/module_base.rb +1 -0
- data/lib/gir_ffi/object_base.rb +1 -0
- data/lib/gir_ffi/object_store.rb +1 -0
- data/lib/gir_ffi/property_not_found_error.rb +1 -0
- data/lib/gir_ffi/receiver_argument_info.rb +1 -0
- data/lib/gir_ffi/receiver_type_info.rb +1 -0
- data/lib/gir_ffi/registered_type_base.rb +1 -0
- data/lib/gir_ffi/return_value_info.rb +1 -0
- data/lib/gir_ffi/signal_not_found_error.rb +1 -0
- data/lib/gir_ffi/sized_array.rb +1 -0
- data/lib/gir_ffi/struct_base.rb +1 -0
- data/lib/gir_ffi/type_base.rb +1 -0
- data/lib/gir_ffi/type_map.rb +1 -0
- data/lib/gir_ffi/unintrospectable_signal_info.rb +1 -0
- data/lib/gir_ffi/unintrospectable_type_info.rb +1 -0
- data/lib/gir_ffi/union_base.rb +1 -0
- data/lib/gir_ffi/user_data_argument_info.rb +1 -0
- data/lib/gir_ffi/user_data_type_info.rb +1 -0
- data/lib/gir_ffi/user_defined_property_info.rb +1 -0
- data/lib/gir_ffi/user_defined_type_info.rb +1 -0
- data/lib/gir_ffi/variable_name_generator.rb +1 -0
- data/lib/gir_ffi/version.rb +1 -1
- data/lib/gir_ffi/vfunc_implementation.rb +1 -0
- data/lib/gir_ffi/zero_terminated.rb +1 -0
- data/lib/gir_ffi-base/glib/boolean.rb +1 -0
- data/lib/gir_ffi-base/glib/strv.rb +1 -0
- data/lib/gir_ffi-base/gobject/lib.rb +1 -0
- data/lib/gir_ffi-base/gobject.rb +1 -0
- data/lib/gir_ffi-base.rb +1 -0
- data/lib/gir_ffi.rb +1 -0
- data/test/base_test_helper.rb +1 -0
- data/test/ffi-glib/array_test.rb +1 -0
- data/test/ffi-glib/byte_array_test.rb +1 -0
- data/test/ffi-glib/bytes_test.rb +1 -0
- data/test/ffi-glib/destroy_notify_test.rb +1 -0
- data/test/ffi-glib/hash_table_test.rb +1 -0
- data/test/ffi-glib/iconv_test.rb +1 -0
- data/test/ffi-glib/list_test.rb +1 -0
- data/test/ffi-glib/main_loop_test.rb +1 -0
- data/test/ffi-glib/ptr_array_test.rb +1 -0
- data/test/ffi-glib/ruby_closure_test.rb +1 -0
- data/test/ffi-glib/s_list_test.rb +1 -0
- data/test/ffi-glib/strv_test.rb +1 -0
- data/test/ffi-glib/variant_test.rb +1 -0
- data/test/ffi-gobject/gobject_test.rb +1 -0
- data/test/ffi-gobject/object_class_test.rb +1 -0
- data/test/ffi-gobject/object_test.rb +1 -0
- data/test/ffi-gobject/value_test.rb +1 -0
- data/test/ffi-gobject_introspection/i_base_info_test.rb +1 -0
- data/test/ffi-gobject_introspection/i_constant_info_test.rb +1 -0
- data/test/ffi-gobject_introspection/i_enum_info_test.rb +1 -0
- data/test/ffi-gobject_introspection/i_function_info_test.rb +1 -0
- data/test/ffi-gobject_introspection/i_interface_info_test.rb +1 -0
- data/test/ffi-gobject_introspection/i_object_info_test.rb +1 -0
- data/test/ffi-gobject_introspection/i_property_info_test.rb +1 -0
- data/test/ffi-gobject_introspection/i_registered_type_info_test.rb +1 -0
- data/test/ffi-gobject_introspection/i_repository_test.rb +1 -0
- data/test/ffi-gobject_introspection/i_struct_info_test.rb +1 -0
- data/test/ffi-gobject_introspection/i_type_info_test.rb +1 -0
- data/test/ffi-gobject_introspection/i_union_info_test.rb +1 -0
- data/test/ffi-gobject_introspection/lib_test.rb +1 -0
- data/test/ffi-gobject_test.rb +1 -0
- data/test/gir_ffi/arg_helper_test.rb +1 -0
- data/test/gir_ffi/builder_test.rb +1 -0
- data/test/gir_ffi/builders/argument_builder_test.rb +17 -0
- data/test/gir_ffi/builders/base_argument_builder_test.rb +1 -0
- data/test/gir_ffi/builders/callback_argument_builder_test.rb +1 -0
- data/test/gir_ffi/builders/callback_builder_test.rb +1 -0
- data/test/gir_ffi/builders/callback_return_value_builder_test.rb +1 -0
- data/test/gir_ffi/builders/constant_builder_test.rb +1 -0
- data/test/gir_ffi/builders/constructor_builder_test.rb +1 -0
- data/test/gir_ffi/builders/enum_builder_test.rb +1 -0
- data/test/gir_ffi/builders/field_builder_test.rb +1 -0
- data/test/gir_ffi/builders/function_builder_test.rb +30 -1
- data/test/gir_ffi/builders/initializer_builder_test.rb +1 -0
- data/test/gir_ffi/builders/interface_builder_test.rb +1 -0
- data/test/gir_ffi/builders/module_builder_test.rb +1 -0
- data/test/gir_ffi/builders/object_builder_test.rb +1 -0
- data/test/gir_ffi/builders/property_builder_test.rb +1 -0
- data/test/gir_ffi/builders/registered_type_builder_test.rb +1 -0
- data/test/gir_ffi/builders/return_value_builder_test.rb +1 -0
- data/test/gir_ffi/builders/signal_closure_builder_test.rb +1 -0
- data/test/gir_ffi/builders/struct_builder_test.rb +1 -0
- data/test/gir_ffi/builders/unintrospectable_boxed_builder_test.rb +1 -0
- data/test/gir_ffi/builders/unintrospectable_builder_test.rb +1 -0
- data/test/gir_ffi/builders/union_builder_test.rb +1 -0
- data/test/gir_ffi/builders/user_defined_builder_test.rb +1 -0
- data/test/gir_ffi/builders/vfunc_builder_test.rb +1 -0
- data/test/gir_ffi/callback_base_test.rb +1 -0
- data/test/gir_ffi/class_base_test.rb +1 -0
- data/test/gir_ffi/error_type_info_test.rb +1 -0
- data/test/gir_ffi/ffi_ext/pointer_test.rb +1 -0
- data/test/gir_ffi/g_type_test.rb +1 -0
- data/test/gir_ffi/in_out_pointer_test.rb +1 -0
- data/test/gir_ffi/in_pointer_test.rb +1 -0
- data/test/gir_ffi/info_ext/i_callable_info_test.rb +1 -0
- data/test/gir_ffi/info_ext/i_callback_info_test.rb +1 -0
- data/test/gir_ffi/info_ext/i_field_info_test.rb +1 -0
- data/test/gir_ffi/info_ext/i_function_info_test.rb +1 -0
- data/test/gir_ffi/info_ext/i_signal_info_test.rb +1 -0
- data/test/gir_ffi/info_ext/i_type_info_test.rb +1 -0
- data/test/gir_ffi/info_ext/i_unresolved_info_test.rb +1 -0
- data/test/gir_ffi/info_ext/safe_constant_name_test.rb +1 -0
- data/test/gir_ffi/info_ext/safe_function_name_test.rb +1 -0
- data/test/gir_ffi/interface_base_test.rb +1 -0
- data/test/gir_ffi/method_stubber_test.rb +1 -0
- data/test/gir_ffi/object_base_test.rb +1 -0
- data/test/gir_ffi/sized_array_test.rb +1 -0
- data/test/gir_ffi/type_map_test.rb +1 -0
- data/test/gir_ffi/unintrospectable_type_info_test.rb +1 -0
- data/test/gir_ffi/user_defined_property_info_test.rb +1 -0
- data/test/gir_ffi/user_defined_type_info_test.rb +1 -0
- data/test/gir_ffi/variable_name_generator_test.rb +1 -0
- data/test/gir_ffi/version_test.rb +1 -0
- data/test/gir_ffi/zero_terminated_test.rb +1 -0
- data/test/gir_ffi-base/glib/boolean_test.rb +2 -1
- data/test/gir_ffi-base/glib/strv_test.rb +1 -0
- data/test/gir_ffi_test.rb +1 -0
- data/test/gir_ffi_test_helper.rb +1 -0
- data/test/integration/callback_exceptions_test.rb +1 -0
- data/test/integration/derived_classes_test.rb +1 -0
- data/test/integration/generated_everything_test.rb +1 -0
- data/test/integration/generated_gimarshallingtests_test.rb +1 -0
- data/test/integration/generated_gio_test.rb +1 -0
- data/test/integration/generated_glib_test.rb +1 -0
- data/test/integration/generated_gobject_test.rb +1 -0
- data/test/integration/generated_gst_test.rb +1 -0
- data/test/integration/generated_gtop_test.rb +1 -0
- data/test/integration/generated_pango_ft2_test.rb +1 -0
- data/test/integration/generated_pango_test.rb +1 -0
- data/test/integration/generated_regress_test.rb +2 -2
- data/test/integration/generated_secret_test.rb +1 -0
- data/test/integration/generated_warnlib_test.rb +1 -0
- data/test/integration/method_lookup_test.rb +1 -0
- data/test/introspection_test_helper.rb +1 -0
- data/test/minitest/stats_plugin.rb +1 -0
- metadata +19 -19
- data/lib/gir_ffi/builders/error_argument_builder.rb +0 -34
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 32348b4646865dc62bc64b2138a2e2103a6e1260
|
4
|
+
data.tar.gz: d62d4d20fd485c6c67e245850e76838b2efd1065
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 75e7375073038d8189f15cc7b1c30209beedde82144f6eb50fbb794be81b3be2689de49f5b3db9322a875c81bfdda22f8a4260cadb4f59e9b0c957e19bb16582
|
7
|
+
data.tar.gz: a932d8198cc5fbed0418e658fda7b4031ae3373642228139c6b1645557e8e4192d706b6fe0f5c21ac5e65d29558a1b1e35a7032b2eec033f479d7d508d558806
|
data/Changelog.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 0.9.3 / 2016-02-20
|
4
|
+
|
5
|
+
* Make allow-none arguments optional in Ruby
|
6
|
+
* Add Clutter example
|
7
|
+
* Clean up mainloop example
|
8
|
+
* Use bit masks for relevant functions in GObjectIntrospection
|
9
|
+
|
3
10
|
## 0.9.2 / 2016-02-05
|
4
11
|
|
5
12
|
* Do not create a property accessor when a corresponding getter method exists
|
data/Gemfile
CHANGED
@@ -1,9 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
source 'https://rubygems.org'
|
2
3
|
|
3
4
|
# The gem's dependencies are specified in gir_ffi.gemspec
|
4
5
|
gemspec
|
5
6
|
|
6
|
-
gem 'rubocop', '~> 0.
|
7
|
+
gem 'rubocop', '~> 0.37.0', type: :development
|
7
8
|
|
8
9
|
if ENV['CI']
|
9
10
|
if ENV['TRAVIS_RUBY_VERSION'] == '2.2'
|
data/README.md
CHANGED
@@ -42,6 +42,11 @@ Ruby bindings for GNOME using the GObject Introspection Repository.
|
|
42
42
|
|
43
43
|
See the [documentation](docs/Documentation.md) for more usage information.
|
44
44
|
|
45
|
+
## Examples
|
46
|
+
|
47
|
+
Have a look in the `examples/` directory for some simple examples. More
|
48
|
+
examples can be found in `gir_ffi-gtk` and `gir_ffi-gst`.
|
49
|
+
|
45
50
|
## Install
|
46
51
|
|
47
52
|
gem install gir_ffi
|
@@ -81,6 +86,7 @@ already exist:
|
|
81
86
|
* `gir_ffi-cairo`: overrides for Cairo
|
82
87
|
* `gir_ffi-pango`: overrides for Pango
|
83
88
|
* `gir_ffi-tracker`: overrides for Tracker
|
89
|
+
* `gir_ffi-gst`: overrides for GStreamer
|
84
90
|
|
85
91
|
## Hacking and contributing
|
86
92
|
|
data/TODO.md
CHANGED
@@ -104,6 +104,7 @@ For how to handle objects, see https://bugzilla.gnome.org/show_bug.cgi?id=657202
|
|
104
104
|
|
105
105
|
* Move GObjectIntrospection to GIRepository, and allow generating its own
|
106
106
|
members.
|
107
|
+
* Do something useful with the versioning info in the GIR
|
107
108
|
|
108
109
|
## External dependencies
|
109
110
|
|
data/examples/clutter.rb
ADDED
@@ -0,0 +1,106 @@
|
|
1
|
+
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib')
|
2
|
+
require 'gir_ffi'
|
3
|
+
|
4
|
+
GirFFI.setup :Clutter
|
5
|
+
GirFFI.setup :GdkPixbuf
|
6
|
+
|
7
|
+
class PhotoWall < Clutter::Stage
|
8
|
+
STAGE_WIDTH = 800
|
9
|
+
STAGE_HEIGHT = 600
|
10
|
+
|
11
|
+
THUMBNAIL_SIZE = 200
|
12
|
+
ROW_COUNT = STAGE_HEIGHT / THUMBNAIL_SIZE
|
13
|
+
COLUMN_COUNT = STAGE_WIDTH / THUMBNAIL_SIZE
|
14
|
+
|
15
|
+
FOCUS_DEPTH = 100.0
|
16
|
+
UNFOCUS_DEPTH = 0.0
|
17
|
+
|
18
|
+
def self.create_for path
|
19
|
+
stage = PhotoWall.new
|
20
|
+
|
21
|
+
stage.instance_eval do
|
22
|
+
@path = path
|
23
|
+
|
24
|
+
@bricks = []
|
25
|
+
@images = Dir["#{@path}/**/*.{jpg,png}"]
|
26
|
+
@focus = nil
|
27
|
+
|
28
|
+
set_title "A PhotoWall"
|
29
|
+
set_size STAGE_WIDTH, STAGE_HEIGHT
|
30
|
+
|
31
|
+
ROW_COUNT.times do |row|
|
32
|
+
COLUMN_COUNT.times do |column|
|
33
|
+
break unless @images[row*COLUMN_COUNT + column]
|
34
|
+
puts "Adding #{@images[row*COLUMN_COUNT + column]}"
|
35
|
+
brick = LittleBrick.new_from_file(@images[row*COLUMN_COUNT + column], row, column)
|
36
|
+
add_actor brick
|
37
|
+
@bricks << brick
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
show_all
|
42
|
+
end
|
43
|
+
|
44
|
+
GObject.signal_connect(stage, "destroy") { Clutter.main_quit }
|
45
|
+
|
46
|
+
stage
|
47
|
+
end
|
48
|
+
|
49
|
+
class LittleBrick < Clutter::Actor
|
50
|
+
attr_accessor :row, :col
|
51
|
+
|
52
|
+
def self.new_from_file fname, row = 0, col = 0
|
53
|
+
brick = new
|
54
|
+
image = Clutter::Image.new
|
55
|
+
picture = GdkPixbuf::Pixbuf.new_from_file fname
|
56
|
+
image.set_data(picture.get_pixels,
|
57
|
+
picture.has_alpha ? :rgba_8888 : :rgb_888,
|
58
|
+
picture.width,
|
59
|
+
picture.height,
|
60
|
+
picture.rowstride)
|
61
|
+
brick.set_content image
|
62
|
+
|
63
|
+
brick.instance_eval do
|
64
|
+
@row = row
|
65
|
+
@col = col
|
66
|
+
|
67
|
+
set_size THUMBNAIL_SIZE, THUMBNAIL_SIZE
|
68
|
+
set_position col * THUMBNAIL_SIZE, row * THUMBNAIL_SIZE
|
69
|
+
set_reactive true
|
70
|
+
end
|
71
|
+
|
72
|
+
@@focus = nil
|
73
|
+
|
74
|
+
GObject.signal_connect brick, "button-press-event" do |a_brick|
|
75
|
+
if @@focus
|
76
|
+
@@focus.unfocus
|
77
|
+
else
|
78
|
+
brick.focus
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
brick
|
83
|
+
end
|
84
|
+
|
85
|
+
def focus
|
86
|
+
@@focus = self
|
87
|
+
set_position 0, 0
|
88
|
+
set_size STAGE_WIDTH, STAGE_HEIGHT
|
89
|
+
raise_top
|
90
|
+
end
|
91
|
+
|
92
|
+
def unfocus
|
93
|
+
set_position @col * THUMBNAIL_SIZE, @row * THUMBNAIL_SIZE
|
94
|
+
set_size THUMBNAIL_SIZE, THUMBNAIL_SIZE
|
95
|
+
@@focus = nil
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
Clutter.init []
|
101
|
+
|
102
|
+
picture_directory = GLib.get_user_special_dir :directory_pictures
|
103
|
+
|
104
|
+
PhotoWall.create_for picture_directory
|
105
|
+
|
106
|
+
Clutter.main
|
data/examples/main_loop.rb
CHANGED
data/lib/ffi-glib/array.rb
CHANGED
data/lib/ffi-glib/byte_array.rb
CHANGED
data/lib/ffi-glib/bytes.rb
CHANGED
data/lib/ffi-glib/error.rb
CHANGED
data/lib/ffi-glib/hash_table.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require 'ffi-glib/container_class_methods'
|
2
3
|
|
3
4
|
GLib.load_class :HashTable
|
@@ -28,7 +29,7 @@ module GLib
|
|
28
29
|
end
|
29
30
|
|
30
31
|
def each
|
31
|
-
prc = proc do|keyptr, valptr, _userdata|
|
32
|
+
prc = proc do |keyptr, valptr, _userdata|
|
32
33
|
key = GirFFI::ArgHelper.cast_from_pointer key_type, keyptr
|
33
34
|
val = GirFFI::ArgHelper.cast_from_pointer value_type, valptr
|
34
35
|
yield key, val
|
data/lib/ffi-glib/iconv.rb
CHANGED
data/lib/ffi-glib/list.rb
CHANGED
data/lib/ffi-glib/main_loop.rb
CHANGED
data/lib/ffi-glib/ptr_array.rb
CHANGED
data/lib/ffi-glib/s_list.rb
CHANGED
data/lib/ffi-glib/strv.rb
CHANGED
data/lib/ffi-glib/variant.rb
CHANGED
data/lib/ffi-glib.rb
CHANGED
data/lib/ffi-gobject/base.rb
CHANGED
data/lib/ffi-gobject/closure.rb
CHANGED
data/lib/ffi-gobject/object.rb
CHANGED
data/lib/ffi-gobject/value.rb
CHANGED
data/lib/ffi-gobject.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require 'ffi-gobject_introspection/i_base_info'
|
2
3
|
require 'ffi-gobject_introspection/i_type_info'
|
3
4
|
require 'ffi-gobject_introspection/i_arg_info'
|
@@ -18,6 +19,10 @@ module GObjectIntrospection
|
|
18
19
|
Lib.g_callable_info_may_return_null @gobj
|
19
20
|
end
|
20
21
|
|
22
|
+
def can_throw_gerror?
|
23
|
+
Lib.g_callable_info_can_throw_gerror @gobj
|
24
|
+
end
|
25
|
+
|
21
26
|
def n_args
|
22
27
|
Lib.g_callable_info_get_n_args @gobj
|
23
28
|
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
module GObjectIntrospection
|
2
3
|
# Wraps a GIFieldInfo struct.
|
3
4
|
# Represents a field of an IStructInfo or an IUnionInfo.
|
@@ -19,11 +20,11 @@ module GObjectIntrospection
|
|
19
20
|
end
|
20
21
|
|
21
22
|
def readable?
|
22
|
-
flags
|
23
|
+
flags[:readable]
|
23
24
|
end
|
24
25
|
|
25
26
|
def writable?
|
26
|
-
flags
|
27
|
+
flags[:writable]
|
27
28
|
end
|
28
29
|
end
|
29
30
|
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
module GObjectIntrospection
|
2
3
|
# Wraps a GIFunctionInfo struct.
|
3
4
|
# Represents a function or method.
|
@@ -10,29 +11,28 @@ module GObjectIntrospection
|
|
10
11
|
Lib.g_function_info_get_flags @gobj
|
11
12
|
end
|
12
13
|
|
13
|
-
# TODO: Use some sort of bitfield
|
14
14
|
def method?
|
15
|
-
flags
|
15
|
+
flags[:is_method]
|
16
16
|
end
|
17
17
|
|
18
18
|
def constructor?
|
19
|
-
flags
|
19
|
+
flags[:is_constructor]
|
20
20
|
end
|
21
21
|
|
22
22
|
def getter?
|
23
|
-
flags
|
23
|
+
flags[:is_getter]
|
24
24
|
end
|
25
25
|
|
26
26
|
def setter?
|
27
|
-
flags
|
27
|
+
flags[:is_setter]
|
28
28
|
end
|
29
29
|
|
30
30
|
def wraps_vfunc?
|
31
|
-
flags
|
31
|
+
flags[:wraps_vfunc]
|
32
32
|
end
|
33
33
|
|
34
34
|
def throws?
|
35
|
-
flags
|
35
|
+
flags[:throws]
|
36
36
|
end
|
37
37
|
end
|
38
38
|
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
module GObjectIntrospection
|
2
3
|
# Wraps a GIPropertyInfo struct.
|
3
4
|
# Represents a property of an IObjectInfo or an IInterfaceInfo.
|
@@ -11,19 +12,19 @@ module GObjectIntrospection
|
|
11
12
|
end
|
12
13
|
|
13
14
|
def readable?
|
14
|
-
flags
|
15
|
+
flags[:readable]
|
15
16
|
end
|
16
17
|
|
17
18
|
def writeable?
|
18
|
-
flags
|
19
|
+
flags[:writable]
|
19
20
|
end
|
20
21
|
|
21
22
|
def construct?
|
22
|
-
flags
|
23
|
+
flags[:construct]
|
23
24
|
end
|
24
25
|
|
25
26
|
def construct_only?
|
26
|
-
flags
|
27
|
+
flags[:construct_only]
|
27
28
|
end
|
28
29
|
end
|
29
30
|
end
|
@@ -1,9 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require 'ffi'
|
3
|
+
require 'ffi/bit_masks'
|
2
4
|
|
3
5
|
module GObjectIntrospection
|
4
6
|
# Module for attaching functions from the girepository library
|
5
7
|
module Lib
|
6
8
|
extend FFI::Library
|
9
|
+
extend FFI::BitMasks
|
7
10
|
ffi_lib 'girepository-1.0'
|
8
11
|
|
9
12
|
# Helper class to support guessing the gobject-introspection version.
|
@@ -77,9 +80,16 @@ module GObjectIntrospection
|
|
77
80
|
attach_function :g_base_info_equal, [:pointer, :pointer], :bool
|
78
81
|
|
79
82
|
# IFunctionInfo
|
83
|
+
bit_mask :IFunctionInfoFlags,
|
84
|
+
is_method: (1 << 0),
|
85
|
+
is_constructor: (1 << 1),
|
86
|
+
is_getter: (1 << 2),
|
87
|
+
is_setter: (1 << 3),
|
88
|
+
wraps_vfunc: (1 << 4),
|
89
|
+
throws: (1 << 5)
|
90
|
+
|
80
91
|
attach_function :g_function_info_get_symbol, [:pointer], :string
|
81
|
-
|
82
|
-
attach_function :g_function_info_get_flags, [:pointer], :int
|
92
|
+
attach_function :g_function_info_get_flags, [:pointer], :IFunctionInfoFlags
|
83
93
|
|
84
94
|
# ICallableInfo
|
85
95
|
enum :ITransfer, [
|
@@ -91,6 +101,7 @@ module GObjectIntrospection
|
|
91
101
|
attach_function :g_callable_info_get_return_type, [:pointer], :pointer
|
92
102
|
attach_function :g_callable_info_get_caller_owns, [:pointer], :ITransfer
|
93
103
|
attach_function :g_callable_info_may_return_null, [:pointer], :bool
|
104
|
+
attach_function :g_callable_info_can_throw_gerror, [:pointer], :bool
|
94
105
|
attach_function :g_callable_info_get_n_args, [:pointer], :int
|
95
106
|
attach_function :g_callable_info_get_arg, [:pointer, :int], :pointer
|
96
107
|
attach_function :g_callable_info_skip_return, [:pointer], :bool
|
@@ -176,12 +187,11 @@ module GObjectIntrospection
|
|
176
187
|
attach_function :g_value_info_get_value, [:pointer], :long
|
177
188
|
|
178
189
|
# IFieldInfo
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
attach_function :g_field_info_get_flags, [:pointer], :int
|
190
|
+
bit_mask :IFieldInfoFlags,
|
191
|
+
readable: (1 << 0),
|
192
|
+
writable: (1 << 1)
|
193
|
+
|
194
|
+
attach_function :g_field_info_get_flags, [:pointer], :IFieldInfoFlags
|
185
195
|
attach_function :g_field_info_get_size, [:pointer], :int
|
186
196
|
attach_function :g_field_info_get_offset, [:pointer], :int
|
187
197
|
attach_function :g_field_info_get_type, [:pointer], :pointer
|
@@ -290,8 +300,15 @@ module GObjectIntrospection
|
|
290
300
|
# IPropertyInfo
|
291
301
|
#
|
292
302
|
attach_function :g_property_info_get_type, [:pointer], :pointer
|
293
|
-
|
294
|
-
|
303
|
+
|
304
|
+
# NOTE: This type has more values, but these are the ones used
|
305
|
+
bit_mask :ParamFlags,
|
306
|
+
readable: (1 << 0),
|
307
|
+
writable: (1 << 1),
|
308
|
+
construct: (1 << 2),
|
309
|
+
construct_only: (1 << 3)
|
310
|
+
|
311
|
+
attach_function :g_property_info_get_flags, [:pointer], :ParamFlags
|
295
312
|
|
296
313
|
::GObjectIntrospection::VERSION = version_guesser.best_guess
|
297
314
|
end
|