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/rbglib_source.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) 2005 Masao Mutoh
|
5
5
|
*
|
6
6
|
* This library is free software; you can redistribute it and/or
|
@@ -23,32 +23,6 @@
|
|
23
23
|
|
24
24
|
static ID id_call;
|
25
25
|
|
26
|
-
/*****************************************/
|
27
|
-
#if !GLIB_CHECK_VERSION(2,30,0)
|
28
|
-
static void
|
29
|
-
source_free(GSource *source)
|
30
|
-
{
|
31
|
-
if (g_source_is_destroyed(source)) {
|
32
|
-
return;
|
33
|
-
}
|
34
|
-
|
35
|
-
g_source_unref(source);
|
36
|
-
g_source_destroy(source);
|
37
|
-
}
|
38
|
-
|
39
|
-
GType
|
40
|
-
g_source_get_type(void)
|
41
|
-
{
|
42
|
-
static GType our_type = 0;
|
43
|
-
if (our_type == 0)
|
44
|
-
our_type = g_boxed_type_register_static ("GSource",
|
45
|
-
(GBoxedCopyFunc)g_source_ref,
|
46
|
-
(GBoxedFreeFunc)source_free);
|
47
|
-
return our_type;
|
48
|
-
}
|
49
|
-
#endif
|
50
|
-
/*****************************************/
|
51
|
-
|
52
26
|
#define RG_TARGET_NAMESPACE cSource
|
53
27
|
#define _SELF(s) ((GSource*)RVAL2BOXED(s, G_TYPE_SOURCE))
|
54
28
|
|
@@ -112,7 +86,6 @@ rg_id(VALUE self)
|
|
112
86
|
return UINT2NUM(g_source_get_id(_SELF(self)));
|
113
87
|
}
|
114
88
|
|
115
|
-
#if GLIB_CHECK_VERSION(2, 26, 0)
|
116
89
|
static VALUE
|
117
90
|
rg_name(VALUE self)
|
118
91
|
{
|
@@ -125,7 +98,6 @@ rg_set_name(VALUE self, VALUE name)
|
|
125
98
|
g_source_set_name(_SELF(self), RVAL2CSTR(name));
|
126
99
|
return self;
|
127
100
|
}
|
128
|
-
#endif
|
129
101
|
|
130
102
|
static VALUE
|
131
103
|
rg_context(VALUE self)
|
@@ -158,7 +130,6 @@ void g_source_set_callback_indirect (GSource *source,
|
|
158
130
|
GSourceCallbackFuncs *callback_funcs);
|
159
131
|
*/
|
160
132
|
|
161
|
-
#if GLIB_CHECK_VERSION(2, 36, 0)
|
162
133
|
static VALUE
|
163
134
|
rg_ready_time(VALUE self)
|
164
135
|
{
|
@@ -173,7 +144,6 @@ rg_set_ready_time(VALUE self, VALUE ready_time)
|
|
173
144
|
g_source_set_ready_time(_SELF(self), NUM2LL(ready_time));
|
174
145
|
return self;
|
175
146
|
}
|
176
|
-
#endif
|
177
147
|
|
178
148
|
static VALUE
|
179
149
|
rg_add_poll(VALUE self, VALUE fd)
|
@@ -189,7 +159,6 @@ rg_remove_poll(VALUE self, VALUE fd)
|
|
189
159
|
return self;
|
190
160
|
}
|
191
161
|
|
192
|
-
#if GLIB_CHECK_VERSION(2, 28, 0)
|
193
162
|
static VALUE
|
194
163
|
rg_time(VALUE self)
|
195
164
|
{
|
@@ -197,7 +166,6 @@ rg_time(VALUE self)
|
|
197
166
|
time = g_source_get_time(_SELF(self));
|
198
167
|
return LL2NUM(time);
|
199
168
|
}
|
200
|
-
#endif
|
201
169
|
|
202
170
|
/* How can I implement them ?
|
203
171
|
gboolean g_source_remove_by_funcs_user_data
|
@@ -226,21 +194,15 @@ Init_glib_source(void)
|
|
226
194
|
RG_DEF_METHOD(set_can_recurse, 1);
|
227
195
|
RG_DEF_METHOD_P(can_recurse, 0);
|
228
196
|
RG_DEF_METHOD(id, 0);
|
229
|
-
#if GLIB_CHECK_VERSION(2, 26, 0)
|
230
197
|
RG_DEF_METHOD(name, 0);
|
231
198
|
RG_REPLACE_SET_PROPERTY(name, 1);
|
232
|
-
#endif
|
233
199
|
RG_DEF_METHOD(context, 0);
|
234
200
|
RG_DEF_METHOD(set_callback, 0);
|
235
|
-
#if GLIB_CHECK_VERSION(2, 36, 0)
|
236
201
|
RG_DEF_METHOD(ready_time, 0);
|
237
202
|
RG_REPLACE_SET_PROPERTY(ready_time, 1);
|
238
|
-
#endif
|
239
203
|
RG_DEF_METHOD(add_poll, 1);
|
240
204
|
RG_DEF_METHOD(remove_poll, 1);
|
241
|
-
#if GLIB_CHECK_VERSION(2, 28, 0)
|
242
205
|
RG_DEF_METHOD(time, 0);
|
243
|
-
#endif
|
244
206
|
|
245
207
|
/* GLib::Source.remove is moved to rbglib_maincontext.c */
|
246
208
|
}
|
data/ext/glib2/rbglib_spawn.c
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
2
|
/*
|
3
|
-
* Copyright (C) 2011 Ruby-
|
3
|
+
* Copyright (C) 2011-2021 Ruby-GNOME Project Team
|
4
4
|
* Copyright (C) 2004 Masao Mutoh
|
5
5
|
* Copyright (C) 2004 Kazuhiro NISHIYAMA
|
6
6
|
*
|
@@ -29,10 +29,11 @@ static ID id_call;
|
|
29
29
|
static ID id_new;
|
30
30
|
|
31
31
|
static void
|
32
|
-
child_setup(gpointer
|
32
|
+
child_setup(gpointer data)
|
33
33
|
{
|
34
|
-
|
35
|
-
|
34
|
+
VALUE func = POINTER2RVAL(data);
|
35
|
+
if (!NIL_P(func)) {
|
36
|
+
rb_funcall(func, id_call, 0);
|
36
37
|
}
|
37
38
|
}
|
38
39
|
|
@@ -204,8 +205,6 @@ rg_s_command_line_async(G_GNUC_UNUSED VALUE self, VALUE str)
|
|
204
205
|
return ret;
|
205
206
|
}
|
206
207
|
|
207
|
-
#ifdef HAVE_G_SPAWN_CLOSE_PID
|
208
|
-
|
209
208
|
#define RVAL2GPID(value) ((GPid)NUM2INT(pid))
|
210
209
|
|
211
210
|
static VALUE
|
@@ -215,8 +214,6 @@ rg_s_close_pid(G_GNUC_UNUSED VALUE self, VALUE pid)
|
|
215
214
|
return Qnil;
|
216
215
|
}
|
217
216
|
|
218
|
-
#endif
|
219
|
-
|
220
217
|
void
|
221
218
|
Init_glib_spawn(void)
|
222
219
|
{
|
@@ -231,9 +228,7 @@ Init_glib_spawn(void)
|
|
231
228
|
RG_DEF_SMETHOD(sync, 4);
|
232
229
|
RG_DEF_SMETHOD(command_line_sync, 1);
|
233
230
|
RG_DEF_SMETHOD(command_line_async, 1);
|
234
|
-
#ifdef HAVE_G_SPAWN_CLOSE_PID
|
235
231
|
RG_DEF_SMETHOD(close_pid, 1);
|
236
|
-
#endif
|
237
232
|
|
238
233
|
rb_define_const(RG_TARGET_NAMESPACE, "LEAVE_DESCRIPTORS_OPEN", INT2NUM(G_SPAWN_LEAVE_DESCRIPTORS_OPEN));
|
239
234
|
rb_define_const(RG_TARGET_NAMESPACE, "DO_NOT_REAP_CHILD", INT2NUM(G_SPAWN_DO_NOT_REAP_CHILD));
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
2
|
/*
|
3
|
-
* Copyright (C) 2011 Ruby-
|
3
|
+
* Copyright (C) 2011-2021 Ruby-GNOME Project Team
|
4
4
|
* Copyright (C) 2004 Masao Mutoh
|
5
5
|
* Copyright (C) 2004 Kazuhiro NISHIYAMA
|
6
6
|
*
|
@@ -35,7 +35,7 @@ Init_glib_spawnerror(void)
|
|
35
35
|
rb_define_const(RG_TARGET_NAMESPACE, "CHDIR", INT2NUM(G_SPAWN_ERROR_CHDIR));
|
36
36
|
rb_define_const(RG_TARGET_NAMESPACE, "EACCES", INT2NUM(G_SPAWN_ERROR_ACCES));
|
37
37
|
rb_define_const(RG_TARGET_NAMESPACE, "EPERM", INT2NUM(G_SPAWN_ERROR_PERM));
|
38
|
-
rb_define_const(RG_TARGET_NAMESPACE, "
|
38
|
+
rb_define_const(RG_TARGET_NAMESPACE, "TOO_BIG", INT2NUM(G_SPAWN_ERROR_TOO_BIG));
|
39
39
|
rb_define_const(RG_TARGET_NAMESPACE, "ENOEXEC", INT2NUM(G_SPAWN_ERROR_NOEXEC));
|
40
40
|
rb_define_const(RG_TARGET_NAMESPACE, "ENAMETOOLONG", INT2NUM(G_SPAWN_ERROR_NAMETOOLONG));
|
41
41
|
rb_define_const(RG_TARGET_NAMESPACE, "ENOENT", INT2NUM(G_SPAWN_ERROR_NOENT));
|
data/ext/glib2/rbglib_threads.c
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
2
|
/*
|
3
|
-
* Copyright (C) 2011 Ruby-
|
3
|
+
* Copyright (C) 2011-2021 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
|
@@ -28,26 +28,13 @@ static VALUE RG_TARGET_NAMESPACE;
|
|
28
28
|
static VALUE
|
29
29
|
rg_s_init(VALUE self)
|
30
30
|
{
|
31
|
-
#ifdef HAVE_G_THREAD_INIT
|
32
|
-
#if defined(G_THREADS_ENABLED) && !GLIB_CHECK_VERSION(2, 32, 0)
|
33
|
-
g_thread_init(NULL);
|
34
|
-
#endif
|
35
|
-
#endif
|
36
31
|
return self;
|
37
32
|
}
|
38
33
|
|
39
34
|
static VALUE
|
40
35
|
rg_s_supported_p(G_GNUC_UNUSED VALUE self)
|
41
36
|
{
|
42
|
-
|
43
|
-
#ifdef G_THREADS_ENABLED
|
44
|
-
return CBOOL2RVAL(g_thread_supported());
|
45
|
-
#else
|
46
|
-
return Qfalse;
|
47
|
-
#endif
|
48
|
-
#else
|
49
|
-
return Qfalse;
|
50
|
-
#endif
|
37
|
+
return Qtrue;
|
51
38
|
|
52
39
|
}
|
53
40
|
|
data/ext/glib2/rbglib_timezone.c
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
* Copyright (C) 2016 Ruby-
|
2
|
+
* Copyright (C) 2016-2021 Ruby-GNOME Project Team
|
3
3
|
*
|
4
4
|
* This library is free software; you can redistribute it and/or
|
5
5
|
* modify it under the terms of the GNU Lesser General Public
|
@@ -22,7 +22,6 @@
|
|
22
22
|
#define RG_TARGET_NAMESPACE cTimeZone
|
23
23
|
#define _SELF(s) ((GTimeZone*)RVAL2BOXED(s, G_TYPE_TIME_ZONE))
|
24
24
|
|
25
|
-
#if GLIB_CHECK_VERSION(2, 34, 0)
|
26
25
|
static VALUE
|
27
26
|
rg_initialize(gint argc, VALUE *argv, VALUE self)
|
28
27
|
{
|
@@ -69,12 +68,10 @@ rg_offset(VALUE self, VALUE rb_interval)
|
|
69
68
|
gint interval = NUM2INT(rb_interval);
|
70
69
|
return INT2NUM(g_time_zone_get_offset(_SELF(self), interval));
|
71
70
|
}
|
72
|
-
#endif
|
73
71
|
|
74
72
|
void
|
75
73
|
Init_glib_time_zone(void)
|
76
74
|
{
|
77
|
-
#if GLIB_CHECK_VERSION(2, 34, 0)
|
78
75
|
VALUE RG_TARGET_NAMESPACE;
|
79
76
|
RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_TIME_ZONE, "TimeZone", mGLib);
|
80
77
|
RG_DEF_METHOD(initialize, -1);
|
@@ -82,5 +79,4 @@ Init_glib_time_zone(void)
|
|
82
79
|
RG_DEF_SMETHOD(utc, 0);
|
83
80
|
RG_DEF_METHOD(abbreviation, 1);
|
84
81
|
RG_DEF_METHOD(offset, 1);
|
85
|
-
#endif
|
86
82
|
}
|
data/ext/glib2/rbglib_unichar.c
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
2
|
/*
|
3
|
-
* Copyright (C) 2011 Ruby-
|
3
|
+
* Copyright (C) 2011-2021 Ruby-GNOME Project Team
|
4
4
|
* Copyright (C) 2006 Kouhei Sutou
|
5
5
|
*
|
6
6
|
* This library is free software; you can redistribute it and/or
|
@@ -105,7 +105,6 @@ rg_s_get_mirror_char(G_GNUC_UNUSED VALUE self, VALUE unichar)
|
|
105
105
|
}
|
106
106
|
}
|
107
107
|
|
108
|
-
#if GLIB_CHECK_VERSION(2,14,0)
|
109
108
|
static VALUE
|
110
109
|
rg_s_combining_class(G_GNUC_UNUSED VALUE self, VALUE unichar)
|
111
110
|
{
|
@@ -130,7 +129,6 @@ rg_s_zero_width_p(G_GNUC_UNUSED VALUE self, VALUE unichar)
|
|
130
129
|
{
|
131
130
|
return CBOOL2RVAL(g_unichar_iszerowidth(NUM2UINT(unichar)));
|
132
131
|
}
|
133
|
-
#endif
|
134
132
|
|
135
133
|
static VALUE
|
136
134
|
rg_s_to_utf8(G_GNUC_UNUSED VALUE self, VALUE unichar)
|
@@ -142,6 +140,48 @@ rg_s_to_utf8(G_GNUC_UNUSED VALUE self, VALUE unichar)
|
|
142
140
|
return CSTR2RVAL_LEN(utf8, len);
|
143
141
|
}
|
144
142
|
|
143
|
+
static VALUE
|
144
|
+
rg_s_compose(G_GNUC_UNUSED VALUE self, VALUE unichar1, VALUE unichar2)
|
145
|
+
{
|
146
|
+
gunichar composed_char;
|
147
|
+
if (g_unichar_compose(NUM2UINT(unichar1),
|
148
|
+
NUM2UINT(unichar2),
|
149
|
+
&composed_char)) {
|
150
|
+
return UINT2NUM(composed_char);
|
151
|
+
} else {
|
152
|
+
return Qnil;
|
153
|
+
}
|
154
|
+
}
|
155
|
+
|
156
|
+
static VALUE
|
157
|
+
rg_s_decompose(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
|
158
|
+
{
|
159
|
+
VALUE unichar;
|
160
|
+
VALUE options = Qnil;
|
161
|
+
gboolean compat = FALSE;
|
162
|
+
|
163
|
+
rb_scan_args(argc, argv, "1:", &unichar, &options);
|
164
|
+
if (!NIL_P(options)) {
|
165
|
+
ID keywords[1];
|
166
|
+
VALUE values[1];
|
167
|
+
keywords[0] = rb_intern("compat");
|
168
|
+
rb_get_kwargs(options, keywords, 0, 1, values);
|
169
|
+
if (values[0] != Qundef) {
|
170
|
+
compat = CBOOL2RVAL(values[0]);
|
171
|
+
}
|
172
|
+
}
|
173
|
+
|
174
|
+
/* 18 is enough. See g_unichar_fully_decompose() document. */
|
175
|
+
gunichar result[G_UNICHAR_MAX_DECOMPOSITION_LENGTH];
|
176
|
+
gsize result_len =
|
177
|
+
g_unichar_fully_decompose(NUM2UINT(unichar),
|
178
|
+
compat,
|
179
|
+
result,
|
180
|
+
G_UNICHAR_MAX_DECOMPOSITION_LENGTH);
|
181
|
+
return CSTR2RVAL_LEN_UCS4((const char *)result,
|
182
|
+
result_len * sizeof(gunichar));
|
183
|
+
}
|
184
|
+
|
145
185
|
void
|
146
186
|
Init_glib_unichar(void)
|
147
187
|
{
|
@@ -190,12 +230,13 @@ Init_glib_unichar(void)
|
|
190
230
|
|
191
231
|
RG_DEF_SMETHOD(get_mirror_char, 1);
|
192
232
|
|
193
|
-
#if GLIB_CHECK_VERSION(2,14,0)
|
194
233
|
RG_DEF_SMETHOD(combining_class, 1);
|
195
234
|
RG_DEF_SMETHOD(get_script, 1);
|
196
235
|
RG_DEF_SMETHOD_P(mark, 1);
|
197
236
|
RG_DEF_SMETHOD_P(zero_width, 1);
|
198
|
-
#endif
|
199
237
|
|
200
238
|
RG_DEF_SMETHOD(to_utf8, 1);
|
239
|
+
|
240
|
+
RG_DEF_SMETHOD(compose, 2);
|
241
|
+
RG_DEF_SMETHOD(decompose, -1);
|
201
242
|
}
|
data/ext/glib2/rbglib_unicode.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) 2006 Kouhei Sutou
|
5
5
|
*
|
6
6
|
* This library is free software; you can redistribute it and/or
|
@@ -49,20 +49,6 @@ rg_s_canonical_ordering(G_GNUC_UNUSED VALUE self, VALUE rb_ucs4)
|
|
49
49
|
return normalized_ucs4;
|
50
50
|
}
|
51
51
|
|
52
|
-
static VALUE
|
53
|
-
rg_s_canonical_decomposition(G_GNUC_UNUSED VALUE self, VALUE unichar)
|
54
|
-
{
|
55
|
-
VALUE normalized_ucs4;
|
56
|
-
gunichar *ucs4;
|
57
|
-
gsize len;
|
58
|
-
|
59
|
-
ucs4 = g_unicode_canonical_decomposition(NUM2UINT(unichar), &len);
|
60
|
-
normalized_ucs4 = CSTR2RVAL_LEN_UCS4((const char *)ucs4,
|
61
|
-
len * sizeof(gunichar));
|
62
|
-
g_free(ucs4);
|
63
|
-
return normalized_ucs4;
|
64
|
-
}
|
65
|
-
|
66
52
|
void
|
67
53
|
Init_glib_unicode(void)
|
68
54
|
{
|
@@ -75,16 +61,13 @@ Init_glib_unicode(void)
|
|
75
61
|
G_DEF_CLASS(G_TYPE_UNICODE_BREAK_TYPE, "BreakType", RG_TARGET_NAMESPACE);
|
76
62
|
G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, G_TYPE_UNICODE_BREAK_TYPE, "G_UNICODE_");
|
77
63
|
|
78
|
-
#if GLIB_CHECK_VERSION(2,14,0)
|
79
64
|
/* GUnicodeScript */
|
80
65
|
G_DEF_CLASS(G_TYPE_UNICODE_SCRIPT, "Script", RG_TARGET_NAMESPACE);
|
81
66
|
G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, G_TYPE_UNICODE_SCRIPT, "G_UNICODE_");
|
82
|
-
#endif
|
83
67
|
|
84
68
|
G_DEF_CLASS(G_TYPE_NORMALIZE_MODE, "NormalizeMode", mGLib);
|
85
69
|
|
86
70
|
rbg_define_singleton_method(mGLib, "charset", rbglib_m_charset, 0);
|
87
71
|
|
88
72
|
RG_DEF_SMETHOD(canonical_ordering, 1);
|
89
|
-
RG_DEF_SMETHOD(canonical_decomposition, 1);
|
90
73
|
}
|
data/ext/glib2/rbglib_utils.c
CHANGED
@@ -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) 2004 Pascal Terjan
|
6
5
|
*
|
7
6
|
* This library is free software; you can redistribute it and/or
|
@@ -71,7 +70,6 @@ rg_s_unsetenv(VALUE self, VALUE variable)
|
|
71
70
|
return self;
|
72
71
|
}
|
73
72
|
|
74
|
-
#ifdef HAVE_G_LISTENV
|
75
73
|
static VALUE
|
76
74
|
rg_s_listenv(G_GNUC_UNUSED VALUE self)
|
77
75
|
{
|
@@ -86,7 +84,6 @@ rg_s_listenv(G_GNUC_UNUSED VALUE self)
|
|
86
84
|
g_strfreev(c_list);
|
87
85
|
return r_list;
|
88
86
|
}
|
89
|
-
#endif
|
90
87
|
|
91
88
|
static VALUE
|
92
89
|
rg_s_host_name(G_GNUC_UNUSED VALUE self)
|
@@ -136,14 +133,12 @@ rg_s_system_config_dirs(G_GNUC_UNUSED VALUE self)
|
|
136
133
|
return STRV2RVAL((const gchar **)g_get_system_config_dirs());
|
137
134
|
}
|
138
135
|
|
139
|
-
#if GLIB_CHECK_VERSION(2, 14, 0)
|
140
136
|
static VALUE
|
141
137
|
rg_s_get_user_special_dir(G_GNUC_UNUSED VALUE self, VALUE directory)
|
142
138
|
{
|
143
139
|
return CSTR2RVAL(g_get_user_special_dir(RVAL2GENUM(directory,
|
144
140
|
G_TYPE_USER_DIRECTORY)));
|
145
141
|
}
|
146
|
-
#endif
|
147
142
|
|
148
143
|
static VALUE
|
149
144
|
rg_s_home_dir(G_GNUC_UNUSED VALUE self)
|
@@ -288,15 +283,11 @@ void
|
|
288
283
|
Init_glib_utils(void)
|
289
284
|
{
|
290
285
|
/* glib/gutils.h */
|
291
|
-
#if GLIB_CHECK_VERSION(2, 14, 0)
|
292
286
|
G_DEF_CLASS(G_TYPE_USER_DIRECTORY, "UserDirectory", RG_TARGET_NAMESPACE);
|
293
287
|
G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, G_TYPE_USER_DIRECTORY, "G_");
|
294
|
-
#endif
|
295
288
|
|
296
|
-
#if GLIB_CHECK_VERSION(2, 30, 0)
|
297
289
|
G_DEF_CLASS(G_TYPE_FORMAT_SIZE_FLAGS,
|
298
290
|
"FormatSizeFlags", RG_TARGET_NAMESPACE);
|
299
|
-
#endif
|
300
291
|
|
301
292
|
RG_DEF_SMETHOD(application_name, 0);
|
302
293
|
RG_DEF_SMETHOD(set_application_name, 1);
|
@@ -305,9 +296,7 @@ Init_glib_utils(void)
|
|
305
296
|
RG_DEF_SMETHOD(getenv, 1);
|
306
297
|
RG_DEF_SMETHOD(setenv, 2);
|
307
298
|
RG_DEF_SMETHOD(unsetenv, 1);
|
308
|
-
#ifdef HAVE_G_LISTENV
|
309
299
|
RG_DEF_SMETHOD(listenv, 0);
|
310
|
-
#endif
|
311
300
|
RG_DEF_SMETHOD(host_name, 0);
|
312
301
|
RG_DEF_SMETHOD(user_name, 0);
|
313
302
|
RG_DEF_SMETHOD(real_name, 0);
|
@@ -317,9 +306,7 @@ Init_glib_utils(void)
|
|
317
306
|
RG_DEF_SMETHOD(user_config_dir, 0);
|
318
307
|
RG_DEF_SMETHOD(system_data_dirs, 0);
|
319
308
|
RG_DEF_SMETHOD(system_config_dirs, 0);
|
320
|
-
#if GLIB_CHECK_VERSION(2, 14, 0)
|
321
309
|
RG_DEF_SMETHOD(get_user_special_dir, 1);
|
322
|
-
#endif
|
323
310
|
RG_DEF_SMETHOD(home_dir, 0);
|
324
311
|
RG_DEF_SMETHOD(tmp_dir, 0);
|
325
312
|
RG_DEF_SMETHOD(current_dir, 0);
|
data/ext/glib2/rbglib_win32.c
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
2
|
/*
|
3
|
-
* Copyright (C) 2011 Ruby-
|
3
|
+
* Copyright (C) 2011-2021 Ruby-GNOME Project Team
|
4
4
|
* Copyright (C) 2006 Kouhei Sutou
|
5
5
|
*
|
6
6
|
* This library is free software; you can redistribute it and/or
|
@@ -65,11 +65,10 @@ rbglib_m_win32_locale_filename_from_utf8_deprecated(VALUE self,
|
|
65
65
|
return rg_s_locale_filename_from_utf8(self, utf8_filename);
|
66
66
|
}
|
67
67
|
|
68
|
-
# if GLIB_CHECK_VERSION(2, 16, 0)
|
69
68
|
static VALUE
|
70
69
|
rg_s_get_package_installation_directory_of_module(int argc,
|
71
|
-
|
72
|
-
|
70
|
+
VALUE *argv,
|
71
|
+
VALUE self)
|
73
72
|
{
|
74
73
|
VALUE rb_module;
|
75
74
|
gchar *directory;
|
@@ -84,7 +83,6 @@ rg_s_get_package_installation_directory_of_module(int argc,
|
|
84
83
|
directory = g_win32_get_package_installation_directory_of_module(hmodule);
|
85
84
|
return CSTR2RVAL_FREE(directory);
|
86
85
|
}
|
87
|
-
# endif
|
88
86
|
#endif
|
89
87
|
|
90
88
|
void
|
@@ -105,8 +103,6 @@ Init_glib_win32(void)
|
|
105
103
|
rbg_define_singleton_method(mGLib, "win32_locale_filename_from_utf8",
|
106
104
|
rbglib_m_win32_locale_filename_from_utf8_deprecated, 1);
|
107
105
|
|
108
|
-
# if GLIB_CHECK_VERSION(2, 16, 0)
|
109
106
|
RG_DEF_SMETHOD(get_package_installation_directory_of_module, -1);
|
110
|
-
# endif
|
111
107
|
#endif
|
112
108
|
}
|
data/ext/glib2/rbgobj_binding.c
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
2
|
/*
|
3
|
-
* Copyright (C) 2015 Ruby-
|
3
|
+
* Copyright (C) 2015-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
|
@@ -24,7 +24,6 @@
|
|
24
24
|
|
25
25
|
#define _SELF(object) G_BINDING(RVAL2GOBJ(self))
|
26
26
|
|
27
|
-
#if GLIB_CHECK_VERSION(2, 38, 0)
|
28
27
|
static VALUE
|
29
28
|
rg_unbind(VALUE self)
|
30
29
|
{
|
@@ -39,18 +38,13 @@ rg_unbind(VALUE self)
|
|
39
38
|
|
40
39
|
return self;
|
41
40
|
}
|
42
|
-
#endif
|
43
41
|
|
44
42
|
void
|
45
43
|
Init_gobject_gbinding(void)
|
46
44
|
{
|
47
|
-
#if GLIB_CHECK_VERSION(2, 26, 0)
|
48
45
|
VALUE RG_TARGET_NAMESPACE;
|
49
46
|
|
50
47
|
RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_BINDING, "Binding", mGLib);
|
51
|
-
#endif
|
52
48
|
|
53
|
-
#if GLIB_CHECK_VERSION(2, 38, 0)
|
54
49
|
RG_DEF_METHOD(unbind, 0);
|
55
|
-
#endif
|
56
50
|
}
|
data/ext/glib2/rbgobj_boxed.c
CHANGED
data/ext/glib2/rbgobj_closure.c
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
2
|
/*
|
3
|
-
* Copyright (C)
|
4
|
-
* Copyright (C) 2002-2006 Ruby-GNOME2 Project
|
3
|
+
* Copyright (C) 2002-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
|
@@ -173,7 +172,7 @@ rclosure_unref(GRClosure *rclosure)
|
|
173
172
|
g_list_free(rclosure->objects);
|
174
173
|
rclosure->objects = NULL;
|
175
174
|
if (!NIL_P(rclosure->rb_holder)) {
|
176
|
-
|
175
|
+
RTYPEDDATA_DATA(rclosure->rb_holder) = NULL;
|
177
176
|
rclosure->rb_holder = Qnil;
|
178
177
|
}
|
179
178
|
}
|
@@ -201,8 +200,10 @@ rclosure_invalidate(G_GNUC_UNUSED gpointer data, GClosure *closure)
|
|
201
200
|
}
|
202
201
|
|
203
202
|
static void
|
204
|
-
gr_closure_holder_mark(
|
203
|
+
gr_closure_holder_mark(void *data)
|
205
204
|
{
|
205
|
+
GRClosure *rclosure = data;
|
206
|
+
|
206
207
|
if (!rclosure)
|
207
208
|
return;
|
208
209
|
|
@@ -211,8 +212,10 @@ gr_closure_holder_mark(GRClosure *rclosure)
|
|
211
212
|
}
|
212
213
|
|
213
214
|
static void
|
214
|
-
gr_closure_holder_free(
|
215
|
+
gr_closure_holder_free(void *data)
|
215
216
|
{
|
217
|
+
GRClosure *rclosure = data;
|
218
|
+
|
216
219
|
if (!rclosure)
|
217
220
|
return;
|
218
221
|
|
@@ -225,6 +228,17 @@ gr_closure_holder_free(GRClosure *rclosure)
|
|
225
228
|
}
|
226
229
|
}
|
227
230
|
|
231
|
+
static const rb_data_type_t rbg_closure_holder_type = {
|
232
|
+
"GLib::ClosureHolder",
|
233
|
+
{
|
234
|
+
gr_closure_holder_mark,
|
235
|
+
gr_closure_holder_free,
|
236
|
+
},
|
237
|
+
NULL,
|
238
|
+
NULL,
|
239
|
+
RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_FROZEN_SHAREABLE,
|
240
|
+
};
|
241
|
+
|
228
242
|
static GClosure *
|
229
243
|
g_rclosure_new_raw(VALUE callback_proc,
|
230
244
|
VALUE extra_args,
|
@@ -241,10 +255,9 @@ g_rclosure_new_raw(VALUE callback_proc,
|
|
241
255
|
closure->objects = NULL;
|
242
256
|
closure->callback = callback_proc;
|
243
257
|
closure->extra_args = extra_args;
|
244
|
-
closure->rb_holder =
|
245
|
-
|
246
|
-
|
247
|
-
closure);
|
258
|
+
closure->rb_holder = TypedData_Wrap_Struct(rb_cObject,
|
259
|
+
&rbg_closure_holder_type,
|
260
|
+
closure);
|
248
261
|
closure->tag[0] = '\0';
|
249
262
|
|
250
263
|
g_closure_set_marshal((GClosure*)closure, &rclosure_marshal);
|
data/ext/glib2/rbgobj_enums.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) 2004-2006 Ruby-GNOME Project Team
|
5
5
|
* Copyright (C) 2002,2003 Masahiro Sakai
|
6
6
|
*
|
@@ -114,7 +114,7 @@ static const rb_data_type_t rg_glib_enum_type = {
|
|
114
114
|
},
|
115
115
|
NULL,
|
116
116
|
NULL,
|
117
|
-
RUBY_TYPED_FREE_IMMEDIATELY,
|
117
|
+
RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_FROZEN_SHAREABLE,
|
118
118
|
};
|
119
119
|
|
120
120
|
static enum_holder *
|
@@ -191,6 +191,7 @@ rbgobj_init_enum_class(VALUE klass)
|
|
191
191
|
|
192
192
|
rb_raw_enum_value = INT2NUM(entry->value);
|
193
193
|
value = rb_funcall(klass, id_new, 1, rb_raw_enum_value);
|
194
|
+
rb_obj_freeze(value);
|
194
195
|
rb_hash_aset(values, rb_raw_enum_value, value);
|
195
196
|
const_nick_name = nick_to_const_name(entry->value_nick);
|
196
197
|
if (const_nick_name) {
|