glib2 3.1.0-x64-mingw32 → 3.1.1-x64-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +2 -2
- data/ext/glib2/rbglib.c +2 -0
- data/ext/glib2/rbglib.h +1 -1
- data/ext/glib2/rbglib2conversions.h +3 -0
- data/ext/glib2/rbglib_datetime.c +250 -0
- data/ext/glib2/rbglib_timezone.c +82 -0
- data/ext/glib2/rbgprivate.h +2 -0
- data/lib/2.2/glib2.so +0 -0
- data/lib/2.3/glib2.so +0 -0
- data/lib/2.4/glib2.so +0 -0
- data/lib/glib2.rb +15 -7
- data/lib/gnome2/rake/external-package.rb +35 -5
- data/lib/gnome2/rake/source-download-task.rb +25 -5
- data/lib/mkmf-gnome2.rb +1 -6
- data/test/test-date-time.rb +112 -0
- data/test/test-time-zone.rb +31 -0
- data/vendor/local/bin/asn1Coding.exe +0 -0
- data/vendor/local/bin/asn1Decoding.exe +0 -0
- data/vendor/local/bin/asn1Parser.exe +0 -0
- data/vendor/local/bin/envsubst.exe +0 -0
- data/vendor/local/bin/gdbus.exe +0 -0
- data/vendor/local/bin/gettext.exe +0 -0
- data/vendor/local/bin/gio-querymodules.exe +0 -0
- data/vendor/local/bin/gio.exe +0 -0
- data/vendor/local/bin/glib-compile-resources.exe +0 -0
- data/vendor/local/bin/glib-compile-schemas.exe +0 -0
- data/vendor/local/bin/glib-genmarshal.exe +0 -0
- data/vendor/local/bin/gobject-query.exe +0 -0
- data/vendor/local/bin/gresource.exe +0 -0
- data/vendor/local/bin/gsettings.exe +0 -0
- data/vendor/local/bin/gspawn-win64-helper-console.exe +0 -0
- data/vendor/local/bin/gspawn-win64-helper.exe +0 -0
- data/vendor/local/bin/iconv.exe +0 -0
- data/vendor/local/bin/idn.exe +0 -0
- data/vendor/local/bin/libasprintf-0.dll +0 -0
- data/vendor/local/bin/libcharset-1.dll +0 -0
- data/vendor/local/bin/libffi-6.dll +0 -0
- data/vendor/local/bin/libgio-2.0-0.dll +0 -0
- data/vendor/local/bin/libglib-2.0-0.dll +0 -0
- data/vendor/local/bin/libgmodule-2.0-0.dll +0 -0
- data/vendor/local/bin/libgmp-10.dll +0 -0
- data/vendor/local/bin/libgnutls-30.dll +0 -0
- data/vendor/local/bin/libgobject-2.0-0.dll +0 -0
- data/vendor/local/bin/libgthread-2.0-0.dll +0 -0
- data/vendor/local/bin/libhogweed-4-2.dll +0 -0
- data/vendor/local/bin/libiconv-2.dll +0 -0
- data/vendor/local/bin/libidn-11.dll +0 -0
- data/vendor/local/bin/libintl-8.dll +0 -0
- data/vendor/local/bin/libnettle-6-2.dll +0 -0
- data/vendor/local/bin/libp11-kit-0.dll +0 -0
- data/vendor/local/bin/libpcre-1.dll +0 -0
- data/vendor/local/bin/libpcrecpp-0.dll +0 -0
- data/vendor/local/bin/libpcreposix-0.dll +0 -0
- data/vendor/local/bin/libtasn1-6.dll +0 -0
- data/vendor/local/bin/nettle-hash.exe +0 -0
- data/vendor/local/bin/nettle-lfib-stream.exe +0 -0
- data/vendor/local/bin/nettle-pbkdf2.exe +0 -0
- data/vendor/local/bin/ngettext.exe +0 -0
- data/vendor/local/bin/p11-kit.exe +0 -0
- data/vendor/local/bin/pcre-config +1 -1
- data/vendor/local/bin/pcregrep.exe +0 -0
- data/vendor/local/bin/pcretest.exe +0 -0
- data/vendor/local/bin/pkcs1-conv.exe +0 -0
- data/vendor/local/bin/sexp-conv.exe +0 -0
- data/vendor/local/bin/trust.exe +0 -0
- data/vendor/local/include/pcre.h +2 -2
- data/vendor/local/lib/gio/modules/libgiognutls.dll +0 -0
- data/vendor/local/lib/gio/modules/libgiognutls.dll.a +0 -0
- data/vendor/local/lib/libasprintf.dll.a +0 -0
- data/vendor/local/lib/libcharset.dll.a +0 -0
- data/vendor/local/lib/libffi.dll.a +0 -0
- data/vendor/local/lib/libgio-2.0.dll.a +0 -0
- data/vendor/local/lib/libglib-2.0.dll.a +0 -0
- data/vendor/local/lib/libgmodule-2.0.dll.a +0 -0
- data/vendor/local/lib/libgmp.dll.a +0 -0
- data/vendor/local/lib/libgnutls.dll.a +0 -0
- data/vendor/local/lib/libgobject-2.0.dll.a +0 -0
- data/vendor/local/lib/libgthread-2.0.dll.a +0 -0
- data/vendor/local/lib/libhogweed.dll.a +0 -0
- data/vendor/local/lib/libiconv.dll.a +0 -0
- data/vendor/local/lib/libidn.dll.a +0 -0
- data/vendor/local/lib/libintl.dll.a +0 -0
- data/vendor/local/lib/libnettle.dll.a +0 -0
- data/vendor/local/lib/libp11-kit.dll.a +0 -0
- data/vendor/local/lib/libpcre.a +0 -0
- data/vendor/local/lib/libpcre.dll.a +0 -0
- data/vendor/local/lib/libpcre.la +1 -1
- data/vendor/local/lib/libpcrecpp.dll.a +0 -0
- data/vendor/local/lib/libpcreposix.a +0 -0
- data/vendor/local/lib/libpcreposix.dll.a +0 -0
- data/vendor/local/lib/libpcreposix.la +1 -1
- data/vendor/local/lib/libtasn1.dll.a +0 -0
- data/vendor/local/lib/p11-kit/p11-kit-remote.exe +0 -0
- data/vendor/local/lib/pkcs11/p11-kit-trust.dll +0 -0
- data/vendor/local/lib/pkcs11/p11-kit-trust.dll.a +0 -0
- data/vendor/local/lib/pkgconfig/libpcre.pc +1 -1
- data/vendor/local/lib/pkgconfig/libpcrecpp.pc +1 -1
- data/vendor/local/lib/pkgconfig/libpcreposix.pc +1 -1
- data/vendor/local/share/doc/pcre/AUTHORS +3 -3
- data/vendor/local/share/doc/pcre/ChangeLog +140 -1
- data/vendor/local/share/doc/pcre/LICENCE +3 -3
- data/vendor/local/share/doc/pcre/NEWS +15 -0
- data/vendor/local/share/doc/pcre/html/pcreapi.html +4 -5
- data/vendor/local/share/doc/pcre/html/pcrecompat.html +1 -1
- data/vendor/local/share/doc/pcre/html/pcrepattern.html +20 -17
- data/vendor/local/share/doc/pcre/pcre.txt +2024 -2020
- data/vendor/local/share/glib-2.0/codegen/__init__.pyc +0 -0
- data/vendor/local/share/glib-2.0/codegen/__init__.pyo +0 -0
- data/vendor/local/share/glib-2.0/codegen/codegen.pyc +0 -0
- data/vendor/local/share/glib-2.0/codegen/codegen.pyo +0 -0
- data/vendor/local/share/glib-2.0/codegen/codegen_docbook.pyc +0 -0
- data/vendor/local/share/glib-2.0/codegen/codegen_docbook.pyo +0 -0
- data/vendor/local/share/glib-2.0/codegen/codegen_main.pyc +0 -0
- data/vendor/local/share/glib-2.0/codegen/codegen_main.pyo +0 -0
- data/vendor/local/share/glib-2.0/codegen/config.pyc +0 -0
- data/vendor/local/share/glib-2.0/codegen/config.pyo +0 -0
- data/vendor/local/share/glib-2.0/codegen/dbustypes.pyc +0 -0
- data/vendor/local/share/glib-2.0/codegen/dbustypes.pyo +0 -0
- data/vendor/local/share/glib-2.0/codegen/parser.pyc +0 -0
- data/vendor/local/share/glib-2.0/codegen/parser.pyo +0 -0
- data/vendor/local/share/glib-2.0/codegen/utils.pyc +0 -0
- data/vendor/local/share/glib-2.0/codegen/utils.pyo +0 -0
- data/vendor/local/share/license/pcre/AUTHORS +3 -3
- data/vendor/local/share/man/man3/pcreapi.3 +5 -6
- data/vendor/local/share/man/man3/pcrecompat.3 +1 -1
- data/vendor/local/share/man/man3/pcrepattern.3 +20 -17
- metadata +11 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7cb4778a094a98385ad0f1b819107d0d4caf2462
|
4
|
+
data.tar.gz: 2573bd8b04125fb6cae85b5339f16e8cc348c6bf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eeb14acbc32382cdb77f3110309164a31751323b7c62b47d897d8091b2d8be9016eb4a200bd80d2bfc758206b8e4a34298b1bd0ca6458df196d25b0ec2562e43
|
7
|
+
data.tar.gz: a16a68b0c2231d646bca62b676f7e4a1321460ce54195c3defbf03a5c566c0fd5d15230398829a625a09d03e925caf21a5a12a12acc6a3e7eae746c72239aa84
|
data/Rakefile
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# -*- ruby -*-
|
2
2
|
#
|
3
|
-
# Copyright (C) 2011-
|
3
|
+
# Copyright (C) 2011-2017 Ruby-GNOME2 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
|
@@ -73,7 +73,7 @@ package_task = GNOME2::Rake::PackageTask.new do |package|
|
|
73
73
|
:name => "pcre",
|
74
74
|
:download_base_url => "ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre",
|
75
75
|
:label => "PCRE",
|
76
|
-
:version => "8.
|
76
|
+
:version => "8.40",
|
77
77
|
:windows => {
|
78
78
|
:configure_args => [
|
79
79
|
"--enable-unicode-properties",
|
data/ext/glib2/rbglib.c
CHANGED
data/ext/glib2/rbglib.h
CHANGED
@@ -62,4 +62,7 @@
|
|
62
62
|
#define RVAL2GREGEXMATCHOPTIONSFLAGS(o) (RVAL2GFLAGS(o, G_TYPE_REGEX_MATCH_FLAGS))
|
63
63
|
#define RVAL2GREGEXCOMPILEOPTIONSFLAGS(o) (RVAL2GFLAGS(o, G_TYPE_REGEX_COMPILE_FLAGS))
|
64
64
|
#define GMATCHINFO2RVAL(o) (BOXED2RVAL(o, G_TYPE_MATCH_INFO))
|
65
|
+
#define GDATETIME2RVAL(o) (BOXED2RVAL(o, G_TYPE_DATE_TIME))
|
66
|
+
#define GTIMEZONE2RVAL(o) (BOXED2RVAL(o, G_TYPE_TIME_ZONE))
|
67
|
+
#define RVAL2GTIMEZONE(o) ((GTimeZone*)RVAL2BOXED(o, G_TYPE_TIME_ZONE))
|
65
68
|
#endif /* __GLIB2CONVERSIONS_H__ */
|
@@ -0,0 +1,250 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright (C) 2016 Ruby-GNOME2 Project Team
|
3
|
+
*
|
4
|
+
* This library is free software; you can redistribute it and/or
|
5
|
+
* modify it under the terms of the GNU Lesser General Public
|
6
|
+
* License as published by the Free Software Foundation; either
|
7
|
+
* version 2.1 of the License, or (at your option) any later version.
|
8
|
+
*
|
9
|
+
* This library is distributed in the hope that it will be useful,
|
10
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
12
|
+
* Lesser General Public License for more details.
|
13
|
+
*
|
14
|
+
* You should have received a copy of the GNU Lesser General Public
|
15
|
+
* License along with this library; if not, write to the Free Software
|
16
|
+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
17
|
+
* MA 02110-1301 USA
|
18
|
+
*/
|
19
|
+
|
20
|
+
#include "rbgprivate.h"
|
21
|
+
|
22
|
+
#define RG_TARGET_NAMESPACE cDateTime
|
23
|
+
#define _SELF(s) ((GDateTime*)RVAL2BOXED(s, G_TYPE_DATE_TIME))
|
24
|
+
|
25
|
+
static gboolean
|
26
|
+
is_local_timezone(VALUE rb_timezone)
|
27
|
+
{
|
28
|
+
ID id_equal;
|
29
|
+
ID id_local;
|
30
|
+
|
31
|
+
if (NIL_P(rb_timezone)) {
|
32
|
+
return TRUE;
|
33
|
+
}
|
34
|
+
|
35
|
+
CONST_ID(id_equal, "==");
|
36
|
+
CONST_ID(id_local, "local");
|
37
|
+
return RVAL2CBOOL(rb_funcall(rb_timezone, id_equal, 1, ID2SYM(id_local)));
|
38
|
+
}
|
39
|
+
|
40
|
+
static gboolean
|
41
|
+
is_utc_timezone(VALUE rb_timezone)
|
42
|
+
{
|
43
|
+
ID id_equal;
|
44
|
+
ID id_utc;
|
45
|
+
|
46
|
+
CONST_ID(id_equal, "==");
|
47
|
+
CONST_ID(id_utc, "utc");
|
48
|
+
return RVAL2CBOOL(rb_funcall(rb_timezone, id_equal, 1, ID2SYM(id_utc)));
|
49
|
+
}
|
50
|
+
|
51
|
+
static gboolean
|
52
|
+
is_timezone(VALUE rb_timezone)
|
53
|
+
{
|
54
|
+
VALUE rb_cTimeZone;
|
55
|
+
|
56
|
+
rb_cTimeZone = rb_const_get(mGLib, rb_intern("TimeZone"));
|
57
|
+
return RVAL2CBOOL(rb_obj_is_kind_of(rb_timezone, rb_cTimeZone));
|
58
|
+
}
|
59
|
+
|
60
|
+
static VALUE
|
61
|
+
rg_s_now(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
|
62
|
+
{
|
63
|
+
GDateTime *date = NULL;
|
64
|
+
VALUE rb_timezone;
|
65
|
+
|
66
|
+
rb_scan_args(argc, argv, "01", &rb_timezone);
|
67
|
+
|
68
|
+
if (is_local_timezone(rb_timezone)) {
|
69
|
+
date = g_date_time_new_now_local();
|
70
|
+
} else if (is_utc_timezone(rb_timezone)) {
|
71
|
+
date = g_date_time_new_now_utc();
|
72
|
+
} else if (is_timezone(rb_timezone)) {
|
73
|
+
date = g_date_time_new_now(RVAL2GTIMEZONE(rb_timezone));
|
74
|
+
} else {
|
75
|
+
rb_raise(rb_eArgError,
|
76
|
+
"timezone must be nil, :local, :utc or GLib::TimeZone: "
|
77
|
+
"%+" PRIsVALUE,
|
78
|
+
rb_timezone);
|
79
|
+
}
|
80
|
+
|
81
|
+
return GDATETIME2RVAL(date);
|
82
|
+
}
|
83
|
+
|
84
|
+
static VALUE
|
85
|
+
rg_initialize(int argc, VALUE *argv, VALUE self)
|
86
|
+
{
|
87
|
+
/*
|
88
|
+
* Not implemented:
|
89
|
+
* GDateTime * g_date_time_new_from_timeval_local ()
|
90
|
+
* GDateTime * g_date_time_new_from_timeval_utc ()
|
91
|
+
* https://developer.gnome.org/glib/stable/glib-Date-and-Time-Functions.html#GTimeVal
|
92
|
+
* */
|
93
|
+
VALUE rb_options;
|
94
|
+
VALUE rb_unix;
|
95
|
+
VALUE rb_timezone;
|
96
|
+
VALUE rb_year;
|
97
|
+
VALUE rb_month;
|
98
|
+
VALUE rb_day;
|
99
|
+
VALUE rb_hour;
|
100
|
+
VALUE rb_minute;
|
101
|
+
VALUE rb_second;
|
102
|
+
GDateTime *datetime = NULL;
|
103
|
+
|
104
|
+
rb_scan_args(argc, argv, "1", &rb_options);
|
105
|
+
rbg_scan_options(rb_options,
|
106
|
+
"unix", &rb_unix,
|
107
|
+
"timezone", &rb_timezone,
|
108
|
+
"year", &rb_year,
|
109
|
+
"month", &rb_month,
|
110
|
+
"day", &rb_day,
|
111
|
+
"hour", &rb_hour,
|
112
|
+
"minute", &rb_minute,
|
113
|
+
"second", &rb_second,
|
114
|
+
NULL);
|
115
|
+
|
116
|
+
if (!NIL_P(rb_unix)) {
|
117
|
+
gint64 unix_time;
|
118
|
+
|
119
|
+
unix_time = rbglib_num_to_int64(rb_unix);
|
120
|
+
if (is_local_timezone(rb_timezone)) {
|
121
|
+
datetime = g_date_time_new_from_unix_local(unix_time);
|
122
|
+
} else if (is_utc_timezone(rb_timezone)) {
|
123
|
+
datetime = g_date_time_new_from_unix_utc(unix_time);
|
124
|
+
} else {
|
125
|
+
rb_raise(rb_eArgError,
|
126
|
+
":timezone must be nil, :local or :utc: %+" PRIsVALUE,
|
127
|
+
rb_timezone);
|
128
|
+
}
|
129
|
+
} else if (!NIL_P(rb_year) &&
|
130
|
+
!NIL_P(rb_month) &&
|
131
|
+
!NIL_P(rb_hour) &&
|
132
|
+
!NIL_P(rb_minute) &&
|
133
|
+
!NIL_P(rb_second)) {
|
134
|
+
gint year = 0;
|
135
|
+
gint month = 0;
|
136
|
+
gint day = 0;
|
137
|
+
gint hour = 0;
|
138
|
+
gint minute = 0;
|
139
|
+
gdouble second = 0.0;
|
140
|
+
|
141
|
+
year = NUM2INT(rb_year);
|
142
|
+
month = NUM2INT(rb_month);
|
143
|
+
day = NUM2INT(rb_day);
|
144
|
+
hour = NUM2INT(rb_hour);
|
145
|
+
minute = NUM2INT(rb_minute);
|
146
|
+
second = NUM2DBL(rb_second);
|
147
|
+
if (is_local_timezone(rb_timezone)) {
|
148
|
+
datetime = g_date_time_new_local(year,
|
149
|
+
month,
|
150
|
+
day,
|
151
|
+
hour,
|
152
|
+
minute,
|
153
|
+
second);
|
154
|
+
} else if (is_utc_timezone(rb_timezone)) {
|
155
|
+
datetime = g_date_time_new_utc(year,
|
156
|
+
month,
|
157
|
+
day,
|
158
|
+
hour,
|
159
|
+
minute,
|
160
|
+
second);
|
161
|
+
} else if (is_timezone(rb_timezone)) {
|
162
|
+
GTimeZone *timezone = NULL;
|
163
|
+
|
164
|
+
timezone = RVAL2GTIMEZONE(rb_timezone);
|
165
|
+
datetime = g_date_time_new(timezone,
|
166
|
+
year,
|
167
|
+
month,
|
168
|
+
day,
|
169
|
+
hour,
|
170
|
+
minute,
|
171
|
+
second);
|
172
|
+
} else {
|
173
|
+
rb_raise(rb_eArgError,
|
174
|
+
":timezone must be nil, :local, :utc or GLib::TimeZone: "
|
175
|
+
"%+" PRIsVALUE,
|
176
|
+
rb_timezone);
|
177
|
+
}
|
178
|
+
} else {
|
179
|
+
rb_raise(rb_eArgError,
|
180
|
+
":unix or (:year, :month, :day, :hour, :minute and :second) "
|
181
|
+
"must be specified: %+" PRIsVALUE,
|
182
|
+
rb_options);
|
183
|
+
}
|
184
|
+
|
185
|
+
G_INITIALIZE(self, datetime);
|
186
|
+
|
187
|
+
return Qnil;
|
188
|
+
}
|
189
|
+
|
190
|
+
static VALUE
|
191
|
+
rg_year(VALUE self)
|
192
|
+
{
|
193
|
+
return INT2NUM(g_date_time_get_year(_SELF(self)));
|
194
|
+
}
|
195
|
+
|
196
|
+
static VALUE
|
197
|
+
rg_month(VALUE self)
|
198
|
+
{
|
199
|
+
return INT2NUM(g_date_time_get_month(_SELF(self)));
|
200
|
+
}
|
201
|
+
|
202
|
+
static VALUE
|
203
|
+
rg_day_of_month(VALUE self)
|
204
|
+
{
|
205
|
+
return INT2NUM(g_date_time_get_day_of_month(_SELF(self)));
|
206
|
+
}
|
207
|
+
|
208
|
+
static VALUE
|
209
|
+
rg_hour(VALUE self)
|
210
|
+
{
|
211
|
+
return INT2NUM(g_date_time_get_hour(_SELF(self)));
|
212
|
+
}
|
213
|
+
|
214
|
+
static VALUE
|
215
|
+
rg_minute(VALUE self)
|
216
|
+
{
|
217
|
+
return INT2NUM(g_date_time_get_minute(_SELF(self)));
|
218
|
+
}
|
219
|
+
|
220
|
+
static VALUE
|
221
|
+
rg_second(VALUE self)
|
222
|
+
{
|
223
|
+
return DBL2NUM(g_date_time_get_second(_SELF(self)));
|
224
|
+
}
|
225
|
+
|
226
|
+
static VALUE
|
227
|
+
rg_format(VALUE self, VALUE rb_format)
|
228
|
+
{
|
229
|
+
const gchar *format = RVAL2CSTR(rb_format);
|
230
|
+
return CSTR2RVAL(g_date_time_format(_SELF(self), format));
|
231
|
+
}
|
232
|
+
|
233
|
+
void
|
234
|
+
Init_glib_date_time(void)
|
235
|
+
{
|
236
|
+
VALUE RG_TARGET_NAMESPACE;
|
237
|
+
|
238
|
+
RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_DATE_TIME, "DateTime", mGLib);
|
239
|
+
|
240
|
+
RG_DEF_SMETHOD(now, -1);
|
241
|
+
|
242
|
+
RG_DEF_METHOD(initialize, -1);
|
243
|
+
RG_DEF_METHOD(year, 0);
|
244
|
+
RG_DEF_METHOD(month, 0);
|
245
|
+
RG_DEF_METHOD(day_of_month, 0);
|
246
|
+
RG_DEF_METHOD(hour, 0);
|
247
|
+
RG_DEF_METHOD(minute, 0);
|
248
|
+
RG_DEF_METHOD(second, 0);
|
249
|
+
RG_DEF_METHOD(format, 1);
|
250
|
+
}
|
@@ -0,0 +1,82 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright (C) 2016 Ruby-GNOME2 Project Team
|
3
|
+
*
|
4
|
+
* This library is free software; you can redistribute it and/or
|
5
|
+
* modify it under the terms of the GNU Lesser General Public
|
6
|
+
* License as published by the Free Software Foundation; either
|
7
|
+
* version 2.1 of the License, or (at your option) any later version.
|
8
|
+
*
|
9
|
+
* This library is distributed in the hope that it will be useful,
|
10
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
12
|
+
* Lesser General Public License for more details.
|
13
|
+
*
|
14
|
+
* You should have received a copy of the GNU Lesser General Public
|
15
|
+
* License along with this library; if not, write to the Free Software
|
16
|
+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
17
|
+
* MA 02110-1301 USA
|
18
|
+
*/
|
19
|
+
|
20
|
+
#include "rbgprivate.h"
|
21
|
+
|
22
|
+
#define RG_TARGET_NAMESPACE cTimeZone
|
23
|
+
#define _SELF(s) ((GTimeZone*)RVAL2BOXED(s, G_TYPE_TIME_ZONE))
|
24
|
+
|
25
|
+
static VALUE
|
26
|
+
rg_initialize(gint argc, VALUE *argv, VALUE self)
|
27
|
+
{
|
28
|
+
VALUE rb_identifier = Qnil;
|
29
|
+
const gchar *identifier = NULL;
|
30
|
+
GTimeZone *time_zone = NULL;
|
31
|
+
|
32
|
+
rb_scan_args(argc, argv, "01", &rb_identifier);
|
33
|
+
|
34
|
+
if (!NIL_P(rb_identifier))
|
35
|
+
identifier = RVAL2CSTR(rb_identifier);
|
36
|
+
|
37
|
+
time_zone = g_time_zone_new(identifier);
|
38
|
+
G_INITIALIZE(self, time_zone);
|
39
|
+
return Qnil;
|
40
|
+
}
|
41
|
+
|
42
|
+
static VALUE
|
43
|
+
rg_s_local(G_GNUC_UNUSED VALUE self)
|
44
|
+
{
|
45
|
+
GTimeZone *time_zone = NULL;
|
46
|
+
time_zone = g_time_zone_new_local();
|
47
|
+
return GTIMEZONE2RVAL(time_zone);
|
48
|
+
}
|
49
|
+
|
50
|
+
static VALUE
|
51
|
+
rg_s_utc(G_GNUC_UNUSED VALUE self)
|
52
|
+
{
|
53
|
+
GTimeZone *time_zone = NULL;
|
54
|
+
time_zone = g_time_zone_new_utc();
|
55
|
+
return GTIMEZONE2RVAL(time_zone);
|
56
|
+
}
|
57
|
+
|
58
|
+
static VALUE
|
59
|
+
rg_abbreviation(VALUE self, VALUE rb_interval)
|
60
|
+
{
|
61
|
+
gint interval = NUM2INT(rb_interval);
|
62
|
+
return CSTR2RVAL(g_time_zone_get_abbreviation(_SELF(self), interval));
|
63
|
+
}
|
64
|
+
|
65
|
+
static VALUE
|
66
|
+
rg_offset(VALUE self, VALUE rb_interval)
|
67
|
+
{
|
68
|
+
gint interval = NUM2INT(rb_interval);
|
69
|
+
return INT2NUM(g_time_zone_get_offset(_SELF(self), interval));
|
70
|
+
}
|
71
|
+
|
72
|
+
void
|
73
|
+
Init_glib_time_zone(void)
|
74
|
+
{
|
75
|
+
VALUE RG_TARGET_NAMESPACE;
|
76
|
+
RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_TIME_ZONE, "TimeZone", mGLib);
|
77
|
+
RG_DEF_METHOD(initialize, -1);
|
78
|
+
RG_DEF_SMETHOD(local, 0);
|
79
|
+
RG_DEF_SMETHOD(utc, 0);
|
80
|
+
RG_DEF_METHOD(abbreviation, 1);
|
81
|
+
RG_DEF_METHOD(offset, 1);
|
82
|
+
}
|
data/ext/glib2/rbgprivate.h
CHANGED
@@ -150,6 +150,8 @@ G_GNUC_INTERNAL void Init_glib_variant_type(void);
|
|
150
150
|
G_GNUC_INTERNAL void Init_glib_variant(void);
|
151
151
|
G_GNUC_INTERNAL void Init_glib_regex(void);
|
152
152
|
G_GNUC_INTERNAL void Init_glib_matchinfo(void);
|
153
|
+
G_GNUC_INTERNAL void Init_glib_date_time(void);
|
154
|
+
G_GNUC_INTERNAL void Init_glib_time_zone(void);
|
153
155
|
|
154
156
|
G_GNUC_INTERNAL void Init_gobject_convert(void);
|
155
157
|
G_GNUC_INTERNAL void Init_gobject_gtype(void);
|
data/lib/2.2/glib2.so
CHANGED
Binary file
|
data/lib/2.3/glib2.so
CHANGED
Binary file
|
data/lib/2.4/glib2.so
ADDED
Binary file
|
data/lib/glib2.rb
CHANGED
@@ -187,7 +187,7 @@ module GLib
|
|
187
187
|
|
188
188
|
module Log
|
189
189
|
DOMAIN = "Ruby/GLib"
|
190
|
-
LEVELS = {
|
190
|
+
LEVELS = {
|
191
191
|
LEVEL_ERROR => "ERROR",
|
192
192
|
LEVEL_CRITICAL => "CRITICAL",
|
193
193
|
LEVEL_WARNING => "WARNING",
|
@@ -207,15 +207,23 @@ module GLib
|
|
207
207
|
log(DOMAIN, LEVEL_CRITICAL, caller(1)[0] << ": " << str)
|
208
208
|
end
|
209
209
|
def warning(str)
|
210
|
-
log(DOMAIN,
|
210
|
+
log(DOMAIN, LEVEL_WARNING, caller(1)[0] << ": " << str)
|
211
211
|
end
|
212
|
-
|
212
|
+
|
213
213
|
def set_log_domain(domain)
|
214
|
-
level =
|
214
|
+
level =
|
215
|
+
FLAG_RECURSION |
|
216
|
+
FLAG_FATAL |
|
217
|
+
LEVEL_ERROR |
|
218
|
+
LEVEL_CRITICAL |
|
219
|
+
LEVEL_WARNING
|
220
|
+
if $VERBOSE or $DEBUG
|
221
|
+
level |=
|
222
|
+
LEVEL_MESSAGE |
|
223
|
+
LEVEL_INFO
|
224
|
+
end
|
215
225
|
if $DEBUG
|
216
|
-
level
|
217
|
-
elsif $VERBOSE
|
218
|
-
level = 127
|
226
|
+
level |= LEVEL_DEBUG
|
219
227
|
end
|
220
228
|
GLib::Log.set_handler(domain, level)
|
221
229
|
end
|
@@ -44,15 +44,15 @@ module GNOME2
|
|
44
44
|
end
|
45
45
|
|
46
46
|
def compression_method
|
47
|
-
super || "gz"
|
47
|
+
resolve_value(super) || "gz"
|
48
48
|
end
|
49
49
|
|
50
50
|
def base_name
|
51
|
-
super || "#{name}-#{version}"
|
51
|
+
resolve_value(super) || "#{name}-#{version}"
|
52
52
|
end
|
53
53
|
|
54
54
|
def archive_base_name
|
55
|
-
super || "#{base_name}.tar.#{compression_method}"
|
55
|
+
resolve_value(super) || "#{base_name}.tar.#{compression_method}"
|
56
56
|
end
|
57
57
|
|
58
58
|
def archive_url
|
@@ -60,7 +60,7 @@ module GNOME2
|
|
60
60
|
end
|
61
61
|
|
62
62
|
def download_base_url
|
63
|
-
super || download_site_base_url
|
63
|
+
resolve_value(super) || download_site_base_url
|
64
64
|
end
|
65
65
|
|
66
66
|
def patches
|
@@ -76,7 +76,7 @@ module GNOME2
|
|
76
76
|
end
|
77
77
|
|
78
78
|
def base_dir_in_package
|
79
|
-
super || "."
|
79
|
+
resolve_value(super) || "."
|
80
80
|
end
|
81
81
|
|
82
82
|
def windows
|
@@ -109,12 +109,22 @@ module GNOME2
|
|
109
109
|
latest_version_freedesktop_gstreamer
|
110
110
|
when :webkitgtk
|
111
111
|
latest_version_webkitgtk
|
112
|
+
when :icu
|
113
|
+
latest_version_icu
|
112
114
|
else
|
113
115
|
nil
|
114
116
|
end
|
115
117
|
end
|
116
118
|
|
117
119
|
private
|
120
|
+
def resolve_value(value)
|
121
|
+
if value.respond_to?(:call)
|
122
|
+
value.call(self)
|
123
|
+
else
|
124
|
+
value
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
118
128
|
def download_site_base_url
|
119
129
|
case download_site
|
120
130
|
when :gnome
|
@@ -131,6 +141,8 @@ module GNOME2
|
|
131
141
|
base_url = "http://ftp.gnu.org/pub/gnu/#{name}"
|
132
142
|
when :webkitgtk
|
133
143
|
base_url = webkitgtk_base_url
|
144
|
+
when :icu
|
145
|
+
base_url = "#{icu_base_url}/#{version}"
|
134
146
|
else
|
135
147
|
base_url = nil
|
136
148
|
end
|
@@ -153,6 +165,10 @@ module GNOME2
|
|
153
165
|
"https://webkitgtk.org/releases"
|
154
166
|
end
|
155
167
|
|
168
|
+
def icu_base_url
|
169
|
+
"http://download.icu-project.org/files/icu4c"
|
170
|
+
end
|
171
|
+
|
156
172
|
def sort_versions(versions)
|
157
173
|
versions.sort_by do |version|
|
158
174
|
version.split(".").collect(&:to_i)
|
@@ -247,6 +263,20 @@ module GNOME2
|
|
247
263
|
sort_versions(versions).last
|
248
264
|
end
|
249
265
|
|
266
|
+
def latest_version_icu
|
267
|
+
base_url = icu_base_url
|
268
|
+
versions = []
|
269
|
+
open(base_url) do |index|
|
270
|
+
index.read.scan(/<a (.+?)>/) do |content,|
|
271
|
+
case content
|
272
|
+
when /href="(\d+(?:\.\d+)+)\/"/x
|
273
|
+
versions << $1
|
274
|
+
end
|
275
|
+
end
|
276
|
+
end
|
277
|
+
sort_versions(versions).last
|
278
|
+
end
|
279
|
+
|
250
280
|
class WindowsConfiguration < Struct.new(:build,
|
251
281
|
:include_paths,
|
252
282
|
:library_paths,
|