glib2 3.4.0 → 3.4.5
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/Rakefile +6 -4
- data/ext/glib2/extconf.rb +1 -5
- 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 +13 -3
- data/ext/glib2/rbglib_bookmarkfile.c +4 -4
- data/ext/glib2/rbglib_datetime.c +1 -5
- data/ext/glib2/rbglib_error.c +3 -1
- data/ext/glib2/rbglib_fileutils.c +1 -17
- data/ext/glib2/rbglib_iochannel.c +4 -4
- data/ext/glib2/rbglib_keyfile.c +16 -41
- 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_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 +113 -104
- 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 +58 -68
- 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 -14
- data/test/test-binding.rb +1 -11
- data/test/test-bytes.rb +1 -5
- data/test/test-date-time.rb +1 -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 +3 -7
- data/ext/glib2/glib-enum-types.c +0 -1233
- data/ext/glib2/glib-enum-types.h +0 -154
- data/ext/glib2/rbgobj_valuearray.c +0 -100
- data/test/glib-test-init.rb +0 -21
@@ -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-2020 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
|
@@ -383,9 +383,9 @@ rg_set_groups(VALUE self, VALUE rburi, VALUE rbgroups)
|
|
383
383
|
GBookmarkFile *bookmark = _SELF(self);
|
384
384
|
const gchar *uri = RVAL2CSTR(rburi);
|
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
|
|
@@ -543,4 +543,4 @@ Init_glib_bookmark_file(void)
|
|
543
543
|
RG_DEF_METHOD(remove_application, 2);
|
544
544
|
RG_DEF_METHOD(remove_item, 1);
|
545
545
|
RG_DEF_METHOD(move_item, 2);
|
546
|
-
}
|
546
|
+
}
|
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
|
{
|
@@ -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 Ruby-
|
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
|
{
|
@@ -148,7 +119,7 @@ rg_load_from_dirs(int argc, VALUE *argv, VALUE self)
|
|
148
119
|
GError* error = NULL;
|
149
120
|
gboolean success;
|
150
121
|
const gchar *file;
|
151
|
-
|
122
|
+
gchar **search_dirs;
|
152
123
|
gchar* full_path;
|
153
124
|
GKeyFileFlags flags;
|
154
125
|
|
@@ -162,7 +133,7 @@ rg_load_from_dirs(int argc, VALUE *argv, VALUE self)
|
|
162
133
|
|
163
134
|
if (search_dirs != NULL)
|
164
135
|
success = g_key_file_load_from_dirs(_SELF(self), file,
|
165
|
-
search_dirs,
|
136
|
+
(const gchar **)search_dirs,
|
166
137
|
&full_path, flags, &error);
|
167
138
|
else
|
168
139
|
success = g_key_file_load_from_data_dirs(_SELF(self), file,
|
@@ -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)
|
@@ -516,9 +486,13 @@ rg_set_string_list(VALUE self, VALUE rbgroup_name, VALUE rbkey, VALUE rblist)
|
|
516
486
|
const gchar *group_name = RVAL2CSTR(rbgroup_name);
|
517
487
|
const gchar *key = RVAL2CSTR(rbkey);
|
518
488
|
long n;
|
519
|
-
|
489
|
+
gchar **list = RVAL2STRS(rblist, n);
|
520
490
|
|
521
|
-
g_key_file_set_string_list(key_file,
|
491
|
+
g_key_file_set_string_list(key_file,
|
492
|
+
group_name,
|
493
|
+
key,
|
494
|
+
(const gchar * const *)list,
|
495
|
+
n);
|
522
496
|
|
523
497
|
g_free(list);
|
524
498
|
|
@@ -533,9 +507,14 @@ rg_set_locale_string_list(VALUE self, VALUE rbgroup_name, VALUE rbkey, VALUE rbl
|
|
533
507
|
const gchar *key = RVAL2CSTR(rbkey);
|
534
508
|
const gchar *locale = RVAL2CSTR(rblocale);
|
535
509
|
long n;
|
536
|
-
|
510
|
+
gchar **list = RVAL2STRS(rblist, n);
|
537
511
|
|
538
|
-
g_key_file_set_locale_string_list(key_file,
|
512
|
+
g_key_file_set_locale_string_list(key_file,
|
513
|
+
group_name,
|
514
|
+
key,
|
515
|
+
locale,
|
516
|
+
(const gchar * const *)list,
|
517
|
+
n);
|
539
518
|
|
540
519
|
g_free(list);
|
541
520
|
|
@@ -661,9 +640,7 @@ Init_glib_keyfile(void)
|
|
661
640
|
RG_DEF_METHOD(load_from_file, -1);
|
662
641
|
RG_DEF_METHOD(load_from_data, -1);
|
663
642
|
RG_DEF_METHOD(load_from_data_dirs, -1);
|
664
|
-
#if GLIB_CHECK_VERSION(2, 14, 0)
|
665
643
|
RG_DEF_METHOD(load_from_dirs, -1);
|
666
|
-
#endif
|
667
644
|
RG_DEF_METHOD(to_data, 0);
|
668
645
|
RG_DEF_METHOD(start_group, 0);
|
669
646
|
RG_DEF_METHOD(groups, 0);
|
@@ -702,7 +679,6 @@ Init_glib_keyfile(void)
|
|
702
679
|
G_DEF_CLASS(G_TYPE_KEY_FILE_FLAGS, "Flags", RG_TARGET_NAMESPACE);
|
703
680
|
G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, G_TYPE_KEY_FILE_FLAGS, "G_KEY_FILE_");
|
704
681
|
|
705
|
-
#if GLIB_CHECK_VERSION(2, 14, 0)
|
706
682
|
/* Defines for handling freedesktop.org Desktop files */
|
707
683
|
rb_define_const(RG_TARGET_NAMESPACE, "DESKTOP_GROUP", CSTR2RVAL(G_KEY_FILE_DESKTOP_GROUP));
|
708
684
|
|
@@ -751,5 +727,4 @@ Init_glib_keyfile(void)
|
|
751
727
|
CSTR2RVAL(G_KEY_FILE_DESKTOP_TYPE_LINK));
|
752
728
|
rb_define_const(RG_TARGET_NAMESPACE, "DESKTOP_TYPE_DIRECTORY",
|
753
729
|
CSTR2RVAL(G_KEY_FILE_DESKTOP_TYPE_DIRECTORY));
|
754
|
-
#endif
|
755
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
|
|
data/ext/glib2/rbglib_mainloop.c
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
2
|
/*
|
3
|
-
* Copyright (C) 2011-
|
4
|
-
* Copyright (C) 2005,2006
|
3
|
+
* Copyright (C) 2011-2021 Ruby-GNOME Project Team
|
4
|
+
* Copyright (C) 2005,2006 Masao Mutoh
|
5
5
|
*
|
6
6
|
* This library is free software; you can redistribute it and/or
|
7
7
|
* modify it under the terms of the GNU Lesser General Public
|
@@ -21,21 +21,6 @@
|
|
21
21
|
|
22
22
|
#include "rbgprivate.h"
|
23
23
|
|
24
|
-
/*****************************************/
|
25
|
-
#if !GLIB_CHECK_VERSION(2,30,0)
|
26
|
-
GType
|
27
|
-
g_main_loop_get_type(void)
|
28
|
-
{
|
29
|
-
static GType our_type = 0;
|
30
|
-
if (our_type == 0)
|
31
|
-
our_type = g_boxed_type_register_static ("GMainLoop",
|
32
|
-
(GBoxedCopyFunc)g_main_loop_ref,
|
33
|
-
(GBoxedFreeFunc)g_main_loop_unref);
|
34
|
-
return our_type;
|
35
|
-
}
|
36
|
-
#endif
|
37
|
-
/*****************************************/
|
38
|
-
|
39
24
|
#define RG_TARGET_NAMESPACE cMainLoop
|
40
25
|
#define _SELF(s) ((GMainLoop*)RVAL2BOXED(s, G_TYPE_MAIN_LOOP))
|
41
26
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
* Copyright (C) 2015-
|
2
|
+
* Copyright (C) 2015-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 cMatchInfo
|
23
23
|
#define _SELF(s) ((GMatchInfo*)RVAL2BOXED(s, G_TYPE_MATCH_INFO))
|
24
24
|
|
25
|
-
#if GLIB_CHECK_VERSION(2, 30, 0)
|
26
25
|
static VALUE
|
27
26
|
rg_regex(VALUE self)
|
28
27
|
{
|
@@ -158,12 +157,10 @@ rg_expand_references(VALUE self, VALUE rb_string)
|
|
158
157
|
|
159
158
|
return CSTR2RVAL_FREE(expanded_string);
|
160
159
|
}
|
161
|
-
#endif
|
162
160
|
|
163
161
|
void
|
164
162
|
Init_glib_matchinfo(void)
|
165
163
|
{
|
166
|
-
#if GLIB_CHECK_VERSION(2, 30, 0)
|
167
164
|
VALUE RG_TARGET_NAMESPACE;
|
168
165
|
|
169
166
|
RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_MATCH_INFO, "MatchInfo", mGLib);
|
@@ -179,5 +176,4 @@ Init_glib_matchinfo(void)
|
|
179
176
|
RG_DEF_METHOD(fetch_all, 0);
|
180
177
|
RG_DEF_METHOD(next, 0);
|
181
178
|
RG_DEF_METHOD(expand_references, 1);
|
182
|
-
#endif
|
183
179
|
}
|