glib2 3.3.8 → 3.3.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/glib2/extconf.rb +22 -6
- data/ext/glib2/glib2.def +7 -2
- data/ext/glib2/rbglib-bytes.c +9 -1
- data/ext/glib2/rbglib-gc.c +1 -3
- data/ext/glib2/rbglib.c +83 -26
- data/ext/glib2/rbglib.h +14 -14
- data/ext/glib2/rbglib2conversions.h +2 -2
- data/ext/glib2/rbglib_iochannel.c +15 -12
- data/ext/glib2/rbglib_maincontext.c +5 -5
- data/ext/glib2/rbglib_messages.c +6 -2
- data/ext/glib2/rbglib_pollfd.c +7 -7
- data/ext/glib2/rbglib_source.c +2 -2
- data/ext/glib2/rbgobj_boxed.c +1 -3
- data/ext/glib2/rbgobj_enums.c +0 -2
- data/ext/glib2/rbgobj_flags.c +4 -5
- data/ext/glib2/rbgobj_object.c +19 -7
- data/ext/glib2/rbgobj_param.c +66 -24
- data/ext/glib2/rbgobj_signal.c +10 -9
- data/ext/glib2/rbgobj_type.c +24 -0
- data/ext/glib2/rbgobj_value.c +10 -4
- data/ext/glib2/rbgobj_valuearray.c +3 -3
- data/ext/glib2/rbgobject.h +8 -4
- data/ext/glib2/rbgprivate.h +1 -2
- data/ext/glib2/rbgutil_callback.c +4 -4
- data/lib/glib-mkenums.rb +2 -0
- data/lib/glib2/deprecated.rb +7 -1
- data/lib/mkmf-gnome.rb +478 -0
- data/lib/mkmf-gnome2.rb +14 -466
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3801c55a0485d01299188fed3c0c31014218b6b7b14d89569eb382cb957e7a55
|
4
|
+
data.tar.gz: a6000f1cbbdfbd5002852cdccc94f1289e26475f03af643f86f34766b2fb9674
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f6d18cfb2fbb7102f1e7e4353fa77b18f3166486645024f7153a0c1ee8219a284a7b768c6437bb777d4f10dd84e0ac72980b004c004d59c37b8ebb6739e831ff
|
7
|
+
data.tar.gz: 5330b0737f3f5b1363e3c75bc946717080c874bc88b51f3d450c28154481d0efa83031b7d334dc02085a834f151b2bb13fe729bce63b33ca2f7648bda19f751e
|
data/ext/glib2/extconf.rb
CHANGED
@@ -1,6 +1,18 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
# Copyright (C) 2002-2019 Ruby-GNOME Project Team
|
2
|
+
#
|
3
|
+
# This library is free software; you can redistribute it and/or
|
4
|
+
# modify it under the terms of the GNU Lesser General Public
|
5
|
+
# License as published by the Free Software Foundation; either
|
6
|
+
# version 2.1 of the License, or (at your option) any later version.
|
7
|
+
#
|
8
|
+
# This library is distributed in the hope that it will be useful,
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
11
|
+
# Lesser General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU Lesser General Public
|
14
|
+
# License along with this library; if not, write to the Free Software
|
15
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
4
16
|
|
5
17
|
require 'pathname'
|
6
18
|
|
@@ -12,12 +24,12 @@ $LOAD_PATH.unshift(mkmf_gnome2_dir.to_s)
|
|
12
24
|
module_name = "glib2"
|
13
25
|
package_id = "gobject-2.0"
|
14
26
|
|
15
|
-
require
|
27
|
+
require "mkmf-gnome"
|
16
28
|
|
17
29
|
unless required_pkg_config_package([package_id, 2, 12, 0],
|
18
30
|
:alt_linux => "glib2-devel",
|
19
31
|
:debian => "libglib2.0-dev",
|
20
|
-
:redhat => "
|
32
|
+
:redhat => "pkgconfig(#{package_id})",
|
21
33
|
:arch_linux => "glib2",
|
22
34
|
:homebrew => "glib",
|
23
35
|
:macports => "glib2",
|
@@ -75,7 +87,11 @@ include_paths = PKGConfig.cflags_only_I(package_id)
|
|
75
87
|
headers = include_paths.split.inject(headers) do |result, path|
|
76
88
|
result + Dir.glob(File.join(path.sub(/^-I/, ""), "gobject", "gsignal.h"))
|
77
89
|
end
|
78
|
-
glib_mkenums(enum_types_prefix,
|
90
|
+
glib_mkenums(enum_types_prefix,
|
91
|
+
headers,
|
92
|
+
"G_TYPE_",
|
93
|
+
[],
|
94
|
+
preamble: "#include \"rbgprivate.h\"")
|
79
95
|
|
80
96
|
$defs << "-DRUBY_GLIB2_COMPILATION"
|
81
97
|
|
data/ext/glib2/glib2.def
CHANGED
@@ -45,6 +45,7 @@ EXPORTS
|
|
45
45
|
rbgobj_lookup_class
|
46
46
|
rbgobj_lookup_class_by_gtype
|
47
47
|
rbgobj_gtype_to_ruby_class
|
48
|
+
rbgobj_gtype_from_ruby
|
48
49
|
rbgobj_ptr2cptr
|
49
50
|
rbgobj_ptr_new
|
50
51
|
rbgobj_make_enum
|
@@ -106,6 +107,8 @@ EXPORTS
|
|
106
107
|
rbg_rval2strv_accept_nil
|
107
108
|
rbg_rval2strv_dup
|
108
109
|
rbg_rval2strv_dup_accept_nil
|
110
|
+
rbg_rval2filenamev
|
111
|
+
rbg_rval2filenamev_accept_nil
|
109
112
|
rbg_strv2rval
|
110
113
|
rbg_strv2rval_free
|
111
114
|
rbg_rval2gbooleans
|
@@ -171,7 +174,9 @@ EXPORTS
|
|
171
174
|
rbg_gc_guard
|
172
175
|
rbg_gc_unguard
|
173
176
|
|
174
|
-
|
177
|
+
rbg_is_bytes
|
178
|
+
rbg_is_object
|
179
|
+
rbg_is_value
|
180
|
+
|
175
181
|
g_connect_flags_get_type
|
176
|
-
g_poll_fd_get_type
|
177
182
|
g_signal_flags_get_type
|
data/ext/glib2/rbglib-bytes.c
CHANGED
@@ -20,10 +20,18 @@
|
|
20
20
|
|
21
21
|
#include "rbgprivate.h"
|
22
22
|
|
23
|
-
|
23
|
+
static VALUE rb_cGLibBytes;
|
24
|
+
|
25
|
+
#define RG_TARGET_NAMESPACE rb_cGLibBytes
|
24
26
|
|
25
27
|
#define _SELF(s) (RVAL2BOXED(s, G_TYPE_BYTES))
|
26
28
|
|
29
|
+
gboolean
|
30
|
+
rbg_is_bytes(VALUE object)
|
31
|
+
{
|
32
|
+
return RVAL2CBOOL(rb_obj_is_kind_of(object, RG_TARGET_NAMESPACE));
|
33
|
+
}
|
34
|
+
|
27
35
|
#if GLIB_CHECK_VERSION(2, 32, 0)
|
28
36
|
static VALUE RG_TARGET_NAMESPACE;
|
29
37
|
|
data/ext/glib2/rbglib-gc.c
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
2
|
/*
|
3
|
-
* Copyright (C) 2018-2019 Ruby-
|
3
|
+
* Copyright (C) 2018-2019 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
|
@@ -53,8 +53,6 @@ static const rb_data_type_t rbg_gc_marker_type = {
|
|
53
53
|
{
|
54
54
|
gc_marker_mark,
|
55
55
|
gc_marker_free,
|
56
|
-
NULL,
|
57
|
-
{0},
|
58
56
|
},
|
59
57
|
NULL,
|
60
58
|
NULL,
|
data/ext/glib2/rbglib.c
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
2
|
/*
|
3
|
-
* Copyright (C) 2011-2019 Ruby-
|
3
|
+
* Copyright (C) 2011-2019 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
|
@@ -323,7 +323,7 @@ rbg_filename_from_ruby(VALUE filename)
|
|
323
323
|
struct rval2strv_args {
|
324
324
|
VALUE ary;
|
325
325
|
long n;
|
326
|
-
|
326
|
+
gchar **result;
|
327
327
|
};
|
328
328
|
|
329
329
|
static VALUE
|
@@ -333,28 +333,28 @@ rbg_rval2strv_body(VALUE value)
|
|
333
333
|
struct rval2strv_args *args = (struct rval2strv_args *)value;
|
334
334
|
|
335
335
|
for (i = 0; i < args->n; i++)
|
336
|
-
args->result[i] = RVAL2CSTR(RARRAY_PTR(args->ary)[i]);
|
336
|
+
args->result[i] = (gchar *)RVAL2CSTR(RARRAY_PTR(args->ary)[i]);
|
337
337
|
args->result[args->n] = NULL;
|
338
338
|
|
339
339
|
return Qnil;
|
340
340
|
}
|
341
341
|
|
342
342
|
static G_GNUC_NORETURN VALUE
|
343
|
-
rbg_rval2strv_rescue(VALUE value)
|
343
|
+
rbg_rval2strv_rescue(VALUE value, VALUE error)
|
344
344
|
{
|
345
345
|
g_free(((struct rval2strv_args *)value)->result);
|
346
346
|
|
347
|
-
rb_exc_raise(
|
347
|
+
rb_exc_raise(error);
|
348
348
|
}
|
349
349
|
|
350
|
-
|
350
|
+
gchar **
|
351
351
|
rbg_rval2strv(volatile VALUE *value, long *n)
|
352
352
|
{
|
353
353
|
struct rval2strv_args args;
|
354
354
|
|
355
355
|
args.ary = *value = rb_ary_dup(rb_ary_to_ary(*value));
|
356
356
|
args.n = RARRAY_LEN(args.ary);
|
357
|
-
args.result = g_new(
|
357
|
+
args.result = g_new(gchar *, args.n + 1);
|
358
358
|
|
359
359
|
rb_rescue(rbg_rval2strv_body, (VALUE)&args,
|
360
360
|
rbg_rval2strv_rescue, (VALUE)&args);
|
@@ -365,7 +365,7 @@ rbg_rval2strv(volatile VALUE *value, long *n)
|
|
365
365
|
return args.result;
|
366
366
|
}
|
367
367
|
|
368
|
-
|
368
|
+
gchar **
|
369
369
|
rbg_rval2strv_accept_nil(volatile VALUE *value, long *n)
|
370
370
|
{
|
371
371
|
if (!NIL_P(*value))
|
@@ -397,11 +397,11 @@ rbg_rval2strv_dup_body(VALUE value)
|
|
397
397
|
}
|
398
398
|
|
399
399
|
static G_GNUC_NORETURN VALUE
|
400
|
-
rbg_rval2strv_dup_rescue(VALUE value)
|
400
|
+
rbg_rval2strv_dup_rescue(VALUE value, VALUE error)
|
401
401
|
{
|
402
|
-
|
402
|
+
g_strfreev(((struct rval2strv_dup_args *)value)->result);
|
403
403
|
|
404
|
-
rb_exc_raise(
|
404
|
+
rb_exc_raise(error);
|
405
405
|
}
|
406
406
|
|
407
407
|
gchar **
|
@@ -411,7 +411,7 @@ rbg_rval2strv_dup(volatile VALUE *value, long *n)
|
|
411
411
|
|
412
412
|
args.ary = *value = rb_ary_dup(rb_ary_to_ary(*value));
|
413
413
|
args.n = RARRAY_LEN(args.ary);
|
414
|
-
args.result =
|
414
|
+
args.result = g_new0(gchar *, args.n + 1);
|
415
415
|
|
416
416
|
rb_rescue(rbg_rval2strv_dup_body, (VALUE)&args,
|
417
417
|
rbg_rval2strv_dup_rescue, (VALUE)&args);
|
@@ -434,6 +434,63 @@ rbg_rval2strv_dup_accept_nil(volatile VALUE *value, long *n)
|
|
434
434
|
return NULL;
|
435
435
|
}
|
436
436
|
|
437
|
+
struct rval2filenamev_args {
|
438
|
+
VALUE ary;
|
439
|
+
long n;
|
440
|
+
gchar **result;
|
441
|
+
};
|
442
|
+
|
443
|
+
static VALUE
|
444
|
+
rbg_rval2filenamev_body(VALUE value)
|
445
|
+
{
|
446
|
+
long i;
|
447
|
+
struct rval2filenamev_args *args = (struct rval2filenamev_args *)value;
|
448
|
+
|
449
|
+
for (i = 0; i < args->n; i++)
|
450
|
+
args->result[i] = RVAL2CSTRFILENAME(RARRAY_PTR(args->ary)[i]);
|
451
|
+
args->result[args->n] = NULL;
|
452
|
+
|
453
|
+
return Qnil;
|
454
|
+
}
|
455
|
+
|
456
|
+
static G_GNUC_NORETURN VALUE
|
457
|
+
rbg_rval2filenamev_rescue(VALUE value, VALUE error)
|
458
|
+
{
|
459
|
+
g_strfreev(((struct rval2filenamev_args *)value)->result);
|
460
|
+
|
461
|
+
rb_exc_raise(error);
|
462
|
+
}
|
463
|
+
|
464
|
+
gchar **
|
465
|
+
rbg_rval2filenamev(volatile VALUE *value, long *n)
|
466
|
+
{
|
467
|
+
struct rval2filenamev_args args;
|
468
|
+
|
469
|
+
args.ary = *value = rb_ary_dup(rb_ary_to_ary(*value));
|
470
|
+
args.n = RARRAY_LEN(args.ary);
|
471
|
+
args.result = g_new0(gchar *, args.n + 1);
|
472
|
+
|
473
|
+
rb_rescue(rbg_rval2filenamev_body, (VALUE)&args,
|
474
|
+
rbg_rval2filenamev_rescue, (VALUE)&args);
|
475
|
+
|
476
|
+
if (n != NULL)
|
477
|
+
*n = args.n;
|
478
|
+
|
479
|
+
return args.result;
|
480
|
+
}
|
481
|
+
|
482
|
+
gchar **
|
483
|
+
rbg_rval2filenamev_accept_nil(volatile VALUE *value, long *n)
|
484
|
+
{
|
485
|
+
if (!NIL_P(*value))
|
486
|
+
return rbg_rval2filenamev(value, n);
|
487
|
+
|
488
|
+
if (n != NULL)
|
489
|
+
*n = 0;
|
490
|
+
|
491
|
+
return NULL;
|
492
|
+
}
|
493
|
+
|
437
494
|
VALUE
|
438
495
|
rbg_strv2rval(const gchar **strings)
|
439
496
|
{
|
@@ -490,11 +547,11 @@ rbg_rval2gbooleans_body(VALUE value)
|
|
490
547
|
}
|
491
548
|
|
492
549
|
static G_GNUC_NORETURN VALUE
|
493
|
-
rbg_rval2gbooleans_rescue(VALUE value)
|
550
|
+
rbg_rval2gbooleans_rescue(VALUE value, VALUE error)
|
494
551
|
{
|
495
552
|
g_free(((struct rbg_rval2gbooleans_args *)value)->result);
|
496
553
|
|
497
|
-
rb_exc_raise(
|
554
|
+
rb_exc_raise(error);
|
498
555
|
}
|
499
556
|
|
500
557
|
gboolean *
|
@@ -533,11 +590,11 @@ rbg_rval2gints_body(VALUE value)
|
|
533
590
|
}
|
534
591
|
|
535
592
|
static G_GNUC_NORETURN VALUE
|
536
|
-
rbg_rval2gints_rescue(VALUE value)
|
593
|
+
rbg_rval2gints_rescue(VALUE value, VALUE error)
|
537
594
|
{
|
538
595
|
g_free(((struct rbg_rval2gints_args *)value)->result);
|
539
596
|
|
540
|
-
rb_exc_raise(
|
597
|
+
rb_exc_raise(error);
|
541
598
|
}
|
542
599
|
|
543
600
|
gint *
|
@@ -576,11 +633,11 @@ rbg_rval2gint8s_body(VALUE value)
|
|
576
633
|
}
|
577
634
|
|
578
635
|
static G_GNUC_NORETURN VALUE
|
579
|
-
rbg_rval2gint8s_rescue(VALUE value)
|
636
|
+
rbg_rval2gint8s_rescue(VALUE value, VALUE error)
|
580
637
|
{
|
581
638
|
g_free(((struct rbg_rval2gint8s_args *)value)->result);
|
582
639
|
|
583
|
-
rb_exc_raise(
|
640
|
+
rb_exc_raise(error);
|
584
641
|
}
|
585
642
|
|
586
643
|
gint8 *
|
@@ -619,11 +676,11 @@ rbg_rval2guint8s_body(VALUE value)
|
|
619
676
|
}
|
620
677
|
|
621
678
|
static G_GNUC_NORETURN VALUE
|
622
|
-
rbg_rval2guint8s_rescue(VALUE value)
|
679
|
+
rbg_rval2guint8s_rescue(VALUE value, VALUE error)
|
623
680
|
{
|
624
681
|
g_free(((struct rbg_rval2guint8s_args *)value)->result);
|
625
682
|
|
626
|
-
rb_exc_raise(
|
683
|
+
rb_exc_raise(error);
|
627
684
|
}
|
628
685
|
|
629
686
|
guint8 *
|
@@ -662,11 +719,11 @@ rbg_rval2guint16s_body(VALUE value)
|
|
662
719
|
}
|
663
720
|
|
664
721
|
static G_GNUC_NORETURN VALUE
|
665
|
-
rbg_rval2guint16s_rescue(VALUE value)
|
722
|
+
rbg_rval2guint16s_rescue(VALUE value, VALUE error)
|
666
723
|
{
|
667
724
|
g_free(((struct rbg_rval2guint16s_args *)value)->result);
|
668
725
|
|
669
|
-
rb_exc_raise(
|
726
|
+
rb_exc_raise(error);
|
670
727
|
}
|
671
728
|
|
672
729
|
guint16 *
|
@@ -705,11 +762,11 @@ rbg_rval2guint32s_body(VALUE value)
|
|
705
762
|
}
|
706
763
|
|
707
764
|
static G_GNUC_NORETURN VALUE
|
708
|
-
rbg_rval2guint32s_rescue(VALUE value)
|
765
|
+
rbg_rval2guint32s_rescue(VALUE value, VALUE error)
|
709
766
|
{
|
710
767
|
g_free(((struct rbg_rval2guint32s_args *)value)->result);
|
711
768
|
|
712
|
-
rb_exc_raise(
|
769
|
+
rb_exc_raise(error);
|
713
770
|
}
|
714
771
|
|
715
772
|
guint32 *
|
@@ -748,11 +805,11 @@ rbg_rval2gdoubles_body(VALUE value)
|
|
748
805
|
}
|
749
806
|
|
750
807
|
static G_GNUC_NORETURN VALUE
|
751
|
-
rbg_rval2gdoubles_rescue(VALUE value)
|
808
|
+
rbg_rval2gdoubles_rescue(VALUE value, VALUE error)
|
752
809
|
{
|
753
810
|
g_free(((struct rbg_rval2gdoubles_args *)value)->result);
|
754
811
|
|
755
|
-
rb_exc_raise(
|
812
|
+
rb_exc_raise(error);
|
756
813
|
}
|
757
814
|
|
758
815
|
gdouble *
|
data/ext/glib2/rbglib.h
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
2
|
/*
|
3
|
-
* Copyright (C) 2002-2019 Ruby-
|
3
|
+
* Copyright (C) 2002-2019 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
|
@@ -27,16 +27,13 @@
|
|
27
27
|
#include "rbglibdeprecated.h"
|
28
28
|
#include "rbglib2conversions.h"
|
29
29
|
|
30
|
-
#
|
31
|
-
#define __RBGLIB_H__
|
30
|
+
#pragma once
|
32
31
|
|
33
|
-
|
34
|
-
extern "C" {
|
35
|
-
#endif /* __cplusplus */
|
32
|
+
G_BEGIN_DECLS
|
36
33
|
|
37
34
|
#define RBGLIB_MAJOR_VERSION 3
|
38
35
|
#define RBGLIB_MINOR_VERSION 3
|
39
|
-
#define RBGLIB_MICRO_VERSION
|
36
|
+
#define RBGLIB_MICRO_VERSION 9
|
40
37
|
|
41
38
|
#ifndef RB_ZALLOC
|
42
39
|
# ifdef ZALLOC
|
@@ -195,10 +192,12 @@ VALUE rbg_filename_to_ruby(const gchar *filename);
|
|
195
192
|
extern VALUE rbg_filename_to_ruby_free(gchar *filename);
|
196
193
|
extern gchar *rbg_filename_from_ruby(VALUE filename);
|
197
194
|
|
198
|
-
|
199
|
-
|
195
|
+
gchar **rbg_rval2strv(volatile VALUE *value, long *n);
|
196
|
+
gchar **rbg_rval2strv_accept_nil(volatile VALUE *value, long *n);
|
200
197
|
gchar **rbg_rval2strv_dup(volatile VALUE *value, long *n);
|
201
198
|
gchar **rbg_rval2strv_dup_accept_nil(volatile VALUE *value, long *n);
|
199
|
+
gchar **rbg_rval2filenamev(volatile VALUE *value, long *n);
|
200
|
+
gchar **rbg_rval2filenamev_accept_nil(volatile VALUE *value, long *n);
|
202
201
|
VALUE rbg_strv2rval(const gchar **strings);
|
203
202
|
VALUE rbg_strv2rval_free(gchar **strings);
|
204
203
|
|
@@ -234,12 +233,13 @@ extern GVariant *rbg_variant_from_ruby(VALUE rb_variant);
|
|
234
233
|
|
235
234
|
extern GVariantType *rbg_variant_type_from_ruby(VALUE rb_variant_type);
|
236
235
|
|
237
|
-
|
238
236
|
extern void rbg_gc_guard(gpointer key, VALUE rb_object);
|
239
237
|
extern void rbg_gc_unguard(gpointer key);
|
240
238
|
|
241
|
-
#ifdef __cplusplus
|
242
|
-
}
|
243
|
-
#endif /* __cplusplus */
|
244
239
|
|
245
|
-
|
240
|
+
/* predicates */
|
241
|
+
extern gboolean rbg_is_bytes(VALUE object);
|
242
|
+
extern gboolean rbg_is_object(VALUE object);
|
243
|
+
extern gboolean rbg_is_value(VALUE object);
|
244
|
+
|
245
|
+
G_END_DECLS
|
@@ -33,8 +33,8 @@
|
|
33
33
|
#define GMAINCONTEXT2RVAL(o) (BOXED2RVAL(o, G_TYPE_MAIN_CONTEXT))
|
34
34
|
#define RVAL2GMAINLOOP(o) ((GMainLoop*)RVAL2BOXED(o, G_TYPE_MAIN_LOOP))
|
35
35
|
#define GMAINLOOP2RVAL(o) (BOXED2RVAL(o, G_TYPE_MAIN_LOOP))
|
36
|
-
#define RVAL2GPOLLFD(o) ((GPollFD*)RVAL2BOXED(o,
|
37
|
-
#define GPOLLFD2RVAL(o) (BOXED2RVAL(o,
|
36
|
+
#define RVAL2GPOLLFD(o) ((GPollFD*)RVAL2BOXED(o, G_TYPE_POLLFD))
|
37
|
+
#define GPOLLFD2RVAL(o) (BOXED2RVAL(o, G_TYPE_POLLFD))
|
38
38
|
#define RVAL2GSOURCE(o) ((GSource*)RVAL2BOXED(o, G_TYPE_SOURCE))
|
39
39
|
#define GSOURCE2RVAL(o) (BOXED2RVAL(o, G_TYPE_SOURCE))
|
40
40
|
#define RVAL2GTIMER(o) ((GTimer*)RVAL2BOXED(o, G_TYPE_TIMER))
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
2
|
/*
|
3
|
-
* Copyright (C) 2011-2019 Ruby-
|
3
|
+
* Copyright (C) 2011-2019 Ruby-GNOME Project Team
|
4
4
|
* Copyright (C) 2005 Masao Mutoh
|
5
5
|
*
|
6
6
|
* This library is free software; you can redistribute it and/or
|
@@ -503,17 +503,20 @@ rg_close(gint argc, VALUE *argv, VALUE self)
|
|
503
503
|
}
|
504
504
|
|
505
505
|
static VALUE
|
506
|
-
rg_create_watch(VALUE
|
506
|
+
rg_create_watch(int argc, VALUE *argv, VALUE self)
|
507
507
|
{
|
508
|
+
VALUE rb_condition;
|
509
|
+
VALUE rb_block;
|
508
510
|
VALUE rb_source;
|
509
511
|
|
510
|
-
|
512
|
+
rb_scan_args(argc, argv, "1&", &rb_condition, &rb_block);
|
513
|
+
rb_source = BOXED2RVAL(g_io_create_watch(_SELF(self), NUM2INT(rb_condition)),
|
511
514
|
G_TYPE_SOURCE);
|
512
515
|
rb_extend_object(rb_source, rb_mIOChannelSource);
|
513
|
-
if (
|
516
|
+
if (!NIL_P(rb_block)) {
|
514
517
|
ID id_set_callback;
|
515
518
|
CONST_ID(id_set_callback, "set_callback");
|
516
|
-
|
519
|
+
rb_funcall_with_block(rb_source, id_set_callback, 0, NULL, rb_block);
|
517
520
|
}
|
518
521
|
return rb_source;
|
519
522
|
}
|
@@ -545,15 +548,15 @@ guint g_io_add_watch_full (GIOChannel *channel,
|
|
545
548
|
*/
|
546
549
|
|
547
550
|
static VALUE
|
548
|
-
rg_io_channel_source_set_callback(VALUE self)
|
551
|
+
rg_io_channel_source_set_callback(int argc, VALUE *argv, VALUE self)
|
549
552
|
{
|
550
|
-
VALUE
|
553
|
+
VALUE rb_callback;
|
551
554
|
|
552
|
-
|
553
|
-
G_RELATIVE(self,
|
555
|
+
rb_scan_args(argc, argv, "&", &rb_callback);
|
556
|
+
G_RELATIVE(self, rb_callback);
|
554
557
|
g_source_set_callback(RVAL2BOXED(self, G_TYPE_SOURCE),
|
555
558
|
(GSourceFunc)io_func,
|
556
|
-
(gpointer)
|
559
|
+
(gpointer)rb_callback,
|
557
560
|
(GDestroyNotify)NULL);
|
558
561
|
return self;
|
559
562
|
}
|
@@ -810,7 +813,7 @@ Init_glib_io_channel(void)
|
|
810
813
|
RG_DEF_METHOD(seek, -1);
|
811
814
|
RG_DEF_METHOD(set_pos, 1);
|
812
815
|
RG_DEF_METHOD(close, -1);
|
813
|
-
RG_DEF_METHOD(create_watch, 1);
|
816
|
+
RG_DEF_METHOD(create_watch, -1);
|
814
817
|
RG_DEF_METHOD(add_watch, 1);
|
815
818
|
RG_DEF_METHOD(buffer_size, 0);
|
816
819
|
RG_DEF_METHOD(set_buffer_size, 1);
|
@@ -852,5 +855,5 @@ Init_glib_io_channel(void)
|
|
852
855
|
rb_define_method(rb_mIOChannelSource,
|
853
856
|
"set_callback",
|
854
857
|
rg_io_channel_source_set_callback,
|
855
|
-
|
858
|
+
-1);
|
856
859
|
}
|