gio2 0.90.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (88) hide show
  1. data/ChangeLog +60 -0
  2. data/README +34 -0
  3. data/Rakefile +76 -0
  4. data/ext/gio2/depend +5 -0
  5. data/ext/gio2/extconf.rb +91 -0
  6. data/ext/gio2/gappinfo.c +318 -0
  7. data/ext/gio2/gapplaunchcontext.c +79 -0
  8. data/ext/gio2/gasyncinitable.c +244 -0
  9. data/ext/gio2/gasyncresult.c +39 -0
  10. data/ext/gio2/gbufferedinputstream.c +184 -0
  11. data/ext/gio2/gbufferedoutputstream.c +82 -0
  12. data/ext/gio2/gcancellable.c +177 -0
  13. data/ext/gio2/gcharsetconverter.c +72 -0
  14. data/ext/gio2/gcontenttype.c +135 -0
  15. data/ext/gio2/gconverter.c +117 -0
  16. data/ext/gio2/gconverterinputstream.c +48 -0
  17. data/ext/gio2/gconverteroutputstream.c +48 -0
  18. data/ext/gio2/gdatainputstream.c +341 -0
  19. data/ext/gio2/gdataoutputstream.c +202 -0
  20. data/ext/gio2/gdesktopappinfo.c +90 -0
  21. data/ext/gio2/gdrive.c +267 -0
  22. data/ext/gio2/gemblem.c +71 -0
  23. data/ext/gio2/gemblemedicon.c +63 -0
  24. data/ext/gio2/gfile.c +2058 -0
  25. data/ext/gio2/gfileattribute.c +263 -0
  26. data/ext/gio2/gfileattributematcher.c +90 -0
  27. data/ext/gio2/gfiledescriptorbased.c +42 -0
  28. data/ext/gio2/gfileenumerator.c +167 -0
  29. data/ext/gio2/gfileicon.c +46 -0
  30. data/ext/gio2/gfileinfo.c +641 -0
  31. data/ext/gio2/gfileinputstream.c +92 -0
  32. data/ext/gio2/gfileiostream.c +98 -0
  33. data/ext/gio2/gfilemonitor.c +63 -0
  34. data/ext/gio2/gfilenamecompleter.c +72 -0
  35. data/ext/gio2/gfileoutputstream.c +100 -0
  36. data/ext/gio2/gfilterinputstream.c +56 -0
  37. data/ext/gio2/gfilteroutputstream.c +56 -0
  38. data/ext/gio2/gicon.c +69 -0
  39. data/ext/gio2/ginetaddress.c +188 -0
  40. data/ext/gio2/ginetsocketaddress.c +54 -0
  41. data/ext/gio2/ginitable.c +195 -0
  42. data/ext/gio2/ginputstream.c +341 -0
  43. data/ext/gio2/gio2.c +120 -0
  44. data/ext/gio2/gio2.def +2 -0
  45. data/ext/gio2/gio2.h +343 -0
  46. data/ext/gio2/gioerror.c +67 -0
  47. data/ext/gio2/giomodule.c +63 -0
  48. data/ext/gio2/gioscheduler.c +195 -0
  49. data/ext/gio2/giostream.c +129 -0
  50. data/ext/gio2/gloadableicon.c +91 -0
  51. data/ext/gio2/gmemoryinputstream.c +65 -0
  52. data/ext/gio2/gmemoryoutputstream.c +65 -0
  53. data/ext/gio2/gmount.c +283 -0
  54. data/ext/gio2/gmountoperation.c +168 -0
  55. data/ext/gio2/gnetworkaddress.c +71 -0
  56. data/ext/gio2/gnetworkservice.c +64 -0
  57. data/ext/gio2/goutputstream.c +343 -0
  58. data/ext/gio2/gresolver.c +230 -0
  59. data/ext/gio2/gseekable.c +89 -0
  60. data/ext/gio2/gsimpleasyncresult.c +153 -0
  61. data/ext/gio2/gsocket.c +451 -0
  62. data/ext/gio2/gsocketaddress.c +45 -0
  63. data/ext/gio2/gsocketclient.c +273 -0
  64. data/ext/gio2/gsocketconnectable.c +97 -0
  65. data/ext/gio2/gsocketconnection.c +82 -0
  66. data/ext/gio2/gsocketcontrolmessage.c +82 -0
  67. data/ext/gio2/gsocketlistener.c +239 -0
  68. data/ext/gio2/gsocketservice.c +64 -0
  69. data/ext/gio2/gsrvtarget.c +77 -0
  70. data/ext/gio2/gtcpconnection.c +48 -0
  71. data/ext/gio2/gthemedicon.c +86 -0
  72. data/ext/gio2/gthreadedsocketservice.c +39 -0
  73. data/ext/gio2/gunixconnection.c +69 -0
  74. data/ext/gio2/gunixfdlist.c +112 -0
  75. data/ext/gio2/gunixfdmessage.c +81 -0
  76. data/ext/gio2/gunixinputstream.c +73 -0
  77. data/ext/gio2/gunixmounts.c +346 -0
  78. data/ext/gio2/gunixoutputstream.c +73 -0
  79. data/ext/gio2/gunixsocketaddress.c +79 -0
  80. data/ext/gio2/gvfs.c +84 -0
  81. data/ext/gio2/gvolume.c +191 -0
  82. data/ext/gio2/gvolumemonitor.c +77 -0
  83. data/ext/gio2/gzlibcompressor.c +47 -0
  84. data/ext/gio2/gzlibdecompressor.c +43 -0
  85. data/ext/gio2/util.c +323 -0
  86. data/extconf.rb +49 -0
  87. data/lib/gio2.rb +141 -0
  88. metadata +184 -0
@@ -0,0 +1,263 @@
1
+ /* -*- c-file-style: "ruby" -*- */
2
+ /*
3
+ * Ruby/GIO: a Ruby binding of gio-2.0.x.
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.
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
+ */
20
+
21
+ #include "gio2.h"
22
+
23
+ static GFileAttributeInfo *
24
+ fileattributeinfo_copy(const GFileAttributeInfo *info)
25
+ {
26
+ return (GFileAttributeInfo *)info;
27
+ }
28
+
29
+ static void
30
+ fileattributeinfo_free(G_GNUC_UNUSED GFileAttributeInfo *info)
31
+ {
32
+ return;
33
+ }
34
+
35
+ static GType
36
+ g_file_attribute_info_get_type(void)
37
+ {
38
+ static GType our_type = 0;
39
+
40
+ if (our_type == 0)
41
+ our_type = g_boxed_type_register_static("GFileAttributeInfo",
42
+ (GBoxedCopyFunc)fileattributeinfo_copy,
43
+ (GBoxedFreeFunc)fileattributeinfo_free);
44
+
45
+ return our_type;
46
+ }
47
+
48
+ #define G_TYPE_FILE_ATTRIBUTE_INFO (g_file_attribute_info_get_type())
49
+
50
+ #define RVAL2GFILEATTRIBUTEINFO(object) \
51
+ ((GFileAttributeInfo *)(RVAL2BOXED(object, G_TYPE_FILE_ATTRIBUTE_INFO)))
52
+
53
+ #define GFILEATTRIBUTEINFO2RVAL(object) \
54
+ BOXED2RVAL(object, G_TYPE_FILE_ATTRIBUTE_INFO)
55
+
56
+ #define _SELF(value) RVAL2GFILEATTRIBUTEINFO(value)
57
+
58
+ #define GFILEATTRIBUTEINFOFLAGS2RVAL(value) \
59
+ GFLAGS2RVAL((value), G_TYPE_FILE_ATTRIBUTE_INFO_FLAGS)
60
+
61
+ #define RVAL2GFILEATTRIBUTEINFOFLAGS(value) \
62
+ RVAL2GFLAGS((value), G_TYPE_FILE_ATTRIBUTE_INFO_FLAGS)
63
+
64
+ #define RVAL2GFILEATTRIBUTEINFOFLAGSDEFAULT(value) \
65
+ RVAL2TYPE_WITH_DEFAULT((value), \
66
+ RVAL2GFILEATTRIBUTEINFOFLAGS, \
67
+ G_FILE_ATTRIBUTE_INFO_NONE)
68
+
69
+ static VALUE
70
+ fileattributeinfo_name(VALUE self)
71
+ {
72
+ return CSTR2RVAL(_SELF(self)->name);
73
+ }
74
+
75
+ static VALUE
76
+ fileattributeinfo_type(VALUE self)
77
+ {
78
+ return GFILEATTRIBUTETYPE2RVAL(_SELF(self)->type);
79
+ }
80
+
81
+ static VALUE
82
+ fileattributeinfo_flags(VALUE self)
83
+ {
84
+ return GFILEATTRIBUTEINFOFLAGS2RVAL(_SELF(self)->flags);
85
+ }
86
+
87
+ #undef _SELF
88
+
89
+ GType
90
+ g_file_attribute_info_list_get_type(void)
91
+ {
92
+ static GType our_type = 0;
93
+ if (our_type == 0)
94
+ our_type = g_boxed_type_register_static("GFileAttributeInfoList",
95
+ (GBoxedCopyFunc)g_file_attribute_info_list_ref,
96
+ (GBoxedFreeFunc)g_file_attribute_info_list_unref);
97
+ return our_type;
98
+ }
99
+
100
+ #define RVAL2GFILEATTRIBUTEINFOLIST(object) \
101
+ ((GFileAttributeInfoList *)(RVAL2BOXED(object, G_TYPE_FILE_ATTRIBUTE_INFO_LIST)))
102
+
103
+ #define _SELF(value) RVAL2GFILEATTRIBUTEINFOLIST(value)
104
+
105
+ static VALUE
106
+ fileattributeinfolist_initialize(VALUE self)
107
+ {
108
+ G_INITIALIZE(self, g_file_attribute_info_list_new());
109
+
110
+ return Qnil;
111
+ }
112
+
113
+ static VALUE
114
+ fileattributeinfolist_dup(VALUE self)
115
+ {
116
+ return GFILEATTRIBUTEINFOLIST2RVAL(g_file_attribute_info_list_dup(_SELF(self)));
117
+ }
118
+
119
+ static VALUE
120
+ fileattributeinfolist_lookup(VALUE self, VALUE name)
121
+ {
122
+ /* TODO: How do we deal with the const? */
123
+ return GFILEATTRIBUTEINFO2RVAL((GFileAttributeInfo *)g_file_attribute_info_list_lookup(_SELF(self),
124
+ RVAL2CSTR(name)));
125
+ }
126
+
127
+ static VALUE
128
+ fileattributeinfolist_add(int argc, VALUE *argv, VALUE self)
129
+ {
130
+ VALUE name, type, flags;
131
+
132
+ rb_scan_args(argc, argv, "21", &name, &type, &flags);
133
+
134
+ g_file_attribute_info_list_add(_SELF(self),
135
+ RVAL2CSTR(name),
136
+ RVAL2GFILEATTRIBUTETYPE(type),
137
+ RVAL2GFILEATTRIBUTEINFOFLAGSDEFAULT(flags));
138
+
139
+ return self;
140
+ }
141
+
142
+ static VALUE
143
+ fileattributeinfolist_each(VALUE self)
144
+ {
145
+ GFileAttributeInfoList *list = RVAL2GFILEATTRIBUTEINFOLIST(self);
146
+ int i;
147
+
148
+ for (i = 0; i < list->n_infos; i++)
149
+ rb_yield(GFILEATTRIBUTEINFO2RVAL(&list->infos[i]));
150
+
151
+ return self;
152
+ }
153
+
154
+ void
155
+ Init_gfileattribute(VALUE glib)
156
+ {
157
+ VALUE fileattribute, fileattributeinfo, fileattributeinfolist;
158
+
159
+ fileattribute = rb_define_module_under(glib, "FileAttribute");
160
+
161
+ rb_define_const(fileattribute, "STANDARD_TYPE", CSTR2RVAL(G_FILE_ATTRIBUTE_STANDARD_TYPE));
162
+ rb_define_const(fileattribute, "STANDARD_IS_HIDDEN", CSTR2RVAL(G_FILE_ATTRIBUTE_STANDARD_IS_HIDDEN));
163
+ rb_define_const(fileattribute, "STANDARD_IS_BACKUP", CSTR2RVAL(G_FILE_ATTRIBUTE_STANDARD_IS_BACKUP));
164
+ rb_define_const(fileattribute, "STANDARD_IS_SYMLINK", CSTR2RVAL(G_FILE_ATTRIBUTE_STANDARD_IS_SYMLINK));
165
+ rb_define_const(fileattribute, "STANDARD_IS_VIRTUAL", CSTR2RVAL(G_FILE_ATTRIBUTE_STANDARD_IS_VIRTUAL));
166
+ rb_define_const(fileattribute, "STANDARD_NAME", CSTR2RVAL(G_FILE_ATTRIBUTE_STANDARD_NAME));
167
+ rb_define_const(fileattribute, "STANDARD_DISPLAY_NAME", CSTR2RVAL(G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME));
168
+ rb_define_const(fileattribute, "STANDARD_EDIT_NAME", CSTR2RVAL(G_FILE_ATTRIBUTE_STANDARD_EDIT_NAME));
169
+ rb_define_const(fileattribute, "STANDARD_COPY_NAME", CSTR2RVAL(G_FILE_ATTRIBUTE_STANDARD_COPY_NAME));
170
+ rb_define_const(fileattribute, "STANDARD_DESCRIPTION", CSTR2RVAL(G_FILE_ATTRIBUTE_STANDARD_DESCRIPTION));
171
+ rb_define_const(fileattribute, "STANDARD_ICON", CSTR2RVAL(G_FILE_ATTRIBUTE_STANDARD_ICON));
172
+ rb_define_const(fileattribute, "STANDARD_CONTENT_TYPE", CSTR2RVAL(G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE));
173
+ rb_define_const(fileattribute, "STANDARD_FAST_CONTENT_TYPE", CSTR2RVAL(G_FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE));
174
+ rb_define_const(fileattribute, "STANDARD_SIZE", CSTR2RVAL(G_FILE_ATTRIBUTE_STANDARD_SIZE));
175
+ rb_define_const(fileattribute, "STANDARD_ALLOCATED_SIZE", CSTR2RVAL(G_FILE_ATTRIBUTE_STANDARD_ALLOCATED_SIZE));
176
+ rb_define_const(fileattribute, "STANDARD_SYMLINK_TARGET", CSTR2RVAL(G_FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET));
177
+ rb_define_const(fileattribute, "STANDARD_TARGET_URI", CSTR2RVAL(G_FILE_ATTRIBUTE_STANDARD_TARGET_URI));
178
+ rb_define_const(fileattribute, "STANDARD_SORT_ORDER", CSTR2RVAL(G_FILE_ATTRIBUTE_STANDARD_SORT_ORDER));
179
+ rb_define_const(fileattribute, "ETAG_VALUE", CSTR2RVAL(G_FILE_ATTRIBUTE_ETAG_VALUE));
180
+ rb_define_const(fileattribute, "ID_FILE", CSTR2RVAL(G_FILE_ATTRIBUTE_ID_FILE));
181
+ rb_define_const(fileattribute, "ID_FILESYSTEM", CSTR2RVAL(G_FILE_ATTRIBUTE_ID_FILESYSTEM));
182
+ rb_define_const(fileattribute, "ACCESS_CAN_READ", CSTR2RVAL(G_FILE_ATTRIBUTE_ACCESS_CAN_READ));
183
+ rb_define_const(fileattribute, "ACCESS_CAN_WRITE", CSTR2RVAL(G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE));
184
+ rb_define_const(fileattribute, "ACCESS_CAN_EXECUTE", CSTR2RVAL(G_FILE_ATTRIBUTE_ACCESS_CAN_EXECUTE));
185
+ rb_define_const(fileattribute, "ACCESS_CAN_DELETE", CSTR2RVAL(G_FILE_ATTRIBUTE_ACCESS_CAN_DELETE));
186
+ rb_define_const(fileattribute, "ACCESS_CAN_TRASH", CSTR2RVAL(G_FILE_ATTRIBUTE_ACCESS_CAN_TRASH));
187
+ rb_define_const(fileattribute, "ACCESS_CAN_RENAME", CSTR2RVAL(G_FILE_ATTRIBUTE_ACCESS_CAN_RENAME));
188
+ rb_define_const(fileattribute, "MOUNTABLE_CAN_MOUNT", CSTR2RVAL(G_FILE_ATTRIBUTE_MOUNTABLE_CAN_MOUNT));
189
+ rb_define_const(fileattribute, "MOUNTABLE_CAN_UNMOUNT", CSTR2RVAL(G_FILE_ATTRIBUTE_MOUNTABLE_CAN_UNMOUNT));
190
+ rb_define_const(fileattribute, "MOUNTABLE_CAN_EJECT", CSTR2RVAL(G_FILE_ATTRIBUTE_MOUNTABLE_CAN_EJECT));
191
+ rb_define_const(fileattribute, "MOUNTABLE_UNIX_DEVICE", CSTR2RVAL(G_FILE_ATTRIBUTE_MOUNTABLE_UNIX_DEVICE));
192
+ rb_define_const(fileattribute, "MOUNTABLE_UNIX_DEVICE_FILE", CSTR2RVAL(G_FILE_ATTRIBUTE_MOUNTABLE_UNIX_DEVICE_FILE));
193
+ rb_define_const(fileattribute, "MOUNTABLE_HAL_UDI", CSTR2RVAL(G_FILE_ATTRIBUTE_MOUNTABLE_HAL_UDI));
194
+ rb_define_const(fileattribute, "MOUNTABLE_CAN_POLL", CSTR2RVAL(G_FILE_ATTRIBUTE_MOUNTABLE_CAN_POLL));
195
+ rb_define_const(fileattribute, "MOUNTABLE_IS_MEDIA_CHECK_AUTOMATIC", CSTR2RVAL(G_FILE_ATTRIBUTE_MOUNTABLE_IS_MEDIA_CHECK_AUTOMATIC));
196
+ rb_define_const(fileattribute, "MOUNTABLE_CAN_START", CSTR2RVAL(G_FILE_ATTRIBUTE_MOUNTABLE_CAN_START));
197
+ rb_define_const(fileattribute, "MOUNTABLE_CAN_START_DEGRADED", CSTR2RVAL(G_FILE_ATTRIBUTE_MOUNTABLE_CAN_START_DEGRADED));
198
+ rb_define_const(fileattribute, "MOUNTABLE_CAN_STOP", CSTR2RVAL(G_FILE_ATTRIBUTE_MOUNTABLE_CAN_STOP));
199
+ rb_define_const(fileattribute, "MOUNTABLE_START_STOP_TYPE", CSTR2RVAL(G_FILE_ATTRIBUTE_MOUNTABLE_START_STOP_TYPE));
200
+ rb_define_const(fileattribute, "TIME_MODIFIED", CSTR2RVAL(G_FILE_ATTRIBUTE_TIME_MODIFIED));
201
+ rb_define_const(fileattribute, "TIME_MODIFIED_USEC", CSTR2RVAL(G_FILE_ATTRIBUTE_TIME_MODIFIED_USEC));
202
+ rb_define_const(fileattribute, "TIME_ACCESS", CSTR2RVAL(G_FILE_ATTRIBUTE_TIME_ACCESS));
203
+ rb_define_const(fileattribute, "TIME_ACCESS_USEC", CSTR2RVAL(G_FILE_ATTRIBUTE_TIME_ACCESS_USEC));
204
+ rb_define_const(fileattribute, "TIME_CHANGED", CSTR2RVAL(G_FILE_ATTRIBUTE_TIME_CHANGED));
205
+ rb_define_const(fileattribute, "TIME_CHANGED_USEC", CSTR2RVAL(G_FILE_ATTRIBUTE_TIME_CHANGED_USEC));
206
+ rb_define_const(fileattribute, "TIME_CREATED", CSTR2RVAL(G_FILE_ATTRIBUTE_TIME_CREATED));
207
+ rb_define_const(fileattribute, "TIME_CREATED_USEC", CSTR2RVAL(G_FILE_ATTRIBUTE_TIME_CREATED_USEC));
208
+ rb_define_const(fileattribute, "UNIX_DEVICE", CSTR2RVAL(G_FILE_ATTRIBUTE_UNIX_DEVICE));
209
+ rb_define_const(fileattribute, "UNIX_INODE", CSTR2RVAL(G_FILE_ATTRIBUTE_UNIX_INODE));
210
+ rb_define_const(fileattribute, "UNIX_MODE", CSTR2RVAL(G_FILE_ATTRIBUTE_UNIX_MODE));
211
+ rb_define_const(fileattribute, "UNIX_NLINK", CSTR2RVAL(G_FILE_ATTRIBUTE_UNIX_NLINK));
212
+ rb_define_const(fileattribute, "UNIX_UID", CSTR2RVAL(G_FILE_ATTRIBUTE_UNIX_UID));
213
+ rb_define_const(fileattribute, "UNIX_GID", CSTR2RVAL(G_FILE_ATTRIBUTE_UNIX_GID));
214
+ rb_define_const(fileattribute, "UNIX_RDEV", CSTR2RVAL(G_FILE_ATTRIBUTE_UNIX_RDEV));
215
+ rb_define_const(fileattribute, "UNIX_BLOCK_SIZE", CSTR2RVAL(G_FILE_ATTRIBUTE_UNIX_BLOCK_SIZE));
216
+ rb_define_const(fileattribute, "UNIX_BLOCKS", CSTR2RVAL(G_FILE_ATTRIBUTE_UNIX_BLOCKS));
217
+ rb_define_const(fileattribute, "UNIX_IS_MOUNTPOINT", CSTR2RVAL(G_FILE_ATTRIBUTE_UNIX_IS_MOUNTPOINT));
218
+ rb_define_const(fileattribute, "DOS_IS_ARCHIVE", CSTR2RVAL(G_FILE_ATTRIBUTE_DOS_IS_ARCHIVE));
219
+ rb_define_const(fileattribute, "DOS_IS_SYSTEM", CSTR2RVAL(G_FILE_ATTRIBUTE_DOS_IS_SYSTEM));
220
+ rb_define_const(fileattribute, "OWNER_USER", CSTR2RVAL(G_FILE_ATTRIBUTE_OWNER_USER));
221
+ rb_define_const(fileattribute, "OWNER_USER_REAL", CSTR2RVAL(G_FILE_ATTRIBUTE_OWNER_USER_REAL));
222
+ rb_define_const(fileattribute, "OWNER_GROUP", CSTR2RVAL(G_FILE_ATTRIBUTE_OWNER_GROUP));
223
+ rb_define_const(fileattribute, "THUMBNAIL_PATH", CSTR2RVAL(G_FILE_ATTRIBUTE_THUMBNAIL_PATH));
224
+ rb_define_const(fileattribute, "THUMBNAILING_FAILED", CSTR2RVAL(G_FILE_ATTRIBUTE_THUMBNAILING_FAILED));
225
+ rb_define_const(fileattribute, "PREVIEW_ICON", CSTR2RVAL(G_FILE_ATTRIBUTE_PREVIEW_ICON));
226
+ rb_define_const(fileattribute, "FILESYSTEM_SIZE", CSTR2RVAL(G_FILE_ATTRIBUTE_FILESYSTEM_SIZE));
227
+ rb_define_const(fileattribute, "FILESYSTEM_FREE", CSTR2RVAL(G_FILE_ATTRIBUTE_FILESYSTEM_FREE));
228
+ rb_define_const(fileattribute, "FILESYSTEM_TYPE", CSTR2RVAL(G_FILE_ATTRIBUTE_FILESYSTEM_TYPE));
229
+ rb_define_const(fileattribute, "FILESYSTEM_READONLY", CSTR2RVAL(G_FILE_ATTRIBUTE_FILESYSTEM_READONLY));
230
+ rb_define_const(fileattribute, "FILESYSTEM_USE_PREVIEW", CSTR2RVAL(G_FILE_ATTRIBUTE_FILESYSTEM_USE_PREVIEW));
231
+ rb_define_const(fileattribute, "GVFS_BACKEND", CSTR2RVAL(G_FILE_ATTRIBUTE_GVFS_BACKEND));
232
+ rb_define_const(fileattribute, "SELINUX_CONTEXT", CSTR2RVAL(G_FILE_ATTRIBUTE_SELINUX_CONTEXT));
233
+ rb_define_const(fileattribute, "TRASH_ITEM_COUNT", CSTR2RVAL(G_FILE_ATTRIBUTE_TRASH_ITEM_COUNT));
234
+
235
+ G_DEF_CLASS(G_TYPE_FILE_ATTRIBUTE_TYPE, "Type", fileattribute);
236
+ G_DEF_CONSTANTS(fileattribute, G_TYPE_FILE_ATTRIBUTE_TYPE, "G_FILE_ATTRIBUTE_");
237
+
238
+ G_DEF_CLASS(G_TYPE_FILE_ATTRIBUTE_INFO_FLAGS, "InfoFlags", fileattribute);
239
+ G_DEF_CONSTANTS(fileattribute, G_TYPE_FILE_ATTRIBUTE_INFO_FLAGS, "G_FILE_ATTRIBUTE_");
240
+
241
+ G_DEF_CLASS(G_TYPE_FILE_ATTRIBUTE_STATUS, "Status", fileattribute);
242
+ G_DEF_CONSTANTS(fileattribute, G_TYPE_FILE_ATTRIBUTE_STATUS, "G_FILE_ATTRIBUTE_");
243
+
244
+ fileattributeinfo = G_DEF_CLASS(G_TYPE_FILE_ATTRIBUTE_INFO, "Info", fileattribute);
245
+
246
+ rb_undef_alloc_func(fileattributeinfo);
247
+ rbgobj_boxed_not_copy_obj(G_TYPE_FILE_ATTRIBUTE_INFO);
248
+
249
+ rb_define_method(fileattributeinfo, "name", fileattributeinfo_name, 0);
250
+ rb_define_method(fileattributeinfo, "type", fileattributeinfo_type, 0);
251
+ rb_define_method(fileattributeinfo, "flags", fileattributeinfo_flags, 0);
252
+
253
+ fileattributeinfolist = G_DEF_CLASS(G_TYPE_FILE_ATTRIBUTE_INFO_LIST, "InfoList", fileattributeinfo);
254
+
255
+ rb_include_module(fileattributeinfolist, rb_mEnumerable);
256
+
257
+ rb_define_method(fileattributeinfolist, "initialize", fileattributeinfolist_initialize, 0);
258
+ rb_define_method(fileattributeinfolist, "dup", fileattributeinfolist_dup, 0);
259
+ rb_define_method(fileattributeinfolist, "lookup", fileattributeinfolist_lookup, 1);
260
+ rb_define_alias(fileattributeinfolist, "[]", "lookup");
261
+ rb_define_method(fileattributeinfolist, "add", fileattributeinfolist_add, 3);
262
+ rb_define_method(fileattributeinfolist, "each", fileattributeinfolist_each, 0);
263
+ }
@@ -0,0 +1,90 @@
1
+ /* -*- c-file-style: "ruby" -*- */
2
+ /*
3
+ * Ruby/GIO: a Ruby binding of gio-2.0.x.
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.
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
+ */
20
+
21
+ #include "gio2.h"
22
+
23
+ GType
24
+ g_file_attribute_matcher_get_type(void)
25
+ {
26
+ static GType our_type = 0;
27
+ if (our_type == 0)
28
+ our_type = g_boxed_type_register_static("GFileAttributeMatcher",
29
+ (GBoxedCopyFunc)g_file_attribute_matcher_ref,
30
+ (GBoxedFreeFunc)g_file_attribute_matcher_unref);
31
+ return our_type;
32
+ }
33
+
34
+ #define _SELF(value) RVAL2GFILEATTRIBUTEMATCHER(value)
35
+
36
+ static VALUE
37
+ fileattributematcher_initialize(VALUE self, VALUE attributes)
38
+ {
39
+ G_INITIALIZE(self, g_file_attribute_matcher_new(RVAL2CSTR(attributes)));
40
+
41
+ return Qnil;
42
+ }
43
+
44
+ static VALUE
45
+ fileattributematcher_matches(VALUE self, VALUE attribute)
46
+ {
47
+ return CBOOL2RVAL(g_file_attribute_matcher_matches(_SELF(self), RVAL2CSTR(attribute)));
48
+ }
49
+
50
+ static VALUE
51
+ fileattributematcher_matches_only(VALUE self, VALUE attribute)
52
+ {
53
+ return CBOOL2RVAL(g_file_attribute_matcher_matches_only(_SELF(self), RVAL2CSTR(attribute)));
54
+ }
55
+
56
+ static VALUE
57
+ fileattributematcher_enumerate_namespace(VALUE self, VALUE ns)
58
+ {
59
+ const char *match;
60
+ gboolean matches_all = g_file_attribute_matcher_enumerate_namespace(_SELF(self),
61
+ RVAL2CSTR(ns));
62
+ if (!rb_block_given_p())
63
+ return CBOOL2RVAL(matches_all);
64
+
65
+ while ((match = g_file_attribute_matcher_enumerate_next(_SELF(self))) != NULL)
66
+ rb_yield(CSTR2RVAL(match));
67
+
68
+ return self;
69
+ }
70
+
71
+ static VALUE
72
+ fileattributematcher_enumerate_next(VALUE self)
73
+ {
74
+ return CSTR2RVAL(g_file_attribute_matcher_enumerate_next(_SELF(self)));
75
+ }
76
+
77
+ void
78
+ Init_gfileattributematcher(VALUE glib)
79
+ {
80
+ VALUE fileattributematcher = G_DEF_CLASS(G_TYPE_FILE_ATTRIBUTE_MATCHER, "FileAttributeMatcher", glib);
81
+
82
+ rb_define_method(fileattributematcher, "initialize", fileattributematcher_initialize, 1);
83
+ rb_define_method(fileattributematcher, "matches?", fileattributematcher_matches, 1);
84
+ /* TODO: Is this confusing when we have both #matches and
85
+ * #matches_only? What does #=~ call? */
86
+ rb_define_alias(fileattributematcher, "=~", "matches?");
87
+ rb_define_method(fileattributematcher, "matches_only?", fileattributematcher_matches_only, 1);
88
+ rb_define_method(fileattributematcher, "enumerate_namespace", fileattributematcher_enumerate_namespace, 1);
89
+ rb_define_method(fileattributematcher, "enumerate_next", fileattributematcher_enumerate_next, 0);
90
+ }
@@ -0,0 +1,42 @@
1
+ /*
2
+ * Ruby/GIO: a Ruby binding of gio-2.0.x.
3
+ * Copyright (C) 2008-2009 Ruby-GNOME2 Project Team
4
+ *
5
+ * This library is free software; you can redistribute it and/or
6
+ * modify it under the terms of the GNU Lesser General Public
7
+ * License as published by the Free Software Foundation; either
8
+ * version 2.1 of the License.
9
+ *
10
+ * This library is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ * Lesser General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Lesser General Public
16
+ * License along with this library; if not, write to the Free Software
17
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
+ */
19
+
20
+ #include "gio2.h"
21
+
22
+ #ifdef HAVE_GIO_UNIX
23
+ #include <gio/gfiledescriptorbased.h>
24
+
25
+ #define _SELF(value) G_FILE_DESCRIPTOR_BASED(RVAL2GOBJ(value))
26
+
27
+ static VALUE
28
+ filedescriptorbased_get_fd(VALUE self)
29
+ {
30
+ return FD2RVAL(g_file_descriptor_based_get_fd(_SELF(self)));
31
+ }
32
+ #endif
33
+
34
+ void
35
+ Init_gfiledescriptorbased(G_GNUC_UNUSED VALUE glib)
36
+ {
37
+ #ifdef HAVE_GIO_UNIX
38
+ VALUE filedescriptorbased = G_DEF_INTERFACE(G_TYPE_FILE_DESCRIPTOR_BASED, "FileDescriptorBased", glib);
39
+
40
+ rb_define_method(filedescriptorbased, "fd", filedescriptorbased_get_fd, 0);
41
+ #endif
42
+ }
@@ -0,0 +1,167 @@
1
+ /* -*- c-file-style: "ruby" -*- */
2
+ /*
3
+ * Ruby/GIO: a Ruby binding of gio-2.0.x.
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.
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
+ */
20
+
21
+ #include "gio2.h"
22
+
23
+ #define _SELF(value) G_FILE_ENUMERATOR(RVAL2GOBJ(value))
24
+
25
+ static VALUE
26
+ fileenumerator_next_file(int argc, VALUE *argv, VALUE self)
27
+ {
28
+ VALUE cancellable;
29
+ GError *error = NULL;
30
+ GFileInfo *info;
31
+
32
+ rb_scan_args(argc, argv, "01", &cancellable);
33
+ info = g_file_enumerator_next_file(_SELF(self),
34
+ RVAL2GCANCELLABLE(cancellable),
35
+ &error);
36
+ if (error != NULL)
37
+ rbgio_raise_error(error);
38
+
39
+ return GOBJ2RVAL_UNREF(info);
40
+ }
41
+
42
+ static VALUE
43
+ fileenumerator_close(int argc, VALUE *argv, VALUE self)
44
+ {
45
+ VALUE cancellable;
46
+ GError *error = NULL;
47
+
48
+ rb_scan_args(argc, argv, "01", &cancellable);
49
+ if (!g_file_enumerator_close(_SELF(self), RVAL2GCANCELLABLE(cancellable), &error))
50
+ rbgio_raise_error(error);
51
+
52
+ return self;
53
+ }
54
+
55
+ static VALUE
56
+ fileenumerator_next_files_async(int argc, VALUE *argv, VALUE self)
57
+ {
58
+ VALUE rbnum_files, rbio_priority, rbcancellable, block;
59
+ int num_files;
60
+ int io_priority;
61
+ GCancellable *cancellable;
62
+
63
+ rb_scan_args(argc, argv, "12&", &rbnum_files, &rbio_priority, &rbcancellable, &block);
64
+ num_files = NUM2INT(rbnum_files);
65
+ io_priority = RVAL2IOPRIORITYDEFAULT(rbio_priority);
66
+ cancellable = RVAL2GCANCELLABLE(rbcancellable);
67
+ SAVE_BLOCK(block);
68
+ g_file_enumerator_next_files_async(_SELF(self),
69
+ num_files,
70
+ io_priority,
71
+ cancellable,
72
+ rbgio_async_ready_callback,
73
+ (gpointer)block);
74
+
75
+ return self;
76
+ }
77
+
78
+ static VALUE
79
+ fileenumerator_next_files_finish(VALUE self, VALUE result)
80
+ {
81
+ GError *error = NULL;
82
+ GList *files = g_file_enumerator_next_files_finish(_SELF(self),
83
+ RVAL2GASYNCRESULT(result),
84
+ &error);
85
+ if (error != NULL)
86
+ rbgio_raise_error(error);
87
+
88
+ return GLIST2ARY_FREE(files);
89
+ }
90
+
91
+ static VALUE
92
+ fileenumerator_close_async(int argc, VALUE *argv, VALUE self)
93
+ {
94
+ VALUE rbio_priority, rbcancellable, block;
95
+ int io_priority;
96
+ GCancellable *cancellable;
97
+
98
+ rb_scan_args(argc, argv, "02&", &rbio_priority, &rbcancellable, &block);
99
+ io_priority = RVAL2IOPRIORITYDEFAULT(rbio_priority);
100
+ cancellable = RVAL2GCANCELLABLE(rbcancellable);
101
+ SAVE_BLOCK(block);
102
+ g_file_enumerator_close_async(_SELF(self),
103
+ io_priority,
104
+ cancellable,
105
+ rbgio_async_ready_callback,
106
+ (gpointer)block);
107
+
108
+ return self;
109
+ }
110
+
111
+ static VALUE
112
+ fileenumerator_close_finish(VALUE self, VALUE result)
113
+ {
114
+ GError *error = NULL;
115
+ if (!g_file_enumerator_close_finish(_SELF(self),
116
+ RVAL2GASYNCRESULT(result),
117
+ &error))
118
+ rbgio_raise_error(error);
119
+
120
+ return Qnil;
121
+ }
122
+
123
+ static VALUE
124
+ fileenumerator_is_closed(VALUE self)
125
+ {
126
+ return CBOOL2RVAL(g_file_enumerator_is_closed(_SELF(self)));
127
+ }
128
+
129
+ static VALUE
130
+ fileenumerator_has_pending(VALUE self)
131
+ {
132
+ return CBOOL2RVAL(g_file_enumerator_has_pending(_SELF(self)));
133
+ }
134
+
135
+ static VALUE
136
+ fileenumerator_set_pending(VALUE self, VALUE pending)
137
+ {
138
+ g_file_enumerator_set_pending(_SELF(self), RVAL2CBOOL(pending));
139
+
140
+ return self;
141
+ }
142
+
143
+ static VALUE
144
+ fileenumerator_get_container(VALUE self)
145
+ {
146
+ return GOBJ2RVAL(g_file_enumerator_get_container(_SELF(self)));
147
+ }
148
+
149
+ void
150
+ Init_gfileenumerator(VALUE glib)
151
+ {
152
+ VALUE fileenumerator = G_DEF_CLASS(G_TYPE_FILE_ENUMERATOR, "FileEnumerator", glib);
153
+
154
+ rb_undef_alloc_func(fileenumerator);
155
+
156
+ rb_define_method(fileenumerator, "next_file", fileenumerator_next_file, -1);
157
+ rb_define_method(fileenumerator, "close", fileenumerator_close, -1);
158
+ rb_define_method(fileenumerator, "next_files_async", fileenumerator_next_files_async, -1);
159
+ rb_define_method(fileenumerator, "next_files_finish", fileenumerator_next_files_finish, 1);
160
+ rb_define_method(fileenumerator, "close_async", fileenumerator_close_async, -1);
161
+ rb_define_method(fileenumerator, "close_finish", fileenumerator_close_finish, 1);
162
+ rb_define_method(fileenumerator, "closed?", fileenumerator_is_closed, 0);
163
+ rb_define_method(fileenumerator, "has_pending?", fileenumerator_has_pending, 0);
164
+ rb_define_method(fileenumerator, "set_pending", fileenumerator_set_pending, 1);
165
+ G_DEF_SETTER(fileenumerator, "pending");
166
+ rb_define_method(fileenumerator, "container", fileenumerator_get_container, 0);
167
+ }