gtk2 0.20.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (281) hide show
  1. data/ChangeLog +6664 -0
  2. data/README +33 -0
  3. data/Rakefile +71 -0
  4. data/extconf.rb +116 -0
  5. data/src/global.h +33 -0
  6. data/src/init.c +39 -0
  7. data/src/lib/gtk2.rb +13 -0
  8. data/src/lib/gtk2/base.rb +95 -0
  9. data/src/makeinits.rb +57 -0
  10. data/src/makekeysyms.rb +5 -0
  11. data/src/rbgdk.c +395 -0
  12. data/src/rbgdk.h +50 -0
  13. data/src/rbgdkatom.c +122 -0
  14. data/src/rbgdkcairo.c +100 -0
  15. data/src/rbgdkcolor.c +151 -0
  16. data/src/rbgdkcolormap.c +142 -0
  17. data/src/rbgdkconst.c +29 -0
  18. data/src/rbgdkconversions.h +18 -0
  19. data/src/rbgdkcursor.c +115 -0
  20. data/src/rbgdkdevice.c +235 -0
  21. data/src/rbgdkdisplay.c +634 -0
  22. data/src/rbgdkdisplaymanager.c +50 -0
  23. data/src/rbgdkdragcontext.c +280 -0
  24. data/src/rbgdkdraw.c +487 -0
  25. data/src/rbgdkevent.c +1020 -0
  26. data/src/rbgdkgc.c +456 -0
  27. data/src/rbgdkgeometry.c +272 -0
  28. data/src/rbgdkimage.c +155 -0
  29. data/src/rbgdkinput.c +70 -0
  30. data/src/rbgdkkeymap.c +153 -0
  31. data/src/rbgdkkeysyms.h +2174 -0
  32. data/src/rbgdkkeyval.c +105 -0
  33. data/src/rbgdkpango.c +171 -0
  34. data/src/rbgdkpangorenderer.c +132 -0
  35. data/src/rbgdkpixbuf.c +178 -0
  36. data/src/rbgdkpixmap.c +255 -0
  37. data/src/rbgdkproperty.c +342 -0
  38. data/src/rbgdkrectangle.c +146 -0
  39. data/src/rbgdkregion.c +242 -0
  40. data/src/rbgdkrgb.c +197 -0
  41. data/src/rbgdkscreen.c +535 -0
  42. data/src/rbgdkselection.c +161 -0
  43. data/src/rbgdkthreads.c +68 -0
  44. data/src/rbgdktimecoord.c +118 -0
  45. data/src/rbgdkvisual.c +273 -0
  46. data/src/rbgdkwindow.c +1302 -0
  47. data/src/rbgdkwindowattr.c +213 -0
  48. data/src/rbgdkx11.c +256 -0
  49. data/src/rbgtk.c +93 -0
  50. data/src/rbgtk.h +121 -0
  51. data/src/rbgtkaboutdialog.c +195 -0
  52. data/src/rbgtkaccelerator.c +78 -0
  53. data/src/rbgtkaccelgroup.c +216 -0
  54. data/src/rbgtkaccelgroupentry.c +85 -0
  55. data/src/rbgtkaccelkey.c +116 -0
  56. data/src/rbgtkaccellabel.c +46 -0
  57. data/src/rbgtkaccelmap.c +162 -0
  58. data/src/rbgtkaccessible.c +29 -0
  59. data/src/rbgtkaction.c +277 -0
  60. data/src/rbgtkactiongroup.c +377 -0
  61. data/src/rbgtkadjustment.c +153 -0
  62. data/src/rbgtkalignment.c +71 -0
  63. data/src/rbgtkallocation.c +171 -0
  64. data/src/rbgtkarrow.c +47 -0
  65. data/src/rbgtkaspectframe.c +46 -0
  66. data/src/rbgtkassistant.c +230 -0
  67. data/src/rbgtkbbox.c +47 -0
  68. data/src/rbgtkbin.c +31 -0
  69. data/src/rbgtkbindingset.c +192 -0
  70. data/src/rbgtkborder.c +80 -0
  71. data/src/rbgtkbox.c +142 -0
  72. data/src/rbgtkbuildable.c +115 -0
  73. data/src/rbgtkbuilder.c +154 -0
  74. data/src/rbgtkbutton.c +151 -0
  75. data/src/rbgtkcalendar.c +159 -0
  76. data/src/rbgtkcelleditable.c +49 -0
  77. data/src/rbgtkcelllayout.c +144 -0
  78. data/src/rbgtkcellrenderer.c +139 -0
  79. data/src/rbgtkcellrendereraccel.c +42 -0
  80. data/src/rbgtkcellrenderercombo.c +37 -0
  81. data/src/rbgtkcellrendererpixbuf.c +33 -0
  82. data/src/rbgtkcellrendererprogress.c +37 -0
  83. data/src/rbgtkcellrendererspin.c +38 -0
  84. data/src/rbgtkcellrenderertext.c +45 -0
  85. data/src/rbgtkcellrenderertoggle.c +32 -0
  86. data/src/rbgtkcellview.c +134 -0
  87. data/src/rbgtkcheckbutton.c +55 -0
  88. data/src/rbgtkcheckmenuitem.c +56 -0
  89. data/src/rbgtkclipboard.c +473 -0
  90. data/src/rbgtkcolorbutton.c +63 -0
  91. data/src/rbgtkcolorsel.c +175 -0
  92. data/src/rbgtkcolorselectiondialog.c +72 -0
  93. data/src/rbgtkcombo.c +117 -0
  94. data/src/rbgtkcombobox.c +240 -0
  95. data/src/rbgtkcomboboxentry.c +60 -0
  96. data/src/rbgtkconst.c +163 -0
  97. data/src/rbgtkcontainer.c +776 -0
  98. data/src/rbgtkconversions.h +26 -0
  99. data/src/rbgtkcurve.c +105 -0
  100. data/src/rbgtkdialog.c +244 -0
  101. data/src/rbgtkdrag.c +436 -0
  102. data/src/rbgtkdrawingarea.c +31 -0
  103. data/src/rbgtkeditable.c +152 -0
  104. data/src/rbgtkentry.c +161 -0
  105. data/src/rbgtkentrycompletion.c +167 -0
  106. data/src/rbgtkeventbox.c +31 -0
  107. data/src/rbgtkexpander.c +67 -0
  108. data/src/rbgtkfilechooser.c +403 -0
  109. data/src/rbgtkfilechooserbutton.c +72 -0
  110. data/src/rbgtkfilechooserdialog.c +58 -0
  111. data/src/rbgtkfilechooserwidget.c +50 -0
  112. data/src/rbgtkfilefilter.c +139 -0
  113. data/src/rbgtkfilesel.c +155 -0
  114. data/src/rbgtkfixed.c +72 -0
  115. data/src/rbgtkfontbutton.c +69 -0
  116. data/src/rbgtkfontselection.c +30 -0
  117. data/src/rbgtkfontselectiondialog.c +106 -0
  118. data/src/rbgtkframe.c +64 -0
  119. data/src/rbgtkgamma.c +47 -0
  120. data/src/rbgtkhandlebox.c +42 -0
  121. data/src/rbgtkhbbox.c +31 -0
  122. data/src/rbgtkhbox.c +38 -0
  123. data/src/rbgtkhpaned.c +31 -0
  124. data/src/rbgtkhruler.c +31 -0
  125. data/src/rbgtkhscale.c +45 -0
  126. data/src/rbgtkhscrollbar.c +38 -0
  127. data/src/rbgtkhseparator.c +30 -0
  128. data/src/rbgtkiconfactory.c +80 -0
  129. data/src/rbgtkiconinfo.c +118 -0
  130. data/src/rbgtkiconset.c +87 -0
  131. data/src/rbgtkiconsize.c +90 -0
  132. data/src/rbgtkiconsource.c +176 -0
  133. data/src/rbgtkicontheme.c +309 -0
  134. data/src/rbgtkiconview.c +351 -0
  135. data/src/rbgtkimage.c +152 -0
  136. data/src/rbgtkimagemenuitem.c +52 -0
  137. data/src/rbgtkimcontext.c +134 -0
  138. data/src/rbgtkimcontextsimple.c +48 -0
  139. data/src/rbgtkimmulticontext.c +38 -0
  140. data/src/rbgtkinits.c +473 -0
  141. data/src/rbgtkinputdialog.c +30 -0
  142. data/src/rbgtkinvisible.c +68 -0
  143. data/src/rbgtkitem.c +51 -0
  144. data/src/rbgtkitemfactory.c +312 -0
  145. data/src/rbgtklabel.c +168 -0
  146. data/src/rbgtklayout.c +91 -0
  147. data/src/rbgtklinkbutton.c +68 -0
  148. data/src/rbgtkliststore.c +412 -0
  149. data/src/rbgtkmacros.h +26 -0
  150. data/src/rbgtkmain.c +532 -0
  151. data/src/rbgtkmenu.c +272 -0
  152. data/src/rbgtkmenubar.c +48 -0
  153. data/src/rbgtkmenuitem.c +171 -0
  154. data/src/rbgtkmenushell.c +128 -0
  155. data/src/rbgtkmenutoolbutton.c +74 -0
  156. data/src/rbgtkmessagedialog.c +102 -0
  157. data/src/rbgtkmisc.c +63 -0
  158. data/src/rbgtknotebook.c +484 -0
  159. data/src/rbgtkobject.c +186 -0
  160. data/src/rbgtkoptionmenu.c +65 -0
  161. data/src/rbgtkpagesetup.c +196 -0
  162. data/src/rbgtkpagesetupunixdialog.c +80 -0
  163. data/src/rbgtkpaned.c +114 -0
  164. data/src/rbgtkpapersize.c +186 -0
  165. data/src/rbgtkplug.c +84 -0
  166. data/src/rbgtkprintcontext.c +124 -0
  167. data/src/rbgtkprinter.c +155 -0
  168. data/src/rbgtkprintjob.c +151 -0
  169. data/src/rbgtkprintoperation.c +152 -0
  170. data/src/rbgtkprintoperationpreview.c +54 -0
  171. data/src/rbgtkprintsettings.c +794 -0
  172. data/src/rbgtkprintunixdialog.c +98 -0
  173. data/src/rbgtkprogress.c +21 -0
  174. data/src/rbgtkprogressbar.c +72 -0
  175. data/src/rbgtkradioaction.c +102 -0
  176. data/src/rbgtkradiobutton.c +83 -0
  177. data/src/rbgtkradiomenuitem.c +115 -0
  178. data/src/rbgtkradiotoolbutton.c +99 -0
  179. data/src/rbgtkrange.c +98 -0
  180. data/src/rbgtkrc.c +228 -0
  181. data/src/rbgtkrcstyle.c +184 -0
  182. data/src/rbgtkrecentaction.c +52 -0
  183. data/src/rbgtkrecentchooser.c +276 -0
  184. data/src/rbgtkrecentchooserdialog.c +59 -0
  185. data/src/rbgtkrecentchoosermenu.c +55 -0
  186. data/src/rbgtkrecentchooserwidget.c +45 -0
  187. data/src/rbgtkrecentdata.c +152 -0
  188. data/src/rbgtkrecentfilter.c +180 -0
  189. data/src/rbgtkrecentfilterinfo.c +197 -0
  190. data/src/rbgtkrecentinfo.c +232 -0
  191. data/src/rbgtkrecentmanager.c +164 -0
  192. data/src/rbgtkruler.c +82 -0
  193. data/src/rbgtkscale.c +47 -0
  194. data/src/rbgtkscalebutton.c +115 -0
  195. data/src/rbgtkscrollbar.c +21 -0
  196. data/src/rbgtkscrolledwindow.c +160 -0
  197. data/src/rbgtkselection.c +171 -0
  198. data/src/rbgtkselectiondata.c +333 -0
  199. data/src/rbgtkseparator.c +21 -0
  200. data/src/rbgtkseparatormenuitem.c +28 -0
  201. data/src/rbgtkseparatortoolitem.c +40 -0
  202. data/src/rbgtksettings.c +225 -0
  203. data/src/rbgtksizegroup.c +74 -0
  204. data/src/rbgtksocket.c +72 -0
  205. data/src/rbgtkspinbutton.c +138 -0
  206. data/src/rbgtkstatusbar.c +90 -0
  207. data/src/rbgtkstatusicon.c +120 -0
  208. data/src/rbgtkstock.c +264 -0
  209. data/src/rbgtkstyle.c +722 -0
  210. data/src/rbgtktable.c +190 -0
  211. data/src/rbgtktargetlist.c +148 -0
  212. data/src/rbgtktearoffmenuitem.c +30 -0
  213. data/src/rbgtktextappearance.c +173 -0
  214. data/src/rbgtktextattributes.c +209 -0
  215. data/src/rbgtktextbuffer.c +993 -0
  216. data/src/rbgtktextchild.c +49 -0
  217. data/src/rbgtktextiter.c +553 -0
  218. data/src/rbgtktextmark.c +87 -0
  219. data/src/rbgtktexttag.c +66 -0
  220. data/src/rbgtktexttagtable.c +94 -0
  221. data/src/rbgtktextview.c +351 -0
  222. data/src/rbgtktoggleaction.c +76 -0
  223. data/src/rbgtktogglebutton.c +84 -0
  224. data/src/rbgtktoggletoolbutton.c +70 -0
  225. data/src/rbgtktoolbar.c +373 -0
  226. data/src/rbgtktoolbutton.c +75 -0
  227. data/src/rbgtktoolitem.c +184 -0
  228. data/src/rbgtktooltip.c +76 -0
  229. data/src/rbgtktooltips.c +107 -0
  230. data/src/rbgtktreedragdest.c +19 -0
  231. data/src/rbgtktreedragsource.c +19 -0
  232. data/src/rbgtktreeiter.c +259 -0
  233. data/src/rbgtktreemodel.c +256 -0
  234. data/src/rbgtktreemodelfilter.c +214 -0
  235. data/src/rbgtktreemodelsort.c +113 -0
  236. data/src/rbgtktreepath.c +195 -0
  237. data/src/rbgtktreerowreference.c +168 -0
  238. data/src/rbgtktreeselection.c +235 -0
  239. data/src/rbgtktreesortable.c +127 -0
  240. data/src/rbgtktreestore.c +379 -0
  241. data/src/rbgtktreeview.c +881 -0
  242. data/src/rbgtktreeviewcolumn.c +331 -0
  243. data/src/rbgtkuimanager.c +210 -0
  244. data/src/rbgtkvbbox.c +31 -0
  245. data/src/rbgtkvbox.c +38 -0
  246. data/src/rbgtkviewport.c +33 -0
  247. data/src/rbgtkvolumebutton.c +36 -0
  248. data/src/rbgtkvpaned.c +31 -0
  249. data/src/rbgtkvruler.c +30 -0
  250. data/src/rbgtkvscale.c +45 -0
  251. data/src/rbgtkvscrollbar.c +38 -0
  252. data/src/rbgtkvseparator.c +30 -0
  253. data/src/rbgtkwidget.c +1414 -0
  254. data/src/rbgtkwindow.c +822 -0
  255. data/src/rbgtkwindowgroup.c +48 -0
  256. data/test/gtk-test-utils.rb +15 -0
  257. data/test/run-test.rb +30 -0
  258. data/test/test_gc.rb +25 -0
  259. data/test/test_gdk.rb +18 -0
  260. data/test/test_gdk_color.rb +10 -0
  261. data/test/test_gdk_display.rb +37 -0
  262. data/test/test_gdk_event.rb +11 -0
  263. data/test/test_gdk_gc.rb +7 -0
  264. data/test/test_gdk_keymap.rb +8 -0
  265. data/test/test_gdk_pango.rb +9 -0
  266. data/test/test_gdk_selection_data.rb +17 -0
  267. data/test/test_gdk_window.rb +29 -0
  268. data/test/test_gdk_window_attribute.rb +9 -0
  269. data/test/test_gtk_about_dialog.rb +14 -0
  270. data/test/test_gtk_buildable.rb +66 -0
  271. data/test/test_gtk_builder.rb +188 -0
  272. data/test/test_gtk_entry.rb +18 -0
  273. data/test/test_gtk_icon_theme.rb +30 -0
  274. data/test/test_gtk_image.rb +8 -0
  275. data/test/test_gtk_list_store.rb +65 -0
  276. data/test/test_gtk_menu_item.rb +13 -0
  277. data/test/test_gtk_rc_style.rb +14 -0
  278. data/test/test_gtk_tree_path.rb +20 -0
  279. data/test/test_gtk_unix_print.rb +14 -0
  280. data/test/test_gtk_widget.rb +32 -0
  281. metadata +393 -0
@@ -0,0 +1,54 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /************************************************
3
+
4
+ rbgtkprintoperationpreview.c -
5
+
6
+ $Author: mutoh $
7
+ $Date: 2006/11/03 19:40:44 $
8
+
9
+ Copyright (C) 2006 Ruby-GNOME2 Project Team
10
+ ************************************************/
11
+
12
+ #include "global.h"
13
+
14
+ #if GTK_CHECK_VERSION(2,10,0)
15
+ #define _SELF(s) (GTK_PRINT_OPERATION_PREVIEW(RVAL2GOBJ(s)))
16
+
17
+ static VALUE
18
+ pop_render_page(VALUE self, VALUE page_number)
19
+ {
20
+ gtk_print_operation_preview_render_page(_SELF(self), NUM2INT(page_number));
21
+ return self;
22
+ }
23
+
24
+ static VALUE
25
+ pop_end_preview(VALUE self)
26
+ {
27
+ gtk_print_operation_preview_end_preview(_SELF(self));
28
+ return self;
29
+ }
30
+
31
+ static VALUE
32
+ pop_is_selected(VALUE self, VALUE page_number)
33
+ {
34
+ gboolean selected;
35
+ selected = gtk_print_operation_preview_is_selected(_SELF(self),
36
+ NUM2INT(page_number));
37
+ return CBOOL2RVAL(selected);
38
+ }
39
+ #endif
40
+
41
+ void
42
+ Init_gtk_print_operation_preview()
43
+ {
44
+ #if GTK_CHECK_VERSION(2,10,0)
45
+ VALUE gPrintOperationPreview = G_DEF_CLASS(GTK_TYPE_PRINT_OPERATION_PREVIEW,
46
+ "PrintOperationPreview", mGtk);
47
+
48
+ rb_define_method(gPrintOperationPreview, "render_page", pop_render_page, 1);
49
+ rb_define_method(gPrintOperationPreview, "end_preview", pop_end_preview, 0);
50
+ rb_define_method(gPrintOperationPreview, "selected?", pop_is_selected, 1);
51
+
52
+ G_DEF_SETTERS(gPrintOperationPreview);
53
+ #endif
54
+ }
@@ -0,0 +1,794 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /************************************************
3
+
4
+ rbgtkprintsettings.c -
5
+
6
+ $Author: ggc $
7
+ $Date: 2007/07/13 16:07:31 $
8
+
9
+ Copyright (C) 2006 Ruby-GNOME2 Project Team
10
+ ************************************************/
11
+
12
+ #include "global.h"
13
+
14
+ #if GTK_CHECK_VERSION(2,10,0)
15
+
16
+ #define _SELF(s) (GTK_PRINT_SETTINGS(RVAL2GOBJ(s)))
17
+
18
+ #define RVAL2UNIT(o) (RVAL2GENUM(o, GTK_TYPE_UNIT))
19
+
20
+ static VALUE s_string, s_bool, s_double, s_length, s_int;
21
+
22
+ #if GTK_CHECK_VERSION(2,12,0)
23
+ static VALUE
24
+ ps_initialize(argc, argv, self)
25
+ int argc;
26
+ VALUE *argv;
27
+ VALUE self;
28
+ {
29
+ VALUE arg1, arg2;
30
+ GtkPrintSettings* settings = NULL;
31
+ GError *error = NULL;
32
+ rb_scan_args(argc, argv, "02", &arg1, &arg2);
33
+ if (NIL_P(arg1)){
34
+ settings = gtk_print_settings_new();
35
+ } else if (NIL_P(arg2)){
36
+ settings = gtk_print_settings_new_from_file(RVAL2CSTR(arg1), &error);
37
+ if (!settings) {
38
+ RAISE_GERROR(error);
39
+ }
40
+ } else {
41
+ settings = gtk_print_settings_new_from_key_file((GKeyFile*)RVAL2BOXED(arg1, G_TYPE_KEY_FILE),
42
+ RVAL2CSTR(arg2),
43
+ &error);
44
+ if (!settings) {
45
+ RAISE_GERROR(error);
46
+ }
47
+ }
48
+ G_INITIALIZE(self, settings);
49
+ return Qnil;
50
+ }
51
+ #else
52
+ static VALUE
53
+ ps_initialize(VALUE self)
54
+ {
55
+ G_INITIALIZE(self, gtk_print_settings_new());
56
+ return Qnil;
57
+ }
58
+ #endif
59
+
60
+ static VALUE
61
+ ps_copy(VALUE self)
62
+ {
63
+ return GOBJ2RVALU(gtk_print_settings_copy(_SELF(self)));
64
+ }
65
+
66
+ static VALUE
67
+ ps_has_key(VALUE self, VALUE key)
68
+ {
69
+ return CBOOL2RVAL(gtk_print_settings_has_key(_SELF(self), RVAL2CSTR(key)));
70
+ }
71
+
72
+ static VALUE
73
+ ps_get(VALUE self, VALUE key)
74
+ {
75
+ return CSTR2RVAL(gtk_print_settings_get(_SELF(self), RVAL2CSTR(key)));
76
+ }
77
+
78
+ static VALUE
79
+ ps_set(VALUE self, VALUE key, VALUE value)
80
+ {
81
+ gtk_print_settings_set(_SELF(self), RVAL2CSTR(key), RVAL2CSTR2(value));
82
+ return self;
83
+ }
84
+
85
+ static VALUE
86
+ ps_unset(VALUE self, VALUE key)
87
+ {
88
+ gtk_print_settings_unset(_SELF(self), RVAL2CSTR(key));
89
+ return self;
90
+ }
91
+
92
+ static void
93
+ ps_foreach_cb(const gchar *key, const gchar *value, gpointer data)
94
+ {
95
+ rb_funcall((VALUE)data, id_call, 2, CSTR2RVAL(key), CSTR2RVAL(value));
96
+ }
97
+
98
+ static VALUE
99
+ ps_foreach(VALUE self)
100
+ {
101
+ gtk_print_settings_foreach(_SELF(self), ps_foreach_cb,
102
+ (gpointer)rb_block_proc());
103
+ return self;
104
+ }
105
+
106
+ static VALUE
107
+ ps_get_bool(VALUE self, VALUE key)
108
+ {
109
+ return CBOOL2RVAL(gtk_print_settings_get_bool(_SELF(self), RVAL2CSTR(key)));
110
+ }
111
+
112
+ static VALUE
113
+ ps_set_bool(VALUE self, VALUE key, VALUE value)
114
+ {
115
+ gtk_print_settings_set_bool(_SELF(self), RVAL2CSTR(key), RVAL2CBOOL(value));
116
+ return self;
117
+ }
118
+
119
+ static VALUE
120
+ ps_get_double(int argc, VALUE *argv, VALUE self)
121
+ {
122
+ VALUE key, default_value;
123
+ gdouble value;
124
+
125
+ rb_scan_args(argc, argv, "11", &key, &default_value);
126
+ if (NIL_P(default_value))
127
+ value = gtk_print_settings_get_double(_SELF(self), RVAL2CSTR(key));
128
+ else
129
+ value = gtk_print_settings_get_double_with_default(_SELF(self),
130
+ RVAL2CSTR(key),
131
+ NUM2DBL(default_value));
132
+
133
+ return rb_float_new(value);
134
+ }
135
+
136
+ static VALUE
137
+ ps_set_double(VALUE self, VALUE key, VALUE value)
138
+ {
139
+ gtk_print_settings_set_double(_SELF(self), RVAL2CSTR(key), NUM2DBL(value));
140
+ return self;
141
+ }
142
+
143
+ static VALUE
144
+ ps_get_length(VALUE self, VALUE key, VALUE unit)
145
+ {
146
+ return rb_float_new(gtk_print_settings_get_length(_SELF(self),
147
+ RVAL2CSTR(key),
148
+ RVAL2UNIT(unit)));
149
+ }
150
+
151
+ static VALUE
152
+ ps_set_length(VALUE self, VALUE key, VALUE value, VALUE unit)
153
+ {
154
+ gtk_print_settings_set_length(_SELF(self), RVAL2CSTR(key),
155
+ NUM2DBL(value), RVAL2UNIT(unit));
156
+ return self;
157
+ }
158
+
159
+ static VALUE
160
+ ps_get_int(int argc, VALUE *argv, VALUE self)
161
+ {
162
+ VALUE key, default_value;
163
+ gint value;
164
+
165
+ rb_scan_args(argc, argv, "11", &key, &default_value);
166
+ if (NIL_P(default_value))
167
+ value = gtk_print_settings_get_int(_SELF(self), RVAL2CSTR(key));
168
+ else
169
+ value = gtk_print_settings_get_int_with_default(_SELF(self),
170
+ RVAL2CSTR(key),
171
+ NUM2INT(default_value));
172
+
173
+ return INT2NUM(value);
174
+ }
175
+
176
+ static VALUE
177
+ ps_set_int(VALUE self, VALUE key, VALUE value)
178
+ {
179
+ gtk_print_settings_set_int(_SELF(self), RVAL2CSTR(key), NUM2INT(value));
180
+ return self;
181
+ }
182
+
183
+ static VALUE
184
+ ps_get_generic(int argc, VALUE *argv, VALUE self)
185
+ {
186
+ VALUE key, type, unit_or_default, result;
187
+
188
+ rb_scan_args(argc, argv, "12", &key, &type, &unit_or_default);
189
+
190
+ if (NIL_P(type) || (RVAL2CBOOL(rb_equal(type, s_string)))) {
191
+ result = ps_get(self, key);
192
+ } else if (RVAL2CBOOL(rb_equal(type, s_bool))) {
193
+ result = ps_get_bool(self, key);
194
+ } else if (RVAL2CBOOL(rb_equal(type, s_double))) {
195
+ VALUE double_argv[2];
196
+ double_argv[0] = key;
197
+ double_argv[1] = unit_or_default;
198
+ result = ps_get_double(2, double_argv, self);
199
+ } else if (RVAL2CBOOL(rb_equal(type, s_length))) {
200
+ result = ps_get_length(self, key, unit_or_default);
201
+ } else if (RVAL2CBOOL(rb_equal(type, s_int))) {
202
+ VALUE int_argv[2];
203
+ int_argv[0] = key;
204
+ int_argv[1] = unit_or_default;
205
+ result = ps_get_int(2, int_argv, self);
206
+ } else {
207
+ VALUE inspected_type;
208
+ inspected_type = rb_inspect(type);
209
+ rb_raise(rb_eArgError,
210
+ "%s must be nil, :string, :bool, :double, :length or :int",
211
+ RVAL2CSTR(inspected_type));
212
+ }
213
+
214
+ return result;
215
+ }
216
+
217
+ static VALUE
218
+ ps_set_generic(int argc, VALUE *argv, VALUE self)
219
+ {
220
+ VALUE key, value, unit;
221
+
222
+ rb_scan_args(argc, argv, "21", &key, &value, &unit);
223
+
224
+ switch (TYPE(value)) {
225
+ case T_STRING:
226
+ ps_set(self, key, value);
227
+ break;
228
+ case T_TRUE:
229
+ case T_FALSE:
230
+ ps_set_bool(self, key, value);
231
+ break;
232
+ case T_FIXNUM:
233
+ ps_set_int(self, key, value);
234
+ break;
235
+ case T_FLOAT:
236
+ if (NIL_P(unit)) {
237
+ ps_set_double(self, key, value);
238
+ } else {
239
+ ps_set_length(self, key, value, unit);
240
+ }
241
+ break;
242
+ case T_NIL:
243
+ ps_unset(self, key);
244
+ break;
245
+ default:
246
+ {
247
+ VALUE inspected_value;
248
+ inspected_value = rb_inspect(value);
249
+ rb_raise(rb_eArgError,
250
+ "%s is invalid value", RVAL2CSTR(inspected_value));
251
+ break;
252
+ }
253
+ }
254
+
255
+ return self;
256
+ }
257
+
258
+ static VALUE
259
+ ps_set_generic_indexer(int argc, VALUE *argv, VALUE self)
260
+ {
261
+ if (argc == 3) {
262
+ VALUE swapped_argv[3];
263
+ swapped_argv[0] = argv[0];
264
+ swapped_argv[1] = argv[2];
265
+ swapped_argv[2] = argv[1];
266
+ ps_set_generic(argc, swapped_argv, self);
267
+ } else if (argc == 2) {
268
+ ps_set_generic(argc, argv, self);
269
+ } else {
270
+ rb_raise(rb_eArgError,
271
+ "wrong number of arguments (%d for 2 or 3)", argc);
272
+ }
273
+
274
+ return argv[2];
275
+ }
276
+
277
+
278
+ /* Helpers: */
279
+ static VALUE
280
+ ps_get_printer(VALUE self)
281
+ {
282
+ return CSTR2RVAL(gtk_print_settings_get_printer(_SELF(self)));
283
+ }
284
+
285
+ static VALUE
286
+ ps_set_printer(VALUE self, VALUE printer)
287
+ {
288
+ gtk_print_settings_set_printer(_SELF(self), RVAL2CSTR2(printer));
289
+ return self;
290
+ }
291
+
292
+ static VALUE
293
+ ps_get_orientation(VALUE self)
294
+ {
295
+ return GENUM2RVAL(gtk_print_settings_get_orientation(_SELF(self)),
296
+ GTK_TYPE_PAGE_ORIENTATION);
297
+ }
298
+
299
+ static VALUE
300
+ ps_set_orientation(VALUE self, VALUE orientation)
301
+ {
302
+ gtk_print_settings_set_orientation(_SELF(self),
303
+ RVAL2GENUM(orientation, GTK_TYPE_PAGE_ORIENTATION));
304
+ return self;
305
+ }
306
+
307
+ static VALUE
308
+ ps_get_paper_size(VALUE self)
309
+ {
310
+ return GOBJ2RVAL(gtk_print_settings_get_paper_size(_SELF(self)));
311
+ }
312
+
313
+ static VALUE
314
+ ps_set_paper_size(VALUE self, VALUE paper_size)
315
+ {
316
+ gtk_print_settings_set_paper_size(_SELF(self),
317
+ RVAL2BOXED(paper_size, GTK_TYPE_PAPER_SIZE));
318
+ return self;
319
+ }
320
+
321
+ static VALUE
322
+ ps_get_paper_width(VALUE self, VALUE unit)
323
+ {
324
+ return rb_float_new(gtk_print_settings_get_paper_width(_SELF(self),
325
+ RVAL2UNIT(unit)));
326
+ }
327
+
328
+ static VALUE
329
+ ps_set_paper_width(VALUE self, VALUE paper_width, VALUE unit)
330
+ {
331
+ gtk_print_settings_set_paper_width(_SELF(self), NUM2DBL(paper_width),
332
+ RVAL2UNIT(unit));
333
+ return self;
334
+ }
335
+
336
+ static VALUE
337
+ ps_get_paper_height(VALUE self, VALUE unit)
338
+ {
339
+ return rb_float_new(gtk_print_settings_get_paper_height(_SELF(self),
340
+ RVAL2UNIT(unit)));
341
+ }
342
+
343
+ static VALUE
344
+ ps_set_paper_height(VALUE self, VALUE paper_height, VALUE unit)
345
+ {
346
+ gtk_print_settings_set_paper_height(_SELF(self), NUM2DBL(paper_height),
347
+ RVAL2UNIT(unit));
348
+ return self;
349
+ }
350
+
351
+ static VALUE
352
+ ps_get_use_color(VALUE self)
353
+ {
354
+ return CBOOL2RVAL(gtk_print_settings_get_use_color(_SELF(self)));
355
+ }
356
+
357
+ static VALUE
358
+ ps_set_use_color(VALUE self, VALUE use_color)
359
+ {
360
+ gtk_print_settings_set_use_color(_SELF(self), RVAL2CBOOL(use_color));
361
+ return self;
362
+ }
363
+
364
+ static VALUE
365
+ ps_get_collate(VALUE self)
366
+ {
367
+ return CBOOL2RVAL(gtk_print_settings_get_collate(_SELF(self)));
368
+ }
369
+
370
+ static VALUE
371
+ ps_set_collate(VALUE self, VALUE collate)
372
+ {
373
+ gtk_print_settings_set_collate(_SELF(self), RVAL2CBOOL(collate));
374
+ return self;
375
+ }
376
+
377
+ static VALUE
378
+ ps_get_reverse(VALUE self)
379
+ {
380
+ return CBOOL2RVAL(gtk_print_settings_get_reverse(_SELF(self)));
381
+ }
382
+
383
+ static VALUE
384
+ ps_set_reverse(VALUE self, VALUE reverse)
385
+ {
386
+ gtk_print_settings_set_reverse(_SELF(self), RVAL2CBOOL(reverse));
387
+ return self;
388
+ }
389
+
390
+ static VALUE
391
+ ps_get_duplex(VALUE self)
392
+ {
393
+ return GENUM2RVAL(gtk_print_settings_get_duplex(_SELF(self)),
394
+ GTK_TYPE_PRINT_DUPLEX);
395
+ }
396
+
397
+ static VALUE
398
+ ps_set_duplex(VALUE self, VALUE duplex)
399
+ {
400
+ gtk_print_settings_set_duplex(_SELF(self),
401
+ RVAL2GENUM(duplex, GTK_TYPE_PRINT_DUPLEX));
402
+ return self;
403
+ }
404
+
405
+ static VALUE
406
+ ps_get_quality(VALUE self)
407
+ {
408
+ return GENUM2RVAL(gtk_print_settings_get_quality(_SELF(self)),
409
+ GTK_TYPE_PRINT_QUALITY);
410
+ }
411
+
412
+ static VALUE
413
+ ps_set_quality(VALUE self, VALUE quality)
414
+ {
415
+ gtk_print_settings_set_quality(_SELF(self),
416
+ RVAL2GENUM(quality, GTK_TYPE_PRINT_QUALITY));
417
+ return self;
418
+ }
419
+
420
+ static VALUE
421
+ ps_get_n_copies(VALUE self)
422
+ {
423
+ return INT2NUM(gtk_print_settings_get_n_copies(_SELF(self)));
424
+ }
425
+
426
+ static VALUE
427
+ ps_set_n_copies(VALUE self, VALUE n_copies)
428
+ {
429
+ gtk_print_settings_set_n_copies(_SELF(self), NUM2INT(n_copies));
430
+ return self;
431
+ }
432
+
433
+ static VALUE
434
+ ps_get_number_up(VALUE self)
435
+ {
436
+ return INT2NUM(gtk_print_settings_get_number_up(_SELF(self)));
437
+ }
438
+
439
+ static VALUE
440
+ ps_set_number_up(VALUE self, VALUE number_up)
441
+ {
442
+ gtk_print_settings_set_number_up(_SELF(self), NUM2INT(number_up));
443
+ return self;
444
+ }
445
+
446
+ static VALUE
447
+ ps_get_resolution(VALUE self)
448
+ {
449
+ return INT2NUM(gtk_print_settings_get_resolution(_SELF(self)));
450
+ }
451
+
452
+ static VALUE
453
+ ps_set_resolution(VALUE self, VALUE resolution)
454
+ {
455
+ gtk_print_settings_set_resolution(_SELF(self), NUM2INT(resolution));
456
+ return self;
457
+ }
458
+
459
+ static VALUE
460
+ ps_get_scale(VALUE self)
461
+ {
462
+ return rb_float_new(gtk_print_settings_get_scale(_SELF(self)));
463
+ }
464
+
465
+ static VALUE
466
+ ps_set_scale(VALUE self, VALUE scale)
467
+ {
468
+ gtk_print_settings_set_scale(_SELF(self), NUM2DBL(scale));
469
+ return self;
470
+ }
471
+
472
+ static VALUE
473
+ ps_get_print_pages(VALUE self)
474
+ {
475
+ return GENUM2RVAL(gtk_print_settings_get_print_pages(_SELF(self)),
476
+ GTK_TYPE_PRINT_PAGES);
477
+ }
478
+
479
+ static VALUE
480
+ ps_set_print_pages(VALUE self, VALUE print_pages)
481
+ {
482
+ gtk_print_settings_set_print_pages(_SELF(self), RVAL2GENUM(print_pages, GTK_TYPE_PRINT_PAGES));
483
+ return self;
484
+ }
485
+
486
+ static VALUE
487
+ ps_get_page_ranges(VALUE self)
488
+ {
489
+ VALUE rb_ranges;
490
+ GtkPageRange *ranges;
491
+ int i, num_ranges;
492
+
493
+ ranges = gtk_print_settings_get_page_ranges(_SELF(self), &num_ranges);
494
+
495
+ rb_ranges = rb_ary_new2(num_ranges);
496
+ for (i = 0; i < num_ranges; i++) {
497
+ rb_ary_push(rb_ranges,
498
+ rb_ary_new3(2,
499
+ INT2NUM(ranges[i].start),
500
+ INT2NUM(ranges[i].end)));
501
+ }
502
+ g_free(ranges);
503
+ return rb_ranges;
504
+ }
505
+
506
+ static VALUE
507
+ ps_set_page_ranges(VALUE self, VALUE rb_page_ranges)
508
+ {
509
+ GtkPageRange *page_ranges;
510
+ gint i, num_ranges;
511
+
512
+ num_ranges = RARRAY_LEN(rb_page_ranges);
513
+ page_ranges = ALLOCA_N(GtkPageRange, num_ranges);
514
+ for (i = 0; i < num_ranges; i++) {
515
+ VALUE page_range;
516
+ page_range = RARRAY_PTR(rb_page_ranges)[i];
517
+ page_ranges[i].start = NUM2INT(RARRAY_PTR(page_range)[0]);
518
+ page_ranges[i].end = NUM2INT(RARRAY_PTR(page_range)[1]);
519
+ }
520
+ gtk_print_settings_set_page_ranges(_SELF(self), page_ranges, num_ranges);
521
+ return self;
522
+ }
523
+
524
+ static VALUE
525
+ ps_get_page_set(VALUE self)
526
+ {
527
+ return GENUM2RVAL(gtk_print_settings_get_page_set(_SELF(self)),
528
+ GTK_TYPE_PAGE_SET);
529
+ }
530
+
531
+ static VALUE
532
+ ps_set_page_set(VALUE self, VALUE page_set)
533
+ {
534
+ gtk_print_settings_set_page_set(_SELF(self),
535
+ RVAL2GENUM(page_set, GTK_TYPE_PAGE_SET));
536
+ return self;
537
+ }
538
+
539
+ static VALUE
540
+ ps_get_default_source(VALUE self)
541
+ {
542
+ return CSTR2RVAL(gtk_print_settings_get_default_source(_SELF(self)));
543
+ }
544
+
545
+ static VALUE
546
+ ps_set_default_source(VALUE self, VALUE default_source)
547
+ {
548
+ gtk_print_settings_set_default_source(_SELF(self),
549
+ RVAL2CSTR2(default_source));
550
+ return self;
551
+ }
552
+
553
+ static VALUE
554
+ ps_get_media_type(VALUE self)
555
+ {
556
+ return CSTR2RVAL(gtk_print_settings_get_media_type(_SELF(self)));
557
+ }
558
+
559
+ static VALUE
560
+ ps_set_media_type(VALUE self, VALUE media_type)
561
+ {
562
+ gtk_print_settings_set_media_type(_SELF(self), RVAL2CSTR2(media_type));
563
+ return self;
564
+ }
565
+
566
+ static VALUE
567
+ ps_get_dither(VALUE self)
568
+ {
569
+ return CSTR2RVAL(gtk_print_settings_get_dither(_SELF(self)));
570
+ }
571
+
572
+ static VALUE
573
+ ps_set_dither(VALUE self, VALUE dither)
574
+ {
575
+ gtk_print_settings_set_dither(_SELF(self), RVAL2CSTR2(dither));
576
+ return self;
577
+ }
578
+
579
+ static VALUE
580
+ ps_get_finishings(VALUE self)
581
+ {
582
+ return CSTR2RVAL(gtk_print_settings_get_finishings(_SELF(self)));
583
+ }
584
+
585
+ static VALUE
586
+ ps_set_finishings(VALUE self, VALUE finishings)
587
+ {
588
+ gtk_print_settings_set_finishings(_SELF(self), RVAL2CSTR2(finishings));
589
+ return self;
590
+ }
591
+
592
+ static VALUE
593
+ ps_get_output_bin(VALUE self)
594
+ {
595
+ return CSTR2RVAL(gtk_print_settings_get_output_bin(_SELF(self)));
596
+ }
597
+
598
+ static VALUE
599
+ ps_set_output_bin(VALUE self, VALUE output_bin)
600
+ {
601
+ gtk_print_settings_set_output_bin(_SELF(self), RVAL2CSTR2(output_bin));
602
+ return self;
603
+ }
604
+ #endif
605
+
606
+ #if GTK_CHECK_VERSION(2,12,0)
607
+ static VALUE
608
+ ps_to_file(VALUE self, VALUE file_name)
609
+ {
610
+ GError *error = NULL;
611
+ if (!gtk_print_settings_to_file(_SELF(self), RVAL2CSTR(file_name), &error)) {
612
+ RAISE_GERROR(error);
613
+ }
614
+ return self;
615
+ }
616
+ static VALUE
617
+ ps_to_key_file(int argc, VALUE *argv, VALUE self)
618
+ {
619
+ VALUE key_file, group_name;
620
+ rb_scan_args(argc, argv, "11", &key_file, &group_name);
621
+ gtk_print_settings_to_key_file(_SELF(self),
622
+ (GKeyFile*)RVAL2BOXED(key_file, G_TYPE_KEY_FILE),
623
+ RVAL2CSTR2(group_name));
624
+ return self;
625
+ }
626
+ #endif
627
+
628
+ void
629
+ Init_gtk_print_settings()
630
+ {
631
+ #if GTK_CHECK_VERSION(2,10,0)
632
+ VALUE gPrintSettings;
633
+
634
+ s_string = ID2SYM(rb_intern("string"));
635
+ s_bool = ID2SYM(rb_intern("bool"));
636
+ s_double = ID2SYM(rb_intern("double"));
637
+ s_length = ID2SYM(rb_intern("length"));
638
+ s_int = ID2SYM(rb_intern("int"));
639
+
640
+ gPrintSettings = G_DEF_CLASS(GTK_TYPE_PRINT_SETTINGS,
641
+ "PrintSettings", mGtk);
642
+
643
+ rb_include_module(gPrintSettings, rb_mEnumerable);
644
+
645
+ #if GTK_CHECK_VERSION(2,12,0)
646
+ rb_define_method(gPrintSettings, "initialize", ps_initialize, -1);
647
+ #else
648
+ rb_define_method(gPrintSettings, "initialize", ps_initialize, 0);
649
+ #endif
650
+ rb_define_method(gPrintSettings, "dup", ps_copy, 0);
651
+ rb_define_method(gPrintSettings, "has_key?", ps_has_key, 1);
652
+
653
+ rb_define_method(gPrintSettings, "get", ps_get_generic, -1);
654
+ rb_define_alias(gPrintSettings, "[]", "get");
655
+ rb_define_method(gPrintSettings, "get_bool", ps_get_bool, 1);
656
+ rb_define_method(gPrintSettings, "get_double", ps_get_double, -1);
657
+ rb_define_method(gPrintSettings, "get_length", ps_get_length, 2);
658
+ rb_define_method(gPrintSettings, "get_int", ps_get_int, -1);
659
+
660
+ rb_define_method(gPrintSettings, "set", ps_set_generic, -1);
661
+ rb_define_method(gPrintSettings, "[]=", ps_set_generic_indexer, -1);
662
+
663
+ rb_define_method(gPrintSettings, "unset", ps_unset, -1);
664
+ rb_define_alias(gPrintSettings, "delete", "unset");
665
+
666
+ rb_define_method(gPrintSettings, "each", ps_foreach, 0);
667
+
668
+ rb_define_const(gPrintSettings, "PRINTER",
669
+ rb_str_new2(GTK_PRINT_SETTINGS_PRINTER));
670
+ rb_define_const(gPrintSettings, "ORIENTATION",
671
+ rb_str_new2(GTK_PRINT_SETTINGS_ORIENTATION));
672
+ rb_define_const(gPrintSettings, "PAPER_FORMAT",
673
+ rb_str_new2(GTK_PRINT_SETTINGS_PAPER_FORMAT));
674
+ rb_define_const(gPrintSettings, "PAPER_WIDTH",
675
+ rb_str_new2(GTK_PRINT_SETTINGS_PAPER_WIDTH));
676
+ rb_define_const(gPrintSettings, "PAPER_HEIGHT",
677
+ rb_str_new2(GTK_PRINT_SETTINGS_PAPER_HEIGHT));
678
+ rb_define_const(gPrintSettings, "N_COPIES",
679
+ rb_str_new2(GTK_PRINT_SETTINGS_N_COPIES));
680
+ rb_define_const(gPrintSettings, "DEFAULT_SOURCE",
681
+ rb_str_new2(GTK_PRINT_SETTINGS_DEFAULT_SOURCE));
682
+ rb_define_const(gPrintSettings, "QUALITY",
683
+ rb_str_new2(GTK_PRINT_SETTINGS_QUALITY));
684
+ rb_define_const(gPrintSettings, "RESOLUTION",
685
+ rb_str_new2(GTK_PRINT_SETTINGS_RESOLUTION));
686
+ rb_define_const(gPrintSettings, "USE_COLOR",
687
+ rb_str_new2(GTK_PRINT_SETTINGS_USE_COLOR));
688
+ rb_define_const(gPrintSettings, "DUPLEX",
689
+ rb_str_new2(GTK_PRINT_SETTINGS_DUPLEX));
690
+ rb_define_const(gPrintSettings, "COLLATE",
691
+ rb_str_new2(GTK_PRINT_SETTINGS_COLLATE));
692
+ rb_define_const(gPrintSettings, "REVERSE",
693
+ rb_str_new2(GTK_PRINT_SETTINGS_REVERSE));
694
+ rb_define_const(gPrintSettings, "MEDIA_TYPE",
695
+ rb_str_new2(GTK_PRINT_SETTINGS_MEDIA_TYPE));
696
+ rb_define_const(gPrintSettings, "DITHER",
697
+ rb_str_new2(GTK_PRINT_SETTINGS_DITHER));
698
+ rb_define_const(gPrintSettings, "SCALE",
699
+ rb_str_new2(GTK_PRINT_SETTINGS_SCALE));
700
+ rb_define_const(gPrintSettings, "PRINT_PAGES",
701
+ rb_str_new2(GTK_PRINT_SETTINGS_PRINT_PAGES));
702
+ rb_define_const(gPrintSettings, "PAGE_RANGES",
703
+ rb_str_new2(GTK_PRINT_SETTINGS_PAGE_RANGES));
704
+ rb_define_const(gPrintSettings, "PAGE_SET",
705
+ rb_str_new2(GTK_PRINT_SETTINGS_PAGE_SET));
706
+ rb_define_const(gPrintSettings, "FINISHINGS",
707
+ rb_str_new2(GTK_PRINT_SETTINGS_FINISHINGS));
708
+ rb_define_const(gPrintSettings, "NUMBER_UP",
709
+ rb_str_new2(GTK_PRINT_SETTINGS_NUMBER_UP));
710
+ rb_define_const(gPrintSettings, "OUTPUT_BIN",
711
+ rb_str_new2(GTK_PRINT_SETTINGS_OUTPUT_BIN));
712
+
713
+ rb_define_const(gPrintSettings, "OUTPUT_FILE_FORMAT",
714
+ rb_str_new2(GTK_PRINT_SETTINGS_OUTPUT_FILE_FORMAT));
715
+ rb_define_const(gPrintSettings, "OUTPUT_URI",
716
+ rb_str_new2(GTK_PRINT_SETTINGS_OUTPUT_URI));
717
+
718
+ rb_define_const(gPrintSettings, "WIN32_DRIVER_VERSION",
719
+ rb_str_new2(GTK_PRINT_SETTINGS_WIN32_DRIVER_VERSION));
720
+ rb_define_const(gPrintSettings, "WIN32_DRIVER_EXTRA",
721
+ rb_str_new2(GTK_PRINT_SETTINGS_WIN32_DRIVER_EXTRA));
722
+
723
+ /* Helpers: */
724
+ rb_define_method(gPrintSettings, "printer", ps_get_printer, 0);
725
+ rb_define_method(gPrintSettings, "set_printer", ps_set_printer, 1);
726
+ rb_define_method(gPrintSettings, "orientation", ps_get_orientation, 0);
727
+ rb_define_method(gPrintSettings, "set_orientation", ps_set_orientation, 1);
728
+ rb_define_method(gPrintSettings, "paper_size", ps_get_paper_size, 0);
729
+ rb_define_method(gPrintSettings, "set_paper_size", ps_set_paper_size, 1);
730
+ rb_define_method(gPrintSettings, "paper_width", ps_get_paper_width, 1);
731
+ rb_define_method(gPrintSettings, "set_paper_width", ps_set_paper_width, 2);
732
+ rb_define_method(gPrintSettings, "paper_height", ps_get_paper_height, 1);
733
+ rb_define_method(gPrintSettings, "set_paper_height",
734
+ ps_set_paper_height, 2);
735
+ rb_define_method(gPrintSettings, "use_color?", ps_get_use_color, 0);
736
+ rb_define_method(gPrintSettings, "set_use_color", ps_set_use_color, 1);
737
+ rb_define_method(gPrintSettings, "collate?", ps_get_collate, 0);
738
+ rb_define_method(gPrintSettings, "set_collate", ps_set_collate, 1);
739
+ rb_define_method(gPrintSettings, "reverse?", ps_get_reverse, 0);
740
+ rb_define_method(gPrintSettings, "set_reverse", ps_set_reverse, 1);
741
+ rb_define_method(gPrintSettings, "duplex", ps_get_duplex, 0);
742
+ rb_define_method(gPrintSettings, "set_duplex", ps_set_duplex, 1);
743
+ rb_define_method(gPrintSettings, "quality", ps_get_quality, 0);
744
+ rb_define_method(gPrintSettings, "set_quality", ps_set_quality, 1);
745
+ rb_define_method(gPrintSettings, "n_copies", ps_get_n_copies, 0);
746
+ rb_define_method(gPrintSettings, "set_n_copies", ps_set_n_copies, 1);
747
+ rb_define_method(gPrintSettings, "number_up", ps_get_number_up, 0);
748
+ rb_define_method(gPrintSettings, "set_number_up", ps_set_number_up, 1);
749
+ rb_define_method(gPrintSettings, "resolution", ps_get_resolution, 0);
750
+ rb_define_method(gPrintSettings, "set_resolution", ps_set_resolution, 1);
751
+ rb_define_method(gPrintSettings, "scale", ps_get_scale, 0);
752
+ rb_define_method(gPrintSettings, "set_scale", ps_set_scale, 1);
753
+ rb_define_method(gPrintSettings, "print_pages", ps_get_print_pages, 0);
754
+ rb_define_method(gPrintSettings, "set_print_pages", ps_set_print_pages, 1);
755
+ rb_define_method(gPrintSettings, "page_ranges", ps_get_page_ranges, 0);
756
+ rb_define_method(gPrintSettings, "set_page_ranges", ps_set_page_ranges, 1);
757
+ rb_define_method(gPrintSettings, "page_set", ps_get_page_set, 0);
758
+ rb_define_method(gPrintSettings, "set_page_set", ps_set_page_set, 1);
759
+ rb_define_method(gPrintSettings, "default_source",
760
+ ps_get_default_source, 0);
761
+ rb_define_method(gPrintSettings, "set_default_source",
762
+ ps_set_default_source, 1);
763
+ rb_define_method(gPrintSettings, "media_type", ps_get_media_type, 0);
764
+ rb_define_method(gPrintSettings, "set_media_type", ps_set_media_type, 1);
765
+ rb_define_method(gPrintSettings, "dither", ps_get_dither, 0);
766
+ rb_define_method(gPrintSettings, "set_dither", ps_set_dither, 1);
767
+ rb_define_method(gPrintSettings, "finishings", ps_get_finishings, 0);
768
+ rb_define_method(gPrintSettings, "set_finishings", ps_set_finishings, 1);
769
+ rb_define_method(gPrintSettings, "output_bin", ps_get_output_bin, 0);
770
+ rb_define_method(gPrintSettings, "set_output_bin", ps_set_output_bin, 1);
771
+
772
+ G_DEF_SETTERS(gPrintSettings);
773
+
774
+ /* GtkPageOrientation */
775
+ G_DEF_CLASS(GTK_TYPE_PAGE_ORIENTATION, "PageOrientation", gPrintSettings);
776
+ G_DEF_CONSTANTS(gPrintSettings, GTK_TYPE_PAGE_ORIENTATION, "GTK_PAGE_");
777
+ /* GtkPrintDuplex */
778
+ G_DEF_CLASS(GTK_TYPE_PRINT_DUPLEX, "PrintDuplex", gPrintSettings);
779
+ G_DEF_CONSTANTS(gPrintSettings, GTK_TYPE_PRINT_DUPLEX, "GTK_PRINT_");
780
+ /* GtkPrintQuality */
781
+ G_DEF_CLASS(GTK_TYPE_PRINT_QUALITY, "PrintQuality", gPrintSettings);
782
+ G_DEF_CONSTANTS(gPrintSettings, GTK_TYPE_PRINT_QUALITY, "GTK_PRINT_");
783
+ /* GtkPrintPages */
784
+ G_DEF_CLASS(GTK_TYPE_PRINT_PAGES, "PrintPages", gPrintSettings);
785
+ G_DEF_CONSTANTS(gPrintSettings, GTK_TYPE_PRINT_PAGES, "GTK_PRINT_");
786
+ /* GtkPageSet */
787
+ G_DEF_CLASS(GTK_TYPE_PAGE_SET, "PageSet", gPrintSettings);
788
+ G_DEF_CONSTANTS(gPrintSettings, GTK_TYPE_PAGE_SET, "GTK_");
789
+ #endif
790
+ #if GTK_CHECK_VERSION(2,12,0)
791
+ rb_define_method(gPrintSettings, "to_file", ps_to_file, 1);
792
+ rb_define_method(gPrintSettings, "to_key_file", ps_to_key_file, -1);
793
+ #endif
794
+ }