glib2 3.2.5 → 3.2.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/COPYING.LIB +502 -0
- data/README.md +42 -0
- data/Rakefile +8 -7
- data/ext/glib2/glib2.def +5 -0
- data/ext/glib2/rbglib-gc.c +89 -0
- data/ext/glib2/rbglib-variant-type.c +17 -0
- data/ext/glib2/rbglib.c +3 -0
- data/ext/glib2/rbglib.h +6 -1
- data/ext/glib2/rbglib2conversions.h +1 -1
- data/ext/glib2/rbgobj_boxed.c +49 -30
- data/ext/glib2/rbgobj_closure.c +3 -2
- data/ext/glib2/rbgobj_convert.c +1 -2
- data/ext/glib2/rbgobj_enums.c +32 -14
- data/ext/glib2/rbgobj_flags.c +31 -14
- data/ext/glib2/rbgobj_param.c +43 -23
- data/ext/glib2/rbgobj_signal.c +78 -66
- data/ext/glib2/rbgobj_type.c +22 -10
- data/ext/glib2/rbgobject.h +2 -0
- data/ext/glib2/rbgprivate.h +11 -0
- data/glib2.gemspec +48 -0
- data/lib/gnome2/rake/package-task.rb +17 -5
- data/lib/gnome2/rake/package.rb +2 -2
- data/lib/gnome2/rake/windows-binary-build-task.rb +39 -6
- data/lib/mkmf-gnome2.rb +4 -3
- data/sample/bookmarkfile.rb +2 -2
- data/sample/type-register.rb +6 -6
- data/sample/type-register2.rb +6 -6
- data/test/{test_enum.rb → test-enum.rb} +0 -0
- data/test/{test_file_utils.rb → test-file-utils.rb} +0 -0
- data/test/{test_flags.rb → test-flags.rb} +0 -0
- data/test/{test_glib2.rb → test-glib2.rb} +0 -0
- data/test/{test_key_file.rb → test-key-file.rb} +0 -0
- data/test/{test_mkenums.rb → test-mkenums.rb} +0 -0
- data/test/{test_poll_fd.rb → test-poll-fd.rb} +0 -0
- data/test/{test_signal.rb → test-signal.rb} +34 -2
- data/test/{test_source.rb → test-source.rb} +0 -0
- data/test/{test_spawn.rb → test-spawn.rb} +0 -0
- data/test/{test_timeout.rb → test-timeout.rb} +0 -0
- data/test/{test_unicode.rb → test-unicode.rb} +0 -0
- data/test/{test_utils.rb → test-utils.rb} +0 -0
- data/test/{test_value.rb → test-value.rb} +0 -0
- data/test/test-variant.rb +27 -0
- data/test/{test_win32.rb → test-win32.rb} +0 -0
- data/version.rb +30 -0
- metadata +29 -64
data/ext/glib2/rbgobj_convert.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-2018 Ruby-GNOME2 Project Team
|
4
4
|
* Copyright (C) 2006 Sjoerd Simons, Masao Mutoh
|
5
5
|
*
|
6
6
|
* This library is free software; you can redistribute it and/or
|
@@ -19,7 +19,6 @@
|
|
19
19
|
* MA 02110-1301 USA
|
20
20
|
*/
|
21
21
|
|
22
|
-
#include "rbgobject.h"
|
23
22
|
#include "rbgprivate.h"
|
24
23
|
|
25
24
|
static GHashTable *tables, *class_to_g_type_map;
|
data/ext/glib2/rbgobj_enums.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-2018 Ruby-GNOME2 Project Team
|
4
4
|
* Copyright (C) 2004-2006 Ruby-GNOME2 Project Team
|
5
5
|
* Copyright (C) 2002,2003 Masahiro Sakai
|
6
6
|
*
|
@@ -107,18 +107,31 @@ typedef struct {
|
|
107
107
|
} enum_holder;
|
108
108
|
|
109
109
|
static void
|
110
|
-
enum_free(
|
110
|
+
enum_free(void *data)
|
111
111
|
{
|
112
|
-
|
113
|
-
|
112
|
+
enum_holder *holder = data;
|
113
|
+
g_type_class_unref(holder->gclass);
|
114
|
+
xfree(holder);
|
114
115
|
}
|
115
116
|
|
116
|
-
static
|
117
|
-
|
117
|
+
static const rb_data_type_t rg_glib_enum_type = {
|
118
|
+
"GLib::Enum",
|
119
|
+
{
|
120
|
+
NULL,
|
121
|
+
enum_free,
|
122
|
+
NULL,
|
123
|
+
},
|
124
|
+
NULL,
|
125
|
+
NULL,
|
126
|
+
RUBY_TYPED_FREE_IMMEDIATELY,
|
127
|
+
};
|
128
|
+
|
129
|
+
static enum_holder *
|
130
|
+
enum_get_holder(VALUE rb_enum)
|
118
131
|
{
|
119
|
-
enum_holder*
|
120
|
-
|
121
|
-
return
|
132
|
+
enum_holder *holder;
|
133
|
+
TypedData_Get_Struct(rb_enum, enum_holder, &rg_glib_enum_type, holder);
|
134
|
+
return holder;
|
122
135
|
}
|
123
136
|
|
124
137
|
static VALUE
|
@@ -262,11 +275,16 @@ rbgobj_enum_alloc_func(VALUE self)
|
|
262
275
|
if (G_TYPE_IS_ABSTRACT(gtype)) {
|
263
276
|
rb_raise(rb_eTypeError, "abstract class");
|
264
277
|
} else {
|
265
|
-
enum_holder*
|
266
|
-
VALUE
|
267
|
-
|
268
|
-
|
269
|
-
|
278
|
+
enum_holder *holder;
|
279
|
+
VALUE rb_enum;
|
280
|
+
|
281
|
+
rb_enum = TypedData_Make_Struct(self,
|
282
|
+
enum_holder,
|
283
|
+
&rg_glib_enum_type,
|
284
|
+
holder);
|
285
|
+
holder->gclass = g_type_class_ref(gtype);
|
286
|
+
holder->info = NULL;
|
287
|
+
return rb_enum;
|
270
288
|
}
|
271
289
|
}
|
272
290
|
|
data/ext/glib2/rbgobj_flags.c
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
2
|
/*
|
3
|
-
* Copyright (C) 2004-
|
3
|
+
* Copyright (C) 2004-2018 Ruby-GNOME2 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
|
@@ -68,18 +68,31 @@ typedef struct {
|
|
68
68
|
} flags_holder;
|
69
69
|
|
70
70
|
static void
|
71
|
-
flags_free(
|
71
|
+
flags_free(void *data)
|
72
72
|
{
|
73
|
-
|
74
|
-
|
73
|
+
flags_holder *holder = data;
|
74
|
+
g_type_class_unref(holder->gclass);
|
75
|
+
xfree(holder);
|
75
76
|
}
|
76
77
|
|
78
|
+
static const rb_data_type_t rg_glib_flags_type = {
|
79
|
+
"GLib::Flags",
|
80
|
+
{
|
81
|
+
NULL,
|
82
|
+
flags_free,
|
83
|
+
NULL,
|
84
|
+
},
|
85
|
+
NULL,
|
86
|
+
NULL,
|
87
|
+
RUBY_TYPED_FREE_IMMEDIATELY,
|
88
|
+
};
|
89
|
+
|
77
90
|
static flags_holder*
|
78
|
-
flags_get_holder(VALUE
|
91
|
+
flags_get_holder(VALUE rb_flags)
|
79
92
|
{
|
80
|
-
flags_holder*
|
81
|
-
|
82
|
-
return
|
93
|
+
flags_holder *holder;
|
94
|
+
TypedData_Get_Struct(rb_flags, flags_holder, &rg_glib_flags_type, holder);
|
95
|
+
return holder;
|
83
96
|
}
|
84
97
|
|
85
98
|
static VALUE
|
@@ -209,12 +222,16 @@ rbgobj_flags_alloc_func(VALUE self)
|
|
209
222
|
if (G_TYPE_IS_ABSTRACT(gtype)) {
|
210
223
|
rb_raise(rb_eTypeError, "abstract class");
|
211
224
|
} else {
|
212
|
-
flags_holder*
|
213
|
-
VALUE
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
225
|
+
flags_holder *holder;
|
226
|
+
VALUE rb_flags;
|
227
|
+
rb_flags = TypedData_Make_Struct(self,
|
228
|
+
flags_holder,
|
229
|
+
&rg_glib_flags_type,
|
230
|
+
holder);
|
231
|
+
holder->gclass = g_type_class_ref(gtype);
|
232
|
+
holder->value = 0;
|
233
|
+
holder->info = NULL;
|
234
|
+
return rb_flags;
|
218
235
|
}
|
219
236
|
}
|
220
237
|
|
data/ext/glib2/rbgobj_param.c
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
2
|
/*
|
3
|
-
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
3
|
+
* Copyright (C) 2011-2018 Ruby-GNOME2 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
|
@@ -34,36 +34,57 @@ typedef struct {
|
|
34
34
|
} pspec_holder;
|
35
35
|
|
36
36
|
static void
|
37
|
-
pspec_mark(
|
37
|
+
pspec_mark(void *data)
|
38
38
|
{
|
39
|
+
pspec_holder *holder = data;
|
39
40
|
if (holder->instance)
|
40
41
|
rbgobj_instance_call_cinfo_mark(holder->instance);
|
41
42
|
}
|
42
43
|
|
43
44
|
static void
|
44
|
-
pspec_free(
|
45
|
+
pspec_free(void *data)
|
45
46
|
{
|
47
|
+
pspec_holder *holder = data;
|
46
48
|
if (holder->instance){
|
47
49
|
rbgobj_instance_call_cinfo_free(holder->instance);
|
48
50
|
g_param_spec_set_qdata(holder->instance, qparamspec, NULL);
|
49
51
|
g_param_spec_unref(holder->instance);
|
50
52
|
}
|
51
|
-
|
53
|
+
xfree(holder);
|
54
|
+
}
|
55
|
+
|
56
|
+
static const rb_data_type_t rg_glib_param_type = {
|
57
|
+
"GLib::Param",
|
58
|
+
{
|
59
|
+
pspec_mark,
|
60
|
+
pspec_free,
|
61
|
+
NULL,
|
62
|
+
},
|
63
|
+
NULL,
|
64
|
+
NULL,
|
65
|
+
RUBY_TYPED_FREE_IMMEDIATELY,
|
66
|
+
};
|
67
|
+
|
68
|
+
static pspec_holder *
|
69
|
+
rbgobj_param_get_raw(VALUE rb_param)
|
70
|
+
{
|
71
|
+
pspec_holder *holder;
|
72
|
+
TypedData_Get_Struct(rb_param, pspec_holder, &rg_glib_param_type, holder);
|
73
|
+
return holder;
|
52
74
|
}
|
53
75
|
|
54
76
|
GParamSpec*
|
55
77
|
rbgobj_get_param_spec(VALUE obj)
|
56
78
|
{
|
57
|
-
|
58
|
-
Data_Get_Struct(obj, pspec_holder, holder);
|
59
|
-
return G_PARAM_SPEC(holder->instance);
|
79
|
+
return G_PARAM_SPEC(rbgobj_param_get_raw(obj)->instance);
|
60
80
|
}
|
61
81
|
|
62
82
|
void
|
63
83
|
rbgobj_param_spec_initialize(VALUE self, GParamSpec *pspec)
|
64
84
|
{
|
65
|
-
pspec_holder*
|
66
|
-
|
85
|
+
pspec_holder *holder;
|
86
|
+
|
87
|
+
holder = rbgobj_param_get_raw(self);
|
67
88
|
|
68
89
|
pspec = g_param_spec_ref(pspec);
|
69
90
|
g_param_spec_sink(pspec);
|
@@ -97,30 +118,29 @@ pspec_s_allocate(VALUE klass)
|
|
97
118
|
rb_raise(rb_eTypeError, "abstract class");
|
98
119
|
|
99
120
|
{
|
100
|
-
pspec_holder*
|
101
|
-
VALUE
|
121
|
+
pspec_holder *holder;
|
122
|
+
VALUE rb_param;
|
102
123
|
|
103
|
-
|
104
|
-
|
124
|
+
rb_param = TypedData_Make_Struct(klass,
|
125
|
+
pspec_holder,
|
126
|
+
&rg_glib_param_type,
|
127
|
+
holder);
|
105
128
|
holder->instance = NULL;
|
106
129
|
holder->cinfo = NULL;
|
107
130
|
|
108
|
-
return
|
131
|
+
return rb_param;
|
109
132
|
}
|
110
133
|
}
|
111
134
|
|
112
135
|
static VALUE
|
113
136
|
rg_inspect(VALUE self)
|
114
137
|
{
|
115
|
-
GParamSpec*
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
VALUE result = rb_str_new2(str);
|
122
|
-
g_free(str);
|
123
|
-
return result;
|
138
|
+
GParamSpec *pspec = rbgobj_get_param_spec(self);
|
139
|
+
|
140
|
+
return rb_sprintf("#<%" PRIsVALUE "%" PRIsVALUE "#%s",
|
141
|
+
CLASS_OF(self),
|
142
|
+
GTYPE2CLASS(pspec->owner_type),
|
143
|
+
g_param_spec_get_name(pspec));
|
124
144
|
}
|
125
145
|
|
126
146
|
static VALUE
|
data/ext/glib2/rbgobj_signal.c
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
2
|
/*
|
3
|
-
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
3
|
+
* Copyright (C) 2011-2018 Ruby-GNOME2 Project Team
|
4
4
|
* Copyright (C) 2002-2004 Ruby-GNOME2 Project Team
|
5
5
|
* Copyright (C) 2002,2003 Masahiro Sakai
|
6
6
|
*
|
@@ -31,6 +31,40 @@ VALUE rbgobj_signal_wrap(guint sig_id);
|
|
31
31
|
|
32
32
|
/**********************************************************************/
|
33
33
|
|
34
|
+
static const rb_data_type_t rg_glib_signal_type = {
|
35
|
+
"GLib::Signal",
|
36
|
+
{
|
37
|
+
NULL,
|
38
|
+
NULL,
|
39
|
+
NULL,
|
40
|
+
},
|
41
|
+
NULL,
|
42
|
+
NULL,
|
43
|
+
RUBY_TYPED_FREE_IMMEDIATELY,
|
44
|
+
};
|
45
|
+
|
46
|
+
VALUE
|
47
|
+
rbgobj_signal_new(guint id)
|
48
|
+
{
|
49
|
+
VALUE rb_query;
|
50
|
+
GSignalQuery *query;
|
51
|
+
|
52
|
+
rb_query = TypedData_Make_Struct(RG_TARGET_NAMESPACE,
|
53
|
+
GSignalQuery,
|
54
|
+
&rg_glib_signal_type,
|
55
|
+
query);
|
56
|
+
g_signal_query(id, query);
|
57
|
+
return rb_query;
|
58
|
+
}
|
59
|
+
|
60
|
+
static GSignalQuery *
|
61
|
+
rbgobj_signal_get_raw(VALUE rb_signal)
|
62
|
+
{
|
63
|
+
GSignalQuery *query;
|
64
|
+
TypedData_Get_Struct(rb_signal, GSignalQuery, &rg_glib_signal_type, query);
|
65
|
+
return query;
|
66
|
+
}
|
67
|
+
|
34
68
|
static VALUE signal_func_table;
|
35
69
|
|
36
70
|
void
|
@@ -164,7 +198,7 @@ rbg_rval2gtypes_accept_nil(volatile VALUE *value, long *n)
|
|
164
198
|
#define RVAL2GTYPES_ACCEPT_NIL(value, n) rbg_rval2gtypes_accept_nil(&(value), &(n))
|
165
199
|
|
166
200
|
static VALUE
|
167
|
-
|
201
|
+
gobj_s_define_signal(int argc, VALUE* argv, VALUE self)
|
168
202
|
{
|
169
203
|
const RGObjClassInfo *cinfo = rbgobj_lookup_class(self);
|
170
204
|
VALUE rbsignal_name, rbsignal_flags, accumulator, rbreturn_type, params;
|
@@ -175,6 +209,7 @@ gobj_s_signal_new(int argc, VALUE* argv, VALUE self)
|
|
175
209
|
GType *param_types;
|
176
210
|
long n_params;
|
177
211
|
guint signal;
|
212
|
+
VALUE rb_signal;
|
178
213
|
|
179
214
|
rb_scan_args(argc, argv, "4*",
|
180
215
|
&rbsignal_name, &rbsignal_flags, &accumulator, &rbreturn_type, ¶ms);
|
@@ -187,20 +222,23 @@ gobj_s_signal_new(int argc, VALUE* argv, VALUE self)
|
|
187
222
|
rbsignal_name = rb_str_new2(rb_id2name(SYM2ID(rbsignal_name)));
|
188
223
|
signal_name = RVAL2CSTR(rbsignal_name);
|
189
224
|
|
190
|
-
signal_flags =
|
225
|
+
signal_flags = RVAL2GFLAGS(rbsignal_flags, G_TYPE_SIGNAL_FLAGS);
|
191
226
|
|
192
227
|
{
|
228
|
+
VALUE rb_method_name;
|
193
229
|
VALUE proc;
|
194
230
|
ID method_id;
|
195
231
|
|
196
|
-
|
232
|
+
rb_method_name =
|
233
|
+
rb_str_concat(rb_str_new_cstr(default_handler_method_prefix),
|
234
|
+
rbsignal_name);
|
235
|
+
method_id = rb_to_id(rb_method_name);
|
197
236
|
|
198
237
|
proc = rb_funcall(mMetaInterface, rb_intern("signal_callback"), 2,
|
199
238
|
self, ID2SYM(method_id));
|
200
239
|
|
201
240
|
class_closure = g_rclosure_new(proc, Qnil, NULL);
|
202
|
-
|
203
|
-
g_rclosure_attach(class_closure, self);
|
241
|
+
g_rclosure_set_tag(class_closure, RVAL2CSTR(rb_method_name));
|
204
242
|
}
|
205
243
|
|
206
244
|
return_type = rbgobj_gtype_get(rbreturn_type);
|
@@ -222,10 +260,13 @@ gobj_s_signal_new(int argc, VALUE* argv, VALUE self)
|
|
222
260
|
if (!signal)
|
223
261
|
rb_raise(rb_eRuntimeError, "g_signal_newv failed");
|
224
262
|
|
263
|
+
rb_signal = rbgobj_signal_new(signal);
|
225
264
|
if (!NIL_P(accumulator))
|
226
|
-
|
265
|
+
rbgobj_add_relative(rb_signal, accumulator);
|
266
|
+
g_rclosure_attach(class_closure, rb_signal);
|
267
|
+
rbgobj_add_relative(self, rb_signal);
|
227
268
|
|
228
|
-
return
|
269
|
+
return rb_signal;
|
229
270
|
}
|
230
271
|
|
231
272
|
static void
|
@@ -280,7 +321,7 @@ gobj_s_signal(VALUE self, VALUE name)
|
|
280
321
|
if (!sig_id)
|
281
322
|
rb_raise(eNoSignalError, "no such signal: %s", sig_name);
|
282
323
|
|
283
|
-
return
|
324
|
+
return rbgobj_signal_new(sig_id);
|
284
325
|
}
|
285
326
|
|
286
327
|
static VALUE
|
@@ -338,7 +379,7 @@ gobj_sig_connect_impl(gboolean after, int argc, VALUE *argv, VALUE self)
|
|
338
379
|
CONST_ID(id_create_signal_handler, "create_signal_handler");
|
339
380
|
normalized_signal_name = g_signal_name(signal_id);
|
340
381
|
func = rb_funcall(self,
|
341
|
-
|
382
|
+
id_create_signal_handler,
|
342
383
|
2,
|
343
384
|
rb_str_new_cstr(normalized_signal_name),
|
344
385
|
rb_block_proc());
|
@@ -388,7 +429,7 @@ gobj_sig_get_invocation_hint(VALUE self)
|
|
388
429
|
GSignalInvocationHint* hint;
|
389
430
|
hint = g_signal_get_invocation_hint(RVAL2GOBJ(self));
|
390
431
|
return rb_ary_new3(3,
|
391
|
-
|
432
|
+
rbgobj_signal_new(hint->signal_id),
|
392
433
|
hint->detail ? rb_str_new2(g_quark_to_string(hint->detail)) : Qnil,
|
393
434
|
INT2NUM(hint->run_type));
|
394
435
|
}
|
@@ -689,71 +730,54 @@ gobj_s_method_added(VALUE klass, VALUE id)
|
|
689
730
|
VALUE
|
690
731
|
rbgobj_signal_wrap(guint sig_id)
|
691
732
|
{
|
692
|
-
|
693
|
-
GSignalQuery* query;
|
694
|
-
|
695
|
-
result = Data_Make_Struct(RG_TARGET_NAMESPACE, GSignalQuery, NULL, free, query);
|
696
|
-
g_signal_query(sig_id, query);
|
697
|
-
return result;
|
733
|
+
return rbgobj_signal_new(sig_id);
|
698
734
|
}
|
699
735
|
|
700
736
|
static VALUE
|
701
737
|
rg_id(VALUE self)
|
702
738
|
{
|
703
|
-
|
704
|
-
Data_Get_Struct(self, GSignalQuery, query);
|
705
|
-
return UINT2NUM(query->signal_id);
|
739
|
+
return UINT2NUM(rbgobj_signal_get_raw(self)->signal_id);
|
706
740
|
}
|
707
741
|
|
708
742
|
static VALUE
|
709
743
|
rg_name(VALUE self)
|
710
744
|
{
|
711
|
-
|
712
|
-
Data_Get_Struct(self, GSignalQuery, query);
|
713
|
-
return rb_str_new2(query->signal_name);
|
745
|
+
return CSTR2RVAL(rbgobj_signal_get_raw(self)->signal_name);
|
714
746
|
}
|
715
747
|
|
716
748
|
static VALUE
|
717
749
|
rg_itype(VALUE self)
|
718
750
|
{
|
719
|
-
|
720
|
-
Data_Get_Struct(self, GSignalQuery, query);
|
721
|
-
return rbgobj_gtype_new(query->itype);
|
751
|
+
return rbgobj_gtype_new(rbgobj_signal_get_raw(self)->itype);
|
722
752
|
}
|
723
753
|
|
724
754
|
static VALUE
|
725
755
|
rg_owner(VALUE self)
|
726
756
|
{
|
727
|
-
|
728
|
-
Data_Get_Struct(self, GSignalQuery, query);
|
729
|
-
return GTYPE2CLASS(query->itype);
|
757
|
+
return GTYPE2CLASS(rbgobj_signal_get_raw(self)->itype);
|
730
758
|
}
|
731
759
|
|
732
760
|
static VALUE
|
733
761
|
rg_return_type(VALUE self)
|
734
762
|
{
|
735
|
-
|
736
|
-
Data_Get_Struct(self, GSignalQuery, query);
|
737
|
-
return rbgobj_gtype_new(query->return_type);
|
763
|
+
return rbgobj_gtype_new(rbgobj_signal_get_raw(self)->return_type);
|
738
764
|
}
|
739
765
|
|
740
766
|
static VALUE
|
741
767
|
rg_flags(VALUE self)
|
742
768
|
{
|
743
|
-
|
744
|
-
Data_Get_Struct(self, GSignalQuery, query);
|
745
|
-
return UINT2NUM(query->signal_flags);
|
769
|
+
return UINT2NUM(rbgobj_signal_get_raw(self)->signal_flags);
|
746
770
|
}
|
747
771
|
|
748
772
|
static VALUE
|
749
773
|
rg_param_types(VALUE self)
|
750
774
|
{
|
751
|
-
GSignalQuery*
|
775
|
+
GSignalQuery *query;
|
752
776
|
VALUE result;
|
753
777
|
guint i;
|
754
|
-
Data_Get_Struct(self, GSignalQuery, query);
|
755
778
|
|
756
|
-
|
779
|
+
query = rbgobj_signal_get_raw(self);
|
780
|
+
result = rb_ary_new_capa(query->n_params);
|
757
781
|
for (i = 0; i < query->n_params; i++)
|
758
782
|
rb_ary_store(result, i, rbgobj_gtype_new(query->param_types[i]));
|
759
783
|
|
@@ -763,31 +787,19 @@ rg_param_types(VALUE self)
|
|
763
787
|
static VALUE
|
764
788
|
rg_inspect(VALUE self)
|
765
789
|
{
|
766
|
-
GSignalQuery*
|
767
|
-
|
768
|
-
|
769
|
-
|
770
|
-
|
771
|
-
|
772
|
-
v = rb_inspect(GTYPE2CLASS(query->itype));
|
773
|
-
|
774
|
-
s = g_strdup_printf("#<%s: %s#%s>",
|
775
|
-
rb_class2name(CLASS_OF(self)),
|
776
|
-
StringValuePtr(v),
|
777
|
-
query->signal_name);
|
778
|
-
result = rb_str_new2(s);
|
779
|
-
g_free(s);
|
780
|
-
|
781
|
-
return result;
|
790
|
+
GSignalQuery *query;
|
791
|
+
query = rbgobj_signal_get_raw(self);
|
792
|
+
return rb_sprintf("#<%" PRIsVALUE " %+" PRIsVALUE "#%s>",
|
793
|
+
CLASS_OF(self),
|
794
|
+
GTYPE2CLASS(query->itype),
|
795
|
+
query->signal_name);
|
782
796
|
}
|
783
797
|
|
784
798
|
#define query_is_flag(flag) \
|
785
799
|
static VALUE \
|
786
800
|
query_is_##flag(VALUE self) \
|
787
801
|
{ \
|
788
|
-
|
789
|
-
Data_Get_Struct(self, GSignalQuery, query); \
|
790
|
-
return CBOOL2RVAL(query->signal_flags & flag); \
|
802
|
+
return CBOOL2RVAL(rbgobj_signal_get_raw(self)->signal_flags & flag); \
|
791
803
|
}
|
792
804
|
|
793
805
|
query_is_flag(G_SIGNAL_RUN_FIRST)
|
@@ -804,8 +816,8 @@ hook_func(GSignalInvocationHint* ihint,
|
|
804
816
|
const GValue* param_values,
|
805
817
|
gpointer data)
|
806
818
|
{
|
807
|
-
GClosure*
|
808
|
-
GValue ret_val =G_VALUE_INIT;
|
819
|
+
GClosure *closure = data;
|
820
|
+
GValue ret_val = G_VALUE_INIT;
|
809
821
|
gboolean ret;
|
810
822
|
|
811
823
|
g_value_init(&ret_val, G_TYPE_BOOLEAN);
|
@@ -833,13 +845,13 @@ g_signal_add_emission_hook_closure (guint signal_id,
|
|
833
845
|
static VALUE
|
834
846
|
rg_add_emission_hook(int argc, VALUE* argv, VALUE self)
|
835
847
|
{
|
836
|
-
GSignalQuery*
|
848
|
+
GSignalQuery *query;
|
837
849
|
VALUE proc;
|
838
850
|
guint hook_id;
|
839
851
|
GQuark detail = 0;
|
840
852
|
GClosure* closure;
|
841
853
|
|
842
|
-
|
854
|
+
query = rbgobj_signal_get_raw(self);
|
843
855
|
|
844
856
|
if (query->signal_flags & G_SIGNAL_DETAILED) {
|
845
857
|
VALUE detail_obj;
|
@@ -847,7 +859,7 @@ rg_add_emission_hook(int argc, VALUE* argv, VALUE self)
|
|
847
859
|
if (SYMBOL_P(detail_obj))
|
848
860
|
detail = g_quark_from_string(rb_id2name(SYM2ID(detail_obj)));
|
849
861
|
else
|
850
|
-
detail = g_quark_from_string(
|
862
|
+
detail = g_quark_from_string(RVAL2CSTR(detail_obj));
|
851
863
|
}
|
852
864
|
} else {
|
853
865
|
rb_scan_args(argc, argv, "00&", &proc);
|
@@ -863,9 +875,8 @@ rg_add_emission_hook(int argc, VALUE* argv, VALUE self)
|
|
863
875
|
static VALUE
|
864
876
|
rg_remove_emission_hook(VALUE self, VALUE hook_id)
|
865
877
|
{
|
866
|
-
|
867
|
-
|
868
|
-
g_signal_remove_emission_hook(query->signal_id, NUM2ULONG(hook_id));
|
878
|
+
g_signal_remove_emission_hook(rbgobj_signal_get_raw(self)->signal_id,
|
879
|
+
NUM2ULONG(hook_id));
|
869
880
|
return Qnil;
|
870
881
|
}
|
871
882
|
|
@@ -983,7 +994,8 @@ Init_gobject_gsignal(void)
|
|
983
994
|
signal_call_func_table = rb_hash_new();
|
984
995
|
rb_global_variable(&signal_call_func_table);
|
985
996
|
|
986
|
-
rbg_define_method(mMetaInterface, "
|
997
|
+
rbg_define_method(mMetaInterface, "define_signal", gobj_s_define_signal, -1);
|
998
|
+
rb_define_alias(mMetaInterface, "signal_new", "define_signal");
|
987
999
|
rbg_define_method(mMetaInterface, "signals", gobj_s_signals, -1);
|
988
1000
|
rbg_define_method(mMetaInterface, "signal", gobj_s_signal, 1);
|
989
1001
|
|