glib2 3.5.0 → 4.0.1
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 +4 -3
- data/ext/glib2/glib2.def +4 -0
- data/ext/glib2/rbglib-bytes.c +1 -1
- data/ext/glib2/rbglib-gc.c +1 -1
- data/ext/glib2/rbglib-variant-type.c +1 -1
- data/ext/glib2/rbglib-variant.c +75 -2
- data/ext/glib2/rbglib.c +30 -1
- data/ext/glib2/rbglib.h +17 -4
- data/ext/glib2/rbglib_bookmarkfile.c +3 -2
- data/ext/glib2/rbglib_convert.c +2 -2
- data/ext/glib2/rbglib_datetime.c +14 -3
- data/ext/glib2/rbglib_error.c +2 -2
- data/ext/glib2/rbglib_fileutils.c +2 -2
- data/ext/glib2/rbglib_gettext.c +1 -1
- data/ext/glib2/rbglib_i18n.c +2 -2
- data/ext/glib2/rbglib_io_constants.c +1 -1
- data/ext/glib2/rbglib_iochannel.c +2 -2
- data/ext/glib2/rbglib_iochannel_win32_socket.c +2 -2
- data/ext/glib2/rbglib_iochannelerror.c +1 -1
- data/ext/glib2/rbglib_keyfile.c +2 -2
- data/ext/glib2/rbglib_maincontext.c +6 -6
- data/ext/glib2/rbglib_mainloop.c +1 -1
- data/ext/glib2/rbglib_matchinfo.c +1 -1
- data/ext/glib2/rbglib_messages.c +1 -1
- data/ext/glib2/rbglib_pollfd.c +1 -1
- data/ext/glib2/rbglib_regex.c +3 -3
- data/ext/glib2/rbglib_shell.c +1 -1
- data/ext/glib2/rbglib_shellerror.c +1 -1
- data/ext/glib2/rbglib_source.c +1 -1
- data/ext/glib2/rbglib_spawn.c +1 -1
- data/ext/glib2/rbglib_spawnerror.c +1 -1
- data/ext/glib2/rbglib_threads.c +1 -1
- data/ext/glib2/rbglib_timer.c +1 -1
- data/ext/glib2/rbglib_timezone.c +1 -1
- data/ext/glib2/rbglib_ucs4.c +1 -1
- data/ext/glib2/rbglib_unichar.c +1 -1
- data/ext/glib2/rbglib_unicode.c +3 -3
- data/ext/glib2/rbglib_utf16.c +1 -1
- data/ext/glib2/rbglib_utf8.c +1 -1
- data/ext/glib2/rbglib_utils.c +1 -1
- data/ext/glib2/rbglib_win32.c +3 -3
- data/ext/glib2/rbgobj_binding.c +1 -1
- data/ext/glib2/rbgobj_boxed.c +1 -1
- data/ext/glib2/rbgobj_closure.c +54 -84
- data/ext/glib2/rbgobj_enums.c +1 -1
- data/ext/glib2/rbgobj_flags.c +1 -1
- data/ext/glib2/rbgobj_object.c +32 -5
- data/ext/glib2/rbgobj_param.c +1 -1
- data/ext/glib2/rbgobj_signal.c +36 -18
- data/ext/glib2/rbgobj_type.c +2 -2
- data/ext/glib2/rbgobj_typeinstance.c +1 -1
- data/ext/glib2/rbgobj_typeinterface.c +4 -4
- data/ext/glib2/rbgobj_typemodule.c +1 -1
- data/ext/glib2/rbgobj_typeplugin.c +1 -1
- data/ext/glib2/rbgobj_value.c +1 -1
- data/ext/glib2/rbgobj_valuetypes.c +14 -4
- data/ext/glib2/rbgobject.c +7 -21
- data/ext/glib2/rbgobject.h +1 -0
- data/ext/glib2/rbgprivate.h +7 -4
- data/ext/glib2/rbgutil.c +20 -1
- data/ext/glib2/rbgutil.h +3 -0
- data/ext/glib2/rbgutil_callback.c +7 -7
- data/lib/glib2/date-time.rb +35 -0
- data/lib/glib2/variant.rb +25 -0
- data/lib/glib2.rb +6 -1
- data/lib/mkmf-gnome.rb +2 -2
- data/test/test-date-time.rb +14 -2
- data/test/test-glib2.rb +21 -9
- data/test/test-variant.rb +44 -1
- metadata +7 -7
- data/ext/glib2/glib-enum-types.c +0 -1233
- data/ext/glib2/glib-enum-types.h +0 -154
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cc1ca98ff2e2ca2540e4f14ca4e41233478bf4df2294003f32b53e628b40d2bb
|
4
|
+
data.tar.gz: 8d2318093b15b1489afd59c97df5a4e76df56a2b48eac599740b437882b74beb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e5d71af62d76175a21f453b465917be4b495c286283278ffc533d7afa91f148fa872c27defdba8f2b2beee75b53c0bfb234e1b4c229c7b9d18eee83cfb0ea3f2
|
7
|
+
data.tar.gz: 7ee7bc7643e2d286d1eeff8c467236672f8939c12ffed17a58d891bb7f8f0eecc26e06935028414699a05024a4980691fea5b7b5ea5889299baf36d2867d9a23
|
data/ext/glib2/extconf.rb
CHANGED
@@ -28,12 +28,13 @@ require "mkmf-gnome"
|
|
28
28
|
|
29
29
|
unless required_pkg_config_package([package_id, 2, 12, 0],
|
30
30
|
:alt_linux => "glib2-devel",
|
31
|
-
:debian => "libglib2.0-dev",
|
32
|
-
:redhat => "pkgconfig(#{package_id})",
|
33
31
|
:arch_linux => "glib2",
|
32
|
+
:debian => "libglib2.0-dev",
|
33
|
+
:gentoo_linux => "dev-libs/glib",
|
34
34
|
:homebrew => "glib",
|
35
35
|
:macports => "glib2",
|
36
|
-
:msys2 => "glib2"
|
36
|
+
:msys2 => "glib2",
|
37
|
+
:redhat => "pkgconfig(#{package_id})")
|
37
38
|
exit(false)
|
38
39
|
end
|
39
40
|
PKGConfig.have_package('gthread-2.0')
|
data/ext/glib2/glib2.def
CHANGED
@@ -76,11 +76,14 @@ EXPORTS
|
|
76
76
|
g_rclosure_new
|
77
77
|
g_rclosure_new_call
|
78
78
|
g_rclosure_attach
|
79
|
+
g_rclosure_attach_gobject
|
79
80
|
g_rclosure_set_tag
|
80
81
|
rbgobj_ruby_value_get_type
|
81
82
|
g_value_get_ruby_value
|
82
83
|
g_value_set_ruby_value
|
83
84
|
g_key_file_get_type
|
85
|
+
rbg_mGLib
|
86
|
+
rbg_cGLibObject
|
84
87
|
rbg_rval_inspect
|
85
88
|
rbg_string_value_ptr
|
86
89
|
rbg_rval2cstr
|
@@ -127,6 +130,7 @@ EXPORTS
|
|
127
130
|
rbg_rval2glist
|
128
131
|
rbg_rval2gslist
|
129
132
|
rbg_define_method
|
133
|
+
rbg_define_private_method
|
130
134
|
rbg_define_singleton_method
|
131
135
|
rbg_to_array
|
132
136
|
rbg_to_hash
|
data/ext/glib2/rbglib-bytes.c
CHANGED
data/ext/glib2/rbglib-gc.c
CHANGED
@@ -191,7 +191,7 @@ void
|
|
191
191
|
Init_glib_gc(void)
|
192
192
|
{
|
193
193
|
VALUE gc_marker = rbg_gc_marker_new_raw();
|
194
|
-
rb_ivar_set(
|
194
|
+
rb_ivar_set(rbg_mGLib(), rb_intern("gc_marker"), gc_marker);
|
195
195
|
TypedData_Get_Struct(gc_marker,
|
196
196
|
RBGGCMarker,
|
197
197
|
&rbg_gc_marker_type,
|
@@ -234,7 +234,7 @@ rg_element(VALUE self)
|
|
234
234
|
void
|
235
235
|
Init_glib_variant_type(void)
|
236
236
|
{
|
237
|
-
RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_VARIANT_TYPE, "VariantType",
|
237
|
+
RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_VARIANT_TYPE, "VariantType", rbg_mGLib());
|
238
238
|
|
239
239
|
RG_DEF_SMETHOD_P(valid, 1);
|
240
240
|
RG_DEF_SMETHOD(scan, 1);
|
data/ext/glib2/rbglib-variant.c
CHANGED
@@ -107,10 +107,53 @@ rg_variant_free(gpointer object)
|
|
107
107
|
g_variant_unref(variant);
|
108
108
|
}
|
109
109
|
|
110
|
+
static const rb_data_type_t rbg_variant_type = {
|
111
|
+
"GLib::Variant",
|
112
|
+
{
|
113
|
+
NULL,
|
114
|
+
rg_variant_free,
|
115
|
+
},
|
116
|
+
NULL,
|
117
|
+
NULL,
|
118
|
+
RUBY_TYPED_FREE_IMMEDIATELY,
|
119
|
+
};
|
120
|
+
|
110
121
|
static VALUE
|
111
122
|
rg_variant_allocate(VALUE klass)
|
112
123
|
{
|
113
|
-
return
|
124
|
+
return TypedData_Wrap_Struct(klass, &rbg_variant_type, NULL);
|
125
|
+
}
|
126
|
+
|
127
|
+
static VALUE
|
128
|
+
rg_s_parse(int argc, VALUE *argv, VALUE klass)
|
129
|
+
{
|
130
|
+
VALUE rb_text;
|
131
|
+
VALUE rb_variant_type;
|
132
|
+
rb_scan_args(argc, argv, "11", &rb_text, &rb_variant_type);
|
133
|
+
const gchar *text = RVAL2CSTR(rb_text);
|
134
|
+
const gchar *limit = text + RSTRING_LEN(rb_text);
|
135
|
+
const GVariantType *variant_type = NULL;
|
136
|
+
if (!NIL_P(rb_variant_type)) {
|
137
|
+
variant_type = RVAL2GVARIANTTYPE(rb_variant_type);
|
138
|
+
}
|
139
|
+
GError *error = NULL;
|
140
|
+
GVariant *variant = g_variant_parse(variant_type,
|
141
|
+
text,
|
142
|
+
limit,
|
143
|
+
NULL,
|
144
|
+
&error);
|
145
|
+
if (error) {
|
146
|
+
GError *detailed_error = NULL;
|
147
|
+
gchar *context = g_variant_parse_error_print_context(error, text);
|
148
|
+
g_set_error_literal(&detailed_error,
|
149
|
+
error->domain,
|
150
|
+
error->code,
|
151
|
+
context);
|
152
|
+
g_free(context);
|
153
|
+
g_error_free(error);
|
154
|
+
RG_RAISE_ERROR(detailed_error);
|
155
|
+
}
|
156
|
+
return TypedData_Wrap_Struct(klass, &rbg_variant_type, variant);
|
114
157
|
}
|
115
158
|
|
116
159
|
static GVariant *
|
@@ -283,14 +326,44 @@ rg_type(VALUE self)
|
|
283
326
|
return GVARIANTTYPE2RVAL((GVariantType *)g_variant_get_type(variant));
|
284
327
|
}
|
285
328
|
|
329
|
+
static VALUE
|
330
|
+
rg_to_s(int argc, VALUE *argv, VALUE self)
|
331
|
+
{
|
332
|
+
VALUE options = Qnil;
|
333
|
+
gboolean type_annotate = FALSE;
|
334
|
+
rb_scan_args(argc, argv, ":", &options);
|
335
|
+
if (!NIL_P(options)) {
|
336
|
+
ID keywords[1];
|
337
|
+
VALUE values[1];
|
338
|
+
keywords[0] = rb_intern("type_annotate");
|
339
|
+
rb_get_kwargs(options, keywords, 0, 1, values);
|
340
|
+
if (values[0] != Qundef) {
|
341
|
+
type_annotate = CBOOL2RVAL(values[0]);
|
342
|
+
}
|
343
|
+
}
|
344
|
+
|
345
|
+
GVariant *variant = _SELF(self);
|
346
|
+
gchar *string = g_variant_print(variant, type_annotate);
|
347
|
+
return CSTR2RVAL_FREE(string);
|
348
|
+
}
|
349
|
+
|
286
350
|
void
|
287
351
|
Init_glib_variant(void)
|
288
352
|
{
|
289
|
-
RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_VARIANT, "Variant",
|
353
|
+
RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_VARIANT, "Variant", rbg_mGLib());
|
290
354
|
|
291
355
|
rb_define_alloc_func(RG_TARGET_NAMESPACE, rg_variant_allocate);
|
292
356
|
|
357
|
+
RG_DEF_SMETHOD(parse, -1);
|
358
|
+
|
293
359
|
RG_DEF_METHOD(initialize, -1);
|
294
360
|
RG_DEF_METHOD(value, 0);
|
295
361
|
RG_DEF_METHOD(type, 0);
|
362
|
+
RG_DEF_METHOD(to_s, -1);
|
363
|
+
|
364
|
+
G_DEF_ERROR(G_VARIANT_PARSE_ERROR,
|
365
|
+
"VariantParseError",
|
366
|
+
rbg_mGLib(),
|
367
|
+
rb_eRuntimeError,
|
368
|
+
G_TYPE_VARIANT_PARSE_ERROR);
|
296
369
|
}
|
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-
|
3
|
+
* Copyright (C) 2011-2022 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
|
@@ -29,6 +29,12 @@ static ID id_inspect;
|
|
29
29
|
|
30
30
|
VALUE RG_TARGET_NAMESPACE;
|
31
31
|
|
32
|
+
VALUE
|
33
|
+
rbg_mGLib(void)
|
34
|
+
{
|
35
|
+
return RG_TARGET_NAMESPACE;
|
36
|
+
}
|
37
|
+
|
32
38
|
const gchar *
|
33
39
|
rbg_rval2cstr(VALUE *str)
|
34
40
|
{
|
@@ -1067,6 +1073,25 @@ rg_s_os_unix_p(G_GNUC_UNUSED VALUE self)
|
|
1067
1073
|
#endif
|
1068
1074
|
}
|
1069
1075
|
|
1076
|
+
static VALUE
|
1077
|
+
rg_s_malloc(G_GNUC_UNUSED VALUE self, VALUE size)
|
1078
|
+
{
|
1079
|
+
return POINTER2NUM(g_malloc(NUM2SIZET(size)));
|
1080
|
+
}
|
1081
|
+
|
1082
|
+
static VALUE
|
1083
|
+
rg_s_malloc0(G_GNUC_UNUSED VALUE self, VALUE size)
|
1084
|
+
{
|
1085
|
+
return POINTER2NUM(g_malloc0(NUM2SIZET(size)));
|
1086
|
+
}
|
1087
|
+
|
1088
|
+
static VALUE
|
1089
|
+
rg_s_free(G_GNUC_UNUSED VALUE self, VALUE address)
|
1090
|
+
{
|
1091
|
+
g_free(NUM2POINTER(address));
|
1092
|
+
return RUBY_Qnil;
|
1093
|
+
}
|
1094
|
+
|
1070
1095
|
extern void Init_glib2(void);
|
1071
1096
|
|
1072
1097
|
void
|
@@ -1153,6 +1178,10 @@ Init_glib2(void)
|
|
1153
1178
|
RG_DEF_SMETHOD_P(os_beos, 0);
|
1154
1179
|
RG_DEF_SMETHOD_P(os_unix, 0);
|
1155
1180
|
|
1181
|
+
RG_DEF_SMETHOD(malloc, 1);
|
1182
|
+
RG_DEF_SMETHOD(malloc0, 1);
|
1183
|
+
RG_DEF_SMETHOD(free, 1);
|
1184
|
+
|
1156
1185
|
rb_define_const(RG_TARGET_NAMESPACE, "DIR_SEPARATOR", CSTR2RVAL(G_DIR_SEPARATOR_S));
|
1157
1186
|
rb_define_const(RG_TARGET_NAMESPACE, "SEARCHPATH_SEPARATOR", CSTR2RVAL(G_SEARCHPATH_SEPARATOR_S));
|
1158
1187
|
|
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-
|
3
|
+
* Copyright (C) 2002-2022 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
|
@@ -31,9 +31,9 @@
|
|
31
31
|
|
32
32
|
G_BEGIN_DECLS
|
33
33
|
|
34
|
-
#define RBGLIB_MAJOR_VERSION
|
35
|
-
#define RBGLIB_MINOR_VERSION
|
36
|
-
#define RBGLIB_MICRO_VERSION
|
34
|
+
#define RBGLIB_MAJOR_VERSION 4
|
35
|
+
#define RBGLIB_MINOR_VERSION 0
|
36
|
+
#define RBGLIB_MICRO_VERSION 1
|
37
37
|
|
38
38
|
#ifndef RB_ZALLOC
|
39
39
|
# ifdef ZALLOC
|
@@ -142,6 +142,14 @@ G_BEGIN_DECLS
|
|
142
142
|
#define RVAL2POINTER(value) ((gpointer)(value))
|
143
143
|
#define POINTER2RVAL(pointer) ((VALUE)(pointer))
|
144
144
|
|
145
|
+
#if SIZEOF_VOIDP == SIZEOF_LONG
|
146
|
+
# define NUM2POINTER(number) ((gpointer)NUM2ULONG(number))
|
147
|
+
# define POINTER2NUM(pointer) ULONG2NUM((unsigned long)pointer)
|
148
|
+
#else
|
149
|
+
# define NUM2POINTER(number) ((gpointer)NUM2ULL(number))
|
150
|
+
# define POINTER2NUM(pointer) ULL2NUM((unsigned LONG_LONG)pointer)
|
151
|
+
#endif
|
152
|
+
|
145
153
|
#define GINTS2RVAL(ary, n) rbg_gints2rval(ary, n)
|
146
154
|
#define GINTS2RVAL_FREE(ary, n) rbg_gints2rval(ary, n)
|
147
155
|
|
@@ -165,8 +173,13 @@ G_BEGIN_DECLS
|
|
165
173
|
# define RUBY_GLIB2_VAR extern
|
166
174
|
#endif
|
167
175
|
|
176
|
+
/* Deprecated. Use rbg_mGLib() instead. */
|
177
|
+
G_GNUC_DEPRECATED_FOR(rbg_mGLib())
|
168
178
|
RUBY_GLIB2_VAR VALUE mGLib;
|
169
179
|
|
180
|
+
extern VALUE rbg_mGLib(void);
|
181
|
+
extern VALUE rbg_cGLibObject(void);
|
182
|
+
|
170
183
|
extern const gchar *rbg_rval_inspect(VALUE object);
|
171
184
|
|
172
185
|
extern gchar* rbg_string_value_ptr(volatile VALUE* ptr); /* no longer used */
|
@@ -500,9 +500,10 @@ rg_move_item(VALUE self, VALUE old_uri, VALUE new_uri)
|
|
500
500
|
void
|
501
501
|
Init_glib_bookmark_file(void)
|
502
502
|
{
|
503
|
-
VALUE RG_TARGET_NAMESPACE =
|
503
|
+
VALUE RG_TARGET_NAMESPACE =
|
504
|
+
G_DEF_CLASS(G_TYPE_BOOKMARK_FILE, "BookmarkFile", rbg_mGLib());
|
504
505
|
|
505
|
-
G_DEF_ERROR(G_BOOKMARK_FILE_ERROR, "BookmarkFileError",
|
506
|
+
G_DEF_ERROR(G_BOOKMARK_FILE_ERROR, "BookmarkFileError", rbg_mGLib(),
|
506
507
|
rb_eRuntimeError, G_TYPE_BOOKMARK_FILE_ERROR);
|
507
508
|
|
508
509
|
RG_DEF_METHOD(initialize, 0);
|
data/ext/glib2/rbglib_convert.c
CHANGED
@@ -23,8 +23,6 @@
|
|
23
23
|
#include "rbgprivate.h"
|
24
24
|
#include "rbglib.h"
|
25
25
|
|
26
|
-
#define RG_TARGET_NAMESPACE mGLib
|
27
|
-
|
28
26
|
static VALUE
|
29
27
|
rg_s_convert(G_GNUC_UNUSED VALUE self, VALUE str, VALUE to, VALUE from)
|
30
28
|
{
|
@@ -171,6 +169,8 @@ rg_s_utf8_validate(G_GNUC_UNUSED VALUE self, VALUE str)
|
|
171
169
|
void
|
172
170
|
Init_glib_convert(void)
|
173
171
|
{
|
172
|
+
VALUE RG_TARGET_NAMESPACE = rbg_mGLib();
|
173
|
+
|
174
174
|
VALUE cCharError = G_DEF_ERROR2(G_CONVERT_ERROR, "ConvertError", RG_TARGET_NAMESPACE, rb_eIOError);
|
175
175
|
|
176
176
|
rb_define_const(cCharError, "NO_CONVERSION", INT2NUM(G_CONVERT_ERROR_NO_CONVERSION));
|
data/ext/glib2/rbglib_datetime.c
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
* Copyright (C) 2016-
|
2
|
+
* Copyright (C) 2016-2022 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
|
@@ -53,7 +53,7 @@ is_timezone(VALUE rb_timezone)
|
|
53
53
|
{
|
54
54
|
VALUE rb_cTimeZone;
|
55
55
|
|
56
|
-
rb_cTimeZone = rb_const_get(
|
56
|
+
rb_cTimeZone = rb_const_get(rbg_mGLib(), rb_intern("TimeZone"));
|
57
57
|
return RVAL2CBOOL(rb_obj_is_kind_of(rb_timezone, rb_cTimeZone));
|
58
58
|
}
|
59
59
|
|
@@ -230,12 +230,20 @@ rg_format(VALUE self, VALUE rb_format)
|
|
230
230
|
return CSTR2RVAL(g_date_time_format(_SELF(self), format));
|
231
231
|
}
|
232
232
|
|
233
|
+
#if GLIB_CHECK_VERSION(2, 62, 0)
|
234
|
+
static VALUE
|
235
|
+
rg_format_iso8601(VALUE self)
|
236
|
+
{
|
237
|
+
return CSTR2RVAL(g_date_time_format_iso8601(_SELF(self)));
|
238
|
+
}
|
239
|
+
#endif
|
240
|
+
|
233
241
|
void
|
234
242
|
Init_glib_date_time(void)
|
235
243
|
{
|
236
244
|
VALUE RG_TARGET_NAMESPACE;
|
237
245
|
|
238
|
-
RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_DATE_TIME, "DateTime",
|
246
|
+
RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_DATE_TIME, "DateTime", rbg_mGLib());
|
239
247
|
|
240
248
|
RG_DEF_SMETHOD(now, -1);
|
241
249
|
|
@@ -247,4 +255,7 @@ Init_glib_date_time(void)
|
|
247
255
|
RG_DEF_METHOD(minute, 0);
|
248
256
|
RG_DEF_METHOD(second, 0);
|
249
257
|
RG_DEF_METHOD(format, 1);
|
258
|
+
#if GLIB_CHECK_VERSION(2, 62, 0)
|
259
|
+
RG_DEF_METHOD(format_iso8601, 0);
|
260
|
+
#endif
|
250
261
|
}
|
data/ext/glib2/rbglib_error.c
CHANGED
@@ -190,12 +190,12 @@ Init_glib_error(void)
|
|
190
190
|
rb_global_variable(&gerror_table);
|
191
191
|
|
192
192
|
#define RG_TARGET_NAMESPACE error_info
|
193
|
-
error_info = rb_define_module_under(
|
193
|
+
error_info = rb_define_module_under(rbg_mGLib(), "ErrorInfo");
|
194
194
|
rb_define_attr(error_info, "code", TRUE, FALSE);
|
195
195
|
rb_define_attr(error_info, "domain", TRUE, FALSE);
|
196
196
|
RG_DEF_METHOD(initialize, -1);
|
197
197
|
|
198
|
-
generic_error = rb_define_class_under(
|
198
|
+
generic_error = rb_define_class_under(rbg_mGLib(), "Error", rb_eRuntimeError);
|
199
199
|
rb_define_const(generic_error, name_CODE, Qnil);
|
200
200
|
rb_define_const(generic_error, name_DOMAIN, Qnil);
|
201
201
|
rb_include_module(generic_error, error_info);
|
@@ -71,7 +71,7 @@ rbglib_m_format_size(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
|
|
71
71
|
void
|
72
72
|
Init_glib_fileutils(void)
|
73
73
|
{
|
74
|
-
VALUE RG_TARGET_NAMESPACE = G_DEF_ERROR2(G_FILE_ERROR, "FileError",
|
74
|
+
VALUE RG_TARGET_NAMESPACE = G_DEF_ERROR2(G_FILE_ERROR, "FileError", rbg_mGLib(), rb_eIOError);
|
75
75
|
|
76
76
|
rb_define_const(RG_TARGET_NAMESPACE, "EXIST", INT2NUM(G_FILE_ERROR_EXIST));
|
77
77
|
rb_define_const(RG_TARGET_NAMESPACE, "ISDIR", INT2NUM(G_FILE_ERROR_ISDIR));
|
@@ -98,6 +98,6 @@ Init_glib_fileutils(void)
|
|
98
98
|
rb_define_const(RG_TARGET_NAMESPACE, "PERM", INT2NUM(G_FILE_ERROR_PERM));
|
99
99
|
rb_define_const(RG_TARGET_NAMESPACE, "FAILED", INT2NUM(G_FILE_ERROR_FAILED));
|
100
100
|
|
101
|
-
rbg_define_singleton_method(
|
101
|
+
rbg_define_singleton_method(rbg_mGLib(), "format_size",
|
102
102
|
rbglib_m_format_size, -1);
|
103
103
|
}
|
data/ext/glib2/rbglib_gettext.c
CHANGED
data/ext/glib2/rbglib_i18n.c
CHANGED
@@ -24,8 +24,6 @@
|
|
24
24
|
#undef _
|
25
25
|
#include <glib/gi18n.h>
|
26
26
|
|
27
|
-
#define RG_TARGET_NAMESPACE mGLib
|
28
|
-
|
29
27
|
static VALUE
|
30
28
|
rg_s_language_names(G_GNUC_UNUSED VALUE self)
|
31
29
|
{
|
@@ -35,6 +33,8 @@ rg_s_language_names(G_GNUC_UNUSED VALUE self)
|
|
35
33
|
void
|
36
34
|
Init_glib_i18n(void)
|
37
35
|
{
|
36
|
+
VALUE RG_TARGET_NAMESPACE = rbg_mGLib();
|
37
|
+
|
38
38
|
/* glib/gi18n.h */
|
39
39
|
RG_DEF_SMETHOD(language_names, 0);
|
40
40
|
}
|
@@ -777,7 +777,7 @@ rg_print(int argc, VALUE *argv, VALUE out)
|
|
777
777
|
void
|
778
778
|
Init_glib_io_channel(void)
|
779
779
|
{
|
780
|
-
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_IO_CHANNEL, "IOChannel",
|
780
|
+
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_IO_CHANNEL, "IOChannel", rbg_mGLib());
|
781
781
|
|
782
782
|
rb_include_module(RG_TARGET_NAMESPACE, rb_mEnumerable);
|
783
783
|
|
@@ -851,7 +851,7 @@ Init_glib_io_channel(void)
|
|
851
851
|
rb_define_const(RG_TARGET_NAMESPACE, "FLAG_GET_MASK", INT2NUM(G_IO_FLAG_GET_MASK));
|
852
852
|
rb_define_const(RG_TARGET_NAMESPACE, "FLAG_SET_MASK", INT2NUM(G_IO_FLAG_SET_MASK));
|
853
853
|
|
854
|
-
rb_mIOChannelSource = rb_define_module_under(
|
854
|
+
rb_mIOChannelSource = rb_define_module_under(rbg_mGLib(), "IOChannelSource");
|
855
855
|
rb_define_method(rb_mIOChannelSource,
|
856
856
|
"set_callback",
|
857
857
|
rg_io_channel_source_set_callback,
|
@@ -47,9 +47,9 @@ Init_glib_io_channel_win32_socket(void)
|
|
47
47
|
/* GIOWin32Channel */
|
48
48
|
VALUE RG_TARGET_NAMESPACE;
|
49
49
|
RG_TARGET_NAMESPACE =
|
50
|
-
rb_define_class_under(
|
50
|
+
rb_define_class_under(rbg_mGLib(),
|
51
51
|
"IOChannelWin32Socket",
|
52
|
-
rb_const_get(
|
52
|
+
rb_const_get(rbg_mGLib(), rb_intern("IOChannel")));
|
53
53
|
RG_DEF_METHOD(initialize, 1);
|
54
54
|
#endif
|
55
55
|
}
|
@@ -32,7 +32,7 @@ rg_s_from_errno(G_GNUC_UNUSED VALUE self, VALUE errno_)
|
|
32
32
|
void
|
33
33
|
Init_glib_io_channelerror(void)
|
34
34
|
{
|
35
|
-
VALUE RG_TARGET_NAMESPACE = G_DEF_ERROR2(G_IO_CHANNEL_ERROR, "IOChannelError",
|
35
|
+
VALUE RG_TARGET_NAMESPACE = G_DEF_ERROR2(G_IO_CHANNEL_ERROR, "IOChannelError", rbg_mGLib(), rb_eIOError);
|
36
36
|
|
37
37
|
/* GIOChannelError */
|
38
38
|
RG_DEF_SMETHOD(from_errno, 1);
|
data/ext/glib2/rbglib_keyfile.c
CHANGED
@@ -631,8 +631,8 @@ rg_remove_comment(VALUE self, VALUE group_name, VALUE key)
|
|
631
631
|
void
|
632
632
|
Init_glib_keyfile(void)
|
633
633
|
{
|
634
|
-
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_KEY_FILE, "KeyFile",
|
635
|
-
G_DEF_ERROR(G_KEY_FILE_ERROR, "KeyFileError",
|
634
|
+
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_KEY_FILE, "KeyFile", rbg_mGLib());
|
635
|
+
G_DEF_ERROR(G_KEY_FILE_ERROR, "KeyFileError", rbg_mGLib(),
|
636
636
|
rb_eRuntimeError, G_TYPE_KEY_FILE_ERROR);
|
637
637
|
|
638
638
|
RG_DEF_METHOD(initialize, 0);
|
@@ -498,11 +498,11 @@ child_watch_add(VALUE self, VALUE pid)
|
|
498
498
|
void
|
499
499
|
Init_glib_main_context(void)
|
500
500
|
{
|
501
|
-
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_MAIN_CONTEXT, "MainContext",
|
501
|
+
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_MAIN_CONTEXT, "MainContext", rbg_mGLib());
|
502
502
|
|
503
|
-
VALUE timeout = rb_define_module_under(
|
504
|
-
VALUE idle = rb_define_module_under(
|
505
|
-
VALUE child_watch = rb_define_module_under(
|
503
|
+
VALUE timeout = rb_define_module_under(rbg_mGLib(), "Timeout");
|
504
|
+
VALUE idle = rb_define_module_under(rbg_mGLib(), "Idle");
|
505
|
+
VALUE child_watch = rb_define_module_under(rbg_mGLib(), "ChildWatch");
|
506
506
|
|
507
507
|
id_call = rb_intern("call");
|
508
508
|
|
@@ -510,10 +510,10 @@ Init_glib_main_context(void)
|
|
510
510
|
|
511
511
|
main_thread = g_thread_self();
|
512
512
|
|
513
|
-
rbg_define_singleton_method(
|
513
|
+
rbg_define_singleton_method(rbg_mGLib(), "set_ruby_thread_priority",
|
514
514
|
ruby_source_set_priority, 1);
|
515
515
|
|
516
|
-
mGLibSource = rb_const_get(
|
516
|
+
mGLibSource = rb_const_get(rbg_mGLib(), rb_intern("Source"));
|
517
517
|
rbg_define_singleton_method(mGLibSource, "remove", source_remove, 1);
|
518
518
|
rbg_define_singleton_method(mGLibSource, "current", source_current_source, 0);
|
519
519
|
/*
|
data/ext/glib2/rbglib_mainloop.c
CHANGED
@@ -119,7 +119,7 @@ rg_context(VALUE self)
|
|
119
119
|
void
|
120
120
|
Init_glib_main_loop(void)
|
121
121
|
{
|
122
|
-
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_MAIN_LOOP, "MainLoop",
|
122
|
+
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_MAIN_LOOP, "MainLoop", rbg_mGLib());
|
123
123
|
|
124
124
|
RG_DEF_METHOD(initialize, -1);
|
125
125
|
RG_DEF_METHOD(run, 0);
|
@@ -163,7 +163,7 @@ Init_glib_matchinfo(void)
|
|
163
163
|
{
|
164
164
|
VALUE RG_TARGET_NAMESPACE;
|
165
165
|
|
166
|
-
RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_MATCH_INFO, "MatchInfo",
|
166
|
+
RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_MATCH_INFO, "MatchInfo", rbg_mGLib());
|
167
167
|
RG_DEF_METHOD(regex, 0);
|
168
168
|
RG_DEF_METHOD(string, 0);
|
169
169
|
RG_DEF_METHOD_P(matches, 0);
|
data/ext/glib2/rbglib_messages.c
CHANGED
@@ -129,7 +129,7 @@ rg_s_log(G_GNUC_UNUSED VALUE self, VALUE domain, VALUE level, VALUE str)
|
|
129
129
|
void
|
130
130
|
Init_glib_messages(void)
|
131
131
|
{
|
132
|
-
VALUE RG_TARGET_NAMESPACE = rb_define_module_under(
|
132
|
+
VALUE RG_TARGET_NAMESPACE = rb_define_module_under(rbg_mGLib(), "Log");
|
133
133
|
|
134
134
|
log_canceled = FALSE;
|
135
135
|
|
data/ext/glib2/rbglib_pollfd.c
CHANGED
data/ext/glib2/rbglib_regex.c
CHANGED
@@ -459,7 +459,7 @@ rg_s_have_reference_p(G_GNUC_UNUSED VALUE self, VALUE rb_replacement)
|
|
459
459
|
void
|
460
460
|
Init_glib_regex(void)
|
461
461
|
{
|
462
|
-
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_REGEX, "Regex",
|
462
|
+
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_REGEX, "Regex", rbg_mGLib());
|
463
463
|
|
464
464
|
RG_DEF_METHOD(initialize, -1);
|
465
465
|
RG_DEF_METHOD(pattern, 0);
|
@@ -479,6 +479,6 @@ Init_glib_regex(void)
|
|
479
479
|
RG_DEF_SMETHOD(check_replacement, 1);
|
480
480
|
RG_DEF_SMETHOD_P(have_reference, 1);
|
481
481
|
|
482
|
-
G_DEF_CLASS(G_TYPE_REGEX_MATCH_FLAGS, "RegexMatchFlags",
|
483
|
-
G_DEF_CLASS(G_TYPE_REGEX_COMPILE_FLAGS, "RegexCompileFlags",
|
482
|
+
G_DEF_CLASS(G_TYPE_REGEX_MATCH_FLAGS, "RegexMatchFlags", rbg_mGLib());
|
483
|
+
G_DEF_CLASS(G_TYPE_REGEX_COMPILE_FLAGS, "RegexCompileFlags", rbg_mGLib());
|
484
484
|
}
|
data/ext/glib2/rbglib_shell.c
CHANGED
@@ -56,7 +56,7 @@ rg_s_unquote(G_GNUC_UNUSED VALUE self, VALUE quoted_string)
|
|
56
56
|
void
|
57
57
|
Init_glib_shell(void)
|
58
58
|
{
|
59
|
-
VALUE RG_TARGET_NAMESPACE = rb_define_module_under(
|
59
|
+
VALUE RG_TARGET_NAMESPACE = rb_define_module_under(rbg_mGLib(), "Shell");
|
60
60
|
|
61
61
|
RG_DEF_SMETHOD(parse, 1);
|
62
62
|
RG_DEF_SMETHOD(quote, 1);
|
@@ -26,7 +26,7 @@
|
|
26
26
|
void
|
27
27
|
Init_glib_shellerror(void)
|
28
28
|
{
|
29
|
-
VALUE RG_TARGET_NAMESPACE = G_DEF_ERROR2(G_SHELL_ERROR, "ShellError",
|
29
|
+
VALUE RG_TARGET_NAMESPACE = G_DEF_ERROR2(G_SHELL_ERROR, "ShellError", rbg_mGLib(), rb_eRuntimeError);
|
30
30
|
|
31
31
|
rb_define_const(RG_TARGET_NAMESPACE, "BAD_QUOTING", INT2FIX(G_SHELL_ERROR_BAD_QUOTING));
|
32
32
|
rb_define_const(RG_TARGET_NAMESPACE, "EMPTY_STRING", INT2FIX(G_SHELL_ERROR_EMPTY_STRING));
|
data/ext/glib2/rbglib_source.c
CHANGED
@@ -177,7 +177,7 @@ gboolean g_source_remove_by_user_data (gpointer user_data);
|
|
177
177
|
void
|
178
178
|
Init_glib_source(void)
|
179
179
|
{
|
180
|
-
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_SOURCE, "Source",
|
180
|
+
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_SOURCE, "Source", rbg_mGLib());
|
181
181
|
|
182
182
|
id_call = rb_intern("call");
|
183
183
|
|
data/ext/glib2/rbglib_spawn.c
CHANGED
@@ -217,7 +217,7 @@ rg_s_close_pid(G_GNUC_UNUSED VALUE self, VALUE pid)
|
|
217
217
|
void
|
218
218
|
Init_glib_spawn(void)
|
219
219
|
{
|
220
|
-
VALUE RG_TARGET_NAMESPACE = rb_define_module_under(
|
220
|
+
VALUE RG_TARGET_NAMESPACE = rb_define_module_under(rbg_mGLib(), "Spawn");
|
221
221
|
|
222
222
|
id_call = rb_intern("call");
|
223
223
|
id_new = rb_intern("new");
|
@@ -28,7 +28,7 @@
|
|
28
28
|
void
|
29
29
|
Init_glib_spawnerror(void)
|
30
30
|
{
|
31
|
-
VALUE RG_TARGET_NAMESPACE = G_DEF_ERROR2(G_SPAWN_ERROR, "SpawnError",
|
31
|
+
VALUE RG_TARGET_NAMESPACE = G_DEF_ERROR2(G_SPAWN_ERROR, "SpawnError", rbg_mGLib(), rb_eIOError);
|
32
32
|
|
33
33
|
rb_define_const(RG_TARGET_NAMESPACE, "FORK", INT2NUM(G_SPAWN_ERROR_FORK));
|
34
34
|
rb_define_const(RG_TARGET_NAMESPACE, "READ", INT2NUM(G_SPAWN_ERROR_READ));
|
data/ext/glib2/rbglib_threads.c
CHANGED
@@ -41,7 +41,7 @@ rg_s_supported_p(G_GNUC_UNUSED VALUE self)
|
|
41
41
|
void
|
42
42
|
Init_glib_threads(void)
|
43
43
|
{
|
44
|
-
RG_TARGET_NAMESPACE = rb_define_class_under(
|
44
|
+
RG_TARGET_NAMESPACE = rb_define_class_under(rbg_mGLib(), "Thread", rb_cObject);
|
45
45
|
|
46
46
|
RG_DEF_SMETHOD(init, 0);
|
47
47
|
RG_DEF_SMETHOD_P(supported, 0);
|
data/ext/glib2/rbglib_timer.c
CHANGED
@@ -116,7 +116,7 @@ rg_reset(VALUE self)
|
|
116
116
|
void
|
117
117
|
Init_glib_timer(void)
|
118
118
|
{
|
119
|
-
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_TIMER, "Timer",
|
119
|
+
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_TIMER, "Timer", rbg_mGLib());
|
120
120
|
|
121
121
|
RG_DEF_METHOD(initialize, 0);
|
122
122
|
RG_DEF_METHOD(start, 0);
|