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,19 +1,31 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /**********************************************************************
3
-
4
- rbglib.h -
5
-
6
- $Author: sakai $
7
- $Date: 2007/07/04 13:13:20 $
8
-
9
- Copyright (C) 2002-2005 Ruby-GNOME2 Project
10
- Copyright (C) 2002,2003 Masahiro Sakai
11
-
12
- **********************************************************************/
2
+ /*
3
+ * Copyright (C) 2011-2012 Ruby-GNOME2 Project Team
4
+ * Copyright (C) 2002-2005 Ruby-GNOME2 Project
5
+ * Copyright (C) 2002,2003 Masahiro Sakai
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
+ */
13
22
 
14
23
  #include <glib.h>
15
24
  #include "ruby.h"
16
25
 
26
+ #include "rbglibdeprecated.h"
27
+ #include "rbglib2conversions.h"
28
+
17
29
  #ifndef __RBGLIB_H__
18
30
  #define __RBGLIB_H__
19
31
 
@@ -22,8 +34,8 @@ extern "C" {
22
34
  #endif /* __cplusplus */
23
35
 
24
36
  #define RBGLIB_MAJOR_VERSION 1
25
- #define RBGLIB_MINOR_VERSION 0
26
- #define RBGLIB_MICRO_VERSION 3
37
+ #define RBGLIB_MINOR_VERSION 1
38
+ #define RBGLIB_MICRO_VERSION 0
27
39
 
28
40
  #ifndef RSTRING_PTR
29
41
  # define RSTRING_PTR(s) (RSTRING(s)->ptr)
@@ -45,29 +57,56 @@ typedef int GPid;
45
57
 
46
58
  #define RBG_INSPECT(object) (rbg_rval_inspect(object))
47
59
 
48
- #define RVAL2CSTR(v) (rbg_rval2cstr(&v))
49
- #define RVAL2CSTR_ACCEPT_NIL(v) (rbg_rval2cstr_accept_nil(&v))
60
+ #define RVAL2CSTR(v) (rbg_rval2cstr(&(v)))
61
+ #define RVAL2CSTR_ACCEPT_NIL(v) (rbg_rval2cstr_accept_nil(&(v)))
50
62
  #define RVAL2CSTR2(v) (RVAL2CSTR_ACCEPT_NIL(v))
63
+ #define RVAL2CSTR_ACCEPT_SYMBOL(v) (rbg_rval2cstr_accept_symbol(&(v)))
64
+ #define RVAL2CSTR_ACCEPT_SYMBOL_ACCEPT_NIL(v) (rbg_rval2cstr_accept_symbol_accept_nil(&(v)))
65
+ #define RVAL2GLIBID(v, buf) (rbg_rval2glibid(&(v), &(buf), FALSE))
66
+ #define RVAL2GLIBID_ACCEPT_NIL(v, buf) (rbg_rval2glibid(&(v), &(buf), TRUE))
51
67
  #define CSTR2RVAL(s) (rbg_cstr2rval(s))
52
68
  #define CSTR2RVAL_LEN(s, l) (rbg_cstr2rval_len(s, l))
69
+ #define CSTR2RVAL_LEN_FREE(s, l) (rbg_cstr2rval_len_free(s, l))
53
70
  #define CSTR2RVAL_ENC(s, e) (rbg_cstr2rval_with_encoding(s, e))
54
71
  #define CSTR2RVAL_LEN_ENC(s, l, e) (rbg_cstr2rval_len_with_encoding(s, l, e))
55
72
  #define CSTR2RVAL_FREE(s) (rbg_cstr2rval_free(s))
56
73
  #define CSTR2RVAL2(s) (CSTR2RVAL_FREE(s))
57
74
 
75
+ #if G_BYTE_ORDER == G_LITTLE_ENDIAN
76
+ # define CSTR2RVAL_LEN_UCS4(s, l) (CSTR2RVAL_LEN_ENC(s, l, "UTF-32LE"))
77
+ # define CSTR2RVAL_LEN_UTF16(s, l) (CSTR2RVAL_LEN_ENC(s, l, "UTF-16LE"))
78
+ #else
79
+ # define CSTR2RVAL_LEN_UCS4(s, l) (CSTR2RVAL_LEN_ENC(s, l, "UTF-32BE"))
80
+ # define CSTR2RVAL_LEN_UTF16(s, l) (CSTR2RVAL_LEN_ENC(s, l, "UTF-16BE"))
81
+ #endif
82
+
58
83
  #define RVAL2CSTRFILENAME(v) (rbg_filename_from_ruby(v))
59
84
  #define CSTRFILENAME2RVAL(s) (rbg_filename_to_ruby(s))
60
85
  #define CSTRFILENAME2RVAL_FREE(s) (rbg_filename_to_ruby_free(s))
61
- #define CSTRFILENAMEARRAY2RVAL_FREE(s) (rbg_filename_gslist_to_array_free(s))
62
86
 
63
- #define RVAL2STRV(ary) rbg_rval2strv(ary)
64
- #define RVAL2STRV_ACCEPT_NIL(ary) rbg_rval2strv_accept_nil(ary)
65
- #define RVAL2STRV_DUP(ary) rbg_rval2strv_dup(ary)
66
- #define RVAL2STRV_DUP_ACCEPT_NIL(ary) rbg_rval2strv_dup_accept_nil(ary)
87
+ #define RVAL2STRS(ary, n) rbg_rval2strv(&(ary), &(n))
88
+ #define RVAL2STRS_ACCEPT_NIL(ary, n) rbg_rval2strv_accept_nil(&(ary), &(n))
89
+ #define RVAL2STRV(ary) rbg_rval2strv(&(ary), NULL)
90
+ #define RVAL2STRV_ACCEPT_NIL(ary) rbg_rval2strv_accept_nil(&(ary), NULL)
91
+ #define RVAL2STRS_DUP(ary, n) rbg_rval2strv_dup(&(ary), &(n))
92
+ #define RVAL2STRS_DUP_ACCEPT_NIL(ary, n) rbg_rval2strv_dup_accept_nil(&(ary), &(n))
93
+ #define RVAL2STRV_DUP(ary) rbg_rval2strv_dup(&(ary), NULL)
94
+ #define RVAL2STRV_DUP_ACCEPT_NIL(ary) rbg_rval2strv_dup_accept_nil(&(ary), NULL)
67
95
 
68
96
  #define STRV2RVAL(strings) rbg_strv2rval(strings)
69
97
  #define STRV2RVAL_FREE(strings) rbg_strv2rval_free(strings)
70
98
 
99
+ #define RVAL2GBOOLEANS(ary, n) rbg_rval2gbooleans(&(ary), &(n))
100
+ #define RVAL2GINTS(ary, n) rbg_rval2gints(&(ary), &(n))
101
+ #define RVAL2GINT8S(ary, n) rbg_rval2gint8s(&(ary), &(n))
102
+ #define RVAL2GUINT8S(ary, n) rbg_rval2guint8s(&(ary), &(n))
103
+ #define RVAL2GUINT16S(ary, n) rbg_rval2guint16s(&(ary), &(n))
104
+ #define RVAL2GUINT32S(ary, n) rbg_rval2guint32s(&(ary), &(n))
105
+ #define RVAL2GDOUBLES(ary, n) rbg_rval2gdoubles(&(ary), &(n))
106
+
107
+ #define GINTS2RVAL(ary, n) rbg_gints2rval(ary, n)
108
+ #define GINTS2RVAL_FREE(ary, n) rbg_gints2rval(ary, n)
109
+
71
110
  #define CBOOL2RVAL(b) ((b) ? Qtrue : Qfalse)
72
111
  #define RVAL2CBOOL(b) (RTEST(b))
73
112
  #define GERROR2RVAL(error) (rbgerr_gerror2exception(error))
@@ -94,8 +133,13 @@ extern const gchar *rbg_rval_inspect(VALUE object);
94
133
  extern gchar* rbg_string_value_ptr(volatile VALUE* ptr); /* no longer used */
95
134
  extern const gchar *rbg_rval2cstr(VALUE *str);
96
135
  extern const gchar *rbg_rval2cstr_accept_nil(VALUE *str);
136
+ extern const gchar *rbg_rval2cstr_accept_symbol(volatile VALUE *value);
137
+ extern const gchar *rbg_rval2cstr_accept_symbol_accept_nil(volatile VALUE *value);
138
+ extern const gchar *rbg_rval2glibid(volatile VALUE *value, volatile VALUE *buf, gboolean accept_nil);
139
+
97
140
  extern VALUE rbg_cstr2rval(const gchar* str);
98
141
  extern VALUE rbg_cstr2rval_len(const gchar* str, gsize len);
142
+ extern VALUE rbg_cstr2rval_len_free(gchar *str, gsize len);
99
143
  extern VALUE rbg_cstr2rval_with_encoding(const gchar* str,
100
144
  const gchar *encoding);
101
145
  extern VALUE rbg_cstr2rval_len_with_encoding(const gchar* str, gsize len,
@@ -107,16 +151,27 @@ extern VALUE rbg_cstr2rval_with_free(gchar *str);
107
151
  VALUE rbg_filename_to_ruby(const gchar *filename);
108
152
  extern VALUE rbg_filename_to_ruby_free(gchar *filename);
109
153
  extern gchar *rbg_filename_from_ruby(VALUE filename);
110
- extern VALUE rbg_filename_gslist_to_array_free(GSList *list);
111
154
 
112
- const gchar **rbg_rval2strv(VALUE ary);
113
- const gchar **rbg_rval2strv_accept_nil(VALUE ary);
114
- gchar **rbg_rval2strv_dup(VALUE ary);
115
- gchar **rbg_rval2strv_dup_accept_nil(VALUE ary);
116
- const gchar **rbg_rval2argv(VALUE ary);
155
+ const gchar **rbg_rval2strv(volatile VALUE *value, long *n);
156
+ const gchar **rbg_rval2strv_accept_nil(volatile VALUE *value, long *n);
157
+ gchar **rbg_rval2strv_dup(volatile VALUE *value, long *n);
158
+ gchar **rbg_rval2strv_dup_accept_nil(volatile VALUE *value, long *n);
117
159
  VALUE rbg_strv2rval(const gchar **strings);
118
160
  VALUE rbg_strv2rval_free(gchar **strings);
119
161
 
162
+ gboolean *rbg_rval2gbooleans(volatile VALUE *value, long *n);
163
+ gint *rbg_rval2gints(volatile VALUE *value, long *n);
164
+ gint8 *rbg_rval2gint8s(volatile VALUE *value, long *n);
165
+ guint8 *rbg_rval2guint8s(volatile VALUE *value, long *n);
166
+ guint16 *rbg_rval2guint16s(volatile VALUE *value, long *n);
167
+ guint32 *rbg_rval2guint32s(volatile VALUE *value, long *n);
168
+ gdouble *rbg_rval2gdoubles(volatile VALUE *value, long *n);
169
+
170
+ VALUE rbg_gints2rval(const gint *gints, long n);
171
+ VALUE rbg_gints2rval_free(gint *gints, long n);
172
+
173
+ extern void rbg_scan_options(VALUE options, ...);
174
+
120
175
  /* rbgerror.h */
121
176
  extern VALUE rbgerr_gerror2exception(GError *error);
122
177
  extern VALUE rbgerr_define_gerror(GQuark domain, const gchar* name, VALUE module, VALUE parent, VALUE gtype);
@@ -0,0 +1,57 @@
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 __GLIB2CONVERSIONS_H__
22
+ #define __GLIB2CONVERSIONS_H__
23
+
24
+ #define RVAL2GPARAMSPEC(o) (G_PARAM_SPEC(RVAL2GOBJ(o)))
25
+
26
+ #define RVAL2GCLOSURE(o) ((GClosure*)RVAL2BOXED(o, G_TYPE_CLOSURE))
27
+ #define GCLOSURE2RVAL(o) (BOXED2RVAL(o, G_TYPE_CLOSURE))
28
+ #define RVAL2GCOMPLETION(o) ((GCompletion*)RVAL2BOXED(o, G_TYPE_COMPLETION))
29
+ #define GCOMPLETION2RVAL(o) (BOXED2RVAL(o, G_TYPE_COMPLETION))
30
+ #define RVAL2GIOCHANNEL(o) ((GIOChannel*)RVAL2BOXED(o, G_TYPE_IO_CHANNEL))
31
+ #define GIOCHANNEL2RVAL(o) (BOXED2RVAL(o, G_TYPE_IO_CHANNEL))
32
+ #define RVAL2GKEYFILE(o) ((GKeyFile*)RVAL2BOXED(o, G_TYPE_KEY_FILE))
33
+ #define GKEYFILE2RVAL(o) (BOXED2RVAL(o, G_TYPE_KEY_FILE))
34
+ #define RVAL2GMAINCONTEXT(o) ((GMainContext*)RVAL2BOXED(o, G_TYPE_MAIN_CONTEXT))
35
+ #define GMAINCONTEXT2RVAL(o) (BOXED2RVAL(o, G_TYPE_MAIN_CONTEXT))
36
+ #define RVAL2GMAINLOOP(o) ((GMainLoop*)RVAL2BOXED(o, G_TYPE_MAIN_LOOP))
37
+ #define GMAINLOOP2RVAL(o) (BOXED2RVAL(o, G_TYPE_MAIN_LOOP))
38
+ #define RVAL2GPOLLFD(o) ((GPollFD*)RVAL2BOXED(o, G_TYPE_POLL_FD))
39
+ #define GPOLLFD2RVAL(o) (BOXED2RVAL(o, G_TYPE_POLL_FD))
40
+ #define RVAL2GSOURCE(o) ((GSource*)RVAL2BOXED(o, G_TYPE_SOURCE))
41
+ #define GSOURCE2RVAL(o) (BOXED2RVAL(o, G_TYPE_SOURCE))
42
+ #define RVAL2GTIMER(o) ((GTimer*)RVAL2BOXED(o, G_TYPE_TIMER))
43
+ #define GTIMER2RVAL(o) (BOXED2RVAL(o, G_TYPE_TIMER))
44
+ #define RVAL2GVALUE(o) ((GValue*)RVAL2BOXED(o, G_TYPE_VALUE))
45
+ #define GVALUE2RVAL(o) (BOXED2RVAL(o, G_TYPE_VALUE))
46
+
47
+ #define RVAL2GIOCONDITION(o) (RVAL2GENUM(o, G_TYPE_IO_CONDITION))
48
+ #define GIOCONDITION2RVAL(o) (GENUM2RVAL(o, G_TYPE_IO_CONDITION))
49
+ #define RVAL2GNORMALIZEMODE(o) (RVAL2GENUM(o, G_TYPE_NORMALIZE_MODE))
50
+ #define GNORMALIZEMODE2RVAL(o) (GENUM2RVAL(o, G_TYPE_NORMALIZE_MODE))
51
+
52
+ #define RVAL2GCONNECTFLAGS(o) (RVAL2GFLAGS(o, G_TYPE_CONNECT_FLAGS))
53
+ #define GCONNECTFLAGS2RVAL(o) (GFLAGS2RVAL(o, G_TYPE_CONNECT_FLAGS))
54
+ #define RVAL2GKEYFILEFLAGS(o) (RVAL2GFLAGS(o, G_TYPE_KEY_FILE_FLAGS))
55
+ #define GKEYFILEFLAGS2RVAL(o) (GFLAGS2RVAL(o, G_TYPE_KEY_FILE_FLAGS))
56
+
57
+ #endif /* __GLIB2CONVERSIONS_H__ */
@@ -1,13 +1,23 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /************************************************
3
-
4
- rbglib_bookmarkfile.c -
5
-
6
- $Author: sakai $
7
- $Date: 2007/07/07 08:25:33 $
8
-
9
- Copyright (C) 2006 Masao Mutoh
10
- ************************************************/
2
+ /*
3
+ * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
+ * Copyright (C) 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
 
@@ -26,8 +36,7 @@ bookmarkfile_copy(const GBookmarkFile* file)
26
36
  return (GBookmarkFile*)file;
27
37
  }
28
38
 
29
-
30
- GType
39
+ static GType
31
40
  g_bookmark_file_get_type(void)
32
41
  {
33
42
  static GType our_type = 0;
@@ -40,17 +49,19 @@ g_bookmark_file_get_type(void)
40
49
  /************************************************/
41
50
 
42
51
  #define G_TYPE_BOOKMARK_FILE (g_bookmark_file_get_type())
52
+
53
+ #define RG_TARGET_NAMESPACE cBookmarkFile
43
54
  #define _SELF(self) ((GBookmarkFile*)(RVAL2BOXED(self, G_TYPE_BOOKMARK_FILE)))
44
55
 
45
56
  static VALUE
46
- bf_initialize(VALUE self)
57
+ rg_initialize(VALUE self)
47
58
  {
48
59
  G_INITIALIZE(self, g_bookmark_file_new());
49
60
  return Qnil;
50
61
  }
51
62
 
52
63
  static VALUE
53
- bf_load_from_file(VALUE self, VALUE rbfilename)
64
+ rg_load_from_file(VALUE self, VALUE rbfilename)
54
65
  {
55
66
  gchar *filename = RVAL2CSTRFILENAME(rbfilename);
56
67
  GError* error = NULL;
@@ -63,22 +74,22 @@ bf_load_from_file(VALUE self, VALUE rbfilename)
63
74
  }
64
75
 
65
76
  static VALUE
66
- bf_load_from_data(VALUE self, VALUE data)
77
+ rg_load_from_data(VALUE self, VALUE data)
67
78
  {
68
79
  GError *error = NULL;
69
80
 
70
81
  StringValue(data);
71
82
  if (!g_bookmark_file_load_from_data(_SELF(self),
72
- RSTRING_PTR(data),
73
- RSTRING_LEN(data),
74
- &error))
75
- RAISE_GERROR(error);
83
+ RSTRING_PTR(data),
84
+ RSTRING_LEN(data),
85
+ &error))
86
+ RAISE_GERROR(error);
76
87
 
77
88
  return Qnil;
78
89
  }
79
90
 
80
91
  static VALUE
81
- bf_load_from_data_dirs(VALUE self, VALUE file)
92
+ rg_load_from_data_dirs(VALUE self, VALUE file)
82
93
  {
83
94
  GError* error = NULL;
84
95
  gboolean ret;
@@ -94,18 +105,18 @@ bf_load_from_data_dirs(VALUE self, VALUE file)
94
105
  }
95
106
 
96
107
  static VALUE
97
- bf_to_data(VALUE self)
108
+ rg_to_data(VALUE self)
98
109
  {
99
110
  GError* error = NULL;
100
111
  gchar* data = g_bookmark_file_to_data(_SELF(self), NULL, &error);
101
112
 
102
113
  if (error) RAISE_GERROR(error);
103
-
114
+
104
115
  return CSTR2RVAL_FREE(data);
105
116
  }
106
117
 
107
118
  static VALUE
108
- bf_to_file(VALUE self, VALUE rbfilename)
119
+ rg_to_file(VALUE self, VALUE rbfilename)
109
120
  {
110
121
  gchar *filename = RVAL2CSTRFILENAME(rbfilename);
111
122
  GError* error = NULL;
@@ -118,14 +129,14 @@ bf_to_file(VALUE self, VALUE rbfilename)
118
129
  }
119
130
 
120
131
  static VALUE
121
- bf_has_item(VALUE self, VALUE uri)
132
+ rg_has_item_p(VALUE self, VALUE uri)
122
133
  {
123
134
  return CBOOL2RVAL(g_bookmark_file_has_item(_SELF(self),
124
135
  RVAL2CSTR(uri)));
125
136
  }
126
137
 
127
138
  static VALUE
128
- bf_has_group(VALUE self, VALUE uri, VALUE group)
139
+ rg_has_group_p(VALUE self, VALUE uri, VALUE group)
129
140
  {
130
141
  GError* error = NULL;
131
142
  return CBOOL2RVAL(g_bookmark_file_has_group(_SELF(self),
@@ -133,9 +144,9 @@ bf_has_group(VALUE self, VALUE uri, VALUE group)
133
144
  RVAL2CSTR(group),
134
145
  &error));
135
146
  }
136
-
147
+
137
148
  static VALUE
138
- bf_has_application(VALUE self, VALUE uri, VALUE name)
149
+ rg_has_application_p(VALUE self, VALUE uri, VALUE name)
139
150
  {
140
151
  GError* error = NULL;
141
152
  return CBOOL2RVAL(g_bookmark_file_has_application(_SELF(self),
@@ -143,21 +154,21 @@ bf_has_application(VALUE self, VALUE uri, VALUE name)
143
154
  RVAL2CSTR(name),
144
155
  &error));
145
156
  }
146
-
157
+
147
158
  static VALUE
148
- bf_get_size(VALUE self)
159
+ rg_size(VALUE self)
149
160
  {
150
161
  return INT2NUM(g_bookmark_file_get_size(_SELF(self)));
151
162
  }
152
163
 
153
164
  static VALUE
154
- bf_get_uris(VALUE self)
165
+ rg_uris(VALUE self)
155
166
  {
156
167
  return STRV2RVAL_FREE(g_bookmark_file_get_uris(_SELF(self), NULL));
157
168
  }
158
169
 
159
170
  static VALUE
160
- bf_get_title(VALUE self, VALUE uri)
171
+ rg_get_title(VALUE self, VALUE uri)
161
172
  {
162
173
  GError *error = NULL;
163
174
  gchar* ret = g_bookmark_file_get_title(_SELF(self),
@@ -168,7 +179,7 @@ bf_get_title(VALUE self, VALUE uri)
168
179
  }
169
180
 
170
181
  static VALUE
171
- bf_get_description(VALUE self, VALUE uri)
182
+ rg_get_description(VALUE self, VALUE uri)
172
183
  {
173
184
  GError *error = NULL;
174
185
  gchar* ret = g_bookmark_file_get_description(_SELF(self),
@@ -179,7 +190,7 @@ bf_get_description(VALUE self, VALUE uri)
179
190
  }
180
191
 
181
192
  static VALUE
182
- bf_get_mime_type(VALUE self, VALUE uri)
193
+ rg_get_mime_type(VALUE self, VALUE uri)
183
194
  {
184
195
  GError *error = NULL;
185
196
  gchar* ret = g_bookmark_file_get_mime_type(_SELF(self),
@@ -190,7 +201,7 @@ bf_get_mime_type(VALUE self, VALUE uri)
190
201
  }
191
202
 
192
203
  static VALUE
193
- bf_get_is_private(VALUE self, VALUE uri)
204
+ rg_private_p(VALUE self, VALUE uri)
194
205
  {
195
206
  GError *error = NULL;
196
207
  gboolean ret = g_bookmark_file_get_is_private(_SELF(self),
@@ -201,7 +212,7 @@ bf_get_is_private(VALUE self, VALUE uri)
201
212
  }
202
213
 
203
214
  static VALUE
204
- bf_get_icon(VALUE self, VALUE uri)
215
+ rg_get_icon(VALUE self, VALUE uri)
205
216
  {
206
217
  gchar* href;
207
218
  gchar* mime_type;
@@ -218,7 +229,7 @@ bf_get_icon(VALUE self, VALUE uri)
218
229
  }
219
230
 
220
231
  static VALUE
221
- bf_get_added(VALUE self, VALUE uri)
232
+ rg_get_added(VALUE self, VALUE uri)
222
233
  {
223
234
  GError *error = NULL;
224
235
  time_t ret = g_bookmark_file_get_added(_SELF(self),
@@ -230,7 +241,7 @@ bf_get_added(VALUE self, VALUE uri)
230
241
  }
231
242
 
232
243
  static VALUE
233
- bf_get_modified(VALUE self, VALUE uri)
244
+ rg_get_modified(VALUE self, VALUE uri)
234
245
  {
235
246
  GError *error = NULL;
236
247
  time_t ret = g_bookmark_file_get_modified(_SELF(self),
@@ -242,7 +253,7 @@ bf_get_modified(VALUE self, VALUE uri)
242
253
  }
243
254
 
244
255
  static VALUE
245
- bf_get_visited(VALUE self, VALUE uri)
256
+ rg_get_visited(VALUE self, VALUE uri)
246
257
  {
247
258
  GError *error = NULL;
248
259
  time_t ret = g_bookmark_file_get_visited(_SELF(self),
@@ -254,7 +265,7 @@ bf_get_visited(VALUE self, VALUE uri)
254
265
  }
255
266
 
256
267
  static VALUE
257
- bf_get_groups(VALUE self, VALUE uri)
268
+ rg_get_groups(VALUE self, VALUE uri)
258
269
  {
259
270
  gsize length;
260
271
  VALUE ary;
@@ -264,7 +275,6 @@ bf_get_groups(VALUE self, VALUE uri)
264
275
  RVAL2CSTR(uri),
265
276
  &length, &error);
266
277
  if (error) RAISE_GERROR(error);
267
-
268
278
 
269
279
  ary = rb_ary_new();
270
280
  for(i = 0; i < length; i++){
@@ -276,7 +286,7 @@ bf_get_groups(VALUE self, VALUE uri)
276
286
  }
277
287
 
278
288
  static VALUE
279
- bf_get_applications(VALUE self, VALUE uri)
289
+ rg_get_applications(VALUE self, VALUE uri)
280
290
  {
281
291
  gsize length;
282
292
  VALUE ary;
@@ -286,7 +296,6 @@ bf_get_applications(VALUE self, VALUE uri)
286
296
  RVAL2CSTR(uri),
287
297
  &length, &error);
288
298
  if (error) RAISE_GERROR(error);
289
-
290
299
 
291
300
  ary = rb_ary_new();
292
301
  for(i = 0; i < length; i++){
@@ -296,9 +305,9 @@ bf_get_applications(VALUE self, VALUE uri)
296
305
  g_strfreev(ret);
297
306
  return ary;
298
307
  }
299
-
308
+
300
309
  static VALUE
301
- bf_get_app_info(VALUE self, VALUE uri, VALUE name)
310
+ rg_get_app_info(VALUE self, VALUE uri, VALUE name)
302
311
  {
303
312
  gchar* exec;
304
313
  guint count;
@@ -310,12 +319,12 @@ bf_get_app_info(VALUE self, VALUE uri, VALUE name)
310
319
  RVAL2CSTR(name),
311
320
  &exec, &count, &stamp, &error);
312
321
  if (!ret) RAISE_GERROR(error);
313
-
322
+
314
323
  return rb_ary_new3(3, CSTR2RVAL(exec), UINT2NUM(count), rb_time_new(stamp, 0));
315
324
  }
316
325
 
317
326
  static VALUE
318
- bf_set_title(VALUE self, VALUE uri, VALUE title)
327
+ rg_set_title(VALUE self, VALUE uri, VALUE title)
319
328
  {
320
329
  g_bookmark_file_set_title(_SELF(self),
321
330
  RVAL2CSTR(uri),
@@ -324,7 +333,7 @@ bf_set_title(VALUE self, VALUE uri, VALUE title)
324
333
  }
325
334
 
326
335
  static VALUE
327
- bf_set_description(VALUE self, VALUE uri, VALUE description)
336
+ rg_set_description(VALUE self, VALUE uri, VALUE description)
328
337
  {
329
338
  g_bookmark_file_set_description(_SELF(self),
330
339
  RVAL2CSTR(uri),
@@ -333,7 +342,7 @@ bf_set_description(VALUE self, VALUE uri, VALUE description)
333
342
  }
334
343
 
335
344
  static VALUE
336
- bf_set_mime_type(VALUE self, VALUE uri, VALUE mime_type)
345
+ rg_set_mime_type(VALUE self, VALUE uri, VALUE mime_type)
337
346
  {
338
347
  g_bookmark_file_set_mime_type(_SELF(self),
339
348
  RVAL2CSTR(uri),
@@ -342,7 +351,7 @@ bf_set_mime_type(VALUE self, VALUE uri, VALUE mime_type)
342
351
  }
343
352
 
344
353
  static VALUE
345
- bf_set_is_private(VALUE self, VALUE uri, VALUE is_private)
354
+ rg_set_private(VALUE self, VALUE uri, VALUE is_private)
346
355
  {
347
356
  g_bookmark_file_set_is_private(_SELF(self),
348
357
  RVAL2CSTR(uri),
@@ -351,7 +360,7 @@ bf_set_is_private(VALUE self, VALUE uri, VALUE is_private)
351
360
  }
352
361
 
353
362
  static VALUE
354
- bf_set_icon(VALUE self, VALUE uri, VALUE href, VALUE mime_type)
363
+ rg_set_icon(VALUE self, VALUE uri, VALUE href, VALUE mime_type)
355
364
  {
356
365
  g_bookmark_file_set_icon(_SELF(self),
357
366
  RVAL2CSTR(uri),
@@ -361,7 +370,7 @@ bf_set_icon(VALUE self, VALUE uri, VALUE href, VALUE mime_type)
361
370
  }
362
371
 
363
372
  static VALUE
364
- bf_set_added(VALUE self, VALUE uri, VALUE time)
373
+ rg_set_added(VALUE self, VALUE uri, VALUE time)
365
374
  {
366
375
  g_bookmark_file_set_added(_SELF(self),
367
376
  RVAL2CSTR(uri),
@@ -370,12 +379,14 @@ bf_set_added(VALUE self, VALUE uri, VALUE time)
370
379
  }
371
380
 
372
381
  static VALUE
373
- bf_set_groups(VALUE self, VALUE uri, VALUE rbgroups)
382
+ rg_set_groups(VALUE self, VALUE rburi, VALUE rbgroups)
374
383
  {
375
- VALUE ary = rb_ary_to_ary(rbgroups);
376
- const gchar **groups = RVAL2STRV(ary);
377
-
378
- g_bookmark_file_set_groups(_SELF(self), RVAL2CSTR(uri), groups, RARRAY_LEN(ary));
384
+ GBookmarkFile *bookmark = _SELF(self);
385
+ const gchar *uri = RVAL2CSTR(rburi);
386
+ long n;
387
+ const gchar **groups = RVAL2STRS(rbgroups, n);
388
+
389
+ g_bookmark_file_set_groups(bookmark, uri, groups, n);
379
390
 
380
391
  g_free(groups);
381
392
 
@@ -383,7 +394,7 @@ bf_set_groups(VALUE self, VALUE uri, VALUE rbgroups)
383
394
  }
384
395
 
385
396
  static VALUE
386
- bf_set_modified(VALUE self, VALUE uri, VALUE time)
397
+ rg_set_modified(VALUE self, VALUE uri, VALUE time)
387
398
  {
388
399
  g_bookmark_file_set_modified(_SELF(self),
389
400
  RVAL2CSTR(uri),
@@ -392,7 +403,7 @@ bf_set_modified(VALUE self, VALUE uri, VALUE time)
392
403
  }
393
404
 
394
405
  static VALUE
395
- bf_set_visited(VALUE self, VALUE uri, VALUE time)
406
+ rg_set_visited(VALUE self, VALUE uri, VALUE time)
396
407
  {
397
408
  g_bookmark_file_set_visited(_SELF(self),
398
409
  RVAL2CSTR(uri),
@@ -401,7 +412,7 @@ bf_set_visited(VALUE self, VALUE uri, VALUE time)
401
412
  }
402
413
 
403
414
  static VALUE
404
- bf_set_app_info(VALUE self, VALUE uri, VALUE name, VALUE exec, VALUE count, VALUE stamp)
415
+ rg_set_app_info(VALUE self, VALUE uri, VALUE name, VALUE exec, VALUE count, VALUE stamp)
405
416
  {
406
417
  GError* error = NULL;
407
418
  gboolean ret = g_bookmark_file_set_app_info(_SELF(self),
@@ -411,14 +422,14 @@ bf_set_app_info(VALUE self, VALUE uri, VALUE name, VALUE exec, VALUE count, VALU
411
422
  NUM2INT(count),
412
423
  (time_t)NUM2LONG(rb_Integer(stamp)),
413
424
  &error);
414
-
425
+
415
426
  if (! ret) RAISE_GERROR(error);
416
427
 
417
428
  return self;
418
429
  }
419
430
 
420
431
  static VALUE
421
- bf_add_group(VALUE self, VALUE uri, VALUE group)
432
+ rg_add_group(VALUE self, VALUE uri, VALUE group)
422
433
  {
423
434
  g_bookmark_file_add_group(_SELF(self),
424
435
  RVAL2CSTR(uri),
@@ -427,7 +438,7 @@ bf_add_group(VALUE self, VALUE uri, VALUE group)
427
438
  }
428
439
 
429
440
  static VALUE
430
- bf_add_application(VALUE self, VALUE uri, VALUE name, VALUE exec)
441
+ rg_add_application(VALUE self, VALUE uri, VALUE name, VALUE exec)
431
442
  {
432
443
  g_bookmark_file_add_application(_SELF(self),
433
444
  RVAL2CSTR(uri),
@@ -437,7 +448,7 @@ bf_add_application(VALUE self, VALUE uri, VALUE name, VALUE exec)
437
448
  }
438
449
 
439
450
  static VALUE
440
- bf_remove_group(VALUE self, VALUE uri, VALUE group)
451
+ rg_remove_group(VALUE self, VALUE uri, VALUE group)
441
452
  {
442
453
  GError* error = NULL;
443
454
  gboolean ret = g_bookmark_file_remove_group(_SELF(self),
@@ -450,7 +461,7 @@ bf_remove_group(VALUE self, VALUE uri, VALUE group)
450
461
  }
451
462
 
452
463
  static VALUE
453
- bf_remove_application(VALUE self, VALUE uri, VALUE name)
464
+ rg_remove_application(VALUE self, VALUE uri, VALUE name)
454
465
  {
455
466
  GError *error = NULL;
456
467
  gboolean ret = g_bookmark_file_remove_application(_SELF(self),
@@ -462,9 +473,8 @@ bf_remove_application(VALUE self, VALUE uri, VALUE name)
462
473
  return self;
463
474
  }
464
475
 
465
-
466
476
  static VALUE
467
- bf_remove_item(VALUE self, VALUE uri)
477
+ rg_remove_item(VALUE self, VALUE uri)
468
478
  {
469
479
  GError *error = NULL;
470
480
  gboolean ret = g_bookmark_file_remove_item(_SELF(self),
@@ -476,7 +486,7 @@ bf_remove_item(VALUE self, VALUE uri)
476
486
  }
477
487
 
478
488
  static VALUE
479
- bf_move_item(VALUE self, VALUE old_uri, VALUE new_uri)
489
+ rg_move_item(VALUE self, VALUE old_uri, VALUE new_uri)
480
490
  {
481
491
  GError *error = NULL;
482
492
  gboolean ret = g_bookmark_file_move_item(_SELF(self),
@@ -491,51 +501,51 @@ bf_move_item(VALUE self, VALUE old_uri, VALUE new_uri)
491
501
  #endif
492
502
 
493
503
  void
494
- Init_glib_bookmark_file()
504
+ Init_glib_bookmark_file(void)
495
505
  {
496
506
  #if GLIB_CHECK_VERSION(2,12,0)
497
- VALUE bf = G_DEF_CLASS(G_TYPE_BOOKMARK_FILE, "BookmarkFile", mGLib);
507
+ VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_BOOKMARK_FILE, "BookmarkFile", mGLib);
498
508
 
499
509
  G_DEF_ERROR(G_BOOKMARK_FILE_ERROR, "BookmarkFileError", mGLib,
500
510
  rb_eRuntimeError, G_TYPE_BOOKMARK_FILE_ERROR);
501
511
 
502
- rb_define_method(bf, "initialize", bf_initialize, 0);
503
- rb_define_method(bf, "load_from_file", bf_load_from_file, 1);
504
- rb_define_method(bf, "load_from_data", bf_load_from_data, 1);
505
- rb_define_method(bf, "load_from_data_dirs", bf_load_from_data_dirs, 1);
506
- rb_define_method(bf, "to_data", bf_to_data, 0);
507
- rb_define_method(bf, "to_file", bf_to_file, 1);
508
- rb_define_method(bf, "has_item?", bf_has_item, 1);
509
- rb_define_method(bf, "has_group?", bf_has_group, 2);
510
- rb_define_method(bf, "has_application?", bf_has_application, 2);
511
- rb_define_method(bf, "size", bf_get_size, 0);
512
- rb_define_method(bf, "uris", bf_get_uris, 0);
513
- rb_define_method(bf, "get_title", bf_get_title, 1);
514
- rb_define_method(bf, "get_description", bf_get_description, 1);
515
- rb_define_method(bf, "get_mime_type", bf_get_mime_type, 1);
516
- rb_define_method(bf, "private?", bf_get_is_private, 1);
517
- rb_define_method(bf, "get_icon", bf_get_icon, 1);
518
- rb_define_method(bf, "get_added", bf_get_added, 1);
519
- rb_define_method(bf, "get_modified", bf_get_modified, 1);
520
- rb_define_method(bf, "get_visited", bf_get_visited, 1);
521
- rb_define_method(bf, "get_groups", bf_get_groups, 1);
522
- rb_define_method(bf, "get_applications", bf_get_applications, 1);
523
- rb_define_method(bf, "get_app_info", bf_get_app_info, 2);
524
- rb_define_method(bf, "set_title", bf_set_title, 2);
525
- rb_define_method(bf, "set_description", bf_set_description, 2);
526
- rb_define_method(bf, "set_mime_type", bf_set_mime_type, 2);
527
- rb_define_method(bf, "set_private", bf_set_is_private, 2);
528
- rb_define_method(bf, "set_icon", bf_set_icon, 3);
529
- rb_define_method(bf, "set_added", bf_set_added, 2);
530
- rb_define_method(bf, "set_groups", bf_set_groups, 2);
531
- rb_define_method(bf, "set_modified", bf_set_modified, 2);
532
- rb_define_method(bf, "set_visited", bf_set_visited, 2);
533
- rb_define_method(bf, "set_app_info", bf_set_app_info, 5);
534
- rb_define_method(bf, "add_group", bf_add_group, 2);
535
- rb_define_method(bf, "add_application", bf_add_application, 3);
536
- rb_define_method(bf, "remove_group", bf_remove_group, 2);
537
- rb_define_method(bf, "remove_application", bf_remove_application, 2);
538
- rb_define_method(bf, "remove_item", bf_remove_item, 1);
539
- rb_define_method(bf, "move_item", bf_move_item, 2);
512
+ RG_DEF_METHOD(initialize, 0);
513
+ RG_DEF_METHOD(load_from_file, 1);
514
+ RG_DEF_METHOD(load_from_data, 1);
515
+ RG_DEF_METHOD(load_from_data_dirs, 1);
516
+ RG_DEF_METHOD(to_data, 0);
517
+ RG_DEF_METHOD(to_file, 1);
518
+ RG_DEF_METHOD_P(has_item, 1);
519
+ RG_DEF_METHOD_P(has_group, 2);
520
+ RG_DEF_METHOD_P(has_application, 2);
521
+ RG_DEF_METHOD(size, 0);
522
+ RG_DEF_METHOD(uris, 0);
523
+ RG_DEF_METHOD(get_title, 1);
524
+ RG_DEF_METHOD(get_description, 1);
525
+ RG_DEF_METHOD(get_mime_type, 1);
526
+ RG_DEF_METHOD_P(private, 1);
527
+ RG_DEF_METHOD(get_icon, 1);
528
+ RG_DEF_METHOD(get_added, 1);
529
+ RG_DEF_METHOD(get_modified, 1);
530
+ RG_DEF_METHOD(get_visited, 1);
531
+ RG_DEF_METHOD(get_groups, 1);
532
+ RG_DEF_METHOD(get_applications, 1);
533
+ RG_DEF_METHOD(get_app_info, 2);
534
+ RG_DEF_METHOD(set_title, 2);
535
+ RG_DEF_METHOD(set_description, 2);
536
+ RG_DEF_METHOD(set_mime_type, 2);
537
+ RG_DEF_METHOD(set_private, 2);
538
+ RG_DEF_METHOD(set_icon, 3);
539
+ RG_DEF_METHOD(set_added, 2);
540
+ RG_DEF_METHOD(set_groups, 2);
541
+ RG_DEF_METHOD(set_modified, 2);
542
+ RG_DEF_METHOD(set_visited, 2);
543
+ RG_DEF_METHOD(set_app_info, 5);
544
+ RG_DEF_METHOD(add_group, 2);
545
+ RG_DEF_METHOD(add_application, 3);
546
+ RG_DEF_METHOD(remove_group, 2);
547
+ RG_DEF_METHOD(remove_application, 2);
548
+ RG_DEF_METHOD(remove_item, 1);
549
+ RG_DEF_METHOD(move_item, 2);
540
550
  #endif
541
- }
551
+ }