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
data/README ADDED
@@ -0,0 +1,33 @@
1
+ Ruby/GTK2
2
+ =========
3
+ Ruby/GTK2 is a Ruby binding of GTK+-2.0.x.
4
+
5
+ Requirements
6
+ ------------
7
+ Ruby: http://www.ruby-lang.org/
8
+ GTK+: http://www.gtk.org/
9
+ Pango: http://www.pango.org/
10
+ cairo/rcairo: http://cairographics.org/ (optional)
11
+ Ruby/GLib2, Ruby/ATK, Ruby/Pango: http://ruby-gnome2.sourceforge.net/
12
+
13
+ Install
14
+ -------
15
+ 0. install ruby-1.6.x or later, GTK+-2.0.x, Ruby/GLib2, Ruby/Pango
16
+ (and cairo/rcairo).
17
+ 1. ruby extconf.rb
18
+ (To use rcairo on Win32, set CAIRO_PATH as a environment variable first)
19
+ 2. make
20
+ 3. su
21
+ 4. make install
22
+
23
+ Copying
24
+ -------
25
+ Copyright (c) 2002-2005 Ruby-GNOME2 Project Team
26
+
27
+ This program is free software.
28
+ You can distribute/modify this program under the terms of
29
+ the GNU LESSER GENERAL PUBLIC LICENSE Version 2.1.
30
+
31
+ Project Website
32
+ ---------------
33
+ http://ruby-gnome2.sourceforge.jp/
@@ -0,0 +1,71 @@
1
+ require 'rake/clean'
2
+ CLEAN.include '**/*.o'
3
+ CLEAN.include "**/*.#{Config::MAKEFILE_CONFIG['DLEXT']}"
4
+ CLOBBER.include 'doc'
5
+ CLOBBER.include '**/*.log'
6
+ CLOBBER.include '**/Makefile'
7
+ CLOBBER.include '**/extconf.h'
8
+
9
+ # Determine the current version of the software
10
+ def ruby_gtk_version
11
+ require 'glib2'
12
+ GLib::BINDING_VERSION.join('.')
13
+ end
14
+
15
+ CURRENT_VERSION = ruby_gtk_version
16
+
17
+ desc "Default Task (Test project)"
18
+ task :default => :test
19
+
20
+ # Make tasks -----------------------------------------------------
21
+ make_program = (/mswin/ =~ RUBY_PLATFORM) ? 'nmake' : 'make'
22
+ MAKECMD = ENV['MAKE_CMD'] || make_program
23
+ MAKEOPTS = ENV['MAKE_OPTS'] || ''
24
+
25
+ GTK_SO = "src/gtk2.#{Config::MAKEFILE_CONFIG['DLEXT']}"
26
+
27
+ file 'Makefile' => 'extconf.rb' do
28
+ sh "ruby extconf.rb #{ENV['EXTCONF_OPTS']}"
29
+ end
30
+
31
+ def make(target = '')
32
+ pid = system("#{MAKECMD} #{MAKEOPTS} #{target}")
33
+ $?.exitstatus
34
+ end
35
+
36
+ # Let make handle dependencies between c/o/so - we'll just run it.
37
+ file GTK_SO => (['Makefile'] + Dir['src/*.c'] + Dir['src/*.h']) do
38
+ m = make
39
+ fail "Make failed (status #{m})" unless m == 0
40
+ end
41
+
42
+ desc "Configure Gtk"
43
+ task :configure => ['Makefile']
44
+
45
+ desc "Compile the shared object"
46
+ task :compile => [GTK_SO]
47
+
48
+ desc "Run gtk tests"
49
+ task :test => :compile do
50
+ sh "ruby test/run-test.rb"
51
+ end
52
+
53
+ desc 'Generate gem specification'
54
+ task :gemspec do
55
+ require 'erb'
56
+ tspec = ERB.new(File.read(File.join(File.dirname(__FILE__),'src','gtk2.gemspec.erb')))
57
+ File.open(File.join(File.dirname(__FILE__),'gtk2.gemspec'),'wb') do|f|
58
+ f << tspec.result
59
+ end
60
+ end
61
+
62
+ desc 'Build gem'
63
+ task :package => :gemspec do
64
+ require 'rubygems/specification'
65
+ spec_source = File.read File.join(File.dirname(__FILE__),'gtk2.gemspec')
66
+ spec = nil
67
+ # see: http://gist.github.com/16215
68
+ Thread.new { spec = eval("$SAFE = 3\n#{spec_source}") }.join
69
+ spec.validate
70
+ Gem::Builder.new(spec).build
71
+ end
@@ -0,0 +1,116 @@
1
+ =begin
2
+ extconf.rb for Ruby/GTK extention library
3
+ =end
4
+
5
+ PACKAGE_NAME = "gtk2"
6
+ PKG_CONFIG_ID = "gtk+-2.0"
7
+
8
+ begin
9
+ require 'mkmf-gnome2'
10
+ TOPDIR = File.expand_path(File.dirname(__FILE__))
11
+ SRCDIR = TOPDIR + '/src'
12
+ require 'glib2'
13
+ require 'pango'
14
+ require 'atk'
15
+ require 'gdk_pixbuf2'
16
+ USE_GNOME_GEMS=true
17
+ rescue LoadError => e
18
+ puts "Not using gems"
19
+ USE_GNOME_GEMS=false
20
+
21
+ TOPDIR = File.expand_path(File.dirname(__FILE__) + '/..')
22
+ MKMF_GNOME2_DIR = TOPDIR + '/glib/src/lib'
23
+ SRCDIR = TOPDIR + '/gtk/src'
24
+
25
+ $LOAD_PATH.unshift MKMF_GNOME2_DIR
26
+
27
+ require 'mkmf-gnome2'
28
+ end
29
+
30
+ #
31
+ # detect GTK+ configurations
32
+ #
33
+
34
+ PKGConfig.have_package('gthread-2.0')
35
+ PKGConfig.have_package(PKG_CONFIG_ID) or exit 1
36
+ setup_win32(PACKAGE_NAME)
37
+
38
+ have_header("st.h")
39
+ have_header("ruby/st.h")
40
+
41
+ STDOUT.print("checking for target... ")
42
+ STDOUT.flush
43
+ target = PKGConfig.variable(PKG_CONFIG_ID, "target")
44
+ $defs << "-DRUBY_GTK2_TARGET=\\\"#{target}\\\""
45
+ STDOUT.print(target, "\n")
46
+
47
+ #
48
+ # detect location of GDK include files
49
+ #
50
+ gdkincl = nil
51
+ tmpincl = $CFLAGS.gsub(/-D\w+/, '').split(/-I/) + ['/usr/include']
52
+ tmpincl.each do |i|
53
+ i.strip!
54
+
55
+ if FileTest.exist?(i + "/gdk/gdkkeysyms.h")
56
+ gdkincl = i + "/gdk"
57
+ break
58
+ end
59
+ end
60
+ raise "can't find gdkkeysyms.h" if gdkincl.nil?
61
+
62
+ gtk_header = "gtk/gtk.h"
63
+ have_func('gtk_plug_get_type', gtk_header)
64
+ have_func('gtk_socket_get_type', gtk_header)
65
+ have_func('pango_render_part_get_type', gtk_header)
66
+ have_header('gtk/gtkfilesystem.h') do |src|
67
+ "#define GTK_FILE_SYSTEM_ENABLE_UNSUPPORTED\n#{src}"
68
+ end
69
+
70
+ xlib_header = "X11/Xlib.h"
71
+ if target == "x11" and have_header('X11/Xlib.h') and have_library("X11")
72
+ have_func("XReadBitmapFileData", xlib_header)
73
+ have_func("XGetErrorText", xlib_header)
74
+ end
75
+
76
+ if PKGConfig.have_package('gtk+-unix-print-2.0')
77
+ $defs.push("-DHAVE_GTK_UNIX_PRINT")
78
+ end
79
+
80
+ have_func("rb_errinfo")
81
+
82
+ check_cairo
83
+ if USE_GNOME_GEMS
84
+ path = File.expand_path(ENV['GEM_HOME'] + "/gems/glib2-#{GLib::BINDING_VERSION.join('.')}/src")
85
+ add_depend_package("glib2", path, '/')
86
+ path = File.expand_path(ENV['GEM_HOME'] + "/gems/pango-#{GLib::BINDING_VERSION.join('.')}/src")
87
+ add_depend_package("pango", path, '/')
88
+ path = File.expand_path(ENV['GEM_HOME'] + "/gems/atk-#{GLib::BINDING_VERSION.join('.')}/src")
89
+ add_depend_package("atk", path, '/')
90
+ path = File.expand_path(ENV['GEM_HOME'] + "/gems/gdkpixbuf-#{GLib::BINDING_VERSION.join('.')}/src")
91
+ add_depend_package("gdkpixbuf2", path, '/')
92
+ else
93
+ add_depend_package("glib2", "glib/src", TOPDIR)
94
+ add_depend_package("pango", "pango/src", TOPDIR)
95
+ add_depend_package("atk", "atk/src", TOPDIR)
96
+ end
97
+
98
+ #
99
+ # create Makefiles
100
+ #
101
+
102
+ add_distcleanfile("rbgdkkeysyms.h")
103
+ add_distcleanfile("rbgtkinits.c")
104
+
105
+ $defs.delete("-DRUBY_GTK2_COMPILATION")
106
+
107
+ create_pkg_config_file("Ruby/GTK2", PKG_CONFIG_ID, ruby_gnome2_version)
108
+
109
+ create_makefile_at_srcdir(PACKAGE_NAME, SRCDIR, "-DRUBY_GTK2_COMPILATION") {
110
+ File.delete("rbgtkinits.c") if FileTest.exist?("rbgtkinits.c")
111
+ SRCDIR_QUOTED = SRCDIR.gsub(' ', '\ ')
112
+ system("#{$ruby} #{SRCDIR_QUOTED}/makeinits.rb #{SRCDIR_QUOTED}/*.c > rbgtkinits.c") or raise "failed to make GTK inits"
113
+ system("#{$ruby} #{SRCDIR_QUOTED}/makekeysyms.rb #{gdkincl}/gdkkeysyms.h > rbgdkkeysyms.h") or raise "failed to make GDK Keysyms"
114
+ }
115
+
116
+ create_top_makefile(["src"])
@@ -0,0 +1,33 @@
1
+ /* -*- c-file-style: "ruby" -*- */
2
+ /************************************************
3
+
4
+ global.h -
5
+
6
+ $Author: sakai $
7
+ $Date: 2003/03/14 03:12:19 $
8
+
9
+ Copyright (C) 2002,2003 Ruby-GNOME2 Project Team
10
+ Copyright (C) 1998-2000 Yukihiro Matsumoto,
11
+ Daisuke Kanda,
12
+ Hiroshi Igarashi
13
+ ************************************************/
14
+
15
+ #ifndef _RBGTK_GLOBAL_H
16
+ #define _RBGTK_GLOBAL_H
17
+
18
+ #include "rbgtk.h"
19
+ #ifdef HAVE_RUBY_ST_H
20
+ # include <ruby/st.h>
21
+ #else
22
+ # include <st.h>
23
+ #endif
24
+
25
+ #ifndef HAVE_RB_ERRINFO
26
+ # define rb_errinfo() (ruby_errinfo)
27
+ #endif
28
+
29
+ extern ID id_relative_callbacks;
30
+ extern ID id_call;
31
+ extern VALUE treeiter_set_value_table;
32
+
33
+ #endif /* _RBGTK_GLOBAL_H */
@@ -0,0 +1,39 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /************************************************
3
+
4
+ init.c -
5
+
6
+ $Author: mutoh $
7
+ $Date: 2006/10/21 16:58:00 $
8
+
9
+ Copyright (C) 2002-2006 Ruby-GNOME2 Project Team
10
+ Copyright (C) 1998-2001 Yukihiro Matsumoto,
11
+ Daisuke Kanda,
12
+ Hiroshi Igarashi
13
+ ************************************************/
14
+
15
+ #include "global.h"
16
+ #include "gmodule.h"
17
+
18
+ extern void Init_gtk_gdk();
19
+ extern void Init_gtk_gtk();
20
+ extern void Init_gtk_inits();
21
+
22
+ VALUE treeiter_set_value_table;
23
+
24
+ void
25
+ Init_gtk2()
26
+ {
27
+ /*
28
+ * For Gtk::TreeModel, Gtk::TreeIter.
29
+ * They should be initialized on this timing.
30
+ */
31
+ treeiter_set_value_table = rb_hash_new();
32
+ rb_global_variable(&treeiter_set_value_table);
33
+
34
+ Init_gtk_gdk();
35
+ Init_gtk_gtk();
36
+
37
+ Init_gtk_inits();
38
+
39
+ }
@@ -0,0 +1,13 @@
1
+ #! /usr/bin/env ruby
2
+ =begin
3
+ gtk2.rb
4
+
5
+ Copyright (c) 2006 Ruby-GNOME2 Project Team
6
+ This program is licenced under the same licence as Ruby-GNOME2.
7
+
8
+ $Id: gtk2.rb,v 1.9 2006/06/17 13:18:12 mutoh Exp $
9
+ =end
10
+
11
+ require 'gtk2/base'
12
+
13
+ Gtk.init
@@ -0,0 +1,95 @@
1
+ #! /usr/bin/env ruby
2
+ =begin
3
+ gtk2/base.rb
4
+
5
+ Copyright (c) 2006 Ruby-GNOME2 Project Team
6
+ This program is licenced under the same licence as Ruby-GNOME2.
7
+
8
+ $Id: base.rb,v 1.6 2007/08/13 11:09:22 ktou Exp $
9
+ =end
10
+
11
+
12
+ require 'glib2'
13
+ require 'atk'
14
+ require 'pango'
15
+ require 'gtk2.so'
16
+ require 'gdk_pixbuf2'
17
+
18
+ module Gdk
19
+ LOG_DOMAIN = "Gdk"
20
+ end
21
+
22
+ if Gdk.cairo_available?
23
+ module Cairo
24
+ class Context
25
+ if method_defined?(:set_source_color)
26
+ alias_method :set_source_not_gdk_color, :set_source_color
27
+ def set_source_color(color)
28
+ if color.is_a?(Gdk::Color)
29
+ set_source_gdk_color(color)
30
+ else
31
+ set_source_not_gdk_color(color)
32
+ end
33
+ end
34
+ else
35
+ alias_method :set_source_color, :set_source_gdk_color
36
+ end
37
+
38
+ def source_color=(color)
39
+ set_source_color(color)
40
+ color
41
+ end
42
+ end
43
+ end
44
+ end
45
+
46
+
47
+ module Gtk
48
+ LOG_DOMAIN = "Gtk"
49
+
50
+ class Printer
51
+ def self.printers(wait = false)
52
+ printers = []
53
+ self.each(wait) {|v| printers << v}
54
+ printers
55
+ end
56
+ end
57
+
58
+ if check_version?(2, 12, 0)
59
+ class Builder
60
+ private
61
+ def canonical_handler_name(name)
62
+ name.gsub(/[-\s]+/, "_")
63
+ end
64
+
65
+ def __connect_signals__(connector, object, signal_name,
66
+ handler_name, connect_object, flags)
67
+ handler_name = canonical_handler_name(handler_name)
68
+ if connect_object
69
+ handler = connect_object.method(handler_name)
70
+ else
71
+ handler = connector.call(handler_name)
72
+ end
73
+ unless handler
74
+ $stderr.puts("Undefined handler: #{handler_name}") if $DEBUG
75
+ return
76
+ end
77
+
78
+ if flags.after?
79
+ signal_connect_method = :signal_connect_after
80
+ else
81
+ signal_connect_method = :signal_connect
82
+ end
83
+
84
+ if handler.arity.zero?
85
+ object.send(signal_connect_method, signal_name) {handler.call}
86
+ else
87
+ object.send(signal_connect_method, signal_name, &handler)
88
+ end
89
+ end
90
+ end
91
+ end
92
+ end
93
+
94
+ GLib::Log.set_log_domain(Gdk::LOG_DOMAIN)
95
+ GLib::Log.set_log_domain(Gtk::LOG_DOMAIN)
@@ -0,0 +1,57 @@
1
+ except_targets = ["Init_gtk2()", "Init_gtk_gdk()", "Init_gtk_gtk()"]
2
+
3
+ def print_data(array, type, defs, extern = false)
4
+ if array[type]
5
+ dependencies = {
6
+ "Init_gtk_gdk_gc()" => ["Init_gtk_gdk_draw()"],
7
+ }
8
+ extern_def = "extern void" if extern
9
+ print "##{defs} #{type}\n" if defs
10
+ sorted_array = array[type].dup
11
+ dependencies.each do |key, values|
12
+ key_index = sorted_array.index(key)
13
+ values.each do |value|
14
+ value_index = sorted_array.index(value)
15
+ next if value_index.nil?
16
+ sorted_array.delete(value)
17
+ sorted_array[key_index - 1, 0] = value
18
+ key_index = sorted_array.index(key)
19
+ end
20
+ end
21
+ sorted_array.each do |val|
22
+ print "#{extern_def} #{val};\n"
23
+ end
24
+ print "#endif\n" if defs
25
+ end
26
+ end
27
+
28
+ inits = Hash.new
29
+
30
+ while gets
31
+ if ~ /^(Init_.*\(\))(.*)/
32
+ init = $1
33
+ unless except_targets.include?(init)
34
+ flag = $2
35
+ if flag.size > 0
36
+ if flag =~ /\/\*\s*(\w*)\s*\*\//
37
+ inits[$1] = Array.new unless inits[$1]
38
+ inits[$1] << init
39
+ end
40
+ else
41
+ inits[""] = Array.new unless inits[""]
42
+ inits[""] << init
43
+ end
44
+ end
45
+ end
46
+ end
47
+
48
+ print_data(inits, "", nil, true)
49
+ print_data(inits, "GTK_DISABLE_DEPRECATED", "ifndef", true)
50
+ print_data(inits, "GTK_ENABLE_BROKEN", "ifdef", true)
51
+
52
+ print "void Init_gtk_inits()\n"
53
+ print "{\n"
54
+ print_data(inits, "", nil)
55
+ print_data(inits, "GTK_DISABLE_DEPRECATED", "ifndef")
56
+ print_data(inits, "GTK_ENABLE_BROKEN", "ifdef")
57
+ print "}\n"