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
@@ -27,30 +27,6 @@ cdialog_initialize(int argc, VALUE *argv, VALUE self)
27
27
  return Qnil;
28
28
  }
29
29
 
30
- static VALUE
31
- cdialog_get_colorsel(VALUE self)
32
- {
33
- return GOBJ2RVAL(_SELF(self)->colorsel);
34
- }
35
-
36
- static VALUE
37
- cdialog_get_ok_button(VALUE self)
38
- {
39
- return GOBJ2RVAL(_SELF(self)->ok_button);
40
- }
41
-
42
- static VALUE
43
- cdialog_get_cancel_button(VALUE self)
44
- {
45
- return GOBJ2RVAL(_SELF(self)->cancel_button);
46
- }
47
-
48
- static VALUE
49
- cdialog_get_help_button(VALUE self)
50
- {
51
- return GOBJ2RVAL(_SELF(self)->help_button);
52
- }
53
-
54
30
  void
55
31
  Init_gtk_color_selection_dialog()
56
32
  {
@@ -58,8 +34,6 @@ Init_gtk_color_selection_dialog()
58
34
  "ColorSelectionDialog", mGtk);
59
35
 
60
36
  rb_define_method(gColorSelDialog, "initialize", cdialog_initialize, -1);
61
- rb_define_method(gColorSelDialog, "colorsel", cdialog_get_colorsel, 0);
62
- rb_define_method(gColorSelDialog, "ok_button", cdialog_get_ok_button, 0);
63
- rb_define_method(gColorSelDialog, "cancel_button", cdialog_get_cancel_button, 0);
64
- rb_define_method(gColorSelDialog, "help_button", cdialog_get_help_button, 0);
37
+ /* NOTE: Backward compatibility */
38
+ rb_define_alias(gColorSelDialog, "colorsel", "color_selection");
65
39
  }
@@ -24,7 +24,7 @@ combo_set_popdown_strings(VALUE self, VALUE ary)
24
24
 
25
25
  Check_Type(ary, T_ARRAY);
26
26
  for (i=0; i<RARRAY_LEN(ary); i++) {
27
- glist = g_list_append(glist, RVAL2CSTR(RARRAY_PTR(ary)[i]));
27
+ glist = g_list_append(glist, (gpointer)RVAL2CSTR(RARRAY_PTR(ary)[i]));
28
28
  }
29
29
  gtk_combo_set_popdown_strings(GTK_COMBO(RVAL2GOBJ(self)), glist);
30
30
  g_list_free(glist);
@@ -94,7 +94,7 @@ Init_gtk_combo()
94
94
  VALUE gCombo = G_DEF_CLASS(GTK_TYPE_COMBO, "Combo", mGtk);
95
95
 
96
96
  rb_define_method(gCombo, "initialize", combo_initialize, -1);
97
- rb_define_method(gCombo, "set_value_in_list", combo_set_val_in_list, 2);
97
+ G_REPLACE_SET_PROPERTY(gCombo, "value_in_list", combo_set_val_in_list, 2);
98
98
  rb_define_method(gCombo, "set_use_arrows", combo_set_use_arrows, 1);
99
99
  rb_define_method(gCombo, "set_use_arrows_always", combo_set_use_arrows_always, 1);
100
100
  rb_define_method(gCombo, "set_popdown_strings", combo_set_popdown_strings, 1);
@@ -108,20 +108,10 @@ combobox_remove_text(VALUE self, VALUE position)
108
108
  return self;
109
109
  }
110
110
 
111
-
112
- static VALUE
113
- combobox_popup(VALUE self)
114
- {
115
- gtk_combo_box_popup(_SELF(self));
116
- return self;
117
- }
118
-
119
- static VALUE
120
- combobox_popdown(VALUE self)
121
- {
122
- gtk_combo_box_popdown(_SELF(self));
123
- return self;
124
- }
111
+ /* Defined as Signals
112
+ void gtk_combo_box_popup (GtkComboBox *combo_box);
113
+ void gtk_combo_box_popdown (GtkComboBox *combo_box);
114
+ */
125
115
 
126
116
  #if GTK_CHECK_VERSION(2,6,0)
127
117
  /* Defined as Property
@@ -174,16 +164,10 @@ combobox_set_row_separator_func(VALUE self)
174
164
  return self;
175
165
  }
176
166
 
177
- /* This calls g_object_notify(combo, "focus_on_click");
178
- If you want to set "focus_on_click" property only,
179
- call GLib::Object.set_property.
180
- */
181
- static VALUE
182
- combobox_set_focus_on_click(VALUE self, VALUE val)
183
- {
184
- gtk_combo_box_set_focus_on_click(_SELF(self), RVAL2CBOOL(val));
185
- return self;
186
- }
167
+ /* Defined as Properties
168
+ void gtk_combo_box_set_focus_on_click (GtkComboBox *combo,
169
+ gboolean focus_on_click);
170
+ */
187
171
 
188
172
  #endif
189
173
  #endif
@@ -203,20 +187,16 @@ Init_gtk_combobox()
203
187
  rb_define_method(gCombobox, "initialize", combobox_initialize, -1);
204
188
  rb_define_method(gCombobox, "active_iter", combobox_get_active_iter, 0);
205
189
  rb_define_method(gCombobox, "set_active_iter", combobox_set_active_iter, 1);
190
+ G_DEF_SETTER(gCombobox, "active_iter");
206
191
  rb_define_method(gCombobox, "append_text", combobox_append_text, 1);
207
192
  rb_define_method(gCombobox, "insert_text", combobox_insert_text, 2);
208
193
  rb_define_method(gCombobox, "prepend_text", combobox_prepend_text, 1);
209
194
  rb_define_method(gCombobox, "remove_text", combobox_remove_text, 1);
210
- rb_define_method(gCombobox, "popup", combobox_popup, 0);
211
- rb_define_method(gCombobox, "popdown", combobox_popdown, 0);
212
195
 
213
196
  #if GTK_CHECK_VERSION(2,6,0)
214
197
  rb_define_method(gCombobox, "active_text", combobox_get_active_text, 0);
215
198
  rb_define_method(gCombobox, "popup_accessible", combobox_get_popup_accessible, 0);
216
199
  rb_define_method(gCombobox, "set_row_separator_func", combobox_set_row_separator_func, 0);
217
- rb_define_method(gCombobox, "set_focus_on_click", combobox_set_focus_on_click, 1);
218
200
  #endif
219
-
220
- G_DEF_SETTERS(gCombobox);
221
201
  #endif
222
202
  }
@@ -422,7 +422,7 @@ cont_s_child_properties(int argc, VALUE *argv, VALUE self)
422
422
  GParamSpec** props;
423
423
  VALUE inherited_too;
424
424
  VALUE ary;
425
- int i;
425
+ guint i;
426
426
 
427
427
  if (rb_scan_args(argc, argv, "01", &inherited_too) == 0)
428
428
  inherited_too = Qtrue;
@@ -84,16 +84,18 @@ Init_gtk_curve()
84
84
  rb_define_method(gCurve, "initialize", curve_initialize, 0);
85
85
  rb_define_method(gCurve, "reset", curve_reset, 0);
86
86
  rb_define_method(gCurve, "set_gamma", curve_set_gamma, 1);
87
+ G_DEF_SETTER(gCurve, "gamma");
87
88
  rb_define_method(gCurve, "set_range", curve_set_range, 4);
88
89
  rb_define_method(gCurve, "set_vector", curve_set_vector, 2);
90
+ G_DEF_SETTER(gCurve, "vector");
91
+ /* NOTE: For backwards compatability. */
89
92
  rb_define_method(gCurve, "get_vector", curve_get_vector, 1);
93
+ rb_define_method(gCurve, "vector", curve_get_vector, 1);
90
94
 
91
95
  /* GtkCurveType(from standard constants) */
92
96
 
93
97
  G_DEF_CLASS(GTK_TYPE_CURVE_TYPE, "Type", gCurve);
94
98
  G_DEF_CONSTANTS(gCurve, GTK_TYPE_CURVE_TYPE, "GTK_CURVE_");
95
-
96
- G_DEF_SETTERS(gCurve);
97
99
  }
98
100
 
99
101
 
@@ -198,6 +198,7 @@ Init_gtk_dialog()
198
198
  rb_define_method(gDialog, "add_buttons", dialog_add_buttons, -1);
199
199
  rb_define_method(gDialog, "add_action_widget", dialog_add_action_widget, 2);
200
200
  rb_define_method(gDialog, "set_default_response", dialog_set_default_response, 1);
201
+ G_DEF_SETTER(gDialog, "default_response");
201
202
 
202
203
  #if GTK_CHECK_VERSION(2,6,0)
203
204
  rb_define_singleton_method(gDialog, "alternative_dialog_button_order?",
@@ -213,9 +214,7 @@ Init_gtk_dialog()
213
214
  rb_define_method(gDialog, "get_response", dialog_get_response_for_widget, 1);
214
215
  rb_define_method(gDialog, "get_response_for_widget", dialog_get_response_for_widget, 1);
215
216
  #endif
216
-
217
- G_DEF_SETTERS(gDialog);
218
-
217
+
219
218
  /* GtkDialogFlags */
220
219
  G_DEF_CLASS(GTK_TYPE_DIALOG_FLAGS, "Flags", gDialog);
221
220
  G_DEF_CONSTANTS(gDialog, GTK_TYPE_DIALOG_FLAGS, "GTK_DIALOG_");
@@ -36,9 +36,9 @@ rbgtk_get_target_entry(VALUE targets)
36
36
  e_flags = rb_ary_entry(ary, 1);
37
37
  e_info = rb_ary_entry(ary, 2);
38
38
 
39
- entries[i].target = NIL_P(e_target) ? NULL:RVAL2CSTR(e_target);
40
- entries[i].flags = NIL_P(e_flags) ? 0:RVAL2GFLAGS(e_flags, GTK_TYPE_TARGET_FLAGS);
41
- entries[i].info = NIL_P(e_info) ? 0:NUM2INT(e_info);
39
+ entries[i].target = NIL_P(e_target) ? NULL : (char *)RVAL2CSTR(e_target);
40
+ entries[i].flags = NIL_P(e_flags) ? 0 : RVAL2GFLAGS(e_flags, GTK_TYPE_TARGET_FLAGS);
41
+ entries[i].info = NIL_P(e_info) ? 0 : NUM2INT(e_info);
42
42
 
43
43
  }
44
44
  return entries;
@@ -138,6 +138,7 @@ Init_gtk_entry()
138
138
  rb_define_method(gEntry, "layout_offsets", entry_get_layout_offsets, 0);
139
139
  #if GTK_CHECK_VERSION(2,4,0)
140
140
  rb_define_method(gEntry, "set_completion", entry_set_completion, 1);
141
+ G_DEF_SETTER(gEntry, "completion");
141
142
  rb_define_method(gEntry, "completion", entry_get_completion, 0);
142
143
  #endif
143
144
  rb_define_method(gEntry, "layout_index_to_text_index", entry_layout_index_to_text_index, 1);
@@ -148,7 +149,6 @@ Init_gtk_entry()
148
149
  entry_get_cursor_hadjustment, 0);
149
150
  rb_define_method(gEntry, "set_cursor_hadjustment",
150
151
  entry_set_cursor_hadjustment, 1);
152
+ G_DEF_SETTER(gEntry, "cursor_hadjustment");
151
153
  #endif
152
-
153
- G_DEF_SETTERS(gEntry);
154
154
  }
@@ -142,13 +142,10 @@ Init_gtk_entry_completion()
142
142
  rb_define_method(gEntryC, "insert_action_markup", entryc_insert_action_markup, 2);
143
143
  rb_define_method(gEntryC, "delete_action", entryc_delete_action, 1);
144
144
 
145
- rb_undef_method(gEntryC, "text_column=");
146
- rb_define_method(gEntryC, "set_text_column", entryc_set_text_column, 1);
145
+ G_REPLACE_SET_PROPERTY(gEntryC, "text_column", entryc_set_text_column, 1);
147
146
 
148
147
  #if GTK_CHECK_VERSION(2, 12, 0)
149
148
  rb_define_method(gEntryC, "completion_prefix", entryc_get_completion_prefix, 0);
150
149
  #endif
151
-
152
- G_DEF_SETTERS(gEntryC);
153
150
  #endif
154
151
  }
@@ -34,22 +34,9 @@ gslist2ary_free(GSList* list)
34
34
  return ary;
35
35
  }
36
36
 
37
- static VALUE
38
- fcho_set_action(VALUE self, VALUE action)
39
- {
40
- gtk_file_chooser_set_action(
41
- _SELF(self),
42
- RVAL2GENUM(action, GTK_TYPE_FILE_CHOOSER_ACTION));
43
- return self;
44
- }
45
-
46
- static VALUE
47
- fcho_get_action(VALUE self)
48
- {
49
- return GENUM2RVAL(gtk_file_chooser_get_action(_SELF(self)), GTK_TYPE_FILE_CHOOSER_ACTION);
50
- }
51
-
52
37
  /* They are defined as properties
38
+ gtk_file_chooser_set_action(_SELF(self), RVAL2GENUM(action, GTK_TYPE_FILE_CHOOSER_ACTION));
39
+ gtk_file_chooser_get_action(_SELF(self));
53
40
  gtk_file_chooser_set_local_only(_SELF(self), RVAL2CBOOL(local));
54
41
  gtk_file_chooser_get_local_only(_SELF(self));
55
42
  gtk_file_chooser_set_select_multiple(_SELF(self), RVAL2CBOOL(multiple));
@@ -79,23 +66,34 @@ fcho_get_filename(VALUE self)
79
66
  }
80
67
 
81
68
  static VALUE
82
- fcho_set_filename(VALUE self, VALUE name)
69
+ fcho_set_filename(VALUE self, VALUE rbfilename)
83
70
  {
84
- gboolean ret = gtk_file_chooser_set_filename(_SELF(self), RVAL2CSTRFILENAME(name));
85
- if (! ret) rb_raise(rb_eRuntimeError, "Can't set filename");
71
+ gchar *filename = RVAL2CSTRFILENAME(rbfilename);
72
+ gboolean ret = gtk_file_chooser_set_filename(_SELF(self), filename);
73
+ g_free(filename);
74
+ if (!ret)
75
+ rb_raise(rb_eRuntimeError, "Can't set filename");
76
+
86
77
  return self;
87
78
  }
88
79
 
89
80
  static VALUE
90
- fcho_select_filename(VALUE self, VALUE filename)
81
+ fcho_select_filename(VALUE self, VALUE rbfilename)
91
82
  {
92
- return CBOOL2RVAL(gtk_file_chooser_select_filename(_SELF(self), RVAL2CSTRFILENAME(filename)));
83
+ gchar *filename = RVAL2CSTRFILENAME(rbfilename);
84
+ gboolean ret = gtk_file_chooser_select_filename(_SELF(self), filename);
85
+ g_free(filename);
86
+
87
+ return CBOOL2RVAL(ret);
93
88
  }
94
89
 
95
90
  static VALUE
96
- fcho_unselect_filename(VALUE self, VALUE filename)
91
+ fcho_unselect_filename(VALUE self, VALUE rbfilename)
97
92
  {
98
- gtk_file_chooser_unselect_filename(_SELF(self), RVAL2CSTRFILENAME(filename));
93
+ gchar *filename = RVAL2CSTRFILENAME(rbfilename);
94
+ gtk_file_chooser_unselect_filename(_SELF(self), filename);
95
+ g_free(filename);
96
+
99
97
  return self;
100
98
  }
101
99
 
@@ -233,20 +231,28 @@ fcho_list_filters(VALUE self)
233
231
  */
234
232
 
235
233
  static VALUE
236
- fcho_add_shortcut_folder(VALUE self, VALUE folder)
234
+ fcho_add_shortcut_folder(VALUE self, VALUE rbfolder)
237
235
  {
236
+ gchar *folder = RVAL2CSTRFILENAME(rbfolder);
238
237
  GError *error = NULL;
239
- if (! gtk_file_chooser_add_shortcut_folder(_SELF(self), RVAL2CSTRFILENAME(folder), &error))
238
+ gboolean ret = gtk_file_chooser_add_shortcut_folder(_SELF(self), folder, &error);
239
+ g_free(folder);
240
+ if (!ret)
240
241
  RAISE_GERROR(error);
242
+
241
243
  return self;
242
244
  }
243
245
 
244
246
  static VALUE
245
- fcho_remove_shortcut_folder(VALUE self, VALUE folder)
247
+ fcho_remove_shortcut_folder(VALUE self, VALUE rbfolder)
246
248
  {
249
+ gchar *folder = RVAL2CSTRFILENAME(rbfolder);
247
250
  GError *error = NULL;
248
- if (! gtk_file_chooser_remove_shortcut_folder(_SELF(self), RVAL2CSTRFILENAME(folder), &error))
251
+ gboolean ret = gtk_file_chooser_remove_shortcut_folder(_SELF(self), folder, &error);
252
+ g_free(folder);
253
+ if (!ret)
249
254
  RAISE_GERROR(error);
255
+
250
256
  return self;
251
257
  }
252
258
 
@@ -301,8 +307,6 @@ Init_gtk_file_chooser()
301
307
  VALUE eFileSystemError;
302
308
  #endif
303
309
 
304
- rb_define_method(gFileCho, "set_action", fcho_set_action, 1);
305
- rb_define_method(gFileCho, "action", fcho_get_action, 0);
306
310
  rb_define_method(gFileCho, "set_current_name", fcho_set_current_name, 1);
307
311
  rb_define_method(gFileCho, "set_filename", fcho_set_filename, 1);
308
312
  rb_define_method(gFileCho, "filename", fcho_get_filename, 0);
@@ -371,4 +375,3 @@ Init_gtk_file_chooser()
371
375
 
372
376
  #endif
373
377
  }
374
-
@@ -20,20 +20,22 @@ fchodiag_initialize(int argc, VALUE *argv, VALUE self)
20
20
  {
21
21
  VALUE title, parent, action, back, button_ary;
22
22
  GtkWidget* dialog;
23
- gchar* gtitle;
23
+ const gchar *gtitle;
24
24
  GtkWindow *gparent;
25
25
  GtkFileChooserAction gaction;
26
- gchar* gback;
26
+ const gchar *gback;
27
27
 
28
28
  rb_scan_args(argc, argv, "04*", &title, &parent, &action, &back, &button_ary);
29
29
  gtitle = NIL_P(title) ? NULL : RVAL2CSTR(title);
30
30
  gparent = NIL_P(parent) ? NULL : GTK_WINDOW(RVAL2GOBJ(parent));
31
31
  gaction = NIL_P(action) ? GTK_FILE_CHOOSER_ACTION_OPEN : RVAL2GENUM(action, GTK_TYPE_FILE_CHOOSER_ACTION);
32
32
  gback = NIL_P(back) ? NULL : RVAL2CSTR(back);
33
- dialog = gtk_file_chooser_dialog_new_with_backend((const gchar*)gtitle,
34
- gparent, gaction,
35
- (const gchar*)gback,
36
- (const gchar*)NULL, NULL);
33
+ dialog = gtk_file_chooser_dialog_new_with_backend(gtitle,
34
+ gparent,
35
+ gaction,
36
+ gback,
37
+ NULL,
38
+ NULL);
37
39
  RBGTK_INITIALIZE(self, dialog);
38
40
  rbgtk_dialog_add_buttons_internal(self, button_ary);
39
41
  return Qnil;
@@ -54,10 +54,14 @@ ffil_add_pattern(VALUE self, VALUE pattern)
54
54
  static gboolean
55
55
  filter_func(const GtkFileFilterInfo *info, gpointer func)
56
56
  {
57
- return CBOOL2RVAL(rb_funcall((VALUE)func, 5,
58
- GFLAGS2RVAL(info->contains, GTK_TYPE_FILE_FILTER_FLAGS),
59
- CSTR2RVAL(info->filename), CSTR2RVAL(info->uri),
60
- CSTR2RVAL(info->display_name), CSTR2RVAL(info->mime_type)));
57
+ return CBOOL2RVAL(rb_funcall((VALUE)func,
58
+ id_call,
59
+ 5,
60
+ GFLAGS2RVAL(info->contains, GTK_TYPE_FILE_FILTER_FLAGS),
61
+ CSTR2RVAL(info->filename),
62
+ CSTR2RVAL(info->uri),
63
+ CSTR2RVAL(info->display_name),
64
+ CSTR2RVAL(info->mime_type)));
61
65
  }
62
66
 
63
67
  #if GTK_CHECK_VERSION(2,6,0)
@@ -51,9 +51,8 @@ Init_gtk_frame()
51
51
  rb_define_method(gFrame, "initialize", frame_initialize, -1);
52
52
  rb_define_method(gFrame, "set_label_align", frame_set_label_align, 2);
53
53
  rb_define_method(gFrame, "label_align", frame_get_label_align, 0);
54
-
55
- rb_undef_method(gFrame, "shadow");
56
- rb_undef_method(gFrame, "shadow=");
57
- rb_undef_method(gFrame, "set_shadow");
54
+ rb_undef_method(gFrame, "shadow");
55
+ rb_undef_method(gFrame, "shadow=");
56
+ rb_undef_method(gFrame, "set_shadow");
58
57
  }
59
58
 
@@ -21,19 +21,12 @@ hb_initialize(VALUE self)
21
21
  return Qnil;
22
22
  }
23
23
 
24
- static VALUE
25
- hb_child_detached(VALUE self)
26
- {
27
- return CBOOL2RVAL(GTK_HANDLE_BOX(RVAL2GOBJ(self))->child_detached);
28
- }
29
-
30
24
  void
31
25
  Init_gtk_handle_box()
32
26
  {
33
27
  VALUE gHandleBox = G_DEF_CLASS(GTK_TYPE_HANDLE_BOX, "HandleBox", mGtk);
34
28
 
35
29
  rb_define_method(gHandleBox, "initialize", hb_initialize, 0);
36
- rb_define_method(gHandleBox, "child_detached?", hb_child_detached, 0);
37
30
  rb_undef_method(gHandleBox, "shadow");
38
31
  rb_undef_method(gHandleBox, "shadow=");
39
32
  rb_undef_method(gHandleBox, "set_shadow");
@@ -192,28 +192,19 @@ it_choose_icon(int argc, VALUE *argv, VALUE self)
192
192
  {
193
193
  VALUE rb_icon_names, rb_size, rb_flags;
194
194
  gint size;
195
- gchar **icon_names;
195
+ const gchar **icon_names;
196
196
  GtkIconLookupFlags flags;
197
197
  GtkIconInfo *info;
198
198
 
199
199
  rb_scan_args(argc, argv, "21", &rb_icon_names, &rb_size, &rb_flags);
200
200
 
201
201
  if (RVAL2CBOOL(rb_obj_is_kind_of(rb_icon_names, rb_cString))) {
202
- icon_names = ALLOCA_N(gchar *, 2);
202
+ icon_names = ALLOCA_N(const gchar *, 2);
203
203
  icon_names[0] = RVAL2CSTR(rb_icon_names);
204
204
  icon_names[1] = NULL;
205
205
  }
206
206
  else if (RVAL2CBOOL(rb_obj_is_kind_of(rb_icon_names, rb_cArray))) {
207
- VALUE *elements;
208
- long i, len;
209
-
210
- len = RARRAY_LEN(rb_icon_names);
211
- icon_names = ALLOCA_N(gchar *, len + 1);
212
- elements = RARRAY_PTR(rb_icon_names);
213
- for (i = 0; i < len; i++) {
214
- icon_names[i] = RVAL2CSTR(elements[i]);
215
- }
216
- icon_names[i] = NULL;
207
+ icon_names = RVAL2STRV(rb_icon_names);
217
208
  }
218
209
  else {
219
210
  rb_raise(rb_eArgError,
@@ -233,7 +224,7 @@ it_choose_icon(int argc, VALUE *argv, VALUE self)
233
224
  }
234
225
 
235
226
  info = gtk_icon_theme_choose_icon(_SELF(self),
236
- (const gchar **)icon_names,
227
+ icon_names,
237
228
  size, flags);
238
229
  return ICON_INFO2RVAL(info);
239
230
  }