gio2 2.1.0 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (140) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +26 -9
  3. data/ext/gio2/extconf.rb +38 -28
  4. data/ext/gio2/rb-gio2-pollable-source.c +59 -0
  5. data/ext/gio2/{rbgiofilteroutputstream.c → rb-gio2.c} +9 -5
  6. data/ext/gio2/{gio2.c → rb-gio2.h} +5 -10
  7. data/extconf.rb +22 -6
  8. data/lib/gio2.rb +38 -143
  9. data/lib/gio2/deprecated.rb +16 -0
  10. data/lib/gio2/inet-address.rb +33 -0
  11. data/lib/gio2/input-stream.rb +39 -0
  12. data/lib/gio2/loader.rb +244 -0
  13. data/lib/gio2/output-stream.rb +24 -0
  14. data/lib/gio2/pollable-input-stream.rb +51 -0
  15. data/lib/gio2/pollable-output-stream.rb +32 -0
  16. data/lib/gio2/resources.rb +62 -0
  17. data/test/fixture/content-type/x-content/unix-software/autorun.sh +1 -0
  18. data/test/fixture/resource/Rakefile +32 -0
  19. data/test/fixture/resource/logo.png +0 -0
  20. data/test/fixture/resource/ruby-gio2.gresource +0 -0
  21. data/test/fixture/resource/ruby-gio2.gresource.xml +6 -0
  22. data/test/gio2-test-utils.rb +21 -0
  23. data/test/gio2-test-utils/fixture.rb +24 -0
  24. data/test/gio2-test-utils/socket-client.rb +59 -0
  25. data/test/run-test.rb +45 -9
  26. data/test/test-buffered-input-stream.rb +23 -0
  27. data/test/test-charset-converter.rb +23 -0
  28. data/test/test-content-type.rb +31 -0
  29. data/test/test-data-input-stream.rb +21 -0
  30. data/test/test-file-enumerator.rb +26 -0
  31. data/test/test-file-monitor.rb +33 -0
  32. data/test/test-file.rb +28 -0
  33. data/test/test-inet-address.rb +34 -0
  34. data/test/test-input-stream.rb +36 -0
  35. data/test/test-output-stream.rb +39 -0
  36. data/test/test-pollable-input-stream.rb +54 -0
  37. data/test/test-pollable-output-stream.rb +53 -0
  38. data/test/test-resources.rb +58 -0
  39. metadata +49 -107
  40. data/README +0 -34
  41. data/ext/gio2/depend +0 -11
  42. data/ext/gio2/gio2.def +0 -2
  43. data/ext/gio2/gio2.h +0 -30
  44. data/ext/gio2/rbgio.c +0 -133
  45. data/ext/gio2/rbgio2.h +0 -158
  46. data/ext/gio2/rbgio2conversions.h +0 -154
  47. data/ext/gio2/rbgio2private.h +0 -148
  48. data/ext/gio2/rbgioappinfo.c +0 -317
  49. data/ext/gio2/rbgioapplaunchcontext.c +0 -81
  50. data/ext/gio2/rbgioasyncinitable.c +0 -246
  51. data/ext/gio2/rbgioasyncresult.c +0 -41
  52. data/ext/gio2/rbgiobufferedinputstream.c +0 -167
  53. data/ext/gio2/rbgiobufferedoutputstream.c +0 -50
  54. data/ext/gio2/rbgiocancellable.c +0 -180
  55. data/ext/gio2/rbgiocharsetconverter.c +0 -57
  56. data/ext/gio2/rbgiocontenttype.c +0 -131
  57. data/ext/gio2/rbgioconverter.c +0 -113
  58. data/ext/gio2/rbgioconverterinputstream.c +0 -43
  59. data/ext/gio2/rbgioconverteroutputstream.c +0 -43
  60. data/ext/gio2/rbgiodatainputstream.c +0 -309
  61. data/ext/gio2/rbgiodataoutputstream.c +0 -186
  62. data/ext/gio2/rbgiodesktopappinfo.c +0 -87
  63. data/ext/gio2/rbgiodrive.c +0 -266
  64. data/ext/gio2/rbgioemblem.c +0 -52
  65. data/ext/gio2/rbgioemblemedicon.c +0 -65
  66. data/ext/gio2/rbgiofile.c +0 -2045
  67. data/ext/gio2/rbgiofileattribute.c +0 -114
  68. data/ext/gio2/rbgiofileattributeinfo.c +0 -86
  69. data/ext/gio2/rbgiofileattributeinfolist.c +0 -108
  70. data/ext/gio2/rbgiofileattributematcher.c +0 -95
  71. data/ext/gio2/rbgiofiledescriptorbased.c +0 -45
  72. data/ext/gio2/rbgiofileenumerator.c +0 -166
  73. data/ext/gio2/rbgiofileicon.c +0 -41
  74. data/ext/gio2/rbgiofileinfo.c +0 -617
  75. data/ext/gio2/rbgiofileinputstream.c +0 -91
  76. data/ext/gio2/rbgiofileiostream.c +0 -98
  77. data/ext/gio2/rbgiofilemonitor.c +0 -46
  78. data/ext/gio2/rbgiofilenamecompleter.c +0 -73
  79. data/ext/gio2/rbgiofileoutputstream.c +0 -98
  80. data/ext/gio2/rbgiofilterinputstream.c +0 -28
  81. data/ext/gio2/rbgioicon.c +0 -69
  82. data/ext/gio2/rbgioinetaddress.c +0 -118
  83. data/ext/gio2/rbgioinetsocketaddress.c +0 -41
  84. data/ext/gio2/rbgioinitable.c +0 -199
  85. data/ext/gio2/rbgioinputstream.c +0 -341
  86. data/ext/gio2/rbgioio.c +0 -73
  87. data/ext/gio2/rbgioiomodule.c +0 -45
  88. data/ext/gio2/rbgioiomodules.c +0 -47
  89. data/ext/gio2/rbgioioscheduler.c +0 -102
  90. data/ext/gio2/rbgioioschedulerjob.c +0 -121
  91. data/ext/gio2/rbgioiostream.c +0 -107
  92. data/ext/gio2/rbgioloadableicon.c +0 -92
  93. data/ext/gio2/rbgiomemoryinputstream.c +0 -67
  94. data/ext/gio2/rbgiomemoryoutputstream.c +0 -44
  95. data/ext/gio2/rbgiomount.c +0 -286
  96. data/ext/gio2/rbgiomountoperation.c +0 -53
  97. data/ext/gio2/rbgionetworkaddress.c +0 -59
  98. data/ext/gio2/rbgionetworkservice.c +0 -45
  99. data/ext/gio2/rbgiooutputstream.c +0 -331
  100. data/ext/gio2/rbgioresolver.c +0 -230
  101. data/ext/gio2/rbgioseekable.c +0 -91
  102. data/ext/gio2/rbgiosimpleasyncresult.c +0 -152
  103. data/ext/gio2/rbgiosocket.c +0 -390
  104. data/ext/gio2/rbgiosocketaddress.c +0 -34
  105. data/ext/gio2/rbgiosocketaddressenumerator.c +0 -83
  106. data/ext/gio2/rbgiosocketclient.c +0 -207
  107. data/ext/gio2/rbgiosocketconnectable.c +0 -41
  108. data/ext/gio2/rbgiosocketconnection.c +0 -66
  109. data/ext/gio2/rbgiosocketconnectionfactory.c +0 -39
  110. data/ext/gio2/rbgiosocketcontrolmessage.c +0 -82
  111. data/ext/gio2/rbgiosocketlistener.c +0 -246
  112. data/ext/gio2/rbgiosocketservice.c +0 -66
  113. data/ext/gio2/rbgiosrvtarget.c +0 -76
  114. data/ext/gio2/rbgiotcpconnection.c +0 -28
  115. data/ext/gio2/rbgiothemedicon.c +0 -83
  116. data/ext/gio2/rbgiothreadedsocketservice.c +0 -43
  117. data/ext/gio2/rbgiotlscertificate.c +0 -89
  118. data/ext/gio2/rbgiounixconnection.c +0 -71
  119. data/ext/gio2/rbgiounixfdlist.c +0 -115
  120. data/ext/gio2/rbgiounixfdmessage.c +0 -74
  121. data/ext/gio2/rbgiounixinputstream.c +0 -51
  122. data/ext/gio2/rbgiounixmount.c +0 -164
  123. data/ext/gio2/rbgiounixmountmonitor.c +0 -65
  124. data/ext/gio2/rbgiounixmountpoint.c +0 -136
  125. data/ext/gio2/rbgiounixmountpoints.c +0 -58
  126. data/ext/gio2/rbgiounixmounts.c +0 -58
  127. data/ext/gio2/rbgiounixoutputstream.c +0 -51
  128. data/ext/gio2/rbgiounixsocketaddress.c +0 -69
  129. data/ext/gio2/rbgiovfs.c +0 -84
  130. data/ext/gio2/rbgiovolume.c +0 -193
  131. data/ext/gio2/rbgiovolumemonitor.c +0 -77
  132. data/ext/gio2/rbgiozlibcompressor.c +0 -52
  133. data/ext/gio2/rbgiozlibdecompressor.c +0 -45
  134. data/ext/gio2/util.c +0 -303
  135. data/test/test_bufferedinputstream.rb +0 -9
  136. data/test/test_charsetconverter.rb +0 -9
  137. data/test/test_datainputstream.rb +0 -7
  138. data/test/test_fileenumerator.rb +0 -8
  139. data/test/test_filemonitor.rb +0 -17
  140. data/test/test_inetaddress.rb +0 -8
@@ -1,87 +0,0 @@
1
- /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /*
3
- * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
- * Copyright (C) 2008-2009 Ruby-GNOME2 Project Team
5
- *
6
- * This library is free software; you can redistribute it and/or
7
- * modify it under the terms of the GNU Lesser General Public
8
- * License as published by the Free Software Foundation; either
9
- * version 2.1 of the License, or (at your option) any later version.
10
- *
11
- * This library is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
- * Lesser General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU Lesser General Public
17
- * License along with this library; if not, write to the Free Software
18
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
- * MA 02110-1301 USA
20
- */
21
-
22
- #include "rbgio2private.h"
23
-
24
- #ifdef HAVE_GIO_UNIX
25
- #include <gio/gdesktopappinfo.h>
26
-
27
- #define RG_TARGET_NAMESPACE cDesktopAppInfo
28
- #define _SELF(value) RVAL2GDESKTOPAPPINFO(value)
29
-
30
- static VALUE
31
- rg_s_new_from_filename(G_GNUC_UNUSED VALUE self, VALUE filename)
32
- {
33
- return GOBJ2RVAL_UNREF(g_desktop_app_info_new_from_filename(RVAL2CSTR(filename)));
34
- }
35
-
36
- static VALUE
37
- rg_s_new_from_keyfile(G_GNUC_UNUSED VALUE self, VALUE keyfile)
38
- {
39
- return GOBJ2RVAL_UNREF(g_desktop_app_info_new_from_keyfile(RVAL2GKEYFILE(keyfile)));
40
- }
41
-
42
- static VALUE
43
- rg_initialize(VALUE self, VALUE desktop_id)
44
- {
45
- G_INITIALIZE(self, g_desktop_app_info_new(RVAL2CSTR(desktop_id)));
46
-
47
- return Qnil;
48
- }
49
-
50
- static VALUE
51
- rg_filename(VALUE self)
52
- {
53
- return CSTR2RVAL(g_desktop_app_info_get_filename(_SELF(self)));
54
- }
55
-
56
- static VALUE
57
- rg_hidden_p(VALUE self)
58
- {
59
- return CBOOL2RVAL(g_desktop_app_info_get_is_hidden(_SELF(self)));
60
- }
61
-
62
- static VALUE
63
- rg_s_set_desktop_env(G_GNUC_UNUSED VALUE self, VALUE desktop_env)
64
- {
65
- g_desktop_app_info_set_desktop_env(RVAL2CSTR(desktop_env));
66
-
67
- return self;
68
- }
69
-
70
- /* TODO: g_desktop_app_info_lookup_get_default_for_uri_scheme ()? */
71
- #endif
72
-
73
- void
74
- Init_gdesktopappinfo(G_GNUC_UNUSED VALUE mGio)
75
- {
76
- #ifdef HAVE_GIO_UNIX
77
- VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_DESKTOP_APP_INFO, "DesktopAppInfo", mGio);
78
-
79
- RG_DEF_SMETHOD(new_from_filename, 1);
80
- RG_DEF_SMETHOD(new_from_keyfile, 1);
81
- RG_DEF_SMETHOD(set_desktop_env, 1);
82
-
83
- RG_DEF_METHOD(initialize, 1);
84
- RG_DEF_METHOD(filename, 0);
85
- RG_DEF_METHOD_P(hidden, 0);
86
- #endif
87
- }
@@ -1,266 +0,0 @@
1
- /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /*
3
- * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
- * Copyright (C) 2008-2009 Ruby-GNOME2 Project Team
5
- *
6
- * This library is free software; you can redistribute it and/or
7
- * modify it under the terms of the GNU Lesser General Public
8
- * License as published by the Free Software Foundation; either
9
- * version 2.1 of the License, or (at your option) any later version.
10
- *
11
- * This library is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
- * Lesser General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU Lesser General Public
17
- * License along with this library; if not, write to the Free Software
18
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
- * MA 02110-1301 USA
20
- */
21
-
22
- #include "rbgio2private.h"
23
-
24
- #define RG_TARGET_NAMESPACE mDrive
25
- #define _SELF(value) RVAL2GDRIVE(value)
26
-
27
- static VALUE
28
- rg_name(VALUE self)
29
- {
30
- return CSTR2RVAL_FREE(g_drive_get_name(_SELF(self)));
31
- }
32
-
33
- static VALUE
34
- rg_icon(VALUE self)
35
- {
36
- return GOBJ2RVAL_UNREF(g_drive_get_icon(_SELF(self)));
37
- }
38
-
39
- static VALUE
40
- rg_has_volumes_p(VALUE self)
41
- {
42
- return CBOOL2RVAL(g_drive_has_volumes(_SELF(self)));
43
- }
44
-
45
- static VALUE
46
- rg_volumes(VALUE self)
47
- {
48
- return GLIST2ARY_FREE(g_drive_get_volumes(_SELF(self)));
49
- }
50
-
51
- static VALUE
52
- rg_can_eject_p(VALUE self)
53
- {
54
- return CBOOL2RVAL(g_drive_can_eject(_SELF(self)));
55
- }
56
-
57
- static VALUE
58
- rg_start_stop_type(VALUE self)
59
- {
60
- return GDRIVESTARTSTOPTYPE2RVAL(g_drive_get_start_stop_type(_SELF(self)));
61
- }
62
-
63
- static VALUE
64
- rg_can_start_p(VALUE self)
65
- {
66
- return CBOOL2RVAL(g_drive_can_start(_SELF(self)));
67
- }
68
-
69
- static VALUE
70
- rg_can_start_degraded_p(VALUE self)
71
- {
72
- return CBOOL2RVAL(g_drive_can_start_degraded(_SELF(self)));
73
- }
74
-
75
- static VALUE
76
- rg_can_stop_p(VALUE self)
77
- {
78
- return CBOOL2RVAL(g_drive_can_stop(_SELF(self)));
79
- }
80
-
81
- static VALUE
82
- rg_can_poll_for_media_p(VALUE self)
83
- {
84
- return CBOOL2RVAL(g_drive_can_poll_for_media(_SELF(self)));
85
- }
86
-
87
- static VALUE
88
- rg_poll_for_media(int argc, VALUE *argv, VALUE self)
89
- {
90
- VALUE rbcancellable, block;
91
- GCancellable *cancellable;
92
-
93
- rb_scan_args(argc, argv, "01&", &rbcancellable, &block);
94
- cancellable = RVAL2GCANCELLABLE(rbcancellable);
95
- g_drive_poll_for_media(_SELF(self),
96
- cancellable,
97
- rbgio_async_ready_callback,
98
- (gpointer)block);
99
-
100
- return self;
101
- }
102
-
103
- typedef gboolean (*BooleanFinishMethod)(GDrive *, GAsyncResult *, GError **);
104
-
105
- static VALUE
106
- boolean_finish_method(BooleanFinishMethod method, VALUE self, VALUE result)
107
- {
108
- GError *error = NULL;
109
-
110
- if (!method(_SELF(self), RVAL2GASYNCRESULT(result), &error))
111
- rbgio_raise_error(error);
112
-
113
- return self;
114
- }
115
-
116
- static VALUE
117
- rg_poll_for_media_finish(VALUE self, VALUE result)
118
- {
119
- return boolean_finish_method(g_drive_poll_for_media_finish, self, result);
120
- }
121
-
122
- static VALUE
123
- rg_has_media_p(VALUE self)
124
- {
125
- return CBOOL2RVAL(g_drive_has_media(_SELF(self)));
126
- }
127
-
128
- static VALUE
129
- rg_media_check_automatic_p(VALUE self)
130
- {
131
- return CBOOL2RVAL(g_drive_is_media_check_automatic(_SELF(self)));
132
- }
133
-
134
- static VALUE
135
- rg_media_removable_p(VALUE self)
136
- {
137
- return CBOOL2RVAL(g_drive_is_media_removable(_SELF(self)));
138
- }
139
-
140
- typedef void (*EjectStopMethod)(GDrive *,
141
- GMountUnmountFlags,
142
- GMountOperation *,
143
- GCancellable *,
144
- GAsyncReadyCallback,
145
- gpointer);
146
-
147
- static VALUE
148
- eject_stop_method(EjectStopMethod method, int argc, VALUE *argv, VALUE self)
149
- {
150
- VALUE rbflags, rbmount_operation, rbcancellable, block;
151
- GMountUnmountFlags flags;
152
- GMountOperation *mount_operation;
153
- GCancellable *cancellable;
154
-
155
- rb_scan_args(argc, argv, "03&", &rbflags, &rbmount_operation, &rbcancellable, &block);
156
- flags = RVAL2GMOUNTUNMOUNTFLAGSDEFAULT(rbflags);
157
- mount_operation = RVAL2GMOUNTOPERATION(rbmount_operation);
158
- cancellable = RVAL2GCANCELLABLE(rbcancellable);
159
- SAVE_BLOCK(block);
160
- method(_SELF(self),
161
- flags,
162
- mount_operation,
163
- cancellable,
164
- rbgio_async_ready_callback,
165
- (gpointer)block);
166
-
167
- return self;
168
- }
169
-
170
- static VALUE
171
- rg_eject_with_operation(int argc, VALUE *argv, VALUE self)
172
- {
173
- return eject_stop_method(g_drive_eject_with_operation, argc, argv, self);
174
- }
175
-
176
- static VALUE
177
- rg_eject_with_operation_finish(VALUE self, VALUE result)
178
- {
179
- return boolean_finish_method(g_drive_eject_with_operation_finish, self, result);
180
- }
181
-
182
- static VALUE
183
- rg_start(int argc, VALUE *argv, VALUE self)
184
- {
185
- VALUE rbflags, rbmount_operation, rbcancellable, block;
186
- GDriveStartFlags flags;
187
- GMountOperation *mount_operation;
188
- GCancellable *cancellable;
189
-
190
- rb_scan_args(argc, argv, "03", &rbflags, &rbmount_operation, &rbcancellable, &block);
191
- flags = RVAL2GDRIVESTARTFLAGSDEFAULT(rbflags);
192
- mount_operation = RVAL2GMOUNTOPERATION(rbmount_operation);
193
- cancellable = RVAL2GCANCELLABLE(rbcancellable);
194
- SAVE_BLOCK(block);
195
- g_drive_start(_SELF(self), flags, mount_operation, cancellable,
196
- rbgio_async_ready_callback, (gpointer)block);
197
-
198
- return self;
199
- }
200
-
201
- static VALUE
202
- rg_start_finish(VALUE self, VALUE result)
203
- {
204
- return boolean_finish_method(g_drive_start_finish, self, result);
205
- }
206
-
207
- static VALUE
208
- rg_stop(int argc, VALUE *argv, VALUE self)
209
- {
210
- return eject_stop_method(g_drive_stop, argc, argv, self);
211
- }
212
-
213
- static VALUE
214
- rg_stop_finish(VALUE self, VALUE result)
215
- {
216
- return boolean_finish_method(g_drive_stop_finish, self, result);
217
- }
218
-
219
- static VALUE
220
- rg_enumerate_identifiers(VALUE self)
221
- {
222
- return STRV2RVAL_FREE(g_drive_enumerate_identifiers(_SELF(self)));
223
- }
224
-
225
- static VALUE
226
- rg_get_identifier(VALUE self, VALUE kind)
227
- {
228
- return CSTR2RVAL_FREE(g_drive_get_identifier(_SELF(self), RVAL2CSTR(kind)));
229
- }
230
-
231
- void
232
- Init_gdrive(VALUE mGio)
233
- {
234
- VALUE RG_TARGET_NAMESPACE = G_DEF_INTERFACE(G_TYPE_DRIVE, "Drive", mGio);
235
-
236
- G_DEF_CLASS(G_TYPE_DRIVE_START_FLAGS, "StartFlags", RG_TARGET_NAMESPACE);
237
- G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, G_TYPE_DRIVE_START_FLAGS, "G_DRIVE_");
238
-
239
- G_DEF_CLASS(G_TYPE_DRIVE_START_STOP_TYPE, "StartStopType", RG_TARGET_NAMESPACE);
240
- G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, G_TYPE_DRIVE_START_STOP_TYPE, "G_DRIVE_");
241
-
242
- RG_DEF_METHOD(name, 0);
243
- RG_DEF_METHOD(icon, 0);
244
- RG_DEF_METHOD_P(has_volumes, 0);
245
- RG_DEF_METHOD(volumes, 0);
246
- RG_DEF_METHOD_P(can_eject, 0);
247
- RG_DEF_METHOD(start_stop_type, 0);
248
- RG_DEF_METHOD_P(can_start, 0);
249
- RG_DEF_METHOD_P(can_start_degraded, 0);
250
- RG_DEF_METHOD_P(can_stop, 0);
251
- RG_DEF_METHOD_P(can_poll_for_media, 0);
252
- RG_DEF_METHOD(poll_for_media, -1);
253
- RG_DEF_METHOD(poll_for_media_finish, 1);
254
- RG_DEF_METHOD_P(has_media, 0);
255
- RG_DEF_METHOD_P(media_check_automatic, 0);
256
- RG_DEF_METHOD_P(media_removable, 0);
257
- RG_DEF_METHOD(eject_with_operation, -1);
258
- RG_DEF_METHOD(eject_with_operation_finish, 1);
259
- RG_DEF_METHOD(start, -1);
260
- RG_DEF_METHOD(start_finish, 1);
261
- RG_DEF_METHOD(stop, -1);
262
- RG_DEF_METHOD(stop_finish, 1);
263
- RG_DEF_METHOD(enumerate_identifiers, -1);
264
- RG_DEF_ALIAS("identifiers", "enumerate_identifiers");
265
- RG_DEF_METHOD(get_identifier, 1);
266
- }
@@ -1,52 +0,0 @@
1
- /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /*
3
- * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
- * Copyright (C) 2008-2009 Ruby-GNOME2 Project Team
5
- *
6
- * This library is free software; you can redistribute it and/or
7
- * modify it under the terms of the GNU Lesser General Public
8
- * License as published by the Free Software Foundation; either
9
- * version 2.1 of the License, or (at your option) any later version.
10
- *
11
- * This library is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
- * Lesser General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU Lesser General Public
17
- * License along with this library; if not, write to the Free Software
18
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
- * MA 02110-1301 USA
20
- */
21
-
22
- #include "rbgio2private.h"
23
-
24
- #define RG_TARGET_NAMESPACE cEmblem
25
-
26
- static VALUE
27
- rg_initialize(int argc, VALUE *argv, VALUE self)
28
- {
29
- VALUE rbicon, origin;
30
- GIcon *icon;
31
- GEmblem *emblem;
32
-
33
- rb_scan_args(argc, argv, "11", &rbicon, &origin);
34
- icon = RVAL2GICON(rbicon);
35
- emblem = NIL_P(origin) ?
36
- g_emblem_new(icon) :
37
- g_emblem_new_with_origin(icon, RVAL2GEMBLEMORIGIN(origin));
38
- G_INITIALIZE(self, emblem);
39
-
40
- return Qnil;
41
- }
42
-
43
- void
44
- Init_gemblem(VALUE mGio)
45
- {
46
- VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_EMBLEM, "Emblem", mGio);
47
-
48
- G_DEF_CLASS(G_TYPE_EMBLEM_ORIGIN, "Origin", RG_TARGET_NAMESPACE);
49
- G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, G_TYPE_EMBLEM_ORIGIN, "G_EMBLEM_");
50
-
51
- RG_DEF_METHOD(initialize, -1);
52
- }
@@ -1,65 +0,0 @@
1
- /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /*
3
- * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
- * Copyright (C) 2008-2009 Ruby-GNOME2 Project Team
5
- *
6
- * This library is free software; you can redistribute it and/or
7
- * modify it under the terms of the GNU Lesser General Public
8
- * License as published by the Free Software Foundation; either
9
- * version 2.1 of the License, or (at your option) any later version.
10
- *
11
- * This library is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
- * Lesser General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU Lesser General Public
17
- * License along with this library; if not, write to the Free Software
18
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
- * MA 02110-1301 USA
20
- */
21
-
22
- #include "rbgio2private.h"
23
-
24
- #define RG_TARGET_NAMESPACE cEmblemedIcon
25
- #define _SELF(value) RVAL2GEMBLEMEDICON(value)
26
-
27
- static VALUE
28
- rg_initialize(VALUE self, VALUE icon, VALUE emblem)
29
- {
30
- G_INITIALIZE(self, g_emblemed_icon_new(RVAL2GICON(icon), RVAL2GEMBLEM(emblem)));
31
-
32
- return Qnil;
33
- }
34
-
35
- static VALUE
36
- rg_icon(VALUE self)
37
- {
38
- return GOBJ2RVAL(g_emblemed_icon_get_icon(_SELF(self)));
39
- }
40
-
41
- static VALUE
42
- rg_emblems(VALUE self)
43
- {
44
- return GLIST2ARY_FREE(g_emblemed_icon_get_emblems(_SELF(self)));
45
- }
46
-
47
- static VALUE
48
- rg_add_emblem(VALUE self, VALUE emblem)
49
- {
50
- g_emblemed_icon_add_emblem(_SELF(self), RVAL2GEMBLEM(emblem));
51
-
52
- return self;
53
- }
54
-
55
- void
56
- Init_gemblemedicon(VALUE mGio)
57
- {
58
- VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_EMBLEMED_ICON, "EmblemedIcon", mGio);
59
-
60
- RG_DEF_METHOD(initialize, 2);
61
- RG_DEF_METHOD(icon, 0);
62
- RG_DEF_METHOD(emblems, 0);
63
- RG_DEF_METHOD(add_emblem, 1);
64
- RG_DEF_ALIAS("<<", "add_emblem");
65
- }