glib2 0.20.0 → 0.90.2
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.
- data/ChangeLog +92 -0
- data/README +22 -10
- data/Rakefile +54 -72
- data/ext/glib2/depend +10 -0
- data/ext/glib2/extconf.rb +61 -0
- data/ext/glib2/glib2.def +89 -0
- data/{src → ext/glib2}/rbgcompat.h +0 -0
- data/{src → ext/glib2}/rbglib.c +17 -7
- data/{src → ext/glib2}/rbglib.h +2 -2
- data/{src → ext/glib2}/rbglib_bookmarkfile.c +0 -0
- data/{src → ext/glib2}/rbglib_completion.c +0 -0
- data/{src → ext/glib2}/rbglib_convert.c +0 -0
- data/{src → ext/glib2}/rbglib_error.c +0 -0
- data/{src → ext/glib2}/rbglib_fileutils.c +0 -0
- data/{src → ext/glib2}/rbglib_i18n.c +0 -0
- data/{src → ext/glib2}/rbglib_int64.c +0 -0
- data/{src → ext/glib2}/rbglib_iochannel.c +0 -0
- data/{src → ext/glib2}/rbglib_keyfile.c +0 -0
- data/{src → ext/glib2}/rbglib_maincontext.c +1 -3
- data/{src → ext/glib2}/rbglib_mainloop.c +0 -0
- data/{src → ext/glib2}/rbglib_messages.c +0 -0
- data/{src → ext/glib2}/rbglib_pollfd.c +0 -0
- data/{src → ext/glib2}/rbglib_shell.c +0 -0
- data/{src → ext/glib2}/rbglib_source.c +0 -0
- data/{src → ext/glib2}/rbglib_spawn.c +0 -0
- data/{src → ext/glib2}/rbglib_threads.c +0 -0
- data/{src → ext/glib2}/rbglib_timer.c +0 -0
- data/{src → ext/glib2}/rbglib_unicode.c +0 -0
- data/{src → ext/glib2}/rbglib_utils.c +0 -0
- data/{src → ext/glib2}/rbglib_win32.c +0 -0
- data/{src → ext/glib2}/rbgobj_boxed.c +0 -0
- data/{src → ext/glib2}/rbgobj_closure.c +0 -0
- data/{src → ext/glib2}/rbgobj_convert.c +0 -0
- data/{src → ext/glib2}/rbgobj_enums.c +0 -0
- data/{src → ext/glib2}/rbgobj_fundamental.c +0 -0
- data/{src → ext/glib2}/rbgobj_object.c +0 -0
- data/{src → ext/glib2}/rbgobj_param.c +0 -0
- data/{src → ext/glib2}/rbgobj_paramspecs.c +0 -0
- data/{src → ext/glib2}/rbgobj_signal.c +0 -0
- data/{src → ext/glib2}/rbgobj_strv.c +0 -0
- data/{src → ext/glib2}/rbgobj_type.c +0 -0
- data/{src → ext/glib2}/rbgobj_typeinstance.c +0 -0
- data/{src → ext/glib2}/rbgobj_typeinterface.c +0 -0
- data/{src → ext/glib2}/rbgobj_typemodule.c +0 -0
- data/{src → ext/glib2}/rbgobj_typeplugin.c +0 -0
- data/{src → ext/glib2}/rbgobj_value.c +0 -0
- data/{src → ext/glib2}/rbgobj_valuearray.c +0 -0
- data/{src → ext/glib2}/rbgobj_valuetypes.c +0 -0
- data/{src → ext/glib2}/rbgobject.c +0 -0
- data/{src → ext/glib2}/rbgobject.h +0 -0
- data/{src → ext/glib2}/rbgprivate.h +0 -0
- data/ext/glib2/rbgutil.c +316 -0
- data/{src → ext/glib2}/rbgutil.h +9 -9
- data/{src → ext/glib2}/rbgutil_callback.c +0 -0
- data/extconf.rb +48 -60
- data/{src/lib → lib}/glib-mkenums.rb +2 -2
- data/{src/lib → lib}/glib2.rb +28 -9
- data/lib/gnome2-win32-binary-downloader.rb +92 -0
- data/{src/lib → lib}/mkmf-gnome2.rb +76 -89
- data/test-unit/COPYING +56 -0
- data/test-unit/GPL +340 -0
- data/test-unit/History.txt +232 -0
- data/test-unit/Manifest.txt +110 -0
- data/test-unit/PSFL +271 -0
- data/test-unit/README.txt +75 -0
- data/test-unit/Rakefile +53 -0
- data/test-unit/TODO +5 -0
- data/test-unit/bin/testrb +5 -0
- data/test-unit/html/bar.png +0 -0
- data/test-unit/html/bar.svg +153 -0
- data/test-unit/html/developer.png +0 -0
- data/test-unit/html/developer.svg +469 -0
- data/test-unit/html/famfamfam-logo.png +0 -0
- data/test-unit/html/favicon.ico +0 -0
- data/test-unit/html/favicon.png +0 -0
- data/test-unit/html/favicon.svg +82 -0
- data/test-unit/html/heading-mark.png +0 -0
- data/test-unit/html/heading-mark.svg +393 -0
- data/test-unit/html/index.html +247 -0
- data/test-unit/html/index.html.ja +270 -0
- data/test-unit/html/install.png +0 -0
- data/test-unit/html/install.svg +636 -0
- data/test-unit/html/jp.png +0 -0
- data/test-unit/html/kinotan-failure.png +0 -0
- data/test-unit/html/kinotan-pass.png +0 -0
- data/test-unit/html/logo.png +0 -0
- data/test-unit/html/logo.svg +483 -0
- data/test-unit/html/reference.png +0 -0
- data/test-unit/html/rubyforge.png +0 -0
- data/test-unit/html/tango-logo.png +0 -0
- data/test-unit/html/test-unit.css +339 -0
- data/test-unit/html/tutorial.png +0 -0
- data/test-unit/html/tutorial.svg +559 -0
- data/test-unit/html/us.png +0 -0
- data/test-unit/images/color-diff.png +0 -0
- data/test-unit/lib/test/unit.rb +328 -0
- data/test-unit/lib/test/unit/assertionfailederror.rb +25 -0
- data/test-unit/lib/test/unit/assertions.rb +1334 -0
- data/test-unit/lib/test/unit/attribute.rb +125 -0
- data/test-unit/lib/test/unit/autorunner.rb +363 -0
- data/test-unit/lib/test/unit/collector.rb +36 -0
- data/test-unit/lib/test/unit/collector/descendant.rb +23 -0
- data/test-unit/lib/test/unit/collector/dir.rb +108 -0
- data/test-unit/lib/test/unit/collector/load.rb +144 -0
- data/test-unit/lib/test/unit/collector/objectspace.rb +34 -0
- data/test-unit/lib/test/unit/color-scheme.rb +106 -0
- data/test-unit/lib/test/unit/color.rb +96 -0
- data/test-unit/lib/test/unit/diff.rb +740 -0
- data/test-unit/lib/test/unit/error.rb +130 -0
- data/test-unit/lib/test/unit/exceptionhandler.rb +39 -0
- data/test-unit/lib/test/unit/failure.rb +136 -0
- data/test-unit/lib/test/unit/fixture.rb +176 -0
- data/test-unit/lib/test/unit/notification.rb +129 -0
- data/test-unit/lib/test/unit/omission.rb +191 -0
- data/test-unit/lib/test/unit/pending.rb +150 -0
- data/test-unit/lib/test/unit/priority.rb +180 -0
- data/test-unit/lib/test/unit/runner/console.rb +52 -0
- data/test-unit/lib/test/unit/runner/emacs.rb +8 -0
- data/test-unit/lib/test/unit/runner/tap.rb +8 -0
- data/test-unit/lib/test/unit/testcase.rb +483 -0
- data/test-unit/lib/test/unit/testresult.rb +121 -0
- data/test-unit/lib/test/unit/testsuite.rb +110 -0
- data/test-unit/lib/test/unit/ui/console/outputlevel.rb +14 -0
- data/test-unit/lib/test/unit/ui/console/testrunner.rb +430 -0
- data/test-unit/lib/test/unit/ui/emacs/testrunner.rb +63 -0
- data/test-unit/lib/test/unit/ui/tap/testrunner.rb +82 -0
- data/test-unit/lib/test/unit/ui/testrunner.rb +53 -0
- data/test-unit/lib/test/unit/ui/testrunnermediator.rb +77 -0
- data/test-unit/lib/test/unit/ui/testrunnerutilities.rb +41 -0
- data/test-unit/lib/test/unit/util/backtracefilter.rb +42 -0
- data/test-unit/lib/test/unit/util/method-owner-finder.rb +28 -0
- data/test-unit/lib/test/unit/util/observable.rb +90 -0
- data/test-unit/lib/test/unit/util/output.rb +31 -0
- data/test-unit/lib/test/unit/util/procwrapper.rb +48 -0
- data/test-unit/lib/test/unit/version.rb +7 -0
- data/test-unit/sample/adder.rb +13 -0
- data/test-unit/sample/subtracter.rb +12 -0
- data/test-unit/sample/test_adder.rb +20 -0
- data/test-unit/sample/test_subtracter.rb +20 -0
- data/test-unit/sample/test_user.rb +23 -0
- data/test-unit/test/collector/test-descendant.rb +133 -0
- data/test-unit/test/collector/test-load.rb +442 -0
- data/test-unit/test/collector/test_dir.rb +406 -0
- data/test-unit/test/collector/test_objectspace.rb +100 -0
- data/test-unit/test/run-test.rb +15 -0
- data/test-unit/test/test-attribute.rb +86 -0
- data/test-unit/test/test-color-scheme.rb +69 -0
- data/test-unit/test/test-color.rb +47 -0
- data/test-unit/test/test-diff.rb +518 -0
- data/test-unit/test/test-emacs-runner.rb +60 -0
- data/test-unit/test/test-fixture.rb +287 -0
- data/test-unit/test/test-notification.rb +33 -0
- data/test-unit/test/test-omission.rb +81 -0
- data/test-unit/test/test-pending.rb +70 -0
- data/test-unit/test/test-priority.rb +119 -0
- data/test-unit/test/test-testcase.rb +544 -0
- data/test-unit/test/test_assertions.rb +1197 -0
- data/test-unit/test/test_error.rb +26 -0
- data/test-unit/test/test_failure.rb +33 -0
- data/test-unit/test/test_testresult.rb +113 -0
- data/test-unit/test/test_testsuite.rb +129 -0
- data/test-unit/test/testunit-test-util.rb +14 -0
- data/test-unit/test/ui/test_tap.rb +33 -0
- data/test-unit/test/ui/test_testrunmediator.rb +20 -0
- data/test-unit/test/util/test-method-owner-finder.rb +38 -0
- data/test-unit/test/util/test-output.rb +11 -0
- data/test-unit/test/util/test_backtracefilter.rb +41 -0
- data/test-unit/test/util/test_observable.rb +102 -0
- data/test-unit/test/util/test_procwrapper.rb +36 -0
- data/test/run-test.rb +2 -6
- metadata +197 -100
- data/src/glib-enum-types.c +0 -1032
- data/src/glib-enum-types.h +0 -140
- data/src/lib/pkg-config.rb +0 -137
- data/src/rbgutil.c +0 -222
data/{src → ext/glib2}/rbglib.h
RENAMED
|
@@ -22,8 +22,8 @@ extern "C" {
|
|
|
22
22
|
#endif /* __cplusplus */
|
|
23
23
|
|
|
24
24
|
#define RBGLIB_MAJOR_VERSION 0
|
|
25
|
-
#define RBGLIB_MINOR_VERSION
|
|
26
|
-
#define RBGLIB_MICRO_VERSION
|
|
25
|
+
#define RBGLIB_MINOR_VERSION 90
|
|
26
|
+
#define RBGLIB_MICRO_VERSION 2
|
|
27
27
|
|
|
28
28
|
#ifndef RSTRING_PTR
|
|
29
29
|
# define RSTRING_PTR(s) (RSTRING(s)->ptr)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -751,18 +751,16 @@ idle_add(argc, argv, self)
|
|
|
751
751
|
VALUE arg1, arg2, func, rb_id;
|
|
752
752
|
callback_info_t *info;
|
|
753
753
|
guint id;
|
|
754
|
-
gint priority;
|
|
754
|
+
gint priority = G_PRIORITY_DEFAULT_IDLE;
|
|
755
755
|
|
|
756
756
|
rb_scan_args(argc, argv, "02", &arg1, &arg2);
|
|
757
757
|
|
|
758
758
|
if (RVAL2CBOOL(rb_obj_is_kind_of(arg1, rb_cProc))) {
|
|
759
|
-
priority = G_PRIORITY_DEFAULT;
|
|
760
759
|
func = arg1;
|
|
761
760
|
} else if (RVAL2CBOOL(rb_obj_is_kind_of(arg1, rb_cInteger))) {
|
|
762
761
|
priority = NUM2INT(arg1);
|
|
763
762
|
func = rb_block_proc();
|
|
764
763
|
} else {
|
|
765
|
-
priority = G_PRIORITY_DEFAULT;
|
|
766
764
|
func = rb_block_proc();
|
|
767
765
|
}
|
|
768
766
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
data/ext/glib2/rbgutil.c
ADDED
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
|
2
|
+
/************************************************
|
|
3
|
+
|
|
4
|
+
rbgutil.c -
|
|
5
|
+
|
|
6
|
+
$Author: sakai $
|
|
7
|
+
$Date: 2007/07/07 08:15:26 $
|
|
8
|
+
|
|
9
|
+
Copyright (C) 2002-2004 Masao Mutoh
|
|
10
|
+
************************************************/
|
|
11
|
+
|
|
12
|
+
#include "rbgprivate.h"
|
|
13
|
+
|
|
14
|
+
ID rbgutil_id_module_eval;
|
|
15
|
+
|
|
16
|
+
static ID id_add_one_arg_setter;
|
|
17
|
+
static ID id_set_property;
|
|
18
|
+
static ID id_to_a;
|
|
19
|
+
static ID id_allocate;
|
|
20
|
+
|
|
21
|
+
void
|
|
22
|
+
rbgutil_set_properties(self, hash)
|
|
23
|
+
VALUE self, hash;
|
|
24
|
+
{
|
|
25
|
+
int i;
|
|
26
|
+
VALUE ary;
|
|
27
|
+
GObject* obj;
|
|
28
|
+
|
|
29
|
+
Check_Type(hash, T_HASH);
|
|
30
|
+
ary = rb_funcall(hash, id_to_a, 0);
|
|
31
|
+
obj = RVAL2GOBJ(self);
|
|
32
|
+
|
|
33
|
+
g_object_freeze_notify(obj);
|
|
34
|
+
for (i = 0; i < RARRAY_LEN(ary); i++) {
|
|
35
|
+
rb_funcall(self, id_set_property, 2,
|
|
36
|
+
RARRAY_PTR(RARRAY_PTR(ary)[i])[0],
|
|
37
|
+
RARRAY_PTR(RARRAY_PTR(ary)[i])[1]);
|
|
38
|
+
}
|
|
39
|
+
g_object_thaw_notify(obj);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
VALUE
|
|
43
|
+
rbgutil_glist2ary(const GList *const list)
|
|
44
|
+
{
|
|
45
|
+
VALUE ary;
|
|
46
|
+
const GList *i;
|
|
47
|
+
|
|
48
|
+
ary = rb_ary_new();
|
|
49
|
+
for (i = list; i != NULL; i = i->next)
|
|
50
|
+
rb_ary_push(ary, GOBJ2RVAL(i->data));
|
|
51
|
+
|
|
52
|
+
return ary;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
VALUE
|
|
56
|
+
rbgutil_glist2ary_and_free_body(VALUE data)
|
|
57
|
+
{
|
|
58
|
+
VALUE ary;
|
|
59
|
+
GList *i;
|
|
60
|
+
|
|
61
|
+
ary = rb_ary_new();
|
|
62
|
+
for (i = (GList *)data; i != NULL; i = i->next)
|
|
63
|
+
rb_ary_push(ary, GOBJ2RVAL(i->data));
|
|
64
|
+
|
|
65
|
+
return ary;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
VALUE
|
|
69
|
+
rbgutil_glist2ary_and_free_ensure(VALUE data)
|
|
70
|
+
{
|
|
71
|
+
g_list_free((GList *)data);
|
|
72
|
+
|
|
73
|
+
return Qnil;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
VALUE
|
|
77
|
+
rbgutil_glist2ary_and_free(GList *const list)
|
|
78
|
+
{
|
|
79
|
+
return rb_ensure(rbgutil_glist2ary_and_free_body, (VALUE)list,
|
|
80
|
+
rbgutil_glist2ary_and_free_ensure, (VALUE)list);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
VALUE
|
|
84
|
+
rbgutil_glist2ary_boxed(const GList *const list, GType gtype)
|
|
85
|
+
{
|
|
86
|
+
VALUE ary;
|
|
87
|
+
const GList *i;
|
|
88
|
+
|
|
89
|
+
ary = rb_ary_new();
|
|
90
|
+
for (i = list; i != NULL; i = i->next)
|
|
91
|
+
rb_ary_push(ary, BOXED2RVAL(i->data, gtype));
|
|
92
|
+
|
|
93
|
+
return ary;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
struct rbgutil_glist2ary_boxed_and_free_data
|
|
97
|
+
{
|
|
98
|
+
GList *const list;
|
|
99
|
+
GType gtype;
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
VALUE
|
|
103
|
+
rbgutil_glist2ary_boxed_and_free_body(VALUE data)
|
|
104
|
+
{
|
|
105
|
+
struct rbgutil_glist2ary_boxed_and_free_data *real;
|
|
106
|
+
VALUE ary;
|
|
107
|
+
GList *i;
|
|
108
|
+
|
|
109
|
+
real = (struct rbgutil_glist2ary_boxed_and_free_data *)data;
|
|
110
|
+
ary = rb_ary_new();
|
|
111
|
+
for (i = real->list; i != NULL; i = i->next)
|
|
112
|
+
rb_ary_push(ary, BOXED2RVAL(i->data, real->gtype));
|
|
113
|
+
|
|
114
|
+
return ary;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
VALUE
|
|
118
|
+
rbgutil_glist2ary_boxed_and_free_ensure(VALUE data)
|
|
119
|
+
{
|
|
120
|
+
g_list_free(((struct rbgutil_glist2ary_boxed_and_free_data *)data)->list);
|
|
121
|
+
|
|
122
|
+
return Qnil;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
VALUE
|
|
126
|
+
rbgutil_glist2ary_boxed_and_free(GList *const list, GType gtype)
|
|
127
|
+
{
|
|
128
|
+
struct rbgutil_glist2ary_boxed_and_free_data data = { list, gtype };
|
|
129
|
+
|
|
130
|
+
return rb_ensure(rbgutil_glist2ary_boxed_and_free_body, (VALUE)&data,
|
|
131
|
+
rbgutil_glist2ary_boxed_and_free_ensure, (VALUE)&data);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
VALUE
|
|
135
|
+
rbgutil_glist2ary_string(const GList *const list)
|
|
136
|
+
{
|
|
137
|
+
VALUE ary;
|
|
138
|
+
const GList *i;
|
|
139
|
+
|
|
140
|
+
ary = rb_ary_new();
|
|
141
|
+
for (i = list; i != NULL; i = i->next)
|
|
142
|
+
rb_ary_push(ary, CSTR2RVAL(i->data));
|
|
143
|
+
|
|
144
|
+
return ary;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
static VALUE
|
|
148
|
+
rbgutil_glist2ary_string_and_free_body(VALUE data)
|
|
149
|
+
{
|
|
150
|
+
VALUE ary;
|
|
151
|
+
GList *i;
|
|
152
|
+
|
|
153
|
+
ary = rb_ary_new();
|
|
154
|
+
for (i = (GList *)data; i != NULL; i = i->next)
|
|
155
|
+
rb_ary_push(ary, CSTR2RVAL(i->data));
|
|
156
|
+
|
|
157
|
+
return ary;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
static VALUE
|
|
161
|
+
rbgutil_glist2ary_string_and_free_ensure(VALUE data)
|
|
162
|
+
{
|
|
163
|
+
GList *i;
|
|
164
|
+
|
|
165
|
+
for (i = (GList *)data; i != NULL; i = i->next)
|
|
166
|
+
g_free(i->data);
|
|
167
|
+
g_list_free((GList *)data);
|
|
168
|
+
|
|
169
|
+
return Qnil;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
VALUE
|
|
173
|
+
rbgutil_glist2ary_string_and_free(GList *const list)
|
|
174
|
+
{
|
|
175
|
+
return rb_ensure(rbgutil_glist2ary_string_and_free_body, (VALUE)list,
|
|
176
|
+
rbgutil_glist2ary_string_and_free_ensure, (VALUE)list);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
VALUE
|
|
180
|
+
rbgutil_gslist2ary(const GSList *const list)
|
|
181
|
+
{
|
|
182
|
+
VALUE ary;
|
|
183
|
+
const GSList *i;
|
|
184
|
+
|
|
185
|
+
ary = rb_ary_new();
|
|
186
|
+
for (i = list; i != NULL; i = i->next)
|
|
187
|
+
rb_ary_push(ary, GOBJ2RVAL(i->data));
|
|
188
|
+
|
|
189
|
+
return ary;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
static VALUE
|
|
193
|
+
rbgutil_gslist2ary_and_free_body(VALUE data)
|
|
194
|
+
{
|
|
195
|
+
VALUE ary;
|
|
196
|
+
GSList *i;
|
|
197
|
+
|
|
198
|
+
ary = rb_ary_new();
|
|
199
|
+
for (i = (GSList *)data; i != NULL; i = i->next)
|
|
200
|
+
rb_ary_push(ary, GOBJ2RVAL(i->data));
|
|
201
|
+
|
|
202
|
+
return ary;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
static VALUE
|
|
206
|
+
rbgutil_gslist2ary_and_free_ensure(VALUE data)
|
|
207
|
+
{
|
|
208
|
+
g_slist_free((GSList *)data);
|
|
209
|
+
|
|
210
|
+
return Qnil;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
VALUE
|
|
214
|
+
rbgutil_gslist2ary_and_free(GSList *const list)
|
|
215
|
+
{
|
|
216
|
+
return rb_ensure(rbgutil_gslist2ary_and_free_body, (VALUE)list,
|
|
217
|
+
rbgutil_gslist2ary_and_free_ensure, (VALUE)list);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
VALUE
|
|
221
|
+
rbgutil_gslist2ary_boxed(const GSList *const list, GType gtype)
|
|
222
|
+
{
|
|
223
|
+
VALUE ary;
|
|
224
|
+
const GSList *i;
|
|
225
|
+
|
|
226
|
+
ary = rb_ary_new();
|
|
227
|
+
for (i = list; i != NULL; i = i->next)
|
|
228
|
+
rb_ary_push(ary, BOXED2RVAL(i->data, gtype));
|
|
229
|
+
|
|
230
|
+
return ary;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
struct rbgutil_gslist2ary_boxed_and_free_data
|
|
234
|
+
{
|
|
235
|
+
GSList *const list;
|
|
236
|
+
GType gtype;
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
static VALUE
|
|
240
|
+
rbgutil_gslist2ary_boxed_and_free_body(VALUE data)
|
|
241
|
+
{
|
|
242
|
+
struct rbgutil_gslist2ary_boxed_and_free_data *real;
|
|
243
|
+
VALUE ary;
|
|
244
|
+
GSList *i;
|
|
245
|
+
|
|
246
|
+
real = (struct rbgutil_gslist2ary_boxed_and_free_data *)data;
|
|
247
|
+
ary = rb_ary_new();
|
|
248
|
+
for (i = real->list; i != NULL; i = i->next)
|
|
249
|
+
rb_ary_push(ary, BOXED2RVAL(i->data, real->gtype));
|
|
250
|
+
|
|
251
|
+
return ary;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
static VALUE
|
|
255
|
+
rbgutil_gslist2ary_boxed_and_free_ensure(VALUE data)
|
|
256
|
+
{
|
|
257
|
+
g_slist_free(((struct rbgutil_gslist2ary_boxed_and_free_data *)data)->list);
|
|
258
|
+
|
|
259
|
+
return Qnil;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
VALUE
|
|
263
|
+
rbgutil_gslist2ary_boxed_and_free(GSList *const list, GType gtype)
|
|
264
|
+
{
|
|
265
|
+
struct rbgutil_gslist2ary_boxed_and_free_data data = { list, gtype };
|
|
266
|
+
|
|
267
|
+
return rb_ensure(rbgutil_gslist2ary_boxed_and_free_body, (VALUE)&data,
|
|
268
|
+
rbgutil_gslist2ary_boxed_and_free_ensure, (VALUE)&data);
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
VALUE
|
|
272
|
+
rbgutil_def_setters(klass)
|
|
273
|
+
VALUE klass;
|
|
274
|
+
{
|
|
275
|
+
return rb_funcall(mGLib, id_add_one_arg_setter, 1, klass);
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
VALUE
|
|
279
|
+
rbgutil_sym_g2r_func(from)
|
|
280
|
+
const GValue *from;
|
|
281
|
+
{
|
|
282
|
+
const gchar *str = g_value_get_string(from);
|
|
283
|
+
return str ? ID2SYM(rb_intern(str)) : Qnil;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
VALUE
|
|
287
|
+
rbgutil_generic_s_gtype(VALUE klass)
|
|
288
|
+
{
|
|
289
|
+
return rbgobj_gtype_new(CLASS2GTYPE(klass));
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
VALUE
|
|
293
|
+
rbgutil_generic_gtype(VALUE self)
|
|
294
|
+
{
|
|
295
|
+
return generic_s_gtype(CLASS_OF(self));
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
VALUE
|
|
299
|
+
rbgutil_string_set_utf8_encoding(VALUE string)
|
|
300
|
+
{
|
|
301
|
+
#ifdef HAVE_RB_STR_ENCODE
|
|
302
|
+
if (!NIL_P(string))
|
|
303
|
+
rb_enc_associate(string, rb_utf8_encoding());
|
|
304
|
+
#endif
|
|
305
|
+
return string;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
void
|
|
309
|
+
Init_gutil()
|
|
310
|
+
{
|
|
311
|
+
rbgutil_id_module_eval = rb_intern("module_eval");
|
|
312
|
+
id_set_property = rb_intern("set_property");
|
|
313
|
+
id_to_a = rb_intern("to_a");
|
|
314
|
+
id_add_one_arg_setter = rb_intern("__add_one_arg_setter");
|
|
315
|
+
id_allocate = rb_intern("allocate");
|
|
316
|
+
}
|
data/{src → ext/glib2}/rbgutil.h
RENAMED
|
@@ -51,16 +51,16 @@ extern "C" {
|
|
|
51
51
|
|
|
52
52
|
extern VALUE rbgutil_def_setters(VALUE klass);
|
|
53
53
|
extern void rbgutil_set_properties(VALUE self, VALUE hash);
|
|
54
|
-
extern VALUE rbgutil_glist2ary(GList*
|
|
55
|
-
extern VALUE rbgutil_glist2ary_boxed(GList* list, GType gtype);
|
|
56
|
-
extern VALUE rbgutil_glist2ary_string(GList* list);
|
|
54
|
+
extern VALUE rbgutil_glist2ary(const GList *list);
|
|
57
55
|
extern VALUE rbgutil_glist2ary_and_free(GList* list);
|
|
58
|
-
extern VALUE
|
|
59
|
-
extern VALUE
|
|
60
|
-
extern VALUE
|
|
61
|
-
extern VALUE
|
|
62
|
-
extern VALUE
|
|
63
|
-
extern VALUE
|
|
56
|
+
extern VALUE rbgutil_glist2ary_boxed(const GList *list, GType gtype);
|
|
57
|
+
extern VALUE rbgutil_glist2ary_boxed_and_free(GList *list, GType gtype);
|
|
58
|
+
extern VALUE rbgutil_glist2ary_string(const GList *list);
|
|
59
|
+
extern VALUE rbgutil_glist2ary_string_and_free(GList *list);
|
|
60
|
+
extern VALUE rbgutil_gslist2ary(const GSList *list);
|
|
61
|
+
extern VALUE rbgutil_gslist2ary_and_free(GSList *list);
|
|
62
|
+
extern VALUE rbgutil_gslist2ary_boxed(const GSList *list, GType gtype);
|
|
63
|
+
extern VALUE rbgutil_gslist2ary_boxed_and_free(GSList *list, GType gtype);
|
|
64
64
|
extern VALUE rbgutil_protect(VALUE (*proc) (VALUE), VALUE data);
|
|
65
65
|
extern VALUE rbgutil_invoke_callback(VALUE (*func)(VALUE), VALUE arg);
|
|
66
66
|
extern void rbgutil_start_callback_dispatch_thread(void);
|