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,17 +1,28 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /************************************************
3
-
4
- rbglib_mainloop.c -
5
-
6
- $Author: ktou $
7
- $Date: 2007/10/03 11:06:01 $
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
 
14
24
  /*****************************************/
25
+ #if !GLIB_CHECK_VERSION(2,30,0)
15
26
  GType
16
27
  g_main_loop_get_type(void)
17
28
  {
@@ -22,14 +33,16 @@ g_main_loop_get_type(void)
22
33
  (GBoxedFreeFunc)g_main_loop_unref);
23
34
  return our_type;
24
35
  }
36
+ #endif
25
37
  /*****************************************/
26
38
 
39
+ #define RG_TARGET_NAMESPACE cMainLoop
27
40
  #define _SELF(s) ((GMainLoop*)RVAL2BOXED(s, G_TYPE_MAIN_LOOP))
28
41
 
29
42
  /*****************************************/
30
43
 
31
44
  static VALUE
32
- ml_initialize(int argc, VALUE *argv, VALUE self)
45
+ rg_initialize(int argc, VALUE *argv, VALUE self)
33
46
  {
34
47
  VALUE context, is_running;
35
48
  GMainLoop *loop;
@@ -45,39 +58,39 @@ ml_initialize(int argc, VALUE *argv, VALUE self)
45
58
  }
46
59
 
47
60
  static VALUE
48
- ml_run(VALUE self)
61
+ rg_run(VALUE self)
49
62
  {
50
63
  g_main_loop_run(_SELF(self));
51
64
  return self;
52
65
  }
53
66
 
54
67
  static VALUE
55
- ml_quit(VALUE self)
68
+ rg_quit(VALUE self)
56
69
  {
57
70
  g_main_loop_quit(_SELF(self));
58
71
  return Qnil;
59
72
  }
60
73
 
61
74
  static VALUE
62
- ml_is_running(VALUE self)
75
+ rg_running_p(VALUE self)
63
76
  {
64
77
  return CBOOL2RVAL(g_main_loop_is_running(_SELF(self)));
65
78
  }
66
79
 
67
80
  static VALUE
68
- ml_get_context(VALUE self)
81
+ rg_context(VALUE self)
69
82
  {
70
83
  return BOXED2RVAL(g_main_loop_get_context(_SELF(self)), G_TYPE_MAIN_CONTEXT);
71
84
  }
72
85
 
73
86
  void
74
- Init_glib_main_loop()
87
+ Init_glib_main_loop(void)
75
88
  {
76
- VALUE ml = G_DEF_CLASS(G_TYPE_MAIN_LOOP, "MainLoop", mGLib);
89
+ VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_MAIN_LOOP, "MainLoop", mGLib);
77
90
 
78
- rb_define_method(ml, "initialize", ml_initialize, -1);
79
- rb_define_method(ml, "run", ml_run, 0);
80
- rb_define_method(ml, "quit", ml_quit, 0);
81
- rb_define_method(ml, "running?", ml_is_running, 0);
82
- rb_define_method(ml, "context", ml_get_context, 0);
91
+ RG_DEF_METHOD(initialize, -1);
92
+ RG_DEF_METHOD(run, 0);
93
+ RG_DEF_METHOD(quit, 0);
94
+ RG_DEF_METHOD_P(running, 0);
95
+ RG_DEF_METHOD(context, 0);
83
96
  }
@@ -1,19 +1,26 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /************************************************
3
-
4
- rbglib_messages.c -
5
-
6
- $Author: sakai $
7
- $Date: 2007/07/07 14:03:35 $
8
-
9
- Copyright (C) 2002-2005 Masao Mutoh
10
-
11
- This file is devided from rbgtkmain.c.
12
- rbgtkmain.c -
13
- Copyright (C) 1998-2000 Yukihiro Matsumoto,
14
- Daisuke Kanda,
15
- Hiroshi Igarashi
16
- ************************************************/
2
+ /*
3
+ * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
+ * Copyright (C) 2002-2005 Masao Mutoh
5
+ * Copyright (C) 1998-2000 Yukihiro Matsumoto,
6
+ * Daisuke Kanda,
7
+ * Hiroshi Igarashi
8
+ *
9
+ * This library is free software; you can redistribute it and/or
10
+ * modify it under the terms of the GNU Lesser General Public
11
+ * License as published by the Free Software Foundation; either
12
+ * version 2.1 of the License, or (at your option) any later version.
13
+ *
14
+ * This library is distributed in the hope that it will be useful,
15
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17
+ * Lesser General Public License for more details.
18
+ *
19
+ * You should have received a copy of the GNU Lesser General Public
20
+ * License along with this library; if not, write to the Free Software
21
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
22
+ * MA 02110-1301 USA
23
+ */
17
24
 
18
25
  #include "rbgprivate.h"
19
26
 
@@ -25,6 +32,8 @@
25
32
  #define rb_sourceline() (ruby_sourceline)
26
33
  #endif
27
34
 
35
+ #define RG_TARGET_NAMESPACE mLog
36
+
28
37
  static VALUE rbglib_log_handler_procs;
29
38
  static ID id_call;
30
39
  static gboolean log_canceled;
@@ -64,78 +73,78 @@ rbglib_log_handler(const gchar *log_domain, GLogLevelFlags log_level, const gcha
64
73
 
65
74
  /* Use Internal only */
66
75
  static VALUE
67
- rbglib_m_log_cancel_handler(VALUE self)
76
+ rg_m_cancel_handler(G_GNUC_UNUSED VALUE self)
68
77
  {
69
78
  log_canceled = TRUE;
70
79
  return Qnil;
71
80
  }
72
81
 
73
82
  static VALUE
74
- rbglib_m_log_set_handler(VALUE self, VALUE domain, VALUE levels)
83
+ rg_m_set_handler(VALUE self, VALUE domain, VALUE levels)
75
84
  {
76
- guint handler_id = g_log_set_handler(NIL_P(domain) ? NULL : RVAL2CSTR(domain),
85
+ guint handler_id = g_log_set_handler(RVAL2CSTR_ACCEPT_NIL(domain),
77
86
  NUM2INT(levels),
78
87
  (GLogFunc)rbglib_log_handler, (gpointer)self);
79
88
  return UINT2NUM(handler_id);
80
89
  }
81
90
 
82
91
  static VALUE
83
- rbglib_m_log_remove_handler(VALUE self, VALUE domain, VALUE handler_id)
92
+ rg_m_remove_handler(VALUE self, VALUE domain, VALUE handler_id)
84
93
  {
85
- g_log_remove_handler(NIL_P(domain) ? NULL : RVAL2CSTR(domain),
94
+ g_log_remove_handler(RVAL2CSTR_ACCEPT_NIL(domain),
86
95
  NUM2UINT(handler_id));
87
96
  G_REMOVE_RELATIVE(self, handler_id, rbglib_log_handler_procs);
88
97
  return Qnil;
89
98
  }
90
99
 
91
100
  static VALUE
92
- rbglib_m_log_set_always_fatal(VALUE self, VALUE fatal_mask)
101
+ rg_m_set_always_fatal(G_GNUC_UNUSED VALUE self, VALUE fatal_mask)
93
102
  {
94
103
  return INT2NUM(g_log_set_always_fatal(NUM2INT(fatal_mask)));
95
104
  }
96
105
 
97
106
  static VALUE
98
- rbglib_m_log_set_fatal_mask(VALUE self, VALUE domain, VALUE fatal_mask)
107
+ rg_m_set_fatal_mask(G_GNUC_UNUSED VALUE self, VALUE domain, VALUE fatal_mask)
99
108
  {
100
- return INT2NUM(g_log_set_fatal_mask(NIL_P(domain) ? NULL : RVAL2CSTR(domain),
109
+ return INT2NUM(g_log_set_fatal_mask(RVAL2CSTR_ACCEPT_NIL(domain),
101
110
  NUM2INT(fatal_mask)));
102
111
  }
103
112
 
104
113
  static VALUE
105
- rbglib_m_log(VALUE self, VALUE domain, VALUE level, VALUE str)
114
+ rg_m_log(G_GNUC_UNUSED VALUE self, VALUE domain, VALUE level, VALUE str)
106
115
  {
107
- g_log(NIL_P(domain) ? NULL : RVAL2CSTR(domain), NUM2INT(level), RVAL2CSTR(str), NULL);
116
+ g_log(RVAL2CSTR_ACCEPT_NIL(domain), NUM2INT(level), "%s", RVAL2CSTR(str));
108
117
  return Qnil;
109
118
  }
110
119
 
111
120
  void
112
- Init_glib_messages()
121
+ Init_glib_messages(void)
113
122
  {
114
- VALUE mGLog = rb_define_module_under(mGLib, "Log");
123
+ VALUE RG_TARGET_NAMESPACE = rb_define_module_under(mGLib, "Log");
115
124
 
116
125
  id_call = rb_intern("call");
117
126
  log_canceled = FALSE;
118
127
 
119
128
  rb_global_variable(&rbglib_log_handler_procs);
120
129
  rbglib_log_handler_procs = rb_hash_new();
121
- rb_define_module_function(mGLog, "set_handler", rbglib_m_log_set_handler, 2);
122
- rb_define_module_function(mGLog, "remove_handler", rbglib_m_log_remove_handler, 2);
123
- rb_define_module_function(mGLog, "cancel_handler", rbglib_m_log_cancel_handler, 0);
124
- rb_define_module_function(mGLog, "set_always_fatal", rbglib_m_log_set_always_fatal, 1);
125
- rb_define_module_function(mGLog, "set_fatal_mask", rbglib_m_log_set_fatal_mask, 2);
126
- rb_define_module_function(mGLog, "log", rbglib_m_log, 3);
130
+ RG_DEF_MODFUNC(set_handler, 2);
131
+ RG_DEF_MODFUNC(remove_handler, 2);
132
+ RG_DEF_MODFUNC(cancel_handler, 0);
133
+ RG_DEF_MODFUNC(set_always_fatal, 1);
134
+ RG_DEF_MODFUNC(set_fatal_mask, 2);
135
+ RG_DEF_MODFUNC(log, 3);
127
136
 
128
- rb_define_const(mGLog, "FATAL_MASK", INT2NUM(G_LOG_FATAL_MASK));
129
- rb_define_const(mGLog, "LEVEL_USER_SHIFT", INT2NUM(G_LOG_LEVEL_USER_SHIFT));
137
+ rb_define_const(RG_TARGET_NAMESPACE, "FATAL_MASK", INT2NUM(G_LOG_FATAL_MASK));
138
+ rb_define_const(RG_TARGET_NAMESPACE, "LEVEL_USER_SHIFT", INT2NUM(G_LOG_LEVEL_USER_SHIFT));
130
139
 
131
140
  /* GLogLevelFlags */
132
- rb_define_const(mGLog, "FLAG_RECURSION", INT2NUM(G_LOG_FLAG_RECURSION));
133
- rb_define_const(mGLog, "FLAG_FATAL", INT2NUM(G_LOG_FLAG_FATAL));
134
- rb_define_const(mGLog, "LEVEL_ERROR", INT2NUM(G_LOG_LEVEL_ERROR));
135
- rb_define_const(mGLog, "LEVEL_CRITICAL", INT2NUM(G_LOG_LEVEL_CRITICAL));
136
- rb_define_const(mGLog, "LEVEL_WARNING", INT2NUM(G_LOG_LEVEL_WARNING));
137
- rb_define_const(mGLog, "LEVEL_MESSAGE", INT2NUM(G_LOG_LEVEL_MESSAGE));
138
- rb_define_const(mGLog, "LEVEL_INFO", INT2NUM(G_LOG_LEVEL_INFO));
139
- rb_define_const(mGLog, "LEVEL_DEBUG", INT2NUM(G_LOG_LEVEL_DEBUG));
140
- rb_define_const(mGLog, "LEVEL_MASK", INT2NUM(G_LOG_LEVEL_MASK));
141
+ rb_define_const(RG_TARGET_NAMESPACE, "FLAG_RECURSION", INT2NUM(G_LOG_FLAG_RECURSION));
142
+ rb_define_const(RG_TARGET_NAMESPACE, "FLAG_FATAL", INT2NUM(G_LOG_FLAG_FATAL));
143
+ rb_define_const(RG_TARGET_NAMESPACE, "LEVEL_ERROR", INT2NUM(G_LOG_LEVEL_ERROR));
144
+ rb_define_const(RG_TARGET_NAMESPACE, "LEVEL_CRITICAL", INT2NUM(G_LOG_LEVEL_CRITICAL));
145
+ rb_define_const(RG_TARGET_NAMESPACE, "LEVEL_WARNING", INT2NUM(G_LOG_LEVEL_WARNING));
146
+ rb_define_const(RG_TARGET_NAMESPACE, "LEVEL_MESSAGE", INT2NUM(G_LOG_LEVEL_MESSAGE));
147
+ rb_define_const(RG_TARGET_NAMESPACE, "LEVEL_INFO", INT2NUM(G_LOG_LEVEL_INFO));
148
+ rb_define_const(RG_TARGET_NAMESPACE, "LEVEL_DEBUG", INT2NUM(G_LOG_LEVEL_DEBUG));
149
+ rb_define_const(RG_TARGET_NAMESPACE, "LEVEL_MASK", INT2NUM(G_LOG_LEVEL_MASK));
141
150
  }
@@ -1,13 +1,23 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /************************************************
3
-
4
- rbglib_pollfd.c -
5
-
6
- $Author: mutoh $
7
- $Date: 2005/03/12 18:03:56 $
8
-
9
- Copyright (C) 2005 Masao Mutoh
10
- ************************************************/
2
+ /*
3
+ * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
+ * Copyright (C) 2005 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
 
@@ -35,10 +45,11 @@ g_poll_fd_get_type(void)
35
45
  }
36
46
  /*****************************************/
37
47
 
48
+ #define RG_TARGET_NAMESPACE cPollFD
38
49
  #define _SELF(s) ((GPollFD*)RVAL2BOXED(s, G_TYPE_POLL_FD))
39
50
 
40
51
  static VALUE
41
- poll_initialize(VALUE self, VALUE fd, VALUE events, VALUE revents)
52
+ rg_initialize(VALUE self, VALUE fd, VALUE events, VALUE revents)
42
53
  {
43
54
  GPollFD gfd;
44
55
  gfd.fd = NUM2INT(fd);
@@ -50,55 +61,55 @@ poll_initialize(VALUE self, VALUE fd, VALUE events, VALUE revents)
50
61
  }
51
62
 
52
63
  static VALUE
53
- poll_set_fd(VALUE self, VALUE fd)
64
+ rg_set_fd(VALUE self, VALUE fd)
54
65
  {
55
66
  _SELF(self)->fd = fd;
56
67
  return self;
57
68
  }
58
69
  static VALUE
59
- poll_fd(VALUE self)
70
+ rg_fd(VALUE self)
60
71
  {
61
72
  return INT2NUM(_SELF(self)->fd);
62
73
  }
63
74
 
64
75
  static VALUE
65
- poll_set_events(VALUE self, VALUE events)
76
+ rg_set_events(VALUE self, VALUE events)
66
77
  {
67
78
  _SELF(self)->events = events;
68
79
  return self;
69
80
  }
70
81
  static VALUE
71
- poll_events(VALUE self)
82
+ rg_events(VALUE self)
72
83
  {
73
84
  return INT2NUM(_SELF(self)->events);
74
85
  }
75
86
 
76
87
  static VALUE
77
- poll_set_revents(VALUE self, VALUE revents)
88
+ rg_set_revents(VALUE self, VALUE revents)
78
89
  {
79
90
  _SELF(self)->revents = revents;
80
91
  return self;
81
92
  }
82
93
  static VALUE
83
- poll_revents(VALUE self)
94
+ rg_revents(VALUE self)
84
95
  {
85
96
  return INT2NUM(_SELF(self)->revents);
86
97
  }
87
98
 
88
99
  void
89
- Init_glib_poll_fd()
100
+ Init_glib_poll_fd(void)
90
101
  {
91
- VALUE fd = G_DEF_CLASS(G_TYPE_POLL_FD, "PollFD", mGLib);
102
+ VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_POLL_FD, "PollFD", mGLib);
92
103
 
93
- rb_define_method(fd, "initialize", poll_initialize, 3);
104
+ RG_DEF_METHOD(initialize, 3);
94
105
 
95
- rb_define_method(fd, "set_fd", poll_set_fd, 1);
96
- rb_define_method(fd, "fd", poll_fd, 0);
97
- rb_define_method(fd, "set_events", poll_set_events, 1);
98
- rb_define_method(fd, "events", poll_events, 0);
99
- rb_define_method(fd, "set_revents", poll_set_revents, 1);
100
- rb_define_method(fd, "revents", poll_revents, 0);
106
+ RG_DEF_METHOD(set_fd, 1);
107
+ RG_DEF_METHOD(fd, 0);
108
+ RG_DEF_METHOD(set_events, 1);
109
+ RG_DEF_METHOD(events, 0);
110
+ RG_DEF_METHOD(set_revents, 1);
111
+ RG_DEF_METHOD(revents, 0);
101
112
 
102
- G_DEF_SETTERS(fd);
113
+ G_DEF_SETTERS(RG_TARGET_NAMESPACE);
103
114
 
104
115
  }
@@ -1,18 +1,30 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /************************************************
3
-
4
- rbglib_shell.c -
5
-
6
- $Author: mutoh $
7
- $Date: 2005/10/14 19:10:08 $
8
-
9
- Copyright (C) 2005 Masao Mutoh
10
- ************************************************/
2
+ /*
3
+ * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
+ * Copyright (C) 2005 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
 
24
+ #define RG_TARGET_NAMESPACE mShell
25
+
14
26
  static VALUE
15
- shell_parse(VALUE self, VALUE command_line)
27
+ rg_m_parse(G_GNUC_UNUSED VALUE self, VALUE command_line)
16
28
  {
17
29
  gint argc;
18
30
  gchar **argv;
@@ -25,13 +37,13 @@ shell_parse(VALUE self, VALUE command_line)
25
37
  }
26
38
 
27
39
  static VALUE
28
- shell_quote(VALUE self, VALUE unquoted_string)
40
+ rg_m_quote(G_GNUC_UNUSED VALUE self, VALUE unquoted_string)
29
41
  {
30
42
  return CSTR2RVAL_FREE(g_shell_quote(RVAL2CSTR(unquoted_string)));
31
43
  }
32
44
 
33
45
  static VALUE
34
- shell_unquote(VALUE self, VALUE quoted_string)
46
+ rg_m_unquote(G_GNUC_UNUSED VALUE self, VALUE quoted_string)
35
47
  {
36
48
  GError *error = NULL;
37
49
  gchar *str = g_shell_unquote(RVAL2CSTR(quoted_string), &error);
@@ -42,16 +54,11 @@ shell_unquote(VALUE self, VALUE quoted_string)
42
54
  }
43
55
 
44
56
  void
45
- Init_glib_shell()
57
+ Init_glib_shell(void)
46
58
  {
47
- VALUE mShell = rb_define_module_under(mGLib, "Shell");
48
- VALUE cShellError = G_DEF_ERROR2(G_SHELL_ERROR, "ShellError", mGLib, rb_eRuntimeError);
49
-
50
- rb_define_module_function(mShell, "parse", shell_parse, 1);
51
- rb_define_module_function(mShell, "quote", shell_quote, 1);
52
- rb_define_module_function(mShell, "unquote", shell_unquote, 1);
59
+ VALUE RG_TARGET_NAMESPACE = rb_define_module_under(mGLib, "Shell");
53
60
 
54
- rb_define_const(cShellError, "BAD_QUOTING", INT2FIX(G_SHELL_ERROR_BAD_QUOTING));
55
- rb_define_const(cShellError, "EMPTY_STRING", INT2FIX(G_SHELL_ERROR_EMPTY_STRING));
56
- rb_define_const(cShellError, "FAILED", INT2FIX(G_SHELL_ERROR_FAILED));
61
+ RG_DEF_MODFUNC(parse, 1);
62
+ RG_DEF_MODFUNC(quote, 1);
63
+ RG_DEF_MODFUNC(unquote, 1);
57
64
  }