glib2 1.0.0-x86-mingw32 → 1.0.1-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +107 -0
- data/ext/glib2/glib2.def +12 -1
- data/ext/glib2/rbglib.c +258 -69
- data/ext/glib2/rbglib.h +25 -5
- data/ext/glib2/rbglib_bookmarkfile.c +507 -519
- data/ext/glib2/rbglib_completion.c +4 -4
- data/ext/glib2/rbglib_error.c +1 -1
- data/ext/glib2/rbglib_i18n.c +1 -10
- data/ext/glib2/rbglib_iochannel.c +5 -1
- data/ext/glib2/rbglib_keyfile.c +103 -114
- data/ext/glib2/rbglib_maincontext.c +45 -13
- data/ext/glib2/rbglib_messages.c +2 -1
- data/ext/glib2/rbglib_shell.c +11 -19
- data/ext/glib2/rbglib_spawn.c +28 -110
- data/ext/glib2/rbglib_utils.c +5 -20
- data/ext/glib2/rbgobj_closure.c +3 -2
- data/ext/glib2/rbgobj_enums.c +37 -17
- data/ext/glib2/rbgobj_object.c +3 -3
- data/ext/glib2/rbgobj_param.c +2 -1
- data/ext/glib2/rbgobj_signal.c +9 -10
- data/ext/glib2/rbgobj_strv.c +9 -32
- data/ext/glib2/rbgobj_type.c +7 -6
- data/ext/glib2/rbgobj_typeinterface.c +142 -142
- data/ext/glib2/rbgobj_value.c +2 -1
- data/ext/glib2/rbgobj_valuearray.c +20 -15
- data/ext/glib2/rbgobj_valuetypes.c +3 -2
- data/ext/glib2/rbgobject.c +12 -12
- data/ext/glib2/rbgprivate.h +4 -0
- data/ext/glib2/rbgutil.h +14 -0
- data/ext/glib2/rbgutil_callback.c +22 -14
- data/lib/1.8/glib2.so +0 -0
- data/lib/1.9/glib2.so +0 -0
- data/lib/glib2.rb +30 -20
- data/lib/mkmf-gnome2.rb +6 -2
- data/test/glib-test-init.rb +1 -0
- metadata +4 -4
@@ -537,28 +537,60 @@ mc_prepare(VALUE self)
|
|
537
537
|
return rb_assoc_new(CBOOL2RVAL(ret), INT2NUM(priority));
|
538
538
|
}
|
539
539
|
|
540
|
+
struct mc_query_body_args {
|
541
|
+
GPollFD *fds;
|
542
|
+
gint timeout_;
|
543
|
+
gint ret;
|
544
|
+
};
|
545
|
+
|
546
|
+
static VALUE
|
547
|
+
mc_query_body(VALUE value)
|
548
|
+
{
|
549
|
+
struct mc_query_body_args *args = (struct mc_query_body_args *)value;
|
550
|
+
gint i;
|
551
|
+
VALUE ary = rb_ary_new();
|
552
|
+
|
553
|
+
for (i = 0; i < args->ret; i++)
|
554
|
+
rb_ary_push(ary, BOXED2RVAL(&args->fds[i], G_TYPE_POLL_FD));
|
555
|
+
|
556
|
+
return rb_assoc_new(INT2NUM(args->timeout_), ary);
|
557
|
+
}
|
558
|
+
|
559
|
+
static VALUE
|
560
|
+
mc_query_ensure(VALUE value)
|
561
|
+
{
|
562
|
+
g_free((GPollFD *)value);
|
563
|
+
|
564
|
+
return Qnil;
|
565
|
+
}
|
566
|
+
|
540
567
|
static VALUE
|
541
568
|
mc_query(VALUE self, VALUE max_priority)
|
542
569
|
{
|
543
|
-
gint
|
544
|
-
|
570
|
+
gint timeout_;
|
571
|
+
struct mc_query_body_args args;
|
545
572
|
|
546
|
-
GPollFD*
|
547
|
-
gint ret = g_main_context_query(_SELF(self),
|
548
|
-
|
573
|
+
GPollFD *fds = g_new(GPollFD, 100);
|
574
|
+
gint ret = g_main_context_query(_SELF(self),
|
575
|
+
NUM2INT(max_priority),
|
576
|
+
&timeout_,
|
577
|
+
fds,
|
578
|
+
100);
|
549
579
|
if (ret > 100) {
|
550
580
|
g_free(fds);
|
551
581
|
fds = g_new(GPollFD, ret);
|
552
|
-
g_main_context_query(_SELF(self),
|
553
|
-
|
582
|
+
g_main_context_query(_SELF(self),
|
583
|
+
NUM2INT(max_priority),
|
584
|
+
&timeout_,
|
585
|
+
fds,
|
586
|
+
ret);
|
554
587
|
}
|
555
588
|
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
return rb_assoc_new(INT2NUM(timeout_), ary);
|
589
|
+
args.fds = fds;
|
590
|
+
args.timeout_ = timeout_;
|
591
|
+
args.ret = ret;
|
592
|
+
return rb_ensure(mc_query_body, (VALUE)&args,
|
593
|
+
mc_query_ensure, (VALUE)fds);
|
562
594
|
}
|
563
595
|
|
564
596
|
/* How can I implement this?
|
data/ext/glib2/rbglib_messages.c
CHANGED
@@ -29,7 +29,8 @@ static VALUE rbglib_log_handler_procs;
|
|
29
29
|
static ID id_call;
|
30
30
|
static gboolean log_canceled;
|
31
31
|
|
32
|
-
static gchar*
|
32
|
+
static const gchar *
|
33
|
+
logmessage(GLogLevelFlags level)
|
33
34
|
{
|
34
35
|
if (level & G_LOG_LEVEL_ERROR){
|
35
36
|
return "ERROR";
|
data/ext/glib2/rbglib_shell.c
CHANGED
@@ -14,37 +14,29 @@
|
|
14
14
|
static VALUE
|
15
15
|
shell_parse(VALUE self, VALUE command_line)
|
16
16
|
{
|
17
|
-
gint argc
|
18
|
-
gchar**
|
19
|
-
GError*
|
20
|
-
VALUE ary;
|
17
|
+
gint argc;
|
18
|
+
gchar **argv;
|
19
|
+
GError *error = NULL;
|
21
20
|
|
22
|
-
|
23
|
-
|
21
|
+
if (!g_shell_parse_argv(RVAL2CSTR(command_line), &argc, &argv, &error))
|
22
|
+
RAISE_GERROR(error);
|
24
23
|
|
25
|
-
|
26
|
-
|
27
|
-
ary = rb_ary_new();
|
28
|
-
for (i = 0; i < argc; i++) {
|
29
|
-
rb_ary_push(ary, CSTR2RVAL(argv[i]));
|
30
|
-
}
|
31
|
-
g_strfreev (argv);
|
32
|
-
return ary;
|
24
|
+
return STRV2RVAL_FREE(argv);
|
33
25
|
}
|
34
26
|
|
35
27
|
static VALUE
|
36
28
|
shell_quote(VALUE self, VALUE unquoted_string)
|
37
29
|
{
|
38
|
-
return CSTR2RVAL_FREE(g_shell_quote(
|
30
|
+
return CSTR2RVAL_FREE(g_shell_quote(RVAL2CSTR(unquoted_string)));
|
39
31
|
}
|
40
32
|
|
41
33
|
static VALUE
|
42
34
|
shell_unquote(VALUE self, VALUE quoted_string)
|
43
35
|
{
|
44
|
-
GError*
|
45
|
-
gchar*
|
46
|
-
|
47
|
-
|
36
|
+
GError *error = NULL;
|
37
|
+
gchar *str = g_shell_unquote(RVAL2CSTR(quoted_string), &error);
|
38
|
+
if (str == NULL)
|
39
|
+
RAISE_GERROR(error);
|
48
40
|
|
49
41
|
return CSTR2RVAL_FREE(str);
|
50
42
|
}
|
data/ext/glib2/rbglib_spawn.c
CHANGED
@@ -31,9 +31,8 @@ rbglib_m_spawn_async_with_pipes(VALUE self, VALUE working_directory, VALUE argv,
|
|
31
31
|
gboolean ret;
|
32
32
|
GPid child_pid;
|
33
33
|
VALUE func = Qnil;
|
34
|
-
|
35
|
-
gchar
|
36
|
-
gchar** genvp = (gchar**)NULL;
|
34
|
+
gchar **gargv;
|
35
|
+
gchar **genvp;
|
37
36
|
gint standard_input, standard_output, standard_error;
|
38
37
|
|
39
38
|
if (rb_block_given_p()) {
|
@@ -41,36 +40,8 @@ rbglib_m_spawn_async_with_pipes(VALUE self, VALUE working_directory, VALUE argv,
|
|
41
40
|
G_RELATIVE(self, func);
|
42
41
|
}
|
43
42
|
|
44
|
-
|
45
|
-
|
46
|
-
gargc = RARRAY_LEN(argv);
|
47
|
-
gargv = ALLOCA_N(gchar*, gargc + 1);
|
48
|
-
for (i = 0; i < gargc; i++) {
|
49
|
-
if (TYPE(RARRAY_PTR(argv)[i]) == T_STRING) {
|
50
|
-
gargv[i] = RVAL2CSTR(RARRAY_PTR(argv)[i]);
|
51
|
-
}
|
52
|
-
else {
|
53
|
-
gargv[i] = "";
|
54
|
-
}
|
55
|
-
}
|
56
|
-
gargv[gargc] = (gchar*)NULL;
|
57
|
-
}
|
58
|
-
|
59
|
-
if (! NIL_P(envp)){
|
60
|
-
Check_Type(envp, T_ARRAY);
|
61
|
-
genc = RARRAY_LEN(envp);
|
62
|
-
genvp = ALLOCA_N(gchar*, genc + 1);
|
63
|
-
for (i = 0; i < genc; i++) {
|
64
|
-
if (TYPE(RARRAY_PTR(envp)[i]) == T_STRING) {
|
65
|
-
genvp[i] = RVAL2CSTR(RARRAY_PTR(envp)[i]);
|
66
|
-
}
|
67
|
-
else {
|
68
|
-
genvp[i] = "";
|
69
|
-
}
|
70
|
-
}
|
71
|
-
genvp[genc] = (gchar*)NULL;
|
72
|
-
}
|
73
|
-
|
43
|
+
gargv = (gchar **)RVAL2STRV(argv);
|
44
|
+
genvp = (gchar **)RVAL2STRV(envp);
|
74
45
|
ret = g_spawn_async_with_pipes(NIL_P(working_directory) ? NULL : RVAL2CSTR(working_directory),
|
75
46
|
gargv, genvp, NUM2INT(flags),
|
76
47
|
(GSpawnChildSetupFunc)child_setup,
|
@@ -78,8 +49,10 @@ rbglib_m_spawn_async_with_pipes(VALUE self, VALUE working_directory, VALUE argv,
|
|
78
49
|
&child_pid,
|
79
50
|
&standard_input, &standard_output,
|
80
51
|
&standard_error, &err);
|
81
|
-
|
82
|
-
|
52
|
+
g_free(gargv);
|
53
|
+
g_free(genvp);
|
54
|
+
if (!ret)
|
55
|
+
RAISE_GERROR(err);
|
83
56
|
|
84
57
|
return rb_ary_new3(4, INT2NUM((gint)child_pid),
|
85
58
|
rb_funcall(rb_cIO, id_new, 1, INT2NUM(standard_input)),
|
@@ -94,54 +67,25 @@ rbglib_m_spawn_async(VALUE self, VALUE working_directory, VALUE argv, VALUE envp
|
|
94
67
|
gboolean ret;
|
95
68
|
GPid child_pid;
|
96
69
|
VALUE func = Qnil;
|
97
|
-
|
98
|
-
gchar
|
99
|
-
gchar** genvp = (gchar**)NULL;
|
70
|
+
gchar **gargv;
|
71
|
+
gchar **genvp;
|
100
72
|
|
101
73
|
if (rb_block_given_p()) {
|
102
74
|
func = rb_block_proc();
|
103
75
|
G_RELATIVE(self, func);
|
104
76
|
}
|
105
77
|
|
106
|
-
|
107
|
-
|
108
|
-
gargc = RARRAY_LEN(argv);
|
109
|
-
gargv = ALLOCA_N(gchar*, gargc + 1);
|
110
|
-
for (i = 0; i < gargc; i++) {
|
111
|
-
if (TYPE(RARRAY_PTR(argv)[i]) == T_STRING) {
|
112
|
-
gargv[i] = RVAL2CSTR(RARRAY_PTR(argv)[i]);
|
113
|
-
}
|
114
|
-
else {
|
115
|
-
gargv[i] = "";
|
116
|
-
}
|
117
|
-
}
|
118
|
-
gargv[gargc] = (gchar*)NULL;
|
119
|
-
}
|
120
|
-
|
121
|
-
if (! NIL_P(envp)){
|
122
|
-
Check_Type(envp, T_ARRAY);
|
123
|
-
genc = RARRAY_LEN(envp);
|
124
|
-
genvp = ALLOCA_N(gchar*, genc + 1);
|
125
|
-
for (i = 0; i < genc; i++) {
|
126
|
-
if (TYPE(RARRAY_PTR(envp)[i]) == T_STRING) {
|
127
|
-
genvp[i] = RVAL2CSTR(RARRAY_PTR(envp)[i]);
|
128
|
-
}
|
129
|
-
else {
|
130
|
-
genvp[i] = "";
|
131
|
-
}
|
132
|
-
}
|
133
|
-
genvp[genc] = (gchar*)NULL;
|
134
|
-
}
|
135
|
-
|
78
|
+
gargv = (gchar **)RVAL2STRV(argv);
|
79
|
+
genvp = (gchar **)RVAL2STRV(envp);
|
136
80
|
ret = g_spawn_async(NIL_P(working_directory) ? NULL : RVAL2CSTR(working_directory),
|
137
81
|
gargv, genvp, NUM2INT(flags),
|
138
82
|
(GSpawnChildSetupFunc)child_setup, (gpointer)func,
|
139
83
|
&child_pid, &err);
|
140
|
-
|
141
|
-
|
84
|
+
g_free(gargv);
|
85
|
+
g_free(genvp);
|
86
|
+
if (!ret)
|
142
87
|
RAISE_GERROR(err);
|
143
|
-
|
144
|
-
|
88
|
+
|
145
89
|
return INT2NUM((int)child_pid);
|
146
90
|
}
|
147
91
|
|
@@ -151,9 +95,8 @@ rbglib_m_spawn_sync(VALUE self, VALUE working_directory, VALUE argv, VALUE envp,
|
|
151
95
|
GError *err = NULL;
|
152
96
|
gboolean ret;
|
153
97
|
VALUE func = Qnil;
|
154
|
-
|
155
|
-
gchar**
|
156
|
-
gchar** genvp = (gchar**)NULL;
|
98
|
+
gchar** gargv;
|
99
|
+
gchar** genvp;
|
157
100
|
gchar *standard_output = NULL, *standard_error = NULL;
|
158
101
|
gint exit_status;
|
159
102
|
VALUE std_out, std_err;
|
@@ -163,46 +106,17 @@ rbglib_m_spawn_sync(VALUE self, VALUE working_directory, VALUE argv, VALUE envp,
|
|
163
106
|
G_RELATIVE(self, func);
|
164
107
|
}
|
165
108
|
|
166
|
-
|
167
|
-
|
168
|
-
gargc = RARRAY_LEN(argv);
|
169
|
-
gargv = ALLOCA_N(gchar*, gargc + 1);
|
170
|
-
for (i = 0; i < gargc; i++) {
|
171
|
-
if (TYPE(RARRAY_PTR(argv)[i]) == T_STRING) {
|
172
|
-
gargv[i] = RVAL2CSTR(RARRAY_PTR(argv)[i]);
|
173
|
-
}
|
174
|
-
else {
|
175
|
-
gargv[i] = "";
|
176
|
-
}
|
177
|
-
}
|
178
|
-
gargv[gargc] = (gchar*)NULL;
|
179
|
-
}
|
180
|
-
|
181
|
-
if (! NIL_P(envp)){
|
182
|
-
Check_Type(envp, T_ARRAY);
|
183
|
-
genc = RARRAY_LEN(envp);
|
184
|
-
genvp = ALLOCA_N(gchar*, genc + 1);
|
185
|
-
for (i = 0; i < genc; i++) {
|
186
|
-
if (TYPE(RARRAY_PTR(envp)[i]) == T_STRING) {
|
187
|
-
genvp[i] = RVAL2CSTR(RARRAY_PTR(envp)[i]);
|
188
|
-
}
|
189
|
-
else {
|
190
|
-
genvp[i] = "";
|
191
|
-
}
|
192
|
-
}
|
193
|
-
genvp[genc] = (gchar*)NULL;
|
194
|
-
}
|
195
|
-
|
109
|
+
gargv = (gchar **)RVAL2STRV(argv);
|
110
|
+
genvp = (gchar **)RVAL2STRV(envp);
|
196
111
|
ret = g_spawn_sync(NIL_P(working_directory) ? NULL : RVAL2CSTR(working_directory),
|
197
112
|
gargv, genvp, NUM2INT(flags),
|
198
113
|
(GSpawnChildSetupFunc)child_setup, (gpointer)func,
|
199
114
|
&standard_output, &standard_error,
|
200
115
|
&exit_status, &err);
|
201
|
-
|
202
|
-
|
203
|
-
if (!
|
116
|
+
g_free(gargv);
|
117
|
+
g_free(genvp);
|
118
|
+
if (!ret)
|
204
119
|
RAISE_GERROR(err);
|
205
|
-
}
|
206
120
|
|
207
121
|
if (standard_output) {
|
208
122
|
std_out = CSTR2RVAL(standard_output);
|
@@ -279,12 +193,16 @@ rbglib_m_spawn_command_line_async(VALUE self, VALUE str)
|
|
279
193
|
}
|
280
194
|
|
281
195
|
#ifdef HAVE_G_SPAWN_CLOSE_PID
|
196
|
+
|
197
|
+
#define RVAL2GPID(value) ((GPid)NUM2INT(pid))
|
198
|
+
|
282
199
|
static VALUE
|
283
200
|
rbglib_m_spawn_close_pid(VALUE self, VALUE pid)
|
284
201
|
{
|
285
|
-
g_spawn_close_pid(
|
202
|
+
g_spawn_close_pid(RVAL2GPID(pid));
|
286
203
|
return Qnil;
|
287
204
|
}
|
205
|
+
|
288
206
|
#endif
|
289
207
|
|
290
208
|
void
|
data/ext/glib2/rbglib_utils.c
CHANGED
@@ -120,29 +120,16 @@ rbglib_m_user_config_dir(VALUE self)
|
|
120
120
|
return CSTR2RVAL(g_get_user_config_dir());
|
121
121
|
}
|
122
122
|
|
123
|
-
static VALUE
|
124
|
-
strv_to_array(const gchar * const *strv)
|
125
|
-
{
|
126
|
-
VALUE array;
|
127
|
-
|
128
|
-
array = rb_ary_new();
|
129
|
-
for (; *strv; strv++) {
|
130
|
-
rb_ary_push(array, CSTR2RVAL(*strv));
|
131
|
-
}
|
132
|
-
|
133
|
-
return array;
|
134
|
-
}
|
135
|
-
|
136
123
|
static VALUE
|
137
124
|
rbglib_m_system_data_dirs(VALUE self)
|
138
125
|
{
|
139
|
-
return
|
126
|
+
return STRV2RVAL((const gchar **)g_get_system_data_dirs());
|
140
127
|
}
|
141
128
|
|
142
129
|
static VALUE
|
143
130
|
rbglib_m_system_config_dirs(VALUE self)
|
144
131
|
{
|
145
|
-
return
|
132
|
+
return STRV2RVAL((const gchar **)g_get_system_config_dirs());
|
146
133
|
}
|
147
134
|
#endif
|
148
135
|
|
@@ -254,21 +241,19 @@ static VALUE
|
|
254
241
|
rbglib_m_parse_debug_string(VALUE self, VALUE string, VALUE keys)
|
255
242
|
{
|
256
243
|
gint i, nkeys;
|
257
|
-
VALUE ary
|
244
|
+
VALUE ary;
|
258
245
|
GDebugKey* gkeys;
|
259
246
|
|
260
247
|
Check_Type(keys, T_HASH);
|
261
248
|
ary = rb_funcall(keys, rb_intern("to_a"), 0);
|
262
249
|
nkeys = RARRAY_LEN(ary);
|
263
|
-
gkeys =
|
250
|
+
gkeys = ALLOCA_N(GDebugKey, nkeys);
|
264
251
|
for (i = 0; i < nkeys; i++) {
|
265
252
|
gkeys[i].key = RVAL2CSTR(RARRAY_PTR(RARRAY_PTR(ary)[i])[0]);
|
266
253
|
gkeys[i].value = NUM2UINT(RARRAY_PTR(RARRAY_PTR(ary)[i])[1]);
|
267
254
|
}
|
268
255
|
|
269
|
-
|
270
|
-
g_free(gkeys);
|
271
|
-
return ret;
|
256
|
+
return UINT2NUM(g_parse_debug_string(RVAL2CSTR(string), gkeys, nkeys));
|
272
257
|
}
|
273
258
|
|
274
259
|
/*
|
data/ext/glib2/rbgobj_closure.c
CHANGED
@@ -33,7 +33,7 @@ struct _GRClosure
|
|
33
33
|
static VALUE
|
34
34
|
rclosure_default_g2r_func(guint num, const GValue *values)
|
35
35
|
{
|
36
|
-
|
36
|
+
guint i;
|
37
37
|
VALUE args = rb_ary_new2(num);
|
38
38
|
for (i = 0; i < num; i++)
|
39
39
|
rb_ary_store(args, i, GVAL2RVAL(&values[i]));
|
@@ -323,7 +323,8 @@ Init_closure()
|
|
323
323
|
|
324
324
|
/**********************************************************************/
|
325
325
|
|
326
|
-
void
|
326
|
+
void
|
327
|
+
Init_gobject_gclosure()
|
327
328
|
{
|
328
329
|
Init_rclosure();
|
329
330
|
Init_closure();
|
data/ext/glib2/rbgobj_enums.c
CHANGED
@@ -164,7 +164,7 @@ rbgobj_enum_add_constants(VALUE mod, GType enum_type,
|
|
164
164
|
const gchar *strip_prefix)
|
165
165
|
{
|
166
166
|
GEnumClass *gclass;
|
167
|
-
|
167
|
+
guint i;
|
168
168
|
int prefix_len = strlen(strip_prefix);
|
169
169
|
|
170
170
|
gclass = G_ENUM_CLASS(g_type_class_ref(enum_type));
|
@@ -190,7 +190,7 @@ rbgobj_flags_add_constants(VALUE mod, GType flags_type,
|
|
190
190
|
const gchar *strip_prefix)
|
191
191
|
{
|
192
192
|
GFlagsClass *gclass;
|
193
|
-
|
193
|
+
guint i;
|
194
194
|
int prefix_len = strlen(strip_prefix);
|
195
195
|
|
196
196
|
gclass = G_FLAGS_CLASS(g_type_class_ref(flags_type));
|
@@ -296,7 +296,7 @@ void
|
|
296
296
|
rbgobj_init_enum_class(VALUE klass)
|
297
297
|
{
|
298
298
|
GEnumClass* gclass = g_type_class_ref(CLASS2GTYPE(klass));
|
299
|
-
|
299
|
+
guint i;
|
300
300
|
|
301
301
|
for (i = 0; i < gclass->n_values; i++) {
|
302
302
|
GEnumValue* entry = &(gclass->values[i]);
|
@@ -342,24 +342,44 @@ enum_s_range(VALUE self)
|
|
342
342
|
return result;
|
343
343
|
}
|
344
344
|
|
345
|
+
struct enum_s_values_body_args {
|
346
|
+
GEnumClass *gclass;
|
347
|
+
VALUE self;
|
348
|
+
};
|
349
|
+
|
345
350
|
static VALUE
|
346
|
-
|
351
|
+
enum_s_values_body(VALUE value)
|
347
352
|
{
|
348
|
-
|
349
|
-
VALUE result;
|
350
|
-
|
353
|
+
struct enum_s_values_body_args *args = (struct enum_s_values_body_args *)value;
|
354
|
+
VALUE result = rb_ary_new();
|
355
|
+
guint i;
|
351
356
|
|
352
|
-
|
353
|
-
|
354
|
-
for (i = 0; i < gclass->n_values; i++) {
|
355
|
-
GEnumValue *p = &(gclass->values[i]);
|
356
|
-
rb_ary_push(result, make_enum(p->value, self));
|
357
|
-
}
|
357
|
+
for (i = 0; i < args->gclass->n_values; i++)
|
358
|
+
rb_ary_push(result, make_enum(args->gclass->values[i].value, args->self));
|
358
359
|
|
359
|
-
g_type_class_unref(gclass);
|
360
360
|
return result;
|
361
361
|
}
|
362
362
|
|
363
|
+
static VALUE
|
364
|
+
enum_s_values_ensure(VALUE gclass)
|
365
|
+
{
|
366
|
+
g_type_class_unref((GEnumClass *)gclass);
|
367
|
+
|
368
|
+
return Qnil;
|
369
|
+
}
|
370
|
+
|
371
|
+
static VALUE
|
372
|
+
enum_s_values(VALUE self)
|
373
|
+
{
|
374
|
+
struct enum_s_values_body_args args = {
|
375
|
+
g_type_class_ref(CLASS2GTYPE(self)),
|
376
|
+
self
|
377
|
+
};
|
378
|
+
|
379
|
+
return rb_ensure(enum_s_values_body, (VALUE)&args,
|
380
|
+
enum_s_values_ensure, (VALUE)args.gclass);
|
381
|
+
}
|
382
|
+
|
363
383
|
static VALUE
|
364
384
|
enum_s_allocate(VALUE self)
|
365
385
|
{
|
@@ -573,7 +593,7 @@ rbgobj_init_flags_class(VALUE klass)
|
|
573
593
|
{
|
574
594
|
GFlagsClass* gclass = g_type_class_ref(CLASS2GTYPE(klass));
|
575
595
|
GString* source = g_string_new(NULL);
|
576
|
-
|
596
|
+
guint i;
|
577
597
|
|
578
598
|
for (i = 0; i < gclass->n_values; i++) {
|
579
599
|
GFlagsValue* entry = &(gclass->values[i]);
|
@@ -639,7 +659,7 @@ flags_s_values(VALUE klass)
|
|
639
659
|
{
|
640
660
|
GFlagsClass *gclass;
|
641
661
|
VALUE result;
|
642
|
-
|
662
|
+
guint i;
|
643
663
|
|
644
664
|
gclass = g_type_class_ref(CLASS2GTYPE(klass));
|
645
665
|
result = rb_ary_new();
|
@@ -694,7 +714,7 @@ flags_initialize(int argc, VALUE* argv, VALUE self)
|
|
694
714
|
}
|
695
715
|
|
696
716
|
if (!p->info) {
|
697
|
-
|
717
|
+
guint i;
|
698
718
|
for (i = 0; i < p->gclass->n_values; i++){
|
699
719
|
GFlagsValue* val = &(p->gclass->values[i]);
|
700
720
|
if (val->value == p->value){
|