glib2 1.1.9 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -3,21 +3,25 @@
3
3
  $LOAD_PATH.unshift("./lib")
4
4
  require 'gnome2-raketask'
5
5
 
6
+ libffi_lib_dir = nil
7
+ libffi_include_dir = nil
8
+
6
9
  package = GNOME2Package.new do |_package|
10
+ libffi_lib_dir = File.join(_package.win32.absolute_binary_dir, "lib")
11
+ libffi_include_dir = File.join(_package.win32.absolute_binary_dir, "include")
12
+
7
13
  _package.summary = "Ruby/GLib2 is a Ruby binding of GLib-2.x."
8
14
  _package.description = "Ruby/GLib2 is a Ruby binding of GLib-2.x."
9
15
  _package.dependency.gem.runtime = [["pkg-config", ">= 0"]]
10
16
  _package.dependency.gem.development = [["test-unit", ">= 2"]]
11
17
  _package.win32.packages = []
12
18
  _package.win32.dependencies = ["zlib", "libffi", "gettext-runtime"]
13
- libffi_lib_dir = File.join(_package.win32.absolute_binary_dir, "lib")
14
- libffi_include_dir = File.join(libffi_lib_dir, "libffi-3.0.6", "include")
15
19
  _package.win32.build_packages = [
16
20
  {
17
21
  :name => "glib",
18
22
  :download_site => :gnome,
19
23
  :label => "GLib",
20
- :version => "2.35.3",
24
+ :version => "2.34.3",
21
25
  :configure_args => [
22
26
  "LIBFFI_CFLAGS=-I#{libffi_include_dir}",
23
27
  "LIBFFI_LIBS=-L#{libffi_lib_dir} -lffi",
@@ -57,7 +61,7 @@ package = GNOME2Package.new do |_package|
57
61
  :name => "glib-networking",
58
62
  :download_site => :gnome,
59
63
  :label => "glib-networking",
60
- :version => "2.35.3",
64
+ :version => "2.34.2",
61
65
  :configure_args => [
62
66
  "--without-libproxy",
63
67
  "--without-gnome-proxy",
@@ -68,3 +72,21 @@ package = GNOME2Package.new do |_package|
68
72
  ]
69
73
  end
70
74
  package.define_tasks
75
+
76
+ namespace :win32 do
77
+ namespace :libffi do
78
+ namespace :header do
79
+ desc "Move libffi headers to include/"
80
+ task :fix do
81
+ libffi_version = "libffi-3.0.6"
82
+ mv(Dir.glob(File.join(libffi_lib_dir, libffi_version, "include", "*.h")),
83
+ libffi_include_dir)
84
+ rm_rf(File.join(libffi_lib_dir, libffi_version))
85
+ end
86
+ end
87
+ end
88
+
89
+ namespace :downloader do
90
+ task :after => ["win32:libffi:header:fix"]
91
+ end
92
+ end
@@ -21,8 +21,11 @@ EXPORTS
21
21
  rbgobj_gobject_initialize
22
22
  rbgobj_boxed_create
23
23
  rbgobj_boxed_get
24
+ rbgobj_boxed_get_default
24
25
  rbgobj_boxed_not_copy_obj
25
26
  rbgobj_make_boxed
27
+ rbgobj_make_boxed_raw
28
+ rbgobj_make_boxed_default
26
29
  rbgobj_add_abstract_but_create_instance_class
27
30
  rbgobj_gtype_get
28
31
  rbgobj_gtype_new
@@ -120,7 +123,6 @@ EXPORTS
120
123
  rbgerr_define_gerror
121
124
  rbgerr_gerror2exception
122
125
  rbgobj_convert_define
123
- rbgobj_fund_define_fundamental
124
126
  rbgobj_gc_mark_gvalue
125
127
  rbgobj_gc_mark_instance
126
128
  rbglib_num_to_uint64
@@ -24,21 +24,6 @@
24
24
 
25
25
  G_BEGIN_DECLS
26
26
 
27
- typedef struct {
28
- GType type;
29
- VALUE (*get_superclass)(void);
30
- void (*type_init_hook)(VALUE);
31
- void (*rvalue2gvalue)(VALUE val, GValue *result);
32
- VALUE (*gvalue2rvalue)(const GValue *);
33
- void (*initialize)(VALUE, gpointer);
34
- gpointer (*robj2instance)(VALUE);
35
- VALUE (*instance2robj)(gpointer);
36
- } RGFundamental;
37
-
38
- #define G_DEF_FUNDAMENTAL(f) (rbgobj_fund_define_fundamental(f))
39
-
40
- extern void rbgobj_fund_define_fundamental(RGFundamental *fundamental);
41
-
42
27
  G_END_DECLS
43
28
 
44
29
  #endif
@@ -1,6 +1,6 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
2
  /*
3
- * Copyright (C) 2011-2012 Ruby-GNOME2 Project Team
3
+ * Copyright (C) 2011-2013 Ruby-GNOME2 Project Team
4
4
  * Copyright (C) 2002-2005 Ruby-GNOME2 Project
5
5
  * Copyright (C) 2002,2003 Masahiro Sakai
6
6
  *
@@ -34,8 +34,8 @@ extern "C" {
34
34
  #endif /* __cplusplus */
35
35
 
36
36
  #define RBGLIB_MAJOR_VERSION 1
37
- #define RBGLIB_MINOR_VERSION 1
38
- #define RBGLIB_MICRO_VERSION 9
37
+ #define RBGLIB_MINOR_VERSION 2
38
+ #define RBGLIB_MICRO_VERSION 0
39
39
 
40
40
  #ifndef RSTRING_PTR
41
41
  # define RSTRING_PTR(s) (RSTRING(s)->ptr)
@@ -55,6 +55,14 @@ extern "C" {
55
55
  typedef int GPid;
56
56
  #endif
57
57
 
58
+ #ifndef G_SOURCE_REMOVE
59
+ # define G_SOURCE_REMOVE FALSE
60
+ #endif
61
+
62
+ #ifndef G_SOURCE_CONTINUE
63
+ # define G_SOURCE_CONTINUE TRUE
64
+ #endif
65
+
58
66
  #define RBG_INSPECT(object) (rbg_rval_inspect(object))
59
67
 
60
68
  #define RVAL2CSTR(v) (rbg_rval2cstr(&(v)))
@@ -1,6 +1,6 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
2
  /*
3
- * Copyright (C) 2011 Ruby-GNOME2 Project Team
3
+ * Copyright (C) 2011-2013 Ruby-GNOME2 Project Team
4
4
  * Copyright (C) 2005 Masao Mutoh
5
5
  *
6
6
  * This library is free software; you can redistribute it and/or
@@ -171,6 +171,11 @@ Init_glib_source(void)
171
171
 
172
172
  id_call = rb_intern("call");
173
173
 
174
+ rb_define_const(RG_TARGET_NAMESPACE,
175
+ "REMOVE", CBOOL2RVAL(G_SOURCE_REMOVE));
176
+ rb_define_const(RG_TARGET_NAMESPACE,
177
+ "CONTINUE", CBOOL2RVAL(G_SOURCE_CONTINUE));
178
+
174
179
  RG_DEF_METHOD(attach, -1);
175
180
  #if GLIB_CHECK_VERSION(2,12,0)
176
181
  RG_DEF_METHOD_P(destroyed, 0);
@@ -45,21 +45,6 @@ rbglib_m_win32_locale_deprecated(VALUE self)
45
45
  return rg_s_locale(self);
46
46
  }
47
47
 
48
- static VALUE
49
- rg_s_get_package_installation_directory(VALUE self, VALUE package, VALUE dll_name)
50
- {
51
- return CSTR2RVAL_FREE(g_win32_get_package_installation_directory(RVAL2CSTR(package),
52
- RVAL2CSTR(dll_name)));
53
- }
54
-
55
- static VALUE
56
- rg_s_get_package_installation_subdirectory(VALUE self, VALUE package, VALUE dll_name, VALUE subdir)
57
- {
58
- return CSTR2RVAL_FREE(g_win32_get_package_installation_subdirectory(RVAL2CSTR(package),
59
- RVAL2CSTR(dll_name),
60
- RVAL2CSTR(subdir)));
61
- }
62
-
63
48
  #if GLIB_CHECK_VERSION(2,6,0)
64
49
  static VALUE
65
50
  rg_s_version(VALUE self)
@@ -116,8 +101,6 @@ Init_glib_win32(void)
116
101
 
117
102
  RG_DEF_SMETHOD(error_message, 1);
118
103
  RG_DEF_SMETHOD(locale, 0);
119
- RG_DEF_SMETHOD(get_package_installation_directory, 2);
120
- RG_DEF_SMETHOD(get_package_installation_subdirectory, 3);
121
104
  RG_DEF_SMETHOD(version, 0);
122
105
  /* Deprecated */
123
106
  rbg_define_singleton_method(mGLib, "win32_locale", rbglib_m_win32_locale_deprecated, 0);
@@ -1,6 +1,6 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
2
  /*
3
- * Copyright (C) 2011 Ruby-GNOME2 Project Team
3
+ * Copyright (C) 2011-2013 Ruby-GNOME2 Project Team
4
4
  * Copyright (C) 2002,2003 Masahiro Sakai
5
5
  *
6
6
  * This library is free software; you can redistribute it and/or
@@ -55,14 +55,14 @@ boxed_free(boxed_holder *holder)
55
55
  static VALUE
56
56
  rbgobj_boxed_s_allocate(VALUE klass)
57
57
  {
58
- const RGObjClassInfo* cinfo = rbgobj_lookup_class(klass);
59
- boxed_holder* holder;
58
+ const RGObjClassInfo *cinfo = rbgobj_lookup_class(klass);
59
+ boxed_holder *holder;
60
60
  VALUE result;
61
61
 
62
62
  if (cinfo->gtype == G_TYPE_BOXED)
63
63
  rb_raise(rb_eTypeError, "abstract class");
64
64
 
65
- result = Data_Make_Struct(klass, boxed_holder,
65
+ result = Data_Make_Struct(klass, boxed_holder,
66
66
  boxed_mark, boxed_free, holder);
67
67
  holder->type = cinfo->gtype;
68
68
  holder->boxed = NULL;
@@ -81,8 +81,8 @@ rg_initialize(VALUE self)
81
81
  static VALUE
82
82
  rg_inspect(VALUE self)
83
83
  {
84
- boxed_holder* holder;
85
- gchar* s;
84
+ boxed_holder *holder;
85
+ gchar *s;
86
86
  VALUE result;
87
87
 
88
88
  Data_Get_Struct(self, boxed_holder, holder);
@@ -102,8 +102,8 @@ rg_inspect(VALUE self)
102
102
  static VALUE
103
103
  rg_initialize_copy(VALUE self, VALUE orig)
104
104
  {
105
- boxed_holder* holder1;
106
- boxed_holder* holder2;
105
+ boxed_holder *holder1;
106
+ boxed_holder *holder2;
107
107
 
108
108
  if (self == orig) return self;
109
109
 
@@ -134,24 +134,21 @@ rbgobj_boxed_create(VALUE klass)
134
134
 
135
135
  void
136
136
  rbgobj_boxed_initialize(VALUE obj, gpointer boxed)
137
- {
138
- boxed_holder* holder;
137
+ {
138
+ boxed_holder *holder;
139
139
  Data_Get_Struct(obj, boxed_holder, holder);
140
140
  holder->boxed = g_boxed_copy(holder->type, boxed);
141
141
  holder->own = TRUE;
142
142
  }
143
143
 
144
144
  gpointer
145
- rbgobj_boxed_get(VALUE obj, GType gtype)
145
+ rbgobj_boxed_get_default(VALUE obj, GType gtype)
146
146
  {
147
- boxed_holder* holder;
148
-
149
- if (NIL_P(obj))
150
- return NULL;
147
+ boxed_holder *holder;
151
148
 
152
149
  if (!RVAL2CBOOL(rb_obj_is_kind_of(obj, GTYPE2CLASS(gtype))))
153
150
  rb_raise(rb_eArgError, "invalid argument %s (expect %s)",
154
- rb_class2name(CLASS_OF(obj)),
151
+ rb_class2name(CLASS_OF(obj)),
155
152
  rb_class2name(GTYPE2CLASS(gtype)));
156
153
 
157
154
  Data_Get_Struct(obj, boxed_holder, holder);
@@ -161,22 +158,32 @@ rbgobj_boxed_get(VALUE obj, GType gtype)
161
158
  return holder->boxed;
162
159
  }
163
160
 
161
+ gpointer
162
+ rbgobj_boxed_get(VALUE obj, GType gtype)
163
+ {
164
+ gpointer boxed = NULL;
165
+
166
+ if (NIL_P(obj))
167
+ return NULL;
168
+
169
+ if (rbgobj_convert_robj2instance(gtype, obj, &boxed)) {
170
+ return boxed;
171
+ }
172
+
173
+ return rbgobj_boxed_get_default(obj, gtype);
174
+ }
175
+
164
176
  VALUE
165
- rbgobj_make_boxed(gpointer p, GType gtype)
177
+ rbgobj_make_boxed_raw(gpointer p, GType gtype, VALUE klass, gint flags)
166
178
  {
167
- const RGObjClassInfo* cinfo;
168
179
  VALUE result;
169
- boxed_holder* holder;
180
+ boxed_holder *holder;
170
181
 
171
- if (!p)
172
- return Qnil;
173
-
174
- cinfo = GTYPE2CINFO(gtype);
175
- result = rbgobj_boxed_s_allocate(cinfo->klass);
182
+ result = rbgobj_boxed_s_allocate(klass);
176
183
 
177
184
  Data_Get_Struct(result, boxed_holder, holder);
178
185
 
179
- if (cinfo->flags & RBGOBJ_BOXED_NOT_COPY){
186
+ if (flags & RBGOBJ_BOXED_NOT_COPY) {
180
187
  holder->boxed = p;
181
188
  holder->own = FALSE;
182
189
  } else {
@@ -187,43 +194,53 @@ rbgobj_make_boxed(gpointer p, GType gtype)
187
194
  return result;
188
195
  }
189
196
 
197
+ VALUE
198
+ rbgobj_make_boxed_default(gpointer p, GType gtype)
199
+ {
200
+ const RGObjClassInfo *cinfo;
201
+
202
+ cinfo = GTYPE2CINFO(gtype);
203
+ return rbgobj_make_boxed_raw(p, gtype, cinfo->klass, cinfo->flags);
204
+ }
205
+
206
+ VALUE
207
+ rbgobj_make_boxed(gpointer p, GType gtype)
208
+ {
209
+ VALUE result;
210
+
211
+ if (!p)
212
+ return Qnil;
213
+
214
+ if (rbgobj_convert_instance2robj(gtype, p, &result)) {
215
+ return result;
216
+ }
217
+
218
+ return rbgobj_make_boxed_default(p, gtype);
219
+ }
220
+
190
221
  void
191
222
  rbgobj_boxed_not_copy_obj(GType gtype)
192
223
  {
193
- RGObjClassInfo* cinfo = (RGObjClassInfo*)GTYPE2CINFO(gtype);
224
+ RGObjClassInfo *cinfo = (RGObjClassInfo *)GTYPE2CINFO(gtype);
194
225
  cinfo->flags |= RBGOBJ_BOXED_NOT_COPY;
195
226
  }
196
227
 
197
228
  /**********************************************************************/
198
229
 
199
230
  static VALUE
200
- boxed_to_ruby(const GValue* from)
231
+ boxed_to_ruby(const GValue *from)
201
232
  {
202
- gpointer boxed = g_value_get_boxed(from);
203
- if (!boxed)
204
- return Qnil;
205
- else
206
- return rbgobj_make_boxed(boxed, G_VALUE_TYPE(from));
233
+ gpointer boxed;
234
+ boxed = g_value_get_boxed(from);
235
+ return rbgobj_make_boxed(boxed, G_VALUE_TYPE(from));
207
236
  }
208
237
 
209
238
  static void
210
- boxed_from_ruby(VALUE from, GValue* to)
239
+ boxed_from_ruby(VALUE from, GValue *to)
211
240
  {
212
- boxed_holder* holder;
213
-
214
- if (NIL_P(from)) {
215
- g_value_set_boxed(to, NULL);
216
- return;
217
- }
218
-
219
- Data_Get_Struct(from, boxed_holder, holder);
220
-
221
- if (g_type_is_a(holder->type, G_VALUE_TYPE(to)))
222
- g_value_set_boxed(to, holder->boxed);
223
- else
224
- rb_raise(rb_eRuntimeError, "%s is not a subtype of %s",
225
- g_type_name(holder->type),
226
- g_type_name(G_VALUE_TYPE(to)));
241
+ gpointer boxed;
242
+ boxed = rbgobj_boxed_get(from, G_VALUE_TYPE(to));
243
+ g_value_set_boxed(to, boxed);
227
244
  }
228
245
 
229
246
  /**********************************************************************/
@@ -1,6 +1,6 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
2
  /*
3
- * Copyright (C) 2011 Ruby-GNOME2 Project Team
3
+ * Copyright (C) 2011-2013 Ruby-GNOME2 Project Team
4
4
  * Copyright (C) 2006 Sjoerd Simons, Masao Mutoh
5
5
  *
6
6
  * This library is free software; you can redistribute it and/or
@@ -24,20 +24,35 @@
24
24
 
25
25
  static GHashTable *tables, *class_to_g_type_map;
26
26
 
27
+ static void
28
+ rg_convert_table_free(gpointer data)
29
+ {
30
+ RGConvertTable *table = data;
31
+
32
+ if (table->notify) {
33
+ table->notify(table->user_data);
34
+ }
35
+ g_free(table);
36
+ }
37
+
27
38
  void
28
39
  Init_gobject_convert(void)
29
40
  {
30
- tables = g_hash_table_new(g_int_hash, g_int_equal);
41
+ /* TODO: unref the below tables on exit. */
42
+ tables = g_hash_table_new_full(g_int_hash, g_int_equal, NULL,
43
+ rg_convert_table_free);
31
44
  class_to_g_type_map = g_hash_table_new(g_int_hash, g_int_equal);
32
45
  }
33
46
 
34
47
  void
35
- rbgobj_convert_define(RGConvertTable *table)
48
+ rbgobj_convert_define(const RGConvertTable *table)
36
49
  {
37
- g_hash_table_insert(tables, &(table->type), table);
38
- if (table->klass && !NIL_P(table->klass)) {
50
+ RGConvertTable *copied_table;
51
+ copied_table = g_memdup(table, sizeof(RGConvertTable));
52
+ g_hash_table_insert(tables, &(copied_table->type), copied_table);
53
+ if (copied_table->klass != Qfalse && !NIL_P(copied_table->klass)) {
39
54
  g_hash_table_insert(class_to_g_type_map,
40
- &(table->klass), &(table->type));
55
+ &(copied_table->klass), &(copied_table->type));
41
56
  }
42
57
  }
43
58
 
@@ -60,7 +75,7 @@ rbgobj_convert_get_superclass(GType type, VALUE *result)
60
75
 
61
76
  table = rbgobj_convert_lookup(type);
62
77
  if (table && table->get_superclass) {
63
- *result = table->get_superclass();
78
+ *result = table->get_superclass(table->user_data);
64
79
  return TRUE;
65
80
  }
66
81
 
@@ -74,7 +89,7 @@ rbgobj_convert_type_init_hook(GType type, VALUE klass)
74
89
 
75
90
  table = rbgobj_convert_lookup(type);
76
91
  if (table && table->type_init_hook) {
77
- table->type_init_hook(klass);
92
+ table->type_init_hook(klass, table->user_data);
78
93
  return TRUE;
79
94
  }
80
95
 
@@ -88,7 +103,7 @@ rbgobj_convert_rvalue2gvalue(GType type, VALUE value, GValue *result)
88
103
 
89
104
  table = rbgobj_convert_lookup(type);
90
105
  if (table && table->rvalue2gvalue) {
91
- table->rvalue2gvalue(value, result);
106
+ table->rvalue2gvalue(value, result, table->user_data);
92
107
  return TRUE;
93
108
  }
94
109
 
@@ -102,7 +117,7 @@ rbgobj_convert_gvalue2rvalue(GType type, const GValue *value, VALUE *result)
102
117
 
103
118
  table = rbgobj_convert_lookup(type);
104
119
  if (table && table->gvalue2rvalue) {
105
- *result = table->gvalue2rvalue(value);
120
+ *result = table->gvalue2rvalue(value, table->user_data);
106
121
  return TRUE;
107
122
  }
108
123
 
@@ -127,7 +142,7 @@ rbgobj_convert_initialize(GType type, VALUE obj, gpointer cobj)
127
142
 
128
143
  table = rbgobj_convert_lookup(type);
129
144
  if (table && table->initialize) {
130
- table->initialize(obj, cobj);
145
+ table->initialize(obj, cobj, table->user_data);
131
146
  return TRUE;
132
147
  }
133
148
 
@@ -141,7 +156,7 @@ rbgobj_convert_robj2instance(GType type, VALUE obj, gpointer *result)
141
156
 
142
157
  table = rbgobj_convert_lookup(type);
143
158
  if (table && table->robj2instance) {
144
- *result = table->robj2instance(obj);
159
+ *result = table->robj2instance(obj, table->user_data);
145
160
  return TRUE;
146
161
  }
147
162
 
@@ -155,7 +170,7 @@ rbgobj_convert_instance2robj(GType type, gpointer instance, VALUE *result)
155
170
 
156
171
  table = rbgobj_convert_lookup(type);
157
172
  if (table && table->instance2robj) {
158
- *result = table->instance2robj(instance);
173
+ *result = table->instance2robj(instance, table->user_data);
159
174
  return TRUE;
160
175
  }
161
176
 
@@ -169,7 +184,7 @@ rbgobj_convert_unref(GType type, gpointer instance)
169
184
 
170
185
  table = rbgobj_convert_lookup(type);
171
186
  if (table && table->unref) {
172
- table->unref(instance);
187
+ table->unref(instance, table->user_data);
173
188
  return TRUE;
174
189
  }
175
190
 
@@ -22,6 +22,8 @@
22
22
  #include "rbgprivate.h"
23
23
 
24
24
  /**********************************************************************/
25
+ #define RG_TARGET_NAMESPACE rbgobj_cValue
26
+ #define _SELF(self) RVAL2GVALUE(self)
25
27
 
26
28
  static ID id_to_s;
27
29
  static GQuark qRValueToGValueFunc;
@@ -332,10 +334,50 @@ rbgobj_gc_mark_gvalue(GValue* value)
332
334
 
333
335
  /**********************************************************************/
334
336
 
337
+ static VALUE
338
+ rg_initialize(VALUE self, VALUE rb_gtype, VALUE rb_value)
339
+ {
340
+ GValue value = G_VALUE_INIT;
341
+
342
+ g_value_init(&value, NUM2INT(rb_to_int(rb_gtype)));
343
+ rbgobj_rvalue_to_gvalue(rb_value, &value);
344
+ G_INITIALIZE(self, &value);
345
+ g_value_unset(&value);
346
+
347
+ return Qnil;
348
+ }
349
+
350
+ static VALUE
351
+ rg_type(VALUE self)
352
+ {
353
+ GValue *value;
354
+
355
+ value = _SELF(self);
356
+
357
+ return rbgobj_gtype_new(value->g_type);
358
+ }
359
+
360
+ static VALUE
361
+ rg_value(VALUE self)
362
+ {
363
+ GValue *value;
364
+
365
+ value = _SELF(self);
366
+
367
+ return GVAL2RVAL(value);
368
+ }
369
+
335
370
  void
336
371
  Init_gobject_gvalue(void)
337
372
  {
373
+ VALUE RG_TARGET_NAMESPACE;
374
+
338
375
  id_to_s = rb_intern("to_s");
339
376
  qRValueToGValueFunc = g_quark_from_static_string("__ruby_r2g_func__");
340
377
  qGValueToRValueFunc = g_quark_from_static_string("__ruby_g2r_func__");
378
+
379
+ RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_VALUE, "Value", mGLib);
380
+ RG_DEF_METHOD(initialize, 2);
381
+ RG_DEF_METHOD(type, 0);
382
+ RG_DEF_METHOD(value, 0);
341
383
  }
@@ -77,9 +77,10 @@ gpointer
77
77
  rbgobj_instance_from_ruby_object(VALUE obj)
78
78
  {
79
79
  GType type;
80
+ GType fundamental_type;
80
81
 
81
82
  if (NIL_P(obj))
82
- return NULL;
83
+ return NULL;
83
84
 
84
85
  type = RVAL2GTYPE(obj);
85
86
  if (rbgobj_convert_has_type(type)) {
@@ -88,16 +89,18 @@ rbgobj_instance_from_ruby_object(VALUE obj)
88
89
  return instance;
89
90
  }
90
91
 
91
- type = G_TYPE_FUNDAMENTAL(type);
92
- switch (type){
92
+ fundamental_type = G_TYPE_FUNDAMENTAL(type);
93
+ switch (fundamental_type) {
93
94
  case G_TYPE_OBJECT:
94
95
  return rbgobj_get_gobject(obj);
96
+ case G_TYPE_BOXED:
97
+ return rbgobj_boxed_get(obj, type);
95
98
  case G_TYPE_PARAM:
96
99
  return rbgobj_get_param_spec(obj);
97
100
  default:
98
101
  {
99
102
  gpointer instance;
100
- if (!rbgobj_convert_robj2instance(type, obj, &instance)) {
103
+ if (!rbgobj_convert_robj2instance(fundamental_type, obj, &instance)) {
101
104
  rb_raise(rb_eTypeError, "%s isn't supported",
102
105
  rb_class2name(CLASS_OF(obj)));
103
106
  }
@@ -227,7 +227,11 @@ extern void rbgobj_register_property_getter(GType gtype, const char* prop_name,
227
227
  /* rbgobj_boxed.c */
228
228
  extern VALUE rbgobj_boxed_create(VALUE klass); /* deprecated */
229
229
  extern gpointer rbgobj_boxed_get(VALUE obj, GType gtype);
230
+ extern gpointer rbgobj_boxed_get_default(VALUE obj, GType gtype);
230
231
  extern VALUE rbgobj_make_boxed(gpointer data, GType gtype);
232
+ extern VALUE rbgobj_make_boxed_raw(gpointer p, GType gtype,
233
+ VALUE klass, gint flags);
234
+ extern VALUE rbgobj_make_boxed_default(gpointer data, GType gtype);
231
235
  extern void rbgobj_boxed_not_copy_obj(GType gtype);
232
236
 
233
237
  /* rbgobj_enums.c */
@@ -267,17 +271,19 @@ extern GType g_poll_fd_get_type(void);
267
271
  typedef struct {
268
272
  GType type;
269
273
  VALUE klass;
270
- VALUE (*get_superclass)(void);
271
- void (*type_init_hook)(VALUE);
272
- void (*rvalue2gvalue)(VALUE val, GValue *result);
273
- VALUE (*gvalue2rvalue)(const GValue *);
274
- void (*initialize)(VALUE, gpointer);
275
- gpointer (*robj2instance)(VALUE);
276
- VALUE (*instance2robj)(gpointer);
277
- void (*unref)(gpointer instance);
274
+ gpointer user_data;
275
+ GDestroyNotify notify;
276
+ VALUE (*get_superclass)(gpointer user_data);
277
+ void (*type_init_hook)(VALUE klass, gpointer user_data);
278
+ void (*rvalue2gvalue)(VALUE value, GValue *result, gpointer user_data);
279
+ VALUE (*gvalue2rvalue)(const GValue *value, gpointer user_data);
280
+ void (*initialize)(VALUE rb_instance, gpointer insntance, gpointer user_data);
281
+ gpointer (*robj2instance)(VALUE rb_instance, gpointer user_data);
282
+ VALUE (*instance2robj)(gpointer instance, gpointer user_data);
283
+ void (*unref)(gpointer instance, gpointer user_data);
278
284
  } RGConvertTable;
279
285
 
280
- extern void rbgobj_convert_define(RGConvertTable *table);
286
+ extern void rbgobj_convert_define(const RGConvertTable *table);
281
287
 
282
288
  #ifdef __cplusplus
283
289
  }
@@ -112,8 +112,13 @@ class GNOME2Package
112
112
  define_win32_build_task
113
113
  end
114
114
 
115
+ def so_base_name
116
+ @name.gsub(/-/, "_")
117
+ end
118
+
115
119
  def define_win32_extension_task
116
- Rake::ExtensionTask.new(@name, @spec) do |ext|
120
+ Rake::ExtensionTask.new(so_base_name, @spec) do |ext|
121
+ ext.ext_dir = "ext/#{@name}"
117
122
  ext.cross_compile = true
118
123
  ext.cross_compiling do |spec|
119
124
  if /mingw|mswin/ =~ spec.platform.to_s
@@ -64,18 +64,27 @@ class GNOME2Win32BinaryBuildTask
64
64
 
65
65
  def define_build_tasks
66
66
  namespace :build do
67
- task :prepare do
68
- depended_packages = @configuration.build_dependencies
69
- use_packages = [@configuration.package.name] + depended_packages
70
- pkg_config_path = use_packages.collect do |package|
71
- "../#{package}/#{@configuration.relative_binary_dir}/lib/pkgconfig"
67
+ prepare_task_names = []
68
+ namespace :prepare do
69
+ prepare_task_names << "pkg_config"
70
+ task :pkg_config do
71
+ depended_packages = @configuration.build_dependencies
72
+ use_packages = [@configuration.package.name] + depended_packages
73
+ pkg_config_path = use_packages.collect do |package|
74
+ "../#{package}/#{@configuration.relative_binary_dir}/lib/pkgconfig"
75
+ end
76
+ ENV["PKG_CONFIG_PATH"] = pkg_config_path.collect do |path|
77
+ File.expand_path(path)
78
+ end.join(":")
79
+ ENV["PKG_CONFIG_LIBDIR"] = rcairo_win32_pkgconfig_path
72
80
  end
73
- ENV["PKG_CONFIG_PATH"] = pkg_config_path.collect do |path|
74
- File.expand_path(path)
75
- end.join(":")
76
- ENV["PKG_CONFIG_LIBDIR"] = rcairo_win32_pkgconfig_path
77
81
  end
78
82
 
83
+ full_prepare_task_names = prepare_task_names.collect do |name|
84
+ "win32:builder:build:prepare:#{name}"
85
+ end
86
+ task :prepare => full_prepare_task_names
87
+
79
88
  build_packages.each do |package|
80
89
  download_task = "win32:builder:download:#{package[:name]}"
81
90
  desc "Build #{package[:label]} and install it into #{dist_dir}."
@@ -95,8 +104,11 @@ class GNOME2Win32BinaryBuildTask
95
104
  (package[:patches] || []).each do |patch|
96
105
  sh("patch -p1 < #{patches_dir}/#{patch}")
97
106
  end
107
+ (package[:remove_paths] || []).each do |path|
108
+ rm_rf(path)
109
+ end
98
110
  sh("./autogen.sh") if package[:need_autogen]
99
- sh("autoreconf -i") if package[:need_autoreconf]
111
+ sh("autoreconf --install") if package[:need_autoreconf]
100
112
  sh("./configure",
101
113
  "CPPFLAGS=#{cppflags(package)}",
102
114
  "LDFLAGS=#{ldflags(package)}",
@@ -163,6 +175,18 @@ class GNOME2Win32BinaryBuildTask
163
175
  package_root_dir + "patches"
164
176
  end
165
177
 
178
+ def glib2_dir
179
+ package_root_dir.parent + "glib2"
180
+ end
181
+
182
+ def glib2_include_path
183
+ "#{glib2_dir}/vendor/local/include"
184
+ end
185
+
186
+ def glib2_lib_path
187
+ "#{glib2_dir}/vendor/local/lib"
188
+ end
189
+
166
190
  def rcairo_win32_dir
167
191
  package_root_dir.parent.parent + "rcairo.win32"
168
192
  end
@@ -194,6 +218,9 @@ class GNOME2Win32BinaryBuildTask
194
218
 
195
219
  def cppflags(package)
196
220
  include_paths = package[:include_paths] || []
221
+ if @configuration.build_dependencies.include?("glib2")
222
+ include_paths += [glib2_include_path]
223
+ end
197
224
  include_paths += [
198
225
  rcairo_win32_include_path,
199
226
  dist_dir + 'include',
@@ -206,6 +233,9 @@ class GNOME2Win32BinaryBuildTask
206
233
 
207
234
  def ldflags(package)
208
235
  library_paths = package[:library_paths] || []
236
+ if @configuration.build_dependencies.include?("glib2")
237
+ library_paths += [glib2_lib_path]
238
+ end
209
239
  library_paths += [
210
240
  rcairo_win32_lib_path,
211
241
  dist_dir + 'lib',
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: 1
4
+ hash: 31
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
- - 1
9
- - 9
10
- version: 1.1.9
8
+ - 2
9
+ - 0
10
+ version: 1.2.0
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: 2012-12-30 00:00:00 Z
18
+ date: 2013-01-24 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: pkg-config
@@ -102,7 +102,6 @@ files:
102
102
  - ext/glib2/rbglib_int64.c
103
103
  - ext/glib2/rbglib_io_constants.c
104
104
  - ext/glib2/glib2.def
105
- - ext/glib2/rbgobj_fundamental.c
106
105
  - ext/glib2/rbgcompat.h
107
106
  - ext/glib2/rbgobj_closure.c
108
107
  - ext/glib2/rbgobject.c
@@ -1,43 +0,0 @@
1
- /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /*
3
- * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
- * Copyright (C) 2007 Ruby-GNOME2 Project Team
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
- */
21
-
22
- #include "rbgobject.h"
23
- #include "rbgprivate.h"
24
-
25
- static GList *tables = NULL;
26
-
27
- void
28
- rbgobj_fund_define_fundamental(RGFundamental *fundamental)
29
- {
30
- RGConvertTable *table;
31
-
32
- table = g_new0(RGConvertTable, 1);
33
- table->type = fundamental->type;
34
- table->get_superclass = fundamental->get_superclass;
35
- table->type_init_hook = fundamental->type_init_hook;
36
- table->rvalue2gvalue = fundamental->rvalue2gvalue;
37
- table->gvalue2rvalue = fundamental->gvalue2rvalue;
38
- table->initialize = fundamental->initialize;
39
- table->robj2instance = fundamental->robj2instance;
40
- table->instance2robj = fundamental->instance2robj;
41
- RG_DEF_CONVERSION(table);
42
- tables = g_list_prepend(tables, table);
43
- }