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,148 +0,0 @@
1
- /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /*
3
- * Copyright (C) 2011 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, or (at your option) any later version.
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., 51 Franklin Street, Fifth Floor, Boston,
18
- * MA 02110-1301 USA
19
- */
20
-
21
- #ifndef __RBGIO2PRIVATE_H__
22
- #define __RBGIO2PRIVATE_H__
23
-
24
- #include <ruby.h>
25
-
26
- #include <rbglib.h>
27
- #include <rbgobject.h>
28
- #include "rbgio2.h"
29
-
30
- #define CSTR2RVAL_TAINTED(string, length) \
31
- rbgio_cstr_to_rval_tainted((string), (length))
32
- #define CSTR2RVAL_TAINTED_FREE(string, length) \
33
- rbgio_cstr_to_rval_tainted_free((string), (length))
34
-
35
- #define GLIST2ARY_UNREF_FREE(list) rbgio_glist_to_ary_unref_free(list)
36
-
37
- #define GFDS2ARY(fds) rbgio_fds_to_ary(fds)
38
- #define GFDS2ARY_FREE(fds) rbgio_fds_to_ary_free(fds)
39
-
40
- #define GFILEARY2GLIST(ary) rbgio_gfile_ary_to_glist(ary)
41
- #define GFILEARY2GLIST_ACCEPT_NIL(ary) rbgio_gfile_ary_to_glist_accept_nil(ary)
42
-
43
- G_GNUC_INTERNAL VALUE rbgio_cstr_to_rval_tainted(const char *string,
44
- gsize length);
45
- G_GNUC_INTERNAL VALUE rbgio_cstr_to_rval_tainted_free(char *string,
46
- gsize length);
47
- G_GNUC_INTERNAL VALUE rbgio_glist_to_ary_unref_free(GList *list);
48
- G_GNUC_INTERNAL VALUE rbgio_fds_to_ary(const gint *fds);
49
- G_GNUC_INTERNAL VALUE rbgio_fds_to_ary_free(gint *fds);
50
- G_GNUC_INTERNAL GList *rbgio_gfile_ary_to_glist(VALUE ary);
51
- G_GNUC_INTERNAL GList *rbgio_gfile_ary_to_glist_accept_nil(VALUE ary);
52
- G_GNUC_INTERNAL void rbgio_rval_to_gtimeval(VALUE value, GTimeVal *time);
53
- G_GNUC_INTERNAL void rbgio_async_ready_callback(GObject *source,
54
- GAsyncResult *result,
55
- gpointer data);
56
- G_GNUC_INTERNAL VALUE rbgio_child_remove_and_return(VALUE parent, VALUE child);
57
-
58
- G_GNUC_INTERNAL void Init_gio(void);
59
- G_GNUC_INTERNAL void Init_gappinfo(VALUE mGio);
60
- G_GNUC_INTERNAL void Init_gapplaunchcontext(VALUE mGio);
61
- G_GNUC_INTERNAL void Init_gasyncinitable(VALUE mGio);
62
- G_GNUC_INTERNAL void Init_gasyncresult(VALUE mGio);
63
- G_GNUC_INTERNAL void Init_gbufferedinputstream(VALUE mGio);
64
- G_GNUC_INTERNAL void Init_gbufferedoutputstream(VALUE mGio);
65
- G_GNUC_INTERNAL void Init_gcancellable(VALUE mGio);
66
- G_GNUC_INTERNAL void Init_gcharsetconverter(VALUE mGio);
67
- G_GNUC_INTERNAL void Init_gcontenttype(VALUE mGio);
68
- G_GNUC_INTERNAL void Init_gconverter(VALUE mGio);
69
- G_GNUC_INTERNAL void Init_gconverterinputstream(VALUE mGio);
70
- G_GNUC_INTERNAL void Init_gconverteroutputstream(VALUE mGio);
71
- G_GNUC_INTERNAL void Init_gdatainputstream(VALUE mGio);
72
- G_GNUC_INTERNAL void Init_gdataoutputstream(VALUE mGio);
73
- G_GNUC_INTERNAL void Init_gdesktopappinfo(VALUE mGio);
74
- G_GNUC_INTERNAL void Init_gdrive(VALUE mGio);
75
- G_GNUC_INTERNAL void Init_gemblem(VALUE mGio);
76
- G_GNUC_INTERNAL void Init_gemblemedicon(VALUE mGio);
77
- G_GNUC_INTERNAL void Init_gfile(VALUE mGio);
78
- G_GNUC_INTERNAL void Init_gfileattribute(VALUE mGio);
79
- G_GNUC_INTERNAL void Init_gfileattributeinfo(VALUE mGio);
80
- G_GNUC_INTERNAL void Init_fileattributeinfolist(VALUE mGio);
81
- G_GNUC_INTERNAL void Init_gfileattributematcher(VALUE mGio);
82
- G_GNUC_INTERNAL void Init_gfiledescriptorbased(VALUE mGio);
83
- G_GNUC_INTERNAL void Init_gfileenumerator(VALUE mGio);
84
- G_GNUC_INTERNAL void Init_gfileicon(VALUE mGio);
85
- G_GNUC_INTERNAL void Init_gfileinfo(VALUE mGio);
86
- G_GNUC_INTERNAL void Init_gfileinputstream(VALUE mGio);
87
- G_GNUC_INTERNAL void Init_gfileiostream(VALUE mGio);
88
- G_GNUC_INTERNAL void Init_gfilemonitor(VALUE mGio);
89
- G_GNUC_INTERNAL void Init_gfilenamecompleter(VALUE mGio);
90
- G_GNUC_INTERNAL void Init_gfileoutputstream(VALUE mGio);
91
- G_GNUC_INTERNAL void Init_gfilterinputstream(VALUE mGio);
92
- G_GNUC_INTERNAL void Init_gfilteroutputstream(VALUE mGio);
93
- G_GNUC_INTERNAL void Init_gicon(VALUE mGio);
94
- G_GNUC_INTERNAL void Init_ginetaddress(VALUE mGio);
95
- G_GNUC_INTERNAL void Init_ginetsocketaddress(VALUE mGio);
96
- G_GNUC_INTERNAL void Init_ginitable(VALUE mGio);
97
- G_GNUC_INTERNAL void Init_ginputstream(VALUE mGio);
98
- G_GNUC_INTERNAL void Init_gioerror(VALUE mGio);
99
- G_GNUC_INTERNAL void Init_giomodule(VALUE mGio);
100
- G_GNUC_INTERNAL void Init_giomodules(VALUE mGio);
101
- G_GNUC_INTERNAL void Init_gioscheduler(VALUE mGio);
102
- G_GNUC_INTERNAL void Init_gioschedulerjob(VALUE mGio);
103
- G_GNUC_INTERNAL void Init_giostream(VALUE mGio);
104
- G_GNUC_INTERNAL void Init_gloadableicon(VALUE mGio);
105
- G_GNUC_INTERNAL void Init_gmemoryinputstream(VALUE mGio);
106
- G_GNUC_INTERNAL void Init_gmemoryoutputstream(VALUE mGio);
107
- G_GNUC_INTERNAL void Init_gmount(VALUE mGio);
108
- G_GNUC_INTERNAL void Init_gmountoperation(VALUE mGio);
109
- G_GNUC_INTERNAL void Init_gnetworkaddress(VALUE mGio);
110
- G_GNUC_INTERNAL void Init_gnetworkservice(VALUE mGio);
111
- G_GNUC_INTERNAL void Init_goutputstream(VALUE mGio);
112
- G_GNUC_INTERNAL void Init_gresolver(VALUE mGio);
113
- G_GNUC_INTERNAL void Init_gseekable(VALUE mGio);
114
- G_GNUC_INTERNAL void Init_gsimpleasyncresult(VALUE mGio);
115
- G_GNUC_INTERNAL void Init_gsocket(VALUE mGio);
116
- G_GNUC_INTERNAL void Init_gsocketaddress(VALUE mGio);
117
- G_GNUC_INTERNAL void Init_gsocketclient(VALUE mGio);
118
- G_GNUC_INTERNAL void Init_gsocketconnectable(VALUE mGio);
119
- G_GNUC_INTERNAL void Init_gsocketaddressenumerator(VALUE mGio);
120
- G_GNUC_INTERNAL void Init_gsocketconnection(VALUE mGio);
121
- G_GNUC_INTERNAL void Init_gsocketconnectionfactory(VALUE mGio);
122
- G_GNUC_INTERNAL void Init_gsocketcontrolmessage(VALUE mGio);
123
- G_GNUC_INTERNAL void Init_gsocketlistener(VALUE mGio);
124
- G_GNUC_INTERNAL void Init_gsocketservice(VALUE mGio);
125
- G_GNUC_INTERNAL void Init_gsrvtarget(VALUE mGio);
126
- G_GNUC_INTERNAL void Init_gtcpconnection(VALUE mGio);
127
- G_GNUC_INTERNAL void Init_gthreadedsocketservice(VALUE mGio);
128
- G_GNUC_INTERNAL void Init_gthemedicon(VALUE mGio);
129
- G_GNUC_INTERNAL void Init_gtlscertificate(VALUE mGio);
130
- G_GNUC_INTERNAL void Init_gunixconnection(VALUE mGio);
131
- G_GNUC_INTERNAL void Init_gunixfdlist(VALUE mGio);
132
- G_GNUC_INTERNAL void Init_gunixfdmessage(VALUE mGio);
133
- G_GNUC_INTERNAL void Init_gunixinputstream(VALUE mGio);
134
- G_GNUC_INTERNAL void Init_gunixmount(VALUE mGio);
135
- G_GNUC_INTERNAL void Init_gunixmounts(VALUE mGio);
136
- G_GNUC_INTERNAL void Init_gunixmountpoint(VALUE mGio);
137
- G_GNUC_INTERNAL void Init_gunixmountpoints(VALUE mGio);
138
- G_GNUC_INTERNAL void Init_gunixmountmonitor(VALUE mGio);
139
- G_GNUC_INTERNAL void Init_gunixoutputstream(VALUE mGio);
140
- G_GNUC_INTERNAL void Init_gunixsocketaddress(VALUE mGio);
141
- G_GNUC_INTERNAL void Init_gvfs(VALUE mGio);
142
- G_GNUC_INTERNAL void Init_gvolume(VALUE mGio);
143
- G_GNUC_INTERNAL void Init_gvolumemonitor(VALUE mGio);
144
- G_GNUC_INTERNAL void Init_gzlibcompressor(VALUE mGio);
145
- G_GNUC_INTERNAL void Init_gzlibdecompressor(VALUE mGio);
146
- G_GNUC_INTERNAL void Init_util(void);
147
-
148
- #endif /* __RBGIO2PRIVATE_H__ */
@@ -1,317 +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 mAppInfo
25
- #define _SELF(value) RVAL2GAPPINFO(value)
26
-
27
- #define RVAL2GAPPINFOCREATEFLAGSDEFAULT(value) \
28
- RVAL2TYPE_WITH_DEFAULT((value), \
29
- RVAL2GAPPINFOCREATEFLAGS, \
30
- G_APP_INFO_CREATE_NONE)
31
-
32
- static VALUE
33
- rg_s_create_from_commandline(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
34
- {
35
- VALUE commandline, application_name, flags;
36
- GError *error = NULL;
37
- GAppInfo *info;
38
-
39
- rb_scan_args(argc, argv, "12", &commandline, &application_name, &flags);
40
- info = g_app_info_create_from_commandline(RVAL2CSTR(commandline),
41
- RVAL2CSTR_ACCEPT_NIL(application_name),
42
- RVAL2GAPPINFOCREATEFLAGSDEFAULT(flags),
43
- &error);
44
- if (info == NULL)
45
- rbgio_raise_error(error);
46
-
47
- return GOBJ2RVAL_UNREF(info);
48
- }
49
-
50
- static VALUE
51
- rg_s_reset_type_associations(VALUE self, VALUE content_type)
52
- {
53
- g_app_info_reset_type_associations(RVAL2CSTR(content_type));
54
-
55
- return self;
56
- }
57
-
58
- static VALUE
59
- rg_s_get_all_for_type(G_GNUC_UNUSED VALUE self, VALUE content_type)
60
- {
61
- return GLIST2ARY_FREE(g_app_info_get_all_for_type(RVAL2CSTR(content_type)));
62
- }
63
-
64
- static VALUE
65
- rg_s_all(int argc, VALUE *argv, VALUE self)
66
- {
67
- VALUE content_type;
68
-
69
- rb_scan_args(argc, argv, "01", &content_type);
70
- if (!NIL_P(content_type))
71
- return rg_s_get_all_for_type(self, content_type);
72
-
73
- return GLIST2ARY_FREE(g_app_info_get_all());
74
- }
75
-
76
- static VALUE
77
- rg_s_get_default_for_type(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
78
- {
79
- VALUE content_type, must_support_uris;
80
-
81
- rb_scan_args(argc, argv, "11", &content_type, &must_support_uris);
82
-
83
- return GOBJ2RVAL_UNREF(g_app_info_get_default_for_type(RVAL2CSTR(content_type),
84
- RVAL2CBOOL(must_support_uris)));
85
- }
86
-
87
- static VALUE
88
- rg_s_get_default_for_uri_scheme(G_GNUC_UNUSED VALUE self, VALUE uri_scheme)
89
- {
90
- return GOBJ2RVAL_UNREF(g_app_info_get_default_for_uri_scheme(RVAL2CSTR(uri_scheme)));
91
- }
92
-
93
- static VALUE
94
- rg_s_launch_default_for_uri(int argc, VALUE *argv, VALUE self)
95
- {
96
- VALUE uri, launch_context;
97
- GError *error;
98
-
99
- rb_scan_args(argc, argv, "11", &uri, &launch_context);
100
- if (!g_app_info_launch_default_for_uri(RVAL2CSTR(uri),
101
- RVAL2GAPPLAUNCHCONTEXT(launch_context),
102
- &error))
103
- rbgio_raise_error(error);
104
-
105
- return self;
106
- }
107
-
108
- static VALUE
109
- rg_dup(VALUE self)
110
- {
111
- return GOBJ2RVAL_UNREF(g_app_info_dup(_SELF(self)));
112
- }
113
-
114
- static VALUE
115
- rg_equal_p(VALUE self, VALUE other)
116
- {
117
- return CBOOL2RVAL(g_app_info_equal(_SELF(self), _SELF(other)));
118
- }
119
-
120
- static VALUE
121
- rg_id(VALUE self)
122
- {
123
- return CSTR2RVAL(g_app_info_get_id(_SELF(self)));
124
- }
125
-
126
- static VALUE
127
- rg_name(VALUE self)
128
- {
129
- return CSTR2RVAL(g_app_info_get_name(_SELF(self)));
130
- }
131
-
132
- static VALUE
133
- rg_display_name(VALUE self)
134
- {
135
- return CSTR2RVAL(g_app_info_get_display_name(_SELF(self)));
136
- }
137
-
138
- static VALUE
139
- rg_description(VALUE self)
140
- {
141
- return CSTR2RVAL(g_app_info_get_description(_SELF(self)));
142
- }
143
-
144
- static VALUE
145
- rg_executable(VALUE self)
146
- {
147
- return CSTR2RVAL(g_app_info_get_executable(_SELF(self)));
148
- }
149
-
150
- static VALUE
151
- rg_commandline(VALUE self)
152
- {
153
- return CSTR2RVAL(g_app_info_get_commandline(_SELF(self)));
154
- }
155
-
156
- static VALUE
157
- rg_icon(VALUE self)
158
- {
159
- return GOBJ2RVAL(g_app_info_get_icon(_SELF(self)));
160
- }
161
-
162
- typedef gboolean (*LaunchMethod)(GAppInfo *,
163
- GList *,
164
- GAppLaunchContext *,
165
- GError **);
166
-
167
- static VALUE
168
- launch_method(LaunchMethod method, int argc, VALUE *argv, VALUE self)
169
- {
170
- VALUE rbfiles, rblaunch_context;
171
- GList *files;
172
- GAppLaunchContext *launch_context;
173
- GError *error = NULL;
174
- gboolean launched;
175
-
176
- rb_scan_args(argc, argv, "02", &rbfiles, &rblaunch_context);
177
- launch_context = RVAL2GAPPLAUNCHCONTEXT(rblaunch_context);
178
- files = GFILEARY2GLIST_ACCEPT_NIL(rbfiles);
179
- launched = method(_SELF(self), files, launch_context, &error);
180
- g_list_free(files);
181
-
182
- if (!launched)
183
- rbgio_raise_error(error);
184
-
185
- return self;
186
- }
187
-
188
- static VALUE
189
- rg_launch(int argc, VALUE *argv, VALUE self)
190
- {
191
- return launch_method(g_app_info_launch, argc, argv, self);
192
- }
193
-
194
- static VALUE
195
- rg_supports_files_p(VALUE self)
196
- {
197
- return CBOOL2RVAL(g_app_info_supports_files(_SELF(self)));
198
- }
199
-
200
- static VALUE
201
- rg_supports_uris_p(VALUE self)
202
- {
203
- return CBOOL2RVAL(g_app_info_supports_uris(_SELF(self)));
204
- }
205
-
206
- static VALUE
207
- rg_launch_uris(int argc, VALUE *argv, VALUE self)
208
- {
209
- return launch_method(g_app_info_launch_uris, argc, argv, self);
210
- }
211
-
212
- static VALUE
213
- rg_should_show_p(VALUE self)
214
- {
215
- return CBOOL2RVAL(g_app_info_should_show(_SELF(self)));
216
- }
217
-
218
- static VALUE
219
- rg_can_delete_p(VALUE self)
220
- {
221
- return CBOOL2RVAL(g_app_info_can_delete(_SELF(self)));
222
- }
223
-
224
- static VALUE
225
- rg_delete(VALUE self)
226
- {
227
- return CBOOL2RVAL(g_app_info_delete(_SELF(self)));
228
- }
229
-
230
- static VALUE
231
- rg_set_as_default_for_type(VALUE self, VALUE value)
232
- {
233
- GError *error = NULL;
234
-
235
- if (!g_app_info_set_as_default_for_type(_SELF(self), RVAL2CSTR(value), &error))
236
- rbgio_raise_error(error);
237
-
238
- return self;
239
- }
240
-
241
- static VALUE
242
- rg_set_as_default_for_extension(VALUE self, VALUE value)
243
- {
244
- GError *error = NULL;
245
-
246
- if (!g_app_info_set_as_default_for_extension(_SELF(self), RVAL2CSTR(value), &error))
247
- rbgio_raise_error(error);
248
-
249
- return self;
250
- }
251
-
252
- static VALUE
253
- rg_add_supports_type(VALUE self, VALUE value)
254
- {
255
- GError *error = NULL;
256
-
257
- if (!g_app_info_add_supports_type(_SELF(self), RVAL2CSTR(value), &error))
258
- rbgio_raise_error(error);
259
-
260
- return self;
261
- }
262
-
263
- static VALUE
264
- rg_remove_supports_type(VALUE self, VALUE value)
265
- {
266
- GError *error = NULL;
267
-
268
- if (!g_app_info_remove_supports_type(_SELF(self), RVAL2CSTR(value), &error))
269
- rbgio_raise_error(error);
270
-
271
- return self;
272
- }
273
-
274
- static VALUE
275
- rg_can_remove_supports_type_p(VALUE self)
276
- {
277
- return CBOOL2RVAL(g_app_info_can_remove_supports_type(_SELF(self)));
278
- }
279
-
280
- void
281
- Init_gappinfo(VALUE mGio)
282
- {
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);
317
- }