gobject-introspection 3.3.9 → 3.4.4

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
2
  SHA256:
3
- metadata.gz: 63b8621d7aa520ba998438e4930c7d6e69398c520e589adafea823aa7597790b
4
- data.tar.gz: 4b3b7409538ab5cdbcf237a1e107d25b276eaa61f4ca56cf771764e3a1343aa3
3
+ metadata.gz: d072b72b786e12f881fea9bde17a9eff9a4c71bedd25f4ecdd2b18267b8ba051
4
+ data.tar.gz: c9e9e78f5c492cb8fea24a1b54e05c2cedad2ec6ce877030cdb3782863340673
5
5
  SHA512:
6
- metadata.gz: ddce980ec3e2abf3a95c16ceb6e48489af7cddd03d59e135485c1adfbe61263b6349ee4d0b53025df9d5ec0f6140721c2ec61604bf6dd2f9304446069e0482e1
7
- data.tar.gz: dec6cddf5c698e47b511913e0f827f29fac841fffee0d3566bdda09f98aab2fd24d84534d695cf2ea6da767402afcc56b789bb9b937f49d6f345755e985b9f6f
6
+ metadata.gz: a24acd65c6f1ddfe47665819bbb37c6121e2c154183c23f64512e4e6ad3b9ba52cde4f035d06754f45071afed0a3db82024efe2ceac596b3d45eeb2027d182d2
7
+ data.tar.gz: 1cdf78cd475b3401ecbd261b182b4271989600a2aef1f572e14c460fa25a84350c0c515edd301c4af7e27ad79943d9c33e24f21fa01c2d5634e7cbd9aec51d38
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  #
3
- # Copyright (C) 2012-2019 Ruby-GNOME Project Team
3
+ # Copyright (C) 2012-2021 Ruby-GNOME Project Team
4
4
  #
5
5
  # This library is free software; you can redistribute it and/or
6
6
  # modify it under the terms of the GNU Lesser General Public
@@ -62,9 +62,6 @@ end
62
62
  # TODO: Remove this when we dropped support for GObject Introspection < 1.60
63
63
  make_version_header("GI", package_id, ".")
64
64
 
65
- gi_headers = ["girepository.h"]
66
- have_func("g_interface_info_find_signal", gi_headers)
67
-
68
65
  enum_type_prefix = "gobject-introspection-enum-types"
69
66
  include_paths = PKGConfig.cflags_only_I(package_id)
70
67
  headers = include_paths.split.inject([]) do |result, path|
@@ -120,7 +120,7 @@ rb_gi_ffi_closure_callback(G_GNUC_UNUSED ffi_cif *cif,
120
120
  i = args.metadata->len - 1;
121
121
  metadata = g_ptr_array_index(args.metadata, i);
122
122
  if (metadata->type.tag == GI_TYPE_TAG_VOID &&
123
- metadata->pointer_p &&
123
+ metadata->type.pointer_p &&
124
124
  strcmp(metadata->name, "data") == 0) {
125
125
  callback_data = *((RBGICallbackData **)(raw_args[i]));
126
126
  }
@@ -682,7 +682,7 @@ rb_gi_arguments_in_init_arg_ruby_array_c_gtype(RBGIArguments *args,
682
682
  raw_array = ALLOC_N(GType, n_elements);
683
683
  for (i = 0; i < n_elements; i++) {
684
684
  VALUE rb_type = RARRAY_AREF(rb_array, i);
685
- raw_array[i] = rbgobj_gtype_get(rb_type);
685
+ raw_array[i] = rbgobj_gtype_from_ruby(rb_type);
686
686
  }
687
687
 
688
688
  rb_gi_arguments_in_init_arg_ruby_array_c_generic(args,
@@ -721,26 +721,50 @@ rb_gi_arguments_in_init_arg_ruby_array_c_interface_struct(RBGIArguments *args,
721
721
  {
722
722
  GIStructInfo *struct_info =
723
723
  (GIStructInfo *)(metadata->element_type.interface_info);
724
- guint8 *raw_array;
725
- gsize struct_size;
726
724
  long i, n_elements;
727
725
 
728
726
  n_elements = RARRAY_LEN(rb_array);
729
- struct_size = g_struct_info_get_size(struct_info);
730
- raw_array = ALLOC_N(guint8, struct_size * n_elements);
731
- for (i = 0; i < n_elements; i++) {
732
- VALUE rb_element = RARRAY_AREF(rb_array, i);
733
- gpointer element;
734
- element = rb_gi_struct_info_from_ruby(struct_info, rb_element);
735
- memcpy(raw_array + (struct_size * i),
736
- element,
737
- struct_size);
727
+ if (metadata->element_type.pointer_p) {
728
+ if (metadata->transfer != GI_TRANSFER_NOTHING) {
729
+ rb_raise(rb_eNotImpError,
730
+ "TODO: [%s::%s] %s "
731
+ "Ruby -> GIArgument(array/%s)[interface(%s)](%s)[%s]",
732
+ args->name,
733
+ metadata->name,
734
+ rb_gi_direction_to_string(metadata->direction),
735
+ rb_gi_array_type_to_string(metadata->array_type),
736
+ g_info_type_to_string(metadata->element_type.interface_type),
737
+ g_type_name(metadata->element_type.interface_gtype),
738
+ rb_gi_transfer_to_string(metadata->transfer));
739
+ }
740
+ gpointer *raw_array = ALLOC_N(gpointer, n_elements);
741
+ for (i = 0; i < n_elements; i++) {
742
+ VALUE rb_element = RARRAY_AREF(rb_array, i);
743
+ gpointer element;
744
+ element = rb_gi_struct_info_from_ruby(struct_info, rb_element);
745
+ raw_array[i] = element;
746
+ }
747
+ rb_gi_arguments_in_init_arg_ruby_array_c_generic(args,
748
+ metadata,
749
+ rb_array,
750
+ raw_array);
751
+ } else {
752
+ gsize struct_size = g_struct_info_get_size(struct_info);
753
+ guint8 *raw_array = ALLOC_N(guint8, struct_size * n_elements);
754
+ for (i = 0; i < n_elements; i++) {
755
+ VALUE rb_element = RARRAY_AREF(rb_array, i);
756
+ gpointer element;
757
+ element = rb_gi_struct_info_from_ruby(struct_info, rb_element);
758
+ memcpy(raw_array + (struct_size * i),
759
+ element,
760
+ struct_size);
761
+ }
762
+ rb_gi_arguments_in_init_arg_ruby_array_c_generic(args,
763
+ metadata,
764
+ rb_array,
765
+ raw_array);
738
766
  }
739
767
 
740
- rb_gi_arguments_in_init_arg_ruby_array_c_generic(args,
741
- metadata,
742
- rb_array,
743
- raw_array);
744
768
  metadata->free_func = rb_gi_arguments_in_free_array_c_interface_struct;
745
769
  }
746
770
 
@@ -980,7 +1004,15 @@ rb_gi_arguments_in_init_arg_ruby_array_c(RBGIArguments *args,
980
1004
  rb_arg);
981
1005
  break;
982
1006
  case GI_TYPE_TAG_UTF8:
983
- {
1007
+ /* Workaround for rsvg_handle_set_stylesheet():
1008
+ https://gitlab.gnome.org/GNOME/librsvg/-/issues/596 */
1009
+ if (strcmp(metadata->name, "css") == 0) {
1010
+ metadata->in_arg->v_pointer = RVAL2CSTR(rb_arg);
1011
+ rb_gi_arguments_in_init_arg_ruby_array_set_length(args,
1012
+ metadata,
1013
+ RSTRING_LEN(rb_arg));
1014
+ metadata->free_func = NULL;
1015
+ } else {
984
1016
  GIArgument *array_argument = metadata->in_arg;
985
1017
  gchar **raw_array;
986
1018
  long length;
@@ -1230,15 +1262,6 @@ rb_gi_arguments_in_init_arg_ruby_interface(RBGIArguments *args,
1230
1262
  rb_gi_transfer_to_string(metadata->transfer));
1231
1263
  break;
1232
1264
  case GI_INFO_TYPE_STRUCT:
1233
- if (metadata->transfer != GI_TRANSFER_NOTHING) {
1234
- rb_raise(rb_eNotImpError,
1235
- "TODO: [%s] %s Ruby -> GIArgument(interface)[%s][%s][%s]",
1236
- metadata->name,
1237
- rb_gi_direction_to_string(metadata->direction),
1238
- g_info_type_to_string(metadata->type.interface_type),
1239
- g_type_name(metadata->type.interface_gtype),
1240
- rb_gi_transfer_to_string(metadata->transfer));
1241
- }
1242
1265
  metadata->free_func = rb_gi_arguments_in_free_interface_struct;
1243
1266
  if (metadata->type.interface_gtype == G_TYPE_VALUE) {
1244
1267
  GValue *gvalue;
@@ -1645,7 +1668,15 @@ rb_gi_arguments_in_init_arg_ruby_ghash_body(VALUE value_data)
1645
1668
  case GI_TYPE_TAG_FLOAT:
1646
1669
  case GI_TYPE_TAG_DOUBLE:
1647
1670
  case GI_TYPE_TAG_GTYPE:
1671
+ rb_raise(rb_eNotImpError,
1672
+ "TODO: Ruby -> GIArgument(GHash)[value][%s]",
1673
+ g_type_tag_to_string(metadata->value_type.tag));
1674
+ break;
1648
1675
  case GI_TYPE_TAG_UTF8:
1676
+ value_destroy_func = g_free;
1677
+ value_ruby_to_c_func = ruby_to_c_utf8;
1678
+ value_ruby_to_c_data.context = "Ruby -> GIArgument(GHash)[value][utf8]";
1679
+ break;
1649
1680
  case GI_TYPE_TAG_FILENAME:
1650
1681
  case GI_TYPE_TAG_ARRAY:
1651
1682
  rb_raise(rb_eNotImpError,
@@ -105,10 +105,11 @@ rb_gi_arguments_out_free_array_c_interface(RBGIArguments *args,
105
105
  case GI_TRANSFER_EVERYTHING:
106
106
  default:
107
107
  rb_raise(rb_eNotImpError,
108
- "TODO: [%s] %s free GIArgument(%s)[%s]",
108
+ "TODO: [%s] %s free GIArgument(%s/%s)[%s]",
109
109
  metadata->name,
110
110
  rb_gi_direction_to_string(metadata->direction),
111
111
  g_type_tag_to_string(metadata->type.tag),
112
+ rb_gi_array_type_to_string(metadata->array_type),
112
113
  rb_gi_transfer_to_string(metadata->transfer));
113
114
  }
114
115
  xfree(target);
@@ -120,17 +121,34 @@ rb_gi_arguments_out_free_array_array_interface_struct(RBGIArguments *args,
120
121
  gpointer user_data)
121
122
  {
122
123
  GArray *target = metadata->out_arg->v_pointer;
124
+ GType gtype = metadata->element_type.interface_gtype;
123
125
  switch (metadata->transfer) {
124
126
  case GI_TRANSFER_NOTHING:
125
127
  break;
126
128
  case GI_TRANSFER_CONTAINER:
129
+ break;
127
130
  case GI_TRANSFER_EVERYTHING:
131
+ if (gtype == G_TYPE_NONE) {
132
+ /* If the target struct is raw (not GType-ed) struct, we
133
+ * can't know how to free fields in the target struct. We
134
+ * assume that the target struct doesn't allocate nothing
135
+ * for its fields.
136
+ *
137
+ * e.g.: The attributes out argument in
138
+ * vte_terminal_get_text_range():
139
+ * https://developer.gnome.org/vte/unstable/VteTerminal.html#vte-terminal-get-text-range
140
+ */
141
+ break;
142
+ }
128
143
  default:
129
144
  rb_raise(rb_eNotImpError,
130
- "TODO: [%s] %s free GIArgument(%s)[%s]",
145
+ "TODO: [%s] %s free GIArgument(%s/%s)[interface(%s)](%s)[%s]",
131
146
  metadata->name,
132
147
  rb_gi_direction_to_string(metadata->direction),
133
148
  g_type_tag_to_string(metadata->type.tag),
149
+ rb_gi_array_type_to_string(metadata->array_type),
150
+ g_info_type_to_string(metadata->element_type.interface_type),
151
+ g_type_name(metadata->element_type.interface_gtype),
134
152
  rb_gi_transfer_to_string(metadata->transfer));
135
153
  }
136
154
  g_array_free(target, TRUE);
@@ -505,16 +523,18 @@ rb_gi_arguments_out_init_arg_interface(RBGIArguments *args,
505
523
  g_info_type_to_string(metadata->type.interface_type));
506
524
  break;
507
525
  case GI_INFO_TYPE_STRUCT:
508
- {
509
- gsize struct_size;
510
-
511
- /* Should we care gtype?
512
- Related: rb_gi_arguments_out_arg_clear_interface() */
513
- struct_size = g_struct_info_get_size(metadata->type.interface_info);
526
+ /* Should we care gtype? */
527
+ if (metadata->type.pointer_p) {
528
+ gpointer *struct_location = RB_ALLOC(gpointer);
529
+ *struct_location = NULL;
530
+ argument->v_pointer = struct_location;
531
+ } else {
532
+ gsize struct_size =
533
+ g_struct_info_get_size(metadata->type.interface_info);
514
534
  argument->v_pointer = xmalloc(struct_size);
515
535
  memset(argument->v_pointer, 0, struct_size);
516
- metadata->free_func = rb_gi_arguments_out_free_interface_struct;
517
536
  }
537
+ metadata->free_func = rb_gi_arguments_out_free_interface_struct;
518
538
  break;
519
539
  case GI_INFO_TYPE_BOXED:
520
540
  rb_raise(rb_eNotImpError,
@@ -584,7 +604,7 @@ rb_gi_arguments_out_init_arg(RBGIArguments *args,
584
604
  memset(argument, 0, sizeof(GIArgument));
585
605
  switch (metadata->type.tag) {
586
606
  case GI_TYPE_TAG_VOID:
587
- if (metadata->pointer_p) {
607
+ if (metadata->type.pointer_p) {
588
608
  gpointer *pointer = ALLOC(gpointer);
589
609
  *pointer = NULL;
590
610
  argument->v_pointer = pointer;
@@ -800,7 +820,7 @@ rb_gi_arguments_out_to_ruby_arg(RBGIArguments *args,
800
820
  memset(&normalized_argument, 0, sizeof(GIArgument));
801
821
  switch (metadata->type.tag) {
802
822
  case GI_TYPE_TAG_VOID:
803
- if (metadata->pointer_p) {
823
+ if (metadata->type.pointer_p) {
804
824
  normalized_argument.v_pointer = *((gpointer *)(argument->v_pointer));
805
825
  }
806
826
  break;
@@ -1,6 +1,6 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
2
  /*
3
- * Copyright (C) 2012-2019 Ruby-GNOME Project Team
3
+ * Copyright (C) 2012-2021 Ruby-GNOME Project Team
4
4
  *
5
5
  * This library is free software; you can redistribute it and/or
6
6
  * modify it under the terms of the GNU Lesser General Public
@@ -23,16 +23,7 @@
23
23
  static gboolean
24
24
  rb_gi_arg_info_may_be_null(GIArgInfo *arg_info)
25
25
  {
26
- #if GI_CHECK_VERSION(1, 42, 0)
27
26
  return g_arg_info_may_be_null(arg_info);
28
- #else
29
- /*
30
- GObject Introspection < 1.42 doesn't support "(nullable)" yet.
31
- So, we assume that all argument may be NULL. It's danger but
32
- convenient.
33
- */
34
- return TRUE;
35
- #endif
36
27
  }
37
28
 
38
29
  static gboolean
@@ -57,12 +48,14 @@ rb_gi_arg_metadata_type_init(RBGIArgMetadataType *type,
57
48
  GITypeInfo *type_info)
58
49
  {
59
50
  type->info = type_info;
51
+ type->pointer_p = FALSE;
60
52
  type->tag = GI_TYPE_TAG_VOID;
61
53
  type->interface_info = NULL;
62
54
  type->interface_type = GI_INFO_TYPE_INVALID;
63
55
  type->interface_gtype = G_TYPE_INVALID;
64
56
 
65
57
  if (type->info) {
58
+ type->pointer_p = g_type_info_is_pointer(type->info);
66
59
  type->tag = g_type_info_get_tag(type->info);
67
60
  }
68
61
  if (type->tag == GI_TYPE_TAG_INTERFACE) {
@@ -114,7 +107,6 @@ rb_gi_arg_metadata_new(GICallableInfo *callable_info, gint i)
114
107
  metadata->array_p = (metadata->type.tag == GI_TYPE_TAG_ARRAY);
115
108
  metadata->array_length_p = FALSE;
116
109
  metadata->may_be_null_p = rb_gi_arg_info_may_be_null(arg_info);
117
- metadata->pointer_p = g_type_info_is_pointer(type_info);
118
110
  metadata->caller_allocates_p = g_arg_info_is_caller_allocates(arg_info);
119
111
  metadata->zero_terminated_p = FALSE;
120
112
  metadata->output_buffer_p = rb_gi_arg_info_is_output_buffer(arg_info);
@@ -1,6 +1,6 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
2
  /*
3
- * Copyright (C) 2012-2017 Ruby-GNOME2 Project Team
3
+ * Copyright (C) 2012-2021 Ruby-GNOME Project Team
4
4
  *
5
5
  * This library is free software; you can redistribute it and/or
6
6
  * modify it under the terms of the GNU Lesser General Public
@@ -125,15 +125,9 @@ rg_get_signal(VALUE self, VALUE rb_n_or_name)
125
125
  n = NUM2INT(rb_n_or_name);
126
126
  signal_info = g_interface_info_get_signal(info, n);
127
127
  } else {
128
- #ifdef HAVE_G_INTERFACE_INFO_FIND_SIGNAL
129
128
  const char *name;
130
129
  name = RVAL2CSTR(rb_n_or_name);
131
130
  signal_info = g_interface_info_find_signal(info, name);
132
- #else
133
- rb_raise(rb_eArgError,
134
- "g_interface_info_find_signal() is defined "
135
- "since GObjectIntrospection 1.34");
136
- #endif
137
131
  }
138
132
 
139
133
  return GI_BASE_INFO2RVAL_WITH_UNREF(signal_info);
@@ -39,7 +39,7 @@ rg_s_define_class(int argc, VALUE *argv, G_GNUC_UNUSED VALUE klass)
39
39
  "size", &rb_size,
40
40
  NULL);
41
41
 
42
- gtype = NUM2ULONG(rb_to_int(rb_gtype));
42
+ gtype = rbgobj_gtype_from_ruby(rb_gtype);
43
43
  rb_class = G_DEF_CLASS_WITH_PARENT(gtype, RVAL2CSTR(rb_name),
44
44
  rb_module, rb_parent);
45
45
  if (!NIL_P(rb_size)) {
@@ -54,7 +54,7 @@ rg_s_define_interface(G_GNUC_UNUSED VALUE klass,
54
54
  {
55
55
  GType gtype;
56
56
 
57
- gtype = rbgobj_gtype_get(rb_gtype);
57
+ gtype = rbgobj_gtype_from_ruby(rb_gtype);
58
58
  return G_DEF_INTERFACE(gtype, RVAL2CSTR(rb_name), rb_module);
59
59
  }
60
60
 
@@ -133,7 +133,7 @@ rg_s_define_error(int argc, VALUE *argv, G_GNUC_UNUSED VALUE klass)
133
133
  }
134
134
 
135
135
  if (!NIL_P(rb_gtype)) {
136
- gtype = NUM2ULONG(rb_funcall(rb_gtype, rb_intern("to_i"), 0));
136
+ gtype = rbgobj_gtype_from_ruby(rb_gtype);
137
137
  }
138
138
 
139
139
  return G_DEF_ERROR(domain, name, rb_module, rb_parent, gtype);
@@ -173,12 +173,10 @@ rg_s_register_boxed_class_converter(VALUE klass, VALUE rb_gtype)
173
173
  {
174
174
  RGConvertTable table;
175
175
  BoxedInstance2RObjData *data;
176
- ID id_to_i;
177
176
  VALUE boxed_class_converters;
178
177
 
179
178
  memset(&table, 0, sizeof(RGConvertTable));
180
- CONST_ID(id_to_i, "to_i");
181
- table.type = NUM2ULONG(rb_funcall(rb_gtype, id_to_i, 0));
179
+ table.type = rbgobj_gtype_from_ruby(rb_gtype);
182
180
  table.klass = Qnil;
183
181
  table.instance2robj = boxed_instance2robj;
184
182
 
@@ -243,12 +241,10 @@ rg_s_register_object_class_converter(VALUE klass, VALUE rb_gtype)
243
241
  {
244
242
  RGConvertTable table;
245
243
  ObjectInstance2RObjData *data;
246
- ID id_to_i;
247
244
  VALUE object_class_converters;
248
245
 
249
246
  memset(&table, 0, sizeof(RGConvertTable));
250
- CONST_ID(id_to_i, "to_i");
251
- table.type = NUM2ULONG(rb_funcall(rb_gtype, id_to_i, 0));
247
+ table.type = rbgobj_gtype_from_ruby(rb_gtype);
252
248
  table.klass = Qnil;
253
249
  table.instance2robj = object_instance2robj;
254
250
 
@@ -40,6 +40,7 @@ typedef void (*RBGIArgFreeFunc)(RBGIArguments *args,
40
40
 
41
41
  typedef struct {
42
42
  GITypeInfo *info;
43
+ gboolean pointer_p;
43
44
  GITypeTag tag;
44
45
  GIBaseInfo *interface_info;
45
46
  GIInfoType interface_type;
@@ -64,7 +65,6 @@ struct RBGIArgMetadata_ {
64
65
  gboolean array_length_p;
65
66
  gboolean interface_p;
66
67
  gboolean may_be_null_p;
67
- gboolean pointer_p;
68
68
  gboolean caller_allocates_p;
69
69
  gboolean zero_terminated_p;
70
70
  gboolean output_buffer_p;
@@ -228,7 +228,7 @@ rg_find(int argc, VALUE *argv, VALUE self)
228
228
  VALUE rb_gtype;
229
229
  GType gtype;
230
230
  rb_gtype = argv[0];
231
- gtype = NUM2UINT(rb_gtype);
231
+ gtype = rbgobj_gtype_from_ruby(rb_gtype);
232
232
  info = g_irepository_find_by_gtype(SELF(self), gtype);
233
233
  } else {
234
234
  VALUE rb_namespace, rb_name;
@@ -84,7 +84,7 @@ rb_gi_struct_get_raw(VALUE rb_struct, GType gtype)
84
84
  if (rb_respond_to(rb_struct_class, rb_intern("gtype"))) {
85
85
  VALUE rb_gtype;
86
86
  rb_gtype = rb_funcall(rb_struct_class, rb_intern("gtype"), 0);
87
- gtype = NUM2ULONG(rb_funcall(rb_gtype, rb_intern("to_i"), 0));
87
+ gtype = rbgobj_gtype_from_ruby(rb_gtype);
88
88
  }
89
89
  }
90
90
  if (gtype == G_TYPE_NONE) {
@@ -146,7 +146,7 @@ rb_gi_struct_info_to_ruby(GIStructInfo *info,
146
146
  GType gtype;
147
147
 
148
148
  rb_gtype = rb_funcall(rb_class, rb_intern("gtype"), 0);
149
- gtype = NUM2ULONG(rb_funcall(rb_gtype, rb_intern("to_i"), 0));
149
+ gtype = rbgobj_gtype_from_ruby(rb_gtype);
150
150
  return BOXED2RVAL(object, gtype);
151
151
  }
152
152
 
@@ -681,10 +681,10 @@ module GObjectIntrospection
681
681
  def normalize_arguments!(arguments, abort_tag)
682
682
  arguments.size.times do |i|
683
683
  argument = arguments[i]
684
- next if argument.nil?
685
684
  type = @in_arg_types[i]
686
685
  converted_argument = type.try_convert(argument)
687
686
  if converted_argument.nil?
687
+ next if argument.nil?
688
688
  if abort_tag
689
689
  throw(abort_tag)
690
690
  elsif @on_invalid == :fallback
@@ -29,6 +29,8 @@ module GObjectIntrospection
29
29
  case value
30
30
  when true, false
31
31
  value
32
+ when nil
33
+ false
32
34
  else
33
35
  nil
34
36
  end
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2012 Ruby-GNOME2 Project Team
1
+ # Copyright (C) 2012-2021 Ruby-GNOME Project Team
2
2
  #
3
3
  # This library is free software; you can redistribute it and/or
4
4
  # modify it under the terms of the GNU Lesser General Public
@@ -14,7 +14,7 @@
14
14
  # License along with this library; if not, write to the Free Software
15
15
  # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
- require "test-unit"
17
+ require "gobject-introspection"
18
18
 
19
19
  module GObjectIntrospectionTestUtils
20
20
  def require_version(major, minor, micro)
data/test/run-test.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  #
3
- # Copyright (C) 2012-2015 Ruby-GNOME2 Project Team
3
+ # Copyright (C) 2012-2021 Ruby-GNOME Project Team
4
4
  #
5
5
  # This library is free software; you can redistribute it and/or
6
6
  # modify it under the terms of the GNU Lesser General Public
@@ -16,31 +16,20 @@
16
16
  # License along with this library; if not, write to the Free Software
17
17
  # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
18
 
19
- ruby_gnome2_base = File.join(File.dirname(__FILE__), "..", "..")
20
- ruby_gnome2_base = File.expand_path(ruby_gnome2_base)
19
+ require_relative "../../glib2/test/run-test"
21
20
 
22
- glib_base = File.join(ruby_gnome2_base, "glib2")
23
- gobject_introspection_base = File.join(ruby_gnome2_base, "gobject-introspection")
21
+ run_test(__dir__,
22
+ [
23
+ "glib2",
24
+ "gobject-introspection",
25
+ ]) do |context|
26
+ require_relative "gobject-introspection-test-utils"
24
27
 
25
- modules = [
26
- [glib_base, "glib2"],
27
- [gobject_introspection_base, "gobject-introspection"]
28
- ]
29
- modules.each do |target, module_name|
30
- if File.exist?("#{target}/Makefile") and system("which make > /dev/null")
31
- `make -C #{target.dump} > /dev/null` or exit(false)
28
+ begin
29
+ repository = GObjectIntrospection::Repository.default
30
+ repository.require("Gio")
31
+ rescue GObjectIntrospection::RepositoryError
32
+ puts("Omit because typelib file doesn't exist: #{$!.message}")
33
+ exit(true)
32
34
  end
33
- $LOAD_PATH.unshift(File.join(target, "ext", module_name))
34
- $LOAD_PATH.unshift(File.join(target, "lib"))
35
35
  end
36
-
37
- $LOAD_PATH.unshift(File.join(glib_base, "test"))
38
- require "glib-test-init"
39
-
40
- $LOAD_PATH.unshift(File.join(gobject_introspection_base, "test"))
41
- require "gobject-introspection-test-utils"
42
-
43
- require "gobject-introspection"
44
-
45
- exit Test::Unit::AutoRunner.run(true,
46
- File.join(gobject_introspection_base, "test"))
@@ -32,7 +32,15 @@ class TestCallableInfo < Test::Unit::TestCase
32
32
  end
33
33
 
34
34
  def test_may_return_null?
35
- assert_false(@info.may_return_null?)
35
+ if GObjectIntrospection::Version.or_later?(1, 67, 0)
36
+ assert do
37
+ @info.may_return_null?
38
+ end
39
+ else
40
+ assert do
41
+ not @info.may_return_null?
42
+ end
43
+ end
36
44
  end
37
45
 
38
46
  def test_n_args
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gobject-introspection
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.9
4
+ version: 3.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - The Ruby-GNOME Project Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-10-10 00:00:00.000000000 Z
11
+ date: 2021-04-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: glib2
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 3.3.9
19
+ version: 3.4.4
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: 3.3.9
26
+ version: 3.4.4
27
27
  description: Ruby/GObjectIntrospection provides bindings of GObject Introspection
28
28
  and a loader module that can generate dynamically Ruby bindings of any GObject C
29
29
  libraries
@@ -38,8 +38,6 @@ files:
38
38
  - Rakefile
39
39
  - ext/gobject-introspection/depend
40
40
  - ext/gobject-introspection/extconf.rb
41
- - ext/gobject-introspection/gobject-introspection-enum-types.c
42
- - ext/gobject-introspection/gobject-introspection-enum-types.h
43
41
  - ext/gobject-introspection/gobject_introspection.def
44
42
  - ext/gobject-introspection/rb-gi-arg-info.c
45
43
  - ext/gobject-introspection/rb-gi-argument.c
@@ -88,7 +86,6 @@ files:
88
86
  - ext/gobject-introspection/rb-gi-vfunc-info.c
89
87
  - ext/gobject-introspection/rb-gobject-introspection.c
90
88
  - ext/gobject-introspection/rb-gobject-introspection.h
91
- - ext/gobject-introspection/rbgiversion.h
92
89
  - extconf.rb
93
90
  - gobject-introspection.gemspec
94
91
  - lib/gi.rb
@@ -154,8 +151,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
154
151
  - !ruby/object:Gem::Version
155
152
  version: '0'
156
153
  requirements: []
157
- rubyforge_project:
158
- rubygems_version: 2.7.6.2
154
+ rubygems_version: 3.3.0.dev
159
155
  signing_key:
160
156
  specification_version: 4
161
157
  summary: Ruby/GObjectIntrospection is a Ruby binding of GObject Introspection.
@@ -1,230 +0,0 @@
1
-
2
- /* Generated by glib-mkenums.rb ($Id$) */
3
-
4
- #include "gobject-introspection-enum-types.h"
5
- #include <girepository.h>
6
-
7
-
8
-
9
- /* enumerations from "/usr/include/gobject-introspection-1.0/girepository.h" */
10
- GType
11
- g_i_repository_load_flags_get_type (void)
12
- {
13
- static GType etype = 0;
14
- if (etype == 0) {
15
- static const GFlagsValue values[] = {
16
- { G_IREPOSITORY_LOAD_FLAG_LAZY, "G_IREPOSITORY_LOAD_FLAG_LAZY", "g-irepository-load-flag-lazy" },
17
- { 0, NULL, NULL }
18
- };
19
- etype = g_flags_register_static ("GIRepositoryLoadFlags", values);
20
- }
21
- return etype;
22
- }
23
-
24
- GType
25
- g_i_repository_error_get_type (void)
26
- {
27
- static GType etype = 0;
28
- if (etype == 0) {
29
- static const GEnumValue values[] = {
30
- { G_IREPOSITORY_ERROR_TYPELIB_NOT_FOUND, "G_IREPOSITORY_ERROR_TYPELIB_NOT_FOUND", "typelib-not-found" },
31
- { G_IREPOSITORY_ERROR_NAMESPACE_MISMATCH, "G_IREPOSITORY_ERROR_NAMESPACE_MISMATCH", "namespace-mismatch" },
32
- { G_IREPOSITORY_ERROR_NAMESPACE_VERSION_CONFLICT, "G_IREPOSITORY_ERROR_NAMESPACE_VERSION_CONFLICT", "namespace-version-conflict" },
33
- { G_IREPOSITORY_ERROR_LIBRARY_NOT_FOUND, "G_IREPOSITORY_ERROR_LIBRARY_NOT_FOUND", "library-not-found" },
34
- { 0, NULL, NULL }
35
- };
36
- etype = g_enum_register_static ("GIRepositoryError", values);
37
- }
38
- return etype;
39
- }
40
-
41
-
42
- /* enumerations from "/usr/include/gobject-introspection-1.0/gitypes.h" */
43
- GType
44
- g_i_info_type_get_type (void)
45
- {
46
- static GType etype = 0;
47
- if (etype == 0) {
48
- static const GEnumValue values[] = {
49
- { GI_INFO_TYPE_INVALID, "GI_INFO_TYPE_INVALID", "invalid" },
50
- { GI_INFO_TYPE_FUNCTION, "GI_INFO_TYPE_FUNCTION", "function" },
51
- { GI_INFO_TYPE_CALLBACK, "GI_INFO_TYPE_CALLBACK", "callback" },
52
- { GI_INFO_TYPE_STRUCT, "GI_INFO_TYPE_STRUCT", "struct" },
53
- { GI_INFO_TYPE_BOXED, "GI_INFO_TYPE_BOXED", "boxed" },
54
- { GI_INFO_TYPE_ENUM, "GI_INFO_TYPE_ENUM", "enum" },
55
- { GI_INFO_TYPE_FLAGS, "GI_INFO_TYPE_FLAGS", "flags" },
56
- { GI_INFO_TYPE_OBJECT, "GI_INFO_TYPE_OBJECT", "object" },
57
- { GI_INFO_TYPE_INTERFACE, "GI_INFO_TYPE_INTERFACE", "interface" },
58
- { GI_INFO_TYPE_CONSTANT, "GI_INFO_TYPE_CONSTANT", "constant" },
59
- { GI_INFO_TYPE_INVALID_0, "GI_INFO_TYPE_INVALID_0", "invalid-0" },
60
- { GI_INFO_TYPE_UNION, "GI_INFO_TYPE_UNION", "union" },
61
- { GI_INFO_TYPE_VALUE, "GI_INFO_TYPE_VALUE", "value" },
62
- { GI_INFO_TYPE_SIGNAL, "GI_INFO_TYPE_SIGNAL", "signal" },
63
- { GI_INFO_TYPE_VFUNC, "GI_INFO_TYPE_VFUNC", "vfunc" },
64
- { GI_INFO_TYPE_PROPERTY, "GI_INFO_TYPE_PROPERTY", "property" },
65
- { GI_INFO_TYPE_FIELD, "GI_INFO_TYPE_FIELD", "field" },
66
- { GI_INFO_TYPE_ARG, "GI_INFO_TYPE_ARG", "arg" },
67
- { GI_INFO_TYPE_TYPE, "GI_INFO_TYPE_TYPE", "type" },
68
- { GI_INFO_TYPE_UNRESOLVED, "GI_INFO_TYPE_UNRESOLVED", "unresolved" },
69
- { 0, NULL, NULL }
70
- };
71
- etype = g_enum_register_static ("GIInfoType", values);
72
- }
73
- return etype;
74
- }
75
-
76
- GType
77
- g_i_transfer_get_type (void)
78
- {
79
- static GType etype = 0;
80
- if (etype == 0) {
81
- static const GEnumValue values[] = {
82
- { GI_TRANSFER_NOTHING, "GI_TRANSFER_NOTHING", "nothing" },
83
- { GI_TRANSFER_CONTAINER, "GI_TRANSFER_CONTAINER", "container" },
84
- { GI_TRANSFER_EVERYTHING, "GI_TRANSFER_EVERYTHING", "everything" },
85
- { 0, NULL, NULL }
86
- };
87
- etype = g_enum_register_static ("GITransfer", values);
88
- }
89
- return etype;
90
- }
91
-
92
- GType
93
- g_i_direction_get_type (void)
94
- {
95
- static GType etype = 0;
96
- if (etype == 0) {
97
- static const GEnumValue values[] = {
98
- { GI_DIRECTION_IN, "GI_DIRECTION_IN", "in" },
99
- { GI_DIRECTION_OUT, "GI_DIRECTION_OUT", "out" },
100
- { GI_DIRECTION_INOUT, "GI_DIRECTION_INOUT", "inout" },
101
- { 0, NULL, NULL }
102
- };
103
- etype = g_enum_register_static ("GIDirection", values);
104
- }
105
- return etype;
106
- }
107
-
108
- GType
109
- g_i_scope_type_get_type (void)
110
- {
111
- static GType etype = 0;
112
- if (etype == 0) {
113
- static const GEnumValue values[] = {
114
- { GI_SCOPE_TYPE_INVALID, "GI_SCOPE_TYPE_INVALID", "invalid" },
115
- { GI_SCOPE_TYPE_CALL, "GI_SCOPE_TYPE_CALL", "call" },
116
- { GI_SCOPE_TYPE_ASYNC, "GI_SCOPE_TYPE_ASYNC", "async" },
117
- { GI_SCOPE_TYPE_NOTIFIED, "GI_SCOPE_TYPE_NOTIFIED", "notified" },
118
- { 0, NULL, NULL }
119
- };
120
- etype = g_enum_register_static ("GIScopeType", values);
121
- }
122
- return etype;
123
- }
124
-
125
- GType
126
- g_i_type_tag_get_type (void)
127
- {
128
- static GType etype = 0;
129
- if (etype == 0) {
130
- static const GEnumValue values[] = {
131
- { GI_TYPE_TAG_VOID, "GI_TYPE_TAG_VOID", "void" },
132
- { GI_TYPE_TAG_BOOLEAN, "GI_TYPE_TAG_BOOLEAN", "boolean" },
133
- { GI_TYPE_TAG_INT8, "GI_TYPE_TAG_INT8", "int8" },
134
- { GI_TYPE_TAG_UINT8, "GI_TYPE_TAG_UINT8", "uint8" },
135
- { GI_TYPE_TAG_INT16, "GI_TYPE_TAG_INT16", "int16" },
136
- { GI_TYPE_TAG_UINT16, "GI_TYPE_TAG_UINT16", "uint16" },
137
- { GI_TYPE_TAG_INT32, "GI_TYPE_TAG_INT32", "int32" },
138
- { GI_TYPE_TAG_UINT32, "GI_TYPE_TAG_UINT32", "uint32" },
139
- { GI_TYPE_TAG_INT64, "GI_TYPE_TAG_INT64", "int64" },
140
- { GI_TYPE_TAG_UINT64, "GI_TYPE_TAG_UINT64", "uint64" },
141
- { GI_TYPE_TAG_FLOAT, "GI_TYPE_TAG_FLOAT", "float" },
142
- { GI_TYPE_TAG_DOUBLE, "GI_TYPE_TAG_DOUBLE", "double" },
143
- { GI_TYPE_TAG_GTYPE, "GI_TYPE_TAG_GTYPE", "gtype" },
144
- { GI_TYPE_TAG_UTF8, "GI_TYPE_TAG_UTF8", "utf8" },
145
- { GI_TYPE_TAG_FILENAME, "GI_TYPE_TAG_FILENAME", "filename" },
146
- { GI_TYPE_TAG_ARRAY, "GI_TYPE_TAG_ARRAY", "array" },
147
- { GI_TYPE_TAG_INTERFACE, "GI_TYPE_TAG_INTERFACE", "interface" },
148
- { GI_TYPE_TAG_GLIST, "GI_TYPE_TAG_GLIST", "glist" },
149
- { GI_TYPE_TAG_GSLIST, "GI_TYPE_TAG_GSLIST", "gslist" },
150
- { GI_TYPE_TAG_GHASH, "GI_TYPE_TAG_GHASH", "ghash" },
151
- { GI_TYPE_TAG_ERROR, "GI_TYPE_TAG_ERROR", "error" },
152
- { GI_TYPE_TAG_UNICHAR, "GI_TYPE_TAG_UNICHAR", "unichar" },
153
- { 0, NULL, NULL }
154
- };
155
- etype = g_enum_register_static ("GITypeTag", values);
156
- }
157
- return etype;
158
- }
159
-
160
- GType
161
- g_i_array_type_get_type (void)
162
- {
163
- static GType etype = 0;
164
- if (etype == 0) {
165
- static const GEnumValue values[] = {
166
- { GI_ARRAY_TYPE_C, "GI_ARRAY_TYPE_C", "c" },
167
- { GI_ARRAY_TYPE_ARRAY, "GI_ARRAY_TYPE_ARRAY", "array" },
168
- { GI_ARRAY_TYPE_PTR_ARRAY, "GI_ARRAY_TYPE_PTR_ARRAY", "ptr-array" },
169
- { GI_ARRAY_TYPE_BYTE_ARRAY, "GI_ARRAY_TYPE_BYTE_ARRAY", "byte-array" },
170
- { 0, NULL, NULL }
171
- };
172
- etype = g_enum_register_static ("GIArrayType", values);
173
- }
174
- return etype;
175
- }
176
-
177
- GType
178
- g_i_field_info_flags_get_type (void)
179
- {
180
- static GType etype = 0;
181
- if (etype == 0) {
182
- static const GFlagsValue values[] = {
183
- { GI_FIELD_IS_READABLE, "GI_FIELD_IS_READABLE", "readable" },
184
- { GI_FIELD_IS_WRITABLE, "GI_FIELD_IS_WRITABLE", "writable" },
185
- { 0, NULL, NULL }
186
- };
187
- etype = g_flags_register_static ("GIFieldInfoFlags", values);
188
- }
189
- return etype;
190
- }
191
-
192
- GType
193
- g_iv_func_info_flags_get_type (void)
194
- {
195
- static GType etype = 0;
196
- if (etype == 0) {
197
- static const GFlagsValue values[] = {
198
- { GI_VFUNC_MUST_CHAIN_UP, "GI_VFUNC_MUST_CHAIN_UP", "must-chain-up" },
199
- { GI_VFUNC_MUST_OVERRIDE, "GI_VFUNC_MUST_OVERRIDE", "must-override" },
200
- { GI_VFUNC_MUST_NOT_OVERRIDE, "GI_VFUNC_MUST_NOT_OVERRIDE", "must-not-override" },
201
- { GI_VFUNC_THROWS, "GI_VFUNC_THROWS", "throws" },
202
- { 0, NULL, NULL }
203
- };
204
- etype = g_flags_register_static ("GIVFuncInfoFlags", values);
205
- }
206
- return etype;
207
- }
208
-
209
- GType
210
- g_i_function_info_flags_get_type (void)
211
- {
212
- static GType etype = 0;
213
- if (etype == 0) {
214
- static const GFlagsValue values[] = {
215
- { GI_FUNCTION_IS_METHOD, "GI_FUNCTION_IS_METHOD", "is-method" },
216
- { GI_FUNCTION_IS_CONSTRUCTOR, "GI_FUNCTION_IS_CONSTRUCTOR", "is-constructor" },
217
- { GI_FUNCTION_IS_GETTER, "GI_FUNCTION_IS_GETTER", "is-getter" },
218
- { GI_FUNCTION_IS_SETTER, "GI_FUNCTION_IS_SETTER", "is-setter" },
219
- { GI_FUNCTION_WRAPS_VFUNC, "GI_FUNCTION_WRAPS_VFUNC", "wraps-vfunc" },
220
- { GI_FUNCTION_THROWS, "GI_FUNCTION_THROWS", "throws" },
221
- { 0, NULL, NULL }
222
- };
223
- etype = g_flags_register_static ("GIFunctionInfoFlags", values);
224
- }
225
- return etype;
226
- }
227
-
228
-
229
- /* Generated data ends here */
230
-
@@ -1,42 +0,0 @@
1
-
2
- /* Generated by glib-mkenums.rb ($Id$) */
3
-
4
- #ifndef __GOBJECT_INTROSPECTION_ENUM_TYPES_H__
5
- #define __GOBJECT_INTROSPECTION_ENUM_TYPES_H__
6
-
7
- #include <glib-object.h>
8
-
9
- G_BEGIN_DECLS
10
-
11
- /* enumerations from "/usr/include/gobject-introspection-1.0/girepository.h" */
12
- GType g_i_repository_load_flags_get_type (void);
13
- #define G_TYPE_I_REPOSITORY_LOAD_FLAGS (g_i_repository_load_flags_get_type())
14
- GType g_i_repository_error_get_type (void);
15
- #define G_TYPE_I_REPOSITORY_ERROR (g_i_repository_error_get_type())
16
-
17
- /* enumerations from "/usr/include/gobject-introspection-1.0/gitypes.h" */
18
- GType g_i_info_type_get_type (void);
19
- #define G_TYPE_I_INFO_TYPE (g_i_info_type_get_type())
20
- GType g_i_transfer_get_type (void);
21
- #define G_TYPE_I_TRANSFER (g_i_transfer_get_type())
22
- GType g_i_direction_get_type (void);
23
- #define G_TYPE_I_DIRECTION (g_i_direction_get_type())
24
- GType g_i_scope_type_get_type (void);
25
- #define G_TYPE_I_SCOPE_TYPE (g_i_scope_type_get_type())
26
- GType g_i_type_tag_get_type (void);
27
- #define G_TYPE_I_TYPE_TAG (g_i_type_tag_get_type())
28
- GType g_i_array_type_get_type (void);
29
- #define G_TYPE_I_ARRAY_TYPE (g_i_array_type_get_type())
30
- GType g_i_field_info_flags_get_type (void);
31
- #define G_TYPE_I_FIELD_INFO_FLAGS (g_i_field_info_flags_get_type())
32
- GType g_iv_func_info_flags_get_type (void);
33
- #define G_TYPE_IV_FUNC_INFO_FLAGS (g_iv_func_info_flags_get_type())
34
- GType g_i_function_info_flags_get_type (void);
35
- #define G_TYPE_I_FUNCTION_INFO_FLAGS (g_i_function_info_flags_get_type())
36
-
37
- G_END_DECLS
38
-
39
- #endif /* __GOBJECT_INTROSPECTION_ENUM_TYPES_H__ */
40
-
41
- /* Generated data ends here */
42
-
@@ -1,24 +0,0 @@
1
- /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /************************************************
3
-
4
- rbgiversion.h -
5
-
6
- This file was generated by mkmf-gnome2.rb.
7
-
8
- ************************************************/
9
-
10
- #ifndef __RBGI_VERSION_H__
11
- #define __RBGI_VERSION_H__
12
-
13
- #define GI_MAJOR_VERSION (1)
14
- #define GI_MINOR_VERSION (46)
15
- #define GI_MICRO_VERSION (0)
16
-
17
- #define GI_CHECK_VERSION(major,minor,micro) \
18
- (GI_MAJOR_VERSION > (major) || \
19
- (GI_MAJOR_VERSION == (major) && GI_MINOR_VERSION > (minor)) || \
20
- (GI_MAJOR_VERSION == (major) && GI_MINOR_VERSION == (minor) && \
21
- GI_MICRO_VERSION >= (micro)))
22
-
23
-
24
- #endif /* __RBGI_VERSION_H__ */