glib2 3.4.3 → 3.4.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +1 -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 +3 -5
- data/ext/glib2/rbglib.c +4 -0
- data/ext/glib2/rbglib.h +12 -2
- data/ext/glib2/rbglib_bookmarkfile.c +1 -1
- data/ext/glib2/rbglib_datetime.c +1 -5
- data/ext/glib2/rbglib_error.c +21 -2
- 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_closure.c +22 -9
- data/ext/glib2/rbgobj_object.c +116 -105
- data/ext/glib2/rbgobj_param.c +2 -8
- data/ext/glib2/rbgobj_paramspecs.c +6 -24
- data/ext/glib2/rbgobj_signal.c +104 -92
- data/ext/glib2/rbgobj_strv.c +2 -2
- data/ext/glib2/rbgobj_type.c +57 -67
- data/ext/glib2/rbgobj_typeinterface.c +38 -2
- data/ext/glib2/rbgobj_value.c +3 -7
- 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 +6 -6
- data/ext/glib2/rbgutil_callback.c +23 -26
- data/lib/glib2.rb +32 -3
- data/lib/glib2/deprecated.rb +22 -1
- data/lib/mkmf-gnome.rb +4 -4
- data/test/glib-test-utils.rb +18 -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 +2 -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-variant.c
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
2
|
/*
|
3
|
-
* Copyright (C) 2015-
|
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
|
@@ -22,7 +22,7 @@
|
|
22
22
|
|
23
23
|
#define RG_TARGET_NAMESPACE cVariant
|
24
24
|
|
25
|
-
#define _SELF(s) (
|
25
|
+
#define _SELF(s) (RTYPEDDATA_DATA(s))
|
26
26
|
|
27
27
|
static VALUE RG_TARGET_NAMESPACE;
|
28
28
|
|
@@ -191,7 +191,6 @@ rg_ruby_to_variant(VALUE rb_value, VALUE rb_variant_type)
|
|
191
191
|
}
|
192
192
|
}
|
193
193
|
return g_variant_new_strv(strings, length);
|
194
|
-
#if GLIB_CHECK_VERSION(2, 30, 0)
|
195
194
|
} else if (g_variant_type_equal(variant_type,
|
196
195
|
G_VARIANT_TYPE_OBJECT_PATH_ARRAY)) {
|
197
196
|
const gchar **paths;
|
@@ -210,7 +209,6 @@ rg_ruby_to_variant(VALUE rb_value, VALUE rb_variant_type)
|
|
210
209
|
}
|
211
210
|
}
|
212
211
|
return g_variant_new_objv(paths, length);
|
213
|
-
#endif
|
214
212
|
} else if (g_variant_type_equal(variant_type, G_VARIANT_TYPE_ARRAY)) {
|
215
213
|
int i;
|
216
214
|
GVariantBuilder builder;
|
@@ -259,7 +257,7 @@ rg_initialize(int argc, VALUE *argv, VALUE self)
|
|
259
257
|
rb_scan_args(argc, argv, "11", &rb_value, &rb_variant_type);
|
260
258
|
variant = rg_ruby_to_variant(rb_value, rb_variant_type);
|
261
259
|
g_variant_ref_sink(variant);
|
262
|
-
|
260
|
+
RTYPEDDATA_DATA(self) = variant;
|
263
261
|
|
264
262
|
return Qnil;
|
265
263
|
}
|
data/ext/glib2/rbglib.c
CHANGED
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-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
|
@@ -33,7 +33,7 @@ G_BEGIN_DECLS
|
|
33
33
|
|
34
34
|
#define RBGLIB_MAJOR_VERSION 3
|
35
35
|
#define RBGLIB_MINOR_VERSION 4
|
36
|
-
#define RBGLIB_MICRO_VERSION
|
36
|
+
#define RBGLIB_MICRO_VERSION 7
|
37
37
|
|
38
38
|
#ifndef RB_ZALLOC
|
39
39
|
# ifdef ZALLOC
|
@@ -139,6 +139,9 @@ G_BEGIN_DECLS
|
|
139
139
|
#define RVAL2GUINT32S(ary, n) rbg_rval2guint32s(&(ary), &(n))
|
140
140
|
#define RVAL2GDOUBLES(ary, n) rbg_rval2gdoubles(&(ary), &(n))
|
141
141
|
|
142
|
+
#define RVAL2POINTER(value) ((gpointer)(value))
|
143
|
+
#define POINTER2RVAL(pointer) ((VALUE)(pointer))
|
144
|
+
|
142
145
|
#define GINTS2RVAL(ary, n) rbg_gints2rval(ary, n)
|
143
146
|
#define GINTS2RVAL_FREE(ary, n) rbg_gints2rval(ary, n)
|
144
147
|
|
@@ -219,6 +222,13 @@ extern VALUE rbg_check_hash_type(VALUE object);
|
|
219
222
|
extern void rbg_scan_options(VALUE options, ...);
|
220
223
|
|
221
224
|
/* rbgerror.h */
|
225
|
+
typedef enum {
|
226
|
+
RBG_RUBY_ERROR_UNKNOWN,
|
227
|
+
} RBGRubyError;
|
228
|
+
|
229
|
+
#define RBG_RUBY_ERROR rbgerr_ruby_error_quark()
|
230
|
+
extern GQuark rbgerr_ruby_error_quark(void);
|
231
|
+
|
222
232
|
extern VALUE rbgerr_gerror2exception(GError *error);
|
223
233
|
extern VALUE rbgerr_define_gerror(GQuark domain, const gchar* name, VALUE module, VALUE parent, GType gtype);
|
224
234
|
|
@@ -385,7 +385,7 @@ rg_set_groups(VALUE self, VALUE rburi, VALUE rbgroups)
|
|
385
385
|
long n;
|
386
386
|
gchar **groups = RVAL2STRS(rbgroups, n);
|
387
387
|
|
388
|
-
g_bookmark_file_set_groups(bookmark, uri, groups, n);
|
388
|
+
g_bookmark_file_set_groups(bookmark, uri, (const gchar **)groups, n);
|
389
389
|
|
390
390
|
g_free(groups);
|
391
391
|
|
data/ext/glib2/rbglib_datetime.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
|
@@ -69,10 +69,8 @@ rg_s_now(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
|
|
69
69
|
date = g_date_time_new_now_local();
|
70
70
|
} else if (is_utc_timezone(rb_timezone)) {
|
71
71
|
date = g_date_time_new_now_utc();
|
72
|
-
#if GLIB_CHECK_VERSION(2, 34, 0)
|
73
72
|
} else if (is_timezone(rb_timezone)) {
|
74
73
|
date = g_date_time_new_now(RVAL2GTIMEZONE(rb_timezone));
|
75
|
-
#endif
|
76
74
|
} else {
|
77
75
|
rb_raise(rb_eArgError,
|
78
76
|
"timezone must be nil, :local, :utc or GLib::TimeZone: "
|
@@ -160,7 +158,6 @@ rg_initialize(int argc, VALUE *argv, VALUE self)
|
|
160
158
|
hour,
|
161
159
|
minute,
|
162
160
|
second);
|
163
|
-
#if GLIB_CHECK_VERSION(2, 34, 0)
|
164
161
|
} else if (is_timezone(rb_timezone)) {
|
165
162
|
GTimeZone *timezone = NULL;
|
166
163
|
|
@@ -172,7 +169,6 @@ rg_initialize(int argc, VALUE *argv, VALUE self)
|
|
172
169
|
hour,
|
173
170
|
minute,
|
174
171
|
second);
|
175
|
-
#endif
|
176
172
|
} else {
|
177
173
|
rb_raise(rb_eArgError,
|
178
174
|
":timezone must be nil, :local, :utc or GLib::TimeZone: "
|
data/ext/glib2/rbglib_error.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 Masao Mutoh
|
5
5
|
*
|
6
6
|
* This library is free software; you can redistribute it and/or
|
@@ -29,6 +29,8 @@ static VALUE gerror_table;
|
|
29
29
|
static VALUE generic_error;
|
30
30
|
static VALUE error_info;
|
31
31
|
|
32
|
+
G_DEFINE_QUARK(ruby-error-quark, rbgerr_ruby_error)
|
33
|
+
|
32
34
|
VALUE
|
33
35
|
rbgerr_gerror2exception(GError *error)
|
34
36
|
{
|
@@ -107,9 +109,13 @@ rbgerr_define_gerror(GQuark domain, const gchar *name, VALUE module, VALUE paren
|
|
107
109
|
{
|
108
110
|
VALUE error_class;
|
109
111
|
VALUE code_classes;
|
112
|
+
VALUE rb_domain = rb_str_new_cstr(g_quark_to_string(domain));
|
113
|
+
rbgutil_string_set_utf8_encoding(rb_domain);
|
110
114
|
|
111
115
|
error_class = rb_define_class_under(module, name, parent);
|
112
|
-
|
116
|
+
rb_ivar_set(error_class, id_code, Qnil);
|
117
|
+
rb_ivar_set(error_class, id_domain, rb_domain);
|
118
|
+
rb_prepend_module(error_class, error_info);
|
113
119
|
|
114
120
|
rb_hash_aset(gerror_table, UINT2NUM(domain), error_class);
|
115
121
|
|
@@ -140,6 +146,8 @@ rbgerr_define_gerror(GQuark domain, const gchar *name, VALUE module, VALUE paren
|
|
140
146
|
code_class_name,
|
141
147
|
error_class);
|
142
148
|
g_free(code_class_name);
|
149
|
+
rb_ivar_set(code_class, id_code, INT2NUM(entry->value));
|
150
|
+
rb_ivar_set(code_class, id_domain, rb_domain);
|
143
151
|
rb_hash_aset(code_classes, INT2NUM(entry->value), code_class);
|
144
152
|
}
|
145
153
|
|
@@ -149,6 +157,15 @@ rbgerr_define_gerror(GQuark domain, const gchar *name, VALUE module, VALUE paren
|
|
149
157
|
return error_class;
|
150
158
|
}
|
151
159
|
|
160
|
+
static VALUE
|
161
|
+
rg_initialize(int argc, VALUE *argv, VALUE self)
|
162
|
+
{
|
163
|
+
VALUE klass = rb_obj_class(self);
|
164
|
+
rb_ivar_set(self, id_code, rb_ivar_get(klass, id_code));
|
165
|
+
rb_ivar_set(self, id_domain, rb_ivar_get(klass, id_domain));
|
166
|
+
return rb_call_super(argc, argv);
|
167
|
+
}
|
168
|
+
|
152
169
|
static VALUE
|
153
170
|
rbg_error_to_ruby(const GValue *from)
|
154
171
|
{
|
@@ -166,9 +183,11 @@ Init_glib_error(void)
|
|
166
183
|
gerror_table = rb_hash_new();
|
167
184
|
rb_global_variable(&gerror_table);
|
168
185
|
|
186
|
+
#define RG_TARGET_NAMESPACE error_info
|
169
187
|
error_info = rb_define_module_under(mGLib, "ErrorInfo");
|
170
188
|
rb_define_attr(error_info, "code", TRUE, FALSE);
|
171
189
|
rb_define_attr(error_info, "domain", TRUE, FALSE);
|
190
|
+
RG_DEF_METHOD(initialize, -1);
|
172
191
|
|
173
192
|
generic_error = rb_define_class_under(mGLib, "Error", rb_eRuntimeError);
|
174
193
|
rb_include_module(generic_error, error_info);
|
@@ -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
|
*
|
6
6
|
* This library is free software; you can redistribute it and/or
|
@@ -49,15 +49,6 @@ void g_dir_rewind (GDir *dir);
|
|
49
49
|
void g_dir_close (GDir *dir);
|
50
50
|
*/
|
51
51
|
|
52
|
-
#if GLIB_CHECK_VERSION(2, 16, 0)
|
53
|
-
static VALUE
|
54
|
-
rbglib_m_format_size_for_display(G_GNUC_UNUSED VALUE self, VALUE size)
|
55
|
-
{
|
56
|
-
return CSTR2RVAL_FREE(g_format_size_for_display(NUM2OFFT(size)));
|
57
|
-
}
|
58
|
-
#endif
|
59
|
-
|
60
|
-
#if GLIB_CHECK_VERSION(2, 30, 0)
|
61
52
|
static VALUE
|
62
53
|
rbglib_m_format_size(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
|
63
54
|
{
|
@@ -76,7 +67,6 @@ rbglib_m_format_size(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
|
|
76
67
|
RVAL2GFORMATSIZEFLAGS(rb_flags)));
|
77
68
|
}
|
78
69
|
}
|
79
|
-
#endif
|
80
70
|
|
81
71
|
void
|
82
72
|
Init_glib_fileutils(void)
|
@@ -108,12 +98,6 @@ Init_glib_fileutils(void)
|
|
108
98
|
rb_define_const(RG_TARGET_NAMESPACE, "PERM", INT2NUM(G_FILE_ERROR_PERM));
|
109
99
|
rb_define_const(RG_TARGET_NAMESPACE, "FAILED", INT2NUM(G_FILE_ERROR_FAILED));
|
110
100
|
|
111
|
-
#if GLIB_CHECK_VERSION(2, 16, 0)
|
112
|
-
rbg_define_singleton_method(mGLib, "format_size_for_display",
|
113
|
-
rbglib_m_format_size_for_display, 1);
|
114
|
-
#endif
|
115
|
-
#if GLIB_CHECK_VERSION(2, 30, 0)
|
116
101
|
rbg_define_singleton_method(mGLib, "format_size",
|
117
102
|
rbglib_m_format_size, -1);
|
118
|
-
#endif
|
119
103
|
}
|
@@ -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
|
@@ -84,7 +84,7 @@ rg_initialize(gint argc, VALUE *argv, VALUE self)
|
|
84
84
|
}
|
85
85
|
|
86
86
|
static VALUE
|
87
|
-
|
87
|
+
ioc_shutdown(VALUE self)
|
88
88
|
{
|
89
89
|
GError* err = NULL;
|
90
90
|
GIOStatus status = g_io_channel_shutdown(_SELF(self), TRUE, &err);
|
@@ -114,7 +114,7 @@ rg_s_open(gint argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
|
|
114
114
|
#endif
|
115
115
|
} else {
|
116
116
|
GError* err = NULL;
|
117
|
-
io = g_io_channel_new_file(RVAL2CSTR(arg1),
|
117
|
+
io = g_io_channel_new_file(RVAL2CSTR(arg1),
|
118
118
|
NIL_P(arg2) ? "r" : RVAL2CSTR(arg2), &err);
|
119
119
|
|
120
120
|
if (err != NULL) RAISE_GERROR(err);
|
@@ -123,7 +123,7 @@ rg_s_open(gint argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
|
|
123
123
|
rio = BOXED2RVAL(io, G_TYPE_IO_CHANNEL);
|
124
124
|
|
125
125
|
if (rb_block_given_p()) {
|
126
|
-
return rb_ensure(rb_yield, rio,
|
126
|
+
return rb_ensure(rb_yield, rio, ioc_shutdown, rio);
|
127
127
|
}
|
128
128
|
return rio;
|
129
129
|
}
|
data/ext/glib2/rbglib_keyfile.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 Masao Mutoh
|
5
5
|
*
|
6
6
|
* This library is free software; you can redistribute it and/or
|
@@ -21,34 +21,6 @@
|
|
21
21
|
|
22
22
|
#include "rbgprivate.h"
|
23
23
|
|
24
|
-
#if !GLIB_CHECK_VERSION(2,31,2)
|
25
|
-
/************************************************/
|
26
|
-
static GKeyFile*
|
27
|
-
keyfile_copy(const GKeyFile* keyfile)
|
28
|
-
{
|
29
|
-
// GKeyFile* new_keyfile;
|
30
|
-
g_return_val_if_fail (keyfile != NULL, NULL);
|
31
|
-
/*
|
32
|
-
new_keyfile = g_key_file_new();
|
33
|
-
*new_keyfile = (GKeyFile*)*keyfile;
|
34
|
-
return new_keyfile;
|
35
|
-
*/
|
36
|
-
return (GKeyFile*)keyfile;
|
37
|
-
}
|
38
|
-
|
39
|
-
GType
|
40
|
-
g_key_file_get_type(void)
|
41
|
-
{
|
42
|
-
static GType our_type = 0;
|
43
|
-
if (our_type == 0)
|
44
|
-
our_type = g_boxed_type_register_static("GKeyFile",
|
45
|
-
(GBoxedCopyFunc)keyfile_copy,
|
46
|
-
(GBoxedFreeFunc)g_key_file_free);
|
47
|
-
return our_type;
|
48
|
-
}
|
49
|
-
/************************************************/
|
50
|
-
#endif
|
51
|
-
|
52
24
|
#define RG_TARGET_NAMESPACE cKeyFile
|
53
25
|
#define _SELF(self) ((GKeyFile*)(RVAL2BOXED(self, G_TYPE_KEY_FILE)))
|
54
26
|
|
@@ -140,7 +112,6 @@ rg_load_from_data_dirs(int argc, VALUE *argv, VALUE self)
|
|
140
112
|
return full_path ? CSTR2RVAL(full_path) : Qnil;
|
141
113
|
}
|
142
114
|
|
143
|
-
#if GLIB_CHECK_VERSION(2, 14, 0)
|
144
115
|
static VALUE
|
145
116
|
rg_load_from_dirs(int argc, VALUE *argv, VALUE self)
|
146
117
|
{
|
@@ -175,7 +146,6 @@ rg_load_from_dirs(int argc, VALUE *argv, VALUE self)
|
|
175
146
|
|
176
147
|
return CSTR2RVAL(full_path);
|
177
148
|
}
|
178
|
-
#endif
|
179
149
|
|
180
150
|
static VALUE
|
181
151
|
rg_to_data(VALUE self)
|
@@ -670,9 +640,7 @@ Init_glib_keyfile(void)
|
|
670
640
|
RG_DEF_METHOD(load_from_file, -1);
|
671
641
|
RG_DEF_METHOD(load_from_data, -1);
|
672
642
|
RG_DEF_METHOD(load_from_data_dirs, -1);
|
673
|
-
#if GLIB_CHECK_VERSION(2, 14, 0)
|
674
643
|
RG_DEF_METHOD(load_from_dirs, -1);
|
675
|
-
#endif
|
676
644
|
RG_DEF_METHOD(to_data, 0);
|
677
645
|
RG_DEF_METHOD(start_group, 0);
|
678
646
|
RG_DEF_METHOD(groups, 0);
|
@@ -711,7 +679,6 @@ Init_glib_keyfile(void)
|
|
711
679
|
G_DEF_CLASS(G_TYPE_KEY_FILE_FLAGS, "Flags", RG_TARGET_NAMESPACE);
|
712
680
|
G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, G_TYPE_KEY_FILE_FLAGS, "G_KEY_FILE_");
|
713
681
|
|
714
|
-
#if GLIB_CHECK_VERSION(2, 14, 0)
|
715
682
|
/* Defines for handling freedesktop.org Desktop files */
|
716
683
|
rb_define_const(RG_TARGET_NAMESPACE, "DESKTOP_GROUP", CSTR2RVAL(G_KEY_FILE_DESKTOP_GROUP));
|
717
684
|
|
@@ -760,5 +727,4 @@ Init_glib_keyfile(void)
|
|
760
727
|
CSTR2RVAL(G_KEY_FILE_DESKTOP_TYPE_LINK));
|
761
728
|
rb_define_const(RG_TARGET_NAMESPACE, "DESKTOP_TYPE_DIRECTORY",
|
762
729
|
CSTR2RVAL(G_KEY_FILE_DESKTOP_TYPE_DIRECTORY));
|
763
|
-
#endif
|
764
730
|
}
|
@@ -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
|
@@ -25,7 +25,7 @@
|
|
25
25
|
# include <ruby/thread.h>
|
26
26
|
#endif
|
27
27
|
|
28
|
-
|
28
|
+
GPrivate rg_polling_key = G_PRIVATE_INIT(NULL);
|
29
29
|
|
30
30
|
/*
|
31
31
|
static ID id_poll_func;
|
@@ -87,7 +87,7 @@ rg_poll(GPollFD *ufds, guint nfsd, gint timeout)
|
|
87
87
|
info.timeout = timeout;
|
88
88
|
info.result = 0;
|
89
89
|
|
90
|
-
|
90
|
+
g_private_set(&rg_polling_key, GINT_TO_POINTER(TRUE));
|
91
91
|
if (g_thread_self() == main_thread) {
|
92
92
|
#ifdef HAVE_RB_THREAD_CALL_WITHOUT_GVL
|
93
93
|
rb_thread_call_without_gvl(rg_poll_in_blocking, &info,
|
@@ -99,7 +99,7 @@ rg_poll(GPollFD *ufds, guint nfsd, gint timeout)
|
|
99
99
|
} else {
|
100
100
|
rg_poll_in_blocking_raw(&info);
|
101
101
|
}
|
102
|
-
|
102
|
+
g_private_set(&rg_polling_key, GINT_TO_POINTER(FALSE));
|
103
103
|
|
104
104
|
return info.result;
|
105
105
|
}
|
@@ -148,21 +148,6 @@ source_destroy_notify(gpointer data)
|
|
148
148
|
xfree(info);
|
149
149
|
}
|
150
150
|
|
151
|
-
/*****************************************/
|
152
|
-
#if !GLIB_CHECK_VERSION(2,30,0)
|
153
|
-
GType
|
154
|
-
g_main_context_get_type(void)
|
155
|
-
{
|
156
|
-
static GType our_type = 0;
|
157
|
-
if (our_type == 0)
|
158
|
-
our_type = g_boxed_type_register_static ("GMainContext",
|
159
|
-
(GBoxedCopyFunc)g_main_context_ref,
|
160
|
-
(GBoxedFreeFunc)g_main_context_unref);
|
161
|
-
return our_type;
|
162
|
-
}
|
163
|
-
#endif
|
164
|
-
/*****************************************/
|
165
|
-
|
166
151
|
#define RG_TARGET_NAMESPACE cMainContext
|
167
152
|
#define _SELF(s) ((GMainContext*)RVAL2BOXED(s, G_TYPE_MAIN_CONTEXT))
|
168
153
|
|
@@ -386,26 +371,23 @@ rg_remove_poll(VALUE self, VALUE fd)
|
|
386
371
|
return self;
|
387
372
|
}
|
388
373
|
|
389
|
-
#ifdef HAVE_G_MAIN_DEPTH
|
390
374
|
static VALUE
|
391
375
|
rg_s_depth(G_GNUC_UNUSED VALUE self)
|
392
376
|
{
|
393
377
|
return INT2NUM(g_main_depth());
|
394
378
|
}
|
395
|
-
#endif
|
396
379
|
|
397
380
|
static VALUE
|
398
381
|
timeout_source_new(G_GNUC_UNUSED VALUE self, VALUE interval)
|
399
382
|
{
|
400
383
|
return BOXED2RVAL(g_timeout_source_new(NUM2UINT(interval)), G_TYPE_SOURCE);
|
401
384
|
}
|
402
|
-
|
385
|
+
|
403
386
|
static VALUE
|
404
387
|
timeout_source_new_seconds(G_GNUC_UNUSED VALUE self, VALUE interval)
|
405
388
|
{
|
406
389
|
return BOXED2RVAL(g_timeout_source_new_seconds(NUM2UINT(interval)), G_TYPE_SOURCE);
|
407
390
|
}
|
408
|
-
#endif
|
409
391
|
|
410
392
|
static VALUE
|
411
393
|
timeout_add(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
|
@@ -431,7 +413,6 @@ timeout_add(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
|
|
431
413
|
return rb_id;
|
432
414
|
}
|
433
415
|
|
434
|
-
#if GLIB_CHECK_VERSION(2,14,0)
|
435
416
|
static VALUE
|
436
417
|
timeout_add_seconds(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
|
437
418
|
{
|
@@ -455,7 +436,6 @@ timeout_add_seconds(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
|
|
455
436
|
rbgobj_add_relative(mGLibSource, func);
|
456
437
|
return rb_id;
|
457
438
|
}
|
458
|
-
#endif
|
459
439
|
|
460
440
|
static VALUE
|
461
441
|
idle_source_new(G_GNUC_UNUSED VALUE self)
|
@@ -526,7 +506,7 @@ Init_glib_main_context(void)
|
|
526
506
|
|
527
507
|
id_call = rb_intern("call");
|
528
508
|
|
529
|
-
|
509
|
+
g_private_set(&rg_polling_key, GINT_TO_POINTER(FALSE));
|
530
510
|
|
531
511
|
main_thread = g_thread_self();
|
532
512
|
|
@@ -559,17 +539,11 @@ Init_glib_main_context(void)
|
|
559
539
|
*/
|
560
540
|
RG_DEF_METHOD(add_poll, 2);
|
561
541
|
RG_DEF_METHOD(remove_poll, 1);
|
562
|
-
#ifdef HAVE_G_MAIN_DEPTH
|
563
542
|
RG_DEF_SMETHOD(depth, 0);
|
564
|
-
#endif
|
565
543
|
rbg_define_singleton_method(timeout, "source_new", timeout_source_new, 1);
|
566
|
-
#if GLIB_CHECK_VERSION(2,14,0)
|
567
544
|
rbg_define_singleton_method(timeout, "source_new_seconds", timeout_source_new_seconds, 1);
|
568
|
-
#endif
|
569
545
|
rbg_define_singleton_method(timeout, "add", timeout_add, -1);
|
570
|
-
#if GLIB_CHECK_VERSION(2,14,0)
|
571
546
|
rbg_define_singleton_method(timeout, "add_seconds", timeout_add_seconds, -1);
|
572
|
-
#endif
|
573
547
|
rbg_define_singleton_method(idle, "source_new", idle_source_new, 0);
|
574
548
|
rbg_define_singleton_method(idle, "add", idle_add, -1);
|
575
549
|
|