glib2 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 (78) hide show
  1. data/ext/glib2/extconf.rb +1 -0
  2. data/ext/glib2/glib2.def +23 -0
  3. data/ext/glib2/rbgcompat.h +19 -5
  4. data/ext/glib2/rbglib.c +607 -160
  5. data/ext/glib2/rbglib.h +81 -26
  6. data/ext/glib2/rbglib2conversions.h +57 -0
  7. data/ext/glib2/rbglib_bookmarkfile.c +117 -107
  8. data/ext/glib2/rbglib_completion.c +37 -26
  9. data/ext/glib2/rbglib_convert.c +42 -30
  10. data/ext/glib2/rbglib_error.c +20 -10
  11. data/ext/glib2/rbglib_fileutils.c +48 -37
  12. data/ext/glib2/rbglib_i18n.c +24 -14
  13. data/ext/glib2/rbglib_int64.c +24 -16
  14. data/ext/glib2/rbglib_iochannel.c +146 -204
  15. data/ext/glib2/rbglib_iochannel_win32_socket.c +56 -0
  16. data/ext/glib2/rbglib_iochannelerror.c +49 -0
  17. data/ext/glib2/rbglib_keyfile.c +171 -182
  18. data/ext/glib2/rbglib_maincontext.c +107 -92
  19. data/ext/glib2/rbglib_mainloop.c +34 -21
  20. data/ext/glib2/rbglib_messages.c +53 -44
  21. data/ext/glib2/rbglib_pollfd.c +37 -26
  22. data/ext/glib2/rbglib_shell.c +29 -22
  23. data/ext/glib2/rbglib_shellerror.c +34 -0
  24. data/ext/glib2/rbglib_source.c +49 -36
  25. data/ext/glib2/rbglib_spawn.c +50 -61
  26. data/ext/glib2/rbglib_spawnerror.c +53 -0
  27. data/ext/glib2/rbglib_threads.c +28 -16
  28. data/ext/glib2/rbglib_timer.c +35 -24
  29. data/ext/glib2/rbglib_ucs4.c +79 -0
  30. data/ext/glib2/rbglib_unichar.c +209 -0
  31. data/ext/glib2/rbglib_unicode.c +34 -584
  32. data/ext/glib2/rbglib_utf16.c +78 -0
  33. data/ext/glib2/rbglib_utf8.c +259 -0
  34. data/ext/glib2/rbglib_utils.c +95 -91
  35. data/ext/glib2/rbglib_win32.c +52 -45
  36. data/ext/glib2/rbglibdeprecated.c +56 -0
  37. data/ext/glib2/rbglibdeprecated.h +34 -0
  38. data/ext/glib2/rbgobj_boxed.c +40 -33
  39. data/ext/glib2/rbgobj_closure.c +45 -34
  40. data/ext/glib2/rbgobj_convert.c +19 -9
  41. data/ext/glib2/rbgobj_enumflags.c +109 -0
  42. data/ext/glib2/rbgobj_enums.c +67 -646
  43. data/ext/glib2/rbgobj_flags.c +522 -0
  44. data/ext/glib2/rbgobj_fundamental.c +19 -6
  45. data/ext/glib2/rbgobj_object.c +90 -81
  46. data/ext/glib2/rbgobj_param.c +78 -83
  47. data/ext/glib2/rbgobj_paramspecs.c +20 -12
  48. data/ext/glib2/rbgobj_signal.c +248 -193
  49. data/ext/glib2/rbgobj_strv.c +20 -10
  50. data/ext/glib2/rbgobj_type.c +153 -149
  51. data/ext/glib2/rbgobj_typeinstance.c +49 -39
  52. data/ext/glib2/rbgobj_typeinterface.c +37 -27
  53. data/ext/glib2/rbgobj_typemodule.c +39 -29
  54. data/ext/glib2/rbgobj_typeplugin.c +36 -26
  55. data/ext/glib2/rbgobj_value.c +41 -11
  56. data/ext/glib2/rbgobj_valuearray.c +59 -23
  57. data/ext/glib2/rbgobj_valuetypes.c +27 -17
  58. data/ext/glib2/rbgobject.c +26 -40
  59. data/ext/glib2/rbgobject.h +38 -20
  60. data/ext/glib2/rbgprivate.h +87 -5
  61. data/ext/glib2/rbgutil.c +52 -238
  62. data/ext/glib2/rbgutil.h +55 -42
  63. data/ext/glib2/rbgutil_callback.c +47 -12
  64. data/ext/glib2/rbgutil_list.c +173 -0
  65. data/ext/glib2/rbgutil_list.h +85 -0
  66. data/ext/glib2/rbgutildeprecated.c +252 -0
  67. data/ext/glib2/rbgutildeprecated.h +63 -0
  68. data/lib/glib-mkenums.rb +2 -2
  69. data/lib/glib2.rb +2 -25
  70. data/lib/glib2/deprecatable.rb +149 -0
  71. data/lib/gnome2-raketask.rb +45 -15
  72. data/lib/gnome2-win32-binary-downloader.rb +1 -1
  73. data/lib/mkmf-gnome2.rb +37 -18
  74. data/test/test_flags.rb +129 -0
  75. data/test/test_key_file.rb +6 -2
  76. data/test/test_spawn.rb +33 -0
  77. metadata +26 -7
  78. data/ChangeLog +0 -3513
@@ -1,13 +1,23 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /************************************************
3
-
4
- rbglib_completion.c -
5
-
6
- $Author: sakai $
7
- $Date: 2007/07/08 02:40:12 $
8
-
9
- Copyright (C) 2005,2006 Masao Mutoh
10
- ************************************************/
2
+ /*
3
+ * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
+ * Copyright (C) 2005,2006 Masao Mutoh
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
+ */
11
21
 
12
22
  #include "rbgprivate.h"
13
23
 
@@ -29,7 +39,7 @@ completion_copy(GCompletion *comp)
29
39
  return new_comp;
30
40
  }
31
41
 
32
- GType
42
+ static GType
33
43
  g_completion_get_type(void)
34
44
  {
35
45
  static GType our_type = 0;
@@ -43,6 +53,7 @@ g_completion_get_type(void)
43
53
 
44
54
  #define G_TYPE_COMPLETION (g_completion_get_type())
45
55
 
56
+ #define RG_TARGET_NAMESPACE cCompletion
46
57
  #define _SELF(s) ((GCompletion*)RVAL2BOXED(s, G_TYPE_COMPLETION))
47
58
 
48
59
  /* data should be [self, data] */
@@ -52,9 +63,9 @@ comp_func(gpointer compdata)
52
63
  VALUE ret;
53
64
  VALUE self = RARRAY_PTR((VALUE)compdata)[0];
54
65
  VALUE data = RARRAY_PTR((VALUE)compdata)[1];
55
-
66
+
56
67
  VALUE func = rb_ivar_get(self, id_compfunc);
57
-
68
+
58
69
  if (NIL_P(func)){
59
70
  ret = rb_funcall(data, id_to_s, 0);
60
71
  } else {
@@ -64,7 +75,7 @@ comp_func(gpointer compdata)
64
75
  }
65
76
 
66
77
  static VALUE
67
- comp_initialize(VALUE self)
78
+ rg_initialize(VALUE self)
68
79
  {
69
80
  VALUE block = Qnil;
70
81
 
@@ -82,7 +93,7 @@ comp_initialize(VALUE self)
82
93
  }
83
94
 
84
95
  static VALUE
85
- comp_add_items(VALUE self, VALUE items)
96
+ rg_add_items(VALUE self, VALUE items)
86
97
  {
87
98
  gint i, len;
88
99
  GList* list = (GList*)NULL;
@@ -102,7 +113,7 @@ comp_add_items(VALUE self, VALUE items)
102
113
  }
103
114
 
104
115
  static VALUE
105
- comp_remove_items(VALUE self, VALUE items)
116
+ rg_remove_items(VALUE self, VALUE items)
106
117
  {
107
118
  gint i, len;
108
119
  GList* list = (GList*)NULL;
@@ -122,7 +133,7 @@ comp_remove_items(VALUE self, VALUE items)
122
133
  }
123
134
 
124
135
  static VALUE
125
- comp_clear_items(VALUE self)
136
+ rg_clear_items(VALUE self)
126
137
  {
127
138
  VALUE items_internal = rb_ivar_get(self, id_items_internal);
128
139
  rb_funcall(items_internal, id_clear, 0);
@@ -131,13 +142,13 @@ comp_clear_items(VALUE self)
131
142
  }
132
143
 
133
144
  static VALUE
134
- comp_items(VALUE self)
145
+ rg_items(VALUE self)
135
146
  {
136
147
  return rb_ivar_get(self, id_items_internal);
137
148
  }
138
149
 
139
150
  static VALUE
140
- comp_complete(VALUE self, VALUE prefix)
151
+ rg_complete(VALUE self, VALUE prefix)
141
152
  {
142
153
  gchar* new_prefix;
143
154
  VALUE ary = rb_ary_new();
@@ -164,9 +175,9 @@ void g_completion_set_compare (GCompletion *cmp,
164
175
  */
165
176
 
166
177
  void
167
- Init_glib_completion()
178
+ Init_glib_completion(void)
168
179
  {
169
- VALUE comp = G_DEF_CLASS(G_TYPE_COMPLETION, "Completion", mGLib);
180
+ VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_COMPLETION, "Completion", mGLib);
170
181
 
171
182
  id_call = rb_intern("call");
172
183
  id_to_s = rb_intern("to_s");
@@ -174,11 +185,11 @@ Init_glib_completion()
174
185
  id_compfunc = rb_intern("completion_proc");
175
186
  id_items_internal = rb_intern("items_internal");
176
187
 
177
- rb_define_method(comp, "initialize", comp_initialize, 0);
178
- rb_define_method(comp, "add_items", comp_add_items, 1);
179
- rb_define_method(comp, "remove_items", comp_remove_items, 1);
180
- rb_define_method(comp, "clear_items", comp_clear_items, 0);
181
- rb_define_method(comp, "complete", comp_complete, 1);
188
+ RG_DEF_METHOD(initialize, 0);
189
+ RG_DEF_METHOD(add_items, 1);
190
+ RG_DEF_METHOD(remove_items, 1);
191
+ RG_DEF_METHOD(clear_items, 0);
192
+ RG_DEF_METHOD(complete, 1);
182
193
 
183
- rb_define_method(comp, "items", comp_items, 0);
194
+ RG_DEF_METHOD(items, 0);
184
195
  }
@@ -1,20 +1,32 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /**********************************************************************
2
+ /*
3
+ * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
+ * Copyright (C) 2009 Ruby-GNOME2 Project Team
5
+ * Copyright (C) 2002,2003 KUBO Takehiro
6
+ *
7
+ * This library is free software; you can redistribute it and/or
8
+ * modify it under the terms of the GNU Lesser General Public
9
+ * License as published by the Free Software Foundation; either
10
+ * version 2.1 of the License, or (at your option) any later version.
11
+ *
12
+ * This library is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
+ * Lesser General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU Lesser General Public
18
+ * License along with this library; if not, write to the Free Software
19
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
20
+ * MA 02110-1301 USA
21
+ */
3
22
 
4
- rbglib_convert.c -
5
-
6
- $Author: sakai $
7
- $Date: 2007/06/16 02:46:28 $
8
-
9
- Copyright (C) 2002,2003 KUBO Takehiro
10
- Copyright (C) 2009 Ruby-GNOME2 Project Team
11
-
12
- **********************************************************************/
13
23
  #include "rbgprivate.h"
14
24
  #include "rbglib.h"
15
25
 
26
+ #define RG_TARGET_NAMESPACE mGLib
27
+
16
28
  static VALUE
17
- rbglib_m_convert(VALUE self, VALUE str, VALUE to, VALUE from)
29
+ rg_m_convert(G_GNUC_UNUSED VALUE self, VALUE str, VALUE to, VALUE from)
18
30
  {
19
31
  GError *err = NULL;
20
32
  gchar* ret;
@@ -25,7 +37,7 @@ rbglib_m_convert(VALUE self, VALUE str, VALUE to, VALUE from)
25
37
  ret = g_convert(RSTRING_PTR(str), RSTRING_LEN(str),
26
38
  StringValuePtr(to), StringValuePtr(from),
27
39
  NULL, &written, &err);
28
-
40
+
29
41
  if (err != NULL)
30
42
  RAISE_GERROR(err);
31
43
  s = rb_str_new(ret, written);
@@ -34,7 +46,7 @@ rbglib_m_convert(VALUE self, VALUE str, VALUE to, VALUE from)
34
46
  }
35
47
 
36
48
  static VALUE
37
- rbglib_m_locale_to_utf8(VALUE self, VALUE str)
49
+ rg_m_locale_to_utf8(G_GNUC_UNUSED VALUE self, VALUE str)
38
50
  {
39
51
  GError *err = NULL;
40
52
  VALUE s = Qnil;
@@ -53,7 +65,7 @@ rbglib_m_locale_to_utf8(VALUE self, VALUE str)
53
65
  }
54
66
 
55
67
  static VALUE
56
- rbglib_m_locale_from_utf8(VALUE self, VALUE str)
68
+ rg_m_locale_from_utf8(G_GNUC_UNUSED VALUE self, VALUE str)
57
69
  {
58
70
  GError *err = NULL;
59
71
  VALUE s = Qnil;
@@ -72,7 +84,7 @@ rbglib_m_locale_from_utf8(VALUE self, VALUE str)
72
84
  }
73
85
 
74
86
  static VALUE
75
- rbglib_m_filename_to_utf8(VALUE self, VALUE str)
87
+ rg_m_filename_to_utf8(G_GNUC_UNUSED VALUE self, VALUE str)
76
88
  {
77
89
  GError *err = NULL;
78
90
  VALUE s = Qnil;
@@ -91,7 +103,7 @@ rbglib_m_filename_to_utf8(VALUE self, VALUE str)
91
103
  }
92
104
 
93
105
  static VALUE
94
- rbglib_m_filename_from_utf8(VALUE self, VALUE str)
106
+ rg_m_filename_from_utf8(G_GNUC_UNUSED VALUE self, VALUE str)
95
107
  {
96
108
  GError *err = NULL;
97
109
  VALUE s = Qnil;
@@ -110,7 +122,7 @@ rbglib_m_filename_from_utf8(VALUE self, VALUE str)
110
122
  }
111
123
 
112
124
  static VALUE
113
- rbglib_m_filename_to_uri(int argc, VALUE *argv, VALUE self)
125
+ rg_m_filename_to_uri(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
114
126
  {
115
127
  VALUE filename, hostname, s;
116
128
  GError *err = NULL;
@@ -130,7 +142,7 @@ rbglib_m_filename_to_uri(int argc, VALUE *argv, VALUE self)
130
142
  }
131
143
 
132
144
  static VALUE
133
- rbglib_m_filename_from_uri(VALUE self, VALUE str)
145
+ rg_m_filename_from_uri(G_GNUC_UNUSED VALUE self, VALUE str)
134
146
  {
135
147
  GError *err = NULL;
136
148
  VALUE s;
@@ -149,7 +161,7 @@ rbglib_m_filename_from_uri(VALUE self, VALUE str)
149
161
  }
150
162
 
151
163
  static VALUE
152
- rbglib_m_utf8_validate(VALUE self, VALUE str)
164
+ rg_m_utf8_validate(G_GNUC_UNUSED VALUE self, VALUE str)
153
165
  {
154
166
  rb_warning("GLib.utf8_validate is deprecated. Use GLib::UTF8.validate instead.");
155
167
  StringValue(str);
@@ -157,9 +169,9 @@ rbglib_m_utf8_validate(VALUE self, VALUE str)
157
169
  }
158
170
 
159
171
  void
160
- Init_glib_convert()
172
+ Init_glib_convert(void)
161
173
  {
162
- VALUE cCharError = G_DEF_ERROR2(G_CONVERT_ERROR, "ConvertError", mGLib, rb_eIOError);
174
+ VALUE cCharError = G_DEF_ERROR2(G_CONVERT_ERROR, "ConvertError", RG_TARGET_NAMESPACE, rb_eIOError);
163
175
 
164
176
  rb_define_const(cCharError, "NO_CONVERSION", INT2NUM(G_CONVERT_ERROR_NO_CONVERSION));
165
177
  rb_define_const(cCharError, "ILLEGAL_SEQUENCE", INT2NUM(G_CONVERT_ERROR_ILLEGAL_SEQUENCE));
@@ -171,15 +183,15 @@ Init_glib_convert()
171
183
  /* glib/gunicode.h */
172
184
  /* just for backward compatibility.
173
185
  Use GLib::UTF8.validate instead. */
174
- rb_define_module_function(mGLib, "utf8_validate", rbglib_m_utf8_validate, 1);
186
+ RG_DEF_MODFUNC(utf8_validate, 1);
175
187
 
176
188
  /* glib/gconvert.h */
177
- rb_define_module_function(mGLib, "convert", rbglib_m_convert, 3);
178
- rb_define_module_function(mGLib, "locale_to_utf8", rbglib_m_locale_to_utf8, 1);
179
- rb_define_module_function(mGLib, "locale_from_utf8", rbglib_m_locale_from_utf8, 1);
180
- rb_define_module_function(mGLib, "filename_to_utf8", rbglib_m_filename_to_utf8, 1);
181
- rb_define_module_function(mGLib, "filename_from_utf8", rbglib_m_filename_from_utf8, 1);
182
-
183
- rb_define_module_function(mGLib, "filename_to_uri", rbglib_m_filename_to_uri, -1);
184
- rb_define_module_function(mGLib, "filename_from_uri", rbglib_m_filename_from_uri, 1);
189
+ RG_DEF_MODFUNC(convert, 3);
190
+ RG_DEF_MODFUNC(locale_to_utf8, 1);
191
+ RG_DEF_MODFUNC(locale_from_utf8, 1);
192
+ RG_DEF_MODFUNC(filename_to_utf8, 1);
193
+ RG_DEF_MODFUNC(filename_from_utf8, 1);
194
+
195
+ RG_DEF_MODFUNC(filename_to_uri, -1);
196
+ RG_DEF_MODFUNC(filename_from_uri, 1);
185
197
  }
@@ -1,13 +1,23 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /************************************************
3
-
4
- rbgerror.c -
5
-
6
- $Author: mutoh $
7
- $Date: 2004/08/22 13:27:47 $
8
-
9
- Copyright (C) 2004 Masao Mutoh
10
- ************************************************/
2
+ /*
3
+ * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
+ * Copyright (C) 2004 Masao Mutoh
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
+ */
11
21
 
12
22
  #include "rbgprivate.h"
13
23
  #include <ctype.h>
@@ -76,7 +86,7 @@ rbgerr_define_gerror(GQuark domain, const gchar *name, VALUE module, VALUE paren
76
86
  }
77
87
 
78
88
  void
79
- Init_glib_error()
89
+ Init_glib_error(void)
80
90
  {
81
91
  id_code = rb_intern("@code");
82
92
  id_domain = rb_intern("@domain");
@@ -1,18 +1,29 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /**********************************************************************
3
-
4
- rbglib_fileutils.c -
5
-
6
- $Author: mutoh $
7
- $Date: 2004/09/17 15:09:07 $
8
-
9
- Copyright (C) 2004 Masao Mutoh
10
-
11
- **********************************************************************/
2
+ /*
3
+ * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
+ * Copyright (C) 2004 Masao Mutoh
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
+ */
12
21
 
13
22
  #include "rbgprivate.h"
14
23
  #include "rbglib.h"
15
24
 
25
+ #define RG_TARGET_NAMESPACE cFileError
26
+
16
27
  /* Use Ruby standard libraries.
17
28
  enum GFileTest;
18
29
  GFileError g_file_error_from_errno (gint err_no);
@@ -40,41 +51,41 @@ void g_dir_close (GDir *dir);
40
51
 
41
52
  #if GLIB_CHECK_VERSION(2, 16, 0)
42
53
  static VALUE
43
- rbglib_m_format_size_for_display(VALUE self, VALUE size)
54
+ rbglib_m_format_size_for_display(G_GNUC_UNUSED VALUE self, VALUE size)
44
55
  {
45
56
  return CSTR2RVAL_FREE(g_format_size_for_display(NUM2INT(size)));
46
57
  }
47
58
  #endif
48
59
 
49
60
  void
50
- Init_glib_fileutils()
61
+ Init_glib_fileutils(void)
51
62
  {
52
- VALUE cFileError = G_DEF_ERROR2(G_FILE_ERROR, "FileError", mGLib, rb_eIOError);
63
+ VALUE RG_TARGET_NAMESPACE = G_DEF_ERROR2(G_FILE_ERROR, "FileError", mGLib, rb_eIOError);
53
64
 
54
- rb_define_const(cFileError, "EXIST", INT2NUM(G_FILE_ERROR_EXIST));
55
- rb_define_const(cFileError, "ISDIR", INT2NUM(G_FILE_ERROR_ISDIR));
56
- rb_define_const(cFileError, "ACCES", INT2NUM(G_FILE_ERROR_ACCES));
57
- rb_define_const(cFileError, "NAMETOOLONG", INT2NUM(G_FILE_ERROR_NAMETOOLONG));
58
- rb_define_const(cFileError, "NOENT", INT2NUM(G_FILE_ERROR_NOENT));
59
- rb_define_const(cFileError, "NOTDIR", INT2NUM(G_FILE_ERROR_NOTDIR));
60
- rb_define_const(cFileError, "NXIO", INT2NUM(G_FILE_ERROR_NXIO));
61
- rb_define_const(cFileError, "NODEV", INT2NUM(G_FILE_ERROR_NODEV));
62
- rb_define_const(cFileError, "ROFS", INT2NUM(G_FILE_ERROR_ROFS));
63
- rb_define_const(cFileError, "TXTBSY", INT2NUM(G_FILE_ERROR_TXTBSY));
64
- rb_define_const(cFileError, "FAULT", INT2NUM(G_FILE_ERROR_FAULT));
65
- rb_define_const(cFileError, "LOOP", INT2NUM(G_FILE_ERROR_LOOP));
66
- rb_define_const(cFileError, "NOSPC", INT2NUM(G_FILE_ERROR_NOSPC));
67
- rb_define_const(cFileError, "NOMEM", INT2NUM(G_FILE_ERROR_NOMEM));
68
- rb_define_const(cFileError, "MFILE", INT2NUM(G_FILE_ERROR_MFILE));
69
- rb_define_const(cFileError, "NFILE", INT2NUM(G_FILE_ERROR_NFILE));
70
- rb_define_const(cFileError, "BADF", INT2NUM(G_FILE_ERROR_BADF));
71
- rb_define_const(cFileError, "INVAL", INT2NUM(G_FILE_ERROR_INVAL));
72
- rb_define_const(cFileError, "PIPE", INT2NUM(G_FILE_ERROR_PIPE));
73
- rb_define_const(cFileError, "AGAIN", INT2NUM(G_FILE_ERROR_AGAIN));
74
- rb_define_const(cFileError, "INTR", INT2NUM(G_FILE_ERROR_INTR));
75
- rb_define_const(cFileError, "IO", INT2NUM(G_FILE_ERROR_IO));
76
- rb_define_const(cFileError, "PERM", INT2NUM(G_FILE_ERROR_PERM));
77
- rb_define_const(cFileError, "FAILED", INT2NUM(G_FILE_ERROR_FAILED));
65
+ rb_define_const(RG_TARGET_NAMESPACE, "EXIST", INT2NUM(G_FILE_ERROR_EXIST));
66
+ rb_define_const(RG_TARGET_NAMESPACE, "ISDIR", INT2NUM(G_FILE_ERROR_ISDIR));
67
+ rb_define_const(RG_TARGET_NAMESPACE, "ACCES", INT2NUM(G_FILE_ERROR_ACCES));
68
+ rb_define_const(RG_TARGET_NAMESPACE, "NAMETOOLONG", INT2NUM(G_FILE_ERROR_NAMETOOLONG));
69
+ rb_define_const(RG_TARGET_NAMESPACE, "NOENT", INT2NUM(G_FILE_ERROR_NOENT));
70
+ rb_define_const(RG_TARGET_NAMESPACE, "NOTDIR", INT2NUM(G_FILE_ERROR_NOTDIR));
71
+ rb_define_const(RG_TARGET_NAMESPACE, "NXIO", INT2NUM(G_FILE_ERROR_NXIO));
72
+ rb_define_const(RG_TARGET_NAMESPACE, "NODEV", INT2NUM(G_FILE_ERROR_NODEV));
73
+ rb_define_const(RG_TARGET_NAMESPACE, "ROFS", INT2NUM(G_FILE_ERROR_ROFS));
74
+ rb_define_const(RG_TARGET_NAMESPACE, "TXTBSY", INT2NUM(G_FILE_ERROR_TXTBSY));
75
+ rb_define_const(RG_TARGET_NAMESPACE, "FAULT", INT2NUM(G_FILE_ERROR_FAULT));
76
+ rb_define_const(RG_TARGET_NAMESPACE, "LOOP", INT2NUM(G_FILE_ERROR_LOOP));
77
+ rb_define_const(RG_TARGET_NAMESPACE, "NOSPC", INT2NUM(G_FILE_ERROR_NOSPC));
78
+ rb_define_const(RG_TARGET_NAMESPACE, "NOMEM", INT2NUM(G_FILE_ERROR_NOMEM));
79
+ rb_define_const(RG_TARGET_NAMESPACE, "MFILE", INT2NUM(G_FILE_ERROR_MFILE));
80
+ rb_define_const(RG_TARGET_NAMESPACE, "NFILE", INT2NUM(G_FILE_ERROR_NFILE));
81
+ rb_define_const(RG_TARGET_NAMESPACE, "BADF", INT2NUM(G_FILE_ERROR_BADF));
82
+ rb_define_const(RG_TARGET_NAMESPACE, "INVAL", INT2NUM(G_FILE_ERROR_INVAL));
83
+ rb_define_const(RG_TARGET_NAMESPACE, "PIPE", INT2NUM(G_FILE_ERROR_PIPE));
84
+ rb_define_const(RG_TARGET_NAMESPACE, "AGAIN", INT2NUM(G_FILE_ERROR_AGAIN));
85
+ rb_define_const(RG_TARGET_NAMESPACE, "INTR", INT2NUM(G_FILE_ERROR_INTR));
86
+ rb_define_const(RG_TARGET_NAMESPACE, "IO", INT2NUM(G_FILE_ERROR_IO));
87
+ rb_define_const(RG_TARGET_NAMESPACE, "PERM", INT2NUM(G_FILE_ERROR_PERM));
88
+ rb_define_const(RG_TARGET_NAMESPACE, "FAILED", INT2NUM(G_FILE_ERROR_FAILED));
78
89
 
79
90
  #if GLIB_CHECK_VERSION(2, 16, 0)
80
91
  rb_define_module_function(mGLib, "format_size_for_display",
@@ -1,34 +1,44 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /**********************************************************************
3
-
4
- rbglib_i18n.c -
5
-
6
- $Author: ktou $
7
- $Date: 2006/02/08 14:54:51 $
8
-
9
- Copyright (C) 2006 Kouhei Sutou
10
-
11
- **********************************************************************/
2
+ /*
3
+ * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
+ * Copyright (C) 2006 Kouhei Sutou
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
+ */
12
21
 
13
22
  #include "rbgprivate.h"
14
23
  #include "rbglib.h"
15
24
  #undef _
16
25
  #include <glib/gi18n.h>
17
26
 
27
+ #define RG_TARGET_NAMESPACE mGLib
28
+
18
29
  #if GLIB_CHECK_VERSION(2,6,0)
19
30
  static VALUE
20
- rbglib_m_language_names(VALUE self)
31
+ rg_m_language_names(G_GNUC_UNUSED VALUE self)
21
32
  {
22
33
  return STRV2RVAL((const gchar **)g_get_language_names());
23
34
  }
24
35
  #endif
25
36
 
26
37
  void
27
- Init_glib_i18n()
38
+ Init_glib_i18n(void)
28
39
  {
29
40
  /* glib/gi18n.h */
30
41
  #if GLIB_CHECK_VERSION(2,6,0)
31
- rb_define_module_function(mGLib, "language_names",
32
- rbglib_m_language_names, 0);
42
+ RG_DEF_MODFUNC(language_names, 0);
33
43
  #endif
34
44
  }