gio2 1.0.3 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (154) hide show
  1. data/ext/gio2/extconf.rb +4 -42
  2. data/ext/gio2/gio2.c +18 -117
  3. data/ext/gio2/gio2.h +20 -339
  4. data/ext/gio2/rbgio.c +132 -0
  5. data/ext/gio2/rbgio2.h +156 -0
  6. data/ext/gio2/rbgio2conversions.h +154 -0
  7. data/ext/gio2/rbgio2private.h +147 -0
  8. data/ext/gio2/{gappinfo.c → rbgioappinfo.c} +81 -82
  9. data/ext/gio2/rbgioapplaunchcontext.c +81 -0
  10. data/ext/gio2/{gasyncinitable.c → rbgioasyncinitable.c} +33 -30
  11. data/ext/gio2/rbgioasyncresult.c +41 -0
  12. data/ext/gio2/{gbufferedinputstream.c → rbgiobufferedinputstream.c} +37 -35
  13. data/ext/gio2/rbgiobufferedoutputstream.c +50 -0
  14. data/ext/gio2/rbgiocancellable.c +180 -0
  15. data/ext/gio2/rbgiocharsetconverter.c +57 -0
  16. data/ext/gio2/rbgiocontenttype.c +131 -0
  17. data/ext/gio2/{gconverter.c → rbgioconverter.c} +24 -28
  18. data/ext/gio2/rbgioconverterinputstream.c +43 -0
  19. data/ext/gio2/rbgioconverteroutputstream.c +43 -0
  20. data/ext/gio2/{gdatainputstream.c → rbgiodatainputstream.c} +49 -58
  21. data/ext/gio2/{gdataoutputstream.c → rbgiodataoutputstream.c} +39 -37
  22. data/ext/gio2/rbgiodesktopappinfo.c +87 -0
  23. data/ext/gio2/{gdrive.c → rbgiodrive.c} +75 -76
  24. data/ext/gio2/rbgioemblem.c +52 -0
  25. data/ext/gio2/rbgioemblemedicon.c +65 -0
  26. data/ext/gio2/{gfile.c → rbgiofile.c} +256 -266
  27. data/ext/gio2/rbgiofileattribute.c +114 -0
  28. data/ext/gio2/rbgiofileattributeinfo.c +86 -0
  29. data/ext/gio2/rbgiofileattributeinfolist.c +106 -0
  30. data/ext/gio2/rbgiofileattributematcher.c +93 -0
  31. data/ext/gio2/rbgiofiledescriptorbased.c +45 -0
  32. data/ext/gio2/{gfileenumerator.c → rbgiofileenumerator.c} +42 -40
  33. data/ext/gio2/rbgiofileicon.c +41 -0
  34. data/ext/gio2/{gfileinfo.c → rbgiofileinfo.c} +159 -163
  35. data/ext/gio2/{gfileinputstream.c → rbgiofileinputstream.c} +26 -25
  36. data/ext/gio2/{gfileiostream.c → rbgiofileiostream.c} +28 -26
  37. data/ext/gio2/rbgiofilemonitor.c +46 -0
  38. data/ext/gio2/rbgiofilenamecompleter.c +74 -0
  39. data/ext/gio2/{gfileoutputstream.c → rbgiofileoutputstream.c} +28 -26
  40. data/ext/gio2/rbgiofilterinputstream.c +28 -0
  41. data/ext/gio2/rbgiofilteroutputstream.c +28 -0
  42. data/ext/gio2/rbgioicon.c +69 -0
  43. data/ext/gio2/rbgioinetaddress.c +118 -0
  44. data/ext/gio2/rbgioinetsocketaddress.c +41 -0
  45. data/ext/gio2/{ginitable.c → rbgioinitable.c} +29 -25
  46. data/ext/gio2/{ginputstream.c → rbgioinputstream.c} +50 -48
  47. data/ext/gio2/rbgioio.c +73 -0
  48. data/ext/gio2/rbgioiomodule.c +45 -0
  49. data/ext/gio2/rbgioiomodules.c +47 -0
  50. data/ext/gio2/rbgioioscheduler.c +102 -0
  51. data/ext/gio2/rbgioioschedulerjob.c +121 -0
  52. data/ext/gio2/rbgioiostream.c +108 -0
  53. data/ext/gio2/{gloadableicon.c → rbgioloadableicon.c} +26 -24
  54. data/ext/gio2/rbgiomemoryinputstream.c +67 -0
  55. data/ext/gio2/rbgiomemoryoutputstream.c +44 -0
  56. data/ext/gio2/{gmount.c → rbgiomount.c} +70 -68
  57. data/ext/gio2/rbgiomountoperation.c +53 -0
  58. data/ext/gio2/rbgionetworkaddress.c +59 -0
  59. data/ext/gio2/rbgionetworkservice.c +45 -0
  60. data/ext/gio2/{goutputstream.c → rbgiooutputstream.c} +61 -62
  61. data/ext/gio2/{gresolver.c → rbgioresolver.c} +50 -48
  62. data/ext/gio2/rbgioseekable.c +91 -0
  63. data/ext/gio2/rbgiosimpleasyncresult.c +155 -0
  64. data/ext/gio2/{gsocket.c → rbgiosocket.c} +74 -76
  65. data/ext/gio2/rbgiosocketaddress.c +34 -0
  66. data/ext/gio2/rbgiosocketaddressenumerator.c +83 -0
  67. data/ext/gio2/{gsocketclient.c → rbgiosocketclient.c} +41 -39
  68. data/ext/gio2/rbgiosocketconnectable.c +41 -0
  69. data/ext/gio2/rbgiosocketconnection.c +66 -0
  70. data/ext/gio2/rbgiosocketconnectionfactory.c +39 -0
  71. data/ext/gio2/rbgiosocketcontrolmessage.c +82 -0
  72. data/ext/gio2/{gsocketlistener.c → rbgiosocketlistener.c} +49 -47
  73. data/ext/gio2/rbgiosocketservice.c +66 -0
  74. data/ext/gio2/rbgiosrvtarget.c +76 -0
  75. data/ext/gio2/rbgiotcpconnection.c +28 -0
  76. data/ext/gio2/rbgiothemedicon.c +83 -0
  77. data/ext/gio2/rbgiothreadedsocketservice.c +43 -0
  78. data/ext/gio2/rbgiounixconnection.c +71 -0
  79. data/ext/gio2/rbgiounixfdlist.c +115 -0
  80. data/ext/gio2/rbgiounixfdmessage.c +74 -0
  81. data/ext/gio2/rbgiounixinputstream.c +51 -0
  82. data/ext/gio2/rbgiounixmount.c +164 -0
  83. data/ext/gio2/rbgiounixmountmonitor.c +66 -0
  84. data/ext/gio2/rbgiounixmountpoint.c +136 -0
  85. data/ext/gio2/rbgiounixmountpoints.c +58 -0
  86. data/ext/gio2/rbgiounixmounts.c +58 -0
  87. data/ext/gio2/rbgiounixoutputstream.c +51 -0
  88. data/ext/gio2/rbgiounixsocketaddress.c +69 -0
  89. data/ext/gio2/rbgiovfs.c +84 -0
  90. data/ext/gio2/rbgiovolume.c +193 -0
  91. data/ext/gio2/rbgiovolumemonitor.c +77 -0
  92. data/ext/gio2/rbgiozlibcompressor.c +52 -0
  93. data/ext/gio2/rbgiozlibdecompressor.c +45 -0
  94. data/ext/gio2/util.c +57 -60
  95. data/lib/gio2/deprecated.rb +102 -0
  96. data/lib/gio2.rb +14 -12
  97. metadata +100 -88
  98. data/ChangeLog +0 -129
  99. data/ext/gio2/gapplaunchcontext.c +0 -79
  100. data/ext/gio2/gasyncresult.c +0 -39
  101. data/ext/gio2/gbufferedoutputstream.c +0 -48
  102. data/ext/gio2/gcancellable.c +0 -177
  103. data/ext/gio2/gcharsetconverter.c +0 -55
  104. data/ext/gio2/gcontenttype.c +0 -128
  105. data/ext/gio2/gconverterinputstream.c +0 -41
  106. data/ext/gio2/gconverteroutputstream.c +0 -41
  107. data/ext/gio2/gdesktopappinfo.c +0 -88
  108. data/ext/gio2/gemblem.c +0 -52
  109. data/ext/gio2/gemblemedicon.c +0 -63
  110. data/ext/gio2/gfileattribute.c +0 -111
  111. data/ext/gio2/gfileattributeinfo.c +0 -89
  112. data/ext/gio2/gfileattributeinfolist.c +0 -109
  113. data/ext/gio2/gfileattributematcher.c +0 -90
  114. data/ext/gio2/gfiledescriptorbased.c +0 -42
  115. data/ext/gio2/gfileicon.c +0 -39
  116. data/ext/gio2/gfilemonitor.c +0 -44
  117. data/ext/gio2/gfilenamecompleter.c +0 -72
  118. data/ext/gio2/gfilterinputstream.c +0 -27
  119. data/ext/gio2/gfilteroutputstream.c +0 -27
  120. data/ext/gio2/gicon.c +0 -67
  121. data/ext/gio2/ginetaddress.c +0 -116
  122. data/ext/gio2/ginetsocketaddress.c +0 -38
  123. data/ext/gio2/gioerror.c +0 -70
  124. data/ext/gio2/giomodule.c +0 -63
  125. data/ext/gio2/gioscheduler.c +0 -193
  126. data/ext/gio2/giostream.c +0 -106
  127. data/ext/gio2/gmemoryinputstream.c +0 -65
  128. data/ext/gio2/gmemoryoutputstream.c +0 -41
  129. data/ext/gio2/gmountoperation.c +0 -66
  130. data/ext/gio2/gnetworkaddress.c +0 -57
  131. data/ext/gio2/gnetworkservice.c +0 -43
  132. data/ext/gio2/gseekable.c +0 -89
  133. data/ext/gio2/gsimpleasyncresult.c +0 -153
  134. data/ext/gio2/gsocketaddress.c +0 -33
  135. data/ext/gio2/gsocketconnectable.c +0 -97
  136. data/ext/gio2/gsocketconnection.c +0 -75
  137. data/ext/gio2/gsocketcontrolmessage.c +0 -80
  138. data/ext/gio2/gsocketservice.c +0 -64
  139. data/ext/gio2/gsrvtarget.c +0 -77
  140. data/ext/gio2/gtcpconnection.c +0 -27
  141. data/ext/gio2/gthemedicon.c +0 -81
  142. data/ext/gio2/gthreadedsocketservice.c +0 -40
  143. data/ext/gio2/gunixconnection.c +0 -69
  144. data/ext/gio2/gunixfdlist.c +0 -112
  145. data/ext/gio2/gunixfdmessage.c +0 -72
  146. data/ext/gio2/gunixinputstream.c +0 -49
  147. data/ext/gio2/gunixmounts.c +0 -343
  148. data/ext/gio2/gunixoutputstream.c +0 -49
  149. data/ext/gio2/gunixsocketaddress.c +0 -67
  150. data/ext/gio2/gvfs.c +0 -82
  151. data/ext/gio2/gvolume.c +0 -191
  152. data/ext/gio2/gvolumemonitor.c +0 -75
  153. data/ext/gio2/gzlibcompressor.c +0 -50
  154. data/ext/gio2/gzlibdecompressor.c +0 -43
@@ -1,37 +1,36 @@
1
- /* -*- c-file-style: "ruby" -*- */
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
2
  /*
3
- * Ruby/GIO: a Ruby binding of gio-2.0.x.
4
- * Copyright (C) 2008-2009 Ruby-GNOME2 Project Team
3
+ * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
+ * Copyright (C) 2008-2009 Ruby-GNOME2 Project Team
5
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.
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
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.
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
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
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
19
20
  */
20
21
 
21
- #include "gio2.h"
22
+ #include "rbgio2private.h"
22
23
 
24
+ #define RG_TARGET_NAMESPACE mAppInfo
23
25
  #define _SELF(value) RVAL2GAPPINFO(value)
24
26
 
25
- #define RVAL2GAPPINFOCREATEFLAGS(value) \
26
- RVAL2GFLAGS((value), G_TYPE_APP_INFO_CREATE_FLAGS)
27
-
28
27
  #define RVAL2GAPPINFOCREATEFLAGSDEFAULT(value) \
29
28
  RVAL2TYPE_WITH_DEFAULT((value), \
30
29
  RVAL2GAPPINFOCREATEFLAGS, \
31
30
  G_APP_INFO_CREATE_NONE)
32
31
 
33
32
  static VALUE
34
- appinfo_create_from_commandline(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
33
+ rg_s_create_from_commandline(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
35
34
  {
36
35
  VALUE commandline, application_name, flags;
37
36
  GError *error = NULL;
@@ -49,7 +48,7 @@ appinfo_create_from_commandline(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
49
48
  }
50
49
 
51
50
  static VALUE
52
- appinfo_reset_type_associations(VALUE self, VALUE content_type)
51
+ rg_s_reset_type_associations(VALUE self, VALUE content_type)
53
52
  {
54
53
  g_app_info_reset_type_associations(RVAL2CSTR(content_type));
55
54
 
@@ -57,25 +56,25 @@ appinfo_reset_type_associations(VALUE self, VALUE content_type)
57
56
  }
58
57
 
59
58
  static VALUE
60
- appinfo_get_all_for_type(G_GNUC_UNUSED VALUE self, VALUE content_type)
59
+ rg_s_get_all_for_type(G_GNUC_UNUSED VALUE self, VALUE content_type)
61
60
  {
62
61
  return GLIST2ARY_FREE(g_app_info_get_all_for_type(RVAL2CSTR(content_type)));
63
62
  }
64
63
 
65
64
  static VALUE
66
- appinfo_get_all(int argc, VALUE *argv, VALUE self)
65
+ rg_s_all(int argc, VALUE *argv, VALUE self)
67
66
  {
68
67
  VALUE content_type;
69
68
 
70
69
  rb_scan_args(argc, argv, "01", &content_type);
71
70
  if (!NIL_P(content_type))
72
- return appinfo_get_all_for_type(self, content_type);
71
+ return rg_s_get_all_for_type(self, content_type);
73
72
 
74
73
  return GLIST2ARY_FREE(g_app_info_get_all());
75
74
  }
76
75
 
77
76
  static VALUE
78
- appinfo_get_default_for_type(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
77
+ rg_s_get_default_for_type(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
79
78
  {
80
79
  VALUE content_type, must_support_uris;
81
80
 
@@ -86,13 +85,13 @@ appinfo_get_default_for_type(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
86
85
  }
87
86
 
88
87
  static VALUE
89
- appinfo_get_default_for_uri_scheme(G_GNUC_UNUSED VALUE self, VALUE uri_scheme)
88
+ rg_s_get_default_for_uri_scheme(G_GNUC_UNUSED VALUE self, VALUE uri_scheme)
90
89
  {
91
90
  return GOBJ2RVAL_UNREF(g_app_info_get_default_for_uri_scheme(RVAL2CSTR(uri_scheme)));
92
91
  }
93
92
 
94
93
  static VALUE
95
- appinfo_launch_default_for_uri(int argc, VALUE *argv, VALUE self)
94
+ rg_s_launch_default_for_uri(int argc, VALUE *argv, VALUE self)
96
95
  {
97
96
  VALUE uri, launch_context;
98
97
  GError *error;
@@ -107,55 +106,55 @@ appinfo_launch_default_for_uri(int argc, VALUE *argv, VALUE self)
107
106
  }
108
107
 
109
108
  static VALUE
110
- appinfo_dup(VALUE self)
109
+ rg_dup(VALUE self)
111
110
  {
112
111
  return GOBJ2RVAL_UNREF(g_app_info_dup(_SELF(self)));
113
112
  }
114
113
 
115
114
  static VALUE
116
- appinfo_equal(VALUE self, VALUE other)
115
+ rg_equal_p(VALUE self, VALUE other)
117
116
  {
118
117
  return CBOOL2RVAL(g_app_info_equal(_SELF(self), _SELF(other)));
119
118
  }
120
119
 
121
120
  static VALUE
122
- appinfo_get_id(VALUE self)
121
+ rg_id(VALUE self)
123
122
  {
124
123
  return CSTR2RVAL(g_app_info_get_id(_SELF(self)));
125
124
  }
126
125
 
127
126
  static VALUE
128
- appinfo_get_name(VALUE self)
127
+ rg_name(VALUE self)
129
128
  {
130
129
  return CSTR2RVAL(g_app_info_get_name(_SELF(self)));
131
130
  }
132
131
 
133
132
  static VALUE
134
- appinfo_get_display_name(VALUE self)
133
+ rg_display_name(VALUE self)
135
134
  {
136
135
  return CSTR2RVAL(g_app_info_get_display_name(_SELF(self)));
137
136
  }
138
137
 
139
138
  static VALUE
140
- appinfo_get_description(VALUE self)
139
+ rg_description(VALUE self)
141
140
  {
142
141
  return CSTR2RVAL(g_app_info_get_description(_SELF(self)));
143
142
  }
144
143
 
145
144
  static VALUE
146
- appinfo_get_executable(VALUE self)
145
+ rg_executable(VALUE self)
147
146
  {
148
147
  return CSTR2RVAL(g_app_info_get_executable(_SELF(self)));
149
148
  }
150
149
 
151
150
  static VALUE
152
- appinfo_get_commandline(VALUE self)
151
+ rg_commandline(VALUE self)
153
152
  {
154
153
  return CSTR2RVAL(g_app_info_get_commandline(_SELF(self)));
155
154
  }
156
155
 
157
156
  static VALUE
158
- appinfo_get_icon(VALUE self)
157
+ rg_icon(VALUE self)
159
158
  {
160
159
  return GOBJ2RVAL(g_app_info_get_icon(_SELF(self)));
161
160
  }
@@ -187,49 +186,49 @@ launch_method(LaunchMethod method, int argc, VALUE *argv, VALUE self)
187
186
  }
188
187
 
189
188
  static VALUE
190
- appinfo_launch(int argc, VALUE *argv, VALUE self)
189
+ rg_launch(int argc, VALUE *argv, VALUE self)
191
190
  {
192
191
  return launch_method(g_app_info_launch, argc, argv, self);
193
192
  }
194
193
 
195
194
  static VALUE
196
- appinfo_supports_files(VALUE self)
195
+ rg_supports_files_p(VALUE self)
197
196
  {
198
197
  return CBOOL2RVAL(g_app_info_supports_files(_SELF(self)));
199
198
  }
200
199
 
201
200
  static VALUE
202
- appinfo_supports_uris(VALUE self)
201
+ rg_supports_uris_p(VALUE self)
203
202
  {
204
203
  return CBOOL2RVAL(g_app_info_supports_uris(_SELF(self)));
205
204
  }
206
205
 
207
206
  static VALUE
208
- appinfo_launch_uris(int argc, VALUE *argv, VALUE self)
207
+ rg_launch_uris(int argc, VALUE *argv, VALUE self)
209
208
  {
210
209
  return launch_method(g_app_info_launch_uris, argc, argv, self);
211
210
  }
212
211
 
213
212
  static VALUE
214
- appinfo_should_show(VALUE self)
213
+ rg_should_show_p(VALUE self)
215
214
  {
216
215
  return CBOOL2RVAL(g_app_info_should_show(_SELF(self)));
217
216
  }
218
217
 
219
218
  static VALUE
220
- appinfo_can_delete(VALUE self)
219
+ rg_can_delete_p(VALUE self)
221
220
  {
222
221
  return CBOOL2RVAL(g_app_info_can_delete(_SELF(self)));
223
222
  }
224
223
 
225
224
  static VALUE
226
- appinfo_delete(VALUE self)
225
+ rg_delete(VALUE self)
227
226
  {
228
227
  return CBOOL2RVAL(g_app_info_delete(_SELF(self)));
229
228
  }
230
229
 
231
230
  static VALUE
232
- appinfo_set_as_default_for_type(VALUE self, VALUE value)
231
+ rg_set_as_default_for_type(VALUE self, VALUE value)
233
232
  {
234
233
  GError *error = NULL;
235
234
 
@@ -240,7 +239,7 @@ appinfo_set_as_default_for_type(VALUE self, VALUE value)
240
239
  }
241
240
 
242
241
  static VALUE
243
- appinfo_set_as_default_for_extension(VALUE self, VALUE value)
242
+ rg_set_as_default_for_extension(VALUE self, VALUE value)
244
243
  {
245
244
  GError *error = NULL;
246
245
 
@@ -251,7 +250,7 @@ appinfo_set_as_default_for_extension(VALUE self, VALUE value)
251
250
  }
252
251
 
253
252
  static VALUE
254
- appinfo_add_supports_type(VALUE self, VALUE value)
253
+ rg_add_supports_type(VALUE self, VALUE value)
255
254
  {
256
255
  GError *error = NULL;
257
256
 
@@ -262,7 +261,7 @@ appinfo_add_supports_type(VALUE self, VALUE value)
262
261
  }
263
262
 
264
263
  static VALUE
265
- appinfo_remove_supports_type(VALUE self, VALUE value)
264
+ rg_remove_supports_type(VALUE self, VALUE value)
266
265
  {
267
266
  GError *error = NULL;
268
267
 
@@ -273,46 +272,46 @@ appinfo_remove_supports_type(VALUE self, VALUE value)
273
272
  }
274
273
 
275
274
  static VALUE
276
- appinfo_can_remove_supports_type(VALUE self)
275
+ rg_can_remove_supports_type_p(VALUE self)
277
276
  {
278
277
  return CBOOL2RVAL(g_app_info_can_remove_supports_type(_SELF(self)));
279
278
  }
280
279
 
281
280
  void
282
- Init_gappinfo(VALUE glib)
281
+ Init_gappinfo(VALUE mGio)
283
282
  {
284
- VALUE appinfo = G_DEF_INTERFACE(G_TYPE_APP_INFO, "AppInfo", glib);
285
-
286
- G_DEF_CLASS(G_TYPE_APP_INFO_CREATE_FLAGS, "CreateFlags", appinfo);
287
- G_DEF_CONSTANTS(appinfo, G_TYPE_APP_INFO_CREATE_FLAGS, "G_APP_INFO_");
288
-
289
- rb_define_singleton_method(appinfo, "create_from_commandline", appinfo_create_from_commandline, -1);
290
- rb_define_singleton_method(appinfo, "reset_type_associations", appinfo_reset_type_associations, -1);
291
- rb_define_singleton_method(appinfo, "all", appinfo_get_all, 0);
292
- rb_define_singleton_method(appinfo, "get_all_for_type", appinfo_get_all_for_type, 1);
293
- rb_define_singleton_method(appinfo, "get_default_for_type", appinfo_get_default_for_type, -1);
294
- rb_define_singleton_method(appinfo, "get_default_for_uri_scheme", appinfo_get_default_for_uri_scheme, 1);
295
- rb_define_singleton_method(appinfo, "launch_default_for_uri", appinfo_launch_default_for_uri, 0);
296
-
297
- rb_define_method(appinfo, "dup", appinfo_dup, 0);
298
- rb_define_method(appinfo, "equal?", appinfo_equal, 1);
299
- rb_define_method(appinfo, "id", appinfo_get_id, 0);
300
- rb_define_method(appinfo, "name", appinfo_get_name, 0);
301
- rb_define_method(appinfo, "display_name", appinfo_get_display_name, 0);
302
- rb_define_method(appinfo, "description", appinfo_get_description, 0);
303
- rb_define_method(appinfo, "executable", appinfo_get_executable, 0);
304
- rb_define_method(appinfo, "commandline", appinfo_get_commandline, 0);
305
- rb_define_method(appinfo, "icon", appinfo_get_icon, 0);
306
- rb_define_method(appinfo, "launch", appinfo_launch, -1);
307
- rb_define_method(appinfo, "supports_files?", appinfo_supports_files, 0);
308
- rb_define_method(appinfo, "supports_uris?", appinfo_supports_uris, 0);
309
- rb_define_method(appinfo, "launch_uris", appinfo_launch_uris, -1);
310
- rb_define_method(appinfo, "should_show?", appinfo_should_show, 0);
311
- rb_define_method(appinfo, "can_delete?", appinfo_can_delete, 0);
312
- rb_define_method(appinfo, "delete", appinfo_delete, 0);
313
- rb_define_method(appinfo, "set_as_default_for_type", appinfo_set_as_default_for_type, 1);
314
- rb_define_method(appinfo, "set_as_default_for_extension", appinfo_set_as_default_for_extension, 1);
315
- rb_define_method(appinfo, "add_supports_type", appinfo_add_supports_type, 1);
316
- rb_define_method(appinfo, "can_remove_supports_type?", appinfo_can_remove_supports_type, 1);
317
- rb_define_method(appinfo, "remove_supports_type", appinfo_remove_supports_type, 1);
283
+ VALUE RG_TARGET_NAMESPACE = G_DEF_INTERFACE(G_TYPE_APP_INFO, "AppInfo", mGio);
284
+
285
+ G_DEF_CLASS(G_TYPE_APP_INFO_CREATE_FLAGS, "CreateFlags", RG_TARGET_NAMESPACE);
286
+ G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, G_TYPE_APP_INFO_CREATE_FLAGS, "G_APP_INFO_");
287
+
288
+ RG_DEF_SMETHOD(create_from_commandline, -1);
289
+ RG_DEF_SMETHOD(reset_type_associations, -1);
290
+ RG_DEF_SMETHOD(all, 0);
291
+ RG_DEF_SMETHOD(get_all_for_type, 1);
292
+ RG_DEF_SMETHOD(get_default_for_type, -1);
293
+ RG_DEF_SMETHOD(get_default_for_uri_scheme, 1);
294
+ RG_DEF_SMETHOD(launch_default_for_uri, 0);
295
+
296
+ RG_DEF_METHOD(dup, 0);
297
+ RG_DEF_METHOD_P(equal, 1);
298
+ RG_DEF_METHOD(id, 0);
299
+ RG_DEF_METHOD(name, 0);
300
+ RG_DEF_METHOD(display_name, 0);
301
+ RG_DEF_METHOD(description, 0);
302
+ RG_DEF_METHOD(executable, 0);
303
+ RG_DEF_METHOD(commandline, 0);
304
+ RG_DEF_METHOD(icon, 0);
305
+ RG_DEF_METHOD(launch, -1);
306
+ RG_DEF_METHOD_P(supports_files, 0);
307
+ RG_DEF_METHOD_P(supports_uris, 0);
308
+ RG_DEF_METHOD(launch_uris, -1);
309
+ RG_DEF_METHOD_P(should_show, 0);
310
+ RG_DEF_METHOD_P(can_delete, 0);
311
+ RG_DEF_METHOD(delete, 0);
312
+ RG_DEF_METHOD(set_as_default_for_type, 1);
313
+ RG_DEF_METHOD(set_as_default_for_extension, 1);
314
+ RG_DEF_METHOD(add_supports_type, 1);
315
+ RG_DEF_METHOD_P(can_remove_supports_type, 1);
316
+ RG_DEF_METHOD(remove_supports_type, 1);
318
317
  }
@@ -0,0 +1,81 @@
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 cAppLaunchContext
25
+ #define _SELF(value) RVAL2GAPPLAUNCHCONTEXT(value)
26
+
27
+ static VALUE
28
+ rg_initialize(VALUE self)
29
+ {
30
+ G_INITIALIZE(self, g_app_launch_context_new());
31
+
32
+ return Qnil;
33
+ }
34
+
35
+ typedef char *(*GetMethod)(GAppLaunchContext *, GAppInfo *, GList *);
36
+
37
+ static VALUE
38
+ get_value_by(GetMethod method, int argc, VALUE *argv, VALUE self)
39
+ {
40
+ VALUE info, rbfiles;
41
+ GList *files;
42
+ char *value;
43
+
44
+ rb_scan_args(argc, argv, "11", &info, &rbfiles);
45
+ files = GFILEARY2GLIST_ACCEPT_NIL(rbfiles);
46
+ value = method(_SELF(self), RVAL2GAPPINFO(info), files);
47
+ g_list_free(files);
48
+
49
+ return CSTR2RVAL_FREE(value);
50
+ }
51
+
52
+ static VALUE
53
+ rg_get_display(int argc, VALUE *argv, VALUE self)
54
+ {
55
+ return get_value_by(g_app_launch_context_get_display, argc, argv, self);
56
+ }
57
+
58
+ static VALUE
59
+ rg_get_startup_notify_id(int argc, VALUE *argv, VALUE self)
60
+ {
61
+ return get_value_by(g_app_launch_context_get_startup_notify_id, argc, argv, self);
62
+ }
63
+
64
+ static VALUE
65
+ rg_launch_failed(VALUE self, VALUE sn_id)
66
+ {
67
+ g_app_launch_context_launch_failed(_SELF(self), RVAL2CSTR(sn_id));
68
+
69
+ return self;
70
+ }
71
+
72
+ void
73
+ Init_gapplaunchcontext(VALUE mGio)
74
+ {
75
+ VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_APP_LAUNCH_CONTEXT, "AppLaunchContext", mGio);
76
+
77
+ RG_DEF_METHOD(initialize, 0);
78
+ RG_DEF_METHOD(get_display, -1);
79
+ RG_DEF_METHOD(get_startup_notify_id, -1);
80
+ RG_DEF_METHOD(launch_failed, 1);
81
+ }
@@ -1,29 +1,31 @@
1
- /* -*- c-file-style: "ruby" -*- */
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
2
  /*
3
- * Ruby/GIO: a Ruby binding of gio-2.0.x.
4
- * Copyright (C) 2008-2009 Ruby-GNOME2 Project Team
3
+ * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
+ * Copyright (C) 2008-2009 Ruby-GNOME2 Project Team
5
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.
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
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.
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
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
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
19
20
  */
20
21
 
21
- #include "gio2.h"
22
+ #include "rbgio2private.h"
22
23
 
23
- #define _SELF(value) G_ASYNC_INITABLE(RVAL2GOBJ(value))
24
+ #define RG_TARGET_NAMESPACE mAsyncInitable
25
+ #define _SELF(value) RVAL2GASYNCINITABLE(value)
24
26
 
25
27
  static VALUE
26
- asyncinitable_init_async(int argc, VALUE *argv, VALUE self)
28
+ rg_init_async(int argc, VALUE *argv, VALUE self)
27
29
  {
28
30
  VALUE rbio_priority, rbcancellable, block;
29
31
  int io_priority;
@@ -43,7 +45,7 @@ asyncinitable_init_async(int argc, VALUE *argv, VALUE self)
43
45
  }
44
46
 
45
47
  static VALUE
46
- asyncinitable_init_finish(VALUE self, VALUE result)
48
+ rg_init_finish(VALUE self, VALUE result)
47
49
  {
48
50
  GError *error = NULL;
49
51
 
@@ -55,9 +57,9 @@ asyncinitable_init_finish(VALUE self, VALUE result)
55
57
  return self;
56
58
  }
57
59
 
58
- /* NOTE: We dont implement g_async_initable_new_async. */
60
+ /* NOTE: We don't implement g_async_initable_new_async. */
59
61
 
60
- /* NOTE: We dont implement g_async_initable_new_valist_async. */
62
+ /* NOTE: We don't implement g_async_initable_new_valist_async. */
61
63
 
62
64
  struct rbgio_gasyncinitable_new_async_data {
63
65
  GObjectClass *gclass;
@@ -134,6 +136,8 @@ rbgio_gasyncinitable_new_async_ensure(struct rbgio_gasyncinitable_new_async_data
134
136
  if (G_IS_VALUE(&data->parameters[i].value))
135
137
  g_value_unset(&data->parameters[i].value);
136
138
 
139
+ g_free(data->parameters);
140
+
137
141
  return Qnil;
138
142
  }
139
143
 
@@ -180,7 +184,7 @@ rbgio_gasyncinitable_new_async(GType type,
180
184
  data.rbparameters = parameters;
181
185
  data.index = 0;
182
186
  data.n_parameters = RVAL2GUINT(rb_funcall(parameters, s_id_length, 0));
183
- data.parameters = ALLOCA_N(GParameter, data.n_parameters);
187
+ data.parameters = g_new(GParameter, data.n_parameters);
184
188
 
185
189
  rb_ensure(rbgio_gasyncinitable_new_async_body, (VALUE)&data,
186
190
  rbgio_gasyncinitable_new_async_ensure, (VALUE)&data);
@@ -189,7 +193,7 @@ rbgio_gasyncinitable_new_async(GType type,
189
193
  }
190
194
 
191
195
  static VALUE
192
- asyncinitable_initialize(int argc, VALUE *argv, VALUE self)
196
+ rg_initialize(int argc, VALUE *argv, VALUE self)
193
197
  {
194
198
  const RGObjClassInfo* info;
195
199
  VALUE io_priority, cancellable, parameters, block;
@@ -211,9 +215,8 @@ asyncinitable_initialize(int argc, VALUE *argv, VALUE self)
211
215
  return self;
212
216
  }
213
217
 
214
-
215
218
  static VALUE
216
- asyncinitable_initialize_finish(VALUE self, VALUE result)
219
+ rg_initialize_finish(VALUE self, VALUE result)
217
220
  {
218
221
  GError *error = NULL;
219
222
  GObject *object;
@@ -232,12 +235,12 @@ asyncinitable_initialize_finish(VALUE self, VALUE result)
232
235
  }
233
236
 
234
237
  void
235
- Init_gasyncinitable(VALUE glib)
238
+ Init_gasyncinitable(VALUE mGio)
236
239
  {
237
- VALUE asyncinitable = G_DEF_INTERFACE(G_TYPE_ASYNC_INITABLE, "AsyncInitable", glib);
240
+ VALUE RG_TARGET_NAMESPACE = G_DEF_INTERFACE(G_TYPE_ASYNC_INITABLE, "AsyncInitable", mGio);
238
241
 
239
- rb_define_method(asyncinitable, "init_async", asyncinitable_init_async, -1);
240
- rb_define_method(asyncinitable, "init_finish", asyncinitable_init_finish, 1);
241
- rb_define_method(asyncinitable, "initialize", asyncinitable_initialize, -1);
242
- rb_define_method(asyncinitable, "initialize_finish", asyncinitable_initialize_finish, 1);
242
+ RG_DEF_METHOD(init_async, -1);
243
+ RG_DEF_METHOD(init_finish, 1);
244
+ RG_DEF_METHOD(initialize, -1);
245
+ RG_DEF_METHOD(initialize_finish, 1);
243
246
  }
@@ -0,0 +1,41 @@
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 mAsyncResult
25
+ #define _SELF(value) RVAL2GASYNCRESULT(value)
26
+
27
+ /* NOTE: g_async_result_get_user_data isn't of any use from Ruby. */
28
+
29
+ static VALUE
30
+ rg_source_object(VALUE self)
31
+ {
32
+ return GOBJ2RVAL_UNREF(g_async_result_get_source_object(_SELF(self)));
33
+ }
34
+
35
+ void
36
+ Init_gasyncresult(VALUE mGio)
37
+ {
38
+ VALUE RG_TARGET_NAMESPACE = G_DEF_INTERFACE(G_TYPE_ASYNC_RESULT, "AsyncResult", mGio);
39
+
40
+ RG_DEF_METHOD(source_object, 0);
41
+ }