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
@@ -54,8 +54,7 @@ cinfo_mark(RGObjClassInfo* cinfo)
54
54
 
55
55
 
56
56
  const RGObjClassInfo *
57
- rbgobj_lookup_class(klass)
58
- VALUE klass;
57
+ rbgobj_lookup_class(VALUE klass)
59
58
  {
60
59
  VALUE data = rb_hash_aref(klass_to_cinfo, klass);
61
60
  if (!NIL_P(data)){
@@ -290,13 +289,7 @@ rbgobj_gtype_to_ruby_class(GType gtype)
290
289
  }
291
290
 
292
291
  VALUE
293
- rbgobj_define_class(gtype, name, module, mark, free, parent)
294
- GType gtype;
295
- const gchar* name;
296
- VALUE module;
297
- void* mark;
298
- void* free;
299
- VALUE parent;
292
+ rbgobj_define_class(GType gtype, const gchar *name, VALUE module, void *mark, void *free, VALUE parent)
300
293
  {
301
294
  RGObjClassInfo* cinfo;
302
295
  if (gtype == 0)
@@ -310,12 +303,7 @@ rbgobj_define_class(gtype, name, module, mark, free, parent)
310
303
  }
311
304
 
312
305
  VALUE
313
- rbgobj_define_class_dynamic(gtype_name, name, module, mark, free)
314
- const gchar* gtype_name;
315
- const gchar* name;
316
- VALUE module;
317
- void* mark;
318
- void* free;
306
+ rbgobj_define_class_dynamic(const gchar *gtype_name, const gchar *name, VALUE module, void *mark, void *free)
319
307
  {
320
308
  RGObjClassInfoDynamic* cinfo;
321
309
  cinfo = (RGObjClassInfoDynamic*)g_new(RGObjClassInfoDynamic, 1);
@@ -407,8 +395,7 @@ VALUE rbgobj_cType;
407
395
  static ID id_gtype;
408
396
 
409
397
  VALUE
410
- rbgobj_gtype_new(gtype)
411
- GType gtype;
398
+ rbgobj_gtype_new(GType gtype)
412
399
  {
413
400
  VALUE result = rb_obj_alloc(rbgobj_cType);
414
401
  VALUE arg = ULONG2NUM(gtype);
@@ -417,8 +404,7 @@ rbgobj_gtype_new(gtype)
417
404
  }
418
405
 
419
406
  GType
420
- rbgobj_gtype_get(self)
421
- VALUE self;
407
+ rbgobj_gtype_get(VALUE self)
422
408
  {
423
409
  if (RVAL2CBOOL(rb_obj_is_kind_of(self, rbgobj_cType))) {
424
410
  return NUM2ULONG(rb_ivar_get(self, id_gtype));
@@ -429,8 +415,7 @@ rbgobj_gtype_get(self)
429
415
  }
430
416
 
431
417
  static VALUE
432
- type_initialize(self, type)
433
- VALUE self, type;
418
+ type_initialize(VALUE self, VALUE type)
434
419
  {
435
420
  GType gtype;
436
421
 
@@ -452,8 +437,7 @@ type_initialize(self, type)
452
437
  }
453
438
 
454
439
  static VALUE
455
- type_inspect(self)
456
- VALUE self;
440
+ type_inspect(VALUE self)
457
441
  {
458
442
  GType gtype = rbgobj_gtype_get(self);
459
443
  gchar* str;
@@ -467,8 +451,7 @@ type_inspect(self)
467
451
  }
468
452
 
469
453
  static VALUE
470
- type_compare(self, other)
471
- VALUE self, other;
454
+ type_compare(VALUE self, VALUE other)
472
455
  {
473
456
  if (!RVAL2CBOOL(rb_obj_is_kind_of(other, rbgobj_cType)))
474
457
  return Qnil;
@@ -488,8 +471,7 @@ type_compare(self, other)
488
471
  }
489
472
 
490
473
  static VALUE
491
- type_eq(self, other)
492
- VALUE self, other;
474
+ type_eq(VALUE self, VALUE other)
493
475
  {
494
476
  if (!RVAL2CBOOL(rb_obj_is_kind_of(other, rbgobj_cType)))
495
477
  return Qnil;
@@ -501,8 +483,7 @@ type_eq(self, other)
501
483
  }
502
484
 
503
485
  static VALUE
504
- type_lt_eq(self, other)
505
- VALUE self, other;
486
+ type_lt_eq(VALUE self, VALUE other)
506
487
  {
507
488
  if (!RVAL2CBOOL(rb_obj_is_kind_of(other, rbgobj_cType)))
508
489
  return Qnil;
@@ -514,8 +495,7 @@ type_lt_eq(self, other)
514
495
  }
515
496
 
516
497
  static VALUE
517
- type_gt_eq(self, other)
518
- VALUE self, other;
498
+ type_gt_eq(VALUE self, VALUE other)
519
499
  {
520
500
  if (!RVAL2CBOOL(rb_obj_is_kind_of(other, rbgobj_cType)))
521
501
  return Qnil;
@@ -527,8 +507,7 @@ type_gt_eq(self, other)
527
507
  }
528
508
 
529
509
  static VALUE
530
- type_lt(self, other)
531
- VALUE self, other;
510
+ type_lt(VALUE self, VALUE other)
532
511
  {
533
512
  if (!RVAL2CBOOL(rb_obj_is_kind_of(other, rbgobj_cType)))
534
513
  return Qnil;
@@ -540,8 +519,7 @@ type_lt(self, other)
540
519
  }
541
520
 
542
521
  static VALUE
543
- type_gt(self, other)
544
- VALUE self, other;
522
+ type_gt(VALUE self, VALUE other)
545
523
  {
546
524
  if (!RVAL2CBOOL(rb_obj_is_kind_of(other, rbgobj_cType)))
547
525
  return Qnil;
@@ -553,128 +531,110 @@ type_gt(self, other)
553
531
  }
554
532
 
555
533
  static VALUE
556
- type_to_int(self)
557
- VALUE self;
534
+ type_to_int(VALUE self)
558
535
  {
559
536
  return rb_ivar_get(self, id_gtype);
560
537
  }
561
538
 
562
539
  static VALUE
563
- type_to_class(self)
564
- VALUE self;
540
+ type_to_class(VALUE self)
565
541
  {
566
542
  return GTYPE2CLASS(rbgobj_gtype_get(self));
567
543
  }
568
544
 
569
545
  static VALUE
570
- type_fundamental(self)
571
- VALUE self;
546
+ type_fundamental(VALUE self)
572
547
  {
573
548
  return rbgobj_gtype_new(G_TYPE_FUNDAMENTAL(rbgobj_gtype_get(self)));
574
549
  }
575
550
 
576
551
  static VALUE
577
- type_is_fundamental(self)
578
- VALUE self;
552
+ type_is_fundamental(VALUE self)
579
553
  {
580
554
  return CBOOL2RVAL(G_TYPE_IS_FUNDAMENTAL(rbgobj_gtype_get(self)));
581
555
  }
582
556
 
583
557
  static VALUE
584
- type_is_derived(self)
585
- VALUE self;
558
+ type_is_derived(VALUE self)
586
559
  {
587
560
  return CBOOL2RVAL(G_TYPE_IS_DERIVED(rbgobj_gtype_get(self)));
588
561
  }
589
562
 
590
563
  static VALUE
591
- type_is_interface(self)
592
- VALUE self;
564
+ type_is_interface(VALUE self)
593
565
  {
594
566
  return CBOOL2RVAL(G_TYPE_IS_INTERFACE(rbgobj_gtype_get(self)));
595
567
  }
596
568
 
597
569
  static VALUE
598
- type_is_classed(self)
599
- VALUE self;
570
+ type_is_classed(VALUE self)
600
571
  {
601
572
  return CBOOL2RVAL(G_TYPE_IS_CLASSED(rbgobj_gtype_get(self)));
602
573
  }
603
574
 
604
575
  static VALUE
605
- type_is_instantiatable(self)
606
- VALUE self;
576
+ type_is_instantiatable(VALUE self)
607
577
  {
608
578
  return CBOOL2RVAL(G_TYPE_IS_INSTANTIATABLE(rbgobj_gtype_get(self)));
609
579
  }
610
580
 
611
581
  static VALUE
612
- type_is_derivable(self)
613
- VALUE self;
582
+ type_is_derivable(VALUE self)
614
583
  {
615
584
  return CBOOL2RVAL(G_TYPE_IS_DERIVABLE(rbgobj_gtype_get(self)));
616
585
  }
617
586
 
618
587
  static VALUE
619
- type_is_deep_derivable(self)
620
- VALUE self;
588
+ type_is_deep_derivable(VALUE self)
621
589
  {
622
590
  return CBOOL2RVAL(G_TYPE_IS_DEEP_DERIVABLE(rbgobj_gtype_get(self)));
623
591
  }
624
592
 
625
593
  static VALUE
626
- type_is_abstract(self)
627
- VALUE self;
594
+ type_is_abstract(VALUE self)
628
595
  {
629
596
  return CBOOL2RVAL(G_TYPE_IS_ABSTRACT(rbgobj_gtype_get(self)));
630
597
  }
631
598
 
632
599
  static VALUE
633
- type_is_value_abstract(self)
634
- VALUE self;
600
+ type_is_value_abstract(VALUE self)
635
601
  {
636
602
  return CBOOL2RVAL(G_TYPE_IS_VALUE_ABSTRACT(rbgobj_gtype_get(self)));
637
603
  }
638
604
 
639
605
  static VALUE
640
- type_is_value_type(self)
641
- VALUE self;
606
+ type_is_value_type(VALUE self)
642
607
  {
643
608
  return CBOOL2RVAL(G_TYPE_IS_VALUE_TYPE(rbgobj_gtype_get(self)));
644
609
  }
645
610
 
646
611
  static VALUE
647
- type_has_value_table(self)
648
- VALUE self;
612
+ type_has_value_table(VALUE self)
649
613
  {
650
614
  return CBOOL2RVAL(G_TYPE_HAS_VALUE_TABLE(rbgobj_gtype_get(self)));
651
615
  }
652
616
 
653
617
  static VALUE
654
- type_name(self)
655
- VALUE self;
618
+ type_name(VALUE self)
656
619
  {
657
620
  return rb_str_new2(g_type_name(rbgobj_gtype_get(self)));
658
621
  }
659
622
 
660
623
  static VALUE
661
- type_parent(self)
662
- VALUE self;
624
+ type_parent(VALUE self)
663
625
  {
664
626
  GType parent = g_type_parent(rbgobj_gtype_get(self));
665
627
  return parent ? rbgobj_gtype_new(parent) : Qnil;
666
628
  }
667
629
 
668
630
  static VALUE
669
- type_depth(self)
670
- VALUE self;
631
+ type_depth(VALUE self)
671
632
  {
672
633
  return UINT2NUM(g_type_depth(rbgobj_gtype_get(self)));
673
634
  }
674
635
 
675
636
  static VALUE
676
- type_next_base(leaf_type, root_type)
677
- VALUE leaf_type, root_type;
637
+ type_next_base(VALUE leaf_type, VALUE root_type)
678
638
  {
679
639
  GType ret = g_type_next_base(rbgobj_gtype_get(leaf_type),
680
640
  rbgobj_gtype_get(root_type));
@@ -682,8 +642,7 @@ type_next_base(leaf_type, root_type)
682
642
  }
683
643
 
684
644
  static VALUE
685
- type_is_a(self, is_a_type)
686
- VALUE self, is_a_type;
645
+ type_is_a(VALUE self, VALUE is_a_type)
687
646
  {
688
647
  return CBOOL2RVAL(g_type_is_a(rbgobj_gtype_get(self), rbgobj_gtype_get(is_a_type)));
689
648
  }
@@ -699,8 +658,7 @@ gpointer g_type_interface_peek_parent (gpointer g_iface);
699
658
  #endif
700
659
 
701
660
  static VALUE
702
- type_children(self)
703
- VALUE self;
661
+ type_children(VALUE self)
704
662
  {
705
663
  guint n_children;
706
664
  GType* types;
@@ -717,8 +675,7 @@ type_children(self)
717
675
  }
718
676
 
719
677
  static VALUE
720
- type_interfaces(self)
721
- VALUE self;
678
+ type_interfaces(VALUE self)
722
679
  {
723
680
  guint n_interfaces;
724
681
  GType* types;
@@ -735,8 +692,7 @@ type_interfaces(self)
735
692
  }
736
693
 
737
694
  static VALUE
738
- type_class_size(self)
739
- VALUE self;
695
+ type_class_size(VALUE self)
740
696
  {
741
697
  GTypeQuery query;
742
698
  g_type_query(rbgobj_gtype_get(self), &query);
@@ -744,8 +700,7 @@ type_class_size(self)
744
700
  }
745
701
 
746
702
  static VALUE
747
- type_instance_size(self)
748
- VALUE self;
703
+ type_instance_size(VALUE self)
749
704
  {
750
705
  GTypeQuery query;
751
706
  g_type_query(rbgobj_gtype_get(self), &query);
@@ -21,22 +21,19 @@ typedef void (*ClassInfoCallbackFunc) (gpointer instance,
21
21
  gpointer user_data);
22
22
 
23
23
  static VALUE
24
- instantiatable_s_allocate(klass)
25
- VALUE klass;
24
+ instantiatable_s_allocate(VALUE klass)
26
25
  {
27
26
  rb_raise(rb_eTypeError, "abstract class");
28
27
  }
29
28
 
30
29
  static VALUE
31
- instantiatable_get_gtype(self)
32
- VALUE self;
30
+ instantiatable_get_gtype(VALUE self)
33
31
  {
34
32
  return rbgobj_gtype_new(G_TYPE_FROM_INSTANCE(rbgobj_instance_from_ruby_object(self)));
35
33
  }
36
34
 
37
35
  static VALUE
38
- instantiatable_clone(self)
39
- VALUE self;
36
+ instantiatable_clone(VALUE self)
40
37
  {
41
38
  rb_raise(rb_eTypeError, "can't clone %s", rb_class2name(CLASS_OF(self)));
42
39
  }
@@ -18,8 +18,7 @@ VALUE rbgobj_mInterface;
18
18
  VALUE mMetaInterface;
19
19
 
20
20
  static VALUE
21
- interface_s_append_features(self, klass)
22
- VALUE self, klass;
21
+ interface_s_append_features(VALUE self, VALUE klass)
23
22
  {
24
23
  if (!rb_obj_is_kind_of(klass, cInstantiatable))
25
24
  rb_raise(rb_eTypeError, "Not a subclass of GLib::Instantiatable");
@@ -29,8 +28,7 @@ interface_s_append_features(self, klass)
29
28
  #if GLIB_CHECK_VERSION(2,4,0)
30
29
 
31
30
  static VALUE
32
- interface_s_install_property(self, pspec_obj)
33
- VALUE self, pspec_obj;
31
+ interface_s_install_property(VALUE self, VALUE pspec_obj)
34
32
  {
35
33
  const RGObjClassInfo* cinfo = rbgobj_lookup_class(self);
36
34
  gpointer ginterface;
@@ -49,8 +47,7 @@ interface_s_install_property(self, pspec_obj)
49
47
  }
50
48
 
51
49
  static VALUE
52
- interface_s_property(self, property_name)
53
- VALUE self, property_name;
50
+ interface_s_property(VALUE self, VALUE property_name)
54
51
  {
55
52
  gpointer ginterface;
56
53
  const char* name;
@@ -14,30 +14,26 @@
14
14
  #include "rbgprivate.h"
15
15
 
16
16
  static VALUE
17
- use(self)
18
- VALUE self;
17
+ use(VALUE self)
19
18
  {
20
19
  return CBOOL2RVAL(g_type_module_use(G_TYPE_MODULE(RVAL2GOBJ(self))));
21
20
  }
22
21
 
23
22
  static VALUE
24
- unuse(self)
25
- VALUE self;
23
+ unuse(VALUE self)
26
24
  {
27
25
  g_type_module_unuse(G_TYPE_MODULE(RVAL2GOBJ(self)));
28
26
  return self;
29
27
  }
30
28
 
31
29
  static VALUE
32
- get_name(self)
33
- VALUE self;
30
+ get_name(VALUE self)
34
31
  {
35
32
  return rb_str_new2(G_TYPE_MODULE(RVAL2GOBJ(self))->name);
36
33
  }
37
34
 
38
35
  static VALUE
39
- set_name(self, name)
40
- VALUE self, name;
36
+ set_name(VALUE self, VALUE name)
41
37
  {
42
38
  g_type_module_set_name(G_TYPE_MODULE(RVAL2GOBJ(self)), StringValuePtr(name));
43
39
  return name;
@@ -14,16 +14,14 @@
14
14
  #include "rbgprivate.h"
15
15
 
16
16
  static VALUE
17
- use(self)
18
- VALUE self;
17
+ use(VALUE self)
19
18
  {
20
19
  g_type_plugin_use(G_TYPE_PLUGIN(RVAL2GOBJ(self)));
21
20
  return self;
22
21
  }
23
22
 
24
23
  static VALUE
25
- unuse(self)
26
- VALUE self;
24
+ unuse(VALUE self)
27
25
  {
28
26
  g_type_plugin_unuse(G_TYPE_PLUGIN(RVAL2GOBJ(self)));
29
27
  return self;
@@ -17,9 +17,7 @@
17
17
 
18
18
 
19
19
  VALUE
20
- rbgobj_ptr_new(type, ptr)
21
- GType type;
22
- gpointer ptr;
20
+ rbgobj_ptr_new(GType type, gpointer ptr)
23
21
  {
24
22
  #ifdef RBGOBJ_USE_DLPTR
25
23
  return rb_dlptr_new2(GTYPE2CLASS(type), 0, NULL);
@@ -29,8 +27,7 @@ rbgobj_ptr_new(type, ptr)
29
27
  }
30
28
 
31
29
  gpointer
32
- rbgobj_ptr2cptr(ptr)
33
- VALUE ptr;
30
+ rbgobj_ptr2cptr(VALUE ptr)
34
31
  {
35
32
  #ifdef RBGOBJ_USE_DLPTR
36
33
  return rb_dlptr2cptr(ptr);
@@ -48,23 +45,20 @@ rbgobj_ptr2cptr(ptr)
48
45
  }
49
46
 
50
47
  static VALUE
51
- ptr_s_gtype(klass)
52
- VALUE klass;
48
+ ptr_s_gtype(VALUE klass)
53
49
  {
54
50
  return rbgobj_gtype_new(rbgobj_lookup_class(klass)->gtype);
55
51
  }
56
52
 
57
53
  static VALUE
58
- ptr_gtype(self)
59
- VALUE self;
54
+ ptr_gtype(VALUE self)
60
55
  {
61
56
  return ptr_s_gtype(CLASS_OF(self));
62
57
  }
63
58
 
64
59
  #ifndef RBGOBJ_USE_DLPTR
65
60
  static VALUE
66
- ptr_inspect(self)
67
- VALUE self;
61
+ ptr_inspect(VALUE self)
68
62
  {
69
63
  gpointer ptr;
70
64
  gchar* s;
@@ -84,8 +78,7 @@ ptr_inspect(self)
84
78
  }
85
79
 
86
80
  static VALUE
87
- ptr_eql(self, other)
88
- VALUE self, other;
81
+ ptr_eql(VALUE self, VALUE other)
89
82
  {
90
83
  gpointer ptr1, ptr2;
91
84
  if (!rb_obj_is_kind_of(other, GTYPE2CLASS(G_TYPE_POINTER)))
@@ -96,8 +89,7 @@ ptr_eql(self, other)
96
89
  }
97
90
 
98
91
  static VALUE
99
- ptr_hash(self)
100
- VALUE self;
92
+ ptr_hash(VALUE self)
101
93
  {
102
94
  gpointer ptr;
103
95
  Data_Get_Struct(self, void, ptr);