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.
Files changed (278) hide show
  1. checksums.yaml +4 -4
  2. data/Changelog.md +7 -0
  3. data/Gemfile +2 -1
  4. data/README.md +6 -0
  5. data/TODO.md +1 -0
  6. data/examples/clutter.rb +106 -0
  7. data/examples/main_loop.rb +0 -8
  8. data/lib/ffi-glib/array.rb +1 -0
  9. data/lib/ffi-glib/array_methods.rb +1 -0
  10. data/lib/ffi-glib/byte_array.rb +1 -0
  11. data/lib/ffi-glib/bytes.rb +1 -0
  12. data/lib/ffi-glib/container_class_methods.rb +1 -0
  13. data/lib/ffi-glib/destroy_notify.rb +1 -0
  14. data/lib/ffi-glib/error.rb +1 -0
  15. data/lib/ffi-glib/hash_table.rb +2 -1
  16. data/lib/ffi-glib/iconv.rb +1 -0
  17. data/lib/ffi-glib/list.rb +1 -0
  18. data/lib/ffi-glib/list_methods.rb +1 -0
  19. data/lib/ffi-glib/main_loop.rb +1 -0
  20. data/lib/ffi-glib/ptr_array.rb +1 -0
  21. data/lib/ffi-glib/s_list.rb +1 -0
  22. data/lib/ffi-glib/strv.rb +1 -0
  23. data/lib/ffi-glib/variant.rb +1 -0
  24. data/lib/ffi-glib.rb +1 -0
  25. data/lib/ffi-gobject/base.rb +1 -0
  26. data/lib/ffi-gobject/closure.rb +1 -0
  27. data/lib/ffi-gobject/initially_unowned.rb +1 -0
  28. data/lib/ffi-gobject/object.rb +1 -0
  29. data/lib/ffi-gobject/object_class.rb +1 -0
  30. data/lib/ffi-gobject/ruby_closure.rb +1 -0
  31. data/lib/ffi-gobject/value.rb +1 -0
  32. data/lib/ffi-gobject.rb +1 -0
  33. data/lib/ffi-gobject_introspection/g_error.rb +1 -0
  34. data/lib/ffi-gobject_introspection/i_arg_info.rb +1 -0
  35. data/lib/ffi-gobject_introspection/i_base_info.rb +1 -0
  36. data/lib/ffi-gobject_introspection/i_callable_info.rb +5 -0
  37. data/lib/ffi-gobject_introspection/i_callback_info.rb +1 -0
  38. data/lib/ffi-gobject_introspection/i_constant_info.rb +1 -0
  39. data/lib/ffi-gobject_introspection/i_enum_info.rb +1 -0
  40. data/lib/ffi-gobject_introspection/i_field_info.rb +3 -2
  41. data/lib/ffi-gobject_introspection/i_flags_info.rb +1 -0
  42. data/lib/ffi-gobject_introspection/i_function_info.rb +7 -7
  43. data/lib/ffi-gobject_introspection/i_interface_info.rb +1 -0
  44. data/lib/ffi-gobject_introspection/i_object_info.rb +1 -0
  45. data/lib/ffi-gobject_introspection/i_property_info.rb +5 -4
  46. data/lib/ffi-gobject_introspection/i_registered_type_info.rb +1 -0
  47. data/lib/ffi-gobject_introspection/i_repository.rb +1 -0
  48. data/lib/ffi-gobject_introspection/i_signal_info.rb +1 -0
  49. data/lib/ffi-gobject_introspection/i_struct_info.rb +1 -0
  50. data/lib/ffi-gobject_introspection/i_type_info.rb +1 -0
  51. data/lib/ffi-gobject_introspection/i_union_info.rb +1 -0
  52. data/lib/ffi-gobject_introspection/i_unresolved_info.rb +1 -0
  53. data/lib/ffi-gobject_introspection/i_value_info.rb +1 -0
  54. data/lib/ffi-gobject_introspection/i_vfunc_info.rb +1 -0
  55. data/lib/ffi-gobject_introspection/lib.rb +27 -10
  56. data/lib/ffi-gobject_introspection.rb +1 -0
  57. data/lib/gir_ffi/allocation_helper.rb +1 -0
  58. data/lib/gir_ffi/arg_helper.rb +1 -0
  59. data/lib/gir_ffi/boxed_base.rb +1 -0
  60. data/lib/gir_ffi/builder.rb +1 -0
  61. data/lib/gir_ffi/builder_helper.rb +1 -0
  62. data/lib/gir_ffi/builders/argument_builder.rb +18 -6
  63. data/lib/gir_ffi/builders/argument_builder_collection.rb +24 -12
  64. data/lib/gir_ffi/builders/base_argument_builder.rb +1 -0
  65. data/lib/gir_ffi/builders/base_method_builder.rb +33 -9
  66. data/lib/gir_ffi/builders/base_type_builder.rb +1 -0
  67. data/lib/gir_ffi/builders/boxed_builder.rb +1 -0
  68. data/lib/gir_ffi/builders/c_to_ruby_convertor.rb +1 -0
  69. data/lib/gir_ffi/builders/callback_argument_builder.rb +5 -0
  70. data/lib/gir_ffi/builders/callback_builder.rb +2 -5
  71. data/lib/gir_ffi/builders/callback_return_value_builder.rb +1 -0
  72. data/lib/gir_ffi/builders/closure_argument_builder.rb +1 -0
  73. data/lib/gir_ffi/builders/closure_convertor.rb +1 -0
  74. data/lib/gir_ffi/builders/closure_return_value_builder.rb +1 -0
  75. data/lib/gir_ffi/builders/closure_to_pointer_convertor.rb +1 -0
  76. data/lib/gir_ffi/builders/constant_builder.rb +1 -0
  77. data/lib/gir_ffi/builders/constructor_builder.rb +2 -0
  78. data/lib/gir_ffi/builders/enum_builder.rb +2 -1
  79. data/lib/gir_ffi/builders/field_builder.rb +2 -0
  80. data/lib/gir_ffi/builders/flags_builder.rb +2 -1
  81. data/lib/gir_ffi/builders/full_c_to_ruby_convertor.rb +1 -0
  82. data/lib/gir_ffi/builders/function_builder.rb +2 -3
  83. data/lib/gir_ffi/builders/initializer_builder.rb +2 -3
  84. data/lib/gir_ffi/builders/initializer_return_value_builder.rb +1 -0
  85. data/lib/gir_ffi/builders/interface_builder.rb +1 -0
  86. data/lib/gir_ffi/builders/mapping_method_builder.rb +15 -37
  87. data/lib/gir_ffi/builders/marshalling_method_builder.rb +9 -26
  88. data/lib/gir_ffi/builders/method_template.rb +4 -3
  89. data/lib/gir_ffi/builders/module_builder.rb +2 -1
  90. data/lib/gir_ffi/builders/null_argument_builder.rb +1 -0
  91. data/lib/gir_ffi/builders/null_class_builder.rb +1 -0
  92. data/lib/gir_ffi/builders/null_convertor.rb +1 -0
  93. data/lib/gir_ffi/builders/null_return_value_builder.rb +1 -0
  94. data/lib/gir_ffi/builders/object_builder.rb +1 -0
  95. data/lib/gir_ffi/builders/property_builder.rb +1 -0
  96. data/lib/gir_ffi/builders/registered_type_builder.rb +1 -0
  97. data/lib/gir_ffi/builders/return_value_builder.rb +1 -0
  98. data/lib/gir_ffi/builders/ruby_to_c_convertor.rb +1 -0
  99. data/lib/gir_ffi/builders/signal_closure_builder.rb +2 -7
  100. data/lib/gir_ffi/builders/struct_builder.rb +1 -0
  101. data/lib/gir_ffi/builders/type_builder.rb +1 -0
  102. data/lib/gir_ffi/builders/unintrospectable_boxed_builder.rb +1 -0
  103. data/lib/gir_ffi/builders/unintrospectable_builder.rb +1 -0
  104. data/lib/gir_ffi/builders/union_builder.rb +1 -0
  105. data/lib/gir_ffi/builders/user_defined_builder.rb +1 -0
  106. data/lib/gir_ffi/builders/vfunc_argument_builder.rb +1 -0
  107. data/lib/gir_ffi/builders/vfunc_builder.rb +2 -9
  108. data/lib/gir_ffi/builders/with_layout.rb +1 -0
  109. data/lib/gir_ffi/callback_base.rb +1 -0
  110. data/lib/gir_ffi/class_base.rb +1 -0
  111. data/lib/gir_ffi/core.rb +1 -0
  112. data/lib/gir_ffi/enum_base.rb +1 -0
  113. data/lib/gir_ffi/error_argument_info.rb +1 -0
  114. data/lib/gir_ffi/error_type_info.rb +1 -0
  115. data/lib/gir_ffi/ffi_ext/pointer.rb +1 -0
  116. data/lib/gir_ffi/ffi_ext.rb +1 -0
  117. data/lib/gir_ffi/field_argument_info.rb +1 -0
  118. data/lib/gir_ffi/flags_base.rb +1 -0
  119. data/lib/gir_ffi/g_type.rb +1 -0
  120. data/lib/gir_ffi/glib_error.rb +1 -0
  121. data/lib/gir_ffi/in_out_pointer.rb +1 -0
  122. data/lib/gir_ffi/in_pointer.rb +1 -0
  123. data/lib/gir_ffi/info_ext/full_type_name.rb +1 -0
  124. data/lib/gir_ffi/info_ext/i_arg_info.rb +1 -0
  125. data/lib/gir_ffi/info_ext/i_callable_info.rb +1 -0
  126. data/lib/gir_ffi/info_ext/i_callback_info.rb +1 -0
  127. data/lib/gir_ffi/info_ext/i_field_info.rb +1 -0
  128. data/lib/gir_ffi/info_ext/i_function_info.rb +1 -0
  129. data/lib/gir_ffi/info_ext/i_property_info.rb +1 -0
  130. data/lib/gir_ffi/info_ext/i_registered_type_info.rb +1 -0
  131. data/lib/gir_ffi/info_ext/i_signal_info.rb +1 -0
  132. data/lib/gir_ffi/info_ext/i_type_info.rb +1 -1
  133. data/lib/gir_ffi/info_ext/i_unresolved_info.rb +1 -0
  134. data/lib/gir_ffi/info_ext/i_vfunc_info.rb +1 -0
  135. data/lib/gir_ffi/info_ext/safe_constant_name.rb +1 -0
  136. data/lib/gir_ffi/info_ext/safe_function_name.rb +1 -0
  137. data/lib/gir_ffi/info_ext.rb +1 -0
  138. data/lib/gir_ffi/interface_base.rb +1 -0
  139. data/lib/gir_ffi/lib_c.rb +1 -0
  140. data/lib/gir_ffi/method_stubber.rb +1 -0
  141. data/lib/gir_ffi/module_base.rb +1 -0
  142. data/lib/gir_ffi/object_base.rb +1 -0
  143. data/lib/gir_ffi/object_store.rb +1 -0
  144. data/lib/gir_ffi/property_not_found_error.rb +1 -0
  145. data/lib/gir_ffi/receiver_argument_info.rb +1 -0
  146. data/lib/gir_ffi/receiver_type_info.rb +1 -0
  147. data/lib/gir_ffi/registered_type_base.rb +1 -0
  148. data/lib/gir_ffi/return_value_info.rb +1 -0
  149. data/lib/gir_ffi/signal_not_found_error.rb +1 -0
  150. data/lib/gir_ffi/sized_array.rb +1 -0
  151. data/lib/gir_ffi/struct_base.rb +1 -0
  152. data/lib/gir_ffi/type_base.rb +1 -0
  153. data/lib/gir_ffi/type_map.rb +1 -0
  154. data/lib/gir_ffi/unintrospectable_signal_info.rb +1 -0
  155. data/lib/gir_ffi/unintrospectable_type_info.rb +1 -0
  156. data/lib/gir_ffi/union_base.rb +1 -0
  157. data/lib/gir_ffi/user_data_argument_info.rb +1 -0
  158. data/lib/gir_ffi/user_data_type_info.rb +1 -0
  159. data/lib/gir_ffi/user_defined_property_info.rb +1 -0
  160. data/lib/gir_ffi/user_defined_type_info.rb +1 -0
  161. data/lib/gir_ffi/variable_name_generator.rb +1 -0
  162. data/lib/gir_ffi/version.rb +1 -1
  163. data/lib/gir_ffi/vfunc_implementation.rb +1 -0
  164. data/lib/gir_ffi/zero_terminated.rb +1 -0
  165. data/lib/gir_ffi-base/glib/boolean.rb +1 -0
  166. data/lib/gir_ffi-base/glib/strv.rb +1 -0
  167. data/lib/gir_ffi-base/gobject/lib.rb +1 -0
  168. data/lib/gir_ffi-base/gobject.rb +1 -0
  169. data/lib/gir_ffi-base.rb +1 -0
  170. data/lib/gir_ffi.rb +1 -0
  171. data/test/base_test_helper.rb +1 -0
  172. data/test/ffi-glib/array_test.rb +1 -0
  173. data/test/ffi-glib/byte_array_test.rb +1 -0
  174. data/test/ffi-glib/bytes_test.rb +1 -0
  175. data/test/ffi-glib/destroy_notify_test.rb +1 -0
  176. data/test/ffi-glib/hash_table_test.rb +1 -0
  177. data/test/ffi-glib/iconv_test.rb +1 -0
  178. data/test/ffi-glib/list_test.rb +1 -0
  179. data/test/ffi-glib/main_loop_test.rb +1 -0
  180. data/test/ffi-glib/ptr_array_test.rb +1 -0
  181. data/test/ffi-glib/ruby_closure_test.rb +1 -0
  182. data/test/ffi-glib/s_list_test.rb +1 -0
  183. data/test/ffi-glib/strv_test.rb +1 -0
  184. data/test/ffi-glib/variant_test.rb +1 -0
  185. data/test/ffi-gobject/gobject_test.rb +1 -0
  186. data/test/ffi-gobject/object_class_test.rb +1 -0
  187. data/test/ffi-gobject/object_test.rb +1 -0
  188. data/test/ffi-gobject/value_test.rb +1 -0
  189. data/test/ffi-gobject_introspection/i_base_info_test.rb +1 -0
  190. data/test/ffi-gobject_introspection/i_constant_info_test.rb +1 -0
  191. data/test/ffi-gobject_introspection/i_enum_info_test.rb +1 -0
  192. data/test/ffi-gobject_introspection/i_function_info_test.rb +1 -0
  193. data/test/ffi-gobject_introspection/i_interface_info_test.rb +1 -0
  194. data/test/ffi-gobject_introspection/i_object_info_test.rb +1 -0
  195. data/test/ffi-gobject_introspection/i_property_info_test.rb +1 -0
  196. data/test/ffi-gobject_introspection/i_registered_type_info_test.rb +1 -0
  197. data/test/ffi-gobject_introspection/i_repository_test.rb +1 -0
  198. data/test/ffi-gobject_introspection/i_struct_info_test.rb +1 -0
  199. data/test/ffi-gobject_introspection/i_type_info_test.rb +1 -0
  200. data/test/ffi-gobject_introspection/i_union_info_test.rb +1 -0
  201. data/test/ffi-gobject_introspection/lib_test.rb +1 -0
  202. data/test/ffi-gobject_test.rb +1 -0
  203. data/test/gir_ffi/arg_helper_test.rb +1 -0
  204. data/test/gir_ffi/builder_test.rb +1 -0
  205. data/test/gir_ffi/builders/argument_builder_test.rb +17 -0
  206. data/test/gir_ffi/builders/base_argument_builder_test.rb +1 -0
  207. data/test/gir_ffi/builders/callback_argument_builder_test.rb +1 -0
  208. data/test/gir_ffi/builders/callback_builder_test.rb +1 -0
  209. data/test/gir_ffi/builders/callback_return_value_builder_test.rb +1 -0
  210. data/test/gir_ffi/builders/constant_builder_test.rb +1 -0
  211. data/test/gir_ffi/builders/constructor_builder_test.rb +1 -0
  212. data/test/gir_ffi/builders/enum_builder_test.rb +1 -0
  213. data/test/gir_ffi/builders/field_builder_test.rb +1 -0
  214. data/test/gir_ffi/builders/function_builder_test.rb +30 -1
  215. data/test/gir_ffi/builders/initializer_builder_test.rb +1 -0
  216. data/test/gir_ffi/builders/interface_builder_test.rb +1 -0
  217. data/test/gir_ffi/builders/module_builder_test.rb +1 -0
  218. data/test/gir_ffi/builders/object_builder_test.rb +1 -0
  219. data/test/gir_ffi/builders/property_builder_test.rb +1 -0
  220. data/test/gir_ffi/builders/registered_type_builder_test.rb +1 -0
  221. data/test/gir_ffi/builders/return_value_builder_test.rb +1 -0
  222. data/test/gir_ffi/builders/signal_closure_builder_test.rb +1 -0
  223. data/test/gir_ffi/builders/struct_builder_test.rb +1 -0
  224. data/test/gir_ffi/builders/unintrospectable_boxed_builder_test.rb +1 -0
  225. data/test/gir_ffi/builders/unintrospectable_builder_test.rb +1 -0
  226. data/test/gir_ffi/builders/union_builder_test.rb +1 -0
  227. data/test/gir_ffi/builders/user_defined_builder_test.rb +1 -0
  228. data/test/gir_ffi/builders/vfunc_builder_test.rb +1 -0
  229. data/test/gir_ffi/callback_base_test.rb +1 -0
  230. data/test/gir_ffi/class_base_test.rb +1 -0
  231. data/test/gir_ffi/error_type_info_test.rb +1 -0
  232. data/test/gir_ffi/ffi_ext/pointer_test.rb +1 -0
  233. data/test/gir_ffi/g_type_test.rb +1 -0
  234. data/test/gir_ffi/in_out_pointer_test.rb +1 -0
  235. data/test/gir_ffi/in_pointer_test.rb +1 -0
  236. data/test/gir_ffi/info_ext/i_callable_info_test.rb +1 -0
  237. data/test/gir_ffi/info_ext/i_callback_info_test.rb +1 -0
  238. data/test/gir_ffi/info_ext/i_field_info_test.rb +1 -0
  239. data/test/gir_ffi/info_ext/i_function_info_test.rb +1 -0
  240. data/test/gir_ffi/info_ext/i_signal_info_test.rb +1 -0
  241. data/test/gir_ffi/info_ext/i_type_info_test.rb +1 -0
  242. data/test/gir_ffi/info_ext/i_unresolved_info_test.rb +1 -0
  243. data/test/gir_ffi/info_ext/safe_constant_name_test.rb +1 -0
  244. data/test/gir_ffi/info_ext/safe_function_name_test.rb +1 -0
  245. data/test/gir_ffi/interface_base_test.rb +1 -0
  246. data/test/gir_ffi/method_stubber_test.rb +1 -0
  247. data/test/gir_ffi/object_base_test.rb +1 -0
  248. data/test/gir_ffi/sized_array_test.rb +1 -0
  249. data/test/gir_ffi/type_map_test.rb +1 -0
  250. data/test/gir_ffi/unintrospectable_type_info_test.rb +1 -0
  251. data/test/gir_ffi/user_defined_property_info_test.rb +1 -0
  252. data/test/gir_ffi/user_defined_type_info_test.rb +1 -0
  253. data/test/gir_ffi/variable_name_generator_test.rb +1 -0
  254. data/test/gir_ffi/version_test.rb +1 -0
  255. data/test/gir_ffi/zero_terminated_test.rb +1 -0
  256. data/test/gir_ffi-base/glib/boolean_test.rb +2 -1
  257. data/test/gir_ffi-base/glib/strv_test.rb +1 -0
  258. data/test/gir_ffi_test.rb +1 -0
  259. data/test/gir_ffi_test_helper.rb +1 -0
  260. data/test/integration/callback_exceptions_test.rb +1 -0
  261. data/test/integration/derived_classes_test.rb +1 -0
  262. data/test/integration/generated_everything_test.rb +1 -0
  263. data/test/integration/generated_gimarshallingtests_test.rb +1 -0
  264. data/test/integration/generated_gio_test.rb +1 -0
  265. data/test/integration/generated_glib_test.rb +1 -0
  266. data/test/integration/generated_gobject_test.rb +1 -0
  267. data/test/integration/generated_gst_test.rb +1 -0
  268. data/test/integration/generated_gtop_test.rb +1 -0
  269. data/test/integration/generated_pango_ft2_test.rb +1 -0
  270. data/test/integration/generated_pango_test.rb +1 -0
  271. data/test/integration/generated_regress_test.rb +2 -2
  272. data/test/integration/generated_secret_test.rb +1 -0
  273. data/test/integration/generated_warnlib_test.rb +1 -0
  274. data/test/integration/method_lookup_test.rb +1 -0
  275. data/test/introspection_test_helper.rb +1 -0
  276. data/test/minitest/stats_plugin.rb +1 -0
  277. metadata +19 -19
  278. 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: ca3636ea5b78e4f09c583690ad160c4a2e739cb1
4
- data.tar.gz: 8a4d243567cc87cc00d18783931c97a35635c6c1
3
+ metadata.gz: 32348b4646865dc62bc64b2138a2e2103a6e1260
4
+ data.tar.gz: d62d4d20fd485c6c67e245850e76838b2efd1065
5
5
  SHA512:
6
- metadata.gz: 6994483aa5dd9df51ef778c97de12698abf57fa436527370c404e7e53e711f5febbe56bd34d1765e2efed09622d81ffbb3da8bb45d3b68048956a61d45562d68
7
- data.tar.gz: 0092e6fb91d2cfa3e1f6f70e4d601b8a1ac617d817675f3c1ad5930c0b3e0989c5b93a3b56601b2e6f1939c15cb1016485baff82635781af01e5099936232df8
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.36.0', type: :development
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
 
@@ -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
@@ -1,12 +1,4 @@
1
1
  require 'gir_ffi'
2
2
 
3
3
  main_loop = GLib::MainLoop.new nil, false
4
-
5
- Signal.trap("INT") do
6
- if main_loop.is_running
7
- main_loop.quit
8
- end
9
- exit
10
- end
11
-
12
4
  main_loop.run
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'ffi-glib/container_class_methods'
2
3
  require 'ffi-glib/array_methods'
3
4
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module GLib
2
3
  # Common methods for GLib::Array and GLib::PtrArray
3
4
  module ArrayMethods
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  GLib.load_class :ByteArray
2
3
 
3
4
  module GLib
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  GLib.load_class :Bytes
2
3
 
3
4
  module GLib
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module GLib
2
3
  # Common methods for container classes: Array, PtrArray, List, SList and
3
4
  # HashTable.
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  GLib.load_class :DestroyNotify
2
3
 
3
4
  module GLib
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  GLib.load_class :Error
2
3
 
3
4
  module GLib
@@ -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
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  GLib.load_class :IConv
2
3
 
3
4
  module GLib
data/lib/ffi-glib/list.rb CHANGED
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'ffi-glib/list_methods'
2
3
 
3
4
  GLib.load_class :List
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'ffi-glib/container_class_methods'
2
3
 
3
4
  module GLib
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'singleton'
2
3
 
3
4
  GLib.load_class :MainLoop
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'ffi-glib/container_class_methods'
2
3
  require 'ffi-glib/array_methods'
3
4
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'ffi-glib/list_methods'
2
3
 
3
4
  GLib.load_class :SList
data/lib/ffi-glib/strv.rb CHANGED
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module GLib
2
3
  # Extra methods for GLib::Strv. The bulk is defined in `gir_ffi-base/glib/strv.rb`
3
4
  class Strv
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  GLib.load_class :Variant
2
3
 
3
4
  module GLib
data/lib/ffi-glib.rb CHANGED
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'gir_ffi/core'
2
3
 
3
4
  GirFFI.setup :GLib
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  # Preload type contants
2
3
  module GObject
3
4
  TYPE_INVALID = type_from_name('invalid')
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  GObject.load_class :Closure
2
3
 
3
4
  module GObject
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  GObject.load_class :InitiallyUnowned
2
3
 
3
4
  module GObject
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'gir_ffi/property_not_found_error'
2
3
 
3
4
  GObject.load_class :Object
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  GObject.load_class :ObjectClass
2
3
 
3
4
  module GObject
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'ffi-gobject/closure'
2
3
 
3
4
  module GObject
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  GObject.load_class :Value
2
3
 
3
4
  module GObject
data/lib/ffi-gobject.rb CHANGED
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'gir_ffi/core'
2
3
 
3
4
  GirFFI.setup :GObject
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module GObjectIntrospection
2
3
  # Wraps GLib's GError struct.
3
4
  class GError
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'ffi-gobject_introspection/i_base_info'
2
3
  module GObjectIntrospection
3
4
  # Wraps a GIArgInfo struct.
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module GObjectIntrospection
2
3
  # Wraps GIBaseInfo struct, the base \type for all info types.
3
4
  # Decendant types will be implemented as needed.
@@ -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 GICallbackInfo struct. Has no methods in addition to the ones
3
4
  # inherited from ICallableInfo.
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module GObjectIntrospection
2
3
  # Wraps a GIConstantInfo struct; represents a constant.
3
4
  class IConstantInfo < IBaseInfo
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module GObjectIntrospection
2
3
  # Wraps a GIEnumInfo struct if it represents an enum.
3
4
  # If it represents a flag, an IFlagsInfo object is used instead.
@@ -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 & 1 != 0
23
+ flags[:readable]
23
24
  end
24
25
 
25
26
  def writable?
26
- flags & 2 != 0
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 GIEnumInfo struct, if it represents a flag type.
3
4
  class IFlagsInfo < IEnumInfo
@@ -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 & 1 != 0
15
+ flags[:is_method]
16
16
  end
17
17
 
18
18
  def constructor?
19
- flags & 2 != 0
19
+ flags[:is_constructor]
20
20
  end
21
21
 
22
22
  def getter?
23
- flags & 4 != 0
23
+ flags[:is_getter]
24
24
  end
25
25
 
26
26
  def setter?
27
- flags & 8 != 0
27
+ flags[:is_setter]
28
28
  end
29
29
 
30
30
  def wraps_vfunc?
31
- flags & 16 != 0
31
+ flags[:wraps_vfunc]
32
32
  end
33
33
 
34
34
  def throws?
35
- flags & 32 != 0
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 IInterfaceInfo struct.
3
4
  # Represents an interface.
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module GObjectIntrospection
2
3
  # Wraps a GIObjectInfo struct.
3
4
  # Represents an object.
@@ -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 & 1 != 0
15
+ flags[:readable]
15
16
  end
16
17
 
17
18
  def writeable?
18
- flags & 2 != 0
19
+ flags[:writable]
19
20
  end
20
21
 
21
22
  def construct?
22
- flags & 4 != 0
23
+ flags[:construct]
23
24
  end
24
25
 
25
26
  def construct_only?
26
- flags & 8 != 0
27
+ flags[:construct_only]
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 GIRegisteredTypeInfo struct.
3
4
  # Represents a registered type.
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'singleton'
2
3
 
3
4
  require 'ffi-gobject_introspection/lib'
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module GObjectIntrospection
2
3
  # Wraps a GISignalInfo struct.
3
4
  # Represents a signal.
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module GObjectIntrospection
2
3
  # Wraps a GIStructInfo struct.
3
4
  # Represents a struct.
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module GObjectIntrospection
2
3
  # Wraps a GITypeInfo struct.
3
4
  # Represents type information, direction, transfer etc.
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module GObjectIntrospection
2
3
  # Wraps a GIUnionInfo struct.
3
4
  # Represents a union.
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'ffi-gobject_introspection/i_base_info'
2
3
 
3
4
  module GObjectIntrospection
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module GObjectIntrospection
2
3
  # Wraps a GIValueInfo struct.
3
4
  # Represents one of the enum values of an IEnumInfo.
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module GObjectIntrospection
2
3
  # Wraps a GIVFuncInfo struct.
3
4
  # Represents a virtual function.
@@ -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
- # TODO: return type is bitfield
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
- enum :IFieldInfoFlags, [
180
- :readable, (1 << 0),
181
- :writable, (1 << 1)
182
- ]
183
- # TODO: return type is bitfield :IFieldInfoFlags
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
- # TODO: return type is bitfield
294
- attach_function :g_property_info_get_flags, [:pointer], :int
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
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'gir_ffi-base'
2
3
 
3
4
  GObject.type_init
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'gir_ffi/lib_c'
2
3
 
3
4
  module GirFFI