gtk2 0.90.2 → 0.90.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/ChangeLog CHANGED
@@ -1,3 +1,57 @@
1
+ 2010-10-17 Kouhei Sutou <kou@cozmixng.org>
2
+
3
+ * ext/gtk2/rbgdkcairo.c: move GDK and cairo related code from
4
+ Ruby/GdkPixbuf2.
5
+ Patch by Andrea Dallera. Thanks!!!
6
+
7
+ * ext/gtk2/rbgtkitemfactory.c (ifact_initialize): Use NUM2ULONG()
8
+ instead of NUM2UINT() because GType is unsigned long.
9
+ "[ruby-gnome2-devel-en] Problem with rbgtkitemfactory.c on 64bit
10
+ platforms"
11
+ Reported by Steve Wills. Thanks!!!
12
+
13
+ 2010-10-12 Kouhei Sutou <kou@cozmixng.org>
14
+
15
+ * ext/gtk2/rbgtkitemfactory.c (ifact_initialize): fix wrong GType
16
+ conversion type.
17
+ "[ruby-gnome2-devel-en] Problem with rbgtkitemfactory.c on 64bit
18
+ platforms"
19
+ Reported by Grant McLean and Steve Wills. Thanks!!!
20
+
21
+ * ext/gtk2/extconf.rb: cleanup.
22
+
23
+ * ext/gtk2/extconf.rb: keep backward compatibility around GDK key
24
+ symbols introduced at GTK+ 2.20.
25
+ "[ruby-gnome2-devel-en] Constants names change in Gdk::KeyVal"
26
+ Patch by Vincent Carmona. Thanks!!!
27
+
28
+ 2010-10-08 Guillaume Cottenceau
29
+
30
+ * fix some uses of rb_str_new* and StringValuePtr to use
31
+ encoding-aware Strings
32
+
33
+ 2010-10-08 Guillaume Cottenceau
34
+
35
+ * RVAL2CSTR2 is deprecated, replace with RVAL2CSTR_ACCEPT_NIL
36
+
37
+ * CSTR2RVAL2 is deprecated, replace with CSTR2RVAL_FREE
38
+
39
+ 2010-10-07 Guillaume Cottenceau
40
+
41
+ * ext/gtk2/rbgtkfilechooser.c: move functions to handle filename
42
+ String to/from rg2 manipulations to glib2, to use them in any rg2
43
+ submodules
44
+
45
+ 2010-10-04 Guillaume Cottenceau
46
+
47
+ * ext/gtk2/rbgtkfilechooser.c: correctly handle filenames
48
+ to/from rg2 with ruby 1.9 String supporting encodings (in
49
+ particular, they are not necessarily specified in UTF-8)
50
+
51
+ 2010-09-29 Kouhei Sutou <kou@cozmixng.org>
52
+
53
+ * Rakefile: fix dependencies.
54
+
1
55
  2010-09-25 Kouhei Sutou <kou@cozmixng.org>
2
56
 
3
57
  * ext/gtk2/extconf.rb: ensure adding built source to targets.
data/Rakefile CHANGED
@@ -39,9 +39,11 @@ spec = Gem::Specification.new do |s|
39
39
  s.version = version
40
40
  s.platform = Gem::Platform::RUBY
41
41
  s.add_dependency("cairo", ">= 1.10.0")
42
- s.add_dependency("glib2", "= #{version}")
43
- s.add_dependency("pango", "= #{version}")
44
- s.add_dependency("atk", "= #{version}")
42
+ compatible_version = version.split(/\./)[0, 3].join(".")
43
+ s.add_dependency("glib2", ">= #{compatible_version}")
44
+ s.add_dependency("pango", ">= #{compatible_version}")
45
+ s.add_dependency("gdk_pixbuf2", ">= #{compatible_version}")
46
+ s.add_dependency("atk", "= #{compatible_version}")
45
47
  s.extensions = FileList["ext/#{package_name}/extconf.rb"]
46
48
  s.require_paths = ["lib"]
47
49
  s.files = FileList["ChangeLog", "README", "Rakefile", "extconf.rb",
@@ -71,6 +73,10 @@ namespace :win32 do
71
73
  task :download do
72
74
  $LOAD_PATH.unshift((@rb_glib2_dir + "lib").to_s)
73
75
  require 'gnome2-win32-binary-downloader'
74
- GNOME2Win32BinaryDownloader.download(:packages => ["gtk"])
76
+ packages = ["glib", "atk", "gdk-pixbuf", "pango", "gtk+"]
77
+ dependencies = ["gettext-runtime", "zlib", "freetype", "expat",
78
+ "fontconfig", "cairo", "libpng"]
79
+ GNOME2Win32BinaryDownloader.download(:packages => packages,
80
+ :dependencies => dependencies)
75
81
  end
76
82
  end
@@ -6,5 +6,7 @@ install-so:
6
6
  $(INSTALL_DATA) $(srcdir)/rbgtkmacros.h $(RUBYARCHDIR)
7
7
 
8
8
  install:
9
- $(MAKEDIRS) $(libdir)/pkgconfig
10
- $(INSTALL_DATA) ruby-gtk2.pc $(libdir)/pkgconfig
9
+ if test -n "$(pkgconfigdir)"; then \
10
+ $(MAKEDIRS) $(pkgconfigdir); \
11
+ $(INSTALL_DATA) ruby-gtk2.pc $(pkgconfigdir); \
12
+ fi
@@ -12,7 +12,7 @@ top_build_dir = Pathname(".").parent.parent.parent.expand_path
12
12
  mkmf_gnome2_dir = top_dir + "glib2" + 'lib'
13
13
  version_suffix = ""
14
14
  unless mkmf_gnome2_dir.exist?
15
- if /(-\d+\.\d+\.\d+)\z/ =~ base_dir.basename.to_s
15
+ if /(-\d+\.\d+\.\d+)(?:\.\d+)?\z/ =~ base_dir.basename.to_s
16
16
  version_suffix = $1
17
17
  mkmf_gnome2_dir = top_dir + "glib2#{version_suffix}" + 'lib'
18
18
  end
@@ -39,17 +39,17 @@ target = PKGConfig.variable(package_id, "target")
39
39
  $defs << "-DRUBY_GTK2_TARGET=\\\"#{target}\\\""
40
40
  STDOUT.print(target, "\n")
41
41
 
42
- gdkincl = nil
43
- tmpincl = $CFLAGS.gsub(/-D\w+/, '').split(/-I/) + ['/usr/include']
44
- tmpincl.each do |i|
45
- i.strip!
42
+ gdk_include_path = nil
43
+ include_paths = $CFLAGS.gsub(/-D\w+/, '').split(/-I/) + ['/usr/include']
44
+ include_paths.each do |path|
45
+ path.strip!
46
46
 
47
- if FileTest.exist?(i + "/gdk/gdkkeysyms.h")
48
- gdkincl = i + "/gdk"
47
+ if FileTest.exist?("#{path}/gdk/gdkkeysyms.h")
48
+ gdk_include_path = Pathname("#{path}/gdk")
49
49
  break
50
50
  end
51
51
  end
52
- raise "can't find gdkkeysyms.h" if gdkincl.nil?
52
+ raise "can't find gdkkeysyms.h" if gdk_include_path.nil?
53
53
 
54
54
  gtk_header = "gtk/gtk.h"
55
55
  have_func('gtk_plug_get_type', gtk_header)
@@ -183,12 +183,17 @@ rbgtkinits_c_path.open("w") do |rbgtkinits_c|
183
183
  end
184
184
 
185
185
  rbgdkkeysyms_h_path = Pathname("rbgdkkeysyms.h")
186
+ gdkkeysyms_h_paths = []
187
+ gdkkeysyms_h_paths << gdk_include_path + "gdkkeysyms.h"
188
+ gdkkeysyms_h_paths << gdk_include_path + "gdkkeysyms-compat.h"
186
189
  rbgdkkeysyms_h_path.open("w") do |rbgdkkeysyms_h|
187
- gdkkeysyms_h_path = Pathname(gdkincl) + "gdkkeysyms.h"
188
- gdkkeysyms_h_path.each_line do |line|
189
- if /^#define\s+(GDK_\w+)\s+\d+/ =~ line
190
- define_line = "rb_define_const(mGdkKeyval, \"#{$1}\", INT2FIX(#{$1}));"
191
- rbgdkkeysyms_h.puts(define_line)
190
+ gdkkeysyms_h_paths.each do |path|
191
+ next unless path.exist?
192
+ path.each_line do |line|
193
+ if /^#define\s+(GDK_\w+)\s+\d+/ =~ line
194
+ define_line = "rb_define_const(mGdkKeyval, \"#{$1}\", INT2FIX(#{$1}));"
195
+ rbgdkkeysyms_h.puts(define_line)
196
+ end
192
197
  end
193
198
  end
194
199
  end
@@ -85,7 +85,7 @@ static VALUE
85
85
  gdkatom_name(self)
86
86
  VALUE self;
87
87
  {
88
- return CSTR2RVAL2(gdk_atom_name(_SELF(self)));
88
+ return CSTR2RVAL_FREE(gdk_atom_name(_SELF(self)));
89
89
  }
90
90
 
91
91
  static VALUE
@@ -13,10 +13,12 @@
13
13
 
14
14
  #if GTK_CHECK_VERSION(2,8,0) && defined(HAVE_RB_CAIRO_H)
15
15
  # define CAIRO_AVAILABLE 1
16
+ #else
17
+ # define CAIRO_AVAILABLE 0
16
18
  #endif
17
19
 
18
- #ifdef CAIRO_AVAILABLE
19
-
20
+ #if CAIRO_AVAILABLE
21
+ #include <gdk/gdkcairo.h>
20
22
  #include <rb_cairo.h>
21
23
 
22
24
  #define _SELF(self) RVAL2CRCONTEXT(self)
@@ -30,13 +32,20 @@ gdkdraw_cairo_set_source_color(self, color)
30
32
  return self;
31
33
  }
32
34
 
33
- /* Move to gdkpixbuf/rbgdk-pixbuf.c
34
- void gdk_cairo_set_source_pixbuf (cairo_t *cr,
35
- GdkPixbuf *pixbuf,
36
- double pixbuf_x,
37
- double pixbuf_y);
38
- */
35
+ static VALUE
36
+ gdkdraw_cairo_set_source_pixbuf(int argc, VALUE *argv, VALUE self)
37
+ {
38
+ VALUE pixbuf, pixbuf_x, pixbuf_y;
39
39
 
40
+ rb_scan_args(argc, argv, "12", &pixbuf, &pixbuf_x, &pixbuf_y);
41
+
42
+ gdk_cairo_set_source_pixbuf(_SELF(self),
43
+ GDK_PIXBUF(RVAL2GOBJ(pixbuf)),
44
+ NIL_P(pixbuf_x) ? 0 : NUM2DBL(pixbuf_x),
45
+ NIL_P(pixbuf_y) ? 0 : NUM2DBL(pixbuf_y));
46
+ rb_cairo_check_status(cairo_status(_SELF(self)));
47
+ return self;
48
+ }
40
49
 
41
50
  #if GTK_CHECK_VERSION(2,10,0)
42
51
  static VALUE
@@ -86,6 +95,8 @@ Init_gtk_gdk_cairo()
86
95
  #if CAIRO_AVAILABLE
87
96
  rb_define_method(rb_cCairo_Context, "set_source_gdk_color",
88
97
  gdkdraw_cairo_set_source_color, 1);
98
+ rb_define_method(rb_cCairo_Context, "set_source_pixbuf",
99
+ gdkdraw_cairo_set_source_pixbuf, -1);
89
100
  #if GTK_CHECK_VERSION(2,10,0)
90
101
  rb_define_method(rb_cCairo_Context, "set_source_pixmap", gdkdraw_cairo_set_source_pixmap, 3);
91
102
  #endif
@@ -283,7 +283,7 @@ gdkprop_get(argc, argv, self)
283
283
  switch(rfmt){
284
284
  case 8:
285
285
  default:
286
- ret = rb_str_new((const char*)rdat, rlen);
286
+ ret = RBG_STRING_SET_UTF8_ENCODING(rb_str_new((const char*)rdat, rlen));
287
287
  break;
288
288
 
289
289
  case 16:
@@ -182,7 +182,6 @@ clipboard_text_received_func(GtkClipboard *clipboard, const gchar *text,
182
182
  VALUE vtext = Qnil;
183
183
  if (text) {
184
184
  vtext = CSTR2RVAL(text);
185
- RBG_STRING_SET_UTF8_ENCODING(vtext);
186
185
  }
187
186
 
188
187
  rb_funcall((VALUE)func, id_call, 2, CLIPBOARD2RVAL(clipboard), vtext);
@@ -153,7 +153,7 @@ static VALUE
153
153
  combobox_get_active_text(self)
154
154
  VALUE self;
155
155
  {
156
- return CSTR2RVAL2(gtk_combo_box_get_active_text(_SELF(self)));
156
+ return CSTR2RVAL_FREE(gtk_combo_box_get_active_text(_SELF(self)));
157
157
  }
158
158
 
159
159
  static VALUE
@@ -220,8 +220,7 @@ cont_child_get_property(self, child, prop_name)
220
220
  if (SYMBOL_P(prop_name)) {
221
221
  name = rb_id2name(SYM2ID(prop_name));
222
222
  } else {
223
- StringValue(prop_name);
224
- name = StringValuePtr(prop_name);
223
+ name = RVAL2CSTR(prop_name);
225
224
  }
226
225
 
227
226
  pspec = gtk_container_class_find_child_property(
@@ -266,8 +265,7 @@ cont_child_set_property(self, child, prop_name, val)
266
265
  if (SYMBOL_P(prop_name)) {
267
266
  name = rb_id2name(SYM2ID(prop_name));
268
267
  } else {
269
- StringValue(prop_name);
270
- name = StringValuePtr(prop_name);
268
+ name = RVAL2CSTR(prop_name);
271
269
  }
272
270
 
273
271
  pspec = gtk_container_class_find_child_property(
@@ -410,8 +408,7 @@ cont_s_child_property(self, property_name)
410
408
  if (SYMBOL_P(property_name)) {
411
409
  name = rb_id2name(SYM2ID(property_name));
412
410
  } else {
413
- StringValue(property_name);
414
- name = StringValuePtr(property_name);
411
+ name = RVAL2CSTR(property_name);
415
412
  }
416
413
 
417
414
  oclass = g_type_class_ref(CLASS2GTYPE(self));
@@ -61,7 +61,7 @@ static VALUE
61
61
  edit_get_chars(self, start, end)
62
62
  VALUE self, start, end;
63
63
  {
64
- return CSTR2RVAL2(
64
+ return CSTR2RVAL_FREE(
65
65
  gtk_editable_get_chars(GTK_EDITABLE(RVAL2GOBJ(self)), /* check s */
66
66
  NUM2INT(start), NUM2INT(end))); /* check start,end */
67
67
  }
@@ -23,13 +23,12 @@
23
23
  #endif
24
24
 
25
25
  static VALUE
26
- gslist2ary_free(list)
27
- GSList* list;
26
+ gslist2ary_free(GSList* list)
28
27
  {
29
28
  GSList* l;
30
29
  VALUE ary = rb_ary_new();
31
30
  for (l = list; l != NULL; l = g_slist_next(l)) {
32
- rb_ary_push(ary, CSTR2RVAL2(l->data));
31
+ rb_ary_push(ary, CSTR2RVAL_FREE(l->data));
33
32
  }
34
33
  g_slist_free(list);
35
34
  return ary;
@@ -71,6 +70,7 @@ static VALUE
71
70
  fcho_set_current_name(self, name)
72
71
  VALUE self, name;
73
72
  {
73
+ /* doc says the awaited string is UTF-8, so use RVAL2CSTR */
74
74
  gtk_file_chooser_set_current_name(_SELF(self), RVAL2CSTR(name));
75
75
  return self;
76
76
  }
@@ -79,14 +79,14 @@ static VALUE
79
79
  fcho_get_filename(self)
80
80
  VALUE self;
81
81
  {
82
- return CSTR2RVAL2(gtk_file_chooser_get_filename(_SELF(self)));
82
+ return CSTRFILENAME2RVAL_FREE(gtk_file_chooser_get_filename(_SELF(self)));
83
83
  }
84
84
 
85
85
  static VALUE
86
86
  fcho_set_filename(self, name)
87
87
  VALUE self, name;
88
88
  {
89
- gboolean ret = gtk_file_chooser_set_filename(_SELF(self), RVAL2CSTR(name));
89
+ gboolean ret = gtk_file_chooser_set_filename(_SELF(self), RVAL2CSTRFILENAME(name));
90
90
  if (! ret) rb_raise(rb_eRuntimeError, "Can't set filename");
91
91
  return self;
92
92
  }
@@ -95,14 +95,14 @@ static VALUE
95
95
  fcho_select_filename(self, filename)
96
96
  VALUE self, filename;
97
97
  {
98
- return CBOOL2RVAL(gtk_file_chooser_select_filename(_SELF(self), RVAL2CSTR(filename)));
98
+ return CBOOL2RVAL(gtk_file_chooser_select_filename(_SELF(self), RVAL2CSTRFILENAME(filename)));
99
99
  }
100
100
 
101
101
  static VALUE
102
102
  fcho_unselect_filename(self, filename)
103
103
  VALUE self, filename;
104
104
  {
105
- gtk_file_chooser_unselect_filename(_SELF(self), RVAL2CSTR(filename));
105
+ gtk_file_chooser_unselect_filename(_SELF(self), RVAL2CSTRFILENAME(filename));
106
106
  return self;
107
107
  }
108
108
 
@@ -126,7 +126,7 @@ static VALUE
126
126
  fcho_get_filenames(self)
127
127
  VALUE self;
128
128
  {
129
- return gslist2ary_free(gtk_file_chooser_get_filenames(_SELF(self)));
129
+ return CSTRFILENAMEARRAY2RVAL_FREE(gtk_file_chooser_get_filenames(_SELF(self)));
130
130
  }
131
131
 
132
132
  static VALUE
@@ -142,14 +142,14 @@ static VALUE
142
142
  fcho_get_current_folder(self)
143
143
  VALUE self;
144
144
  {
145
- return CSTR2RVAL2(gtk_file_chooser_get_current_folder(_SELF(self)));
145
+ return CSTR2RVAL_FREE(gtk_file_chooser_get_current_folder(_SELF(self)));
146
146
  }
147
147
 
148
148
  static VALUE
149
149
  fcho_get_uri(self)
150
150
  VALUE self;
151
151
  {
152
- return CSTR2RVAL2(gtk_file_chooser_get_uri(_SELF(self)));
152
+ return CSTR2RVAL_FREE(gtk_file_chooser_get_uri(_SELF(self)));
153
153
  }
154
154
 
155
155
  static VALUE
@@ -196,7 +196,7 @@ static VALUE
196
196
  fcho_get_current_folder_uri(self)
197
197
  VALUE self;
198
198
  {
199
- return CSTR2RVAL2(gtk_file_chooser_get_current_folder_uri(_SELF(self)));
199
+ return CSTR2RVAL_FREE(gtk_file_chooser_get_current_folder_uri(_SELF(self)));
200
200
  }
201
201
 
202
202
  /* They are defined as properties.
@@ -212,14 +212,14 @@ static VALUE
212
212
  fcho_get_preview_filename(self)
213
213
  VALUE self;
214
214
  {
215
- return CSTR2RVAL2(gtk_file_chooser_get_preview_filename(_SELF(self)));
215
+ return CSTR2RVAL_FREE(gtk_file_chooser_get_preview_filename(_SELF(self)));
216
216
  }
217
217
 
218
218
  static VALUE
219
219
  fcho_get_preview_uri(self)
220
220
  VALUE self;
221
221
  {
222
- return CSTR2RVAL2(gtk_file_chooser_get_preview_uri(_SELF(self)));
222
+ return CSTR2RVAL_FREE(gtk_file_chooser_get_preview_uri(_SELF(self)));
223
223
  }
224
224
 
225
225
  /* They are defined as properties.
@@ -261,7 +261,7 @@ fcho_add_shortcut_folder(self, folder)
261
261
  VALUE self, folder;
262
262
  {
263
263
  GError *error = NULL;
264
- if (! gtk_file_chooser_add_shortcut_folder(_SELF(self), RVAL2CSTR(folder), &error))
264
+ if (! gtk_file_chooser_add_shortcut_folder(_SELF(self), RVAL2CSTRFILENAME(folder), &error))
265
265
  RAISE_GERROR(error);
266
266
  return self;
267
267
  }
@@ -271,7 +271,7 @@ fcho_remove_shortcut_folder(self, folder)
271
271
  VALUE self, folder;
272
272
  {
273
273
  GError *error = NULL;
274
- if (! gtk_file_chooser_remove_shortcut_folder(_SELF(self), RVAL2CSTR(folder), &error))
274
+ if (! gtk_file_chooser_remove_shortcut_folder(_SELF(self), RVAL2CSTRFILENAME(folder), &error))
275
275
  RAISE_GERROR(error);
276
276
  return self;
277
277
  }
@@ -280,7 +280,7 @@ static VALUE
280
280
  fcho_list_shortcut_folders(self)
281
281
  VALUE self;
282
282
  {
283
- return gslist2ary_free(gtk_file_chooser_list_shortcut_folders(_SELF(self)));
283
+ return CSTRFILENAMEARRAY2RVAL_FREE(gtk_file_chooser_list_shortcut_folders(_SELF(self)));
284
284
  }
285
285
 
286
286
 
@@ -323,6 +323,7 @@ gboolean gtk_file_chooser_get_do_overwrite_confirmation
323
323
  void
324
324
  Init_gtk_file_chooser()
325
325
  {
326
+
326
327
  #if GTK_CHECK_VERSION(2,4,0)
327
328
 
328
329
  VALUE gFileCho = G_DEF_INTERFACE(GTK_TYPE_FILE_CHOOSER, "FileChooser", mGtk);
@@ -183,7 +183,7 @@ static VALUE
183
183
  it_get_example_icon_name(self)
184
184
  VALUE self;
185
185
  {
186
- return CSTR2RVAL2(gtk_icon_theme_get_example_icon_name(_SELF(self)));
186
+ return CSTR2RVAL_FREE(gtk_icon_theme_get_example_icon_name(_SELF(self)));
187
187
  }
188
188
 
189
189
  static VALUE
@@ -29,7 +29,7 @@ ifact_initialize(self, type, path, accel)
29
29
  {
30
30
  VALUE obj = rb_eval_string("eval('self', binding)");
31
31
  G_RELATIVE(obj, self);
32
- RBGTK_INITIALIZE(self, gtk_item_factory_new(FIX2INT(type), RVAL2CSTR(path),
32
+ RBGTK_INITIALIZE(self, gtk_item_factory_new(NUM2ULONG(type), RVAL2CSTR(path),
33
33
  RVAL2ACCEL(accel)));
34
34
 
35
35
  return Qnil;
@@ -23,7 +23,7 @@ psud_initialize(int argc, VALUE *argv, VALUE self)
23
23
  VALUE title, parent;
24
24
 
25
25
  rb_scan_args(argc, argv, "02", &title, &parent);
26
- dialog = gtk_page_setup_unix_dialog_new(RVAL2CSTR2(title), RVAL2GOBJ(parent));
26
+ dialog = gtk_page_setup_unix_dialog_new(RVAL2CSTR_ACCEPT_NIL(title), RVAL2GOBJ(parent));
27
27
 
28
28
  RBGTK_INITIALIZE(self, dialog);
29
29
  return Qnil;
@@ -26,7 +26,7 @@ ps_initialize(int argc, VALUE *argv, VALUE self)
26
26
  if (argc <= 1) {
27
27
  VALUE name;
28
28
  rb_scan_args(argc, argv, "01", &name);
29
- size = gtk_paper_size_new(RVAL2CSTR2(name));
29
+ size = gtk_paper_size_new(RVAL2CSTR_ACCEPT_NIL(name));
30
30
  } else if (argc == 4) {
31
31
  size = gtk_paper_size_new_from_ppd(RVAL2CSTR(argv[0]),
32
32
  RVAL2CSTR(argv[1]),
@@ -144,14 +144,14 @@ Init_gtk_paper_size()
144
144
 
145
145
  rb_define_singleton_method(gPaperSize, "default", ps_s_get_default, 0);
146
146
 
147
- rb_define_const(gPaperSize, "A3", rb_str_new2(GTK_PAPER_NAME_A3));
148
- rb_define_const(gPaperSize, "A4", rb_str_new2(GTK_PAPER_NAME_A4));
149
- rb_define_const(gPaperSize, "A5", rb_str_new2(GTK_PAPER_NAME_A5));
150
- rb_define_const(gPaperSize, "B5", rb_str_new2(GTK_PAPER_NAME_B5));
151
- rb_define_const(gPaperSize, "LETTER", rb_str_new2(GTK_PAPER_NAME_LETTER));
147
+ rb_define_const(gPaperSize, "A3", CSTR2RVAL(GTK_PAPER_NAME_A3));
148
+ rb_define_const(gPaperSize, "A4", CSTR2RVAL(GTK_PAPER_NAME_A4));
149
+ rb_define_const(gPaperSize, "A5", CSTR2RVAL(GTK_PAPER_NAME_A5));
150
+ rb_define_const(gPaperSize, "B5", CSTR2RVAL(GTK_PAPER_NAME_B5));
151
+ rb_define_const(gPaperSize, "LETTER", CSTR2RVAL(GTK_PAPER_NAME_LETTER));
152
152
  rb_define_const(gPaperSize, "EXECUTIVE",
153
- rb_str_new2(GTK_PAPER_NAME_EXECUTIVE));
154
- rb_define_const(gPaperSize, "LEGAL", rb_str_new2(GTK_PAPER_NAME_LEGAL));
153
+ CSTR2RVAL(GTK_PAPER_NAME_EXECUTIVE));
154
+ rb_define_const(gPaperSize, "LEGAL", CSTR2RVAL(GTK_PAPER_NAME_LEGAL));
155
155
 
156
156
  rb_define_method(gPaperSize, "initialize", ps_initialize, -1);
157
157
  rb_define_method(gPaperSize, "==", ps_is_equal, 1);
@@ -78,7 +78,7 @@ ps_get(VALUE self, VALUE key)
78
78
  static VALUE
79
79
  ps_set(VALUE self, VALUE key, VALUE value)
80
80
  {
81
- gtk_print_settings_set(_SELF(self), RVAL2CSTR(key), RVAL2CSTR2(value));
81
+ gtk_print_settings_set(_SELF(self), RVAL2CSTR(key), RVAL2CSTR_ACCEPT_NIL(value));
82
82
  return self;
83
83
  }
84
84
 
@@ -285,7 +285,7 @@ ps_get_printer(VALUE self)
285
285
  static VALUE
286
286
  ps_set_printer(VALUE self, VALUE printer)
287
287
  {
288
- gtk_print_settings_set_printer(_SELF(self), RVAL2CSTR2(printer));
288
+ gtk_print_settings_set_printer(_SELF(self), RVAL2CSTR_ACCEPT_NIL(printer));
289
289
  return self;
290
290
  }
291
291
 
@@ -546,7 +546,7 @@ static VALUE
546
546
  ps_set_default_source(VALUE self, VALUE default_source)
547
547
  {
548
548
  gtk_print_settings_set_default_source(_SELF(self),
549
- RVAL2CSTR2(default_source));
549
+ RVAL2CSTR_ACCEPT_NIL(default_source));
550
550
  return self;
551
551
  }
552
552
 
@@ -559,7 +559,7 @@ ps_get_media_type(VALUE self)
559
559
  static VALUE
560
560
  ps_set_media_type(VALUE self, VALUE media_type)
561
561
  {
562
- gtk_print_settings_set_media_type(_SELF(self), RVAL2CSTR2(media_type));
562
+ gtk_print_settings_set_media_type(_SELF(self), RVAL2CSTR_ACCEPT_NIL(media_type));
563
563
  return self;
564
564
  }
565
565
 
@@ -572,7 +572,7 @@ ps_get_dither(VALUE self)
572
572
  static VALUE
573
573
  ps_set_dither(VALUE self, VALUE dither)
574
574
  {
575
- gtk_print_settings_set_dither(_SELF(self), RVAL2CSTR2(dither));
575
+ gtk_print_settings_set_dither(_SELF(self), RVAL2CSTR_ACCEPT_NIL(dither));
576
576
  return self;
577
577
  }
578
578
 
@@ -585,7 +585,7 @@ ps_get_finishings(VALUE self)
585
585
  static VALUE
586
586
  ps_set_finishings(VALUE self, VALUE finishings)
587
587
  {
588
- gtk_print_settings_set_finishings(_SELF(self), RVAL2CSTR2(finishings));
588
+ gtk_print_settings_set_finishings(_SELF(self), RVAL2CSTR_ACCEPT_NIL(finishings));
589
589
  return self;
590
590
  }
591
591
 
@@ -598,7 +598,7 @@ ps_get_output_bin(VALUE self)
598
598
  static VALUE
599
599
  ps_set_output_bin(VALUE self, VALUE output_bin)
600
600
  {
601
- gtk_print_settings_set_output_bin(_SELF(self), RVAL2CSTR2(output_bin));
601
+ gtk_print_settings_set_output_bin(_SELF(self), RVAL2CSTR_ACCEPT_NIL(output_bin));
602
602
  return self;
603
603
  }
604
604
  #endif
@@ -620,7 +620,7 @@ ps_to_key_file(int argc, VALUE *argv, VALUE self)
620
620
  rb_scan_args(argc, argv, "11", &key_file, &group_name);
621
621
  gtk_print_settings_to_key_file(_SELF(self),
622
622
  (GKeyFile*)RVAL2BOXED(key_file, G_TYPE_KEY_FILE),
623
- RVAL2CSTR2(group_name));
623
+ RVAL2CSTR_ACCEPT_NIL(group_name));
624
624
  return self;
625
625
  }
626
626
  #endif
@@ -666,59 +666,59 @@ Init_gtk_print_settings()
666
666
  rb_define_method(gPrintSettings, "each", ps_foreach, 0);
667
667
 
668
668
  rb_define_const(gPrintSettings, "PRINTER",
669
- rb_str_new2(GTK_PRINT_SETTINGS_PRINTER));
669
+ CSTR2RVAL(GTK_PRINT_SETTINGS_PRINTER));
670
670
  rb_define_const(gPrintSettings, "ORIENTATION",
671
- rb_str_new2(GTK_PRINT_SETTINGS_ORIENTATION));
671
+ CSTR2RVAL(GTK_PRINT_SETTINGS_ORIENTATION));
672
672
  rb_define_const(gPrintSettings, "PAPER_FORMAT",
673
- rb_str_new2(GTK_PRINT_SETTINGS_PAPER_FORMAT));
673
+ CSTR2RVAL(GTK_PRINT_SETTINGS_PAPER_FORMAT));
674
674
  rb_define_const(gPrintSettings, "PAPER_WIDTH",
675
- rb_str_new2(GTK_PRINT_SETTINGS_PAPER_WIDTH));
675
+ CSTR2RVAL(GTK_PRINT_SETTINGS_PAPER_WIDTH));
676
676
  rb_define_const(gPrintSettings, "PAPER_HEIGHT",
677
- rb_str_new2(GTK_PRINT_SETTINGS_PAPER_HEIGHT));
677
+ CSTR2RVAL(GTK_PRINT_SETTINGS_PAPER_HEIGHT));
678
678
  rb_define_const(gPrintSettings, "N_COPIES",
679
- rb_str_new2(GTK_PRINT_SETTINGS_N_COPIES));
679
+ CSTR2RVAL(GTK_PRINT_SETTINGS_N_COPIES));
680
680
  rb_define_const(gPrintSettings, "DEFAULT_SOURCE",
681
- rb_str_new2(GTK_PRINT_SETTINGS_DEFAULT_SOURCE));
681
+ CSTR2RVAL(GTK_PRINT_SETTINGS_DEFAULT_SOURCE));
682
682
  rb_define_const(gPrintSettings, "QUALITY",
683
- rb_str_new2(GTK_PRINT_SETTINGS_QUALITY));
683
+ CSTR2RVAL(GTK_PRINT_SETTINGS_QUALITY));
684
684
  rb_define_const(gPrintSettings, "RESOLUTION",
685
- rb_str_new2(GTK_PRINT_SETTINGS_RESOLUTION));
685
+ CSTR2RVAL(GTK_PRINT_SETTINGS_RESOLUTION));
686
686
  rb_define_const(gPrintSettings, "USE_COLOR",
687
- rb_str_new2(GTK_PRINT_SETTINGS_USE_COLOR));
687
+ CSTR2RVAL(GTK_PRINT_SETTINGS_USE_COLOR));
688
688
  rb_define_const(gPrintSettings, "DUPLEX",
689
- rb_str_new2(GTK_PRINT_SETTINGS_DUPLEX));
689
+ CSTR2RVAL(GTK_PRINT_SETTINGS_DUPLEX));
690
690
  rb_define_const(gPrintSettings, "COLLATE",
691
- rb_str_new2(GTK_PRINT_SETTINGS_COLLATE));
691
+ CSTR2RVAL(GTK_PRINT_SETTINGS_COLLATE));
692
692
  rb_define_const(gPrintSettings, "REVERSE",
693
- rb_str_new2(GTK_PRINT_SETTINGS_REVERSE));
693
+ CSTR2RVAL(GTK_PRINT_SETTINGS_REVERSE));
694
694
  rb_define_const(gPrintSettings, "MEDIA_TYPE",
695
- rb_str_new2(GTK_PRINT_SETTINGS_MEDIA_TYPE));
695
+ CSTR2RVAL(GTK_PRINT_SETTINGS_MEDIA_TYPE));
696
696
  rb_define_const(gPrintSettings, "DITHER",
697
- rb_str_new2(GTK_PRINT_SETTINGS_DITHER));
697
+ CSTR2RVAL(GTK_PRINT_SETTINGS_DITHER));
698
698
  rb_define_const(gPrintSettings, "SCALE",
699
- rb_str_new2(GTK_PRINT_SETTINGS_SCALE));
699
+ CSTR2RVAL(GTK_PRINT_SETTINGS_SCALE));
700
700
  rb_define_const(gPrintSettings, "PRINT_PAGES",
701
- rb_str_new2(GTK_PRINT_SETTINGS_PRINT_PAGES));
701
+ CSTR2RVAL(GTK_PRINT_SETTINGS_PRINT_PAGES));
702
702
  rb_define_const(gPrintSettings, "PAGE_RANGES",
703
- rb_str_new2(GTK_PRINT_SETTINGS_PAGE_RANGES));
703
+ CSTR2RVAL(GTK_PRINT_SETTINGS_PAGE_RANGES));
704
704
  rb_define_const(gPrintSettings, "PAGE_SET",
705
- rb_str_new2(GTK_PRINT_SETTINGS_PAGE_SET));
705
+ CSTR2RVAL(GTK_PRINT_SETTINGS_PAGE_SET));
706
706
  rb_define_const(gPrintSettings, "FINISHINGS",
707
- rb_str_new2(GTK_PRINT_SETTINGS_FINISHINGS));
707
+ CSTR2RVAL(GTK_PRINT_SETTINGS_FINISHINGS));
708
708
  rb_define_const(gPrintSettings, "NUMBER_UP",
709
- rb_str_new2(GTK_PRINT_SETTINGS_NUMBER_UP));
709
+ CSTR2RVAL(GTK_PRINT_SETTINGS_NUMBER_UP));
710
710
  rb_define_const(gPrintSettings, "OUTPUT_BIN",
711
- rb_str_new2(GTK_PRINT_SETTINGS_OUTPUT_BIN));
711
+ CSTR2RVAL(GTK_PRINT_SETTINGS_OUTPUT_BIN));
712
712
 
713
713
  rb_define_const(gPrintSettings, "OUTPUT_FILE_FORMAT",
714
- rb_str_new2(GTK_PRINT_SETTINGS_OUTPUT_FILE_FORMAT));
714
+ CSTR2RVAL(GTK_PRINT_SETTINGS_OUTPUT_FILE_FORMAT));
715
715
  rb_define_const(gPrintSettings, "OUTPUT_URI",
716
- rb_str_new2(GTK_PRINT_SETTINGS_OUTPUT_URI));
716
+ CSTR2RVAL(GTK_PRINT_SETTINGS_OUTPUT_URI));
717
717
 
718
718
  rb_define_const(gPrintSettings, "WIN32_DRIVER_VERSION",
719
- rb_str_new2(GTK_PRINT_SETTINGS_WIN32_DRIVER_VERSION));
719
+ CSTR2RVAL(GTK_PRINT_SETTINGS_WIN32_DRIVER_VERSION));
720
720
  rb_define_const(gPrintSettings, "WIN32_DRIVER_EXTRA",
721
- rb_str_new2(GTK_PRINT_SETTINGS_WIN32_DRIVER_EXTRA));
721
+ CSTR2RVAL(GTK_PRINT_SETTINGS_WIN32_DRIVER_EXTRA));
722
722
 
723
723
  /* Helpers: */
724
724
  rb_define_method(gPrintSettings, "printer", ps_get_printer, 0);
@@ -156,7 +156,7 @@ static VALUE
156
156
  rc_find_module_in_path(self, module_file)
157
157
  VALUE self, module_file;
158
158
  {
159
- return CSTR2RVAL2(gtk_rc_find_module_in_path(RVAL2CSTR(module_file)));
159
+ return CSTR2RVAL_FREE(gtk_rc_find_module_in_path(RVAL2CSTR(module_file)));
160
160
  }
161
161
 
162
162
  /*
@@ -169,7 +169,7 @@ static VALUE
169
169
  rc_get_module_dir(self)
170
170
  VALUE self;
171
171
  {
172
- return CSTR2RVAL2(gtk_rc_get_module_dir());
172
+ return CSTR2RVAL_FREE(gtk_rc_get_module_dir());
173
173
  }
174
174
 
175
175
  static VALUE
@@ -190,7 +190,7 @@ static VALUE
190
190
  rc_get_theme_dir(self)
191
191
  VALUE self;
192
192
  {
193
- return CSTR2RVAL2(gtk_rc_get_theme_dir());
193
+ return CSTR2RVAL_FREE(gtk_rc_get_theme_dir());
194
194
  }
195
195
 
196
196
  void
@@ -27,14 +27,14 @@ rcd_initialize(argc, argv, self)
27
27
  VALUE manager;
28
28
  rb_scan_args(argc, argv, "03*", &title, &parent, &manager, &button_ary);
29
29
 
30
- dialog = gtk_recent_chooser_dialog_new_for_manager((const gchar*)RVAL2CSTR2(title),
30
+ dialog = gtk_recent_chooser_dialog_new_for_manager((const gchar*)RVAL2CSTR_ACCEPT_NIL(title),
31
31
  GTK_WINDOW(RVAL2GOBJ(parent)),
32
32
  GTK_RECENT_MANAGER(RVAL2GOBJ(manager)),
33
33
  (const gchar*)NULL, NULL);
34
34
  } else {
35
35
  rb_scan_args(argc, argv, "02*", &title, &parent, &button_ary);
36
36
 
37
- dialog = gtk_recent_chooser_dialog_new((const gchar*)RVAL2CSTR2(title),
37
+ dialog = gtk_recent_chooser_dialog_new((const gchar*)RVAL2CSTR_ACCEPT_NIL(title),
38
38
  GTK_WINDOW(RVAL2GOBJ(parent)),
39
39
  (const gchar*)NULL, NULL);
40
40
  }
@@ -105,7 +105,8 @@ static VALUE
105
105
  gtkselectiondata_data(self)
106
106
  VALUE self;
107
107
  {
108
- return rb_str_new((const char*)_SELF(self)->data, _SELF(self)->length);
108
+ return RBG_STRING_SET_UTF8_ENCODING(rb_str_new((const char*)_SELF(self)->data,
109
+ _SELF(self)->length));
109
110
  }
110
111
 
111
112
  #if GTK_CHECK_VERSION(2,2,0)
@@ -489,7 +489,7 @@ deserialize_func(register_buffer, content_buffer, iter, data, length, create_tag
489
489
  argv[0] = GOBJ2RVAL(register_buffer);
490
490
  argv[1] = GOBJ2RVAL(content_buffer);
491
491
  argv[2] = ITR2RVAL(iter);
492
- argv[3] = rb_str_new((char*)data, length);
492
+ argv[3] = RBG_STRING_SET_UTF8_ENCODING(rb_str_new((char*)data, length));
493
493
  argv[4] = CBOOL2RVAL(create_tags);
494
494
 
495
495
  arg.callback = (VALUE)func;
@@ -590,7 +590,7 @@ txt_serialize(self, content_buffer, format, start, end)
590
590
  RVAL2ATOM(format),
591
591
  RVAL2ITR(start), RVAL2ITR(end),
592
592
  &length);
593
- return rb_str_new((char*)ret, length);
593
+ return RBG_STRING_SET_UTF8_ENCODING(rb_str_new((char*)ret, length));
594
594
  }
595
595
 
596
596
  static VALUE
@@ -644,7 +644,7 @@ widget_create_pango_layout(argc, argv, self)
644
644
  {
645
645
  VALUE text;
646
646
  rb_scan_args(argc, argv, "01", &text);
647
- return GOBJ2RVALU(gtk_widget_create_pango_layout(_SELF(self), RVAL2CSTR2(text)));
647
+ return GOBJ2RVALU(gtk_widget_create_pango_layout(_SELF(self), RVAL2CSTR_ACCEPT_NIL(text)));
648
648
  }
649
649
 
650
650
  static VALUE
@@ -657,7 +657,7 @@ widget_render_icon(argc, argv, self)
657
657
  rb_scan_args(argc, argv, "21", &stock_id, &size, &detail);
658
658
  return GOBJ2RVALU(gtk_widget_render_icon(_SELF(self), rb_id2name(SYM2ID(stock_id)),
659
659
  RVAL2GENUM(size, GTK_TYPE_ICON_SIZE),
660
- RVAL2CSTR2(detail)));
660
+ RVAL2CSTR_ACCEPT_NIL(detail)));
661
661
  }
662
662
 
663
663
  static VALUE
@@ -796,8 +796,7 @@ widget_s_find_style_property(self, property_name)
796
796
  if (SYMBOL_P(property_name)) {
797
797
  name = rb_id2name(SYM2ID(property_name));
798
798
  } else {
799
- StringValue(property_name);
800
- name = StringValuePtr(property_name);
799
+ name = RVAL2CSTR(property_name);
801
800
  }
802
801
 
803
802
  oclass = (GtkWidgetClass*)g_type_class_ref(CLASS2GTYPE(self));
@@ -879,8 +878,7 @@ widget_style_get_property(self, prop_name)
879
878
  if (SYMBOL_P(prop_name)) {
880
879
  name = rb_id2name(SYM2ID(prop_name));
881
880
  } else {
882
- StringValue(prop_name);
883
- name = StringValuePtr(prop_name);
881
+ name = RVAL2CSTR(prop_name);
884
882
  }
885
883
  #if GTK_CHECK_VERSION(2,2,0)
886
884
  pspec = gtk_widget_class_find_style_property((GtkWidgetClass*)g_type_class_ref(RVAL2GTYPE(self)), name);
@@ -3,11 +3,11 @@
3
3
  ruby_gnome2_base = File.join(File.dirname(__FILE__), "..", "..")
4
4
  ruby_gnome2_base = File.expand_path(ruby_gnome2_base)
5
5
 
6
- glib_base = File.join(ruby_gnome2_base, "glib")
6
+ glib_base = File.join(ruby_gnome2_base, "glib2")
7
7
  atk_base = File.join(ruby_gnome2_base, "atk")
8
8
  pango_base = File.join(ruby_gnome2_base, "pango")
9
- gdk_pixbuf_base = File.join(ruby_gnome2_base, "gdkpixbuf")
10
- gtk_base = File.join(ruby_gnome2_base, "gtk")
9
+ gdk_pixbuf_base = File.join(ruby_gnome2_base, "gdk_pixbuf2")
10
+ gtk_base = File.join(ruby_gnome2_base, "gtk2")
11
11
 
12
12
  [[glib_base, "glib2"],
13
13
  [atk_base, "atk"],
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gtk2
3
3
  version: !ruby/object:Gem::Version
4
- hash: 371
4
+ hash: 369
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 90
9
- - 2
10
- version: 0.90.2
9
+ - 3
10
+ version: 0.90.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - The Ruby-GNOME2 Proejct Team
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-09-25 00:00:00 +09:00
18
+ date: 2010-10-23 00:00:00 +09:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -40,14 +40,14 @@ dependencies:
40
40
  requirement: &id002 !ruby/object:Gem::Requirement
41
41
  none: false
42
42
  requirements:
43
- - - "="
43
+ - - ">="
44
44
  - !ruby/object:Gem::Version
45
- hash: 371
45
+ hash: 369
46
46
  segments:
47
47
  - 0
48
48
  - 90
49
- - 2
50
- version: 0.90.2
49
+ - 3
50
+ version: 0.90.3
51
51
  type: :runtime
52
52
  version_requirements: *id002
53
53
  - !ruby/object:Gem::Dependency
@@ -56,32 +56,48 @@ dependencies:
56
56
  requirement: &id003 !ruby/object:Gem::Requirement
57
57
  none: false
58
58
  requirements:
59
- - - "="
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
- hash: 371
61
+ hash: 369
62
62
  segments:
63
63
  - 0
64
64
  - 90
65
- - 2
66
- version: 0.90.2
65
+ - 3
66
+ version: 0.90.3
67
67
  type: :runtime
68
68
  version_requirements: *id003
69
69
  - !ruby/object:Gem::Dependency
70
- name: atk
70
+ name: gdk_pixbuf2
71
71
  prerelease: false
72
72
  requirement: &id004 !ruby/object:Gem::Requirement
73
73
  none: false
74
74
  requirements:
75
- - - "="
75
+ - - ">="
76
76
  - !ruby/object:Gem::Version
77
- hash: 371
77
+ hash: 369
78
78
  segments:
79
79
  - 0
80
80
  - 90
81
- - 2
82
- version: 0.90.2
81
+ - 3
82
+ version: 0.90.3
83
83
  type: :runtime
84
84
  version_requirements: *id004
85
+ - !ruby/object:Gem::Dependency
86
+ name: atk
87
+ prerelease: false
88
+ requirement: &id005 !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - "="
92
+ - !ruby/object:Gem::Version
93
+ hash: 369
94
+ segments:
95
+ - 0
96
+ - 90
97
+ - 3
98
+ version: 0.90.3
99
+ type: :runtime
100
+ version_requirements: *id005
85
101
  description: Ruby/GTK2 is a Ruby binding of GTK+-2.x.
86
102
  email: ruby-gnome2-devel-en@lists.sourceforge.net
87
103
  executables: []