gtk2 1.0.3 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (255) hide show
  1. data/Rakefile +66 -1
  2. data/ext/gtk2/extconf.rb +0 -96
  3. data/ext/gtk2/global.h +274 -13
  4. data/ext/gtk2/gtk2.def +5 -3
  5. data/ext/gtk2/init.c +263 -19
  6. data/ext/gtk2/rbgdk.c +245 -89
  7. data/ext/gtk2/rbgdk.h +32 -6
  8. data/ext/gtk2/rbgdkatom.c +38 -28
  9. data/ext/gtk2/rbgdkcairo.c +32 -42
  10. data/ext/gtk2/rbgdkcolor.c +52 -42
  11. data/ext/gtk2/rbgdkcolormap.c +42 -37
  12. data/ext/gtk2/rbgdkconst.c +23 -13
  13. data/ext/gtk2/rbgdkconversions.h +19 -6
  14. data/ext/gtk2/rbgdkcursor.c +37 -25
  15. data/ext/gtk2/rbgdkdevice.c +77 -67
  16. data/ext/gtk2/rbgdkdisplay.c +158 -150
  17. data/ext/gtk2/rbgdkdisplaymanager.c +27 -15
  18. data/ext/gtk2/rbgdkdragcontext.c +121 -70
  19. data/ext/gtk2/rbgdkdraw.c +252 -160
  20. data/ext/gtk2/rbgdkevent.c +30 -20
  21. data/ext/gtk2/rbgdkgc.c +123 -116
  22. data/ext/gtk2/rbgdkgeometry.c +77 -68
  23. data/ext/gtk2/rbgdkimage.c +58 -47
  24. data/ext/gtk2/rbgdkinput.c +33 -26
  25. data/ext/gtk2/rbgdkkeymap.c +38 -27
  26. data/ext/gtk2/rbgdkkeyval.c +44 -32
  27. data/ext/gtk2/rbgdkpango.c +66 -39
  28. data/ext/gtk2/rbgdkpangorenderer.c +63 -35
  29. data/ext/gtk2/rbgdkpixbuf.c +36 -25
  30. data/ext/gtk2/rbgdkpixmap.c +65 -49
  31. data/ext/gtk2/rbgdkproperty.c +66 -60
  32. data/ext/gtk2/rbgdkrectangle.c +54 -46
  33. data/ext/gtk2/rbgdkregion.c +144 -79
  34. data/ext/gtk2/rbgdkrgb.c +74 -58
  35. data/ext/gtk2/rbgdkscreen.c +103 -97
  36. data/ext/gtk2/rbgdkselection.c +49 -39
  37. data/ext/gtk2/rbgdkthreads.c +32 -19
  38. data/ext/gtk2/rbgdktimecoord.c +60 -38
  39. data/ext/gtk2/rbgdkvisual.c +79 -71
  40. data/ext/gtk2/rbgdkwindow.c +284 -305
  41. data/ext/gtk2/rbgdkwindowattr.c +69 -58
  42. data/ext/gtk2/rbgdkx11.c +41 -28
  43. data/ext/gtk2/rbgtk.c +498 -19
  44. data/ext/gtk2/rbgtk.h +35 -20
  45. data/ext/gtk2/rbgtkaboutdialog.c +33 -80
  46. data/ext/gtk2/rbgtkaccelerator.c +36 -23
  47. data/ext/gtk2/rbgtkaccelgroup.c +50 -40
  48. data/ext/gtk2/rbgtkaccelgroupentry.c +32 -20
  49. data/ext/gtk2/rbgtkaccelkey.c +40 -28
  50. data/ext/gtk2/rbgtkaccellabel.c +30 -18
  51. data/ext/gtk2/rbgtkaccelmap.c +55 -42
  52. data/ext/gtk2/rbgtkaccessible.c +25 -14
  53. data/ext/gtk2/rbgtkaction.c +68 -68
  54. data/ext/gtk2/rbgtkactiongroup.c +317 -195
  55. data/ext/gtk2/rbgtkadjustment.c +33 -46
  56. data/ext/gtk2/rbgtkalignment.c +36 -24
  57. data/ext/gtk2/rbgtkallocation.c +53 -42
  58. data/ext/gtk2/rbgtkarrow.c +34 -22
  59. data/ext/gtk2/rbgtkaspectframe.c +32 -20
  60. data/ext/gtk2/rbgtkassistant.c +81 -61
  61. data/ext/gtk2/rbgtkbbox.c +32 -20
  62. data/ext/gtk2/rbgtkbin.c +28 -16
  63. data/ext/gtk2/rbgtkbindingset.c +42 -35
  64. data/ext/gtk2/rbgtkborder.c +34 -23
  65. data/ext/gtk2/rbgtkbox.c +40 -29
  66. data/ext/gtk2/rbgtkbuildable.c +57 -45
  67. data/ext/gtk2/rbgtkbuilder.c +53 -38
  68. data/ext/gtk2/rbgtkbutton.c +41 -55
  69. data/ext/gtk2/rbgtkcalendar.c +51 -40
  70. data/ext/gtk2/rbgtkcelleditable.c +28 -17
  71. data/ext/gtk2/rbgtkcelllayout.c +41 -30
  72. data/ext/gtk2/rbgtkcellrenderer.c +43 -32
  73. data/ext/gtk2/rbgtkcellrendereraccel.c +26 -18
  74. data/ext/gtk2/rbgtkcellrenderercombo.c +25 -17
  75. data/ext/gtk2/rbgtkcellrendererpixbuf.c +24 -17
  76. data/ext/gtk2/rbgtkcellrendererprogress.c +25 -17
  77. data/ext/gtk2/rbgtkcellrendererspin.c +24 -16
  78. data/ext/gtk2/rbgtkcellrendererspinner.c +23 -11
  79. data/ext/gtk2/rbgtkcellrenderertext.c +28 -21
  80. data/ext/gtk2/rbgtkcellrenderertoggle.c +24 -16
  81. data/ext/gtk2/rbgtkcellview.c +34 -33
  82. data/ext/gtk2/rbgtkcheckbutton.c +28 -16
  83. data/ext/gtk2/rbgtkcheckmenuitem.c +31 -19
  84. data/ext/gtk2/rbgtkclipboard.c +123 -77
  85. data/ext/gtk2/rbgtkcolorbutton.c +26 -31
  86. data/ext/gtk2/rbgtkcolorsel.c +109 -55
  87. data/ext/gtk2/rbgtkcolorselectiondialog.c +28 -19
  88. data/ext/gtk2/rbgtkcombo.c +43 -32
  89. data/ext/gtk2/rbgtkcombobox.c +44 -83
  90. data/ext/gtk2/rbgtkcomboboxentry.c +26 -21
  91. data/ext/gtk2/rbgtkconst.c +23 -13
  92. data/ext/gtk2/rbgtkcontainer.c +153 -100
  93. data/ext/gtk2/rbgtkconversions.h +19 -6
  94. data/ext/gtk2/rbgtkcurve.c +46 -36
  95. data/ext/gtk2/rbgtkdialog.c +104 -70
  96. data/ext/gtk2/rbgtkdrag.c +173 -121
  97. data/ext/gtk2/rbgtkdrawingarea.c +28 -16
  98. data/ext/gtk2/rbgtkeditable.c +63 -51
  99. data/ext/gtk2/rbgtkentry.c +48 -85
  100. data/ext/gtk2/rbgtkentrycompletion.c +42 -55
  101. data/ext/gtk2/rbgtkeventbox.c +28 -16
  102. data/ext/gtk2/rbgtkexpander.c +26 -35
  103. data/ext/gtk2/rbgtkfilechooser.c +87 -143
  104. data/ext/gtk2/rbgtkfilechooserbutton.c +26 -32
  105. data/ext/gtk2/rbgtkfilechooserdialog.c +25 -15
  106. data/ext/gtk2/rbgtkfilechooserwidget.c +26 -15
  107. data/ext/gtk2/rbgtkfilefilter.c +45 -35
  108. data/ext/gtk2/rbgtkfilesel.c +54 -43
  109. data/ext/gtk2/rbgtkfilesystemerror.c +51 -0
  110. data/ext/gtk2/rbgtkfixed.c +36 -25
  111. data/ext/gtk2/rbgtkfontbutton.c +26 -37
  112. data/ext/gtk2/rbgtkfontselection.c +27 -15
  113. data/ext/gtk2/rbgtkfontselectiondialog.c +43 -32
  114. data/ext/gtk2/rbgtkframe.c +39 -28
  115. data/ext/gtk2/rbgtkgamma.c +32 -20
  116. data/ext/gtk2/rbgtkhandlebox.c +31 -19
  117. data/ext/gtk2/rbgtkhbbox.c +28 -16
  118. data/ext/gtk2/rbgtkhbox.c +29 -17
  119. data/ext/gtk2/rbgtkhpaned.c +28 -16
  120. data/ext/gtk2/rbgtkhruler.c +28 -16
  121. data/ext/gtk2/rbgtkhscale.c +28 -16
  122. data/ext/gtk2/rbgtkhscrollbar.c +28 -16
  123. data/ext/gtk2/rbgtkhseparator.c +28 -16
  124. data/ext/gtk2/rbgtkiconfactory.c +35 -23
  125. data/ext/gtk2/rbgtkiconinfo.c +42 -30
  126. data/ext/gtk2/rbgtkiconset.c +31 -19
  127. data/ext/gtk2/rbgtkiconsize.c +38 -25
  128. data/ext/gtk2/rbgtkiconsource.c +62 -50
  129. data/ext/gtk2/rbgtkicontheme.c +95 -95
  130. data/ext/gtk2/rbgtkiconview.c +87 -121
  131. data/ext/gtk2/rbgtkimage.c +31 -40
  132. data/ext/gtk2/rbgtkimagemenuitem.c +26 -14
  133. data/ext/gtk2/rbgtkimcontext.c +46 -34
  134. data/ext/gtk2/rbgtkimcontextsimple.c +47 -24
  135. data/ext/gtk2/rbgtkimmulticontext.c +26 -14
  136. data/ext/gtk2/rbgtkinputdialog.c +28 -16
  137. data/ext/gtk2/rbgtkinvisible.c +24 -18
  138. data/ext/gtk2/rbgtkitem.c +32 -20
  139. data/ext/gtk2/rbgtkitemfactory.c +65 -57
  140. data/ext/gtk2/rbgtklabel.c +46 -57
  141. data/ext/gtk2/rbgtklayout.c +40 -29
  142. data/ext/gtk2/rbgtklinkbutton.c +26 -15
  143. data/ext/gtk2/rbgtkliststore.c +145 -102
  144. data/ext/gtk2/rbgtkmacros.h +19 -6
  145. data/ext/gtk2/rbgtkmenu.c +47 -59
  146. data/ext/gtk2/rbgtkmenubar.c +30 -30
  147. data/ext/gtk2/rbgtkmenuitem.c +34 -41
  148. data/ext/gtk2/rbgtkmenushell.c +43 -42
  149. data/ext/gtk2/rbgtkmenutoolbutton.c +27 -16
  150. data/ext/gtk2/rbgtkmessagedialog.c +31 -25
  151. data/ext/gtk2/rbgtkmisc.c +33 -22
  152. data/ext/gtk2/rbgtknotebook.c +98 -134
  153. data/ext/gtk2/rbgtkobject.c +46 -81
  154. data/ext/gtk2/rbgtkoptionmenu.c +35 -23
  155. data/ext/gtk2/rbgtkpagesetup.c +64 -54
  156. data/ext/gtk2/rbgtkpagesetupunixdialog.c +34 -27
  157. data/ext/gtk2/rbgtkpaned.c +46 -36
  158. data/ext/gtk2/rbgtkpapersize.c +60 -54
  159. data/ext/gtk2/rbgtkplug.c +32 -20
  160. data/ext/gtk2/rbgtkprintcontext.c +43 -35
  161. data/ext/gtk2/rbgtkprinter.c +36 -37
  162. data/ext/gtk2/rbgtkprintjob.c +36 -37
  163. data/ext/gtk2/rbgtkprintoperation.c +44 -33
  164. data/ext/gtk2/rbgtkprintoperationpreview.c +30 -18
  165. data/ext/gtk2/rbgtkprintsettings.c +248 -192
  166. data/ext/gtk2/rbgtkprintunixdialog.c +33 -45
  167. data/ext/gtk2/rbgtkprogress.c +23 -13
  168. data/ext/gtk2/rbgtkprogressbar.c +47 -46
  169. data/ext/gtk2/rbgtkradioaction.c +84 -39
  170. data/ext/gtk2/rbgtkradiobutton.c +33 -21
  171. data/ext/gtk2/rbgtkradiomenuitem.c +86 -45
  172. data/ext/gtk2/rbgtkradiotoolbutton.c +99 -53
  173. data/ext/gtk2/rbgtkrange.c +36 -56
  174. data/ext/gtk2/rbgtkrc.c +61 -49
  175. data/ext/gtk2/rbgtkrcstyle.c +59 -48
  176. data/ext/gtk2/rbgtkrecentaction.c +28 -16
  177. data/ext/gtk2/rbgtkrecentchooser.c +58 -92
  178. data/ext/gtk2/rbgtkrecentchooserdialog.c +29 -18
  179. data/ext/gtk2/rbgtkrecentchoosermenu.c +25 -21
  180. data/ext/gtk2/rbgtkrecentchooserwidget.c +24 -13
  181. data/ext/gtk2/rbgtkrecentdata.c +47 -36
  182. data/ext/gtk2/rbgtkrecentfilter.c +55 -46
  183. data/ext/gtk2/rbgtkrecentfilterinfo.c +51 -40
  184. data/ext/gtk2/rbgtkrecentinfo.c +66 -56
  185. data/ext/gtk2/rbgtkrecentmanager.c +47 -43
  186. data/ext/gtk2/rbgtkruler.c +35 -30
  187. data/ext/gtk2/rbgtkscale.c +29 -18
  188. data/ext/gtk2/rbgtkscalebutton.c +27 -27
  189. data/ext/gtk2/rbgtkscrollbar.c +23 -13
  190. data/ext/gtk2/rbgtkscrolledwindow.c +44 -60
  191. data/ext/gtk2/rbgtkselection.c +87 -67
  192. data/ext/gtk2/rbgtkselectiondata.c +74 -65
  193. data/ext/gtk2/rbgtkseparator.c +23 -13
  194. data/ext/gtk2/rbgtkseparatormenuitem.c +25 -13
  195. data/ext/gtk2/rbgtkseparatortoolitem.c +26 -21
  196. data/ext/gtk2/rbgtksettings.c +123 -103
  197. data/ext/gtk2/rbgtksizegroup.c +33 -30
  198. data/ext/gtk2/rbgtksocket.c +32 -20
  199. data/ext/gtk2/rbgtkspinbutton.c +48 -38
  200. data/ext/gtk2/rbgtkspinner.c +27 -14
  201. data/ext/gtk2/rbgtkstatusbar.c +36 -31
  202. data/ext/gtk2/rbgtkstatusicon.c +31 -44
  203. data/ext/gtk2/rbgtkstock.c +137 -125
  204. data/ext/gtk2/rbgtkstyle.c +177 -161
  205. data/ext/gtk2/rbgtktable.c +58 -47
  206. data/ext/gtk2/rbgtktargetlist.c +56 -36
  207. data/ext/gtk2/rbgtktearoffmenuitem.c +28 -16
  208. data/ext/gtk2/rbgtktextappearance.c +44 -34
  209. data/ext/gtk2/rbgtktextattributes.c +54 -42
  210. data/ext/gtk2/rbgtktextbuffer.c +188 -191
  211. data/ext/gtk2/rbgtktextchild.c +29 -18
  212. data/ext/gtk2/rbgtktextiter.c +153 -145
  213. data/ext/gtk2/rbgtktextmark.c +33 -30
  214. data/ext/gtk2/rbgtktexttag.c +34 -22
  215. data/ext/gtk2/rbgtktexttagtable.c +36 -25
  216. data/ext/gtk2/rbgtktextview.c +85 -73
  217. data/ext/gtk2/rbgtktoggleaction.c +27 -22
  218. data/ext/gtk2/rbgtktogglebutton.c +37 -26
  219. data/ext/gtk2/rbgtktoggletoolbutton.c +26 -20
  220. data/ext/gtk2/rbgtktoolbar.c +66 -69
  221. data/ext/gtk2/rbgtktoolbutton.c +27 -40
  222. data/ext/gtk2/rbgtktoolitem.c +60 -62
  223. data/ext/gtk2/rbgtktooltip.c +36 -25
  224. data/ext/gtk2/rbgtktooltips.c +42 -34
  225. data/ext/gtk2/rbgtktreedragdest.c +20 -11
  226. data/ext/gtk2/rbgtktreedragsource.c +20 -11
  227. data/ext/gtk2/rbgtktreeiter.c +58 -47
  228. data/ext/gtk2/rbgtktreemodel.c +83 -65
  229. data/ext/gtk2/rbgtktreemodelfilter.c +47 -35
  230. data/ext/gtk2/rbgtktreemodelsort.c +38 -27
  231. data/ext/gtk2/rbgtktreepath.c +55 -44
  232. data/ext/gtk2/rbgtktreerowreference.c +60 -42
  233. data/ext/gtk2/rbgtktreeselection.c +61 -52
  234. data/ext/gtk2/rbgtktreesortable.c +52 -42
  235. data/ext/gtk2/rbgtktreestore.c +88 -67
  236. data/ext/gtk2/rbgtktreeview.c +157 -185
  237. data/ext/gtk2/rbgtktreeviewcolumn.c +57 -62
  238. data/ext/gtk2/rbgtkuimanager.c +61 -61
  239. data/ext/gtk2/rbgtkvbbox.c +28 -16
  240. data/ext/gtk2/rbgtkvbox.c +29 -17
  241. data/ext/gtk2/rbgtkviewport.c +28 -16
  242. data/ext/gtk2/rbgtkvolumebutton.c +28 -16
  243. data/ext/gtk2/rbgtkvpaned.c +28 -16
  244. data/ext/gtk2/rbgtkvruler.c +28 -16
  245. data/ext/gtk2/rbgtkvscale.c +28 -16
  246. data/ext/gtk2/rbgtkvscrollbar.c +28 -16
  247. data/ext/gtk2/rbgtkvseparator.c +28 -16
  248. data/ext/gtk2/rbgtkwidget.c +284 -296
  249. data/ext/gtk2/rbgtkwindow.c +156 -214
  250. data/ext/gtk2/rbgtkwindowgroup.c +35 -24
  251. data/sample/testgtk/labels.rb +1 -0
  252. data/sample/testgtk/testgtk.rb +2 -0
  253. metadata +16 -17
  254. data/ChangeLog +0 -6902
  255. data/ext/gtk2/rbgtkmain.c +0 -493
@@ -1,13 +1,23 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /************************************************
3
-
4
- rbgtktreerowreference.c -
5
-
6
- $Author: mutoh $
7
- $Date: 2006/10/21 16:58:00 $
8
-
9
- Copyright (C) 2002-2006 Masao Mutoh
10
- ************************************************/
2
+ /*
3
+ * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
+ * Copyright (C) 2002-2006 Masao Mutoh
5
+ *
6
+ * This library is free software; you can redistribute it and/or
7
+ * modify it under the terms of the GNU Lesser General Public
8
+ * License as published by the Free Software Foundation; either
9
+ * version 2.1 of the License, or (at your option) any later version.
10
+ *
11
+ * This library is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ * Lesser General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU Lesser General Public
17
+ * License along with this library; if not, write to the Free Software
18
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
+ * MA 02110-1301 USA
20
+ */
11
21
 
12
22
  #include "global.h"
13
23
 
@@ -40,6 +50,7 @@ rbgtk_get_tree_row_reference(VALUE obj)
40
50
 
41
51
  /*****************************************/
42
52
 
53
+ #define RG_TARGET_NAMESPACE cTreeRowReference
43
54
  #define _SELF(s) RVAL2TREEROWREFERENCE(s)
44
55
 
45
56
  /*****************************************/
@@ -49,11 +60,11 @@ static ID id_model;
49
60
  static ID id_path;
50
61
 
51
62
  static VALUE
52
- treerowref_initialize(int argc, VALUE *argv, VALUE self)
63
+ rg_initialize(int argc, VALUE *argv, VALUE self)
53
64
  {
54
65
  VALUE proxy, model, path;
55
66
  GtkTreeRowReference* ref;
56
-
67
+
57
68
  if (argc == 3){
58
69
  rb_scan_args(argc, argv, "3", &proxy, &model, &path);
59
70
  G_CHILD_SET(self, id_proxy, proxy);
@@ -70,14 +81,13 @@ treerowref_initialize(int argc, VALUE *argv, VALUE self)
70
81
 
71
82
  G_CHILD_SET(self, id_model, model);
72
83
  G_CHILD_SET(self, id_path, path);
73
-
84
+
74
85
  G_INITIALIZE(self, ref);
75
86
  return Qnil;
76
87
  }
77
88
 
78
-
79
89
  static VALUE
80
- treerowref_get_path(VALUE self)
90
+ rg_path(VALUE self)
81
91
  {
82
92
  VALUE ret = GTKTREEPATH2RVAL(gtk_tree_row_reference_get_path(_SELF(self)));
83
93
  G_CHILD_SET(self, id_path, ret);
@@ -86,7 +96,7 @@ treerowref_get_path(VALUE self)
86
96
 
87
97
  #if GTK_CHECK_VERSION(2,8,0)
88
98
  static VALUE
89
- treerowref_get_model(VALUE self)
99
+ rg_model(VALUE self)
90
100
  {
91
101
  VALUE ret = GOBJ2RVAL(gtk_tree_row_reference_get_model(_SELF(self)));
92
102
  G_CHILD_SET(self, id_model, ret);
@@ -95,63 +105,71 @@ treerowref_get_model(VALUE self)
95
105
  #endif
96
106
 
97
107
  static VALUE
98
- treerowref_valid(VALUE self)
108
+ rg_valid_p(VALUE self)
99
109
  {
100
110
  return CBOOL2RVAL(gtk_tree_row_reference_valid(_SELF(self)));
101
111
  }
102
112
 
103
113
  static VALUE
104
- treerowref_s_inserted(VALUE self, VALUE proxy, VALUE path)
114
+ rg_s_inserted(VALUE self, VALUE proxy, VALUE path)
105
115
  {
106
116
  gtk_tree_row_reference_inserted(RVAL2GOBJ(proxy), RVAL2GTKTREEPATH(path));
107
117
  return self;
108
118
  }
109
119
 
110
120
  static VALUE
111
- treerowref_s_deleted(VALUE self, VALUE proxy, VALUE path)
121
+ rg_s_deleted(VALUE self, VALUE proxy, VALUE path)
112
122
  {
113
123
  gtk_tree_row_reference_deleted(RVAL2GOBJ(proxy), RVAL2GTKTREEPATH(path));
114
124
  return self;
115
125
  }
116
126
 
117
127
  static VALUE
118
- treerowref_s_reordered(VALUE self, VALUE proxy, VALUE path, VALUE iter, VALUE new_orders)
128
+ rg_s_reordered(VALUE self, VALUE rbproxy, VALUE rbpath, VALUE rbiter, VALUE rbnew_order)
119
129
  {
120
- gint i, len;
121
- gint* orders;
130
+ GObject *proxy = RVAL2GOBJ(rbproxy);
131
+ GtkTreePath *path = RVAL2GTKTREEPATH(rbpath);
132
+ GtkTreeIter *iter = RVAL2GTKTREEITER(rbiter);
133
+ /* TODO: How do we implement this check?
134
+ gint columns = gtk_tree_model_get_n_columns(proxy);
135
+ */
136
+ long n;
137
+ gint *new_order = RVAL2GINTS(rbnew_order, n);
138
+
139
+ /*
140
+ if (n != columns) {
141
+ g_free(new_order);
142
+
143
+ rb_raise(rb_eArgError,
144
+ "new order array must contain same number of elements as the number of columns in the store: %ld != %d",
145
+ n, columns);
146
+ }
147
+ */
122
148
 
123
- Check_Type(new_orders, T_ARRAY);
149
+ gtk_tree_row_reference_reordered(proxy, path, iter, new_order);
124
150
 
125
- len = RARRAY_LEN(new_orders);
126
- orders = ALLOCA_N(gint, len);
151
+ g_free(new_order);
127
152
 
128
- for (i = 0; i < len; i++) {
129
- orders[i] = RARRAY_PTR(new_orders)[i];
130
- }
131
-
132
- gtk_tree_row_reference_reordered(RVAL2GOBJ(proxy), RVAL2GTKTREEPATH(path),
133
- RVAL2GTKTREEITER(iter), orders);
134
153
  return self;
135
154
  }
136
155
 
137
156
  void
138
- Init_gtk_treerowreference()
157
+ Init_gtk_treerowreference(VALUE mGtk)
139
158
  {
140
- VALUE gTreeref = G_DEF_CLASS(GTK_TYPE_TREE_ROW_REFERENCE, "TreeRowReference", mGtk);
141
-
142
- rb_define_method(gTreeref, "initialize", treerowref_initialize, -1);
143
- rb_define_method(gTreeref, "path", treerowref_get_path, 0);
159
+ VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_TREE_ROW_REFERENCE, "TreeRowReference", mGtk);
160
+
161
+ RG_DEF_METHOD(initialize, -1);
162
+ RG_DEF_METHOD(path, 0);
144
163
  #if GTK_CHECK_VERSION(2,8,0)
145
- rb_define_method(gTreeref, "model", treerowref_get_model, 0);
164
+ RG_DEF_METHOD(model, 0);
146
165
  #endif
147
- rb_define_method(gTreeref, "valid?", treerowref_valid, 0);
148
-
149
- rb_define_singleton_method(gTreeref, "inserted", treerowref_s_inserted, 2);
150
- rb_define_singleton_method(gTreeref, "deleted", treerowref_s_deleted, 2);
151
- rb_define_singleton_method(gTreeref, "reordered", treerowref_s_reordered, 4);
166
+ RG_DEF_METHOD_P(valid, 0);
167
+
168
+ RG_DEF_SMETHOD(inserted, 2);
169
+ RG_DEF_SMETHOD(deleted, 2);
170
+ RG_DEF_SMETHOD(reordered, 4);
152
171
 
153
172
  id_proxy = rb_intern("proxy");
154
173
  id_model = rb_intern("model");
155
174
  id_path = rb_intern("path");
156
175
  }
157
-
@@ -1,28 +1,39 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /************************************************
3
-
4
- rbgtktreeselection.c -
5
-
6
- $Author: ggc $
7
- $Date: 2007/07/13 16:07:32 $
8
-
9
- Copyright (C) 2002-2006 Masao Mutoh
10
- ************************************************/
2
+ /*
3
+ * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
+ * Copyright (C) 2002-2006 Masao Mutoh
5
+ *
6
+ * This library is free software; you can redistribute it and/or
7
+ * modify it under the terms of the GNU Lesser General Public
8
+ * License as published by the Free Software Foundation; either
9
+ * version 2.1 of the License, or (at your option) any later version.
10
+ *
11
+ * This library is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ * Lesser General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU Lesser General Public
17
+ * License along with this library; if not, write to the Free Software
18
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
+ * MA 02110-1301 USA
20
+ */
11
21
 
12
22
  #include "global.h"
13
23
 
24
+ #define RG_TARGET_NAMESPACE cTreeSelection
14
25
  #define _SELF(s) (GTK_TREE_SELECTION(RVAL2GOBJ(s)))
15
26
  #define RVAL2TREEMODEL(s) (GTK_TREE_MODEL(RVAL2GOBJ(s)))
16
27
 
17
28
  static VALUE
18
- treeselection_set_mode(VALUE self, VALUE type)
29
+ rg_set_mode(VALUE self, VALUE type)
19
30
  {
20
31
  gtk_tree_selection_set_mode(_SELF(self), RVAL2GENUM(type, GTK_TYPE_SELECTION_MODE));
21
32
  return self;
22
33
  }
23
34
 
24
35
  static VALUE
25
- treeselection_get_mode(VALUE self)
36
+ rg_mode(VALUE self)
26
37
  {
27
38
  return GENUM2RVAL(gtk_tree_selection_get_mode(_SELF(self)), GTK_TYPE_SELECTION_MODE);
28
39
  }
@@ -38,7 +49,7 @@ selection_func(GtkTreeSelection *selection, GtkTreeModel *model, GtkTreePath *pa
38
49
  }
39
50
 
40
51
  static VALUE
41
- treeselection_set_select_function(VALUE self)
52
+ rg_set_select_function(VALUE self)
42
53
  {
43
54
  volatile VALUE func = rb_block_proc();
44
55
  G_RELATIVE(self, func);
@@ -54,13 +65,13 @@ gpointer gtk_tree_selection_get_user_data
54
65
  */
55
66
 
56
67
  static VALUE
57
- treeselection_get_tree_view(VALUE self)
68
+ rg_tree_view(VALUE self)
58
69
  {
59
70
  return GOBJ2RVAL(gtk_tree_selection_get_tree_view(_SELF(self)));
60
71
  }
61
72
 
62
73
  static VALUE
63
- treeselection_get_selected(VALUE self)
74
+ rg_selected(VALUE self)
64
75
  {
65
76
  GtkTreeIter iter;
66
77
  GtkTreeModel* model;
@@ -78,7 +89,7 @@ foreach_func(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer
78
89
  }
79
90
 
80
91
  static VALUE
81
- treeselection_selected_foreach(VALUE self)
92
+ rg_selected_each(VALUE self)
82
93
  {
83
94
  volatile VALUE func = rb_block_proc();
84
95
  gtk_tree_selection_selected_foreach(_SELF(self),
@@ -88,61 +99,61 @@ treeselection_selected_foreach(VALUE self)
88
99
  }
89
100
 
90
101
  static VALUE
91
- treeselection_select_path(VALUE self, VALUE path)
102
+ rg_select_path(VALUE self, VALUE path)
92
103
  {
93
104
  gtk_tree_selection_select_path(_SELF(self), RVAL2GTKTREEPATH(path));
94
105
  return self;
95
106
  }
96
107
 
97
108
  static VALUE
98
- treeselection_unselect_path(VALUE self, VALUE path)
109
+ rg_unselect_path(VALUE self, VALUE path)
99
110
  {
100
111
  gtk_tree_selection_unselect_path(_SELF(self), RVAL2GTKTREEPATH(path));
101
112
  return self;
102
113
  }
103
114
 
104
115
  static VALUE
105
- treeselection_path_is_selected(VALUE self, VALUE path)
116
+ rg_path_is_selected_p(VALUE self, VALUE path)
106
117
  {
107
118
  return CBOOL2RVAL(gtk_tree_selection_path_is_selected(_SELF(self), RVAL2GTKTREEPATH(path)));
108
119
  }
109
120
 
110
121
  static VALUE
111
- treeselection_select_iter(VALUE self, VALUE iter)
122
+ rg_select_iter(VALUE self, VALUE iter)
112
123
  {
113
124
  gtk_tree_selection_select_iter(_SELF(self), RVAL2GTKTREEITER(iter));
114
125
  return self;
115
126
  }
116
127
 
117
128
  static VALUE
118
- treeselection_unselect_iter(VALUE self, VALUE iter)
129
+ rg_unselect_iter(VALUE self, VALUE iter)
119
130
  {
120
131
  gtk_tree_selection_unselect_iter(_SELF(self), RVAL2GTKTREEITER(iter));
121
132
  return self;
122
133
  }
123
134
 
124
135
  static VALUE
125
- treeselection_iter_is_selected(VALUE self, VALUE iter)
136
+ rg_iter_is_selected_p(VALUE self, VALUE iter)
126
137
  {
127
138
  return CBOOL2RVAL(gtk_tree_selection_iter_is_selected(_SELF(self), RVAL2GTKTREEITER(iter)));
128
139
  }
129
140
 
130
141
  static VALUE
131
- treeselection_select_all(VALUE self)
142
+ rg_select_all(VALUE self)
132
143
  {
133
144
  gtk_tree_selection_select_all(_SELF(self));
134
145
  return self;
135
146
  }
136
147
 
137
148
  static VALUE
138
- treeselection_unselect_all(VALUE self)
149
+ rg_unselect_all(VALUE self)
139
150
  {
140
151
  gtk_tree_selection_unselect_all(_SELF(self));
141
152
  return self;
142
153
  }
143
154
 
144
155
  static VALUE
145
- treeselection_select_range(VALUE self, VALUE start_path, VALUE end_path)
156
+ rg_select_range(VALUE self, VALUE start_path, VALUE end_path)
146
157
  {
147
158
  gtk_tree_selection_select_range(_SELF(self), RVAL2GTKTREEPATH(start_path),
148
159
  RVAL2GTKTREEPATH(end_path));
@@ -151,7 +162,7 @@ treeselection_select_range(VALUE self, VALUE start_path, VALUE end_path)
151
162
 
152
163
  #if GTK_CHECK_VERSION(2,2,0)
153
164
  static VALUE
154
- treeselection_get_selected_rows(VALUE self)
165
+ rg_selected_rows(VALUE self)
155
166
  {
156
167
  GtkTreeModel* model;
157
168
  GList* list = gtk_tree_selection_get_selected_rows(_SELF(self), &model);
@@ -162,13 +173,13 @@ treeselection_get_selected_rows(VALUE self)
162
173
  }
163
174
 
164
175
  static VALUE
165
- treeselection_count_selected_rows(VALUE self)
176
+ rg_count_selected_rows(VALUE self)
166
177
  {
167
178
  return INT2NUM(gtk_tree_selection_count_selected_rows(_SELF(self)));
168
179
  }
169
180
 
170
181
  static VALUE
171
- treeselection_unselect_range(VALUE self, VALUE start_path, VALUE end_path)
182
+ rg_unselect_range(VALUE self, VALUE start_path, VALUE end_path)
172
183
  {
173
184
  gtk_tree_selection_unselect_range(_SELF(self), RVAL2GTKTREEPATH(start_path),
174
185
  RVAL2GTKTREEPATH(end_path));
@@ -177,32 +188,30 @@ treeselection_unselect_range(VALUE self, VALUE start_path, VALUE end_path)
177
188
  #endif
178
189
 
179
190
  void
180
- Init_gtk_treeselection()
181
- {
182
- VALUE gTs = G_DEF_CLASS(GTK_TYPE_TREE_SELECTION, "TreeSelection", mGtk);
183
-
184
- rb_define_method(gTs, "set_mode", treeselection_set_mode, 1);
185
- rb_define_method(gTs, "mode", treeselection_get_mode, 0);
186
- rb_define_method(gTs, "set_select_function", treeselection_set_select_function, 0);
187
- rb_define_method(gTs, "tree_view", treeselection_get_tree_view, 0);
188
- rb_define_method(gTs, "selected", treeselection_get_selected, 0);
189
- rb_define_method(gTs, "selected_each", treeselection_selected_foreach, 0);
190
- rb_define_method(gTs, "select_path", treeselection_select_path, 1);
191
- rb_define_method(gTs, "unselect_path", treeselection_unselect_path, 1);
192
- rb_define_method(gTs, "path_is_selected?", treeselection_path_is_selected, 1);
193
- rb_define_method(gTs, "select_iter", treeselection_select_iter, 1);
194
- rb_define_method(gTs, "unselect_iter", treeselection_unselect_iter, 1);
195
- rb_define_method(gTs, "iter_is_selected?", treeselection_iter_is_selected, 1);
196
- rb_define_method(gTs, "select_all", treeselection_select_all, 0);
197
- rb_define_method(gTs, "unselect_all", treeselection_unselect_all, 0);
198
- rb_define_method(gTs, "select_range", treeselection_select_range, 2);
191
+ Init_gtk_treeselection(VALUE mGtk)
192
+ {
193
+ VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_TREE_SELECTION, "TreeSelection", mGtk);
194
+
195
+ RG_DEF_METHOD(set_mode, 1);
196
+ RG_DEF_METHOD(mode, 0);
197
+ RG_DEF_METHOD(set_select_function, 0);
198
+ RG_DEF_METHOD(tree_view, 0);
199
+ RG_DEF_METHOD(selected, 0);
200
+ RG_DEF_METHOD(selected_each, 0);
201
+ RG_DEF_METHOD(select_path, 1);
202
+ RG_DEF_METHOD(unselect_path, 1);
203
+ RG_DEF_METHOD_P(path_is_selected, 1);
204
+ RG_DEF_METHOD(select_iter, 1);
205
+ RG_DEF_METHOD(unselect_iter, 1);
206
+ RG_DEF_METHOD_P(iter_is_selected, 1);
207
+ RG_DEF_METHOD(select_all, 0);
208
+ RG_DEF_METHOD(unselect_all, 0);
209
+ RG_DEF_METHOD(select_range, 2);
199
210
  #if GTK_CHECK_VERSION(2,2,0)
200
- rb_define_method(gTs, "selected_rows", treeselection_get_selected_rows, 0);
201
- rb_define_method(gTs, "count_selected_rows", treeselection_count_selected_rows, 0);
202
- rb_define_method(gTs, "unselect_range", treeselection_unselect_range, 2);
211
+ RG_DEF_METHOD(selected_rows, 0);
212
+ RG_DEF_METHOD(count_selected_rows, 0);
213
+ RG_DEF_METHOD(unselect_range, 2);
203
214
  #endif
204
215
 
205
- G_DEF_SETTERS(gTs);
216
+ G_DEF_SETTERS(RG_TARGET_NAMESPACE);
206
217
  }
207
-
208
-
@@ -1,60 +1,70 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /************************************************
3
-
4
- rbgtktreesortable.c -
5
-
6
- $Author: ggc $
7
-
8
- $Date: 2007/07/13 16:07:32 $
9
-
10
- Copyright (C) 2002,2003 Ruby-GNOME2 Project Team
11
- ************************************************/
2
+ /*
3
+ * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
+ * Copyright (C) 2002,2003 Ruby-GNOME2 Project Team
5
+ *
6
+ * This library is free software; you can redistribute it and/or
7
+ * modify it under the terms of the GNU Lesser General Public
8
+ * License as published by the Free Software Foundation; either
9
+ * version 2.1 of the License, or (at your option) any later version.
10
+ *
11
+ * This library is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ * Lesser General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU Lesser General Public
17
+ * License along with this library; if not, write to the Free Software
18
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
+ * MA 02110-1301 USA
20
+ */
12
21
 
13
22
  #include "global.h"
14
23
 
15
- #define _SELF(s) (GTK_TREE_SORTABLE(RVAL2GOBJ(s)))
24
+ #define RG_TARGET_NAMESPACE mTreeSortable
25
+ #define _SELF(s) (GTK_TREE_SORTABLE(RVAL2GOBJ(s)))
16
26
 
17
27
  static VALUE
18
- treesortable_sort_column_changed(VALUE self)
28
+ rg_sort_column_changed(VALUE self)
19
29
  {
20
30
  gtk_tree_sortable_sort_column_changed(_SELF(self));
21
31
  return self;
22
32
  }
23
33
 
24
34
  static VALUE
25
- treesortable_get_sort_column_id(VALUE self)
35
+ rg_sort_column_id(VALUE self)
26
36
  {
27
37
  gint sort_column_id;
28
38
  GtkSortType order;
29
39
 
30
40
  if (gtk_tree_sortable_get_sort_column_id(_SELF(self), &sort_column_id,
31
- &order)) {
32
- VALUE ary;
41
+ &order)) {
42
+ VALUE ary;
33
43
 
34
- ary = rb_ary_new2(2);
35
- rb_ary_push(ary, INT2NUM(sort_column_id));
36
- rb_ary_push(ary, GENUM2RVAL(order, GTK_TYPE_SORT_TYPE));
37
- return ary;
44
+ ary = rb_ary_new2(2);
45
+ rb_ary_push(ary, INT2NUM(sort_column_id));
46
+ rb_ary_push(ary, GENUM2RVAL(order, GTK_TYPE_SORT_TYPE));
47
+ return ary;
38
48
  } else {
39
- return Qnil; /* XXX: or something else? exception? */
49
+ return Qnil; /* XXX: or something else? exception? */
40
50
  }
41
51
  }
42
52
 
43
53
  static VALUE
44
- treesortable_set_sort_column_id(int argc, VALUE *argv, VALUE self)
54
+ rg_set_sort_column_id(int argc, VALUE *argv, VALUE self)
45
55
  {
46
56
  gint sort_column_id;
47
57
  GtkSortType order;
48
58
 
49
59
  if (argc == 1 || argc == 2) {
50
- sort_column_id = NUM2INT(argv[0]);
51
- order = (argc == 2) ? RVAL2GENUM(argv[1], GTK_TYPE_SORT_TYPE) : GTK_SORT_ASCENDING;
60
+ sort_column_id = NUM2INT(argv[0]);
61
+ order = (argc == 2) ? RVAL2GENUM(argv[1], GTK_TYPE_SORT_TYPE) : GTK_SORT_ASCENDING;
52
62
  } else {
53
- rb_raise(rb_eArgError, "need 1 or 2 arguments.");
63
+ rb_raise(rb_eArgError, "need 1 or 2 arguments.");
54
64
  }
55
65
 
56
66
  gtk_tree_sortable_set_sort_column_id(_SELF(self), sort_column_id,
57
- order);
67
+ order);
58
68
  return self;
59
69
  }
60
70
 
@@ -64,50 +74,50 @@ sort_func(GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, gpointer func)
64
74
  a->user_data3 = model;
65
75
  b->user_data3 = model;
66
76
  return NUM2INT(rb_funcall((VALUE)func, id_call, 2, GTKTREEITER2RVAL(a),
67
- GTKTREEITER2RVAL(b)));
77
+ GTKTREEITER2RVAL(b)));
68
78
  }
69
79
 
70
80
  static VALUE
71
- treesortable_set_sort_func(VALUE self, VALUE sort_column_id)
81
+ rg_set_sort_func(VALUE self, VALUE sort_column_id)
72
82
  {
73
83
  volatile VALUE func = rb_block_proc();
74
84
  G_RELATIVE(self, func);
75
85
  gtk_tree_sortable_set_sort_func(_SELF(self), NUM2INT(sort_column_id),
76
- (GtkTreeIterCompareFunc)sort_func,
77
- (gpointer)func, NULL);
86
+ (GtkTreeIterCompareFunc)sort_func,
87
+ (gpointer)func, NULL);
78
88
  return self;
79
89
  }
80
90
 
81
91
  static VALUE
82
- treesortable_set_default_sort_func(VALUE self)
92
+ rg_set_default_sort_func(VALUE self)
83
93
  {
84
94
  volatile VALUE func = rb_block_proc();
85
95
  G_RELATIVE(self, func);
86
96
  gtk_tree_sortable_set_default_sort_func(_SELF(self),
87
- (GtkTreeIterCompareFunc)sort_func,
88
- (gpointer)func, NULL);
97
+ (GtkTreeIterCompareFunc)sort_func,
98
+ (gpointer)func, NULL);
89
99
  return self;
90
100
  }
91
101
 
92
102
  static VALUE
93
- treesortable_has_default_sort_func(VALUE self)
103
+ rg_has_default_sort_func_p(VALUE self)
94
104
  {
95
105
  return RVAL2CBOOL(gtk_tree_sortable_has_default_sort_func(_SELF(self)));
96
106
  }
97
107
 
98
108
  void
99
- Init_gtk_treesortable()
109
+ Init_gtk_treesortable(VALUE mGtk)
100
110
  {
101
- VALUE mts = G_DEF_INTERFACE(GTK_TYPE_TREE_SORTABLE, "TreeSortable", mGtk);
111
+ VALUE RG_TARGET_NAMESPACE = G_DEF_INTERFACE(GTK_TYPE_TREE_SORTABLE, "TreeSortable", mGtk);
102
112
 
103
- rb_define_method(mts, "sort_column_changed", treesortable_sort_column_changed, 0);
104
- rb_define_method(mts, "sort_column_id", treesortable_get_sort_column_id, 0);
105
- rb_define_method(mts, "set_sort_column_id", treesortable_set_sort_column_id, -1);
106
- rb_define_method(mts, "set_sort_func", treesortable_set_sort_func, 1);
107
- rb_define_method(mts, "set_default_sort_func", treesortable_set_default_sort_func, 0);
108
- rb_define_method(mts, "has_default_sort_func?", treesortable_has_default_sort_func, 0);
113
+ RG_DEF_METHOD(sort_column_changed, 0);
114
+ RG_DEF_METHOD(sort_column_id, 0);
115
+ RG_DEF_METHOD(set_sort_column_id, -1);
116
+ RG_DEF_METHOD(set_sort_func, 1);
117
+ RG_DEF_METHOD(set_default_sort_func, 0);
118
+ RG_DEF_METHOD_P(has_default_sort_func, 0);
109
119
 
110
- rb_define_const(mts, "DEFAULT_SORT_COLUMN_ID", GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID);
120
+ rb_define_const(RG_TARGET_NAMESPACE, "DEFAULT_SORT_COLUMN_ID", GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID);
111
121
  }
112
122
 
113
123
  /* vim: set sts=4 sw=4 ts=8: */