glib2 0.90.7 → 0.90.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. data/ChangeLog +68 -0
  2. data/ext/glib2/rbglib.c +51 -15
  3. data/ext/glib2/rbglib.h +10 -2
  4. data/ext/glib2/rbglib_bookmarkfile.c +37 -74
  5. data/ext/glib2/rbglib_completion.c +8 -16
  6. data/ext/glib2/rbglib_convert.c +8 -18
  7. data/ext/glib2/rbglib_error.c +2 -8
  8. data/ext/glib2/rbglib_i18n.c +1 -2
  9. data/ext/glib2/rbglib_iochannel.c +81 -127
  10. data/ext/glib2/rbglib_keyfile.c +38 -86
  11. data/ext/glib2/rbglib_maincontext.c +29 -64
  12. data/ext/glib2/rbglib_mainloop.c +4 -8
  13. data/ext/glib2/rbglib_messages.c +7 -17
  14. data/ext/glib2/rbglib_pollfd.c +7 -14
  15. data/ext/glib2/rbglib_shell.c +3 -6
  16. data/ext/glib2/rbglib_source.c +14 -28
  17. data/ext/glib2/rbglib_spawn.c +7 -14
  18. data/ext/glib2/rbglib_threads.c +2 -4
  19. data/ext/glib2/rbglib_timer.c +7 -14
  20. data/ext/glib2/rbglib_unicode.c +45 -16
  21. data/ext/glib2/rbglib_utils.c +25 -50
  22. data/ext/glib2/rbglib_win32.c +10 -17
  23. data/ext/glib2/rbgobj_boxed.c +9 -21
  24. data/ext/glib2/rbgobj_closure.c +5 -11
  25. data/ext/glib2/rbgobj_enums.c +1 -2
  26. data/ext/glib2/rbgobj_object.c +23 -59
  27. data/ext/glib2/rbgobj_param.c +7 -15
  28. data/ext/glib2/rbgobj_signal.c +25 -65
  29. data/ext/glib2/rbgobj_type.c +36 -81
  30. data/ext/glib2/rbgobj_typeinstance.c +3 -6
  31. data/ext/glib2/rbgobj_typeinterface.c +3 -6
  32. data/ext/glib2/rbgobj_typemodule.c +4 -8
  33. data/ext/glib2/rbgobj_typeplugin.c +2 -4
  34. data/ext/glib2/rbgobj_valuetypes.c +7 -15
  35. data/ext/glib2/rbgobject.c +8 -18
  36. data/ext/glib2/rbgobject.h +3 -0
  37. data/ext/glib2/rbgprivate.h +0 -1
  38. data/ext/glib2/rbgutil.c +3 -6
  39. data/lib/gnome2-raketask.rb +1 -0
  40. data/lib/mkmf-gnome2.rb +12 -9
  41. data/test-unit/History.txt +43 -1
  42. data/test-unit/Manifest.txt +1 -1
  43. data/test-unit/html/index.html +62 -24
  44. data/test-unit/html/index.html.ja +54 -25
  45. data/test-unit/html/test-unit.css +3 -3
  46. data/test-unit/lib/test/unit/assertions.rb +489 -36
  47. data/test-unit/lib/test/unit/autorunner.rb +40 -0
  48. data/test-unit/lib/test/unit/collector.rb +6 -4
  49. data/test-unit/lib/test/unit/collector/load.rb +48 -5
  50. data/test-unit/lib/test/unit/collector/xml.rb +250 -0
  51. data/test-unit/lib/test/unit/error.rb +4 -3
  52. data/test-unit/lib/test/unit/fixture.rb +12 -3
  53. data/test-unit/lib/test/unit/runner/xml.rb +15 -0
  54. data/test-unit/lib/test/unit/testcase.rb +48 -16
  55. data/test-unit/lib/test/unit/testresult.rb +6 -2
  56. data/test-unit/lib/test/unit/testsuite.rb +24 -2
  57. data/test-unit/lib/test/unit/ui/console/testrunner.rb +65 -28
  58. data/test-unit/lib/test/unit/ui/testrunnermediator.rb +11 -2
  59. data/test-unit/lib/test/unit/ui/xml/testrunner.rb +224 -0
  60. data/test-unit/lib/test/unit/version.rb +1 -1
  61. data/test-unit/test/run-test.rb +7 -0
  62. data/test-unit/test/{test_assertions.rb → test-assertions.rb} +708 -77
  63. data/test-unit/test/test-fixture.rb +37 -0
  64. data/test-unit/test/test-testcase.rb +24 -7
  65. data/test-unit/test/test_testsuite.rb +19 -11
  66. data/test/test_iochannel.rb +9 -9
  67. data/test/test_unicode.rb +44 -31
  68. metadata +8 -9
  69. data/ext/glib2/Makefile +0 -169
  70. data/ext/glib2/glib-enum-types.c +0 -1065
  71. data/ext/glib2/glib-enum-types.h +0 -144
  72. data/ext/glib2/ruby-glib2.pc +0 -3
@@ -45,31 +45,27 @@ ml_initialize(int argc, VALUE *argv, VALUE self)
45
45
  }
46
46
 
47
47
  static VALUE
48
- ml_run(self)
49
- VALUE self;
48
+ ml_run(VALUE self)
50
49
  {
51
50
  g_main_loop_run(_SELF(self));
52
51
  return self;
53
52
  }
54
53
 
55
54
  static VALUE
56
- ml_quit(self)
57
- VALUE self;
55
+ ml_quit(VALUE self)
58
56
  {
59
57
  g_main_loop_quit(_SELF(self));
60
58
  return Qnil;
61
59
  }
62
60
 
63
61
  static VALUE
64
- ml_is_running(self)
65
- VALUE self;
62
+ ml_is_running(VALUE self)
66
63
  {
67
64
  return CBOOL2RVAL(g_main_loop_is_running(_SELF(self)));
68
65
  }
69
66
 
70
67
  static VALUE
71
- ml_get_context(self)
72
- VALUE self;
68
+ ml_get_context(VALUE self)
73
69
  {
74
70
  return BOXED2RVAL(g_main_loop_get_context(_SELF(self)), G_TYPE_MAIN_CONTEXT);
75
71
  }
@@ -48,11 +48,7 @@ static gchar* logmessage(GLogLevelFlags level)
48
48
  }
49
49
 
50
50
  static void
51
- rbglib_log_handler(log_domain, log_level, message, user_data)
52
- const gchar *log_domain;
53
- GLogLevelFlags log_level;
54
- const gchar *message;
55
- gpointer user_data;
51
+ rbglib_log_handler(const gchar *log_domain, GLogLevelFlags log_level, const gchar *message, gpointer user_data)
56
52
  {
57
53
  if (! log_canceled){
58
54
  #ifdef HAVE_RUBY_SET_CURRENT_SOURCE
@@ -67,16 +63,14 @@ rbglib_log_handler(log_domain, log_level, message, user_data)
67
63
 
68
64
  /* Use Internal only */
69
65
  static VALUE
70
- rbglib_m_log_cancel_handler(self)
71
- VALUE self;
66
+ rbglib_m_log_cancel_handler(VALUE self)
72
67
  {
73
68
  log_canceled = TRUE;
74
69
  return Qnil;
75
70
  }
76
71
 
77
72
  static VALUE
78
- rbglib_m_log_set_handler(self, domain, levels)
79
- VALUE self, domain, levels;
73
+ rbglib_m_log_set_handler(VALUE self, VALUE domain, VALUE levels)
80
74
  {
81
75
  guint handler_id = g_log_set_handler(NIL_P(domain) ? NULL : RVAL2CSTR(domain),
82
76
  NUM2INT(levels),
@@ -85,8 +79,7 @@ rbglib_m_log_set_handler(self, domain, levels)
85
79
  }
86
80
 
87
81
  static VALUE
88
- rbglib_m_log_remove_handler(self, domain, handler_id)
89
- VALUE self, domain, handler_id;
82
+ rbglib_m_log_remove_handler(VALUE self, VALUE domain, VALUE handler_id)
90
83
  {
91
84
  g_log_remove_handler(NIL_P(domain) ? NULL : RVAL2CSTR(domain),
92
85
  NUM2UINT(handler_id));
@@ -95,23 +88,20 @@ rbglib_m_log_remove_handler(self, domain, handler_id)
95
88
  }
96
89
 
97
90
  static VALUE
98
- rbglib_m_log_set_always_fatal(self, fatal_mask)
99
- VALUE self, fatal_mask;
91
+ rbglib_m_log_set_always_fatal(VALUE self, VALUE fatal_mask)
100
92
  {
101
93
  return INT2NUM(g_log_set_always_fatal(NUM2INT(fatal_mask)));
102
94
  }
103
95
 
104
96
  static VALUE
105
- rbglib_m_log_set_fatal_mask(self, domain, fatal_mask)
106
- VALUE self, domain, fatal_mask;
97
+ rbglib_m_log_set_fatal_mask(VALUE self, VALUE domain, VALUE fatal_mask)
107
98
  {
108
99
  return INT2NUM(g_log_set_fatal_mask(NIL_P(domain) ? NULL : RVAL2CSTR(domain),
109
100
  NUM2INT(fatal_mask)));
110
101
  }
111
102
 
112
103
  static VALUE
113
- rbglib_m_log(self, domain, level, str)
114
- VALUE self, domain, level, str;
104
+ rbglib_m_log(VALUE self, VALUE domain, VALUE level, VALUE str)
115
105
  {
116
106
  g_log(NIL_P(domain) ? NULL : RVAL2CSTR(domain), NUM2INT(level), RVAL2CSTR(str), NULL);
117
107
  return Qnil;
@@ -38,8 +38,7 @@ g_poll_fd_get_type(void)
38
38
  #define _SELF(s) ((GPollFD*)RVAL2BOXED(s, G_TYPE_POLL_FD))
39
39
 
40
40
  static VALUE
41
- poll_initialize(self, fd, events, revents)
42
- VALUE self, fd, events, revents;
41
+ poll_initialize(VALUE self, VALUE fd, VALUE events, VALUE revents)
43
42
  {
44
43
  GPollFD gfd;
45
44
  gfd.fd = NUM2INT(fd);
@@ -51,43 +50,37 @@ poll_initialize(self, fd, events, revents)
51
50
  }
52
51
 
53
52
  static VALUE
54
- poll_set_fd(self, fd)
55
- VALUE self, fd;
53
+ poll_set_fd(VALUE self, VALUE fd)
56
54
  {
57
55
  _SELF(self)->fd = fd;
58
56
  return self;
59
57
  }
60
58
  static VALUE
61
- poll_fd(self)
62
- VALUE self;
59
+ poll_fd(VALUE self)
63
60
  {
64
61
  return INT2NUM(_SELF(self)->fd);
65
62
  }
66
63
 
67
64
  static VALUE
68
- poll_set_events(self, events)
69
- VALUE self, events;
65
+ poll_set_events(VALUE self, VALUE events)
70
66
  {
71
67
  _SELF(self)->events = events;
72
68
  return self;
73
69
  }
74
70
  static VALUE
75
- poll_events(self)
76
- VALUE self;
71
+ poll_events(VALUE self)
77
72
  {
78
73
  return INT2NUM(_SELF(self)->events);
79
74
  }
80
75
 
81
76
  static VALUE
82
- poll_set_revents(self, revents)
83
- VALUE self, revents;
77
+ poll_set_revents(VALUE self, VALUE revents)
84
78
  {
85
79
  _SELF(self)->revents = revents;
86
80
  return self;
87
81
  }
88
82
  static VALUE
89
- poll_revents(self)
90
- VALUE self;
83
+ poll_revents(VALUE self)
91
84
  {
92
85
  return INT2NUM(_SELF(self)->revents);
93
86
  }
@@ -12,8 +12,7 @@
12
12
  #include "rbgprivate.h"
13
13
 
14
14
  static VALUE
15
- shell_parse(self, command_line)
16
- VALUE self, command_line;
15
+ shell_parse(VALUE self, VALUE command_line)
17
16
  {
18
17
  gint argc, i;
19
18
  gchar** argv;
@@ -34,15 +33,13 @@ shell_parse(self, command_line)
34
33
  }
35
34
 
36
35
  static VALUE
37
- shell_quote(self, unquoted_string)
38
- VALUE self, unquoted_string;
36
+ shell_quote(VALUE self, VALUE unquoted_string)
39
37
  {
40
38
  return CSTR2RVAL_FREE(g_shell_quote((const gchar*)RVAL2CSTR(unquoted_string)));
41
39
  }
42
40
 
43
41
  static VALUE
44
- shell_unquote(self, quoted_string)
45
- VALUE self, quoted_string;
42
+ shell_unquote(VALUE self, VALUE quoted_string)
46
43
  {
47
44
  GError* err = NULL;
48
45
  gchar* str = g_shell_unquote((const gchar*)RVAL2CSTR(quoted_string), &err);
@@ -15,8 +15,7 @@ static ID id_call;
15
15
 
16
16
  /*****************************************/
17
17
  static void
18
- source_free(source)
19
- GSource* source;
18
+ source_free(GSource *source)
20
19
  {
21
20
  g_source_unref(source);
22
21
  g_source_destroy(source);
@@ -42,8 +41,7 @@ GSource* g_source_new (GSourceFuncs *source_funcs,
42
41
  */
43
42
 
44
43
  static VALUE
45
- source_attach(self, context)
46
- VALUE self, context;
44
+ source_attach(VALUE self, VALUE context)
47
45
  {
48
46
  return UINT2NUM(g_source_attach(_SELF(self),
49
47
  RVAL2BOXED(context, G_TYPE_MAIN_CONTEXT)));
@@ -51,68 +49,59 @@ source_attach(self, context)
51
49
 
52
50
  #if GLIB_CHECK_VERSION(2,12,0)
53
51
  static VALUE
54
- source_is_destroyed(self)
55
- VALUE self;
52
+ source_is_destroyed(VALUE self)
56
53
  {
57
54
  return CBOOL2RVAL(g_source_is_destroyed(_SELF(self)));
58
55
  }
59
56
  #endif
60
57
 
61
58
  static VALUE
62
- source_set_priority(self, priority)
63
- VALUE self, priority;
59
+ source_set_priority(VALUE self, VALUE priority)
64
60
  {
65
61
  g_source_set_priority(_SELF(self), NUM2INT(priority));
66
62
  return self;
67
63
  }
68
64
 
69
65
  static VALUE
70
- source_get_priority(self)
71
- VALUE self;
66
+ source_get_priority(VALUE self)
72
67
  {
73
68
  return INT2NUM(g_source_get_priority(_SELF(self)));
74
69
  }
75
70
 
76
71
  static VALUE
77
- source_set_can_recurse(self, can_recurse)
78
- VALUE self, can_recurse;
72
+ source_set_can_recurse(VALUE self, VALUE can_recurse)
79
73
  {
80
74
  g_source_set_can_recurse(_SELF(self), RVAL2CBOOL(can_recurse));
81
75
  return self;
82
76
  }
83
77
 
84
78
  static VALUE
85
- source_get_can_recurse(self)
86
- VALUE self;
79
+ source_get_can_recurse(VALUE self)
87
80
  {
88
81
  return CBOOL2RVAL(g_source_get_can_recurse(_SELF(self)));
89
82
  }
90
83
 
91
84
  static VALUE
92
- source_get_id(self)
93
- VALUE self;
85
+ source_get_id(VALUE self)
94
86
  {
95
87
  return UINT2NUM(g_source_get_id(_SELF(self)));
96
88
  }
97
89
 
98
90
  static VALUE
99
- source_get_context(self)
100
- VALUE self;
91
+ source_get_context(VALUE self)
101
92
  {
102
93
  GMainContext* context = g_source_get_context(_SELF(self));
103
94
  return BOXED2RVAL(context, G_TYPE_MAIN_CONTEXT);
104
95
  }
105
96
 
106
97
  static gboolean
107
- source_func(func)
108
- gpointer func;
98
+ source_func(gpointer func)
109
99
  {
110
100
  return RVAL2CBOOL(rb_funcall((VALUE)func, id_call, 0));
111
101
  }
112
102
 
113
103
  static VALUE
114
- source_set_callback(self)
115
- VALUE self;
104
+ source_set_callback(VALUE self)
116
105
  {
117
106
  VALUE func = rb_block_proc();
118
107
  G_RELATIVE(self, func);
@@ -130,24 +119,21 @@ void g_source_set_callback_indirect (GSource *source,
130
119
  */
131
120
 
132
121
  static VALUE
133
- source_add_poll(self, fd)
134
- VALUE self, fd;
122
+ source_add_poll(VALUE self, VALUE fd)
135
123
  {
136
124
  g_source_add_poll(_SELF(self), RVAL2BOXED(fd, G_TYPE_POLL_FD));
137
125
  return self;
138
126
  }
139
127
 
140
128
  static VALUE
141
- source_remove_poll(self, fd)
142
- VALUE self, fd;
129
+ source_remove_poll(VALUE self, VALUE fd)
143
130
  {
144
131
  g_source_remove_poll(_SELF(self), RVAL2BOXED(fd, G_TYPE_POLL_FD));
145
132
  return self;
146
133
  }
147
134
 
148
135
  static VALUE
149
- source_get_current_time(self)
150
- VALUE self;
136
+ source_get_current_time(VALUE self)
151
137
  {
152
138
  GTimeVal timeval;
153
139
  g_source_get_current_time(_SELF(self), &timeval);
@@ -17,8 +17,7 @@ static ID id_call;
17
17
  static ID id_new;
18
18
 
19
19
  static void
20
- child_setup(func)
21
- gpointer func;
20
+ child_setup(gpointer func)
22
21
  {
23
22
  if (! NIL_P(func)){
24
23
  rb_funcall((VALUE)func, id_call, 0);
@@ -26,8 +25,7 @@ child_setup(func)
26
25
  }
27
26
 
28
27
  static VALUE
29
- rbglib_m_spawn_async_with_pipes(self, working_directory, argv, envp, flags)
30
- VALUE self, working_directory, argv, envp, flags;
28
+ rbglib_m_spawn_async_with_pipes(VALUE self, VALUE working_directory, VALUE argv, VALUE envp, VALUE flags)
31
29
  {
32
30
  GError *err = NULL;
33
31
  gboolean ret;
@@ -90,8 +88,7 @@ rbglib_m_spawn_async_with_pipes(self, working_directory, argv, envp, flags)
90
88
  }
91
89
 
92
90
  static VALUE
93
- rbglib_m_spawn_async(self, working_directory, argv, envp, flags)
94
- VALUE self, working_directory, argv, envp, flags;
91
+ rbglib_m_spawn_async(VALUE self, VALUE working_directory, VALUE argv, VALUE envp, VALUE flags)
95
92
  {
96
93
  GError *err = NULL;
97
94
  gboolean ret;
@@ -149,8 +146,7 @@ rbglib_m_spawn_async(self, working_directory, argv, envp, flags)
149
146
  }
150
147
 
151
148
  static VALUE
152
- rbglib_m_spawn_sync(self, working_directory, argv, envp, flags)
153
- VALUE self, working_directory, argv, envp, flags;
149
+ rbglib_m_spawn_sync(VALUE self, VALUE working_directory, VALUE argv, VALUE envp, VALUE flags)
154
150
  {
155
151
  GError *err = NULL;
156
152
  gboolean ret;
@@ -231,8 +227,7 @@ rbglib_m_spawn_sync(self, working_directory, argv, envp, flags)
231
227
  }
232
228
 
233
229
  static VALUE
234
- rbglib_m_spawn_command_line_sync(self, str)
235
- VALUE self, str;
230
+ rbglib_m_spawn_command_line_sync(VALUE self, VALUE str)
236
231
  {
237
232
  GError *err = NULL;
238
233
  const gchar *command_line;
@@ -269,8 +264,7 @@ rbglib_m_spawn_command_line_sync(self, str)
269
264
  }
270
265
 
271
266
  static VALUE
272
- rbglib_m_spawn_command_line_async(self, str)
273
- VALUE self, str;
267
+ rbglib_m_spawn_command_line_async(VALUE self, VALUE str)
274
268
  {
275
269
  GError *err = NULL;
276
270
  const gchar *command_line;
@@ -286,8 +280,7 @@ rbglib_m_spawn_command_line_async(self, str)
286
280
 
287
281
  #ifdef HAVE_G_SPAWN_CLOSE_PID
288
282
  static VALUE
289
- rbglib_m_spawn_close_pid(self, pid)
290
- VALUE self, pid;
283
+ rbglib_m_spawn_close_pid(VALUE self, VALUE pid)
291
284
  {
292
285
  g_spawn_close_pid(NUM2INT(pid));
293
286
  return Qnil;
@@ -14,8 +14,7 @@
14
14
  static VALUE gthreads;
15
15
 
16
16
  static VALUE
17
- gt_init(self)
18
- VALUE self;
17
+ gt_init(VALUE self)
19
18
  {
20
19
  #ifdef HAVE_G_THREAD_INIT
21
20
  #ifdef G_THREADS_ENABLED
@@ -26,8 +25,7 @@ gt_init(self)
26
25
  }
27
26
 
28
27
  static VALUE
29
- gt_supported(self)
30
- VALUE self;
28
+ gt_supported(VALUE self)
31
29
  {
32
30
  #ifdef HAVE_G_THREAD_INIT
33
31
  #ifdef G_THREADS_ENABLED
@@ -32,8 +32,7 @@ struct _GTimer
32
32
  };
33
33
 
34
34
  static GTimer*
35
- timer_copy(timer)
36
- GTimer* timer;
35
+ timer_copy(GTimer *timer)
37
36
  {
38
37
  GTimer* new_timer;
39
38
  g_return_val_if_fail (timer != NULL, NULL);
@@ -60,24 +59,21 @@ g_timer_get_type(void)
60
59
  #define _SELF(s) ((GTimer*)RVAL2BOXED(s, G_TYPE_TIMER))
61
60
 
62
61
  static VALUE
63
- timer_initialize(self)
64
- VALUE self;
62
+ timer_initialize(VALUE self)
65
63
  {
66
64
  G_INITIALIZE(self, g_timer_new());
67
65
  return Qnil;
68
66
  }
69
67
 
70
68
  static VALUE
71
- timer_start(self)
72
- VALUE self;
69
+ timer_start(VALUE self)
73
70
  {
74
71
  g_timer_start(_SELF(self));
75
72
  return self;
76
73
  }
77
74
 
78
75
  static VALUE
79
- timer_stop(self)
80
- VALUE self;
76
+ timer_stop(VALUE self)
81
77
  {
82
78
  g_timer_stop(_SELF(self));
83
79
  return self;
@@ -85,8 +81,7 @@ timer_stop(self)
85
81
 
86
82
  #if GLIB_CHECK_VERSION(2,4,0)
87
83
  static VALUE
88
- timer_continue(self)
89
- VALUE self;
84
+ timer_continue(VALUE self)
90
85
  {
91
86
  g_timer_continue(_SELF(self));
92
87
  return self;
@@ -94,8 +89,7 @@ timer_continue(self)
94
89
  #endif
95
90
 
96
91
  static VALUE
97
- timer_elapsed(self)
98
- VALUE self;
92
+ timer_elapsed(VALUE self)
99
93
  {
100
94
  gulong microseconds;
101
95
  gdouble ret = g_timer_elapsed(_SELF(self), &microseconds);
@@ -104,8 +98,7 @@ timer_elapsed(self)
104
98
  }
105
99
 
106
100
  static VALUE
107
- timer_reset(self)
108
- VALUE self;
101
+ timer_reset(VALUE self)
109
102
  {
110
103
  g_timer_reset(_SELF(self));
111
104
  return self;