gtk2 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (96) hide show
  1. data/ChangeLog +52 -0
  2. data/ext/gtk2/extconf.rb +18 -9
  3. data/ext/gtk2/rbgdk.h +3 -0
  4. data/ext/gtk2/rbgdkdragcontext.c +4 -4
  5. data/ext/gtk2/rbgdkevent.c +18 -5
  6. data/ext/gtk2/rbgdkpixmap.c +43 -48
  7. data/ext/gtk2/rbgdkproperty.c +6 -5
  8. data/ext/gtk2/rbgdkscreen.c +18 -74
  9. data/ext/gtk2/rbgdkselection.c +2 -2
  10. data/ext/gtk2/rbgdkwindow.c +11 -18
  11. data/ext/gtk2/rbgdkwindowattr.c +1 -1
  12. data/ext/gtk2/rbgtkaccelgroup.c +1 -1
  13. data/ext/gtk2/rbgtkaction.c +8 -26
  14. data/ext/gtk2/rbgtkactiongroup.c +6 -6
  15. data/ext/gtk2/rbgtkadjustment.c +20 -74
  16. data/ext/gtk2/rbgtkbindingset.c +1 -1
  17. data/ext/gtk2/rbgtkbuilder.c +2 -1
  18. data/ext/gtk2/rbgtkbutton.c +1 -9
  19. data/ext/gtk2/rbgtkcalendar.c +1 -1
  20. data/ext/gtk2/rbgtkcellrendererspinner.c +0 -3
  21. data/ext/gtk2/rbgtkcellrenderertext.c +1 -2
  22. data/ext/gtk2/rbgtkcellview.c +6 -11
  23. data/ext/gtk2/rbgtkcolorselectiondialog.c +2 -28
  24. data/ext/gtk2/rbgtkcombo.c +2 -2
  25. data/ext/gtk2/rbgtkcombobox.c +9 -29
  26. data/ext/gtk2/rbgtkcontainer.c +1 -1
  27. data/ext/gtk2/rbgtkcurve.c +4 -2
  28. data/ext/gtk2/rbgtkdialog.c +2 -3
  29. data/ext/gtk2/rbgtkdrag.c +3 -3
  30. data/ext/gtk2/rbgtkentry.c +2 -2
  31. data/ext/gtk2/rbgtkentrycompletion.c +1 -4
  32. data/ext/gtk2/rbgtkfilechooser.c +32 -29
  33. data/ext/gtk2/rbgtkfilechooserdialog.c +8 -6
  34. data/ext/gtk2/rbgtkfilefilter.c +8 -4
  35. data/ext/gtk2/rbgtkframe.c +3 -4
  36. data/ext/gtk2/rbgtkhandlebox.c +0 -7
  37. data/ext/gtk2/rbgtkicontheme.c +4 -13
  38. data/ext/gtk2/rbgtkiconview.c +4 -15
  39. data/ext/gtk2/rbgtkimcontext.c +1 -1
  40. data/ext/gtk2/rbgtkinvisible.c +5 -21
  41. data/ext/gtk2/rbgtkitemfactory.c +3 -3
  42. data/ext/gtk2/rbgtklabel.c +0 -2
  43. data/ext/gtk2/rbgtklinkbutton.c +0 -2
  44. data/ext/gtk2/rbgtkmain.c +7 -10
  45. data/ext/gtk2/rbgtkmenu.c +22 -74
  46. data/ext/gtk2/rbgtkmenuitem.c +16 -55
  47. data/ext/gtk2/rbgtkmenushell.c +3 -11
  48. data/ext/gtk2/rbgtkmessagedialog.c +11 -20
  49. data/ext/gtk2/rbgtknotebook.c +0 -1
  50. data/ext/gtk2/rbgtkoptionmenu.c +1 -2
  51. data/ext/gtk2/rbgtkprintjob.c +1 -2
  52. data/ext/gtk2/rbgtkprintoperation.c +0 -2
  53. data/ext/gtk2/rbgtkradioaction.c +2 -7
  54. data/ext/gtk2/rbgtkradiobutton.c +1 -1
  55. data/ext/gtk2/rbgtkradiomenuitem.c +4 -6
  56. data/ext/gtk2/rbgtkradiotoolbutton.c +2 -4
  57. data/ext/gtk2/rbgtkrange.c +1 -2
  58. data/ext/gtk2/rbgtkrc.c +8 -9
  59. data/ext/gtk2/rbgtkrcstyle.c +2 -2
  60. data/ext/gtk2/rbgtkrecentaction.c +0 -1
  61. data/ext/gtk2/rbgtkrecentchooser.c +3 -3
  62. data/ext/gtk2/rbgtkrecentdata.c +2 -9
  63. data/ext/gtk2/rbgtkrecentfilter.c +2 -1
  64. data/ext/gtk2/rbgtkrecentfilterinfo.c +5 -16
  65. data/ext/gtk2/rbgtkrecentinfo.c +2 -2
  66. data/ext/gtk2/rbgtkrecentmanager.c +1 -2
  67. data/ext/gtk2/rbgtkruler.c +6 -16
  68. data/ext/gtk2/rbgtkscalebutton.c +16 -48
  69. data/ext/gtk2/rbgtkscrolledwindow.c +1 -1
  70. data/ext/gtk2/rbgtkselectiondata.c +10 -34
  71. data/ext/gtk2/rbgtksettings.c +1 -1
  72. data/ext/gtk2/rbgtkspinner.c +0 -3
  73. data/ext/gtk2/rbgtkstatusbar.c +5 -16
  74. data/ext/gtk2/rbgtkstatusicon.c +2 -9
  75. data/ext/gtk2/rbgtkstock.c +4 -4
  76. data/ext/gtk2/rbgtktable.c +8 -13
  77. data/ext/gtk2/rbgtktextattributes.c +0 -2
  78. data/ext/gtk2/rbgtktextbuffer.c +17 -16
  79. data/ext/gtk2/rbgtktextmark.c +7 -14
  80. data/ext/gtk2/rbgtktexttag.c +1 -2
  81. data/ext/gtk2/rbgtktextview.c +3 -4
  82. data/ext/gtk2/rbgtktoggleaction.c +5 -16
  83. data/ext/gtk2/rbgtktogglebutton.c +1 -2
  84. data/ext/gtk2/rbgtktoggletoolbutton.c +5 -16
  85. data/ext/gtk2/rbgtktoolbar.c +8 -31
  86. data/ext/gtk2/rbgtktoolitem.c +3 -1
  87. data/ext/gtk2/rbgtktreerowreference.c +4 -4
  88. data/ext/gtk2/rbgtktreesortable.c +0 -3
  89. data/ext/gtk2/rbgtktreestore.c +10 -7
  90. data/ext/gtk2/rbgtktreeview.c +5 -8
  91. data/ext/gtk2/rbgtktreeviewcolumn.c +13 -34
  92. data/ext/gtk2/rbgtkuimanager.c +2 -3
  93. data/ext/gtk2/rbgtkwidget.c +24 -44
  94. data/ext/gtk2/rbgtkwindow.c +32 -92
  95. data/lib/gtk2/base.rb +1 -1
  96. metadata +13 -13
@@ -33,7 +33,7 @@ rbgtk_atom2selectiondata(VALUE type, VALUE size, VALUE src, GdkAtom *gtype,
33
33
  fmt = sizeof(int) * 8;
34
34
  len = 1;
35
35
  } else if(ntype == GDK_SELECTION_TYPE_STRING) {
36
- dat = RVAL2CSTR(src);
36
+ dat = (void *)RVAL2CSTR(src);
37
37
  if (NIL_P(size)) {
38
38
  fmt = sizeof(char) * 8;
39
39
  len = RSTRING_LEN(src);
@@ -45,7 +45,7 @@ rbgtk_atom2selectiondata(VALUE type, VALUE size, VALUE src, GdkAtom *gtype,
45
45
  guchar* str = (guchar*)dat;
46
46
  gdk_string_to_compound_text(RVAL2CSTR(src), &ntype, &fmt, &str, &len);
47
47
  } else if(type != Qnil && size != Qnil && src != Qnil) {
48
- dat = RVAL2CSTR(src);
48
+ dat = (void *)RVAL2CSTR(src);
49
49
  fmt = NUM2INT(size);
50
50
  len = (RSTRING_LEN(src) * sizeof(char) / fmt);
51
51
  } else {
@@ -137,14 +137,10 @@ gtkselectiondata_set(int argc, VALUE *argv, VALUE self)
137
137
  static VALUE
138
138
  gtkselectiondata_set_text(VALUE self, VALUE str)
139
139
  {
140
- gboolean ret;
141
140
  StringValue(str);
142
141
 
143
- ret = gtk_selection_data_set_text(_SELF(self), RVAL2CSTR(str),
144
- RSTRING_LEN(str));
145
-
146
- if (!ret)
147
- rb_raise(rb_eRuntimeError, "the selection wasn't successfully.");
142
+ if (!gtk_selection_data_set_text(_SELF(self), RSTRING_PTR(str), RSTRING_LEN(str)))
143
+ rb_raise(rb_eRuntimeError, "the selection wasn't successfully set");
148
144
 
149
145
  return self;
150
146
  }
@@ -152,23 +148,15 @@ gtkselectiondata_set_text(VALUE self, VALUE str)
152
148
  static VALUE
153
149
  gtkselectiondata_get_text(VALUE self)
154
150
  {
155
- VALUE ret = Qnil;
156
- guchar* text = gtk_selection_data_get_text(_SELF(self));
157
- if (text) {
158
- ret = CSTR2RVAL((const char*)text);
159
- g_free(text);
160
- }
161
- return ret;
151
+ return CSTR2RVAL_FREE((gchar *)gtk_selection_data_get_text(_SELF(self)));
162
152
  }
163
153
 
164
154
  #if GTK_CHECK_VERSION(2,6,0)
165
155
  static VALUE
166
156
  gtkselectiondata_set_pixbuf(VALUE self, VALUE pixbuf)
167
157
  {
168
- gboolean ret = gtk_selection_data_set_pixbuf(_SELF(self),
169
- GDK_PIXBUF(RVAL2GOBJ(pixbuf)));
170
- if (!ret)
171
- rb_raise(rb_eRuntimeError, "the selection wasn't successfully.");
158
+ if (!gtk_selection_data_set_pixbuf(_SELF(self), GDK_PIXBUF(RVAL2GOBJ(pixbuf))))
159
+ rb_raise(rb_eRuntimeError, "the selection wasn't successfully set");
172
160
 
173
161
  return self;
174
162
  }
@@ -183,23 +171,11 @@ static VALUE
183
171
  gtkselectiondata_set_uris(VALUE self, VALUE uris)
184
172
  {
185
173
  gboolean ret;
186
- gchar** guris;
187
- int i, n_targets;
174
+ gchar **guris;
188
175
 
189
- Check_Type(uris, T_ARRAY);
190
- n_targets = RARRAY_LEN(uris);
191
-
192
- guris = g_new(gchar*, n_targets + 1);
193
-
194
- for (i = 0; i < n_targets; i++) {
195
- guris[i] = RVAL2CSTR(RARRAY_PTR(uris)[i]);
196
- }
197
- guris[n_targets] = NULL;
198
-
176
+ guris = (gchar **)RVAL2STRV(uris);
199
177
  ret = gtk_selection_data_set_uris(_SELF(self), guris);
200
-
201
- g_strfreev(guris);
202
-
178
+ g_free(guris);
203
179
  if (!ret)
204
180
  rb_raise(rb_eRuntimeError, "the selection wasn't successfully.");
205
181
 
@@ -163,7 +163,7 @@ settings_set_property_value(VALUE self, VALUE name, VALUE value, VALUE origin)
163
163
  g_value_init(&svalue.value, RVAL2GTYPE(value));
164
164
  rbgobj_rvalue_to_gvalue(value, &svalue.value);
165
165
 
166
- svalue.origin = RVAL2CSTR(origin);
166
+ svalue.origin = (char *)RVAL2CSTR(origin);
167
167
  gtk_settings_set_property_value(GTK_SETTINGS(RVAL2GOBJ(self)),
168
168
  RVAL2CSTR(name), &svalue);
169
169
  g_value_unset(&svalue.value);
@@ -3,9 +3,6 @@
3
3
 
4
4
  rbgtkspinner.c -
5
5
 
6
- $Author: masaakiaoyagi $
7
- $Date: 2011-02-19 09:24:49 +0900 (土, 19 2月 2011) $
8
-
9
6
  Copyright (C) 2011 Ruby-GNOME2 Project Team
10
7
  ************************************************/
11
8
 
@@ -53,18 +53,11 @@ statusbar_remove(VALUE self, VALUE cid, VALUE mid)
53
53
  return self;
54
54
  }
55
55
 
56
- static VALUE
57
- statusbar_set_has_resize_grip(VALUE self, VALUE setting)
58
- {
59
- gtk_statusbar_set_has_resize_grip(_SELF(self), RVAL2CBOOL(setting));
60
- return self;
61
- }
62
-
63
- static VALUE
64
- statusbar_get_has_resize_grip(VALUE self)
65
- {
66
- return CBOOL2RVAL(gtk_statusbar_get_has_resize_grip(_SELF(self)));
67
- }
56
+ /* Defined as Properties:
57
+ void gtk_statusbar_set_has_resize_grip (GtkStatusbar *statusbar,
58
+ gboolean setting);
59
+ gboolean gtk_statusbar_get_has_resize_grip (GtkStatusbar *statusbar);
60
+ */
68
61
 
69
62
  void
70
63
  Init_gtk_statusbar()
@@ -76,8 +69,4 @@ Init_gtk_statusbar()
76
69
  rb_define_method(gStatusBar, "push", statusbar_push, 2);
77
70
  rb_define_method(gStatusBar, "pop", statusbar_pop, 1);
78
71
  rb_define_method(gStatusBar, "remove", statusbar_remove, 2);
79
- rb_define_method(gStatusBar, "set_has_resize_grip", statusbar_set_has_resize_grip, 1);
80
- rb_define_method(gStatusBar, "has_resize_grip?", statusbar_get_has_resize_grip, 0);
81
-
82
- G_DEF_SETTERS(gStatusBar);
83
72
  }
@@ -54,6 +54,7 @@ gboolean gtk_status_icon_get_visible (GtkStatusIcon *status_icon);
54
54
  void gtk_status_icon_set_blinking (GtkStatusIcon *status_icon,
55
55
  gboolean blinking);
56
56
  gboolean gtk_status_icon_get_blinking (GtkStatusIcon *status_icon);
57
+ gboolean gtk_status_icon_is_embedded (GtkStatusIcon *status_icon);
57
58
  */
58
59
 
59
60
  static VALUE
@@ -63,12 +64,6 @@ si_set_tooltip(VALUE self, VALUE tooltip_text)
63
64
  return self;
64
65
  }
65
66
 
66
- static VALUE
67
- si_is_embedded(VALUE self)
68
- {
69
- return CBOOL2RVAL(gtk_status_icon_is_embedded(_SELF(self)));
70
- }
71
-
72
67
  static VALUE
73
68
  si_position_menu(VALUE self, VALUE menu)
74
69
  {
@@ -106,10 +101,8 @@ Init_gtk_status_icon()
106
101
 
107
102
  rb_define_method(si, "initialize", si_initialize, 0);
108
103
  rb_define_method(si, "set_tooltip", si_set_tooltip, 1);
109
- rb_define_method(si, "embedded?", si_is_embedded, 0);
104
+ G_DEF_SETTER(si, "tooltip");
110
105
  rb_define_method(si, "position_menu", si_position_menu, 1);
111
106
  rb_define_method(si, "geometry", si_get_geometry, 0);
112
-
113
- G_DEF_SETTERS(si);
114
107
  #endif
115
108
  }
@@ -30,10 +30,10 @@ stock_m_add(int argc, VALUE *argv, VALUE klass)
30
30
  rb_scan_args(argc, argv, "23", &stock_id, &label, &modifier, &keyval, &translation_domain);
31
31
  Check_Symbol(stock_id);
32
32
  item.stock_id = (gchar *)SYM2CSTR(stock_id);
33
- item.label = RVAL2CSTR(label);
33
+ item.label = (gchar *)RVAL2CSTR(label);
34
34
  item.modifier = NIL_P(modifier) ? 0 : NUM2UINT(modifier);
35
35
  item.keyval = NIL_P(keyval) ? 0 : NUM2UINT(keyval);
36
- item.translation_domain = NIL_P(translation_domain) ? NULL : RVAL2CSTR(translation_domain);
36
+ item.translation_domain = NIL_P(translation_domain) ? NULL : (gchar *)RVAL2CSTR(translation_domain);
37
37
  gtk_stock_add(&item, 1);
38
38
  return Qnil;
39
39
  }
@@ -70,11 +70,11 @@ stock_m_list_ids(VALUE klass)
70
70
  }
71
71
 
72
72
  #if GTK_CHECK_VERSION(2,8,0)
73
- static gchar*
73
+ static gchar *
74
74
  translate_func(const gchar *path, gpointer func)
75
75
  {
76
76
  VALUE ret = rb_funcall((VALUE)func, id_call, 1, CSTR2RVAL(path));
77
- return RVAL2CSTR(ret);
77
+ return (gchar *)RVAL2CSTR(ret);
78
78
  }
79
79
 
80
80
  static VALUE
@@ -143,29 +143,24 @@ Init_gtk_table()
143
143
  {
144
144
  VALUE gTable = G_DEF_CLASS(GTK_TYPE_TABLE, "Table", mGtk);
145
145
 
146
- /* Undef properties, column/row-spacing confuse us ... */
147
- rb_undef_method(gTable, "set_row_spacing");
148
- rb_undef_method(gTable, "set_column_spacing");
149
- rb_undef_method(gTable, "row_spacing=");
150
- rb_undef_method(gTable, "column_spacing=");
151
- rb_undef_method(gTable, "row_spacing");
152
- rb_undef_method(gTable, "column_spacing");
153
-
154
146
  rb_define_method(gTable, "initialize", tbl_initialize, -1);
155
147
  rb_define_method(gTable, "resize", tbl_resize, 2);
156
148
  rb_define_method(gTable, "attach", tbl_attach, -1);
157
149
  rb_define_method(gTable, "attach_defaults", tbl_attach_defaults, 5);
158
- rb_define_method(gTable, "set_row_spacing", tbl_set_row_spacing, 2);
159
- rb_define_method(gTable, "set_column_spacing", tbl_set_col_spacing, 2);
150
+ G_REPLACE_SET_PROPERTY(gTable, "row_spacing", tbl_set_row_spacing, 2);
151
+ rb_undef_method(gTable, "row_spacing=");
152
+ G_REPLACE_SET_PROPERTY(gTable, "column_spacing", tbl_set_col_spacing, 2);
153
+ rb_undef_method(gTable, "column_spacing=");
160
154
  rb_define_method(gTable, "get_row_spacing", tbl_get_row_spacing, 1);
155
+ rb_undef_method(gTable, "row_spacing");
161
156
  rb_define_method(gTable, "get_column_spacing", tbl_get_col_spacing, 1);
157
+ rb_undef_method(gTable, "column_spacing");
162
158
  rb_define_method(gTable, "set_row_spacings", tbl_set_row_spacings, 1);
159
+ G_DEF_SETTER(gTable, "row_spacings");
163
160
  rb_define_method(gTable, "set_column_spacings", tbl_set_col_spacings, 1);
161
+ G_DEF_SETTER(gTable, "column_spacings");
164
162
  rb_define_method(gTable, "row_spacings", tbl_get_row_spacings, 0);
165
163
  rb_define_method(gTable, "column_spacings", tbl_get_col_spacings, 0);
166
164
  rb_define_method(gTable, "default_row_spacing", tbl_get_default_row_spacing, 0);
167
165
  rb_define_method(gTable, "default_column_spacing", tbl_get_default_col_spacing, 0);
168
-
169
- G_DEF_SETTERS(gTable);
170
-
171
166
  }
@@ -182,8 +182,6 @@ Init_txt_attr()
182
182
  rb_define_method(gTextAttributes, "set_invisible", txt_attr_bool_set_invisible, 1);
183
183
  rb_define_method(gTextAttributes, "bg_full_height?", txt_attr_bool_bg_full_height, 0);
184
184
  rb_define_method(gTextAttributes, "set_bg_full_height", txt_attr_bool_set_bg_full_height, 1);
185
- rb_define_method(gTextAttributes, "bg_full_height?", txt_attr_bool_bg_full_height, 0);
186
- rb_define_method(gTextAttributes, "set_bg_full_height", txt_attr_bool_set_bg_full_height, 1);
187
185
  rb_define_method(gTextAttributes, "editable?", txt_attr_bool_editable, 0);
188
186
  rb_define_method(gTextAttributes, "set_editable", txt_attr_bool_set_editable, 1);
189
187
  rb_define_method(gTextAttributes, "realized?", txt_attr_bool_realized, 0);
@@ -49,17 +49,15 @@ txt_get_char_count(VALUE self)
49
49
  return INT2NUM(gtk_text_buffer_get_char_count(_SELF(self)));
50
50
  }
51
51
 
52
- static VALUE
53
- txt_get_tag_table(VALUE self)
54
- {
55
- return GOBJ2RVAL(gtk_text_buffer_get_tag_table(_SELF(self)));
56
- }
52
+ /* Defined as Properties:
53
+ GtkTextTagTable * gtk_text_buffer_get_tag_table (GtkTextBuffer *buffer);
54
+ */
57
55
 
58
56
  static VALUE
59
57
  txt_set_text(VALUE self, VALUE text)
60
58
  {
61
59
  StringValue(text);
62
- gtk_text_buffer_set_text(_SELF(self), RVAL2CSTR(text), RSTRING_LEN(text));
60
+ gtk_text_buffer_set_text(_SELF(self), RSTRING_PTR(text), RSTRING_LEN(text));
63
61
  return self;
64
62
  }
65
63
 
@@ -77,17 +75,18 @@ static VALUE
77
75
  txt_insert_at_cursor(VALUE self, VALUE text)
78
76
  {
79
77
  StringValue(text);
80
- gtk_text_buffer_insert_at_cursor(_SELF(self),
81
- RVAL2CSTR(text), RSTRING_LEN(text));
78
+ gtk_text_buffer_insert_at_cursor(_SELF(self), RSTRING_PTR(text), RSTRING_LEN(text));
82
79
  return self;
83
80
  }
84
81
 
85
82
  static VALUE
86
83
  txt_insert_interactive(VALUE self, VALUE iter, VALUE text, VALUE editable)
87
84
  {
85
+ StringValue(text);
86
+
88
87
  return CBOOL2RVAL(gtk_text_buffer_insert_interactive(_SELF(self),
89
88
  RVAL2ITR(iter),
90
- RVAL2CSTR(text),
89
+ RSTRING_PTR(text),
91
90
  RSTRING_LEN(text),
92
91
  RVAL2CBOOL(editable)));
93
92
  }
@@ -95,8 +94,10 @@ txt_insert_interactive(VALUE self, VALUE iter, VALUE text, VALUE editable)
95
94
  static VALUE
96
95
  txt_insert_interactive_at_cursor(VALUE self, VALUE text, VALUE editable)
97
96
  {
97
+ StringValue(text);
98
+
98
99
  return CBOOL2RVAL(gtk_text_buffer_insert_interactive_at_cursor(_SELF(self),
99
- RVAL2CSTR(text),
100
+ RSTRING_PTR(text),
100
101
  RSTRING_LEN(text),
101
102
  RVAL2CBOOL(editable)));
102
103
  }
@@ -346,6 +347,7 @@ txt_deserialize(VALUE self, VALUE content_buffer, VALUE format, VALUE iter, VALU
346
347
  GError* error = NULL;
347
348
  gboolean ret;
348
349
 
350
+ /* TODO: Why not StringValue(data)? */
349
351
  Check_Type(data, T_STRING);
350
352
  ret = gtk_text_buffer_deserialize(_SELF(self), _SELF(content_buffer),
351
353
  RVAL2ATOM(format),
@@ -493,6 +495,7 @@ serialize_func(GtkTextBuffer *register_buffer, GtkTextBuffer *content_buffer, Gt
493
495
 
494
496
  /* This should return data as String */
495
497
  result = G_PROTECT_CALLBACK(invoke_callback, &arg);
498
+ /* TODO: Why not StringValue(result)? */
496
499
  Check_Type(result, T_STRING);
497
500
  *length = RSTRING_LEN(result);
498
501
  return (guint8*)(NIL_P(rb_errinfo()) ? RSTRING_PTR(result) : NULL);
@@ -676,7 +679,7 @@ txt_insert(int argc, VALUE *argv, VALUE self)
676
679
  start_offset = gtk_text_iter_get_offset(RVAL2ITR(where));
677
680
  StringValue(value);
678
681
  gtk_text_buffer_insert(_SELF(self), RVAL2ITR(where),
679
- RVAL2CSTR(value), RSTRING_LEN(value));
682
+ RSTRING_PTR(value), RSTRING_LEN(value));
680
683
 
681
684
  if (RARRAY_LEN(tags) == 0)
682
685
  return self;
@@ -808,9 +811,8 @@ Init_gtk_textbuffer()
808
811
  rb_define_method(gTextBuffer, "initialize", txt_initialize, -1);
809
812
  rb_define_method(gTextBuffer, "line_count", txt_get_line_count, 0);
810
813
  rb_define_method(gTextBuffer, "char_count", txt_get_char_count, 0);
811
- rb_define_method(gTextBuffer, "tag_table", txt_get_tag_table, 0);
812
814
 
813
- rb_define_method(gTextBuffer, "set_text", txt_set_text, 1);
815
+ G_REPLACE_SET_PROPERTY(gTextBuffer, "text", txt_set_text, 1);
814
816
  rb_define_method(gTextBuffer, "insert", txt_insert, -1);
815
817
  rb_define_method(gTextBuffer, "insert_with_tags", txt_insert_with_tags, -1);
816
818
  #if GTK_CHECK_VERSION(2,6,0)
@@ -826,7 +828,7 @@ Init_gtk_textbuffer()
826
828
  rb_define_method(gTextBuffer, "delete_interactive", txt_delete_interactive, 3);
827
829
 
828
830
  rb_define_method(gTextBuffer, "get_text", txt_get_text, -1);
829
- rb_define_method(gTextBuffer, "text", txt_get_text_all, 0);
831
+ G_REPLACE_GET_PROPERTY(gTextBuffer, "text", txt_get_text_all, 0);
830
832
  rb_define_method(gTextBuffer, "get_slice", txt_get_slice, -1);
831
833
  rb_define_method(gTextBuffer, "slice", txt_get_slice_all, 0);
832
834
 
@@ -852,6 +854,7 @@ Init_gtk_textbuffer()
852
854
  #endif
853
855
  rb_define_method(gTextBuffer, "modified?", txt_get_modified, 0);
854
856
  rb_define_method(gTextBuffer, "set_modified", txt_set_modified, 1);
857
+ G_DEF_SETTER(gTextBuffer, "modified");
855
858
 
856
859
  rb_define_method(gTextBuffer, "add_selection_clipboard", txt_add_selection_clipboard, 1);
857
860
  rb_define_method(gTextBuffer, "remove_selection_clipboard", txt_remove_selection_clipboard, 1);
@@ -894,7 +897,5 @@ Init_gtk_textbuffer()
894
897
  rb_define_method(gTextBuffer, "apply_tag", txt_apply_tag, 3);
895
898
  rb_define_method(gTextBuffer, "remove_tag", txt_remove_tag, 3);
896
899
  rb_define_method(gTextBuffer, "remove_all_tags", txt_remove_all_tags, 2);
897
-
898
- G_DEF_SETTERS(gTextBuffer);
899
900
  }
900
901
 
@@ -38,11 +38,9 @@ get_visible(VALUE self)
38
38
  return CBOOL2RVAL(gtk_text_mark_get_visible(_SELF(self)));
39
39
  }
40
40
 
41
- static VALUE
42
- get_name(VALUE self)
43
- {
44
- return CSTR2RVAL(gtk_text_mark_get_name(_SELF(self)));
45
- }
41
+ /* Defined as Properties:
42
+ const gchar * gtk_text_mark_get_name (GtkTextMark *mark);
43
+ */
46
44
 
47
45
  static VALUE
48
46
  get_deleted(VALUE self)
@@ -56,11 +54,9 @@ get_buffer(VALUE self)
56
54
  return GOBJ2RVAL(gtk_text_mark_get_buffer(_SELF(self)));
57
55
  }
58
56
 
59
- static VALUE
60
- get_left_gravity(VALUE self)
61
- {
62
- return CBOOL2RVAL(gtk_text_mark_get_left_gravity(_SELF(self)));
63
- }
57
+ /* Defined as Properties:
58
+ gboolean gtk_text_mark_get_left_gravity (GtkTextMark *mark);
59
+ */
64
60
 
65
61
  void
66
62
  Init_gtk_textmark()
@@ -70,11 +66,8 @@ Init_gtk_textmark()
70
66
  rb_define_method(gTextMark, "initialize", initialize, 2);
71
67
  #endif
72
68
  rb_define_method(gTextMark, "set_visible", set_visible, 1);
69
+ G_DEF_SETTER(gTextMark, "visible");
73
70
  rb_define_method(gTextMark, "visible?", get_visible, 0);
74
- rb_define_method(gTextMark, "name", get_name, 0);
75
71
  rb_define_method(gTextMark, "deleted?", get_deleted, 0);
76
72
  rb_define_method(gTextMark, "buffer", get_buffer, 0);
77
- rb_define_method(gTextMark, "left_gravity?", get_left_gravity, 0);
78
-
79
- G_DEF_SETTERS(gTextMark);
80
73
  }
@@ -50,10 +50,9 @@ Init_gtk_texttag()
50
50
  rb_define_method(gTextTag, "initialize", initialize, -1);
51
51
  rb_define_method(gTextTag, "priority", get_priority, 0);
52
52
  rb_define_method(gTextTag, "set_priority", set_priority, 1);
53
+ G_DEF_SETTER(gTextTag, "priority");
53
54
  rb_define_method(gTextTag, "event", event, 3);
54
55
 
55
- G_DEF_SETTERS(gTextTag);
56
-
57
56
  /* GtkWrapMode */
58
57
  G_DEF_CLASS(GTK_TYPE_WRAP_MODE, "WrapMode", gTextTag);
59
58
  G_DEF_CONSTANTS(gTextTag, GTK_TYPE_WRAP_MODE, "GTK_");
@@ -277,8 +277,8 @@ Init_gtk_textview()
277
277
  id_buffer = rb_intern("buffer");
278
278
 
279
279
  rb_define_method(cTextView, "initialize", textview_initialize, -1);
280
- rb_define_method(cTextView, "set_buffer", textview_set_buffer, 1);
281
- rb_define_method(cTextView, "buffer", textview_get_buffer, 0);
280
+ G_REPLACE_SET_PROPERTY(cTextView, "buffer", textview_set_buffer, 1);
281
+ G_REPLACE_GET_PROPERTY(cTextView, "buffer", textview_get_buffer, 0);
282
282
  rb_define_method(cTextView, "scroll_to_mark", textview_scroll_to_mark, 5);
283
283
  rb_define_method(cTextView, "scroll_to_iter", textview_scroll_to_iter, 5);
284
284
  rb_define_method(cTextView, "scroll_mark_onscreen", textview_scroll_mark_onscreen, 1);
@@ -297,6 +297,7 @@ Init_gtk_textview()
297
297
  rb_define_method(cTextView, "get_window", textview_get_window, 1);
298
298
  rb_define_method(cTextView, "get_window_type", textview_get_window_type, 1);
299
299
  rb_define_method(cTextView, "set_border_window_size", textview_set_border_window_size, 2);
300
+ G_DEF_SETTER(cTextView, "border_window_size");
300
301
  rb_define_method(cTextView, "get_border_window_size", textview_get_border_window_size, 1);
301
302
  rb_define_method(cTextView, "forward_display_line", textview_forward_display_line, 1);
302
303
  rb_define_method(cTextView, "backward_display_line", textview_backward_display_line, 1);
@@ -309,8 +310,6 @@ Init_gtk_textview()
309
310
  rb_define_method(cTextView, "move_child", textview_move_child, 3);
310
311
  rb_define_method(cTextView, "default_attributes", textview_get_default_attributes, 0);
311
312
 
312
- G_DEF_SETTERS(cTextView);
313
-
314
313
  /* GtkTextWindowType */
315
314
  G_DEF_CLASS(GTK_TYPE_TEXT_WINDOW_TYPE, "WindowType", cTextView);
316
315
  G_DEF_CONSTANTS(cTextView, GTK_TYPE_TEXT_WINDOW_TYPE, "GTK_TEXT_");
@@ -40,18 +40,11 @@ taction_toggled(VALUE self)
40
40
  return self;
41
41
  }
42
42
 
43
- static VALUE
44
- taction_set_active(VALUE self, VALUE is_active)
45
- {
46
- gtk_toggle_action_set_active(_SELF(self), RVAL2CBOOL(is_active));
47
- return self;
48
- }
49
-
50
- static VALUE
51
- taction_get_active(VALUE self)
52
- {
53
- return CBOOL2RVAL(gtk_toggle_action_get_active(_SELF(self)));
54
- }
43
+ /* Defined as Properties:
44
+ void gtk_toggle_action_set_active (GtkToggleAction *action,
45
+ gboolean is_active);
46
+ gboolean gtk_toggle_action_get_active (GtkToggleAction *action);
47
+ */
55
48
  #endif
56
49
 
57
50
  void
@@ -63,10 +56,6 @@ Init_gtk_toggle_action()
63
56
 
64
57
  rb_define_method(gToggleAction, "initialize", taction_initialize, 4);
65
58
  rb_define_method(gToggleAction, "toggled", taction_toggled, 0);
66
- rb_define_method(gToggleAction, "set_active", taction_set_active, 1);
67
- rb_define_method(gToggleAction, "active?", taction_get_active, 0);
68
-
69
- G_DEF_SETTERS(gToggleAction);
70
59
  #endif
71
60
  }
72
61