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
@@ -453,6 +453,5 @@ Init_gtk_notebook()
453
453
  rb_define_const(gNotebook, "TAB_FIRST", GTK_NOTEBOOK_TAB_FIRST);
454
454
  rb_define_const(gNotebook, "TAB_LAST", GTK_NOTEBOOK_TAB_LAST);
455
455
 
456
- G_DEF_SETTERS(gNotebook);
457
456
  G_DEF_SIGNAL_FUNC(gNotebook, "switch_page", (GValToRValSignalFunc)signal_g2r_func);
458
457
  }
@@ -54,8 +54,7 @@ Init_gtk_option_menu()
54
54
  rb_define_method(gOptionMenu, "initialize", omenu_initialize, 0);
55
55
  rb_define_method(gOptionMenu, "remove_menu", omenu_remove_menu, 0);
56
56
  rb_define_method(gOptionMenu, "set_history", omenu_set_history, 1);
57
+ G_DEF_SETTER(gOptionMenu, "history");
57
58
  rb_define_method(gOptionMenu, "history", omenu_get_history, 0);
58
-
59
- G_DEF_SETTERS(gOptionMenu);
60
59
  #endif
61
60
  }
@@ -141,11 +141,10 @@ Init_gtk_print_job()
141
141
  rb_define_method(gPrintJob, "initialize", pj_initialize, 4);
142
142
  rb_define_method(gPrintJob, "status", pj_get_status, 0);
143
143
  rb_define_method(gPrintJob, "set_source_file", pj_set_source_file, 1);
144
+ G_DEF_SETTER(gPrintJob, "source_file");
144
145
  #ifdef HAVE_RB_CAIRO_H
145
146
  rb_define_method(gPrintJob, "surface", pj_get_surface, 0);
146
147
  #endif
147
148
  rb_define_method(gPrintJob, "send", pj_send, 0);
148
-
149
- G_DEF_SETTERS(gPrintJob);
150
149
  #endif
151
150
  }
@@ -146,7 +146,5 @@ Init_gtk_print_operation()
146
146
  /* GtkPrintOperationResult */
147
147
  G_DEF_CLASS(GTK_TYPE_PRINT_OPERATION_RESULT, "Result", gPrintOperation);
148
148
  G_DEF_CONSTANTS(gPrintOperation, GTK_TYPE_PRINT_OPERATION_RESULT, "GTK_PRINT_OPERATION_");
149
-
150
- G_DEF_SETTERS(gPrintOperation);
151
149
  #endif
152
150
  }
@@ -79,7 +79,6 @@ void
79
79
  Init_gtk_radio_action()
80
80
  {
81
81
  #if GTK_CHECK_VERSION(2,4,0)
82
-
83
82
  VALUE gRadioAction = G_DEF_CLASS(GTK_TYPE_RADIO_ACTION, "RadioAction", mGtk);
84
83
 
85
84
  rb_define_method(gRadioAction, "initialize", raction_initialize, 5);
@@ -87,12 +86,8 @@ Init_gtk_radio_action()
87
86
  /* Define as Property since 2.10 */
88
87
  rb_define_method(gRadioAction, "current_value", raction_get_current_value, 0);
89
88
  #endif
90
- rb_undef_method(gRadioAction, "group");
91
- rb_undef_method(gRadioAction, "set_group");
92
- rb_define_method(gRadioAction, "group", raction_get_group, 0);
93
- rb_define_method(gRadioAction, "set_group", raction_set_group, 1);
94
-
95
- G_DEF_SETTERS(gRadioAction);
89
+ G_REPLACE_GET_PROPERTY(gRadioAction, "group", raction_get_group, 0);
90
+ G_REPLACE_SET_PROPERTY(gRadioAction, "group", raction_get_group, 1);
96
91
  #endif
97
92
  }
98
93
 
@@ -64,7 +64,7 @@ rbtn_initialize(int argc, VALUE *argv, VALUE self)
64
64
  static VALUE
65
65
  rbtn_group(VALUE self)
66
66
  {
67
- /* Owened by GTK+ */
67
+ /* Owned by GTK+ */
68
68
  return GSLIST2ARY(gtk_radio_button_get_group(GTK_RADIO_BUTTON(RVAL2GOBJ(self))));
69
69
  }
70
70
 
@@ -36,8 +36,8 @@ rmitem_initialize(int argc, VALUE *argv, VALUE self)
36
36
  VALUE arg1, arg2, arg3;
37
37
  GtkWidget *widget;
38
38
  GSList *list = NULL;
39
- char *label = NULL;
40
- char *mnemonic = NULL;
39
+ const gchar *label = NULL;
40
+ const gchar *mnemonic = NULL;
41
41
 
42
42
  if (rb_scan_args(argc, argv, "03", &arg1, &arg2, &arg3) > 0 &&
43
43
  TYPE(arg1) == T_STRING) {
@@ -102,8 +102,6 @@ Init_gtk_radio_menu_item()
102
102
  VALUE gRMenuItem = G_DEF_CLASS(GTK_TYPE_RADIO_MENU_ITEM, "RadioMenuItem", mGtk);
103
103
 
104
104
  rb_define_method(gRMenuItem, "initialize", rmitem_initialize, -1);
105
- rb_define_method(gRMenuItem, "group", rmitem_get_group, 0);
106
- rb_define_method(gRMenuItem, "set_group", rmitem_set_group, 1);
107
-
108
- G_DEF_SETTERS(gRMenuItem);
105
+ G_REPLACE_GET_PROPERTY(gRMenuItem, "group", rmitem_get_group, 0);
106
+ G_REPLACE_SET_PROPERTY(gRMenuItem, "group", rmitem_set_group, 1);
109
107
  }
@@ -86,9 +86,7 @@ Init_gtk_radiotoolbutton()
86
86
  gRToolButton = G_DEF_CLASS(GTK_TYPE_RADIO_TOOL_BUTTON, "RadioToolButton", mGtk);
87
87
 
88
88
  rb_define_method(gRToolButton, "initialize", rbtn_initialize, -1);
89
- rb_define_method(gRToolButton, "group", rbtn_get_group, 0);
90
- rb_define_method(gRToolButton, "set_group", rbtn_set_group, 1);
91
-
92
- G_DEF_SETTERS(gRToolButton);
89
+ G_REPLACE_GET_PROPERTY(gRToolButton, "group", rbtn_get_group, 0);
90
+ G_REPLACE_SET_PROPERTY(gRToolButton, "group", rbtn_set_group, 1);
93
91
  #endif
94
92
  }
@@ -83,8 +83,7 @@ Init_gtk_range()
83
83
  rb_define_method(gRange, "set_increments", range_set_increments, 2);
84
84
  rb_define_method(gRange, "set_range", range_set_range, 2);
85
85
  rb_define_method(gRange, "set_value", range_set_value, 1);
86
-
87
- G_DEF_SETTERS(gRange);
86
+ G_DEF_SETTER(gRange, "value");
88
87
 
89
88
  #if GTK_CHECK_VERSION(2,10,0)
90
89
  /* GtkSensitivityType */
@@ -116,16 +116,15 @@ rc_get_default_files(VALUE self)
116
116
  }
117
117
 
118
118
  static VALUE
119
- rc_set_default_files(VALUE self, VALUE filenames)
119
+ rc_set_default_files(VALUE self, VALUE rbfilenames)
120
120
  {
121
- int i;
122
- gchar** gfiles = g_new(gchar*, RARRAY_LEN(filenames) + 1);
123
- for (i = 0; i < RARRAY_LEN(filenames); i++) {
124
- gfiles[i] = RVAL2CSTR(RARRAY_PTR(filenames)[i]);
125
- }
126
- gfiles[RARRAY_LEN(filenames)] = NULL;
127
- gtk_rc_set_default_files(gfiles);
128
- return filenames;
121
+ gchar **filenames = (gchar **)RVAL2STRV(rbfilenames);
122
+
123
+ gtk_rc_set_default_files(filenames);
124
+
125
+ g_free(filenames);
126
+
127
+ return rbfilenames;
129
128
  }
130
129
  /*
131
130
  guint gtk_rc_parse_color (GScanner *scanner,
@@ -29,7 +29,7 @@ rcstyle_name(VALUE self)
29
29
  static VALUE
30
30
  rcstyle_set_name(VALUE self, VALUE name)
31
31
  {
32
- _SELF(self)->name = RVAL2CSTR(name);
32
+ _SELF(self)->name = g_strdup(RVAL2CSTR(name));
33
33
  return self;
34
34
  }
35
35
 
@@ -50,7 +50,7 @@ rcstyle_set_bg_pixmap_name(VALUE self, VALUE idx, VALUE bg_pixmap_name)
50
50
 
51
51
  if (i < 0 || 5 < i)
52
52
  rb_raise(rb_eArgError, "state out of range");
53
- _SELF(self)->bg_pixmap_name[i] = RVAL2CSTR(bg_pixmap_name);
53
+ _SELF(self)->bg_pixmap_name[i] = g_strdup(RVAL2CSTR(bg_pixmap_name));
54
54
  return self;
55
55
  }
56
56
 
@@ -44,6 +44,5 @@ Init_gtk_recentaction()
44
44
  #if GTK_CHECK_VERSION(2,12,0)
45
45
  VALUE gRecentaction = G_DEF_CLASS(GTK_TYPE_RECENT_ACTION, "RecentAction", mGtk);
46
46
  rb_define_method(gRecentaction, "initialize", recentaction_initialize, -1);
47
- G_DEF_SETTERS(gRecentaction);
48
47
  #endif
49
48
  }
@@ -186,7 +186,7 @@ rc_get_items(VALUE self)
186
186
  static VALUE
187
187
  rc_get_uris(VALUE self)
188
188
  {
189
- int i;
189
+ gsize i;
190
190
  gsize size;
191
191
  gchar** uris = gtk_recent_chooser_get_uris(_SELF(self), &size);
192
192
  VALUE ary = rb_ary_new();
@@ -227,9 +227,11 @@ Init_gtk_recent_chooser()
227
227
  VALUE gRecentChooser = G_DEF_CLASS(GTK_TYPE_RECENT_CHOOSER, "RecentChooser", mGtk);
228
228
 
229
229
  rb_define_method(gRecentChooser, "set_show_numbers", rc_set_show_numbers, 1);
230
+ G_DEF_SETTER(gRecentChooser, "show_numbers");
230
231
  rb_define_method(gRecentChooser, "show_numbers", rc_get_show_numbers, 0);
231
232
  rb_define_method(gRecentChooser, "set_sort_func", rc_set_sort_func, 0);
232
233
  rb_define_method(gRecentChooser, "set_current_uri", rc_set_current_uri, 1);
234
+ G_DEF_SETTER(gRecentChooser, "current_uri");
233
235
  rb_define_method(gRecentChooser, "current_uri", rc_get_current_uri, 0);
234
236
  rb_define_method(gRecentChooser, "current_item", rc_get_current_item, 0);
235
237
  rb_define_method(gRecentChooser, "select_uri", rc_select_uri, 1);
@@ -242,8 +244,6 @@ Init_gtk_recent_chooser()
242
244
  rb_define_method(gRecentChooser, "remove_filter", rc_remove_filter, 1);
243
245
  rb_define_method(gRecentChooser, "filters", rc_list_filters, 0);
244
246
 
245
- G_DEF_SETTERS(gRecentChooser);
246
-
247
247
  /* GtkRecentChooserError */
248
248
  G_DEF_ERROR(GTK_RECENT_CHOOSER_ERROR, "RecentChooserError", mGtk, rb_eRuntimeError,
249
249
  GTK_TYPE_RECENT_CHOOSER_ERROR);
@@ -64,7 +64,7 @@ rd_get_ ## name (VALUE self)\
64
64
  static VALUE \
65
65
  rd_set_ ## name (VALUE self, VALUE val)\
66
66
  {\
67
- _SELF(self)->name = RVAL2CSTR(val);\
67
+ _SELF(self)->name = (gchar *)RVAL2CSTR(val);\
68
68
  return self;\
69
69
  }
70
70
 
@@ -91,14 +91,7 @@ rd_get_groups(VALUE self)
91
91
  static VALUE
92
92
  rd_set_groups(VALUE self, VALUE groups)
93
93
  {
94
- gint i;
95
- gint len = RARRAY_LEN(groups);
96
- gchar** grps = g_new(gchar*, len + 1);
97
- for (i = 0; i < len; i++) {
98
- grps[i] = RVAL2CSTR(RARRAY_PTR(groups)[i]);
99
- }
100
- grps[len] = NULL;
101
- _SELF(self)->groups = grps;
94
+ _SELF(self)->groups = RVAL2STRV_DUP(groups);
102
95
 
103
96
  return self;
104
97
  }
@@ -94,12 +94,13 @@ invoke_callback(VALUE arg_)
94
94
  static gboolean
95
95
  filter_func(const GtkRecentFilterInfo *info, gpointer func)
96
96
  {
97
+ VALUE result;
97
98
  struct callback_arg arg;
98
99
 
99
100
  arg.callback = (VALUE)func;
100
101
  arg.info = BOXED2RVAL((gpointer)info, GTK_TYPE_RECENT_FILTER_INFO);
101
102
 
102
- VALUE result = G_PROTECT_CALLBACK(invoke_callback, &arg);
103
+ result = G_PROTECT_CALLBACK(invoke_callback, &arg);
103
104
  return NIL_P(rb_errinfo()) ? TRUE : RVAL2CBOOL(result);
104
105
  }
105
106
 
@@ -103,14 +103,10 @@ rf_get_applications(VALUE self)
103
103
  static VALUE
104
104
  rf_set_applications(VALUE self, VALUE applications)
105
105
  {
106
- gint i;
107
- gint len = RARRAY_LEN(applications);
108
- gchar** apps = g_new(gchar*, len + 1);
109
- for (i = 0; i < len; i++) {
110
- apps[i] = RVAL2CSTR(RARRAY_PTR(applications)[i]);
111
- }
112
- apps[len] = NULL;
113
- _SELF(self)->applications = (const gchar**)apps;
106
+ /* NOTE: This can’t be right. What guarantees that the entries in
107
+ * applications will be around? It should be RVAL2STRV_DUP and use
108
+ * g_strfreev in free above. */
109
+ _SELF(self)->applications = RVAL2STRV(applications);
114
110
 
115
111
  return self;
116
112
  }
@@ -132,14 +128,7 @@ rf_get_groups(VALUE self)
132
128
  static VALUE
133
129
  rf_set_groups(VALUE self, VALUE groups)
134
130
  {
135
- gint i;
136
- gint len = RARRAY_LEN(groups);
137
- gchar** grps = g_new(gchar*, len + 1);
138
- for (i = 0; i < len; i++) {
139
- grps[i] = RVAL2CSTR(RARRAY_PTR(groups)[i]);
140
- }
141
- grps[len] = NULL;
142
- _SELF(self)->groups = (const gchar**)grps;
131
+ _SELF(self)->groups = RVAL2STRV(groups);
143
132
 
144
133
  return self;
145
134
  }
@@ -90,7 +90,7 @@ ri_get_application_info(VALUE self, VALUE app_name)
90
90
  static VALUE
91
91
  ri_get_applications(VALUE self)
92
92
  {
93
- gint i;
93
+ gsize i;
94
94
  gsize length;
95
95
  gchar** str = gtk_recent_info_get_applications(_SELF(self), &length);
96
96
  VALUE ary = rb_ary_new();
@@ -110,7 +110,7 @@ ri_last_application(VALUE self)
110
110
  static VALUE
111
111
  ri_get_groups(VALUE self)
112
112
  {
113
- gint i;
113
+ gsize i;
114
114
  gsize length;
115
115
  gchar** str = gtk_recent_info_get_groups(_SELF(self), &length);
116
116
  VALUE ary = rb_ary_new();
@@ -134,6 +134,7 @@ Init_gtk_recent_manager()
134
134
  rb_define_singleton_method(rm, "default", rm_s_get_default, 0);
135
135
  rb_define_singleton_method(rm, "get_for_screen", rm_s_get_for_screen, 1);
136
136
  rb_define_method(rm, "set_screen", rm_set_screen, 1);
137
+ G_DEF_SETTER(rm, "set_screen");
137
138
  rb_define_method(rm, "add_item", rm_add_item, -1);
138
139
  rb_define_method(rm, "remove_item", rm_remove_item, 1);
139
140
  rb_define_method(rm, "lookup_item", rm_lookup_item, 1);
@@ -142,8 +143,6 @@ Init_gtk_recent_manager()
142
143
  rb_define_method(rm, "items", rm_get_items, 0);
143
144
  rb_define_method(rm, "purge_items", rm_purge_items, 0);
144
145
 
145
- G_DEF_SETTERS(rm);
146
-
147
146
  /* GtkRecentManagerError */
148
147
  G_DEF_ERROR(GTK_RECENT_MANAGER_ERROR, "RecentManagerError", mGtk, rb_eRuntimeError,
149
148
  GTK_TYPE_RECENT_MANAGER_ERROR);
@@ -16,12 +16,11 @@
16
16
 
17
17
  #define _SELF(self) (GTK_RULER(RVAL2GOBJ(self)))
18
18
 
19
- static VALUE
20
- ruler_set_metric(VALUE self, VALUE metric)
21
- {
22
- gtk_ruler_set_metric(_SELF(self), RVAL2GENUM(metric, GTK_TYPE_METRIC_TYPE));
23
- return self;
24
- }
19
+ /* Defined as Properties
20
+ void gtk_ruler_set_metric (GtkRuler *ruler,
21
+ GtkMetricType metric);
22
+ GtkMetricType gtk_ruler_get_metric (GtkRuler *ruler);
23
+ */
25
24
 
26
25
  static VALUE
27
26
  ruler_set_range(VALUE self, VALUE lower, VALUE upper, VALUE position, VALUE max_size)
@@ -31,12 +30,6 @@ ruler_set_range(VALUE self, VALUE lower, VALUE upper, VALUE position, VALUE max_
31
30
  return self;
32
31
  }
33
32
 
34
- static VALUE
35
- ruler_get_metric(VALUE self)
36
- {
37
- return INT2FIX(gtk_ruler_get_metric(_SELF(self)));
38
- }
39
-
40
33
  static VALUE
41
34
  ruler_get_range(VALUE self)
42
35
  {
@@ -65,12 +58,9 @@ Init_gtk_ruler()
65
58
  {
66
59
  VALUE gRuler = G_DEF_CLASS(GTK_TYPE_RULER, "Ruler", mGtk);
67
60
 
68
- rb_define_method(gRuler, "set_metric", ruler_set_metric, 1);
69
61
  rb_define_method(gRuler, "set_range", ruler_set_range, 4);
70
- rb_define_method(gRuler, "metric", ruler_get_metric, 0);
62
+ G_DEF_SETTER(gRuler, "range");
71
63
  rb_define_method(gRuler, "range", ruler_get_range, 0);
72
64
  rb_define_method(gRuler, "draw_ticks", ruler_draw_ticks, 0);
73
65
  rb_define_method(gRuler, "draw_pos", ruler_draw_pos, 0);
74
-
75
- G_DEF_SETTERS(gRuler);
76
66
  }
@@ -18,9 +18,6 @@
18
18
 
19
19
  #define _SELF(s) (GTK_SCALE_BUTTON(RVAL2GOBJ(s)))
20
20
 
21
- static VALUE
22
- scalebutton_set_icons(VALUE self, VALUE icons);
23
-
24
21
  static VALUE
25
22
  scalebutton_initialize(int argc, VALUE *argv, VALUE self)
26
23
  {
@@ -44,50 +41,27 @@ scalebutton_initialize(int argc, VALUE *argv, VALUE self)
44
41
  widget = gtk_scale_button_new(RVAL2GENUM(arg1, GTK_TYPE_ICON_SIZE), min, max, step, NULL);
45
42
  RBGTK_INITIALIZE(self, widget);
46
43
 
47
- if (!NIL_P(arg5))
48
- scalebutton_set_icons(self, arg5);
44
+ if (!NIL_P(arg5)) {
45
+ const gchar **icons = RVAL2STRV(arg5);
49
46
 
50
- return Qnil;
51
- }
47
+ gtk_scale_button_set_icons(_SELF(self), icons);
52
48
 
53
- static VALUE
54
- scalebutton_set_adjustment(VALUE self, VALUE adjustment)
55
- {
56
- gtk_scale_button_set_adjustment(_SELF(self), RVAL2GOBJ(adjustment));
57
- return self;
58
- }
59
-
60
- static VALUE
61
- scalebutton_set_icons(VALUE self, VALUE icons)
62
- {
63
- int i;
64
- gchar **icons_c = g_new0(gchar*, RARRAY_LEN(icons) + 1);
65
- for (i = 0; i < RARRAY_LEN(icons); i++)
66
- icons_c[i] = RVAL2CSTR(RARRAY_PTR(icons)[i]);
67
- icons_c[i] = NULL;
68
- gtk_scale_button_set_icons(_SELF(self), (const gchar **) icons_c);
69
- g_free(icons_c);
70
- return self;
71
- }
49
+ g_free(icons);
50
+ }
72
51
 
73
- static VALUE
74
- scalebutton_set_value(VALUE self, VALUE value)
75
- {
76
- gtk_scale_button_set_value(_SELF(self), NUM2DBL(value));
77
- return self;
78
- }
79
-
80
- static VALUE
81
- scalebutton_get_adjustment(VALUE self)
82
- {
83
- return GOBJ2RVAL(gtk_scale_button_get_adjustment(_SELF(self)));
52
+ return Qnil;
84
53
  }
85
54
 
86
- static VALUE
87
- scalebutton_get_value(VALUE self)
88
- {
89
- return rb_float_new(gtk_scale_button_get_value(_SELF(self)));
90
- }
55
+ /* Defined as Properties
56
+ void gtk_scale_button_set_adjustment (GtkScaleButton *button,
57
+ GtkAdjustment *adjustment);
58
+ void gtk_scale_button_set_icons (GtkScaleButton *button,
59
+ const gchar **icons);
60
+ void gtk_scale_button_set_value (GtkScaleButton *button,
61
+ gdouble value);
62
+ GtkAdjustment * gtk_scale_button_get_adjustment (GtkScaleButton *button);
63
+ gdouble gtk_scale_button_get_value (GtkScaleButton *button);
64
+ */
91
65
 
92
66
  #endif
93
67
 
@@ -97,11 +71,5 @@ Init_gtk_scalebutton()
97
71
  #if GTK_CHECK_VERSION(2,12,0)
98
72
  VALUE gScaleButton = G_DEF_CLASS(GTK_TYPE_SCALE_BUTTON, "ScaleButton", mGtk);
99
73
  rb_define_method(gScaleButton, "initialize", scalebutton_initialize, -1);
100
- rb_define_method(gScaleButton, "set_adjustment", scalebutton_set_adjustment, 1);
101
- rb_define_method(gScaleButton, "set_icons", scalebutton_set_icons, 1);
102
- rb_define_method(gScaleButton, "set_value", scalebutton_set_value, 1);
103
- rb_define_method(gScaleButton, "adjustment", scalebutton_get_adjustment, 0);
104
- rb_define_method(gScaleButton, "value", scalebutton_get_value, 0);
105
- G_DEF_SETTERS(gScaleButton);
106
74
  #endif
107
75
  }
@@ -144,6 +144,6 @@ Init_gtk_scrolled_window()
144
144
  rb_define_method(gScrolledWin, "unset_placement", scwin_unset_placement, 0);
145
145
  rb_define_method(gScrolledWin, "placement", scwin_get_placement, 0);
146
146
  rb_define_method(gScrolledWin, "set_placement", scwin_set_placement, 1);
147
+ G_DEF_SETTER(gScrolledWin, "placement");
147
148
  #endif
148
- G_DEF_SETTERS(gScrolledWin);
149
149
  }