glib2 3.4.3 → 3.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -5
- data/ext/glib2/extconf.rb +1 -5
- data/ext/glib2/glib-enum-types.c +1233 -0
- data/ext/glib2/glib-enum-types.h +154 -0
- data/ext/glib2/glib2.def +2 -0
- data/ext/glib2/rbglib-bytes.c +1 -5
- data/ext/glib2/rbglib-gc.c +98 -52
- data/ext/glib2/rbglib-variant-type.c +1 -5
- data/ext/glib2/rbglib-variant.c +6 -7
- data/ext/glib2/rbglib.c +68 -1
- data/ext/glib2/rbglib.h +13 -3
- data/ext/glib2/rbglib_bookmarkfile.c +1 -1
- data/ext/glib2/rbglib_datetime.c +1 -5
- data/ext/glib2/rbglib_error.c +39 -12
- data/ext/glib2/rbglib_fileutils.c +1 -17
- data/ext/glib2/rbglib_iochannel.c +4 -4
- data/ext/glib2/rbglib_keyfile.c +1 -35
- data/ext/glib2/rbglib_maincontext.c +6 -32
- data/ext/glib2/rbglib_mainloop.c +2 -17
- data/ext/glib2/rbglib_matchinfo.c +1 -5
- data/ext/glib2/rbglib_messages.c +4 -5
- data/ext/glib2/rbglib_pollfd.c +1 -25
- data/ext/glib2/rbglib_regex.c +1 -13
- data/ext/glib2/rbglib_source.c +1 -39
- data/ext/glib2/rbglib_spawn.c +5 -10
- data/ext/glib2/rbglib_spawnerror.c +2 -2
- data/ext/glib2/rbglib_threads.c +2 -15
- data/ext/glib2/rbglib_timezone.c +1 -5
- data/ext/glib2/rbglib_unichar.c +46 -5
- data/ext/glib2/rbglib_unicode.c +1 -18
- data/ext/glib2/rbglib_utils.c +1 -14
- data/ext/glib2/rbglib_win32.c +3 -7
- data/ext/glib2/rbgobj_binding.c +1 -7
- data/ext/glib2/rbgobj_boxed.c +1 -1
- data/ext/glib2/rbgobj_closure.c +22 -9
- data/ext/glib2/rbgobj_enums.c +3 -2
- data/ext/glib2/rbgobj_flags.c +1 -1
- data/ext/glib2/rbgobj_object.c +117 -106
- data/ext/glib2/rbgobj_param.c +3 -9
- data/ext/glib2/rbgobj_paramspecs.c +6 -24
- data/ext/glib2/rbgobj_signal.c +105 -93
- data/ext/glib2/rbgobj_strv.c +2 -2
- data/ext/glib2/rbgobj_type.c +58 -67
- data/ext/glib2/rbgobj_typeinterface.c +38 -2
- data/ext/glib2/rbgobj_value.c +23 -8
- data/ext/glib2/rbgobj_valuetypes.c +14 -62
- data/ext/glib2/rbgobject.c +4 -6
- data/ext/glib2/rbgobject.h +2 -27
- data/ext/glib2/rbgprivate.h +10 -6
- data/ext/glib2/rbgutil.h +3 -2
- data/ext/glib2/rbgutil_callback.c +30 -27
- data/lib/glib2/deprecated.rb +22 -1
- data/lib/glib2.rb +54 -3
- data/lib/mkmf-gnome.rb +7 -6
- data/test/glib-test-utils.rb +22 -3
- data/test/run-test.rb +49 -15
- data/test/test-binding.rb +1 -11
- data/test/test-bytes.rb +1 -5
- data/test/test-date-time.rb +1 -3
- data/test/{glib-test-init.rb → test-error.rb} +25 -3
- data/test/test-file-utils.rb +1 -32
- data/test/test-iochannel.rb +3 -5
- data/test/test-key-file.rb +5 -6
- data/test/test-match-info.rb +1 -5
- data/test/test-regex.rb +1 -5
- data/test/test-source.rb +1 -14
- data/test/test-spawn.rb +4 -1
- data/test/test-time-zone.rb +1 -5
- data/test/test-timeout.rb +2 -3
- data/test/test-unicode.rb +16 -12
- data/test/test-utils.rb +2 -8
- data/test/test-variant-type.rb +1 -3
- data/test/test-win32.rb +6 -6
- metadata +6 -5
- data/ext/glib2/rbgobj_valuearray.c +0 -100
data/ext/glib2/rbgobj_object.c
CHANGED
@@ -1,11 +1,10 @@
|
|
1
1
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
2
|
/*
|
3
|
-
* Copyright (C)
|
4
|
-
* Copyright (C) 2002-2004 Ruby-GNOME Project Team
|
3
|
+
* Copyright (C) 2002-2021 Ruby-GNOME Project Team
|
5
4
|
* Copyright (C) 2002-2003 Masahiro Sakai
|
6
|
-
* Copyright (C) 1998-2000
|
7
|
-
*
|
8
|
-
*
|
5
|
+
* Copyright (C) 1998-2000 Yukihiro Matsumoto,
|
6
|
+
* Daisuke Kanda,
|
7
|
+
* Hiroshi Igarashi
|
9
8
|
*
|
10
9
|
* This library is free software; you can redistribute it and/or
|
11
10
|
* modify it under the terms of the GNU Lesser General Public
|
@@ -109,7 +108,7 @@ static const rb_data_type_t rg_glib_object_type = {
|
|
109
108
|
},
|
110
109
|
NULL,
|
111
110
|
NULL,
|
112
|
-
RUBY_TYPED_FREE_IMMEDIATELY,
|
111
|
+
RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_FROZEN_SHAREABLE,
|
113
112
|
};
|
114
113
|
|
115
114
|
void
|
@@ -365,7 +364,9 @@ static VALUE
|
|
365
364
|
gobj_new_body(VALUE rb_arg)
|
366
365
|
{
|
367
366
|
struct param_setup_arg *arg = (struct param_setup_arg *)rb_arg;
|
368
|
-
|
367
|
+
ID id_each;
|
368
|
+
CONST_ID(id_each, "each");
|
369
|
+
rb_block_call(arg->params_hash, id_each, 0, NULL, _params_setup, (VALUE)arg);
|
369
370
|
return (VALUE)g_object_newv(G_TYPE_FROM_CLASS(arg->gclass),
|
370
371
|
arg->param_size, arg->params);
|
371
372
|
}
|
@@ -496,140 +497,146 @@ gobj_s_properties(int argc, VALUE* argv, VALUE self)
|
|
496
497
|
return ary;
|
497
498
|
}
|
498
499
|
|
499
|
-
static
|
500
|
-
static
|
500
|
+
static GHashTable *rbg_type_to_prop_setter_tables;
|
501
|
+
static GMutex rbg_type_to_prop_setter_tables_mutex;
|
502
|
+
static GHashTable *rbg_type_to_prop_getter_tables;
|
503
|
+
static GMutex rbg_type_to_prop_getter_tables_mutex;
|
501
504
|
|
502
|
-
void
|
503
|
-
|
505
|
+
static void
|
506
|
+
rbg_register_property_accessor(GHashTable *tables,
|
507
|
+
GMutex *mutex,
|
508
|
+
GType gtype,
|
509
|
+
const char *name,
|
510
|
+
gpointer accessor)
|
504
511
|
{
|
505
|
-
|
506
|
-
GParamSpec* pspec;
|
512
|
+
g_mutex_lock(mutex);
|
507
513
|
|
508
|
-
|
509
|
-
if (
|
510
|
-
table =
|
511
|
-
|
514
|
+
GHashTable *table = g_hash_table_lookup(tables, GUINT_TO_POINTER(gtype));
|
515
|
+
if (!table) {
|
516
|
+
table = g_hash_table_new(g_str_hash, g_str_equal);
|
517
|
+
g_hash_table_insert(tables, GUINT_TO_POINTER(gtype), table);
|
512
518
|
}
|
513
519
|
|
514
|
-
|
515
|
-
pspec = g_object_class_find_property(
|
516
|
-
|
517
|
-
|
518
|
-
|
520
|
+
GObjectClass *gclass = g_type_class_ref(gtype);
|
521
|
+
GParamSpec *pspec = g_object_class_find_property(gclass, name);
|
522
|
+
g_hash_table_insert(table,
|
523
|
+
(gchar *)g_param_spec_get_name(pspec),
|
524
|
+
accessor);
|
525
|
+
g_type_class_unref(gclass);
|
519
526
|
|
520
|
-
|
527
|
+
g_mutex_unlock(mutex);
|
521
528
|
}
|
522
529
|
|
523
|
-
|
524
|
-
|
530
|
+
static gpointer
|
531
|
+
rbg_get_property_accessor(GHashTable *tables,
|
532
|
+
GMutex *mutex,
|
533
|
+
GType gtype,
|
534
|
+
const char *name)
|
525
535
|
{
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
if (
|
531
|
-
|
532
|
-
|
536
|
+
g_mutex_lock(mutex);
|
537
|
+
|
538
|
+
gpointer accessor = NULL;
|
539
|
+
GHashTable *table = g_hash_table_lookup(tables, GUINT_TO_POINTER(gtype));
|
540
|
+
if (table) {
|
541
|
+
GObjectClass *gclass = g_type_class_ref(gtype);
|
542
|
+
GParamSpec *pspec = g_object_class_find_property(gclass, name);
|
543
|
+
accessor = g_hash_table_lookup(table, g_param_spec_get_name(pspec));
|
544
|
+
g_type_class_unref(gclass);
|
533
545
|
}
|
534
546
|
|
535
|
-
|
536
|
-
pspec = g_object_class_find_property(oclass, name);
|
547
|
+
g_mutex_unlock(mutex);
|
537
548
|
|
538
|
-
|
539
|
-
|
549
|
+
return accessor;
|
550
|
+
}
|
540
551
|
|
541
|
-
|
552
|
+
void
|
553
|
+
rbgobj_register_property_setter(GType gtype,
|
554
|
+
const char *name,
|
555
|
+
RValueToGValueFunc func)
|
556
|
+
{
|
557
|
+
rbg_register_property_accessor(rbg_type_to_prop_setter_tables,
|
558
|
+
&rbg_type_to_prop_setter_tables_mutex,
|
559
|
+
gtype,
|
560
|
+
name,
|
561
|
+
func);
|
562
|
+
}
|
563
|
+
|
564
|
+
void
|
565
|
+
rbgobj_register_property_getter(GType gtype, const char *name, GValueToRValueFunc func)
|
566
|
+
{
|
567
|
+
rbg_register_property_accessor(rbg_type_to_prop_getter_tables,
|
568
|
+
&rbg_type_to_prop_getter_tables_mutex,
|
569
|
+
gtype,
|
570
|
+
name,
|
571
|
+
func);
|
542
572
|
}
|
543
573
|
|
544
574
|
static VALUE
|
545
575
|
rg_set_property(VALUE self, VALUE prop_name, VALUE val)
|
546
576
|
{
|
547
|
-
GParamSpec* pspec;
|
548
577
|
const char* name;
|
549
|
-
|
550
578
|
if (SYMBOL_P(prop_name))
|
551
579
|
name = rb_id2name(SYM2ID(prop_name));
|
552
580
|
else
|
553
581
|
name = StringValuePtr(prop_name);
|
554
582
|
|
555
|
-
pspec =
|
556
|
-
|
557
|
-
|
583
|
+
GParamSpec* pspec =
|
584
|
+
g_object_class_find_property(G_OBJECT_GET_CLASS(RVAL2GOBJ(self)),
|
585
|
+
name);
|
558
586
|
if (!pspec)
|
559
587
|
rb_raise(eNoPropertyError, "No such property: %s", name);
|
560
|
-
else {
|
561
|
-
// FIXME: use rb_ensure to call g_value_unset()
|
562
|
-
RValueToGValueFunc setter = NULL;
|
563
|
-
GValue gval = G_VALUE_INIT;
|
564
588
|
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
|
580
|
-
}
|
581
|
-
|
582
|
-
g_object_set_property(RVAL2GOBJ(self), name, &gval);
|
583
|
-
g_value_unset(&gval);
|
589
|
+
RValueToGValueFunc setter =
|
590
|
+
rbg_get_property_accessor(rbg_type_to_prop_setter_tables,
|
591
|
+
&rbg_type_to_prop_setter_tables_mutex,
|
592
|
+
pspec->owner_type,
|
593
|
+
name);
|
594
|
+
// FIXME: use rb_ensure to call g_value_unset()
|
595
|
+
GValue gval = G_VALUE_INIT;
|
596
|
+
g_value_init(&gval, G_PARAM_SPEC_VALUE_TYPE(pspec));
|
597
|
+
if (setter) {
|
598
|
+
setter(val, &gval);
|
599
|
+
} else {
|
600
|
+
rbgobj_rvalue_to_gvalue(val, &gval);
|
601
|
+
}
|
602
|
+
g_object_set_property(RVAL2GOBJ(self), name, &gval);
|
603
|
+
g_value_unset(&gval);
|
584
604
|
|
585
|
-
|
605
|
+
G_CHILD_SET(self, rb_intern(name), val);
|
586
606
|
|
587
|
-
|
588
|
-
}
|
607
|
+
return self;
|
589
608
|
}
|
590
609
|
|
591
610
|
static VALUE
|
592
611
|
rg_get_property(VALUE self, VALUE prop_name)
|
593
612
|
{
|
594
|
-
GParamSpec* pspec;
|
595
613
|
const char* name;
|
596
|
-
|
597
614
|
if (SYMBOL_P(prop_name))
|
598
615
|
name = rb_id2name(SYM2ID(prop_name));
|
599
616
|
else
|
600
617
|
name = StringValuePtr(prop_name);
|
601
618
|
|
602
|
-
pspec =
|
603
|
-
|
604
|
-
|
619
|
+
GParamSpec *pspec =
|
620
|
+
g_object_class_find_property(G_OBJECT_GET_CLASS(RVAL2GOBJ(self)),
|
621
|
+
name);
|
605
622
|
if (!pspec)
|
606
623
|
rb_raise(eNoPropertyError, "No such property: %s", name);
|
607
|
-
else {
|
608
|
-
// FIXME: use rb_ensure to call g_value_unset()
|
609
|
-
GValueToRValueFunc getter = NULL;
|
610
|
-
GValue gval = G_VALUE_INIT;
|
611
|
-
VALUE ret;
|
612
|
-
|
613
|
-
{
|
614
|
-
VALUE table = rb_hash_aref(type_to_prop_getter_table,
|
615
|
-
INT2FIX(pspec->owner_type));
|
616
|
-
if (!NIL_P(table)){
|
617
|
-
VALUE obj = rb_hash_aref(table, CSTR2RVAL(g_param_spec_get_name(pspec)));
|
618
|
-
if (!NIL_P(obj))
|
619
|
-
Data_Get_Struct(obj, void, getter);
|
620
|
-
}
|
621
|
-
}
|
622
|
-
|
623
|
-
g_value_init(&gval, G_PARAM_SPEC_VALUE_TYPE(pspec));
|
624
|
-
g_object_get_property(RVAL2GOBJ(self), name, &gval);
|
625
624
|
|
626
|
-
|
627
|
-
|
628
|
-
|
629
|
-
|
630
|
-
|
631
|
-
|
632
|
-
|
625
|
+
GValueToRValueFunc getter =
|
626
|
+
rbg_get_property_accessor(rbg_type_to_prop_getter_tables,
|
627
|
+
&rbg_type_to_prop_getter_tables_mutex,
|
628
|
+
pspec->owner_type,
|
629
|
+
name);
|
630
|
+
// FIXME: use rb_ensure to call g_value_unset()
|
631
|
+
GValue gval = G_VALUE_INIT;
|
632
|
+
g_value_init(&gval, G_PARAM_SPEC_VALUE_TYPE(pspec));
|
633
|
+
g_object_get_property(RVAL2GOBJ(self), name, &gval);
|
634
|
+
VALUE ret = getter ? getter(&gval) : GVAL2RVAL(&gval);
|
635
|
+
g_value_unset(&gval);
|
636
|
+
|
637
|
+
G_CHILD_SET(self, rb_intern(name), ret);
|
638
|
+
|
639
|
+
return ret;
|
633
640
|
}
|
634
641
|
|
635
642
|
static VALUE rg_thaw_notify(VALUE self);
|
@@ -714,7 +721,6 @@ rg_type_name(VALUE self)
|
|
714
721
|
return CSTR2RVAL(G_OBJECT_TYPE_NAME(RVAL2GOBJ(self)));
|
715
722
|
}
|
716
723
|
|
717
|
-
#if GLIB_CHECK_VERSION(2, 26, 0)
|
718
724
|
typedef struct {
|
719
725
|
VALUE transform_from_callback;
|
720
726
|
VALUE transform_to_callback;
|
@@ -843,7 +849,6 @@ rg_bind_property(gint argc, VALUE *argv, VALUE self)
|
|
843
849
|
|
844
850
|
return rb_binding;
|
845
851
|
}
|
846
|
-
#endif
|
847
852
|
|
848
853
|
static VALUE
|
849
854
|
rg_initialize(int argc, VALUE *argv, VALUE self)
|
@@ -1090,18 +1095,24 @@ Init_gobject_gobject(void)
|
|
1090
1095
|
RG_DEF_METHOD(inspect, 0);
|
1091
1096
|
RG_DEF_METHOD(type_name, 0);
|
1092
1097
|
|
1093
|
-
#if GLIB_CHECK_VERSION(2, 26, 0)
|
1094
1098
|
RG_DEF_METHOD(bind_property, -1);
|
1095
1099
|
G_DEF_CLASS(G_TYPE_BINDING_FLAGS, "BindingFlags", mGLib);
|
1096
|
-
#endif
|
1097
1100
|
|
1098
1101
|
eNoPropertyError = rb_define_class_under(mGLib, "NoPropertyError",
|
1099
1102
|
rb_eNameError);
|
1100
1103
|
|
1101
|
-
|
1102
|
-
|
1103
|
-
|
1104
|
-
|
1104
|
+
rbg_type_to_prop_setter_tables =
|
1105
|
+
g_hash_table_new_full(g_direct_hash,
|
1106
|
+
g_direct_equal,
|
1107
|
+
NULL,
|
1108
|
+
(GDestroyNotify)g_hash_table_unref);
|
1109
|
+
g_mutex_init(&rbg_type_to_prop_setter_tables_mutex);
|
1110
|
+
rbg_type_to_prop_getter_tables =
|
1111
|
+
g_hash_table_new_full(g_direct_hash,
|
1112
|
+
g_direct_equal,
|
1113
|
+
NULL,
|
1114
|
+
(GDestroyNotify)g_hash_table_unref);
|
1115
|
+
g_mutex_init(&rbg_type_to_prop_getter_tables_mutex);
|
1105
1116
|
|
1106
1117
|
/* subclass */
|
1107
1118
|
RG_DEF_SMETHOD(type_register, -1);
|
data/ext/glib2/rbgobj_param.c
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
2
|
/*
|
3
|
-
* Copyright (C) 2011-
|
3
|
+
* Copyright (C) 2011-2021 Ruby-GNOME Project Team
|
4
4
|
* Copyright (C) 2002,2003 Masahiro Sakai
|
5
5
|
*
|
6
6
|
* This library is free software; you can redistribute it and/or
|
@@ -61,7 +61,7 @@ static const rb_data_type_t rg_glib_param_type = {
|
|
61
61
|
},
|
62
62
|
NULL,
|
63
63
|
NULL,
|
64
|
-
RUBY_TYPED_FREE_IMMEDIATELY,
|
64
|
+
RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_FROZEN_SHAREABLE,
|
65
65
|
};
|
66
66
|
|
67
67
|
static pspec_holder *
|
@@ -276,7 +276,7 @@ rg_value_convert(int argc, VALUE* argv, VALUE self)
|
|
276
276
|
rb_scan_args(argc, argv, "21", &src, &src_type, &strict_validation);
|
277
277
|
|
278
278
|
/* FIXME: use rb_ensure to ensure following g_value_unset() call*/
|
279
|
-
g_value_init(&src_value,
|
279
|
+
g_value_init(&src_value, rbgobj_gtype_from_ruby(src_type));
|
280
280
|
g_value_init(&dest_value, G_PARAM_SPEC_VALUE_TYPE(pspec));
|
281
281
|
|
282
282
|
rbgobj_rvalue_to_gvalue(src, &src_value);
|
@@ -344,9 +344,7 @@ param_is_flag(G_PARAM_LAX_VALIDATION)
|
|
344
344
|
param_is_flag(G_PARAM_STATIC_NAME)
|
345
345
|
param_is_flag(G_PARAM_STATIC_NICK)
|
346
346
|
param_is_flag(G_PARAM_STATIC_BLURB)
|
347
|
-
#if GLIB_CHECK_VERSION(2, 42, 0)
|
348
347
|
param_is_flag(G_PARAM_EXPLICIT_NOTIFY)
|
349
|
-
#endif
|
350
348
|
param_is_flag(G_PARAM_DEPRECATED)
|
351
349
|
|
352
350
|
/**********************************************************************/
|
@@ -376,10 +374,8 @@ Init_gobject_gparam(void)
|
|
376
374
|
INT2FIX(G_PARAM_STATIC_NICK));
|
377
375
|
rb_define_const(RG_TARGET_NAMESPACE, "STATIC_BLURB",
|
378
376
|
INT2FIX(G_PARAM_STATIC_BLURB));
|
379
|
-
#if GLIB_CHECK_VERSION(2, 42, 0)
|
380
377
|
rb_define_const(RG_TARGET_NAMESPACE, "EXPLICIT_NOTIFY",
|
381
378
|
INT2FIX(G_PARAM_EXPLICIT_NOTIFY));
|
382
|
-
#endif
|
383
379
|
rb_define_const(RG_TARGET_NAMESPACE, "DEPRECATED",
|
384
380
|
INT2FIX(G_PARAM_DEPRECATED));
|
385
381
|
rb_define_const(RG_TARGET_NAMESPACE, "MASK",
|
@@ -432,10 +428,8 @@ Init_gobject_gparam(void)
|
|
432
428
|
param_is_G_PARAM_STATIC_NICK, 0);
|
433
429
|
rbg_define_method(RG_TARGET_NAMESPACE, "static_blurb?",
|
434
430
|
param_is_G_PARAM_STATIC_BLURB, 0);
|
435
|
-
#if GLIB_CHECK_VERSION(2, 42, 0)
|
436
431
|
rbg_define_method(RG_TARGET_NAMESPACE, "explicit_notify?",
|
437
432
|
param_is_G_PARAM_EXPLICIT_NOTIFY, 0);
|
438
|
-
#endif
|
439
433
|
rbg_define_method(RG_TARGET_NAMESPACE, "deprecated?",
|
440
434
|
param_is_G_PARAM_DEPRECATED, 0);
|
441
435
|
}
|
@@ -1,7 +1,6 @@
|
|
1
1
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
2
|
/*
|
3
|
-
* Copyright (C)
|
4
|
-
* Copyright (C) 2004 Ruby-GNOME2 Project Team
|
3
|
+
* Copyright (C) 2004-2021 Ruby-GNOME Project Team
|
5
4
|
* Copyright (C) 2002,2003 Masahiro Sakai
|
6
5
|
*
|
7
6
|
* This library is free software; you can redistribute it and/or
|
@@ -116,7 +115,7 @@ enum_initialize(VALUE self, VALUE name, VALUE nick, VALUE blurb,
|
|
116
115
|
VALUE enum_type, VALUE default_value, VALUE flags)
|
117
116
|
{
|
118
117
|
GParamSpec* pspec;
|
119
|
-
GType gtype =
|
118
|
+
GType gtype = rbgobj_gtype_from_ruby(enum_type);
|
120
119
|
|
121
120
|
pspec = g_param_spec_enum(StringValuePtr(name),
|
122
121
|
StringValuePtr(nick),
|
@@ -133,7 +132,7 @@ flags_initialize(VALUE self, VALUE name, VALUE nick, VALUE blurb,
|
|
133
132
|
VALUE flags_type, VALUE default_value, VALUE flags)
|
134
133
|
{
|
135
134
|
GParamSpec* pspec;
|
136
|
-
GType gtype =
|
135
|
+
GType gtype = rbgobj_gtype_from_ruby(flags_type);
|
137
136
|
|
138
137
|
pspec = g_param_spec_flags(StringValuePtr(name),
|
139
138
|
StringValuePtr(nick),
|
@@ -167,7 +166,7 @@ param_initialize(VALUE self, VALUE name, VALUE nick, VALUE blurb,
|
|
167
166
|
pspec = g_param_spec_param(StringValuePtr(name),
|
168
167
|
StringValuePtr(nick),
|
169
168
|
StringValuePtr(blurb),
|
170
|
-
|
169
|
+
rbgobj_gtype_from_ruby(param_type),
|
171
170
|
NUM2UINT(flags));
|
172
171
|
rbgobj_param_spec_initialize(self, pspec);
|
173
172
|
return Qnil;
|
@@ -181,7 +180,7 @@ boxed_initialize(VALUE self, VALUE name, VALUE nick, VALUE blurb,
|
|
181
180
|
pspec = g_param_spec_boxed(StringValuePtr(name),
|
182
181
|
StringValuePtr(nick),
|
183
182
|
StringValuePtr(blurb),
|
184
|
-
|
183
|
+
rbgobj_gtype_from_ruby(boxed_type),
|
185
184
|
NUM2UINT(flags));
|
186
185
|
rbgobj_param_spec_initialize(self, pspec);
|
187
186
|
return Qnil;
|
@@ -199,20 +198,6 @@ pointer_initialize(VALUE self, VALUE name, VALUE nick, VALUE blurb, VALUE flags)
|
|
199
198
|
return Qnil;
|
200
199
|
}
|
201
200
|
|
202
|
-
static VALUE
|
203
|
-
value_array_initialize(VALUE self, VALUE name, VALUE nick, VALUE blurb,
|
204
|
-
VALUE element_spec, VALUE flags)
|
205
|
-
{
|
206
|
-
GParamSpec* pspec;
|
207
|
-
pspec = g_param_spec_value_array(StringValuePtr(name),
|
208
|
-
StringValuePtr(nick),
|
209
|
-
StringValuePtr(blurb),
|
210
|
-
RVAL2GOBJ(element_spec),
|
211
|
-
NUM2UINT(flags));
|
212
|
-
rbgobj_param_spec_initialize(self, pspec);
|
213
|
-
return Qnil;
|
214
|
-
}
|
215
|
-
|
216
201
|
static VALUE
|
217
202
|
object_initialize(VALUE self, VALUE name, VALUE nick, VALUE blurb,
|
218
203
|
VALUE object_type, VALUE flags)
|
@@ -221,7 +206,7 @@ object_initialize(VALUE self, VALUE name, VALUE nick, VALUE blurb,
|
|
221
206
|
pspec = g_param_spec_object(StringValuePtr(name),
|
222
207
|
StringValuePtr(nick),
|
223
208
|
StringValuePtr(blurb),
|
224
|
-
|
209
|
+
rbgobj_gtype_from_ruby(object_type),
|
225
210
|
NUM2UINT(flags));
|
226
211
|
rbgobj_param_spec_initialize(self, pspec);
|
227
212
|
return Qnil;
|
@@ -303,9 +288,6 @@ Init_gobject_gparamspecs(void)
|
|
303
288
|
c = G_DEF_CLASS(G_TYPE_PARAM_POINTER, "Pointer", cParamSpec);
|
304
289
|
rbg_define_method(c, "initialize", pointer_initialize, 4);
|
305
290
|
|
306
|
-
c = G_DEF_CLASS(G_TYPE_PARAM_VALUE_ARRAY, "ValueArray", cParamSpec);
|
307
|
-
rbg_define_method(c, "initialize", value_array_initialize, 5);
|
308
|
-
|
309
291
|
c = G_DEF_CLASS(G_TYPE_PARAM_OBJECT, "Object", cParamSpec);
|
310
292
|
rbg_define_method(c, "initialize", object_initialize, 5);
|
311
293
|
}
|