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,39 +1,49 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /**********************************************************************
3
-
4
- rbgobj_typeinstance.c -
5
-
6
- $Author: sakai $
7
- $Date: 2007/07/04 13:13:19 $
8
- created at: Sat May 27 14:18:55 JST 2006
9
-
10
- Copyright (C) 2002-2006 Ruby-GNOME2 Project Team
11
- Copyright (C) 2002,2003 Masahiro Sakai
12
-
13
- **********************************************************************/
2
+ /*
3
+ * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
+ * Copyright (C) 2002-2006 Ruby-GNOME2 Project Team
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
+ */
14
22
 
15
23
  #include "rbgprivate.h"
16
24
 
17
- VALUE cInstantiatable;
25
+ #define RG_TARGET_NAMESPACE cInstantiatable
26
+
27
+ VALUE RG_TARGET_NAMESPACE;
18
28
 
19
29
  typedef void (*ClassInfoCallbackFunc) (gpointer instance,
20
- const RGObjClassInfo *class_info,
21
- gpointer user_data);
30
+ const RGObjClassInfo *class_info,
31
+ gpointer user_data);
22
32
 
23
- static VALUE
24
- instantiatable_s_allocate(VALUE klass)
33
+ static G_GNUC_NORETURN VALUE
34
+ instantiatable_s_allocate(G_GNUC_UNUSED VALUE klass)
25
35
  {
26
36
  rb_raise(rb_eTypeError, "abstract class");
27
37
  }
28
38
 
29
39
  static VALUE
30
- instantiatable_get_gtype(VALUE self)
40
+ rg_gtype(VALUE self)
31
41
  {
32
42
  return rbgobj_gtype_new(G_TYPE_FROM_INSTANCE(rbgobj_instance_from_ruby_object(self)));
33
43
  }
34
44
 
35
- static VALUE
36
- instantiatable_clone(VALUE self)
45
+ static G_GNUC_NORETURN VALUE
46
+ rg_clone(VALUE self)
37
47
  {
38
48
  rb_raise(rb_eTypeError, "can't clone %s", rb_class2name(CLASS_OF(self)));
39
49
  }
@@ -51,35 +61,35 @@ each_cinfo(gpointer instance, ClassInfoCallbackFunc func, gpointer user_data)
51
61
  {
52
62
  guint i;
53
63
  for (i = 0; i < n_interfaces; i++) {
54
- const RGObjClassInfo *info;
64
+ const RGObjClassInfo *info;
55
65
 
56
- info = GTYPE2CINFO_NO_CREATE(interfaces[i]);
57
- if (info)
58
- func(instance, info, user_data);
59
- }
66
+ info = GTYPE2CINFO_NO_CREATE(interfaces[i]);
67
+ if (info)
68
+ func(instance, info, user_data);
69
+ }
60
70
  }
61
71
  g_free(interfaces);
62
72
 
63
73
  {
64
74
  GType type;
65
75
  for (type = gtype; type != G_TYPE_INVALID; type = g_type_parent(type)) {
66
- const RGObjClassInfo *info;
76
+ const RGObjClassInfo *info;
67
77
 
68
- info = GTYPE2CINFO_NO_CREATE(type);
69
- if (info)
70
- func(instance, info, user_data);
71
- }
78
+ info = GTYPE2CINFO_NO_CREATE(type);
79
+ if (info)
80
+ func(instance, info, user_data);
81
+ }
72
82
  }
73
83
  }
74
84
 
75
85
  static void
76
- call_cinfo_free(gpointer instance, const RGObjClassInfo *cinfo, gpointer user_data)
86
+ call_cinfo_free(gpointer instance, const RGObjClassInfo *cinfo, G_GNUC_UNUSED gpointer user_data)
77
87
  {
78
88
  if (cinfo->free) cinfo->free(instance);
79
89
  }
80
90
 
81
91
  static void
82
- call_cinfo_mark(gpointer instance, const RGObjClassInfo *cinfo, gpointer user_data)
92
+ call_cinfo_mark(gpointer instance, const RGObjClassInfo *cinfo, G_GNUC_UNUSED gpointer user_data)
83
93
  {
84
94
  if (cinfo->mark) cinfo->mark(instance);
85
95
  }
@@ -106,13 +116,13 @@ rbgobj_gc_mark_instance(gpointer instance)
106
116
  /**********************************************************************/
107
117
 
108
118
  void
109
- Init_gobject_typeinstance()
119
+ Init_gobject_typeinstance(void)
110
120
  {
111
121
  /* should be renamed to GLib::Instance? */
112
- cInstantiatable = rb_define_class_under(mGLib, "Instantiatable", rb_cObject);
113
- rb_extend_object(cInstantiatable, mMetaInterface);
122
+ RG_TARGET_NAMESPACE = rb_define_class_under(mGLib, "Instantiatable", rb_cObject);
123
+ rb_extend_object(RG_TARGET_NAMESPACE, mMetaInterface);
114
124
 
115
- rb_define_alloc_func(cInstantiatable, (VALUE(*)_((VALUE)))instantiatable_s_allocate);
116
- rb_define_method(cInstantiatable, "gtype", instantiatable_get_gtype, 0);
117
- rb_define_method(cInstantiatable, "clone", instantiatable_clone, 0);
118
- }
125
+ rb_define_alloc_func(RG_TARGET_NAMESPACE, (VALUE(*)_((VALUE)))instantiatable_s_allocate);
126
+ RG_DEF_METHOD(gtype, 0);
127
+ RG_DEF_METHOD(clone, 0);
128
+ }
@@ -1,24 +1,34 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /**********************************************************************
3
-
4
- rbgobj_typeinterface.c -
5
-
6
- $Author: ggc $
7
- $Date: 2007/07/13 16:07:28 $
8
- created at: Sat May 27 16:04:13 JST 2006
9
-
10
- Copyright (C) 2002-2006 Ruby-GNOME2 Project Team
11
- Copyright (C) 2002,2003 Masahiro Sakai
12
-
13
- **********************************************************************/
2
+ /*
3
+ * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
+ * Copyright (C) 2002-2006 Ruby-GNOME2 Project Team
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
+ */
14
22
 
15
23
  #include "rbgprivate.h"
16
24
 
25
+ #define RG_TARGET_NAMESPACE mMetaInterface
26
+
17
27
  VALUE rbgobj_mInterface;
18
- VALUE mMetaInterface;
28
+ VALUE RG_TARGET_NAMESPACE;
19
29
 
20
30
  static VALUE
21
- interface_s_append_features(VALUE self, VALUE klass)
31
+ rg_append_features(G_GNUC_UNUSED VALUE self, VALUE klass)
22
32
  {
23
33
  if (!rb_obj_is_kind_of(klass, cInstantiatable))
24
34
  rb_raise(rb_eTypeError, "Not a subclass of GLib::Instantiatable");
@@ -28,7 +38,7 @@ interface_s_append_features(VALUE self, VALUE klass)
28
38
  #if GLIB_CHECK_VERSION(2,4,0)
29
39
 
30
40
  static VALUE
31
- interface_s_install_property(VALUE self, VALUE pspec_obj)
41
+ rg_install_property(VALUE self, VALUE pspec_obj)
32
42
  {
33
43
  const RGObjClassInfo* cinfo = rbgobj_lookup_class(self);
34
44
  gpointer ginterface;
@@ -47,7 +57,7 @@ interface_s_install_property(VALUE self, VALUE pspec_obj)
47
57
  }
48
58
 
49
59
  static VALUE
50
- interface_s_property(VALUE self, VALUE property_name)
60
+ rg_property(VALUE self, VALUE property_name)
51
61
  {
52
62
  gpointer ginterface;
53
63
  const char* name;
@@ -82,7 +92,7 @@ interface_s_property(VALUE self, VALUE property_name)
82
92
  }
83
93
 
84
94
  static VALUE
85
- interface_s_properties(int argc, VALUE* argv, VALUE self)
95
+ rg_properties(int argc, VALUE* argv, VALUE self)
86
96
  {
87
97
  guint n_properties;
88
98
  GParamSpec** props;
@@ -119,9 +129,9 @@ rbgobj_init_interface(VALUE interf)
119
129
  {
120
130
  static VALUE rb_mGLibInterface = Qnil;
121
131
 
122
- rb_extend_object(interf, mMetaInterface);
132
+ rb_extend_object(interf, RG_TARGET_NAMESPACE);
123
133
  if (CLASS2GTYPE(interf) == G_TYPE_INTERFACE) {
124
- rb_mGLibInterface = interf;
134
+ rb_mGLibInterface = interf;
125
135
  } else {
126
136
  rb_extend_object(interf, rb_mGLibInterface);
127
137
  rb_include_module(interf, rb_mGLibInterface);
@@ -130,16 +140,16 @@ rbgobj_init_interface(VALUE interf)
130
140
  }
131
141
 
132
142
  void
133
- Init_gobject_typeinterface()
143
+ Init_gobject_typeinterface(void)
134
144
  {
135
- mMetaInterface = rb_define_module_under(mGLib, "MetaInterface");
136
- rb_define_method(mMetaInterface, "gtype", generic_s_gtype, 0);
137
- rb_define_method(mMetaInterface, "append_features", interface_s_append_features, 1);
145
+ RG_TARGET_NAMESPACE = rb_define_module_under(mGLib, "MetaInterface");
146
+ rb_define_method(RG_TARGET_NAMESPACE, "gtype", generic_s_gtype, 0);
147
+ RG_DEF_METHOD(append_features, 1);
138
148
  #if GLIB_CHECK_VERSION(2,4,0)
139
- rb_define_method(mMetaInterface, "install_property", interface_s_install_property, 1);
140
- rb_define_method(mMetaInterface, "property", interface_s_property, 1);
141
- rb_define_method(mMetaInterface, "properties", interface_s_properties, -1);
149
+ RG_DEF_METHOD(install_property, 1);
150
+ RG_DEF_METHOD(property, 1);
151
+ RG_DEF_METHOD(properties, -1);
142
152
  #endif
143
153
 
144
154
  rbgobj_mInterface = G_DEF_INTERFACE(G_TYPE_INTERFACE, "Interface", mGLib);
145
- }
155
+ }
@@ -1,39 +1,49 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /**********************************************************************
3
-
4
- rbgobj_typemodule.c -
5
-
6
- $Author: ggc $
7
- $Date: 2007/07/13 14:27:07 $
8
- created at: Sat Jul 27 16:56:01 JST 2002
9
-
10
- Copyright (C) 2002,2003 Masahiro Sakai
11
-
12
- **********************************************************************/
2
+ /*
3
+ * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
+ * Copyright (C) 2002,2003 Masahiro Sakai
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
+ */
13
21
 
14
22
  #include "rbgprivate.h"
15
23
 
24
+ #define RG_TARGET_NAMESPACE cTypeModule
25
+
16
26
  static VALUE
17
- use(VALUE self)
27
+ rg_use(VALUE self)
18
28
  {
19
29
  return CBOOL2RVAL(g_type_module_use(G_TYPE_MODULE(RVAL2GOBJ(self))));
20
30
  }
21
31
 
22
32
  static VALUE
23
- unuse(VALUE self)
33
+ rg_unuse(VALUE self)
24
34
  {
25
35
  g_type_module_unuse(G_TYPE_MODULE(RVAL2GOBJ(self)));
26
36
  return self;
27
37
  }
28
38
 
29
39
  static VALUE
30
- get_name(VALUE self)
40
+ rg_name(VALUE self)
31
41
  {
32
42
  return rb_str_new2(G_TYPE_MODULE(RVAL2GOBJ(self))->name);
33
43
  }
34
44
 
35
45
  static VALUE
36
- set_name(VALUE self, VALUE name)
46
+ rg_operator_set_name(VALUE self, VALUE name)
37
47
  {
38
48
  g_type_module_set_name(G_TYPE_MODULE(RVAL2GOBJ(self)), StringValuePtr(name));
39
49
  return name;
@@ -41,22 +51,22 @@ set_name(VALUE self, VALUE name)
41
51
 
42
52
  #if 0
43
53
  GType g_type_module_register_type (GTypeModule *module,
44
- GType parent_type,
45
- const gchar *type_name,
46
- const GTypeInfo *type_info,
47
- GTypeFlags flags);
54
+ GType parent_type,
55
+ const gchar *type_name,
56
+ const GTypeInfo *type_info,
57
+ GTypeFlags flags);
48
58
  void g_type_module_add_interface (GTypeModule *module,
49
- GType instance_type,
50
- GType interface_type,
51
- const GInterfaceInfo *interface_info);
59
+ GType instance_type,
60
+ GType interface_type,
61
+ const GInterfaceInfo *interface_info);
52
62
  #endif
53
63
 
54
64
  void
55
- Init_gobject_gtypemodule()
65
+ Init_gobject_gtypemodule(void)
56
66
  {
57
- VALUE cTypeModule = G_DEF_CLASS(G_TYPE_TYPE_MODULE, "TypeModule", mGLib);
58
- rb_define_method(cTypeModule, "use", use, 0);
59
- rb_define_method(cTypeModule, "unuse", unuse, 0);
60
- rb_define_method(cTypeModule, "name", get_name, 0);
61
- rb_define_method(cTypeModule, "name=", set_name, 1);
62
- }
67
+ VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_TYPE_MODULE, "TypeModule", mGLib);
68
+ RG_DEF_METHOD(use, 0);
69
+ RG_DEF_METHOD(unuse, 0);
70
+ RG_DEF_METHOD(name, 0);
71
+ RG_DEF_METHOD_OPERATOR("name=", set_name, 1);
72
+ }
@@ -1,47 +1,57 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /**********************************************************************
3
-
4
- rbgobj_typeplugin.c -
5
-
6
- $Author: mutoh $
7
- $Date: 2003/02/01 16:03:09 $
8
- created at: Mon Aug 5 00:42:09 JST 2002
9
-
10
- Copyright (C) 2002,2003 Masahiro Sakai
11
-
12
- **********************************************************************/
2
+ /*
3
+ * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
+ * Copyright (C) 2002,2003 Masahiro Sakai
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
+ */
13
21
 
14
22
  #include "rbgprivate.h"
15
23
 
24
+ #define RG_TARGET_NAMESPACE mTypePlugin
25
+
16
26
  static VALUE
17
- use(VALUE self)
27
+ rg_use(VALUE self)
18
28
  {
19
29
  g_type_plugin_use(G_TYPE_PLUGIN(RVAL2GOBJ(self)));
20
30
  return self;
21
31
  }
22
32
 
23
33
  static VALUE
24
- unuse(VALUE self)
34
+ rg_unuse(VALUE self)
25
35
  {
26
36
  g_type_plugin_unuse(G_TYPE_PLUGIN(RVAL2GOBJ(self)));
27
37
  return self;
28
38
  }
29
39
 
30
40
  #if 0
31
- void g_type_plugin_complete_type_info (GTypePlugin *plugin,
32
- GType g_type,
33
- GTypeInfo *info,
34
- GTypeValueTable *value_table);
35
- void g_type_plugin_complete_interface_info (GTypePlugin *plugin,
36
- GType interface_type,
37
- GType instance_type,
38
- GInterfaceInfo *info);
41
+ void g_type_plugin_complete_type_info (GTypePlugin *plugin,
42
+ GType g_type,
43
+ GTypeInfo *info,
44
+ GTypeValueTable *value_table);
45
+ void g_type_plugin_complete_interface_info (GTypePlugin *plugin,
46
+ GType interface_type,
47
+ GType instance_type,
48
+ GInterfaceInfo *info);
39
49
  #endif
40
50
 
41
51
  void
42
- Init_gobject_gtypeplugin()
52
+ Init_gobject_gtypeplugin(void)
43
53
  {
44
- VALUE iTypePlugin = G_DEF_INTERFACE(G_TYPE_TYPE_PLUGIN, "TypePlugin", mGLib);
45
- rb_define_method(iTypePlugin, "use", use, 0);
46
- rb_define_method(iTypePlugin, "unuse", unuse, 0);
47
- }
54
+ VALUE RG_TARGET_NAMESPACE = G_DEF_INTERFACE(G_TYPE_TYPE_PLUGIN, "TypePlugin", mGLib);
55
+ RG_DEF_METHOD(use, 0);
56
+ RG_DEF_METHOD(unuse, 0);
57
+ }
@@ -1,14 +1,23 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /**********************************************************************
3
-
4
- rbgobj_value.c -
5
-
6
- $Author: ggc $
7
- $Date: 2007/07/13 16:07:28 $
8
-
9
- Copyright (C) 2002,2003 Masahiro Sakai
10
-
11
- **********************************************************************/
2
+ /*
3
+ * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
+ * Copyright (C) 2002,2003 Masahiro Sakai
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
 
@@ -126,6 +135,27 @@ rbgobj_gvalue_to_rvalue(const GValue* value)
126
135
  }
127
136
  }
128
137
 
138
+ static VALUE
139
+ rbgobj_gvalue_to_rvalue_unset_body(VALUE value)
140
+ {
141
+ return GVAL2RVAL((GValue *)value);
142
+ }
143
+
144
+ static VALUE
145
+ rbgobj_gvalue_to_rvalue_unset_ensure(VALUE value)
146
+ {
147
+ g_value_unset((GValue *)value);
148
+
149
+ return Qnil;
150
+ }
151
+
152
+ VALUE
153
+ rbgobj_gvalue_to_rvalue_unset(GValue *value)
154
+ {
155
+ return rb_ensure(rbgobj_gvalue_to_rvalue_unset_body, (VALUE)value,
156
+ rbgobj_gvalue_to_rvalue_unset_ensure, (VALUE)value);
157
+ }
158
+
129
159
  void
130
160
  rbgobj_initialize_gvalue(GValue *result, VALUE value)
131
161
  {
@@ -303,7 +333,7 @@ rbgobj_gc_mark_gvalue(GValue* value)
303
333
  /**********************************************************************/
304
334
 
305
335
  void
306
- Init_gobject_gvalue()
336
+ Init_gobject_gvalue(void)
307
337
  {
308
338
  id_to_s = rb_intern("to_s");
309
339
  qRValueToGValueFunc = g_quark_from_static_string("__ruby_r2g_func__");