glib2 1.2.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/ext/glib2/extconf.rb CHANGED
@@ -44,6 +44,8 @@ have_func("ruby_set_current_source", ruby_header)
44
44
  have_func("rb_thread_blocking_region", ruby_header)
45
45
  have_func("ruby_native_thread_p", ruby_header)
46
46
  have_func("rb_thread_call_with_gvl", ruby_header)
47
+ have_func("rb_str_new_cstr", ruby_header)
48
+ have_func("rb_gc_register_mark_object", ruby_header)
47
49
 
48
50
  have_var("curr_thread", [ruby_header, "node.h"])
49
51
  have_var("rb_curr_thread", [ruby_header, "node.h"])
data/ext/glib2/rbglib.h CHANGED
@@ -35,7 +35,7 @@ extern "C" {
35
35
 
36
36
  #define RBGLIB_MAJOR_VERSION 1
37
37
  #define RBGLIB_MINOR_VERSION 2
38
- #define RBGLIB_MICRO_VERSION 0
38
+ #define RBGLIB_MICRO_VERSION 1
39
39
 
40
40
  #ifndef RSTRING_PTR
41
41
  # define RSTRING_PTR(s) (RSTRING(s)->ptr)
@@ -63,6 +63,10 @@ typedef int GPid;
63
63
  # define G_SOURCE_CONTINUE TRUE
64
64
  #endif
65
65
 
66
+ #ifndef HAVE_RB_STR_NEW_CSTR
67
+ # define rb_str_new_cstr(c_string) rb_str_new2(c_string)
68
+ #endif
69
+
66
70
  #define RBG_INSPECT(object) (rbg_rval_inspect(object))
67
71
 
68
72
  #define RVAL2CSTR(v) (rbg_rval2cstr(&(v)))
@@ -22,6 +22,10 @@
22
22
  #include "rbgprivate.h"
23
23
 
24
24
  static ID id_call;
25
+ static ID id_puts;
26
+ static ID id_unpack;
27
+
28
+ static VALUE default_rs;
25
29
 
26
30
  #define RG_TARGET_NAMESPACE cIOChannel
27
31
  #define _SELF(s) ((GIOChannel*)RVAL2BOXED(s, G_TYPE_IO_CHANNEL))
@@ -415,8 +419,6 @@ rg_write(VALUE self, VALUE buf)
415
419
  return UINT2NUM(bytes_written);
416
420
  }
417
421
 
418
- static ID id_unpack;
419
-
420
422
  static VALUE
421
423
  rg_putc(VALUE self, VALUE thechar)
422
424
  {
@@ -666,7 +668,7 @@ ioc_puts_ary(VALUE ary, VALUE out, int recur)
666
668
  if (recur) {
667
669
  tmp = rb_str_new2("[...]");
668
670
  }
669
- rb_io_puts(1, &tmp, out);
671
+ rb_funcall(out, id_puts, 1, tmp);
670
672
  }
671
673
  return Qnil;
672
674
  }
@@ -679,7 +681,7 @@ rg_puts(int argc, VALUE *argv, VALUE self)
679
681
 
680
682
  /* if no argument given, print newline. */
681
683
  if (argc == 0) {
682
- rg_write(self, rb_default_rs);
684
+ rg_write(self, default_rs);
683
685
  return Qnil;
684
686
  }
685
687
  for (i=0; i<argc; i++) {
@@ -705,7 +707,7 @@ rg_puts(int argc, VALUE *argv, VALUE self)
705
707
  rg_write(self, line);
706
708
  if (RSTRING_LEN(line) == 0 ||
707
709
  RSTRING_PTR(line)[RSTRING_LEN(line)-1] != '\n') {
708
- rg_write(self, rb_default_rs);
710
+ rg_write(self, default_rs);
709
711
  }
710
712
  }
711
713
 
@@ -755,8 +757,16 @@ Init_glib_io_channel(void)
755
757
  rb_include_module(RG_TARGET_NAMESPACE, rb_mEnumerable);
756
758
 
757
759
  id_call = rb_intern("call");
760
+ id_puts = rb_intern("puts");
758
761
  id_unpack = rb_intern("unpack");
759
762
 
763
+ default_rs = rb_str_new_cstr("\n");
764
+ #ifdef HAVE_RB_GC_REGISTER_MARK_OBJECT
765
+ rb_gc_register_mark_object(default_rs);
766
+ #else
767
+ rb_global_variable(&default_rs);
768
+ #endif
769
+
760
770
  RG_DEF_METHOD(initialize, -1);
761
771
  RG_DEF_SMETHOD(open, -1);
762
772
  RG_DEF_METHOD(fileno, 0);
@@ -1,7 +1,6 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
2
  /*
3
- * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
- * Copyright (C) 2002-2009 Ruby-GNOME2 Project Team
3
+ * Copyright (C) 2002-2013 Ruby-GNOME2 Project Team
5
4
  * Copyright (C) 2002,2003 Masahiro Sakai
6
5
  *
7
6
  * This library is free software; you can redistribute it and/or
@@ -27,10 +26,6 @@
27
26
  /**********************************************************************/
28
27
  /* Type Mapping */
29
28
 
30
- #ifdef RBGOBJ_USE_DLPTR
31
- #include "dl.h"
32
- #endif
33
-
34
29
  static VALUE rb_cMutex;
35
30
  static VALUE lookup_class_mutex;
36
31
 
@@ -104,11 +99,7 @@ get_superclass(GType gtype)
104
99
  case G_TYPE_BOXED:
105
100
  return rb_cObject;
106
101
  case G_TYPE_POINTER:
107
- #ifdef RBGOBJ_USE_DLPTR
108
- return rb_cDLPtrData;
109
- #else
110
102
  return rb_cData;
111
- #endif
112
103
  case G_TYPE_ENUM:
113
104
  case G_TYPE_FLAGS:
114
105
  return rb_cObject;
@@ -434,8 +425,7 @@ rg_initialize(VALUE self, VALUE type)
434
425
  GType gtype;
435
426
 
436
427
  if (RVAL2CBOOL(rb_obj_is_kind_of(type, rb_cInteger))) {
437
- gtype = NUM2UINT(type);
438
- // XXX
428
+ gtype = NUM2ULONG(type);
439
429
  if (!g_type_name(gtype))
440
430
  gtype = G_TYPE_INVALID;
441
431
  } else {
@@ -445,7 +435,7 @@ rg_initialize(VALUE self, VALUE type)
445
435
  if (G_TYPE_INVALID == gtype)
446
436
  rb_raise(rb_eArgError, "invalid type");
447
437
 
448
- rb_ivar_set(self, id_gtype, UINT2NUM(gtype));
438
+ rb_ivar_set(self, id_gtype, ULONG2NUM(gtype));
449
439
 
450
440
  return Qnil;
451
441
  }
@@ -734,7 +724,10 @@ _def_fundamental_type(VALUE ary, GType gtype, const char* name)
734
724
  void
735
725
  Init_gobject_gtype(void)
736
726
  {
727
+ #if !GLIB_CHECK_VERSION(2, 35, 1)
737
728
  g_type_init();
729
+ #endif
730
+
738
731
  init_typemap();
739
732
 
740
733
  /* type */
@@ -21,27 +21,17 @@
21
21
 
22
22
  #include "rbgprivate.h"
23
23
  #include "rbgobject.h"
24
- #ifdef RBGOBJ_USE_DLPTR
25
- #include "dl.h"
26
- #endif
27
24
 
28
25
 
29
26
  VALUE
30
27
  rbgobj_ptr_new(GType type, gpointer ptr)
31
28
  {
32
- #ifdef RBGOBJ_USE_DLPTR
33
- return rb_dlptr_new2(GTYPE2CLASS(type), 0, NULL);
34
- #else
35
29
  return Data_Wrap_Struct(GTYPE2CLASS(type), NULL, NULL, ptr);
36
- #endif
37
30
  }
38
31
 
39
32
  gpointer
40
33
  rbgobj_ptr2cptr(VALUE ptr)
41
34
  {
42
- #ifdef RBGOBJ_USE_DLPTR
43
- return rb_dlptr2cptr(ptr);
44
- #else
45
35
  gpointer dest;
46
36
  if (rb_obj_is_kind_of(ptr, GTYPE2CLASS(G_TYPE_POINTER))){
47
37
  Data_Get_Struct(ptr, void, dest);
@@ -51,7 +41,6 @@ rbgobj_ptr2cptr(VALUE ptr)
51
41
  rb_raise(rb_eTypeError, "not a pointer object");
52
42
  }
53
43
  return dest;
54
- #endif
55
44
  }
56
45
 
57
46
  static VALUE
@@ -66,59 +55,12 @@ ptr_gtype(VALUE self)
66
55
  return ptr_s_gtype(CLASS_OF(self));
67
56
  }
68
57
 
69
- #ifndef RBGOBJ_USE_DLPTR
70
- static VALUE
71
- ptr_inspect(VALUE self)
72
- {
73
- gpointer ptr;
74
- gchar* s;
75
- VALUE result;
76
-
77
- Data_Get_Struct(self, void, ptr);
78
-
79
- s = g_strdup_printf("#<%s:%p ptr=%p>",
80
- rb_class2name(CLASS_OF(self)),
81
- (void *)self,
82
- ptr);
83
-
84
- result = rb_str_new2(s);
85
- g_free(s);
86
-
87
- return result;
88
- }
89
-
90
- static VALUE
91
- ptr_eql(VALUE self, VALUE other)
92
- {
93
- gpointer ptr1, ptr2;
94
- if (!rb_obj_is_kind_of(other, GTYPE2CLASS(G_TYPE_POINTER)))
95
- return Qnil;
96
- Data_Get_Struct(self, void, ptr1);
97
- Data_Get_Struct(other, void, ptr2);
98
- return CBOOL2RVAL(ptr1 == ptr2);
99
- }
100
-
101
- static VALUE
102
- ptr_hash(VALUE self)
103
- {
104
- gpointer ptr;
105
- Data_Get_Struct(self, void, ptr);
106
- return INT2FIX((long)ptr);
107
- }
108
- #endif
109
-
110
58
  static void
111
59
  Init_gtype_pointer(void)
112
60
  {
113
61
  VALUE cPtr = G_DEF_CLASS(G_TYPE_POINTER, "Pointer", mGLib);
114
62
  rbg_define_singleton_method(cPtr, "gtype", ptr_s_gtype, 1);
115
63
  rbg_define_method(cPtr, "gtype", ptr_gtype, 1);
116
- #ifndef RBGOBJ_USE_DLPTR
117
- rbg_define_method(cPtr, "inspect", ptr_inspect, 0);
118
- rbg_define_method(cPtr, "==", ptr_eql, 1);
119
- rbg_define_method(cPtr, "eql?", ptr_eql, 1);
120
- rbg_define_method(cPtr, "hash", ptr_hash, 0);
121
- #endif
122
64
  }
123
65
 
124
66
  /**********************************************************************/
@@ -92,7 +92,9 @@ class GNOME2Package
92
92
  s.email = @email
93
93
  s.homepage = @homepage
94
94
  s.version = version
95
- s.extensions = FileList["ext/#{@name}/extconf.rb"]
95
+ extensions = FileList["ext/#{@name}/extconf.rb"]
96
+ extensions.existing!
97
+ s.extensions = extensions
96
98
  s.require_paths = ["lib"]
97
99
  files = FileList["ChangeLog", "README",
98
100
  "Rakefile", "extconf.rb",
data/lib/mkmf-gnome2.rb CHANGED
@@ -489,7 +489,9 @@ def install_missing_native_package(native_package_info)
489
489
  succeeded = xsystem(install_command)
490
490
  else
491
491
  if sudo
492
- install_command = "#{sudo} #{install_command}"
492
+ prompt = "[sudo] password for %u to install <#{package}>: "
493
+ sudo_options = "-p #{Shellwords.escape(prompt)}"
494
+ install_command = "#{sudo} #{sudo_options} #{install_command}"
493
495
  succeeded = xsystem(install_command)
494
496
  else
495
497
  succeeded = false
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glib2
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 29
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 2
9
- - 0
10
- version: 1.2.0
9
+ - 1
10
+ version: 1.2.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - The Ruby-GNOME2 Project Team
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2013-01-24 00:00:00 Z
18
+ date: 2013-01-30 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: pkg-config