[DRE-commits] [ruby-gnome2] 01/07: Imported Upstream version 2.2.5
Antonio Terceiro
terceiro at moszumanska.debian.org
Fri Jul 17 13:32:55 UTC 2015
This is an automated email from the git hooks/post-receive script.
terceiro pushed a commit to branch master
in repository ruby-gnome2.
commit c4f35d4edcb006651caca22d3a34cef34d57cfc7
Author: Antonio Terceiro <terceiro at debian.org>
Date: Mon Jun 22 18:24:03 2015 -0300
Imported Upstream version 2.2.5
---
NEWS | 313 +++++
README | 205 ----
README.md | 141 +++
Rakefile | 63 +-
atk/Rakefile | 2 +-
atk/ext/atk/extconf.rb | 2 +-
cairo-gobject/Rakefile | 22 +-
cairo-gobject/ext/cairo-gobject/extconf.rb | 22 +-
cairo-gobject/ext/cairo-gobject/rb-cairo-gobject.c | 10 +-
clutter-gstreamer/Rakefile | 11 +-
clutter-gstreamer/lib/clutter-gst.rb | 6 +-
.../lib/clutter-gstreamer.rb | 8 +-
clutter-gstreamer/sample/video-player.rb | 11 +-
clutter-gstreamer/sample/video-sink-navigation.rb | 3 +-
clutter-gstreamer/sample/video-sink.rb | 3 +-
.../test/clutter-gstreamer-test-utils.rb | 22 +-
clutter-gstreamer/test/run-test.rb | 5 +-
clutter-gstreamer/test/test-clutter-gst.rb | 5 +-
clutter-gtk/Rakefile | 6 +-
clutter-gtk/lib/clutter-gtk.rb | 5 +-
clutter/Rakefile | 37 +-
clutter/lib/clutter.rb | 19 +-
clutter/lib/clutter/brightness-contrast-effect.rb | 44 +
.../lib/clutter/clutter.rb | 11 +-
.../lib/clutter/text-buffer.rb | 28 +-
.../json-glib-1.0.2-add-missing-config-h.diff | 21 +
clutter/test/clutter-test-utils.rb | 12 +
clutter/test/run-test.rb | 5 +-
clutter/test/test-clutter-actor.rb | 242 ++++
.../test/test-clutter-blur-effect.rb | 15 +-
.../test-clutter-brightness-contrast-effect.rb | 56 +
.../test/test-clutter-canvas.rb | 28 +-
.../test/test-clutter-colorize-effect.rb | 20 +-
.../test/test-clutter-desaturate-effect.rb | 19 +-
.../test/test-clutter-feature.rb | 21 +-
clutter/test/test-clutter-flow-layout.rb | 83 ++
.../test/test-clutter-page-turn-effect.rb | 31 +-
.../test/test-clutter-property-transiton.rb | 19 +-
clutter/test/test-clutter-shader-effect.rb | 65 ++
clutter/test/test-clutter-text-buffer.rb | 72 ++
clutter/test/test-clutter-timeline.rb | 59 +
extconf.rb | 3 +-
gdk3/Rakefile | 40 +-
gdk3/ext/gdk3/depend | 11 -
gdk3/ext/gdk3/extconf.rb | 130 ---
gdk3/ext/gdk3/gdk3.def | 12 -
gdk3/ext/gdk3/init.c | 35 -
gdk3/ext/gdk3/rbgdk.c | 491 --------
gdk3/ext/gdk3/rbgdk3.h | 73 --
gdk3/ext/gdk3/rbgdk3conversions.h | 121 --
gdk3/ext/gdk3/rbgdk3private.h | 85 --
gdk3/ext/gdk3/rbgdkatom.c | 122 --
gdk3/ext/gdk3/rbgdkcairo.c | 91 --
gdk3/ext/gdk3/rbgdkcolor.c | 137 ---
gdk3/ext/gdk3/rbgdkcursor.c | 92 --
gdk3/ext/gdk3/rbgdkdevice.c | 253 ----
gdk3/ext/gdk3/rbgdkdevicemanager.c | 39 -
gdk3/ext/gdk3/rbgdkdisplay.c | 434 -------
gdk3/ext/gdk3/rbgdkdisplaymanager.c | 55 -
gdk3/ext/gdk3/rbgdkdragcontext.c | 191 ---
gdk3/ext/gdk3/rbgdkevent.c | 1173 -------------------
gdk3/ext/gdk3/rbgdkgeometry.c | 253 ----
gdk3/ext/gdk3/rbgdkkeymap.c | 151 ---
gdk3/ext/gdk3/rbgdkkeyval.c | 108 --
gdk3/ext/gdk3/rbgdkpango.c | 197 ----
gdk3/ext/gdk3/rbgdkpangorenderer.c | 144 ---
gdk3/ext/gdk3/rbgdkpixbuf.c | 176 ---
gdk3/ext/gdk3/rbgdkproperty.c | 305 -----
gdk3/ext/gdk3/rbgdkrectangle.c | 140 ---
gdk3/ext/gdk3/rbgdkrgb.c | 199 ----
gdk3/ext/gdk3/rbgdkrgba.c | 142 ---
gdk3/ext/gdk3/rbgdkscreen.c | 443 -------
gdk3/ext/gdk3/rbgdkselection.c | 146 ---
gdk3/ext/gdk3/rbgdkthreads.c | 77 --
gdk3/ext/gdk3/rbgdktimecoord.c | 133 ---
gdk3/ext/gdk3/rbgdkvisual.c | 251 ----
gdk3/ext/gdk3/rbgdkwindow.c | 1069 -----------------
gdk3/ext/gdk3/rbgdkwindowattr.c | 191 ---
gdk3/ext/gdk3/rbgdkx11.c | 102 --
gdk3/ext/gdk3/rbgdkx11x11window.c | 66 --
gdk3/extconf.rb | 49 -
gdk3/lib/gdk3.rb | 63 +-
.../gio2/output-stream.rb => gdk3/lib/gdk3/atom.rb | 12 +-
gdk3/lib/gdk3/base.rb | 59 -
gdk3/lib/gdk3/cairo.rb | 64 +
gdk3/lib/gdk3/color.rb | 49 +
gdk3/lib/gdk3/deprecated.rb | 54 +-
.../output-stream.rb => gdk3/lib/gdk3/event.rb | 24 +-
gdk3/lib/gdk3/loader.rb | 265 +++++
.../lib/gdk3/rectangle.rb | 28 +-
.../gio2/output-stream.rb => gdk3/lib/gdk3/rgba.rb | 18 +-
.../lib/gdk3/window-attr.rb | 14 +-
.../output-stream.rb => gdk3/lib/gdk3/window.rb | 9 +-
gdk3/patches/gdk+-3.10.6-remove-def-use.diff | 106 --
gdk3/test/run-test.rb | 21 +-
gdk3/test/test-gdk-cairo.rb | 71 ++
gdk3/test/test-gdk-color.rb | 25 +
.../test/test-gdk-event-type.rb | 13 +-
gdk3/test/test-gdk-event.rb | 96 +-
gdk3/test/test-gdk-keyval.rb | 76 ++
gdk3/test/test-gdk-pixbuf.rb | 49 +
gdk3/test/test-gdk-rectangle.rb | 39 +-
gdk3/test/test-gdk-rgba.rb | 7 +-
gdk3/test/test-gdk-window-attr.rb | 6 +-
gdk_pixbuf2/Rakefile | 2 +-
gdk_pixbuf2/ext/gdk_pixbuf2/extconf.rb | 2 +-
gio2/Makefile | 20 +
gio2/Makefile.lib | 226 ++++
gio2/ext/gio2/Makefile | 244 ++++
{goocanvas/ext/goocanvas => gio2/ext/gio2}/depend | 2 +-
gio2/ext/gio2/extconf.rb | 2 +-
gio2/ext/gio2/ruby-gio2.pc | 3 +
gio2/lib/gio2/input-stream.rb | 13 +-
gio2/lib/gio2/loader.rb | 28 +-
gio2/lib/gio2/pollable-input-stream.rb | 13 +-
gio2/lib/gio2/pollable-output-stream.rb | 5 -
gio2/test/gio2-test-utils.rb | 1 +
.../gio2-test-utils/omissions.rb} | 9 +-
gio2/test/test-content-type.rb | 8 +
gio2/test/{test-content-type.rb => test-dbus.rb} | 29 +-
gio2/test/test-file.rb | 2 +
.../test-memory-input-stream.rb} | 9 +-
.../test-memory-output-stream.rb} | 9 +-
glib2/Makefile | 20 +
glib2/Makefile.lib | 242 ++++
glib2/Rakefile | 120 +-
glib2/ext/glib2/Makefile | 256 ++++
glib2/ext/glib2/extconf.rb | 15 +-
glib2/ext/glib2/glib-enum-types.c | 1233 ++++++++++++++++++++
glib2/ext/glib2/glib-enum-types.h | 154 +++
glib2/ext/glib2/glib2.def | 2 +
glib2/ext/glib2/rbglib.c | 4 +-
glib2/ext/glib2/rbglib.h | 2 +-
glib2/ext/glib2/rbglib2conversions.h | 2 +
glib2/ext/glib2/rbglib_fileutils.c | 25 +
glib2/ext/glib2/rbglib_maincontext.c | 356 +-----
glib2/ext/glib2/rbglib_mainloop.c | 29 +-
glib2/ext/glib2/rbglib_source.c | 52 +-
glib2/ext/glib2/rbglib_threads.c | 2 +-
glib2/ext/glib2/rbglib_utils.c | 11 +-
glib2/ext/glib2/rbgobj_boxed.c | 24 +-
glib2/ext/glib2/rbgobj_convert.c | 21 +-
glib2/ext/glib2/rbgobj_object.c | 26 +-
glib2/ext/glib2/rbgobj_type.c | 10 +-
glib2/ext/glib2/rbgprivate.h | 2 -
glib2/ext/glib2/rbgutil.c | 40 +-
glib2/ext/glib2/rbgutil.h | 3 +-
glib2/ext/glib2/rbgutil_callback.c | 2 -
glib2/ext/glib2/ruby-glib2.pc | 3 +
glib2/lib/glib2/deprecatable.rb | 46 +-
glib2/lib/gnome2/rake/external-package.rb | 12 +
glib2/lib/gnome2/rake/native-binary-build-task.rb | 12 +-
glib2/lib/gnome2/rake/package-task.rb | 78 +-
glib2/lib/gnome2/rake/package.rb | 34 +-
...-build-task.rb => windows-binary-build-task.rb} | 127 +-
...oad-task.rb => windows-binary-download-task.rb} | 34 +-
glib2/lib/mkmf-gnome2.rb | 115 +-
glib2/test/test_file_utils.rb | 38 +
glib2/test/test_source.rb | 40 +-
gobject-introspection/Makefile | 20 +
gobject-introspection/Makefile.lib | 232 ++++
gobject-introspection/Rakefile | 38 +-
.../ext/gobject-introspection/Makefile | 248 ++++
.../ext/gobject-introspection/extconf.rb | 2 +-
.../gobject-introspection-enum-types.c | 230 ++++
.../gobject-introspection-enum-types.h | 42 +
.../ext/gobject-introspection/rb-gi-argument.c | 153 ++-
.../gobject-introspection/rb-gi-constructor-info.c | 7 +-
.../gobject-introspection/rb-gi-function-info.c | 37 +-
.../ext/gobject-introspection/rb-gi-loader.c | 22 +-
.../ext/gobject-introspection/rb-gi-repository.c | 82 ++
.../ext/gobject-introspection/rb-gi-struct-info.c | 44 +-
.../ext/gobject-introspection/rbgiversion.h | 24 +
.../ruby-gobject-introspection.pc | 3 +
.../lib/gobject-introspection/callable-info.rb | 23 +-
.../lib/gobject-introspection/loader.rb | 79 +-
.../patches/cross-g-ir-scanner.diff | 50 +-
...er.patch => support-external-g-ir-scanner.diff} | 200 ++--
gobject-introspection/test/test-object-info.rb | 2 +-
gobject-introspection/test/test-signal-info.rb | 4 +-
gobject-introspection/test/test-struct-info.rb | 2 +-
goocanvas/README | 37 -
goocanvas/Rakefile | 14 -
goocanvas/ext/goocanvas/extconf.rb | 82 --
goocanvas/ext/goocanvas/goocanvas.def | 2 -
goocanvas/ext/goocanvas/rbgoocanvas.c | 58 -
goocanvas/ext/goocanvas/rbgoocanvas.h | 29 -
goocanvas/extconf.rb | 49 -
goocanvas/lib/goo/canvas-item.rb | 32 -
goocanvas/lib/goocanvas.rb | 72 --
goocanvas/sample/demo-animation.rb | 176 ---
goocanvas/sample/demo-arrowhead.rb | 354 ------
goocanvas/sample/demo-events.rb | 187 ---
goocanvas/sample/demo-features.rb | 148 ---
goocanvas/sample/demo-fifteen.rb | 226 ----
goocanvas/sample/demo-focus.rb | 135 ---
goocanvas/sample/demo-primitives.rb | 719 ------------
goocanvas/sample/demo.rb | 94 --
goocanvas/sample/flower.png | Bin 818 -> 0 bytes
goocanvas/sample/scalability-demo.rb | 169 ---
goocanvas/sample/simple-demo.rb | 70 --
goocanvas/sample/table-demo.rb | 218 ----
goocanvas/sample/toroid.png | Bin 16917 -> 0 bytes
goocanvas/sample/units-demo.rb | 129 --
goocanvas/sample/widgets-demo.rb | 277 -----
gstreamer/Rakefile | 57 +-
gstreamer/ext/gstreamer/extconf.rb | 2 +-
gstreamer/ext/gstreamer/rbgst-child-proxy.c | 105 ++
gstreamer/ext/gstreamer/rbgst.c | 3 +-
gstreamer/ext/gstreamer/rbgst.h | 3 +-
gstreamer/lib/gst.rb | 3 +-
gstreamer/lib/gst/caps.rb | 14 +
.../lib/gstreamer.rb | 8 +-
.../test/gstreamer-test-utils.rb | 6 +-
{clutter => gstreamer}/test/run-test.rb | 27 +-
.../test/test-caps.rb | 17 +-
.../test/test-child-proxy.rb | 15 +-
.../test/test-element-factory.rb | 11 +-
gtk2/Rakefile | 29 +-
gtk2/ext/gtk2/extconf.rb | 17 +-
gtk2/ext/gtk2/rbgdkproperty.c | 8 +-
gtk2/ext/gtk2/rbgtk.c | 17 +
gtk2/ext/gtk2/rbgtkaboutdialog.c | 2 +-
gtk2/ext/gtk2/rbgtkdialog.c | 33 +-
gtk2/ext/gtk2/rbgtkselectiondata.c | 9 +-
.../gtk+-2.24.22-remove-PRIVATE-from-def.diff | 210 ++++
...4.25-add-missing-exeext-and-fix-directory.diff} | 16 +-
.../test-file.rb => gtk2/test/test_gdk_pixbuf.rb | 22 +-
gtk3/ext/gtk3/extconf.rb | 22 +-
gtk3/ext/gtk3/rbgtk-about-dialog.c | 4 +-
.../ext/gtk3/rbgtk-action-bar.c | 49 +-
gtk3/ext/gtk3/rbgtk-color-button.c | 8 +-
gtk3/ext/gtk3/rbgtk-dialog.c | 32 +-
gtk3/ext/gtk3/rbgtk-image.c | 1 +
gtk3/ext/gtk3/rbgtk-selection-data.c | 9 +-
.../ext/gtk3/rbgtk-stack-switcher.c | 26 +-
gtk3/ext/gtk3/rbgtk-window.c | 8 +
gtk3/ext/gtk3/rbgtk.c | 161 +++
gtk3/ext/gtk3/rbgtk3.h | 33 +
gtk3/ext/gtk3/rbgtk3conversions.h | 64 +-
gtk3/ext/gtk3/rbgtk3private.h | 5 +-
gtk3/lib/gtk3.rb | 1 +
gtk3/sample/gtk-demo/cairo-arc-negative.rb | 2 +-
gtk3/sample/gtk-demo/cairo-arc.rb | 2 +-
gtk3/sample/gtk-demo/cairo-clip-image.rb | 12 +-
gtk3/sample/gtk-demo/cairo-clip-rectangle.rb | 4 +-
gtk3/sample/gtk-demo/cairo-curve-rectangle.rb | 4 +-
gtk3/sample/gtk-demo/cairo-curve-to.rb | 4 +-
gtk3/sample/gtk-demo/cairo-dash.rb | 2 +-
gtk3/sample/gtk-demo/cairo-fill-and-stroke.rb | 2 +-
gtk3/sample/gtk-demo/cairo-fill-and-stroke2.rb | 4 +-
gtk3/sample/gtk-demo/cairo-gradient.rb | 2 +-
gtk3/sample/gtk-demo/cairo-image-pattern.rb | 10 +-
gtk3/sample/gtk-demo/cairo-image.rb | 8 +-
gtk3/sample/gtk-demo/cairo-line-cap.rb | 16 +-
gtk3/sample/gtk-demo/cairo-line-join.rb | 6 +-
gtk3/sample/gtk-demo/cairo-long-lines.rb | 6 +-
gtk3/sample/gtk-demo/cairo-pattern-fill.rb | 22 +-
gtk3/sample/gtk-demo/cairo-self-intersect.rb | 4 +-
gtk3/sample/gtk-demo/cairo-text-align-center.rb | 8 +-
gtk3/sample/gtk-demo/cairo-text-extents.rb | 10 +-
gtk3/sample/gtk-demo/cairo-text.rb | 6 +-
gtk3/sample/gtk-demo/common.rb | 1 -
gtk3/sample/gtk-demo/dialog.rb | 46 +-
gtk3/sample/gtk-demo/drawingarea.rb | 6 +-
gtk3/sample/gtk-demo/editable_cells.rb | 56 +-
gtk3/sample/gtk-demo/entry_completion.rb | 6 +-
gtk3/sample/gtk-demo/images.rb | 150 +--
gtk3/sample/gtk-demo/item_factory.rb | 80 +-
gtk3/sample/gtk-demo/list_store.rb | 26 +-
gtk3/sample/gtk-demo/menus.rb | 68 +-
gtk3/sample/gtk-demo/panes.rb | 56 +-
gtk3/sample/gtk-demo/rotated_text.rb | 94 +-
gtk3/sample/gtk-demo/sizegroup.rb | 34 +-
gtk3/sample/gtk-demo/spinner.rb | 2 +-
gtk3/sample/gtk-demo/textview.rb | 274 ++---
gtk3/sample/gtk-demo/theming.ui | 319 +++++
gtk3/sample/gtk-demo/theming_style_classes.rb | 48 +
gtk3/sample/gtk-demo/tree_store.rb | 254 ++--
gtk3/sample/misc/assistant.rb | 72 +-
gtk3/sample/misc/bindings.rb | 54 +-
gtk3/sample/misc/button.rb | 13 +-
gtk3/sample/misc/buttonbox.rb | 4 +-
gtk3/sample/misc/checkbutton.rb | 5 +-
gtk3/sample/misc/colorselection.rb | 17 +-
gtk3/sample/misc/combo_check.rb | 60 +-
gtk3/sample/misc/combobox.rb | 21 +-
gtk3/sample/misc/cursor.rb | 4 +-
gtk3/sample/misc/dialog.rb | 24 +-
gtk3/sample/misc/dialog2.rb | 29 +-
gtk3/sample/misc/drawing.rb | 61 +-
gtk3/sample/misc/statusicon.rb | 73 +-
gtk3/sample/misc/threads.rb | 34 +-
gtk3/sample/misc/tree_progress.rb | 22 +-
gtk3/test/run-test.rb | 26 +-
.../test/test_gtk_action_group.rb | 31 +-
gtk3/test/test_gtk_image.rb | 2 +-
gtk3/test/test_gtk_search_bar.rb | 2 +-
.../test/test_gtk_stack_switcher.rb | 14 +-
gtksourceview2/Rakefile | 17 +-
gtksourceview2/ext/gtksourceview2/extconf.rb | 17 +-
gtksourceview3/Rakefile | 2 +-
gtksourceview3/ext/gtksourceview3/extconf.rb | 20 +-
.../gtksourceview3/rbgtksourcegutterrenderertext.c | 26 +-
.../gtksourceview3/rbgtksourceview3conversions.h | 7 +
.../ext/gtksourceview3/rbgtksourceview3private.h | 1 -
gtksourceview3/test/run-test.rb | 24 +-
gtksourceview3/test/test_mark_attributes.rb | 2 +-
.../test/test_source_gutter_renderer.rb | 18 +-
.../test/test_source_language_manager.rb | 31 +-
gtksourceview3/test/test_source_view.rb | 34 +
pango/Rakefile | 42 +-
pango/ext/pango/extconf.rb | 16 +-
poppler/Rakefile | 17 +-
poppler/ext/poppler/extconf.rb | 21 +-
poppler/lib/poppler.rb | 5 +-
poppler/test/test_annotation.rb | 4 +-
poppler/test/test_page.rb | 18 -
rsvg2/Rakefile | 3 +-
rsvg2/ext/rsvg2/extconf.rb | 17 +-
rsvg2/ext/rsvg2/rbrsvghandle.c | 71 +-
rsvg2/ext/rsvg2/rsvg2.h | 6 +-
...rsvg-2.40.1-replace-canonicalize-file-name.diff | 75 --
.../test/rsvg2-test-utils.rb | 6 +-
{gdk3 => rsvg2}/test/run-test.rb | 31 +-
rsvg2/test/test-handle.rb | 91 ++
run-test.rb | 5 +-
vte/Rakefile | 16 +-
vte/ext/vte/extconf.rb | 2 +-
vte3/Rakefile | 22 +-
vte3/ext/vte3/extconf.rb | 6 +-
vte3/ext/vte3/rbvte.c | 4 +
vte3/ext/vte3/rbvte3conversions.h | 9 +
vte3/ext/vte3/rbvte3private.h | 1 -
vte3/ext/vte3/rbvteterminal.c | 20 +
vte3/lib/vte3/deprecated.rb | 9 +-
webkit-gtk/Rakefile | 37 +-
.../libsoup-2.48.0-remove-nonexistent-symbol.diff | 11 +
webkit-gtk/patches/webkitgtk-2.2.3-buildable.diff | 63 -
webkit-gtk/patches/webkitgtk-2.6.0-buildable.diff | 20 +
webkit-gtk/test/run-test.rb | 2 +
.../test/test_webkit_gtk_webview.rb | 12 +-
webkit-gtk/test/webkit-gtk-test-utils.rb | 18 +
.../test/webkit-gtk-test-utils/omissions.rb | 9 +-
webkit-gtk2/Rakefile | 23 +-
.../test/test_webkit_gtk_webview.rb | 12 +-
webkit-gtk2/test/webkit-gtk-test-utils.rb | 4 +-
.../test/webkit-gtk-test-utils/omissions.rb | 9 +-
348 files changed, 9418 insertions(+), 14307 deletions(-)
diff --git a/NEWS b/NEWS
index 6253e70..d82734b 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,319 @@
= NEWS
+== Ruby-GNOME2 2.2.5: 2015-04-24
+
+It is a GLib 2.44 support release.
+
+=== Changes
+
+==== Ruby/GLib2
+
+ * Improvements
+ * Supported GLib 2.44.
+ [GitHub#361][Reported by Benjamin Maisano]
+
+=== Thanks
+
+ * Benjamin Maisano
+
+== Ruby-GNOME2 2.2.4: 2014-12-23
+
+It is a x64 Windows support release.
+
+=== Changes
+
+==== Ruby/GLib2
+
+ * Improvements
+ * Stopped to call g_thread_init() for GLib 2.32.0 or later because
+ g_thread_init() is called automatically.
+ * Added GLib.format_size.
+ * Added GLib::Source#name.
+ * Added GLib::Source#name=.
+ * Added GLib::Source#ready_time.
+ * Added GLib::Source#ready_time=.
+ * Added GLib::Source#destroy.
+ * Fixes
+ * Fixed a bug that wrong converter is used on bigendian
+ environment.
+ [GitHub#270][Reported by mtasaka]
+
+==== Ruby/GIO2
+
+ * Improvements
+ * Added Gio::DBus.
+ * Fixes
+ * Fixed a bug that Gio::ContentType#executable? isn't defined by
+ correct name.
+
+==== Ruby/GTK2
+
+ * Improvements
+ * Gtk::AboutDialog#show: Supported license_type option.
+ [ruby-gnome2-devel-ja][Patch by Hiroyuki Ito]
+ * Fixes
+ * Gtk::AboutDialog#show: Fixed a bug that wrap_license option
+ doesn't work.
+ [ruby-gnome2-devel-ja][Patch by Hiroyuki Ito]
+
+==== Ruby/GObjectIntrospection
+
+ * Improvements
+ * Supported prefix removing from method name.
+ * Supported GList of UTF-8.
+ [ruby-gnome2-devel-en][Reported by Detlef Reichl]
+ * Added documentation.
+ [GitHub#267][Patch by Detlef Reichl]
+ * Fixes
+ * Fixed a bug that out only argument is required.
+ [GitHub#268][Reported by mtasaka]
+
+==== Ruby/GDK3
+
+ * Improvements
+ * Gdk::Window: Added deprecated constants for backward compatibility.
+ * Supported Gdk::Keyval module functions.
+ [GitHub#265][Reported by Detlef Reichl]
+ * Cairo::Context#set_source_rgba: Re-supported
+ (({set_source_rgba(r, g, b, a)})) style.
+ [GitHub#272][Patch by Detlef Reichl]
+ * [windows] Bundled the new default GNOME icon theme.
+ [GitHub#276][Reported by glurp]
+ * Fixes
+ * Gdk::Color.parse: Fixed unexpected API change.
+ [GitHub#276][Reported by glurp]
+ * Fixed a bug that Gdk::Event::Mask fallback doesn't work.
+ [GitHub#276][Reported by glurp]
+
+==== Ruby/GTK3
+
+ * Improvements
+ * Gtk::AboutDialog#show: Supported license_type option.
+ [ruby-gnome2-devel-ja][Patch by Hiroyuki Ito]
+ * Gtk::ActionBar: Added.
+ [GitHub#282][Suggested by Christopher L. Ramsey]
+ * Fixes
+ * Gtk::AboutDialog#show: Fixed a bug that wrap_license option
+ doesn't work.
+ [ruby-gnome2-devel-ja][Patch by Hiroyuki Ito]
+
+==== Ruby/RSVG2
+
+ * Improvements
+ * RSVG::Handle.new_from_file: Supported flags. You can open a
+ large file with (({:flags => :unlimited})).
+ [GitHub#263][Patch by Taro Matsuzawa]
+
+==== Ruby/Clutter
+
+ * Improvements
+ * Added Clutter::Feature.
+ * Fixes
+ * Added missing require for Ruby/Pango.
+ * Fixed initializing order.
+ [GitHub#274][Reported by mtasaka]
+
+=== Thanks
+
+ * Detlef Reichl
+ * Hiroyuki Ito
+ * mtasaka
+ * glurp
+ * Taro Matsuzawa
+ * Christopher L. Ramsey
+
+== Ruby-GNOME2 2.2.3: 2014-10-26
+
+It is a bug fix release.
+
+It's recommended that you upgrade if your application uses thread and
+runs on Ruby 2.0 or later.
+
+=== Changes
+
+==== All
+
+ * Improvements
+ * Supported auto native package install on SuSE.
+
+==== Ruby/GLib2
+
+ * Fixes
+ * Fixed infinite loop bug on Ruby 2.0 or later.
+ [ruby-gnome2-devel-ja] [Reported by Toshi Hatsune]
+
+==== Ruby/GDK3
+
+ * Fixes
+ * Added missing dependencies.
+ [GitHub#258] [Reported by Luis Daniel Gonzalez Orozco]
+
+==== Ruby/CairoGObject
+
+ * Improvements
+ * Supported auto required native package install by Homebrew.
+
+ * Fixes
+ * Fixed wrong package name on Debian.
+
+==== Ruby/VTE3
+
+ * Improvements
+ * Supported auto required native package install by Homebrew.
+
+==== Ruby/Clutter
+
+ * Improvements
+ * Added Clutter.check_version?.
+
+=== Thanks
+
+ * Luis Daniel Gonzalez Orozco
+ * Toshi Hatsune
+
+== Ruby-GNOME2 2.2.2: 2014-10-12
+
+It is a Windows package fix release.
+
+== Ruby-GNOME2 2.2.1: 2014-10-12
+
+It is a release that Ruby/GDK3 is migrated to
+Ruby/GObjectIntrospection based bindings.
+
+Some API changes in Ruby/GDK3 are expected but unexpected API
+changes may exist. If you find API change, please report it. If the
+API change provides non Rubyish API, it will be a bug.
+
+Ruby/GooCanvas is removed because we can't maintain it.
+
+=== Changes
+
+==== Ruby/GLib2
+
+ * Improvements
+ * Added GObject#unref to free large object immediately.
+
+ * Fixes
+ * [windows] Added a missing exported symbol. ((({rbg_inspect})))
+ * Fixed a bug that signal handler doesn't work on Ruby 2.1.
+ [ruby-gnome2-devel-en] [Reported by Carlo E. Prelz]
+ * Fixed free function (free -> xfree).
+
+==== Ruby/GObjectIntrospection
+
+ * Improvements
+ * Supported instantiating union.
+ * Accepted 5 or more the number of signals.
+ It may be increased for later GIO version.
+ [GitHub#229] [Reported by cosmo0920]
+ * Added "?" to boolean field value reader.
+ * Supported mapping function info to method.
+ * Don't handle MethodInfo as FunctionInfo.
+ * Accepted not GType struct as an input argument.
+ * Accepted getting a field value from not GType but
+ GType descendant sruct.
+ * Added Loader.register_constant_rename_map.
+ * Supported in GType array.
+ * Don't require needless array length argument.
+ * Supported finding suitable method that has optional argument.
+
+ * Fixes
+ * Fixed wrong argument index for Ruby objects.
+ * Fixed a bug that ArgInfo isn't passed.
+
+==== Ruby/CairoGObject
+
+ * Improvements
+ * Suppressed a warning that instance variable gboxed not initialized.
+
+==== Ruby/GIO2
+
+ * Improvements
+ * Supported GLib 2.42.0. Annotation for GObject Introspection is added
+ to g_pollable_input_stream_read_nonblocking() since GLib 2.42.0.
+ See also: https://bugzilla.gnome.org/show_bug.cgi?id=730493
+ * Supported GLib <= 2.36.0.
+
+ * Fixes
+ * Fixed a bug that .pc isn't installed. [Reported by OBATA Akio]
+
+==== Ruby/GDK3
+
+ * Improvements
+ * Migrated to Ruby/GObjectIntrospection based bindings.
+ * Gdk::Keyval::GDK_KEY_x style is deprecated. Use
+ Gdk::Keyval::KEY_x style instead.
+ * Accepted Gdk::RGBA for Cairo::Context#set_source_rgba.
+
+==== Ruby/GTK3
+
+ * Improvements
+ * Added Gtk::StackSwitcher.
+ * Supported interrupt in Gtk.main.
+ * Supported interrupt in Gtk::Dialog#run.
+ [Reported by Carlo E. Prelz]
+ * Added initialization with Gdk::RGBA value.
+ [GitHub#231] [Patch by Detlef Reichl]
+ * Added Gtk::Window#set_titlebar (enable the use of Gtk::HeaderBar).
+ [GitHub#236] [Patch by tescorg]
+ * Updated sample scripts.
+ [Patch by kitachro]
+
+ * Fixes
+ * Fixed memory leak of Gtk::Image.
+ [GitHub#252] [Reported by Michel Boaventura]
+
+==== Ruby/GTK2
+
+ * Improvements
+ * Fixed wrong property value on ppc64 and s390x.
+ [GitHub#256] [Reported by mtasaka]
+
+==== Ruby/GStreamer
+
+ * Improvements
+ * Added gstreamer.rb for Bundler's autoload.
+ [GitHub#232] [Reported by saepia]
+ * Added Caps.any and Caps.empty.
+ * Supported property for Gst::ChildProxy.
+ [GitHub#233] [Reported by saepia]
+
+ * Fixes
+ * Fixed a bug that Gst.init is failed.
+ [GitHub#232] [Reported by saepia]
+
+==== Ruby/Poppler
+
+ * Improvements
+ * Install Poppler with --with-glib option for Homebrew.
+ [GitHub#237] [Reported by Colin Dean]
+ * Removed needless `--with-glib` option. Now, it is the default.
+ [rabbit-shocker/rabbit#24] [Reported by Kazuhiro NISHIYAMA]
+
+==== Ruby/ClutterGStreamer
+
+ * Improvements
+ * Added clutter-gstreamer.rb to support Bundler's autoload.
+
+==== Ruby/GooCanvas
+
+ * Removed.
+
+=== Thanks
+
+ * OBATA Akio
+ * Carlo E. Prelz
+ * cosmo0920
+ * Detlef Reichl
+ * saepia
+ * tescorg
+ * Colin Dean
+ * Kazuhiro NISHIYAMA
+ * kitachro
+ * Michel Boaventura
+ * mtasaka
+
== Ruby-GNOME2 2.2.0: 2014-03-09
It is a release that Ruby/GIO2 is migrated to
diff --git a/README b/README
deleted file mode 100644
index 726bee5..0000000
--- a/README
+++ /dev/null
@@ -1,205 +0,0 @@
-# -*- RD -*-
-
-= README
-
-== Ruby-GNOME2 -- Ruby bindings for GNOME-2.x
-
-This is a set of bindings for the GNOME-2.x and GNOME-3.x libraries to
-use from Ruby 1.9.x and 2.0.0.
-
-== Release packages
-
-=== ruby-gtk2
-
- * Ruby/GLib2: GLib 2.12.x or later
- * Ruby/ATK: ATK 1.12.x or later
- * Ruby/Pango: Pango 1.14.x or later
- * Ruby/GdkPixbuf2: GTK+ 2.0.x or later
- * Ruby/GTK2: GTK+ 2.10.x or later
- * Ruby/GObjectIntrospection: GObject Introspection 1.32.1 or later
-
-=== ruby-gtk3
-
- * ruby-gtk2 - Ruby/GTK2
- * Ruby/GDK3: GTK+ 3.4.2 or later
- * Ruby/GTK3: GTK+ 3.4.2 or later
-
-=== ruby-gnome2-all
-
- * ruby-gtk2 + ruby-gtk3 - duplicated libraries
- * Ruby/RSVG: librsvg 2.8.0 or later
- * Ruby/Poppler: poppler-glib 0.8.0 or later
- * Ruby/VTE VTE 0.12.1 or later
- * Ruby/GtkSourceView2: GtkSourceView 2.0.0 or later
- * Ruby/GIO2: GIO 2.16.x or later
- * Ruby/CairoGObject: cairo-gobject 1.12.10 or later
- * Ruby/Clutter: Clutter 1.12.0 or later
- * Ruby/ClutterGTK: Clutter-GTK 1.2.0 or later
- * Ruby/ClutterGStreamer:Clutter-GStreamer 2.0.0 or later
- * Ruby/GtkSourceView3: GtkSourceView 3.4.2 or later
- * Ruby/VTE3: VTE 0.32.2 or later
- * Ruby/WebKitGTK: WebKitGTK+ 1.8.1 or later (for GTK+ 3)
- * Ruby/WebKitGTK2: WebKitGTK+ 1.8.1 or later (for GTK+ 2)
- * Ruby/GStreamer: GStreamer 1.0.0 or later
- * Ruby/GooCanvas: GooCanvas 0.8.0 or later
-
-=== Experimental / Incomplete:
-
- * ...
-
-=== Deprecated
-
- * Ruby/PanelApplet: gnome-panel 2.6.0 or later (deprecated since 0.16.0)
- * Ruby/GConf2: GConf 2.0.x or later
- * Ruby/GNOME2: libgnome-2.0.x, libgnomeui-2.0.x or later
- * Ruby/GnomeCanvas2: libgnomecanvas-2.0.x or later
- * Ruby/GnomePrint: libgnomeprint-2.8.x or later
- * Ruby/GnomePrintUI: libgnomeprintui-2.6.x or later
- * Ruby/GnomeVFS: GnomeVFS 2.0.x or later
- * Ruby/GtkHtml2: GtkHtml2 2.0.x or later
- * Ruby/GtkGLExt: GtkGLExt 1.0.3 or later
- * Ruby/Libart2: libart_lgpl 2.3.12 or later
- * Ruby/GtkSourceView: GtkSourceView 1.0.1 or later
- * Ruby/Libglade2: Libglade 2.0.x or later
- * Ruby/GtkMozEmbed: GtkMozEmbed (Mozilla 1.7.x or FireFox-1.0.x or later)
-
-== Install
-
- % ruby extconf.rb
- % make
- % sudo make install
-
-To compile and install a particular sub-binding, you can add arguments:
-
- % ruby extconf.rb [subdir]...
- e.g.) ruby extconf.rb glib2 pango atk gdk_pixbuf2 gtk2
-
-Or you can compile each sub-binding:
-
- % cd <each sub-directory>
- % ruby extconf.rb
- % make
- % sudo make install
-
-=== extconf.rb options
-
-: --ruby
- ruby directory
-
-: --topsrcdir
- top source directory
-
-: --topdir
- top directory
-
-: --strict
- if some libraries fail to compile/install, "make"
- command returns 1(exit 1)
-
-=== Environment Variables
-
-: CAIRO_PATH
- rcairo path (for Win32).
-
-=== Dependencies
-
-You should install a sub-binding with its dependencies. The
-current dependencies are:
-
-: Ruby/GLib
- none.
-
-: Ruby/ATK
- depends on Ruby/GLib.
-
-: Ruby/Pango
- depends on Ruby/GLib, rcairo(optional).
-
-: Ruby/GdkPixbuf
- depends on Ruby/GLib.
-
-: Ruby/GTK
- depends on Ruby/GLib, Ruby/ATK, Ruby/Pango,
- Ruby/GdkPixbuf, rcairo(optional)
-
-: Ruby/RSVG
- depends on Ruby/GLib, Ruby/GdkPixbuf2.
-
-: Ruby/Poppler
- depends on Ruby/GLib, Ruby/GdkPixbuf(optional), rcairo(optional).
-
-: Ruby/VTE
- depends on Ruby/GTK.
-
-: Ruby/GtkSourceView2
- depends on Ruby/GTK.
-
-: Ruby/GIO2
- depends on Ruby/GLib.
-
-=== Experimental
-
-: Ruby/GStreamer
- depends on Ruby/GLib.
-
-: Ruby/GooCanvas
- depends on Ruby/GTK.
-
-=== Deprecated
-
-: Ruby/PanelApplet
- depends on Ruby/GTK (since libpanel-applet 2.25) or
- Ruby/GNOME (before libpanel-applet 2.25).
-
-: Ruby/Libart
- depends on Ruby/GLib(Use mkmf-gnome2.rb only).
-
-: Ruby/GConf
- depends on Ruby/GLib.
-
-: Ruby/GNOME
- depends on Ruby/GnomeCanvas.
-
-: Ruby/GnomeCanvas
- depends on Ruby/GTK, Ruby/Libart.
-
-: Ruby/GnomeVFS
- depends on Ruby/GLib.
-
-: Ruby/GnomePrint
- depends on Ruby/GLib, Ruby/Pango, Ruby/Libart2.
-
-: Ruby/GnomePrintUI
- depends on Ruby/GTK, Ruby/GnomePrint.
-
-: Ruby/GtkHtml2
- depends on Ruby/GTK.
-
-: Ruby/GtkGLExt
- depends on Ruby/GTK, rbogl.
-
-: Ruby/GtkSourceView
- depends on Ruby/GTK.
-
-: Ruby/Libglade
- depends on Ruby/GTK, Ruby/GNOME(optional), REXML(optional).
-
-== Bugs
-
-Please report bugs either in our bug tracker
-((<URL:http://sourceforge.net/tracker/?group_id=53614&atid=470969>))
-
-or on the ruby-gnome2-devel-en / ruby-gnome2-devel-ja mailing list
-((<URL:http://sourceforge.net/mail/?group_id=53614>))
-
-== Copying
-
-Copyright (c) 2002-2009 Ruby-GNOME2 Project Team
-
-This program is free software.
-You can distribute/modify this program under the terms of
-the GNU LESSER GENERAL PUBLIC LICENSE Version 2.1.
-
-== Project Website
-
-((<URL:http://ruby-gnome2.sourceforge.jp/>))
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..b09edbd
--- /dev/null
+++ b/README.md
@@ -0,0 +1,141 @@
+# README
+
+[![Build Status](https://travis-ci.org/ruby-gnome2/ruby-gnome2.svg?branch=master)](https://travis-ci.org/ruby-gnome2/ruby-gnome2)
+
+## Ruby-GNOME2 -- Ruby bindings for GNOME-2.x
+
+This is a set of bindings for the GNOME-2.x and GNOME-3.x libraries to
+use from Ruby 1.9.x, 2.0.0 and 2.1.
+
+## Release packages
+
+### ruby-gtk2
+
+* Ruby/GLib2: GLib 2.12.x or later
+* Ruby/ATK: ATK 1.12.x or later
+* Ruby/Pango: Pango 1.14.x or later
+* Ruby/GdkPixbuf2: GTK+ 2.0.x or later
+* Ruby/GTK2: GTK+ 2.10.x or later
+* Ruby/GObjectIntrospection: GObject Introspection 1.32.1 or later
+
+### ruby-gtk3
+
+* ruby-gtk2 - Ruby/GTK2
+* Ruby/GDK3: GTK+ 3.4.2 or later
+* Ruby/GTK3: GTK+ 3.4.2 or later
+
+### ruby-gnome2-all
+
+* ruby-gtk2 + ruby-gtk3
+* Ruby/RSVG: librsvg 2.8.0 or later
+* Ruby/Poppler: poppler-glib 0.8.0 or later
+* Ruby/VTE VTE 0.12.1 or later
+* Ruby/GtkSourceView2: GtkSourceView 2.0.0 or later
+* Ruby/GIO2: GIO 2.16.x or later
+* Ruby/CairoGObject: cairo-gobject 1.12.10 or later
+* Ruby/Clutter: Clutter 1.12.0 or later
+* Ruby/ClutterGTK: Clutter-GTK 1.2.0 or later
+* Ruby/ClutterGStreamer:Clutter-GStreamer 2.0.0 or later
+* Ruby/GtkSourceView3: GtkSourceView 3.4.2 or later
+* Ruby/VTE3: VTE 0.32.2 or later
+* Ruby/WebKitGTK: WebKitGTK+ 1.8.1 or later (for GTK+ 3)
+* Ruby/WebKitGTK2: WebKitGTK+ 1.8.1 or later (for GTK+ 2)
+* Ruby/GStreamer: GStreamer 1.0.0 or later
+
+### Experimental / Incomplete:
+
+* ...
+
+## Install
+
+ % ruby extconf.rb
+ % make
+ % sudo make install
+
+To compile and install a particular sub-binding, you can add arguments:
+
+ % ruby extconf.rb [subdir]...
+ e.g.) ruby extconf.rb glib2 pango atk gdk_pixbuf2 gtk2
+
+Or you can compile each sub-binding:
+
+ % cd <each sub-directory>
+ % ruby extconf.rb
+ % make
+ % sudo make install
+
+### extconf.rb options
+
+* `--ruby`
+ * ruby directory
+
+* `--topsrcdir`
+ * top source directory
+
+* `--topdir`
+ * top directory
+
+* `--strict`
+ * if some libraries fail to compile/install, "make"
+ command returns 1(exit 1)
+
+### Environment Variables
+
+* `CAIRO_PATH`
+ * rcairo path (for Win32).
+
+### Dependencies
+
+You should install a sub-binding with its dependencies. The
+current dependencies are:
+
+* Ruby/GLib
+ * none.
+* Ruby/ATK
+ * depends on Ruby/GLib.
+* Ruby/Pango
+ * depends on Ruby/GLib, rcairo.
+* Ruby/GdkPixbuf
+ * depends on Ruby/GLib.
+* Ruby/GTK
+ * depends on Ruby/GLib, Ruby/ATK, Ruby/Pango,
+ Ruby/GdkPixbuf, rcairo
+* Ruby/RSVG
+ * depends on Ruby/GLib, Ruby/GdkPixbuf2.
+* Ruby/Poppler
+ * depends on Ruby/GLib, Ruby/GdkPixbuf(optional), rcairo.
+* Ruby/VTE
+ * depends on Ruby/GTK.
+* Ruby/GtkSourceView2
+ * depends on Ruby/GTK.
+* Ruby/GIO2
+ * depends on Ruby/GLib.
+* Ruby/GStreamer
+ * depends on Ruby/GLib.
+
+### Experimental
+
+* ...
+
+## Bugs
+
+Please report bugs either in our bug tracker
+
+* [https://github.com/ruby-gnome2/ruby-gnome2/issues](https://github.com/ruby-gnome2/ruby-gnome2/issues) (current)
+* [http://sourceforge.net/tracker/?group_id=53614&atid=470969](http://sourceforge.net/tracker/?group_id=53614&atid=470969) (previous)
+
+or on the ruby-gnome2-devel-en / ruby-gnome2-devel-ja mailing list
+
+* [http://sourceforge.net/mail/?group_id=53614](http://sourceforge.net/mail/?group_id=53614)
+
+## Copying
+
+Copyright (c) 2002-2014 Ruby-GNOME2 Project Team
+
+This program is free software.
+You can distribute/modify this program under the terms of
+the GNU LESSER GENERAL PUBLIC LICENSE Version 2.1.
+
+## Project Website
+
+[http://ruby-gnome2.sourceforge.jp/](http://ruby-gnome2.sourceforge.jp/)
diff --git a/Rakefile b/Rakefile
index 946ab64..7f2703d 100644
--- a/Rakefile
+++ b/Rakefile
@@ -1,6 +1,7 @@
# -*- ruby -*-
require "pathname"
+require "find"
require "tmpdir"
require "open-uri"
@@ -53,6 +54,11 @@ def package(base_name, paths, needless_paths=nil)
Dir.glob("#{_dist_dir}/**/{#{needless_paths.join(',')}}") do |needless_path|
rm_rf(needless_path)
end
+ Dir.glob("#{_dist_dir}/**/*/") do |directory|
+ if (Dir.entries(directory) - [".", ".."]).empty?
+ rm_r(directory)
+ end
+ end
sh("tar", "cvfz", archive_name(base_name), _dist_dir)
ensure
rm_rf(_dist_dir) if _dist_dir
@@ -99,6 +105,16 @@ task :build => ["Makefile"] do
sh("make")
end
+namespace :windows do
+ desc "build all packages for Windows"
+ task :build do
+ cd("build") do
+ sh("vagrant", "destroy", "--force")
+ sh("vagrant", "up")
+ end
+ end
+end
+
desc "clean all packages"
task :clean do
sh("make", "clean") if File.exist?("Makefile")
@@ -127,16 +143,18 @@ gtk2_packages = [
"gdk_pixbuf2",
"gtk2",
]
-gtk3_packages = gtk2_packages - ["gtk2"] + ["gdk3", "gtk3"]
+gtk3_packages = gtk2_packages - ["gtk2"] + [
+ "cairo-gobject",
+ "gdk3",
+ "gtk3",
+]
gnome2_packages = gtk2_packages + gtk3_packages + [
- "goocanvas",
"gstreamer",
"gtksourceview2",
"poppler",
"rsvg2",
"vte",
"vte3",
- "cairo-gobject",
"gtksourceview3",
"clutter",
"clutter-gtk",
@@ -148,7 +166,7 @@ gnome2_packages = gnome2_packages.uniq
namespace :dist do
base_files = ["AUTHORS", "COPYING.LIB", "NEWS",
- "README", "Rakefile",
+ "README.md", "Rakefile",
"exec_make.rb", "extconf.rb", "run-test.rb"]
desc "make Ruby/GTK2 package"
task :gtk2 do
@@ -312,7 +330,7 @@ task :release => ["misc/release.rb", :dist] do
archive_name(base_name)
end
ruby("misc/release.rb", sf_user_name, project_id, project_name,
- package_name, release_name, "README:1", "NEWS",
+ package_name, release_name, "README.md:1", "NEWS",
*archive_names)
end
@@ -349,22 +367,22 @@ namespace :gem do
end
end
- namespace :win32 do
- win32_unsupported_packages = [
- "goocanvas",
+ namespace :windows do
+ windows_unsupported_packages = [
+ "gtksourceview2",
"vte",
"vte3",
"webkit-gtk",
"webkit-gtk2",
]
- win32_gnome2_packages = gnome2_packages - win32_unsupported_packages
+ windows_gnome2_packages = gnome2_packages - windows_unsupported_packages
namespace :build do
desc "build all Windows binaries"
task :vendor do
- win32_gnome2_packages.each do |package|
+ windows_gnome2_packages.each do |package|
Dir.chdir(package) do
- ruby("-S", "rake", "native:build", "win32:build")
+ ruby("-S", "rake", "native:build", "windows:build")
end
end
end
@@ -372,15 +390,16 @@ namespace :gem do
desc "build all Windows bindings"
task :ext do
change_environment_variable("MAKE" => "make debugflags=") do
- win32_gnome2_packages.each do |package|
+ windows_gnome2_packages.each do |package|
Dir.chdir(package) do
tasks = [
"cross",
- "win32:builder:build:prepare:pkg_config",
+ "windows:builder:build:prepare:pkg_config",
"native",
"gem",
]
- ruby("-S", "rake", "RUBY_CC_VERSION=1.9.3:2.0.0:2.1.0", *tasks)
+ ruby_cc_version = ENV["RUBY_CC_VERSION"] || "2.0.0:2.1.5"
+ ruby("-S", "rake", "RUBY_CC_VERSION=#{ruby_cc_version}", *tasks)
end
end
end
@@ -389,7 +408,7 @@ namespace :gem do
desc "build GSettings schemas for all Windows binaries"
task :schema do
Dir.mktmpdir do |dir|
- win32_gnome2_packages.each do |package|
+ windows_gnome2_packages.each do |package|
gschema_xml_glob = File.join(package, "vendor", "local", "share",
"glib-2.0", "schemas", "*.gschema.xml")
Dir.glob(gschema_xml_glob).each do |schema|
@@ -405,30 +424,30 @@ namespace :gem do
desc "build all Windows gems"
task :build => [
- "gem:win32:build:vendor",
- "gem:win32:build:schema",
- "gem:win32:build:ext",
+ "gem:windows:build:vendor",
+ "gem:windows:build:schema",
+ "gem:windows:build:ext",
]
desc "clean all Windows gems build"
task :clean do
- win32_gnome2_packages.each do |package|
+ windows_gnome2_packages.each do |package|
rm_rf(File.join(package, "tmp"))
end
end
desc "download DLL for Windows all gems"
task :download do
- win32_gnome2_packages.each do |package|
+ windows_gnome2_packages.each do |package|
Dir.chdir(package) do
- ruby("-S", "rake", "win32:download")
+ ruby("-S", "rake", "windows:download")
end
end
end
desc "push all Windows gems"
task :push do
- win32_gnome2_packages.each do |package|
+ windows_gnome2_packages.each do |package|
ruby("-S", "gem", "push",
*Dir.glob(File.join(package, "pkg", "*-#{version}-x86-mingw32.gem")))
end
diff --git a/atk/Rakefile b/atk/Rakefile
index c4122a5..3e46d97 100644
--- a/atk/Rakefile
+++ b/atk/Rakefile
@@ -15,7 +15,7 @@ package_task = GNOME2::Rake::PackageTask.new do |package|
:name => "atk",
:download_site => :gnome,
:label => "atk",
- :version => "2.10.0",
+ :version => "2.14.0",
:compression_method => "xz",
:windows => {
:configure_args => [
diff --git a/atk/ext/atk/extconf.rb b/atk/ext/atk/extconf.rb
index cefad32..c194286 100644
--- a/atk/ext/atk/extconf.rb
+++ b/atk/ext/atk/extconf.rb
@@ -42,7 +42,7 @@ have_func 'rb_errinfo', ruby_header
:target_build_dir => build_dir)
end
-setup_win32(module_name, base_dir)
+setup_windows(module_name, base_dir)
unless required_pkg_config_package([package_id, 1, 12, 0],
:debian => "libatk1.0-dev",
diff --git a/cairo-gobject/Rakefile b/cairo-gobject/Rakefile
index f7b025e..0925356 100644
--- a/cairo-gobject/Rakefile
+++ b/cairo-gobject/Rakefile
@@ -17,16 +17,16 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
$LOAD_PATH.unshift("./../glib2/lib")
-require "gnome2-raketask"
+require "gnome2/rake/package-task"
-package = GNOME2Package.new do |_package|
- _package.summary = "Ruby/CairoGObject is a Ruby binding of cairo-gobject."
- _package.description = "Ruby/CairoGObject is a Ruby binding of cairo-gobject."
- _package.dependency.gem.runtime = ["cairo", "glib2"]
- _package.dependency.gem.development = ["test-unit-notify"]
- _package.win32.packages = []
- _package.win32.dependencies = []
- _package.win32.build_dependencies = ["cairo", "glib2"]
- _package.win32.build_packages = []
+package_task = GNOME2::Rake::PackageTask.new do |package|
+ package.summary = "Ruby/CairoGObject is a Ruby binding of cairo-gobject."
+ package.description = "Ruby/CairoGObject is a Ruby binding of cairo-gobject."
+ package.dependency.gem.runtime = ["cairo", "glib2"]
+ package.dependency.gem.development = ["test-unit-notify"]
+ package.windows.packages = []
+ package.windows.dependencies = []
+ package.windows.build_dependencies = ["cairo", "glib2"]
+ package.windows.build_packages = []
end
-package.define_tasks
+package_task.define
diff --git a/cairo-gobject/ext/cairo-gobject/extconf.rb b/cairo-gobject/ext/cairo-gobject/extconf.rb
index c54e55a..72084ba 100755
--- a/cairo-gobject/ext/cairo-gobject/extconf.rb
+++ b/cairo-gobject/ext/cairo-gobject/extconf.rb
@@ -54,28 +54,16 @@ end
:target_build_dir => build_dir)
end
-rcairo_options = {}
-rcairo_source_dir_names = ["rcairo"]
-if /mingw|cygwin|mswin/ =~ RUBY_PLATFORM
- rcairo_source_dir_names.unshift("rcairo.win32")
-end
-rcairo_source_dir_names.each do |rcairo_source_dir_name|
- rcairo_source_dir = top_dir.parent.expand_path + rcairo_source_dir_name
- if rcairo_source_dir.exist?
- rcairo_options[:rcairo_source_dir] = rcairo_source_dir.to_s
- break
- end
-end
-
-unless check_cairo(rcairo_options)
+unless check_cairo(:top_dir => top_dir)
exit(false)
end
-setup_win32(module_name, base_dir)
+setup_windows(module_name, base_dir)
unless required_pkg_config_package(package_id,
- :debian => "libcairo-gobject2",
- :fedora => "cairo-gobject-devel")
+ :debian => "libcairo2-dev",
+ :fedora => "cairo-gobject-devel",
+ :homebrew => "cairo")
exit(false)
end
diff --git a/cairo-gobject/ext/cairo-gobject/rb-cairo-gobject.c b/cairo-gobject/ext/cairo-gobject/rb-cairo-gobject.c
index b3f4c71..05c96bf 100644
--- a/cairo-gobject/ext/cairo-gobject/rb-cairo-gobject.c
+++ b/cairo-gobject/ext/cairo-gobject/rb-cairo-gobject.c
@@ -27,13 +27,17 @@ static gpointer \
prefix ## _robj2instance(VALUE rb_object, \
G_GNUC_UNUSED gpointer user_data) \
{ \
- VALUE rb_boxed; \
+ ID id_gboxed; \
+ VALUE rb_boxed = Qnil; \
\
- rb_boxed = rb_iv_get(rb_object, "gboxed"); \
+ CONST_ID(id_gboxed, "gboxed"); \
+ if (rb_ivar_defined(rb_object, id_gboxed)) { \
+ rb_boxed = rb_ivar_get(rb_object, id_gboxed); \
+ } \
if (NIL_P(rb_boxed)) { \
gpointer cr_object = RVAL2CR(rb_object); \
rb_boxed = rbgobj_make_boxed_default(cr_object, gtype); \
- rb_iv_set(rb_object, "gboxed", rb_boxed); \
+ rb_ivar_set(rb_object, id_gboxed, rb_boxed); \
} \
\
return rbgobj_boxed_get_default(rb_boxed, gtype); \
diff --git a/clutter-gstreamer/Rakefile b/clutter-gstreamer/Rakefile
index 847ce00..9ec9f6c 100644
--- a/clutter-gstreamer/Rakefile
+++ b/clutter-gstreamer/Rakefile
@@ -1,6 +1,6 @@
# -*- ruby -*-
#
-# Copyright (C) 2013 Ruby-GNOME2 Project Team
+# Copyright (C) 2013-2014 Ruby-GNOME2 Project Team
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -22,7 +22,7 @@ require "gnome2/rake/package-task"
package_task = GNOME2::Rake::PackageTask.new do |package|
package.summary = "Ruby/ClutterGStreamer is a Ruby binding of Clutter-GStreamer."
package.description = "Ruby/ClutterGStreamer is a Ruby binding of Clutter-GStreamer."
- package.dependency.gem.runtime = ["clutter", "gstreamer"]
+ package.dependency.gem.runtime = ["gdk_pixbuf2", "clutter", "gstreamer"]
package.dependency.gem.development = ["test-unit-notify"]
package.windows.packages = []
package.windows.dependencies = []
@@ -38,6 +38,7 @@ package_task = GNOME2::Rake::PackageTask.new do |package|
package.windows.gobject_introspection_dependencies = [
"atk",
"pango",
+ "gdk_pixbuf2",
"clutter",
"gstreamer",
]
@@ -46,21 +47,19 @@ package_task = GNOME2::Rake::PackageTask.new do |package|
:name => "clutter-gst",
:download_site => :gnome,
:label => "Clutter-GStreamer",
- :version => "2.0.10",
+ :version => "3.0.0",
:compression_method => "xz",
:windows => {
:configure_args => [
"--enable-introspection",
],
- :built_file => "bin/libclutter-gst-2.0-0.dll",
+ :built_file => "bin/libclutter-gst-3.0-0.dll",
},
}
]
end
package_task.define
-Rake::Task["native:clutter-gstreamer:i386-mingw32"].prerequisites.clear
-
namespace :dependency do
desc "Install depenencies"
task :install do
diff --git a/clutter-gstreamer/lib/clutter-gst.rb b/clutter-gstreamer/lib/clutter-gst.rb
index 5254c23..ec32546 100644
--- a/clutter-gstreamer/lib/clutter-gst.rb
+++ b/clutter-gstreamer/lib/clutter-gst.rb
@@ -14,6 +14,7 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+require "gdk_pixbuf2"
require "clutter"
require "gst"
@@ -43,6 +44,8 @@ module ClutterGst
remove_method(:init)
remove_method(:const_missing)
end
+ Gst.init if Gst.respond_to?(:init)
+ Clutter.init if Clutter.respond_to?(:init)
loader = Loader.new(self, argv)
loader.load("ClutterGst")
end
@@ -61,11 +64,10 @@ module ClutterGst
def pre_load(repository, namespace)
init = repository.find(namespace, "init")
arguments = [
- 1 + @init_arguments.size,
[$0] + @init_arguments,
]
error, returned_arguments = init.invoke(:arguments => arguments)
- @init_arguments.replace(returned_arguments)
+ @init_arguments.replace(returned_arguments[1..-1])
if error.to_i <= 0
raise InitError, "failed to initialize Clutter-GStreamer: #{error.name}"
end
diff --git a/webkit-gtk/test/webkit-gtk-test-utils.rb b/clutter-gstreamer/lib/clutter-gstreamer.rb
similarity index 85%
copy from webkit-gtk/test/webkit-gtk-test-utils.rb
copy to clutter-gstreamer/lib/clutter-gstreamer.rb
index 4dd02d7..0d04663 100644
--- a/webkit-gtk/test/webkit-gtk-test-utils.rb
+++ b/clutter-gstreamer/lib/clutter-gstreamer.rb
@@ -1,4 +1,4 @@
-# Copyright (C) 2013 Ruby-GNOME2 Project Team
+# Copyright (C) 2014 Ruby-GNOME2 Project Team
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -14,8 +14,4 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-require "test-unit"
-require "test/unit/notify"
-
-module WebKitGtkTestUtils
-end
+require "clutter-gst"
diff --git a/clutter-gstreamer/sample/video-player.rb b/clutter-gstreamer/sample/video-player.rb
index 935bc1f..fee05e7 100755
--- a/clutter-gstreamer/sample/video-player.rb
+++ b/clutter-gstreamer/sample/video-player.rb
@@ -11,7 +11,7 @@
# Copyright (C) 2007,2008 OpenedHand
# Copyright (C) 2013 Collabora
#
-# Copyright (C) 2013 Ruby-GNOME2 Project Team
+# Copyright (C) 2013-2014 Ruby-GNOME2 Project Team
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -27,8 +27,6 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-# NOTE: This sample code is for libclutter-gst (a library by C) 2.0.2.
-
require "optparse"
require "clutter-gst"
@@ -220,10 +218,6 @@ app.vtexture.filename = ARGV[0]
pipe = app.vtexture.pipeline
raise "Unable to get gstreamer pipeline!" unless pipe
-# TODO: want to not require Gst.init
-# prepare Gst's methods (e.g. iterate_sinks)
-Gst.init
-
iter = pipe.iterate_sinks
raise "Unable to iterate over sinks!" unless iter
@@ -259,8 +253,7 @@ app.control_seekbar.opacity = 0x99
app.control_label = Clutter::Text.new
app.control_label.font_name = "Sans Bold 14"
-# TODO: segfault
-#app.control_label.text = File.basename(ARGV[0])
+app.control_label.text = File.basename(ARGV[0])
stage.title = File.basename(ARGV[0]) # substitutes for label text
app.control_label.color = control_color1
diff --git a/clutter-gstreamer/sample/video-sink-navigation.rb b/clutter-gstreamer/sample/video-sink-navigation.rb
index 3189f60..fa25ca4 100755
--- a/clutter-gstreamer/sample/video-sink-navigation.rb
+++ b/clutter-gstreamer/sample/video-sink-navigation.rb
@@ -10,7 +10,7 @@
#
# Copyright (C) 2007,2008 OpenedHand
#
-# Copyright (C) 2013 Ruby-GNOME2 Project Team
+# Copyright (C) 2013-2014 Ruby-GNOME2 Project Team
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -26,7 +26,6 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-# NOTE: This sample code is for libclutter-gst (a library by C) 2.0.2.
require "clutter-gst"
stage = Clutter::Stage.new
diff --git a/clutter-gstreamer/sample/video-sink.rb b/clutter-gstreamer/sample/video-sink.rb
index 56f834d..8a5c5f3 100755
--- a/clutter-gstreamer/sample/video-sink.rb
+++ b/clutter-gstreamer/sample/video-sink.rb
@@ -10,7 +10,7 @@
#
# Copyright (C) 2007,2008 OpenedHand
#
-# Copyright (C) 2013 Ruby-GNOME2 Project Team
+# Copyright (C) 2013-2014 Ruby-GNOME2 Project Team
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -26,7 +26,6 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-# NOTE: This sample code is for libclutter-gst (a library by C) 2.0.2.
require "clutter-gst"
stage = Clutter::Stage.new
diff --git a/clutter-gstreamer/test/clutter-gstreamer-test-utils.rb b/clutter-gstreamer/test/clutter-gstreamer-test-utils.rb
index 6f33510..615d835 100644
--- a/clutter-gstreamer/test/clutter-gstreamer-test-utils.rb
+++ b/clutter-gstreamer/test/clutter-gstreamer-test-utils.rb
@@ -1,4 +1,4 @@
-# Copyright (C) 2013 Ruby-GNOME2 Project Team
+# Copyright (C) 2013-2014 Ruby-GNOME2 Project Team
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -18,4 +18,24 @@ require "test-unit"
require "test/unit/notify"
module ClutterGStreamerTestUtils
+ def later_version?(major, minor, micro=nil)
+ micro ||= 0
+ clutter_gstreamer_version = [
+ ClutterGst::MAJOR_VERSION,
+ ClutterGst::MINOR_VERSION,
+ ClutterGst::MICRO_VERSION,
+ ]
+ (clutter_gstreamer_version <=> [major, minor, micro]) >= 0
+ end
+
+ def only_clutter_gstreamer_version(major, minor, micro=nil)
+ micro ||= 0
+ unless later_version?(major, minor, micro)
+ omit("Require Clutter-GStreamer >= #{major}.#{minor}.#{micro}")
+ end
+ end
+
+ def omit_on_travis_ci
+ omit("This test can't be run on Travis CI") if ENV["CI"]
+ end
end
diff --git a/clutter-gstreamer/test/run-test.rb b/clutter-gstreamer/test/run-test.rb
index 470c42e..e8dea03 100755
--- a/clutter-gstreamer/test/run-test.rb
+++ b/clutter-gstreamer/test/run-test.rb
@@ -1,6 +1,6 @@
#!/usr/bin/env ruby
#
-# Copyright (C) 2013 Ruby-GNOME2 Project Team
+# Copyright (C) 2013-2014 Ruby-GNOME2 Project Team
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -55,6 +55,9 @@ require "gobject-introspection-test-utils"
$LOAD_PATH.unshift(File.join(clutter_base, "test"))
require "clutter-test-utils"
+$LOAD_PATH.unshift(File.join(clutter_gstreamer_base, "test"))
+require "clutter-gstreamer-test-utils"
+
require "clutter-gst"
exit Test::Unit::AutoRunner.run(true)
diff --git a/clutter-gstreamer/test/test-clutter-gst.rb b/clutter-gstreamer/test/test-clutter-gst.rb
index 2eec5c1..e546d88 100644
--- a/clutter-gstreamer/test/test-clutter-gst.rb
+++ b/clutter-gstreamer/test/test-clutter-gst.rb
@@ -1,4 +1,4 @@
-# Copyright (C) 2013 Ruby-GNOME2 Project Team
+# Copyright (C) 2013-2014 Ruby-GNOME2 Project Team
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -15,7 +15,10 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
class ClutterGstTest < Test::Unit::TestCase
+ include ClutterGStreamerTestUtils
+
def test_init
+ omit_on_travis_ci
assert_nothing_raised do
ClutterGst.init
end
diff --git a/clutter-gtk/Rakefile b/clutter-gtk/Rakefile
index 8634c4f..02c0674 100644
--- a/clutter-gtk/Rakefile
+++ b/clutter-gtk/Rakefile
@@ -1,6 +1,6 @@
# -*- ruby -*-
#
-# Copyright (C) 2013 Ruby-GNOME2 Project Team
+# Copyright (C) 2013-2014 Ruby-GNOME2 Project Team
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -47,7 +47,7 @@ package_task = GNOME2::Rake::PackageTask.new do |package|
:name => "clutter-gtk",
:download_site => :gnome,
:label => "Clutter-GTK",
- :version => "1.4.4",
+ :version => "1.6.0",
:compression_method => "xz",
:windows => {
:configure_args => [
@@ -65,8 +65,6 @@ package_task = GNOME2::Rake::PackageTask.new do |package|
end
package_task.define
-Rake::Task["native:clutter-gtk:i386-mingw32"].prerequisites.clear
-
namespace :dependency do
desc "Install depenencies"
task :install do
diff --git a/clutter-gtk/lib/clutter-gtk.rb b/clutter-gtk/lib/clutter-gtk.rb
index 30c1ac5..3910210 100644
--- a/clutter-gtk/lib/clutter-gtk.rb
+++ b/clutter-gtk/lib/clutter-gtk.rb
@@ -62,13 +62,12 @@ module ClutterGtk
def pre_load(repository, namespace)
init = repository.find(namespace, "init")
arguments = [
- 1 + @init_arguments.size,
[$0] + @init_arguments,
]
error, returned_arguments = init.invoke(:arguments => arguments)
- @init_arguments.replace(returned_arguments)
+ @init_arguments.replace(returned_arguments[1..-1])
if error.to_i <= 0
- raise InitError, "failed to initialize Clutter: #{error.name}"
+ raise InitError, "failed to initialize Clutter-GTK: #{error.name}"
end
end
diff --git a/clutter/Rakefile b/clutter/Rakefile
index 539a2d8..58785dc 100644
--- a/clutter/Rakefile
+++ b/clutter/Rakefile
@@ -1,6 +1,6 @@
# -*- ruby -*-
#
-# Copyright (C) 2012-2013 Ruby-GNOME2 Project Team
+# Copyright (C) 2012-2014 Ruby-GNOME2 Project Team
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -22,7 +22,11 @@ require "gnome2/rake/package-task"
package_task = GNOME2::Rake::PackageTask.new do |package|
package.summary = "Ruby/Clutter is a Ruby binding of Clutter."
package.description = "Ruby/Clutter is a Ruby binding of Clutter."
- package.dependency.gem.runtime = ["cairo-gobject", "gobject-introspection"]
+ package.dependency.gem.runtime = [
+ "cairo-gobject",
+ "gobject-introspection",
+ "pango"
+ ]
package.dependency.gem.development = ["test-unit-notify"]
package.windows.packages = []
package.windows.dependencies = []
@@ -43,15 +47,14 @@ package_task = GNOME2::Rake::PackageTask.new do |package|
# MinGW w64 bundles old OpenGL headers. Here are changes to build Cogl:
#
# (1) Put the latest glext.h that can be downloaded from
- # http://www.opengl.org/registry/api/glext.h into
- # /usr/i686-w64-mingw32/include/GL/ directory:
+ # https://www.opengl.org/registry/api/GL/glext.h into
+ # /usr/share/mingw-w64/include/GL/ directory:
#
- # % wget http://www.opengl.org/registry/api/glext.h
- # % sudo cp glext.h /usr/i686-w64-mingw32/include/GL/
- # % sudo chown root:root /usr/i686-w64-mingw32/include/GL/glext.h
+ # % wget https://www.opengl.org/registry/api/GL/glext.h
+ # % sudo install glext.h /usr/share/mingw-w64/include/GL/
#
# (2) Add missing declarations and includes to
- # /usr/i686-w64-mingw32/include/GL/gl.h:
+ # /usr/share/mingw-w64/include/GL/gl.h:
#
# Before:
# ...
@@ -79,52 +82,60 @@ package_task = GNOME2::Rake::PackageTask.new do |package|
:name => "cogl",
:download_site => :gnome,
:label => "Cogl",
- :version => "1.16.2",
+ :version => "1.18.2",
:compression_method => "xz",
:windows => {
:configure_args => [
"--disable-glibtest",
"--enable-introspection",
],
+ :built_file => "bin/libcogl-20.dll",
},
},
{
:name => "json-glib",
:download_site => :gnome,
:label => "JSON-GLib",
- :version => "0.16.2",
+ :version => "1.0.2",
:compression_method => "xz",
:windows => {
:configure_args => [
"--enable-introspection",
],
+ :patches => [
+ "json-glib-1.0.2-add-missing-config-h.diff",
+ ],
+ :need_autoreconf => true,
+ :built_file => "bin/libjson-glib-1.0-0.dll",
},
},
{
:name => "clutter",
:download_site => :gnome,
:label => "Clutter",
- :version => "1.16.4",
+ :version => "1.20.0",
:compression_method => "xz",
:windows => {
:configure_args => [
"--enable-introspection",
],
:build_concurrently => false,
+ :built_file => "bin/libclutter-1.0-0.dll",
},
}
]
package.cross_compiling do |spec|
if /mingw|mswin/ =~ spec.platform.to_s
spec.add_runtime_dependency("atk", "= #{package.version}")
- spec.add_runtime_dependency("pango", "= #{package.version}")
spec.add_runtime_dependency("gdk_pixbuf2", "= #{package.version}")
end
end
end
package_task.define
-Rake::Task["native:clutter:i386-mingw32"].prerequisites.clear
+if Rake::Task.task_defined?("native:clutter:i386-mingw32")
+ Rake::Task["native:clutter:i386-mingw32"].prerequisites.clear
+end
namespace :dependency do
desc "Install depenencies"
diff --git a/clutter/lib/clutter.rb b/clutter/lib/clutter.rb
index 10548f1..d882754 100644
--- a/clutter/lib/clutter.rb
+++ b/clutter/lib/clutter.rb
@@ -1,4 +1,4 @@
-# Copyright (C) 2012-2013 Ruby-GNOME2 Project Team
+# Copyright (C) 2012-2014 Ruby-GNOME2 Project Team
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -16,6 +16,7 @@
require "gobject-introspection"
require "cairo-gobject"
+require "pango"
base_dir = Pathname.new(__FILE__).dirname.dirname.expand_path
vendor_dir = base_dir + "vendor" + "local"
@@ -26,7 +27,6 @@ GObjectIntrospection.prepend_typelib_path(vendor_girepository_dir)
if vendor_dir.exist?
require "atk"
- require "pango"
require "gdk_pixbuf2"
end
@@ -54,11 +54,14 @@ module Clutter
require "clutter/actor"
require "clutter/actor-iter"
require "clutter/animatable"
+ require "clutter/brightness-contrast-effect"
require "clutter/cairo"
+ require "clutter/clutter"
require "clutter/color"
require "clutter/event"
require "clutter/point"
require "clutter/text"
+ require "clutter/text-buffer"
require "clutter/threads"
end
end
@@ -79,11 +82,10 @@ module Clutter
def pre_load(repository, namespace)
init = repository.find(namespace, "init")
arguments = [
- 1 + @init_arguments.size,
[$0] + @init_arguments,
]
error, returned_arguments = init.invoke(:arguments => arguments)
- @init_arguments.replace(returned_arguments)
+ @init_arguments.replace(returned_arguments[1..-1])
if error.to_i <= 0
raise InitError, "failed to initialize Clutter: #{error.name}"
end
@@ -91,6 +93,8 @@ module Clutter
@base_module.const_set("Keys", @keys_module)
@threads_module = Module.new
@base_module.const_set("Threads", @threads_module)
+ @feature_module = Module.new
+ @base_module.const_set("Feature", @feature_module)
end
def post_load(repository, namespace)
@@ -140,6 +144,13 @@ module Clutter
# ignore
when /\Athreads_/
define_module_function(@threads_module, $POSTMATCH, info)
+ when /\Afeature_/
+ method_name = rubyish_method_name(info, :prefix => "feature_")
+ case method_name
+ when "available"
+ method_name = "#{method_name}?"
+ end
+ define_module_function(@feature_module, method_name, info)
else
super
end
diff --git a/clutter/lib/clutter/brightness-contrast-effect.rb b/clutter/lib/clutter/brightness-contrast-effect.rb
new file mode 100644
index 0000000..2346794
--- /dev/null
+++ b/clutter/lib/clutter/brightness-contrast-effect.rb
@@ -0,0 +1,44 @@
+# Copyright (C) 2014 Ruby-GNOME2 Project Team
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+module Clutter
+ class BrightnessContrastEffect
+ alias_method :set_contrast_raw, :set_contrast
+ def set_contrast(contrast_all_or_red, contrast_green=nil, contrast_blue=nil)
+ if contrast_green.nil? && contrast_blue.nil?
+ contrast_all = contrast_all_or_red
+ set_contrast_raw(contrast_all)
+ else
+ contrast_red = contrast_all_or_red
+ set_contrast_full(contrast_red, contrast_green,
+ contrast_blue)
+ end
+ end
+
+ alias_method :set_brightness_raw, :set_brightness
+ def set_brightness(brightness_all_or_red, brightness_green=nil,
+ brightness_blue=nil)
+ if brightness_green.nil? && brightness_blue.nil?
+ brightness_all = brightness_all_or_red
+ set_brightness_raw(brightness_all)
+ else
+ brightness_red = brightness_all_or_red
+ set_brightness_full(brightness_red, brightness_green,
+ brightness_blue)
+ end
+ end
+ end
+end
diff --git a/gio2/lib/gio2/output-stream.rb b/clutter/lib/clutter/clutter.rb
similarity index 79%
copy from gio2/lib/gio2/output-stream.rb
copy to clutter/lib/clutter/clutter.rb
index d686699..a10d3ec 100644
--- a/gio2/lib/gio2/output-stream.rb
+++ b/clutter/lib/clutter/clutter.rb
@@ -14,11 +14,12 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-module Gio
- class OutputStream
- alias_method :write_raw, :write
- def write(data)
- write_raw(data, data.bytesize)
+module Clutter
+ class << self
+ alias_method :check_version_raw, :check_version
+ remove_method :check_version
+ def check_version?(major, minor, micro=nil)
+ check_version_raw(major, minor, micro)
end
end
end
diff --git a/gio2/lib/gio2/pollable-output-stream.rb b/clutter/lib/clutter/text-buffer.rb
similarity index 57%
copy from gio2/lib/gio2/pollable-output-stream.rb
copy to clutter/lib/clutter/text-buffer.rb
index 49b5c8e..1357fde 100644
--- a/gio2/lib/gio2/pollable-output-stream.rb
+++ b/clutter/lib/clutter/text-buffer.rb
@@ -1,4 +1,4 @@
-# Copyright (C) 2014 Ruby-GNOME2 Project Team
+# Copyright (C) 2012-2014 Ruby-GNOME2 Project Team
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -14,19 +14,23 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-module Gio
- module PollableOutputStream
- alias_method :create_source_raw, :create_source
- def create_source(&block)
- source = create_source_raw
- source.extend(PollableSource)
- source.set_callback(&block)
- source
+module Clutter
+ class TextBuffer
+ alias_method :set_text_raw, :set_text
+ alias_method :insert_text_raw, :insert_text
+ alias_method :emit_inserted_text_raw, :emit_inserted_text
+
+ def set_text(string)
+ set_text_raw(string, string.length)
+ end
+ alias_method :text=, :set_text
+
+ def insert_text(position, string)
+ insert_text_raw(position, string, string.length)
end
- alias_method :write_nonblocking_raw, :write_nonblocking
- def write_nonblocking(data)
- write_nonblocking_raw(data, data.bytesize)
+ def emit_inserted_text(position, string)
+ emit_inserted_text_raw(position, string, string.length)
end
end
end
diff --git a/clutter/patches/json-glib-1.0.2-add-missing-config-h.diff b/clutter/patches/json-glib-1.0.2-add-missing-config-h.diff
new file mode 100644
index 0000000..e5aa502
--- /dev/null
+++ b/clutter/patches/json-glib-1.0.2-add-missing-config-h.diff
@@ -0,0 +1,21 @@
+commit 415c75677544df6aa4929c851f44a412ea39b7b4
+Author: Emmanuele Bassi <ebassi at gnome.org>
+Date: Fri Jul 25 09:10:52 2014 +0100
+
+ Include "config.h" in the enum types template
+
+ Expands the symbol annotation correctly.
+---
+ json-glib/json-enum-types.c.in | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/json-glib/json-enum-types.c.in b/json-glib/json-enum-types.c.in
+index 8b82049..0e09075 100644
+--- a/json-glib/json-enum-types.c.in
++++ b/json-glib/json-enum-types.c.in
+@@ -1,4 +1,5 @@
+ /*** BEGIN file-header ***/
++#include "config.h"
+ #include "json-enum-types.h"
+ /*** END file-header ***/
+
diff --git a/clutter/test/clutter-test-utils.rb b/clutter/test/clutter-test-utils.rb
index 26b74e0..0ab2042 100644
--- a/clutter/test/clutter-test-utils.rb
+++ b/clutter/test/clutter-test-utils.rb
@@ -18,9 +18,21 @@ require "test-unit"
require "test/unit/notify"
module ClutterTestUtils
+ private
+ def only_clutter_version(major, minor, micro=nil)
+ micro ||= 0
+ unless Clutter.check_version?(major, minor, micro)
+ omit("Require Clutter >= #{major}.#{minor}.#{micro}")
+ end
+ end
+
def omit_if_clutter_color_hash_expect_arguments
unless Clutter::Color.method(:hash).parameters.empty?
omit("This test can't be run on this environment.")
end
end
+
+ def omit_on_travis_ci
+ omit("This test can't be run on Travis CI") if ENV["CI"]
+ end
end
diff --git a/clutter/test/run-test.rb b/clutter/test/run-test.rb
index c1c9a1e..ba01dfd 100755
--- a/clutter/test/run-test.rb
+++ b/clutter/test/run-test.rb
@@ -22,16 +22,19 @@ ruby_gnome2_base = File.expand_path(ruby_gnome2_base)
glib_base = File.join(ruby_gnome2_base, "glib2")
cairo_gobject_base = File.join(ruby_gnome2_base, "cairo-gobject")
gobject_introspection_base = File.join(ruby_gnome2_base, "gobject-introspection")
+pango_base = File.join(ruby_gnome2_base, "pango")
clutter_base = File.join(ruby_gnome2_base, "clutter")
modules = [
[glib_base, "glib2"],
[cairo_gobject_base, "cairo-gobject"],
[gobject_introspection_base, "gobject-introspection"],
+ [pango_base, "pango"],
[clutter_base, "clutter"],
]
modules.each do |target, module_name|
- if File.exist?("Makefile") and system("which make > /dev/null")
+ makefile = File.join(target, "Makefile")
+ if File.exist?(makefile) and system("which make > /dev/null")
`make -C #{target.dump} > /dev/null` or exit(false)
end
$LOAD_PATH.unshift(File.join(target, "ext", module_name))
diff --git a/clutter/test/test-clutter-actor.rb b/clutter/test/test-clutter-actor.rb
new file mode 100644
index 0000000..02243c0
--- /dev/null
+++ b/clutter/test/test-clutter-actor.rb
@@ -0,0 +1,242 @@
+# Copyright (C) 2014 Ruby-GNOME2 Project Team
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+class ClutterActorTest < Test::Unit::TestCase
+ include ClutterTestUtils
+
+ def setup
+ @actor = Clutter::Actor.new
+ end
+
+ def test_flags
+ actor_flag = Clutter::ActorFlags::REACTIVE
+ @actor.flags = actor_flag
+ assert_equal(actor_flag, @actor.flags)
+
+ @actor.unset_flags(actor_flag)
+ assert_true(@actor.flags.empty?)
+ end
+
+ def test_scaled
+ assert_false(@actor.scaled?)
+
+ scale_x = 5.5
+ scale_y = 7.5
+ @actor.set_scale(scale_x, scale_y)
+ assert_true(@actor.scaled?)
+ end
+
+ def test_rotation_angle
+ only_clutter_version(1, 12, 0)
+ rotate_angle = 0.5
+ @actor.set_rotation_angle(Clutter::RotateAxis::X_AXIS, rotate_angle)
+ assert_equal(rotate_angle,
+ @actor.get_rotation_angle(Clutter::RotateAxis::X_AXIS))
+ end
+
+ def test_name
+ actor_name = "ClutterActor"
+ @actor.name = actor_name
+ assert_equal(actor_name, @actor.name)
+ end
+
+ def test_fixed_position_set
+ @actor.fixed_position_set = true
+ assert_true(@actor.fixed_position_set?)
+ end
+
+ def test_x_align
+ align = Clutter::ActorAlign::FILL
+ @actor.x_align = align
+ assert_equal(align, @actor.x_align)
+ end
+
+ def test_y_align
+ align = Clutter::ActorAlign::CENTER
+ @actor.y_align = align
+ assert_equal(align, @actor.y_align)
+ end
+
+ def test_content_gravity
+ gravity = Clutter::ContentGravity::CENTER
+ @actor.content_gravity = gravity
+ assert_equal(gravity, @actor.content_gravity)
+ end
+
+ def test_opacity_accessors
+ opacity_value = 220
+ @actor.opacity = opacity_value
+ assert_equal(opacity_value, @actor.opacity)
+ end
+
+ def test_easing_delay
+ delay_msec = 300
+ @actor.save_easing_state
+ @actor.easing_delay = delay_msec
+ assert_equal(delay_msec, @actor.easing_delay)
+ end
+
+ def test_easing_mode
+ only_clutter_version(1, 12, 0)
+ mode = Clutter::AnimationMode::EASE
+ @actor.easing_mode = mode
+ assert_equal(mode, @actor.easing_mode)
+ end
+
+ def test_pango_context
+ @actor.create_pango_context
+ assert_kind_of(Pango::Context, @actor.pango_context)
+ end
+
+ def test_width_accessors
+ actor_width = 20
+ @actor.width = actor_width
+ assert_equal(actor_width, @actor.width)
+ end
+
+ def test_height_accessors
+ actor_height = 30
+ @actor.height = actor_height
+ assert_equal(actor_height, @actor.height)
+ end
+
+ def test_x_accessors
+ actor_x = 35
+ @actor.x = actor_x
+ assert_equal(actor_x, @actor.x)
+ end
+
+ def test_y_accessors
+ actor_y = 15
+ @actor.y = actor_y
+ assert_equal(actor_y, @actor.y)
+ end
+
+ def test_z_position_accessors
+ only_clutter_version(1, 12, 0)
+ actor_z_position = 55
+ @actor.z_position = actor_z_position
+ assert_equal(actor_z_position, @actor.z_position)
+ end
+
+ def test_pivot_point_accessors
+ only_clutter_version(1, 12, 0)
+ pivot_x = 1.0
+ pivot_y = 3.0
+ @actor.set_pivot_point(pivot_x, pivot_y)
+ assert_equal([pivot_x, pivot_y], @actor.pivot_point)
+ end
+
+ def test_pivot_point_z_accessors
+ only_clutter_version(1, 12, 0)
+ pivot_z = 5.0
+ @actor.pivot_point_z = pivot_z
+ assert_equal(pivot_z, @actor.pivot_point_z)
+ end
+
+ def test_reactive_accessors
+ @actor.reactive = true
+ assert_true(@actor.reactive?)
+ end
+
+ def test_scale_accessors
+ scale_x = 1.5
+ scale_y = 3.5
+ @actor.set_scale(scale_x, scale_y)
+ assert_equal([scale_x, scale_y], @actor.scale)
+ end
+
+ def test_scale_z_accessors
+ only_clutter_version(1, 12, 0)
+ scale_z = 4.5
+ @actor.scale_z = scale_z
+ assert_equal(scale_z, @actor.scale_z)
+ end
+
+ def test_text_direction_accessors
+ direction = Clutter::TextDirection::LTR
+ @actor.text_direction = direction
+ assert_equal(direction, @actor.text_direction)
+ end
+
+ def test_clutter_transform
+ # TODO: !!needs CoglMatrix!!
+ # Clutter::Matrix equals Cogl::Matrix
+ # ref: https://developer.gnome.org/clutter/stable/clutter-Base-geometric-types.html#ClutterMatrix
+ # Cogl::Matrix type is returned by Cogl::Matrix.init_identity API in clutter 1.18
+ end
+
+ class TestMargin < self
+ def test_margin_top
+ margin = 3.0
+ @actor.margin_top = margin
+ assert_equal(margin, @actor.margin_top)
+ end
+
+ def test_margin_right
+ margin = 5.0
+ @actor.margin_right = margin
+ assert_equal(margin, @actor.margin_right)
+ end
+
+ def test_margin_left
+ margin = 3.5
+ @actor.margin_left = margin
+ assert_equal(margin, @actor.margin_left)
+ end
+
+ def test_margin_bottom
+ margin = 4.5
+ @actor.margin_bottom = margin
+ assert_equal(margin, @actor.margin_bottom)
+ end
+ end
+
+ class TestEnum < self
+ def test_allocation_flags
+ assert_const_defined(Clutter::AllocationFlags, :DELEGATE_LAYOUT)
+ end
+
+ def test_actor_align
+ assert_const_defined(Clutter::ActorAlign, :FILL)
+ end
+
+ def test_actor_flags
+ assert_const_defined(Clutter::ActorFlags, :REACTIVE)
+ end
+
+ def test_content_gravity
+ assert_const_defined(Clutter::ContentGravity, :CENTER)
+ end
+
+ def test_content_repeat
+ only_clutter_version(1, 12, 0)
+ assert_const_defined(Clutter::ContentRepeat, :BOTH)
+ end
+
+ def test_scaling_fliter
+ assert_const_defined(Clutter::ScalingFilter, :LINEAR)
+ end
+
+ def test_request_mode
+ assert_const_defined(Clutter::RequestMode, :WIDTH_FOR_HEIGHT)
+ end
+
+ def test_offscreen_redirect
+ assert_const_defined(Clutter::OffscreenRedirect, :ALWAYS)
+ end
+ end
+end
diff --git a/gio2/lib/gio2/output-stream.rb b/clutter/test/test-clutter-blur-effect.rb
similarity index 78%
copy from gio2/lib/gio2/output-stream.rb
copy to clutter/test/test-clutter-blur-effect.rb
index d686699..1df0ddd 100644
--- a/gio2/lib/gio2/output-stream.rb
+++ b/clutter/test/test-clutter-blur-effect.rb
@@ -14,11 +14,14 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-module Gio
- class OutputStream
- alias_method :write_raw, :write
- def write(data)
- write_raw(data, data.bytesize)
- end
+class ClutterBlurEffectTest < Test::Unit::TestCase
+ include ClutterTestUtils
+
+ def setup
+ @blur_effect = Clutter::BlurEffect.new
+ end
+
+ def test_blur_effect_new
+ assert_kind_of(Clutter::Effect, @blur_effect)
end
end
diff --git a/clutter/test/test-clutter-brightness-contrast-effect.rb b/clutter/test/test-clutter-brightness-contrast-effect.rb
new file mode 100644
index 0000000..b6cb923
--- /dev/null
+++ b/clutter/test/test-clutter-brightness-contrast-effect.rb
@@ -0,0 +1,56 @@
+# Copyright (C) 2014 Ruby-GNOME2 Project Team
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+class ClutterBrightnessContrastEffectTest < Test::Unit::TestCase
+ include ClutterTestUtils
+
+ def setup
+ @effect = Clutter::BrightnessContrastEffect.new
+ end
+
+ def test_brightness
+ brightness = 127
+ @effect.brightness = brightness
+ assert_equal([brightness, brightness, brightness],
+ @effect.brightness)
+ end
+
+ def test_brightness_rgb_params
+ brightness_red = 120
+ brightness_green = 200
+ brightness_blue = 250
+ @effect.set_brightness(brightness_red, brightness_green,
+ brightness_blue)
+ assert_equal([brightness_red, brightness_green, brightness_blue],
+ @effect.brightness)
+ end
+
+ def test_contrast
+ contrast = 127
+ @effect.contrast = contrast
+ assert_equal([contrast, contrast, contrast],
+ @effect.contrast)
+ end
+
+ def test_contrast_rgb_params
+ contrast_red = 250
+ contrast_green = 120
+ contrast_blue = 100
+ @effect.set_contrast(contrast_red, contrast_green, contrast_blue)
+ assert_equal([contrast_red, contrast_green, contrast_blue],
+ @effect.contrast)
+ end
+end
diff --git a/gio2/test/test-content-type.rb b/clutter/test/test-clutter-canvas.rb
similarity index 60%
copy from gio2/test/test-content-type.rb
copy to clutter/test/test-clutter-canvas.rb
index dd2585f..5b5be49 100644
--- a/gio2/test/test-content-type.rb
+++ b/clutter/test/test-clutter-canvas.rb
@@ -14,18 +14,30 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-class TestContentType < Test::Unit::TestCase
+class ClutterCanvasTest < Test::Unit::TestCase
+ include ClutterTestUtils
+
def setup
- @content_type = Gio::ContentType.new("image/jpeg")
+ @canvas = Clutter::Canvas.new
+ end
+
+ def test_scale_factor
+ only_clutter_version(1, 18, 0)
+ scale = 2
+ @canvas.scale_factor = scale
+ assert_equal(scale, @canvas.scale_factor)
+ assert_true(@canvas.scale_factor_set?)
end
- def test_icon
- assert_equal("image-jpeg",
- @content_type.icon.names.first)
+ def test_height_accessors
+ height = 320
+ @canvas.height = height
+ assert_equal(height, @canvas.height)
end
- def test_guess
- assert_equal(["audio/mpeg", false],
- Gio::ContentType.guess("filename.mp3"))
+ def test_width_accessors
+ width = 640
+ @canvas.width = width
+ assert_equal(width, @canvas.width)
end
end
diff --git a/gio2/test/test-content-type.rb b/clutter/test/test-clutter-colorize-effect.rb
similarity index 66%
copy from gio2/test/test-content-type.rb
copy to clutter/test/test-clutter-colorize-effect.rb
index dd2585f..0208132 100644
--- a/gio2/test/test-content-type.rb
+++ b/clutter/test/test-clutter-colorize-effect.rb
@@ -14,18 +14,18 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-class TestContentType < Test::Unit::TestCase
- def setup
- @content_type = Gio::ContentType.new("image/jpeg")
- end
+class ClutterColorizeEffectTest < Test::Unit::TestCase
+ include ClutterTestUtils
- def test_icon
- assert_equal("image-jpeg",
- @content_type.icon.names.first)
+ def setup
+ omit_if_clutter_color_hash_expect_arguments
+ default_color = Clutter::Color.rgb(255, 0, 0)
+ @colorize_effect = Clutter::ColorizeEffect.new(default_color)
end
- def test_guess
- assert_equal(["audio/mpeg", false],
- Gio::ContentType.guess("filename.mp3"))
+ def test_tint_accessors
+ color = Clutter::Color.rgb(127, 127, 0)
+ @colorize_effect.tint = color
+ assert_equal(color.to_s, @colorize_effect.tint.to_s)
end
end
diff --git a/gio2/test/test-content-type.rb b/clutter/test/test-clutter-desaturate-effect.rb
similarity index 71%
copy from gio2/test/test-content-type.rb
copy to clutter/test/test-clutter-desaturate-effect.rb
index dd2585f..1f776b4 100644
--- a/gio2/test/test-content-type.rb
+++ b/clutter/test/test-clutter-desaturate-effect.rb
@@ -14,18 +14,17 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-class TestContentType < Test::Unit::TestCase
- def setup
- @content_type = Gio::ContentType.new("image/jpeg")
- end
+class ClutterDesaturateEffectTest < Test::Unit::TestCase
+ include ClutterTestUtils
- def test_icon
- assert_equal("image-jpeg",
- @content_type.icon.names.first)
+ def setup
+ default_factor = 1.0
+ @desaturate_effect = Clutter::DesaturateEffect.new(default_factor)
end
- def test_guess
- assert_equal(["audio/mpeg", false],
- Gio::ContentType.guess("filename.mp3"))
+ def test_factor_accesssors
+ factor = 0.8
+ @desaturate_effect.factor = factor
+ assert_equal(factor, @desaturate_effect.factor)
end
end
diff --git a/gio2/test/test-content-type.rb b/clutter/test/test-clutter-feature.rb
similarity index 66%
copy from gio2/test/test-content-type.rb
copy to clutter/test/test-clutter-feature.rb
index dd2585f..94d791a 100644
--- a/gio2/test/test-content-type.rb
+++ b/clutter/test/test-clutter-feature.rb
@@ -14,18 +14,21 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-class TestContentType < Test::Unit::TestCase
- def setup
- @content_type = Gio::ContentType.new("image/jpeg")
+class ClutterFeatureTest < Test::Unit::TestCase
+ include ClutterTestUtils
+
+ def test_avaliable
+ feature_flag = Clutter::FeatureFlags::SYNC_TO_VBLANK
+ assert_boolean(Clutter::Feature.available?(feature_flag))
end
- def test_icon
- assert_equal("image-jpeg",
- @content_type.icon.names.first)
+ def test_all
+ assert_kind_of(Clutter::FeatureFlags, Clutter::Feature.all)
end
- def test_guess
- assert_equal(["audio/mpeg", false],
- Gio::ContentType.guess("filename.mp3"))
+ class TestEnum
+ def test_flags
+ assert_const_defined(Clutter::FeatureFlags, :TEXTURE_NPOT)
+ end
end
end
diff --git a/clutter/test/test-clutter-flow-layout.rb b/clutter/test/test-clutter-flow-layout.rb
new file mode 100644
index 0000000..e3a8525
--- /dev/null
+++ b/clutter/test/test-clutter-flow-layout.rb
@@ -0,0 +1,83 @@
+# Copyright (C) 2014 Ruby-GNOME2 Project Team
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+class ClutterFlowLayoutTest < Test::Unit::TestCase
+ include ClutterTestUtils
+
+ def setup
+ default_orientation = Clutter::FlowOrientation::VERTICAL
+ @flow_layout = Clutter::FlowLayout.new(default_orientation)
+ end
+
+ def test_column_spacing_accessors
+ column_space = 1.0
+ @flow_layout.column_spacing = column_space
+ assert_equal(column_space, @flow_layout.column_spacing)
+ end
+
+ def test_homogeneous_accessors
+ @flow_layout.homogeneous = true
+ assert_true(@flow_layout.homogeneous?)
+ end
+
+ def test_max_column_width_accessors
+ max_width = 300
+ @flow_layout.max_column_width = max_width
+ assert_equal(max_width, @flow_layout.max_column_width)
+ end
+
+ def test_min_column_width_accessors
+ min_width = 10
+ @flow_layout.min_column_width = min_width
+ assert_equal(min_width, @flow_layout.min_column_width)
+ end
+
+ def test_max_row_height_accessors
+ max_height = 400
+ @flow_layout.max_row_height = max_height
+ assert_equal(max_height, @flow_layout.max_row_height)
+ end
+
+ def test_min_row_height_accessors
+ min_height = 5
+ @flow_layout.min_row_height = min_height
+ assert_equal(min_height, @flow_layout.min_row_height)
+ end
+
+ def test_orientation_accessors
+ changed_orientation = Clutter::FlowOrientation::HORIZONTAL
+ @flow_layout.orientation = changed_orientation
+ assert_equal(changed_orientation, @flow_layout.orientation)
+ end
+
+ def test_row_spacing_accessors
+ row_space = 1.5
+ @flow_layout.row_spacing = row_space
+ assert_equal(row_space, @flow_layout.row_spacing)
+ end
+
+ def test_snap_to_grid_accessors
+ only_clutter_version(1, 16, 0)
+ @flow_layout.snap_to_grid = false
+ assert_false(@flow_layout.snap_to_grid?)
+ end
+
+ class TestEnum < self
+ def test_enum
+ assert_const_defined(Clutter::FlowOrientation, :HORIZONTAL)
+ end
+ end
+end
diff --git a/gio2/test/test-content-type.rb b/clutter/test/test-clutter-page-turn-effect.rb
similarity index 50%
copy from gio2/test/test-content-type.rb
copy to clutter/test/test-clutter-page-turn-effect.rb
index dd2585f..ea9741e 100644
--- a/gio2/test/test-content-type.rb
+++ b/clutter/test/test-clutter-page-turn-effect.rb
@@ -14,18 +14,33 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-class TestContentType < Test::Unit::TestCase
+class ClutterPageTurnEffect < Test::Unit::TestCase
+ include ClutterTestUtils
+
def setup
- @content_type = Gio::ContentType.new("image/jpeg")
+ default_period = 1.0
+ default_angle = 180.0
+ default_radious = 20.0
+ @page_turn_effect = Clutter::PageTurnEffect.new(default_period,
+ default_angle,
+ default_radious)
+ end
+
+ def test_angle_accessors
+ page_angle = 150
+ @page_turn_effect.angle = page_angle
+ assert_equal(page_angle, @page_turn_effect.angle)
end
- def test_icon
- assert_equal("image-jpeg",
- @content_type.icon.names.first)
+ def test_period_accessors
+ page_period = 0.5
+ @page_turn_effect.period = page_period
+ assert_equal(page_period, @page_turn_effect.period)
end
- def test_guess
- assert_equal(["audio/mpeg", false],
- Gio::ContentType.guess("filename.mp3"))
+ def test_radius_accessors
+ page_radius = 50.0
+ @page_turn_effect.radius = page_radius
+ assert_equal(page_radius, @page_turn_effect.radius)
end
end
diff --git a/gio2/test/test-content-type.rb b/clutter/test/test-clutter-property-transiton.rb
similarity index 71%
copy from gio2/test/test-content-type.rb
copy to clutter/test/test-clutter-property-transiton.rb
index dd2585f..78f09bc 100644
--- a/gio2/test/test-content-type.rb
+++ b/clutter/test/test-clutter-property-transiton.rb
@@ -14,18 +14,17 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-class TestContentType < Test::Unit::TestCase
- def setup
- @content_type = Gio::ContentType.new("image/jpeg")
- end
+class ClutterPropertyTransitionTest < Test::Unit::TestCase
+ include ClutterTestUtils
- def test_icon
- assert_equal("image-jpeg",
- @content_type.icon.names.first)
+ def setup
+ @transition = Clutter::PropertyTransition.new
end
- def test_guess
- assert_equal(["audio/mpeg", false],
- Gio::ContentType.guess("filename.mp3"))
+ def test_property_name_accessors
+ only_clutter_version(1, 10, 0)
+ name = "clutter property"
+ @transition.property_name = name
+ assert_equal(name, @transition.property_name)
end
end
diff --git a/clutter/test/test-clutter-shader-effect.rb b/clutter/test/test-clutter-shader-effect.rb
new file mode 100644
index 0000000..4760761
--- /dev/null
+++ b/clutter/test/test-clutter-shader-effect.rb
@@ -0,0 +1,65 @@
+# Copyright (C) 2014 Ruby-GNOME2 Project Team
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+class ClutterShaderEffect < Test::Unit::TestCase
+ include ClutterTestUtils
+
+ def setup
+ @shader_effect = Clutter::ShaderEffect.new(Clutter::ShaderType::FRAGMENT_SHADER)
+ @fragment_shader_source = <<-EOS
+#ifdef GL_ES
+precision mediump float;
+#endif
+
+void main( void ) {
+ gl_FragColor = vec4( 1.0, 0.0, 1.0, 1.0 );
+}
+EOS
+ # TODO: use original Cogl::INVALID_HANDLE
+ # original value: NULL
+ # ref: https://developer.gnome.org/cogl/1.18/cogl-General-API.html#COGL-INVALID-HANDLE:CAPS
+ # It should create gi based cogl binding?
+ @cogl_invalid_handle = 0
+ end
+
+ def test_set_uniform_value
+ gvalue = 1.0
+ assert_nothing_raised do
+ @shader_effect.set_uniform_value("components", gvalue)
+ end
+ end
+
+ def test_set_shader_source
+ result = @shader_effect.set_shader_source(@fragment_shader_source)
+ assert_true(result)
+ end
+
+ def test_get_program
+ @shader_effect.shader_source = @fragment_shader_source
+ assert_not_equal(@cogl_invalid_handle, @shader_effect.program)
+ end
+
+ def test_get_shader
+ @shader_effect.shader_source = @fragment_shader_source
+ assert_not_equal(@cogl_invalid_handle, @shader_effect.shader)
+ end
+
+ class TestEnum < self
+ def test_shader_type
+ assert_const_defined(Clutter::ShaderType, :VERTEX_SHADER)
+ end
+ end
+end
diff --git a/clutter/test/test-clutter-text-buffer.rb b/clutter/test/test-clutter-text-buffer.rb
new file mode 100644
index 0000000..29ec588
--- /dev/null
+++ b/clutter/test/test-clutter-text-buffer.rb
@@ -0,0 +1,72 @@
+# coding: utf-8
+# Copyright (C) 2012-2014 Ruby-GNOME2 Project Team
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+class ClutterTextBufferTest < Test::Unit::TestCase
+ include ClutterTestUtils
+
+ def setup
+ @text_buffer = Clutter::TextBuffer.new
+ end
+
+ def test_text
+ string = "clutter test"
+ @text_buffer.text = string
+ assert_equal(string, @text_buffer.text)
+ end
+
+ def test_max_length
+ length = 80
+ @text_buffer.max_length = length
+ assert_equal(length, @text_buffer.max_length)
+ end
+
+ def test_length_read_property
+ string = "clutter test"
+ length = string.length
+ @text_buffer.text = string
+ assert_equal(length, @text_buffer.length)
+ end
+
+ def test_insert_text
+ string = "clutter test"
+ @text_buffer.text = string
+
+ append_string = "append"
+ append_string_length = append_string.length
+ result_string = string + append_string
+
+ assert_equal(append_string_length,
+ @text_buffer.insert_text(string.length, append_string))
+ assert_equal(result_string, @text_buffer.text)
+ end
+
+ def test_delete_text
+ string = "clutter test string"
+ @text_buffer.text = string
+
+ delete_text = "clutter"
+ delete_position = delete_text.length
+ delete_string = " test"
+ delete_string_length = delete_string.length
+ result_string = "clutter string"
+
+ assert_equal(delete_string_length,
+ @text_buffer.delete_text(delete_position,
+ delete_string_length))
+ assert_equal(result_string, @text_buffer.text)
+ end
+end
diff --git a/clutter/test/test-clutter-timeline.rb b/clutter/test/test-clutter-timeline.rb
new file mode 100644
index 0000000..0a2775a
--- /dev/null
+++ b/clutter/test/test-clutter-timeline.rb
@@ -0,0 +1,59 @@
+# Copyright (C) 2014 Ruby-GNOME2 Project Team
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+class ClutterTimelineTest < Test::Unit::TestCase
+ include ClutterTestUtils
+
+ def setup
+ default_duration = 100
+ @timeline = Clutter::Timeline.new(default_duration)
+ end
+
+ def test_auto_reverse_accessors
+ @timeline.auto_reverse = true
+ assert_true(@timeline.auto_reverse?)
+ end
+
+ def test_delay_accessors
+ delay_msec = 2000
+ @timeline.delay = delay_msec
+ assert_equal(delay_msec, @timeline.delay)
+ end
+
+ def test_direction_accessors
+ timeline_direction = Clutter::TimelineDirection::FORWARD
+ @timeline.direction = timeline_direction
+ assert_equal(timeline_direction, @timeline.direction)
+ end
+
+ def test_duration_accessors
+ duration_msec = 1500
+ @timeline.duration = duration_msec
+ assert_equal(duration_msec, @timeline.duration)
+ end
+
+ def test_repeat_count_accessors
+ count = 5
+ @timeline.repeat_count = count
+ assert_equal(count, @timeline.repeat_count)
+ end
+
+ def test_progress_mode_accessors
+ animation_mode = Clutter::AnimationMode::EASE_IN_QUAD
+ @timeline.progress_mode = animation_mode
+ assert_equal(animation_mode, @timeline.progress_mode)
+ end
+end
diff --git a/extconf.rb b/extconf.rb
index 4054981..119c7ad 100644
--- a/extconf.rb
+++ b/extconf.rb
@@ -24,8 +24,7 @@ priorlibs = [
]
unsupported_libraries = [
- "gstreamer-no-gi",
- "gio2-no-gi"
+ "gdk3-no-gi"
]
#
diff --git a/gdk3/Rakefile b/gdk3/Rakefile
index 8cae6ca..d9fd146 100644
--- a/gdk3/Rakefile
+++ b/gdk3/Rakefile
@@ -1,4 +1,20 @@
# -*- ruby -*-
+#
+# Copyright (C) 2011-2013 Ruby-GNOME2 Project Team
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
$LOAD_PATH.unshift("./../glib2/lib")
require "gnome2/rake/package-task"
@@ -6,7 +22,12 @@ require "gnome2/rake/package-task"
package_task = GNOME2::Rake::PackageTask.new do |package|
package.summary = "Ruby/GDK3 is a Ruby binding of GDK-3.x."
package.description = "Ruby/GDK3 is a Ruby binding of GDK-3.x."
- package.dependency.gem.runtime = ["pango", "gdk_pixbuf2"]
+ package.dependency.gem.runtime = [
+ "pango",
+ "gdk_pixbuf2",
+ "cairo-gobject",
+ "gobject-introspection",
+ ]
package.windows.packages = []
package.windows.dependencies = []
package.windows.build_dependencies = [
@@ -26,29 +47,28 @@ package_task = GNOME2::Rake::PackageTask.new do |package|
:name => "gtk+",
:download_site => :gnome,
:label => "GTK+",
- :version => "3.10.7",
+ :version => "3.14.6",
:compression_method => "xz",
:windows => {
:configure_args => [
"--enable-introspection",
"--with-included-immodules",
],
- :patches => [
- "gdk+-3.10.6-remove-def-use.diff",
- ],
:need_autoreconf => true,
+ :build_concurrently => false,
:built_file => "bin/libgdk-3-0.dll",
},
},
{
- :name => "hicolor-icon-theme",
- :download_base_url => "http://icon-theme.freedesktop.org/releases",
- :label => "gtk-hi-color-icon-theme",
- :version => "0.13",
+ :name => "adwaita-icon-theme",
+ :download_site => :gnome,
+ :label => "adwaita-icon-theme",
+ :version => "3.14.1",
+ :compression_method => "xz",
:windows => {
:configure_args => [],
:build_concurrently => false,
- :built_file => "share/icons/hicolor/index.theme",
+ :built_file => "share/icons/Adwaita/index.theme",
}
},
]
diff --git a/gdk3/ext/gdk3/depend b/gdk3/ext/gdk3/depend
deleted file mode 100644
index 5bff803..0000000
--- a/gdk3/ext/gdk3/depend
+++ /dev/null
@@ -1,11 +0,0 @@
-install-so: install-headers
-install-headers:
- $(INSTALL_DATA) $(srcdir)/rbgdk3.h $(RUBYARCHDIR)
- $(INSTALL_DATA) $(srcdir)/rbgdk3conversions.h $(RUBYARCHDIR)
-
-install: install-pc
-install-pc:
- if test -n "$(pkgconfigdir)"; then \
- $(MAKEDIRS) $(pkgconfigdir); \
- $(INSTALL_DATA) ruby-gdk3.pc $(pkgconfigdir); \
- fi
diff --git a/gdk3/ext/gdk3/extconf.rb b/gdk3/ext/gdk3/extconf.rb
deleted file mode 100644
index 75abc58..0000000
--- a/gdk3/ext/gdk3/extconf.rb
+++ /dev/null
@@ -1,130 +0,0 @@
-=begin
-extconf.rb for Ruby/GDK extention library
-=end
-
-require 'pathname'
-
-source_dir = Pathname(__FILE__).dirname
-base_dir = source_dir.parent.parent.expand_path
-top_dir = base_dir.parent.expand_path
-top_build_dir = Pathname(".").parent.parent.parent.expand_path
-
-mkmf_gnome2_dir = top_dir + "glib2" + 'lib'
-version_suffix = ""
-unless mkmf_gnome2_dir.exist?
- if /(-\d+\.\d+\.\d+)(?:\.\d+)?\z/ =~ base_dir.basename.to_s
- version_suffix = $1
- mkmf_gnome2_dir = top_dir + "glib2#{version_suffix}" + 'lib'
- end
-end
-
-$LOAD_PATH.unshift(mkmf_gnome2_dir.to_s)
-
-module_name = "gdk3"
-package_id = "gdk-3.0"
-
-begin
- require 'mkmf-gnome2'
-rescue LoadError
- require 'rubygems'
- gem 'glib2'
- require 'mkmf-gnome2'
-end
-
-have_func("rb_errinfo")
-
-["glib2", "pango", "gdk_pixbuf2"].each do |package|
- directory = "#{package}#{version_suffix}"
- build_dir = "#{directory}/tmp/#{RUBY_PLATFORM}/#{package}/#{RUBY_VERSION}"
- add_depend_package(package, "#{directory}/ext/#{package}",
- top_dir.to_s,
- :top_build_dir => top_build_dir.to_s,
- :target_build_dir => build_dir)
-end
-
-rcairo_options = {}
-rcairo_source_dir_names = ["rcairo"]
-if /mingw|cygwin|mswin/ =~ RUBY_PLATFORM
- rcairo_source_dir_names.unshift("rcairo.win32")
-end
-rcairo_source_dir_names.each do |rcairo_source_dir_name|
- rcairo_source_dir = top_dir.parent.expand_path + rcairo_source_dir_name
- if rcairo_source_dir.exist?
- rcairo_options[:rcairo_source_dir] = rcairo_source_dir.to_s
- break
- end
-end
-
-unless check_cairo(rcairo_options)
- exit(false)
-end
-
-setup_win32(module_name, base_dir)
-
-unless required_pkg_config_package(package_id,
- :debian => "libgtk-3-dev",
- :fedora => "gtk3-devel",
- :homebrew => "gtk+3",
- :macports => "gtk3")
- exit(false)
-end
-
-have_header("st.h")
-have_header("ruby/st.h")
-
-STDOUT.print("checking for target... ")
-STDOUT.flush
-target = PKGConfig.variable(package_id, "target")
-$defs << "-DRUBY_GDK3_TARGET=\\\"#{target}\\\""
-STDOUT.print(target, "\n")
-
-gdk_include_path = nil
-include_paths = $CFLAGS.gsub(/-D\w+/, '').split(/-I/) + ['/usr/include']
-include_paths.each do |path|
- path.strip!
-
- if FileTest.exist?("#{path}/gdk/gdkkeysyms.h")
- gdk_include_path = Pathname("#{path}/gdk")
- break
- end
-end
-raise "can't find gdkkeysyms.h" if gdk_include_path.nil?
-
-xlib_header = "X11/Xlib.h"
-if target == "x11" and have_header('X11/Xlib.h') and have_library("X11")
- have_func("XReadBitmapFileData", xlib_header)
- have_func("XGetErrorText", xlib_header)
-end
-
-create_pkg_config_file("Ruby/GDK3", package_id, ruby_gnome2_version)
-
-rbgdkkeysyms_h_path = Pathname("rbgdkkeysyms.h")
-gdkkeysyms_h_paths = []
-gdkkeysyms_h_paths << gdk_include_path + "gdkkeysyms.h"
-gdkkeysyms_h_paths << gdk_include_path + "gdkkeysyms-compat.h"
-rbgdkkeysyms_h_path.open("w") do |rbgdkkeysyms_h|
- gdkkeysyms_h_paths.each do |path|
- next unless path.exist?
- path.each_line do |line|
- if /^#define\s+(GDK_KEY_\w+)\s+\d+/ =~ line
- define_line = "rb_define_const(mGdkKeyval, \"#{$1}\", INT2FIX(#{$1}));"
- rbgdkkeysyms_h.puts(define_line)
- end
- end
- end
-end
-
-add_distcleanfile("rbgdkkeysyms.h")
-
-ensure_objs
-
-$defs << "-DRUBY_GDK3_COMPILATION"
-create_makefile(module_name)
-
-pkg_config_dir = with_config("pkg-config-dir")
-if pkg_config_dir.is_a?(String)
- File.open("Makefile", "ab") do |makefile|
- makefile.puts
- makefile.puts("pkgconfigdir=#{pkg_config_dir}")
- end
-end
diff --git a/gdk3/ext/gdk3/gdk3.def b/gdk3/ext/gdk3/gdk3.def
deleted file mode 100644
index 7f219a4..0000000
--- a/gdk3/ext/gdk3/gdk3.def
+++ /dev/null
@@ -1,12 +0,0 @@
-EXPORTS
- Init_gdk3
- rbgdk_rval2gdkpoints
- rbgdk_rval2gdkatoms
- rbgdk_rval2gdkpixbufglist
- gdk_atom_get_type
- gdk_geometry_get_type
- gdk_windowattr_get_type
- get_gdkatom
- rbgdk_gdkevent2rval
- rbgdk_rval2gdkevent
-
diff --git a/gdk3/ext/gdk3/init.c b/gdk3/ext/gdk3/init.c
deleted file mode 100644
index 6e20c07..0000000
--- a/gdk3/ext/gdk3/init.c
+++ /dev/null
@@ -1,35 +0,0 @@
-/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
-/*
- * Copyright (C) 2011 Ruby-GNOME2 Project Team
- * Copyright (C) 2002-2006 Ruby-GNOME2 Project Team
- * Copyright (C) 1998-2001 Yukihiro Matsumoto,
- * Daisuke Kanda,
- * Hiroshi Igarashi
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- */
-
-#include "rbgdk3private.h"
-#include "gmodule.h"
-
-extern void Init_gdk3(void);
-
-void
-Init_gdk3(void)
-{
- Init_gdk();
- Init_gdkx11();
-}
diff --git a/gdk3/ext/gdk3/rbgdk.c b/gdk3/ext/gdk3/rbgdk.c
deleted file mode 100644
index 2a829f6..0000000
--- a/gdk3/ext/gdk3/rbgdk.c
+++ /dev/null
@@ -1,491 +0,0 @@
-/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
-/*
- * Copyright (C) 2011 Ruby-GNOME2 Project Team
- * Copyright (C) 2002,2003 Ruby-GNOME2 Project Team
- * Copyright (C) 1998-2000 Yukihiro Matsumoto,
- * Daisuke Kanda,
- * Hiroshi Igarashi
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- */
-
-#include "rbgdk3private.h"
-
-#define RG_TARGET_NAMESPACE mGdk
-
-ID id_call;
-
-/* We don't need them.
-void gdk_init (gint *argc,
- gchar ***argv);
-gboolean gdk_init_check (gint *argc,
- gchar ***argv);
-void gdk_parse_args (gint *argc,
- gchar ***argv);
-*/
-
-struct rbgdk_rval2gdkpoints_args {
- VALUE ary;
- long n;
- GdkPoint *result;
-};
-
-static VALUE
-rbgdk_rval2gdkpoints_body(VALUE value)
-{
- long i;
- struct rbgdk_rval2gdkpoints_args *args = (struct rbgdk_rval2gdkpoints_args *)value;
-
- for (i = 0; i < args->n; i++) {
- VALUE points = rb_ary_to_ary(RARRAY_PTR(args->ary)[i]);
-
- if (RARRAY_LEN(points) != 2)
- rb_raise(rb_eArgError, "point %ld should be array of size 2", i);
-
- args->result[i].x = NUM2INT(RARRAY_PTR(points)[0]);
- args->result[i].y = NUM2INT(RARRAY_PTR(points)[1]);
- }
-
- return Qnil;
-}
-
-static G_GNUC_NORETURN VALUE
-rbgdk_rval2gdkpoints_rescue(VALUE value)
-{
- g_free(((struct rbgdk_rval2gdkpoints_args *)value)->result);
-
- rb_exc_raise(rb_errinfo());
-}
-
-GdkPoint *
-rbgdk_rval2gdkpoints(VALUE value, long *n)
-{
- struct rbgdk_rval2gdkpoints_args args;
-
- args.ary = rb_ary_to_ary(value);
- args.n = RARRAY_LEN(args.ary);
- args.result = g_new(GdkPoint, args.n + 1);
-
- rb_rescue(rbgdk_rval2gdkpoints_body, (VALUE)&args,
- rbgdk_rval2gdkpoints_rescue, (VALUE)&args);
-
- *n = args.n;
-
- return args.result;
-}
-
-struct rbgdk_rval2gdkatoms_args {
- VALUE ary;
- long n;
- GdkAtom *result;
-};
-
-static VALUE
-rbgdk_rval2gdkatoms_body(VALUE value)
-{
- long i;
- struct rbgdk_rval2gdkatoms_args *args = (struct rbgdk_rval2gdkatoms_args *)value;
-
- for (i = 0; i < args->n; i++)
- args->result[i] = RVAL2ATOM(RARRAY_PTR(args->ary)[i]);
-
- return Qnil;
-}
-
-static G_GNUC_NORETURN VALUE
-rbgdk_rval2gdkatoms_rescue(VALUE value)
-{
- g_free(((struct rbgdk_rval2gdkatoms_args *)value)->result);
-
- rb_exc_raise(rb_errinfo());
-}
-
-GdkAtom *
-rbgdk_rval2gdkatoms(VALUE value, long *n)
-{
- struct rbgdk_rval2gdkatoms_args args;
-
- args.ary = rb_ary_to_ary(value);
- args.n = RARRAY_LEN(args.ary);
- args.result = g_new(GdkAtom, args.n + 1);
-
- rb_rescue(rbgdk_rval2gdkatoms_body, (VALUE)&args,
- rbgdk_rval2gdkatoms_rescue, (VALUE)&args);
-
- *n = args.n;
-
- return args.result;
-}
-
-struct rval2gdkpixbufglist_args {
- VALUE ary;
- long n;
- GList *result;
-};
-
-static VALUE
-rbgdk_rval2gdkpixbufglist_body(VALUE value)
-{
- long i;
- struct rval2gdkpixbufglist_args *args = (struct rval2gdkpixbufglist_args *)value;
-
- for (i = 0; i < args->n; i++)
- args->result = g_list_append(args->result, RVAL2GDKPIXBUF(RARRAY_PTR(args->ary)[i]));
-
- return Qnil;
-}
-
-static G_GNUC_NORETURN VALUE
-rbgdk_rval2gdkpixbufglist_rescue(VALUE value)
-{
- g_list_free(((struct rval2gdkpixbufglist_args *)value)->result);
-
- rb_exc_raise(rb_errinfo());
-}
-
-GList *
-rbgdk_rval2gdkpixbufglist(VALUE value)
-{
- struct rval2gdkpixbufglist_args args;
-
- args.ary = rb_ary_to_ary(value);
- args.n = RARRAY_LEN(args.ary);
- args.result = NULL;
-
- rb_rescue(rbgdk_rval2gdkpixbufglist_body, (VALUE)&args,
- rbgdk_rval2gdkpixbufglist_rescue, (VALUE)&args);
-
- return args.result;
-}
-
-static VALUE
-rg_s_display_arg_name(G_GNUC_UNUSED VALUE self)
-{
- return CSTR2RVAL(gdk_get_display_arg_name());
-}
-
-/* deprecated
-static VALUE
-rg_s_set_locale(G_GNUC_UNUSED VALUE self)
-{
- return CSTR2RVAL(gdk_set_locale());
-}
-*/
-
-/* deprecated
-static VALUE
-rg_s_set_sm_client_id(VALUE self, VALUE id)
-{
- gdk_set_sm_client_id(RVAL2CSTR_ACCEPT_NIL(id));
- return self;
-}
-*/
-
-static VALUE
-rg_s_notify_startup_complete(int argc, VALUE *argv, VALUE self)
-{
- VALUE startup_id;
-
- rb_scan_args(argc, argv, "01", &startup_id);
-
- if (NIL_P(startup_id)) {
- gdk_notify_startup_complete();
- } else {
- gdk_notify_startup_complete_with_id(RVAL2CSTR(startup_id));
- }
- return self;
-}
-
-static VALUE
-rg_s_program_class(G_GNUC_UNUSED VALUE self)
-{
- return CSTR2RVAL(gdk_get_program_class());
-}
-
-static VALUE
-rg_s_set_program_class(VALUE self, VALUE program_class)
-{
- gdk_set_program_class(RVAL2CSTR(program_class));
- return self;
-}
-
-static VALUE
-rg_s_display(G_GNUC_UNUSED VALUE self)
-{
- return CSTR2RVAL(gdk_get_display());
-}
-
-#ifdef HAVE_X11_XLIB_H
-#ifdef HAVE_XGETERRORTEXT
-#include <X11/Xlib.h>
-#include <errno.h>
-
-static VALUE rb_x_error;
-static VALUE rb_x_io_error;
-
-static int
-rbgdk_x_error(Display *display, XErrorEvent *error)
-{
- gchar buf[64];
-
- XGetErrorText(display, error->error_code, buf, 63);
-
- rb_funcall((VALUE)rb_x_error, id_call, 4, INT2NUM(error->serial),
- INT2NUM(error->error_code), INT2NUM(error->request_code),
- INT2NUM(error->minor_code));
- return 0;
-}
-
-static int
-rbgdk_x_io_error(Display *display)
-{
- int errno_saved = errno;
- const gchar* disp;
- const gchar* error;
-
- disp = display ? DisplayString(display) : gdk_get_display_arg_name();
- if (! disp)
- disp = "(none)";
-
- error = g_strerror(errno_saved);
-
- rb_funcall((VALUE)rb_x_io_error, id_call, 3, CSTR2RVAL(disp),
- INT2NUM(errno), CSTR2RVAL(error));
- return 0;
-}
-#endif
-#endif
-
-static VALUE
-rg_s_set_x_error_handler(VALUE self)
-{
-#ifdef HAVE_XGETERRORTEXT
- rb_x_error = rb_block_proc();
- G_RELATIVE(self, rb_x_error);
- XSetErrorHandler(rbgdk_x_error);
-#else
- rb_warn("Not supported on this environment.");
-#endif
- return self;
-}
-
-static VALUE
-rg_s_set_x_io_error_handler(VALUE self)
-{
-#ifdef HAVE_XGETERRORTEXT
- rb_x_io_error = rb_block_proc();
- G_RELATIVE(self, rb_x_io_error);
- XSetIOErrorHandler(rbgdk_x_io_error);
-#else
- rb_warn("Not supported on this environment.");
-#endif
- return self;
-}
-
-static VALUE
-rg_s_flush(VALUE self)
-{
- gdk_flush();
- return self;
-}
-
-static VALUE
-rg_s_screen_width(G_GNUC_UNUSED VALUE self)
-{
- return INT2NUM(gdk_screen_width());
-}
-
-static VALUE
-rg_s_screen_width_mm(G_GNUC_UNUSED VALUE self)
-{
- return INT2NUM(gdk_screen_width_mm());
-}
-
-static VALUE
-rg_s_screen_height(G_GNUC_UNUSED VALUE self)
-{
- return INT2NUM(gdk_screen_height());
-}
-
-static VALUE
-rg_s_screen_height_mm(G_GNUC_UNUSED VALUE self)
-{
- return INT2NUM(gdk_screen_height_mm());
-}
-
-static VALUE
-rg_s_set_double_click_time(VALUE self, VALUE msec)
-{
- gdk_set_double_click_time(NUM2UINT(msec));
- return self;
-}
-
-static VALUE
-rg_s_beep(VALUE self)
-{
- gdk_beep();
- return self;
-}
-
-static VALUE
-rg_s_error_trap_push(VALUE self)
-{
- gdk_error_trap_push();
- return self;
-}
-
-static VALUE
-rg_s_error_trap_pop(VALUE self)
-{
- gdk_error_trap_pop();
- return self;
-}
-
-static VALUE
-rg_s_windowing_x11_p(G_GNUC_UNUSED VALUE self)
-{
-#ifdef GDK_WINDOWING_X11
- return Qtrue;
-#else
- return Qfalse;
-#endif
-}
-
-static VALUE
-rg_s_windowing_win32_p(G_GNUC_UNUSED VALUE self)
-{
-#ifdef GDK_WINDOWING_WIN32
- return Qtrue;
-#else
- return Qfalse;
-#endif
-}
-
-static VALUE
-rg_s_windowing_fb_p(G_GNUC_UNUSED VALUE self)
-{
-#ifdef GDK_WINDOWING_FB
- return Qtrue;
-#else
- return Qfalse;
-#endif
-}
-
-static VALUE
-rg_s_windowing_quartz_p(G_GNUC_UNUSED VALUE self)
-{
-#ifdef GDK_WINDOWING_QUARTZ
- return Qtrue;
-#else
- return Qfalse;
-#endif
-}
-
-static VALUE
-rg_s_windowing_directfb_p(G_GNUC_UNUSED VALUE self)
-{
-#ifdef GDK_WINDOWING_DIRECTFB
- return Qtrue;
-#else
- return Qfalse;
-#endif
-}
-
-static VALUE
-rg_s_target(G_GNUC_UNUSED VALUE self)
-{
- return CSTR2RVAL(RUBY_GDK3_TARGET);
-}
-
-static VALUE
-rg_s_cairo_available_p(G_GNUC_UNUSED VALUE self)
-{
- return Qtrue;
-}
-
-void
-Init_gdk(void)
-{
- id_call = rb_intern("call");
-
- VALUE RG_TARGET_NAMESPACE = rb_define_module("Gdk");
-
- RG_DEF_SMETHOD(display_arg_name, 0);
-/* deprecated
- RG_DEF_SMETHOD(set_locale, 0);
- RG_DEF_SMETHOD(set_sm_client_id, 1);
-*/
- RG_DEF_SMETHOD(notify_startup_complete, -1);
- RG_DEF_SMETHOD(program_class, 0);
- RG_DEF_SMETHOD(set_program_class, 1);
- RG_DEF_SMETHOD(display, 0);
-
- RG_DEF_SMETHOD(set_x_error_handler, 0);
- RG_DEF_SMETHOD(set_x_io_error_handler, 0);
- RG_DEF_SMETHOD(screen_width, 0);
- RG_DEF_SMETHOD(screen_width_mm, 0);
- RG_DEF_SMETHOD(screen_height, 0);
- RG_DEF_SMETHOD(screen_height_mm, 0);
- RG_DEF_SMETHOD(beep, 0);
- RG_DEF_SMETHOD(flush, 0);
- RG_DEF_SMETHOD(set_double_click_time, 1);
- RG_DEF_SMETHOD(error_trap_push, 0);
- RG_DEF_SMETHOD(error_trap_pop, 0);
- RG_DEF_SMETHOD_P(windowing_x11, 0);
- RG_DEF_SMETHOD_P(windowing_win32, 0);
- RG_DEF_SMETHOD_P(windowing_fb, 0);
- RG_DEF_SMETHOD_P(windowing_quartz, 0);
- RG_DEF_SMETHOD_P(windowing_directfb, 0);
-
- RG_DEF_SMETHOD(target, 0);
-
- RG_DEF_SMETHOD_P(cairo_available, 0);
-
- G_DEF_CLASS(GDK_TYPE_GRAB_STATUS, "GrabStatus", RG_TARGET_NAMESPACE);
-
- Init_gdk_atom(RG_TARGET_NAMESPACE);
- Init_gdk_cairo();
- Init_gdk_color(RG_TARGET_NAMESPACE);
- Init_gdk_const(RG_TARGET_NAMESPACE);
- Init_gdk_cursor(RG_TARGET_NAMESPACE);
- Init_gdk_device(RG_TARGET_NAMESPACE);
- Init_gdk_device_manager(RG_TARGET_NAMESPACE);
- Init_gdk_display(RG_TARGET_NAMESPACE);
- Init_gdk_display_manager(RG_TARGET_NAMESPACE);
- Init_gdk_dragcontext(RG_TARGET_NAMESPACE);
- Init_gdk_event(RG_TARGET_NAMESPACE);
- Init_gdk_geometry(RG_TARGET_NAMESPACE);
- Init_gdk_keymap(RG_TARGET_NAMESPACE);
- Init_gdk_keyval(RG_TARGET_NAMESPACE);
- Init_gdk_pango(RG_TARGET_NAMESPACE);
-/* deprecated
- Init_gdk_pangorenderer(RG_TARGET_NAMESPACE);
-*/
- Init_gdk_pixbuf(RG_TARGET_NAMESPACE);
- Init_gdk_property(RG_TARGET_NAMESPACE);
- Init_gdk_rectangle(RG_TARGET_NAMESPACE);
-/* deprecated
- Init_gdk_rgb(RG_TARGET_NAMESPACE);
-*/
- Init_gdk_rgba(RG_TARGET_NAMESPACE);
- Init_gdk_screen(RG_TARGET_NAMESPACE);
- Init_gdk_selection(RG_TARGET_NAMESPACE);
- Init_gdk_threads(RG_TARGET_NAMESPACE);
- Init_gdk_timecoord(RG_TARGET_NAMESPACE);
- Init_gdk_visual(RG_TARGET_NAMESPACE);
- Init_gdk_window(RG_TARGET_NAMESPACE);
- Init_gdk_windowattr(RG_TARGET_NAMESPACE);
-}
diff --git a/gdk3/ext/gdk3/rbgdk3.h b/gdk3/ext/gdk3/rbgdk3.h
deleted file mode 100644
index 97cff28..0000000
--- a/gdk3/ext/gdk3/rbgdk3.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
-/*
- * Copyright (C) 2011 Ruby-GNOME2 Project Team
- * Copyright (C) 2008 Ruby-GNOME2 Project Team
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- */
-
-#ifndef __RBGDK3_H__
-#define __RBGDK3_H__
-
-#include <gdk/gdk.h>
-#ifdef GDK_WINDOWING_X11
-# include <gdk/gdkx.h>
-#endif
-#ifdef GDK_WINDOWING_WIN32
-# include <gdk/gdkwin32.h>
-#endif
-
-#include "rbgdk3conversions.h"
-
-#define RBGDK_MAJOR_VERSION RBGLIB_MAJOR_VERSION
-#define RBGDK_MINOR_VERSION RBGLIB_MINOR_VERSION
-#define RBGDK_MICRO_VERSION RBGLIB_MICRO_VERSION
-
-#define RVAL2GDKPOINTS(value, n) rbgdk_rval2gdkpoints(value, n)
-#define RVAL2GDKATOMS(value, n) rbgdk_rval2gdkatoms(value, n)
-
-#define RVAL2GDKPIXBUFGLIST(value) rbgdk_rval2gdkpixbufglist(value)
-
-/* for backword compatibility. TODO: remove me. */
-#define GEV2RVAL(ev) GDKEVENT2RVAL(ev)
-#define RVAL2GEV(ev) RVAL2GDKEVENT(ev)
-
-#define RVAL2ATOM(atom) (get_gdkatom(atom))
-
-#define GDK_TYPE_GEOMETRY (gdk_geometry_get_type())
-#define GDK_TYPE_ATOM (gdk_atom_get_type())
-#define GDK_TYPE_WINDOW_ATTR (gdk_windowattr_get_type())
-#define GDK_TYPE_TIME_COORD (gdk_timecoord_get_type())
-
-typedef struct {
- GdkAtom atom;
-} GdkAtomData;
-
-GdkPoint *rbgdk_rval2gdkpoints(VALUE value, long *n);
-GdkAtom *rbgdk_rval2gdkatoms(VALUE value, long *n);
-
-GList *rbgdk_rval2gdkpixbufglist(VALUE value);
-
-extern GType gdk_windowattr_get_type(void);
-extern GType gdk_atom_get_type(void);
-extern GType gdk_geometry_get_type(void);
-extern GType gdk_timecoord_get_type(void);
-
-extern GdkAtom get_gdkatom(VALUE atom);
-extern VALUE rbgdk_gdkevent2rval(GdkEvent *event);
-extern GdkEvent *rbgdk_rval2gdkevent(VALUE event);
-
-#endif /* __RBGDK3_H__ */
diff --git a/gdk3/ext/gdk3/rbgdk3conversions.h b/gdk3/ext/gdk3/rbgdk3conversions.h
deleted file mode 100644
index fb0d020..0000000
--- a/gdk3/ext/gdk3/rbgdk3conversions.h
+++ /dev/null
@@ -1,121 +0,0 @@
-/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
-/*
- * Copyright (C) 2011 Ruby-GNOME2 Project Team
- * Copyright (C) 2008 Ruby-GNOME2 Project Team
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- */
-
-#ifndef __RBGDK3CONVERSIONS_H__
-#define __RBGDK3CONVERSIONS_H__
-
-#define RVAL2GDKDEVICE(o) (GDK_DEVICE(RVAL2GOBJ(o)))
-#define RVAL2GDKDISPLAY(o) (GDK_DISPLAY(RVAL2GOBJ(o)))
-#define RVAL2GDKDISPLAYMANAGER(o) (GDK_DISPLAY_MANAGER(RVAL2GOBJ(o)))
-#define RVAL2GDKDEVICEMANAGER(o) (GDK_DEVICE_MANAGER(RVAL2GOBJ(o)))
-#define RVAL2GDKDISPLAYOBJECT(o) (GDK_DISPLAY_OBJECT(RVAL2GOBJ(o)))
-#define RVAL2GDKDRAGCONTEXT(o) (GDK_DRAG_CONTEXT(RVAL2GOBJ(o)))
-#define RVAL2GDKDRAWABLE(o) (GDK_DRAWABLE(RVAL2GOBJ(o)))
-#define RVAL2GDKKEYMAP(o) (GDK_KEYMAP(RVAL2GOBJ(o)))
-#define RVAL2GDKPANGORENDERER(o) (GDK_PANGO_RENDERER(RVAL2GOBJ(o)))
-#define RVAL2GDKPIXBUF(o) (GDK_PIXBUF(RVAL2GOBJ(o)))
-#define RVAL2GDKSCREEN(o) (GDK_SCREEN(RVAL2GOBJ(o)))
-#define RVAL2GDKVISUAL(o) (GDK_VISUAL(RVAL2GOBJ(o)))
-#define RVAL2GDKWINDOW(o) (GDK_WINDOW(RVAL2GOBJ(o)))
-#define RVAL2GDKX11WINDOW(o) (GDK_X11_WINDOW(RVAL2GOBJ(o)))
-
-#define RVAL2GDKATOM(o) ((GdkAtomData*)RVAL2BOXED(o, GDK_TYPE_ATOM))
-#define GDKATOM2RVAL(o) (BOXED2RVAL(o, GDK_TYPE_ATOM))
-#define RVAL2GDKCOLOR(o) ((GdkColor*)RVAL2BOXED(o, GDK_TYPE_COLOR))
-#define GDKCOLOR2RVAL(o) (BOXED2RVAL(o, GDK_TYPE_COLOR))
-#define RVAL2GDKCURSOR(o) ((GdkCursor*)RVAL2BOXED(o, GDK_TYPE_CURSOR))
-#define GDKCURSOR2RVAL(o) (BOXED2RVAL(o, GDK_TYPE_CURSOR))
-#define RVAL2GDKEVENT(o) (rbgdk_rval2gdkevent(o))
-#define GDKEVENT2RVAL(o) (rbgdk_gdkevent2rval(o))
-#define RVAL2GDKGEOMETRY(o) ((GdkGeometry*)RVAL2BOXED(o, GDK_TYPE_GEOMETRY))
-#define GDKGEOMETRY2RVAL(o) (BOXED2RVAL(o, GDK_TYPE_GEOMETRY))
-#define RVAL2GDKRECTANGLE(o) ((GdkRectangle*)RVAL2BOXED(o, GDK_TYPE_RECTANGLE))
-#define GDKRECTANGLE2RVAL(o) (BOXED2RVAL(o, GDK_TYPE_RECTANGLE))
-#define RVAL2GDKRGBA(o) ((GdkRGBA*)RVAL2BOXED(o, GDK_TYPE_RGBA))
-#define GDKRGBA2RVAL(o) (BOXED2RVAL(o, GDK_TYPE_RGBA))
-#define RVAL2GDKTIMECOORD(o) ((GdkTimeCoord*)RVAL2BOXED(o, GDK_TYPE_TIME_COORD))
-#define GDKTIMECOORD2RVAL(o) (BOXED2RVAL(o, GDK_TYPE_TIME_COORD))
-#define RVAL2GDKWINDOWATTR(o) ((GdkWindowAttr*)RVAL2BOXED(o, GDK_TYPE_WINDOW_ATTR))
-#define GDKWINDOWATTR2RVAL(o) (BOXED2RVAL(o, GDK_TYPE_WINDOW_ATTR))
-
-#define RVAL2GDKEVENTKEY(o) ((GdkEventKey*)RVAL2GDKEVENT(o))
-
-#define RVAL2GDKAXISUSE(o) (RVAL2GENUM(o, GDK_TYPE_AXIS_USE))
-#define GDKAXISUSE2RVAL(o) (GENUM2RVAL(o, GDK_TYPE_AXIS_USE))
-#define RVAL2GDKBYTEORDER(o) (RVAL2GENUM(o, GDK_TYPE_BYTE_ORDER))
-#define GDKBYTEORDER2RVAL(o) (GENUM2RVAL(o, GDK_TYPE_BYTE_ORDER))
-#define RVAL2GDKCURSORTYPE(o) (RVAL2GENUM(o, GDK_TYPE_CURSOR_TYPE))
-#define GDKCURSORTYPE2RVAL(o) (GENUM2RVAL(o, GDK_TYPE_CURSOR_TYPE))
-#define RVAL2GDKDRAGPROTOCOL(o) (RVAL2GENUM(o, GDK_TYPE_DRAG_PROTOCOL))
-#define GDKDRAGPROTOCOL2RVAL(o) (GENUM2RVAL(o, GDK_TYPE_DRAG_PROTOCOL))
-#define RVAL2GDKEVENTTYPE(o) (RVAL2GENUM(o, GDK_TYPE_EVENT_TYPE))
-#define GDKEVENTTYPE2RVAL(o) (GENUM2RVAL(o, GDK_TYPE_EVENT_TYPE))
-#define RVAL2GDKFILTERRETURN(o) (RVAL2GENUM(o, GDK_TYPE_FILTER_RETURN))
-#define GDKFILTERRETURN2RVAL(o) (GENUM2RVAL(o, GDK_TYPE_FILTER_RETURN))
-#define RVAL2GDKGRABSTATUS(o) (RVAL2GENUM(o, GDK_TYPE_GRAB_STATUS))
-#define GDKGRABSTATUS2RVAL(o) (GENUM2RVAL(o, GDK_TYPE_GRAB_STATUS))
-#define RVAL2GDKGRAVITY(o) (RVAL2GENUM(o, GDK_TYPE_GRAVITY))
-#define GDKGRAVITY2RVAL(o) (GENUM2RVAL(o, GDK_TYPE_GRAVITY))
-#define RVAL2GDKINPUTMODE(o) (RVAL2GENUM(o, GDK_TYPE_INPUT_MODE))
-#define GDKINPUTMODE2RVAL(o) (GENUM2RVAL(o, GDK_TYPE_INPUT_MODE))
-#define RVAL2GDKINPUTSOURCE(o) (RVAL2GENUM(o, GDK_TYPE_INPUT_SOURCE))
-#define GDKINPUTSOURCE2RVAL(o) (GENUM2RVAL(o, GDK_TYPE_INPUT_SOURCE))
-#define RVAL2GDKGRABOWNERSHIP(o) (RVAL2GENUM(o, GDK_TYPE_GRAB_OWNERSHIP))
-#define GDKGRABOWNERSHIP2RVAL(o) (GENUM2RVAL(o, GDK_TYPE_GRAB_OWNERSHIP))
-#define RVAL2GDKPROPMODE(o) (RVAL2GENUM(o, GDK_TYPE_PROP_MODE))
-#define GDKPROPMODE2RVAL(o) (GENUM2RVAL(o, GDK_TYPE_PROP_MODE))
-#define RVAL2GDKRGBDITHER(o) (RVAL2GENUM(o, GDK_TYPE_RGB_DITHER))
-#define GDKRGBDITHER2RVAL(o) (GENUM2RVAL(o, GDK_TYPE_RGB_DITHER))
-#define RVAL2GDKVISUALTYPE(o) (RVAL2GENUM(o, GDK_TYPE_VISUAL_TYPE))
-#define GDKVISUALTYPE2RVAL(o) (GENUM2RVAL(o, GDK_TYPE_VISUAL_TYPE))
-#define RVAL2GDKWINDOWEDGE(o) (RVAL2GENUM(o, GDK_TYPE_WINDOW_EDGE))
-#define GDKWINDOWEDGE2RVAL(o) (GENUM2RVAL(o, GDK_TYPE_WINDOW_EDGE))
-#define RVAL2GDKWINDOWSTATE(o) (RVAL2GENUM(o, GDK_TYPE_WINDOW_STATE))
-#define GDKWINDOWSTATE2RVAL(o) (GENUM2RVAL(o, GDK_TYPE_WINDOW_STATE))
-#define RVAL2GDKWINDOWTYPE(o) (RVAL2GENUM(o, GDK_TYPE_WINDOW_TYPE))
-#define GDKWINDOWTYPE2RVAL(o) (GENUM2RVAL(o, GDK_TYPE_WINDOW_TYPE))
-#define RVAL2GDKWINDOWHINT(o) (RVAL2GENUM(o, GDK_TYPE_WINDOW_TYPE_HINT))
-#define GDKWINDOWHINT2RVAL(o) (GENUM2RVAL(o, GDK_TYPE_WINDOW_TYPE_HINT))
-#define RVAL2GDKWINDOWWINDOWCLASS(o) (RVAL2GENUM(o, GDK_TYPE_WINDOW_WINDOW_CLASS))
-#define GDKWINDOWWINDOWCLASS2RVAL(o) (GENUM2RVAL(o, GDK_TYPE_WINDOW_WINDOW_CLASS))
-
-#define RVAL2GDKDRAGACTION(o) (RVAL2GFLAGS(o, GDK_TYPE_DRAG_ACTION))
-#define GDKDRAGACTION2RVAL(o) (GFLAGS2RVAL(o, GDK_TYPE_DRAG_ACTION))
-#define RVAL2GDKEVENTMASK(o) (RVAL2GFLAGS(o, GDK_TYPE_EVENT_MASK))
-#define GDKEVENTMASK2RVAL(o) (GFLAGS2RVAL(o, GDK_TYPE_EVENT_MASK))
-#define RVAL2GDKMODIFIERTYPE(o) (RVAL2GFLAGS(o, GDK_TYPE_MODIFIER_TYPE))
-#define GDKMODIFIERTYPE2RVAL(o) (GFLAGS2RVAL(o, GDK_TYPE_MODIFIER_TYPE))
-#define RVAL2GDKWINDOWHINTS(o) (RVAL2GFLAGS(o, GDK_TYPE_WINDOW_HINTS))
-#define GDKWINDOWHINTS2RVAL(o) (GFLAGS2RVAL(o, GDK_TYPE_WINDOW_HINTS))
-#define RVAL2GDKWMDECORATION(o) (RVAL2GFLAGS(o, GDK_TYPE_WM_DECORATION))
-#define GDKWMDECORATION2RVAL(o) (GFLAGS2RVAL(o, GDK_TYPE_WM_DECORATION))
-#define RVAL2GDKWMFUNCTION(o) (RVAL2GFLAGS(o, GDK_TYPE_WM_FUNCTION))
-#define GDKWMFUNCTION2RVAL(o) (GFLAGS2RVAL(o, GDK_TYPE_WM_FUNCTION))
-#define RVAL2GDKDRAGACTION(o) (RVAL2GFLAGS(o, GDK_TYPE_DRAG_ACTION))
-#define GDKDRAGACTION2RVAL(o) (GFLAGS2RVAL(o, GDK_TYPE_DRAG_ACTION))
-#define RVAL2GDKMODIFIERTYPE(o) (RVAL2GFLAGS(o, GDK_TYPE_MODIFIER_TYPE))
-#define GDKMODIFIERTYPE2RVAL(o) (GFLAGS2RVAL(o, GDK_TYPE_MODIFIER_TYPE))
-#define RVAL2GDKWINDOWATTRIBUTESTYPE(o) (RVAL2GFLAGS(o, GDK_TYPE_WINDOW_ATTRIBUTES_TYPE))
-#define GDKWINDOWATTRIBUTESTYPE2RVAL(o) (GFLAGS2RVAL(o, GDK_TYPE_WINDOW_ATTRIBUTES_TYPE))
-#define RVAL2GDKWINDOWHINTS(o) (RVAL2GFLAGS(o, GDK_TYPE_WINDOW_HINTS))
-#define GDKWINDOWHINTS2RVAL(o) (GFLAGS2RVAL(o, GDK_TYPE_WINDOW_HINTS))
-
-#endif /* __RBGDK3CONVERSIONS_H__ */
diff --git a/gdk3/ext/gdk3/rbgdk3private.h b/gdk3/ext/gdk3/rbgdk3private.h
deleted file mode 100644
index 36e57fd..0000000
--- a/gdk3/ext/gdk3/rbgdk3private.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
-/*
- * Copyright (C) 2011 Ruby-GNOME2 Project Team
- * Copyright (C) 2002,2003 Ruby-GNOME2 Project Team
- * Copyright (C) 1998-2000 Yukihiro Matsumoto,
- * Daisuke Kanda,
- * Hiroshi Igarashi
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- */
-
-#ifndef __RBGDK3PRIVATE_H__
-#define __RBGDK3PRIVATE_H__
-
-#ifdef HAVE_RUBY_ST_H
-# include <ruby/st.h>
-#else
-# include <st.h>
-#endif
-
-#include <rb_cairo.h>
-#include <rbgobject.h>
-#include <rbpango.h>
-#include "rbgdk3.h"
-
-#ifndef HAVE_RB_ERRINFO
-# define rb_errinfo() (ruby_errinfo)
-#endif
-
-#ifndef G_VALUE_INIT
-# define G_VALUE_INIT { 0, { { 0 } } }
-#endif
-
-extern ID id_call;
-
-G_GNUC_INTERNAL void Init_gdk(void);
-G_GNUC_INTERNAL void Init_gdk_atom(VALUE mGdk);
-G_GNUC_INTERNAL void Init_gdk_cairo(void);
-G_GNUC_INTERNAL void Init_gdk_color(VALUE mGdk);
-G_GNUC_INTERNAL void Init_gdk_const(VALUE mGdk);
-G_GNUC_INTERNAL void Init_gdk_cursor(VALUE mGdk);
-G_GNUC_INTERNAL void Init_gdk_device(VALUE mGdk);
-G_GNUC_INTERNAL void Init_gdk_device_manager(VALUE mGdk);
-G_GNUC_INTERNAL void Init_gdk_display(VALUE mGdk);
-G_GNUC_INTERNAL void Init_gdk_display_manager(VALUE mGdk);
-G_GNUC_INTERNAL void Init_gdk_dragcontext(VALUE mGdk);
-G_GNUC_INTERNAL void Init_gdk_event(VALUE mGdk);
-G_GNUC_INTERNAL void Init_gdk_geometry(VALUE mGdk);
-G_GNUC_INTERNAL void Init_gdk_keymap(VALUE mGdk);
-G_GNUC_INTERNAL void Init_gdk_keyval(VALUE mGdk);
-G_GNUC_INTERNAL void Init_gdk_pango(VALUE mGdk);
-/* deprecated
-G_GNUC_INTERNAL void Init_gdk_pangorenderer(VALUE mGdk);
-*/
-G_GNUC_INTERNAL void Init_gdk_pixbuf(VALUE mGdk);
-G_GNUC_INTERNAL void Init_gdk_property(VALUE mGdk);
-G_GNUC_INTERNAL void Init_gdk_rectangle(VALUE mGdk);
-/* deprecated
-G_GNUC_INTERNAL void Init_gdk_rgb(VALUE mGdk);
-*/
-G_GNUC_INTERNAL void Init_gdk_rgba(VALUE mGdk);
-G_GNUC_INTERNAL void Init_gdk_screen(VALUE mGdk);
-G_GNUC_INTERNAL void Init_gdk_selection(VALUE mGdk);
-G_GNUC_INTERNAL void Init_gdk_threads(VALUE mGdk);
-G_GNUC_INTERNAL void Init_gdk_timecoord(VALUE mGdk);
-G_GNUC_INTERNAL void Init_gdk_visual(VALUE mGdk);
-G_GNUC_INTERNAL void Init_gdk_window(VALUE mGdk);
-G_GNUC_INTERNAL void Init_gdk_windowattr(VALUE mGdk);
-G_GNUC_INTERNAL void Init_gdkx11(void);
-G_GNUC_INTERNAL void Init_gdkx11_x11window(VALUE mGdkX11);
-
-#endif /* __RBGDK3PRIVATE_H__ */
diff --git a/gdk3/ext/gdk3/rbgdkatom.c b/gdk3/ext/gdk3/rbgdkatom.c
deleted file mode 100644
index 5716b8e..0000000
--- a/gdk3/ext/gdk3/rbgdkatom.c
+++ /dev/null
@@ -1,122 +0,0 @@
-/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
-/*
- * Copyright (C) 2011 Ruby-GNOME2 Project Team
- * Copyright (C) 2002,2003 Masao Mutoh
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- */
-
-#include "rbgdk3private.h"
-
-#define RG_TARGET_NAMESPACE cAtom
-#define _SELF(a) ((RVAL2GDKATOM(a))->atom)
-
-/*****************************************/
-static GdkAtomData *
-gdk_atom_copy(const GdkAtom atom)
-{
- GdkAtomData* data;
- data = g_new(GdkAtomData, 1);
- data->atom = atom;
- return data;
-}
-
-GType
-gdk_atom_get_type(void)
-{
- static GType our_type = 0;
- if (our_type == 0)
- our_type = g_boxed_type_register_static ("GdkAtomData",
- (GBoxedCopyFunc)gdk_atom_copy,
- (GBoxedFreeFunc)g_free);
- return our_type;
-}
-
-GdkAtom
-get_gdkatom(VALUE atom)
-{
- if (TYPE(atom) == T_STRING)
- return gdk_atom_intern(RVAL2CSTR(atom), FALSE);
- return (RVAL2GDKATOM(atom))->atom;
-}
-/*****************************************/
-
-static VALUE
-rg_s_intern(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
-{
- VALUE name;
- VALUE exist;
-
- rb_scan_args(argc, argv, "11", &name, &exist);
-
- return GDKATOM2RVAL(gdk_atom_intern(RVAL2CSTR(name), RVAL2CBOOL(exist)));
-}
-
-/* We don't need them.
-GdkAtom gdk_atom_intern_static_string(const gchar *atom_name);
- */
-
-static VALUE
-rg_initialize(VALUE self, VALUE num)
-{
- guint atom = FIX2INT(num);
- if (atom == 0){
- /* This is a trick for passing 0(NULL) */
- G_INITIALIZE(self, GUINT_TO_POINTER(1));
- _SELF(self) = GUINT_TO_POINTER(GDK_NONE);
- } else {
- G_INITIALIZE(self, GUINT_TO_POINTER(atom));
- }
-
- return Qnil;
-}
-
-static VALUE
-rg_name(VALUE self)
-{
- return CSTR2RVAL_FREE(gdk_atom_name(_SELF(self)));
-}
-
-static VALUE
-rg_to_i(VALUE self)
-{
- return UINT2NUM(GPOINTER_TO_UINT(_SELF(self)));
-}
-
-static VALUE
-rg_operator_equal(VALUE self, VALUE other)
-{
- return CBOOL2RVAL(_SELF(self) == _SELF(other));
-}
-
-void
-Init_gdk_atom(VALUE mGdk)
-{
- VALUE none;
- VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GDK_TYPE_ATOM, "Atom", mGdk);
-
- RG_DEF_SMETHOD(intern, -1);
-
- RG_DEF_METHOD(initialize, 1);
- RG_DEF_METHOD(name, 0);
- RG_DEF_METHOD(to_i, 0);
- RG_DEF_METHOD_OPERATOR("==", equal, 1);
-
- /* This is a trick to define GDK_NONE as a BOXED object */
- none = GDKATOM2RVAL((gpointer)1);
- rb_define_const(RG_TARGET_NAMESPACE, "NONE", none);
- _SELF(none) = GDK_NONE;
-}
diff --git a/gdk3/ext/gdk3/rbgdkcairo.c b/gdk3/ext/gdk3/rbgdkcairo.c
deleted file mode 100644
index 270480f..0000000
--- a/gdk3/ext/gdk3/rbgdkcairo.c
+++ /dev/null
@@ -1,91 +0,0 @@
-/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
-/*
- * Copyright (C) 2011 Ruby-GNOME2 Project Team
- * Copyright (C) 2005 Kouhei Sutou
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- */
-
-#include "rbgdk3private.h"
-
-#include <gdk/gdk.h>
-#include <rb_cairo.h>
-
-#define RG_TARGET_NAMESPACE rb_cCairo_Context
-#define _SELF(self) RVAL2CRCONTEXT(self)
-
-static VALUE
-rg_set_source_gdk_color(VALUE self, VALUE color)
-{
- gdk_cairo_set_source_color(_SELF(self), RVAL2GDKCOLOR(color));
- rb_cairo_check_status(cairo_status(_SELF(self)));
- return self;
-}
-
-static VALUE
-rg_set_source_pixbuf(int argc, VALUE *argv, VALUE self)
-{
- VALUE pixbuf, pixbuf_x, pixbuf_y;
-
- rb_scan_args(argc, argv, "12", &pixbuf, &pixbuf_x, &pixbuf_y);
-
- gdk_cairo_set_source_pixbuf(_SELF(self),
- RVAL2GDKPIXBUF(pixbuf),
- NIL_P(pixbuf_x) ? 0 : NUM2DBL(pixbuf_x),
- NIL_P(pixbuf_y) ? 0 : NUM2DBL(pixbuf_y));
- rb_cairo_check_status(cairo_status(_SELF(self)));
- return self;
-}
-
-/* deprecated
-static VALUE
-rg_set_source_pixmap(VALUE self, VALUE pixmap, VALUE pixmap_x, VALUE pixmap_y)
-{
- gdk_cairo_set_source_pixmap(_SELF(self), RVAL2GDKPIXMAP(pixmap),
- NUM2DBL(pixmap_x), NUM2DBL(pixmap_y));
- rb_cairo_check_status(cairo_status(_SELF(self)));
- return self;
-}
-*/
-
-static VALUE
-rg_gdk_rectangle(VALUE self, VALUE rectangle)
-{
- gdk_cairo_rectangle(_SELF(self),
- RVAL2GDKRECTANGLE(rectangle));
- rb_cairo_check_status(cairo_status(_SELF(self)));
- return self;
-}
-
-static VALUE
-rg_gdk_region(VALUE self, VALUE region)
-{
- gdk_cairo_region(_SELF(self), RVAL2CRREGION(region));
- rb_cairo_check_status(cairo_status(_SELF(self)));
- return self;
-}
-
-void
-Init_gdk_cairo(void)
-{
- RG_DEF_METHOD(set_source_gdk_color, 1);
- RG_DEF_METHOD(set_source_pixbuf, -1);
-/* deprecated
- RG_DEF_METHOD(set_source_pixmap, 3);
-*/
- RG_DEF_METHOD(gdk_rectangle, 1);
- RG_DEF_METHOD(gdk_region, 1);
-}
diff --git a/gdk3/ext/gdk3/rbgdkcolor.c b/gdk3/ext/gdk3/rbgdkcolor.c
deleted file mode 100644
index 0196904..0000000
--- a/gdk3/ext/gdk3/rbgdkcolor.c
+++ /dev/null
@@ -1,137 +0,0 @@
-/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
-/*
- * Copyright (C) 2011-2013 Ruby-GNOME2 Project Team
- * Copyright (C) 2002,2003 Ruby-GNOME2 Project Team
- * Copyright (C) 1998-2000 Yukihiro Matsumoto,
- * Daisuke Kanda,
- * Hiroshi Igarashi
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- */
-
-#include "rbgdk3private.h"
-
-#define RG_TARGET_NAMESPACE cColor
-#define _SELF(c) (RVAL2GDKCOLOR(c))
-
-static VALUE
-rg_initialize(VALUE self, VALUE red, VALUE green, VALUE blue)
-{
- GdkColor color;
- color.pixel = 0;
- color.red = NUM2INT(red);
- color.green = NUM2INT(green);
- color.blue = NUM2INT(blue);
-
- G_INITIALIZE(self, g_boxed_copy(GDK_TYPE_COLOR, &color));
-
- return Qnil;
-}
-
-static VALUE
-rg_s_parse(G_GNUC_UNUSED VALUE self, VALUE name)
-{
- GdkColor c;
- if (! gdk_color_parse(RVAL2CSTR(name), &c)) {
- rb_raise(rb_eArgError, "can't parse color name `%s'", RVAL2CSTR(name));
- }
- return GDKCOLOR2RVAL(&c);
-}
-
-static VALUE
-rg_pixel(VALUE self)
-{
- return INT2NUM(_SELF(self)->pixel);
-}
-
-static VALUE
-rg_red(VALUE self)
-{
-
- return INT2FIX(_SELF(self)->red);
-}
-
-static VALUE
-rg_set_red(VALUE self, VALUE red)
-{
- _SELF(self)->red = NUM2INT(red);
- return self;
-}
-
-static VALUE
-rg_green(VALUE self)
-{
- return INT2FIX(_SELF(self)->green);
-}
-
-static VALUE
-rg_set_green(VALUE self, VALUE green)
-{
- _SELF(self)->green = NUM2INT(green);
- return self;
-}
-
-static VALUE
-rg_blue(VALUE self)
-{
- return INT2FIX(_SELF(self)->blue);
-}
-
-static VALUE
-rg_set_blue(VALUE self, VALUE blue)
-{
- _SELF(self)->blue = NUM2INT(blue);
- return self;
-}
-
-static VALUE
-rg_to_a(VALUE self)
-{
- GdkColor *c = _SELF(self);
- return rb_ary_new3(3, INT2FIX(c->red),
- INT2FIX(c->green), INT2FIX(c->blue));
-}
-
-static VALUE
-rg_operator_gdkcolor_equal(VALUE self, VALUE other)
-{
- return CBOOL2RVAL(gdk_color_equal(_SELF(self), _SELF(other)));
-}
-
-static VALUE
-rg_to_s(VALUE self)
-{
- return CSTR2RVAL_FREE(gdk_color_to_string(_SELF(self)));
-}
-
-void
-Init_gdk_color(VALUE mGdk)
-{
- VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GDK_TYPE_COLOR, "Color", mGdk);
-
- RG_DEF_SMETHOD(parse, 1);
- RG_DEF_METHOD(initialize, 3);
- RG_DEF_METHOD(pixel, 0);
- RG_DEF_METHOD(red, 0);
- RG_DEF_METHOD(set_red, 1);
- RG_DEF_METHOD(green, 0);
- RG_DEF_METHOD(set_green, 1);
- RG_DEF_METHOD(blue, 0);
- RG_DEF_METHOD(set_blue, 1);
- RG_DEF_METHOD(to_a, 0);
- RG_DEF_METHOD_OPERATOR("==", gdkcolor_equal, 1);
- RG_DEF_METHOD(to_s, 0);
-}
diff --git a/gdk3/ext/gdk3/rbgdkcursor.c b/gdk3/ext/gdk3/rbgdkcursor.c
deleted file mode 100644
index 1433c41..0000000
--- a/gdk3/ext/gdk3/rbgdkcursor.c
+++ /dev/null
@@ -1,92 +0,0 @@
-/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
-/*
- * Copyright (C) 2011 Ruby-GNOME2 Project Team
- * Copyright (C) 2001-2004 Masao Mutoh
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- */
-
-#include "rbgdk3private.h"
-
-#define RG_TARGET_NAMESPACE cCursor
-
-static VALUE
-rg_initialize(int argc, VALUE *argv, VALUE self)
-{
- GdkCursor* cursor = NULL;
-
- if (argc == 1){
- VALUE type;
- rb_scan_args(argc, argv, "10", &type);
- cursor = gdk_cursor_new(RVAL2GDKCURSORTYPE(type));
- } else if (argc == 2) {
- VALUE display, type_or_name;
- rb_scan_args(argc, argv, "20", &display, &type_or_name);
- if (TYPE(type_or_name) == T_STRING)
- cursor = gdk_cursor_new_from_name(RVAL2GDKDISPLAYOBJECT(display),
- RVAL2CSTR(type_or_name));
- else
- cursor = gdk_cursor_new_for_display(RVAL2GDKDISPLAYOBJECT(display),
- RVAL2GDKCURSORTYPE(type_or_name));
- } else if (argc == 4) {
- VALUE display, pixbuf, x, y;
- rb_scan_args(argc, argv, "40", &display, &pixbuf, &x, &y);
- cursor = gdk_cursor_new_from_pixbuf(RVAL2GDKDISPLAYOBJECT(display),
- RVAL2GDKPIXBUF(pixbuf),
- NUM2INT(x), NUM2INT(y));
-/* deprecated
- } else if (argc == 6) {
- VALUE pixmap, mask, fg, bg, x, y;
- rb_scan_args(argc, argv, "60", &pixmap, &mask, &fg, &bg, &x, &y);
- cursor = gdk_cursor_new_from_pixmap(RVAL2GDKPIXMAP(pixmap),
- NIL_P(mask)?NULL:RVAL2GDKPIXMAP(mask),
- RVAL2GDKCOLOR(fg),
- RVAL2GDKCOLOR(bg),
- NUM2INT(x), NUM2INT(y));
-*/
- }
- G_INITIALIZE(self, cursor);
-
- return Qnil;
-}
-
-/* TODO
-static VALUE
-rg_cursor_type(VALUE self)
-{
- return GDKCURSORTYPE2RVAL((RVAL2GDKCURSOR(self))->type);
-}
-*/
-
-static VALUE
-rg_image(VALUE self)
-{
- return GOBJ2RVAL(gdk_cursor_get_image(RVAL2GDKCURSOR(self)));
-}
-
-void
-Init_gdk_cursor(VALUE mGdk)
-{
- VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GDK_TYPE_CURSOR, "Cursor", mGdk);
-
- RG_DEF_METHOD(initialize, -1);
-/* TODO
- RG_DEF_METHOD(cursor_type, 0);
-*/
- RG_DEF_METHOD(image, 0);
-
- G_DEF_CLASS(GDK_TYPE_CURSOR_TYPE, "Type", RG_TARGET_NAMESPACE);
-}
diff --git a/gdk3/ext/gdk3/rbgdkdevice.c b/gdk3/ext/gdk3/rbgdkdevice.c
deleted file mode 100644
index c39b72c..0000000
--- a/gdk3/ext/gdk3/rbgdkdevice.c
+++ /dev/null
@@ -1,253 +0,0 @@
-/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
-/*
- * Copyright (C) 2011-2013 Ruby-GNOME2 Project Team
- * Copyright (C) 2003-2006 Masao Mutoh
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- */
-
-#include "rbgdk3private.h"
-
-#define RG_TARGET_NAMESPACE cDevice
-#define _SELF(self) (RVAL2GDKDEVICE(self))
-
-/* deprecated
-static VALUE
-rg_s_list(G_GNUC_UNUSED VALUE self)
-{
- return GOBJGLIST2RVAL(gdk_devices_list());
-}
-
-static VALUE
-rg_s_set_extension_events(G_GNUC_UNUSED VALUE self, VALUE window, VALUE mask, VALUE mode)
-{
- gdk_input_set_extension_events(RVAL2GDKWINDOW(window),
- NUM2INT(mask), FIX2INT(mode));
- return Qnil;
-}
-
-static VALUE
-rg_s_core_pointer(G_GNUC_UNUSED VALUE self)
-{
- return GOBJ2RVAL(gdk_device_get_core_pointer());
-}
-
-static VALUE
-rg_set_source(VALUE self, VALUE source)
-{
- gdk_device_set_source(_SELF(self), RVAL2GDKINPUTSOURCE(source));
- return self;
-}
-*/
-
-static VALUE
-rg_set_mode(VALUE self, VALUE mode)
-{
- return CBOOL2RVAL(gdk_device_set_mode(_SELF(self), RVAL2GDKINPUTMODE(mode)));
-}
-
-static VALUE
-rg_set_key(VALUE self, VALUE index, VALUE keyval, VALUE modifiers)
-{
- gdk_device_set_key(_SELF(self), NUM2UINT(index), NUM2UINT(keyval),
- RVAL2GDKMODIFIERTYPE(modifiers));
- return self;
-}
-
-static VALUE
-rg_set_axis_use(VALUE self, VALUE index, VALUE use)
-{
- gdk_device_set_axis_use(_SELF(self), NUM2UINT(index),
- RVAL2GDKAXISUSE(use));
- return self;
-}
-
-static VALUE
-rg_get_state(VALUE self, VALUE window)
-{
- gdouble axes[2];
- GdkModifierType mask;
-
- gdk_device_get_state(_SELF(self), RVAL2GDKWINDOW(window),
- axes, &mask);
- return rb_ary_new3(3, rb_float_new(axes[0]), rb_float_new(axes[1]),
- GDKMODIFIERTYPE2RVAL(mask));
-}
-
-static VALUE
-rg_get_history(VALUE self, VALUE window, VALUE start, VALUE stop)
-{
- gboolean ret;
- GdkTimeCoord** events;
- gint i, n_events;
- VALUE ary = Qnil;
- ret = gdk_device_get_history(_SELF(self),
- RVAL2GDKWINDOW(window),
- NUM2UINT(start), NUM2UINT(stop),
- &events, &n_events);
- if (ret){
- ary = rb_ary_new();
- for (i = 0; i < n_events; i++){
- rb_ary_push(ary, GDKTIMECOORD2RVAL(events));
- }
- gdk_device_free_history(events, n_events);
- }
- return ary;
-}
-
-static VALUE
-rg_get_axis(VALUE self, VALUE rbaxes, VALUE rbuse)
-{
- GdkDevice *device = _SELF(self);
- GdkAxisUse use = RVAL2GDKAXISUSE(rbuse);
- long n;
- gdouble *axes = RVAL2GDOUBLES(rbaxes, n);
- gint device_n_axes = gdk_device_get_n_axes(device);
- gdouble value;
- gboolean found;
-
- if (n != device_n_axes)
- rb_raise(rb_eArgError,
- "unexpected number of axes: %ld != %d",
- n, device_n_axes);
-
- found = gdk_device_get_axis(device, axes, use, &value);
-
- g_free(axes);
-
- return found ? DBL2NUM(value) : Qnil;
-}
-
-static VALUE
-rg_mode(VALUE self)
-{
- return GDKINPUTMODE2RVAL(gdk_device_get_mode(_SELF(self)));
-}
-
-static VALUE
-rg_get_window_at_position(G_GNUC_UNUSED VALUE self)
-{
- gint x, y;
- GdkWindow *win = gdk_device_get_window_at_position(_SELF(self), &x ,&y);
- return rb_ary_new3(3, GOBJ2RVAL(win), INT2FIX(x), INT2FIX(y));
-}
-
-static VALUE
-rg_ungrab(int argc, VALUE *argv, VALUE self)
-{
- VALUE rb_time;
- guint32 time = GDK_CURRENT_TIME;
-
- rb_scan_args(argc, argv, "01", &rb_time);
- if (!NIL_P(rb_time)) {
- time = NUM2UINT(GDK_CURRENT_TIME);
- }
- gdk_device_ungrab(_SELF(self), time);
- return self;
-}
-
-static VALUE
-rg_get_position(VALUE self)
-{
- GdkScreen *screen;
- gint x, y;
- gdk_device_get_position(_SELF(self), &screen, &x, &y);
- return rb_ary_new3(3, GOBJ2RVAL(screen), INT2NUM(x), INT2NUM(y));
-}
-
-static VALUE
-rg_warp(VALUE self, VALUE screen, VALUE x, VALUE y)
-{
- gdk_device_warp(_SELF(self), RVAL2GDKSCREEN(screen), NUM2INT(x), NUM2INT(y));
- return self;
-}
-
-static VALUE
-rg_grab(VALUE self, VALUE win, VALUE grab_ownership, VALUE owner_events, VALUE event_mask, VALUE cursor, VALUE time)
-{
- return GDKGRABSTATUS2RVAL(gdk_device_grab(_SELF(self),
- RVAL2GDKWINDOW(win),
- RVAL2GDKGRABOWNERSHIP(grab_ownership),
- RVAL2CBOOL(owner_events),
- RVAL2GDKEVENTMASK(event_mask),
- RVAL2GDKCURSOR(cursor),
- NUM2INT(time)));
-}
-
-/* deprecated
-static VALUE
-rg_axes(VALUE self)
-{
- gint i;
- VALUE ary = rb_ary_new();
- GdkDeviceAxis* axes = _SELF(self)->axes;
-
- for (i = 0; i < _SELF(self)->num_axes; i++){
- rb_ary_push(ary, rb_ary_new3(3, GDKAXISUSE2RVAL(axes[i].use),
- rb_float_new(axes[i].min), rb_float_new(axes[i].max)));
- }
- return ary;
-}
-
-static VALUE
-rg_keys(VALUE self)
-{
- gint i;
- VALUE ary = rb_ary_new();
- GdkDeviceKey* keys = _SELF(self)->keys;
-
- for (i = 0; i < _SELF(self)->num_keys; i++){
- rb_ary_push(ary, rb_ary_new3(2, UINT2NUM(keys[i].keyval),
- GDKMODIFIERTYPE2RVAL(keys[i].modifiers)));
- }
- return ary;
-}
-*/
-
-void
-Init_gdk_device(VALUE mGdk)
-{
- VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GDK_TYPE_DEVICE, "Device", mGdk);
-
-/* deprecated
- RG_DEF_SMETHOD(list, 0);
- RG_DEF_SMETHOD(set_extension_events, 3);
- RG_DEF_SMETHOD(core_pointer, 0);
-
- RG_DEF_METHOD(set_source, 1);
-*/
- RG_DEF_METHOD(set_mode, 1);
- RG_DEF_METHOD(set_key, 3);
- RG_DEF_METHOD(set_axis_use, 2);
- RG_DEF_METHOD(get_state, 1);
- RG_DEF_METHOD(get_history, 3);
- RG_DEF_METHOD(get_axis, 2);
- RG_DEF_METHOD(mode, 0);
- RG_DEF_METHOD(get_window_at_position, 0);
- RG_DEF_METHOD(ungrab, -1);
- RG_DEF_METHOD(get_position, 0);
- RG_DEF_METHOD(warp, 3);
- RG_DEF_METHOD(grab, 6);
-
-/* deprecated
- RG_DEF_METHOD(axes, 0);
- RG_DEF_METHOD(keys, 0);
-*/
-
- G_DEF_CLASS(GDK_TYPE_INPUT_SOURCE, "InputSource", RG_TARGET_NAMESPACE);
- G_DEF_CLASS(GDK_TYPE_INPUT_MODE, "InputMode", RG_TARGET_NAMESPACE);
- G_DEF_CLASS(GDK_TYPE_AXIS_USE, "AxisUse", RG_TARGET_NAMESPACE);
-}
diff --git a/gdk3/ext/gdk3/rbgdkdevicemanager.c b/gdk3/ext/gdk3/rbgdkdevicemanager.c
deleted file mode 100644
index 479e5b7..0000000
--- a/gdk3/ext/gdk3/rbgdkdevicemanager.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
-/*
- * Copyright (C) 2013-2014 Ruby-GNOME2 Project Team
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- */
-
-#include "rbgdk3private.h"
-
-#define RG_TARGET_NAMESPACE cDeviceManager
-#define _SELF(obj) RVAL2GDKDEVICEMANAGER(obj)
-
-static VALUE
-rg_devices(VALUE self)
-{
- return GOBJGLIST2RVAL_FREE(gdk_device_manager_list_devices(_SELF(self), GDK_TYPE_DEVICE),
- g_list_free, NULL);
-}
-
-void
-Init_gdk_device_manager(VALUE mGdk)
-{
- VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GDK_TYPE_DEVICE_MANAGER, "DeviceManager", mGdk);
-
- RG_DEF_METHOD(devices, 0);
-}
diff --git a/gdk3/ext/gdk3/rbgdkdisplay.c b/gdk3/ext/gdk3/rbgdkdisplay.c
deleted file mode 100644
index 5055c59..0000000
--- a/gdk3/ext/gdk3/rbgdkdisplay.c
+++ /dev/null
@@ -1,434 +0,0 @@
-/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
-/*
- * Copyright (C) 2011 Ruby-GNOME2 Project Team
- * Copyright (C) 2002-2005 Ruby-GNOME2 Project Team
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- */
-
-#include "rbgdk3private.h"
-
-#define RG_TARGET_NAMESPACE cDisplay
-#define _SELF(i) RVAL2GDKDISPLAYOBJECT(i)
-
-static VALUE
-rg_close(VALUE self)
-{
- gdk_display_close(_SELF(self));
- return self;
-}
-
-static VALUE
-rg_s_open(G_GNUC_UNUSED VALUE self, VALUE display_name)
-{
- GdkDisplay* gdisplay = gdk_display_open(RVAL2CSTR(display_name));
- if (! gdisplay) {
- rb_raise(rb_eRuntimeError, "The display `%s' could not be opened.",
- RVAL2CSTR(display_name));
- } else {
- VALUE display;
- g_object_ref(gdisplay);
- display = GOBJ2RVAL(gdisplay);
-
- if (rb_block_given_p()) {
- rb_ensure(rb_yield, display, rg_close, display);
- return Qnil;
- } else {
- return display;
- }
- }
-}
-
-static VALUE
-rg_s_default(G_GNUC_UNUSED VALUE self)
-{
- GdkDisplay* gdisplay = gdk_display_get_default();
- if (! gdisplay)
- rb_raise(rb_eRuntimeError, "No default display is found.");
-
- return GOBJ2RVAL(gdisplay);
-}
-
-static VALUE
-rg_name(VALUE self)
-{
- return CSTR2RVAL(gdk_display_get_name(_SELF(self)));
-}
-
-static VALUE
-rg_n_screens(VALUE self)
-{
- return INT2NUM(gdk_display_get_n_screens(_SELF(self)));
-}
-
-static VALUE
-rg_get_screen(VALUE self, VALUE num)
-{
- return GOBJ2RVAL(gdk_display_get_screen(_SELF(self), NUM2INT(num)));
-}
-
-static VALUE
-rg_default_screen(VALUE self)
-{
- return GOBJ2RVAL(gdk_display_get_default_screen(_SELF(self)));
-}
-
-static VALUE
-rg_device_manager(VALUE self)
-{
- return GOBJ2RVAL(gdk_display_get_device_manager(_SELF(self)));
-}
-
-static VALUE
-rg_device_is_grabbed_p(VALUE self, VALUE device)
-{
- return CBOOL2RVAL(gdk_display_device_is_grabbed(_SELF(self), RVAL2GDKDEVICE(device)));
-}
-
-static VALUE
-rg_beep(VALUE self)
-{
- gdk_display_beep(_SELF(self));
- return self;
-}
-
-static VALUE
-rg_sync(VALUE self)
-{
- gdk_display_sync(_SELF(self));
- return self;
-}
-
-static VALUE
-rg_flush(VALUE self)
-{
- gdk_display_flush(_SELF(self));
- return self;
-}
-
-static VALUE
-rg_event(VALUE self)
-{
- return GEV2RVAL(gdk_display_get_event(_SELF(self)));
-}
-
-static VALUE
-rg_peek_event(VALUE self)
-{
- return GEV2RVAL(gdk_display_peek_event(_SELF(self)));
-}
-
-static VALUE
-rg_put_event(VALUE self, VALUE event)
-{
- gdk_display_put_event(_SELF(self), RVAL2GEV(event));
- return self;
-}
-
-/* Don't implement this.
-static GdkFilterReturn
-filter_func(GdkXEvent xevent, GdkEvent event, gpointer func)
-{
- return GENUM2RVAL(rb_funcall((VALUE)func, id_call, 2,
- ????, GEV2RVAL(event)),
- GDK_TYPE_FILTER_RETURN);
-}
-
-static VALUE
-gdkdisplay_add_client_message_filter(VALUE self, VALUE message_type)
-{
- VALUE func = RB_BLOCK_PROC();
- G_RELATIVE(self, func);
- gdk_display_add_client_message_filter(_SELF(self), RVAL2ATOM(message_type),
- filter_func, func);
- return self;
-}
-*/
-
-static VALUE
-rg_set_double_click_time(VALUE self, VALUE msec)
-{
- gdk_display_set_double_click_time(_SELF(self), NUM2UINT(msec));
- return self;
-}
-
-static VALUE
-rg_closed_p(VALUE self)
-{
- return CBOOL2RVAL(gdk_display_is_closed(_SELF(self)));
-}
-
-static VALUE
-rg_set_double_click_distance(VALUE self, VALUE distance)
-{
- gdk_display_set_double_click_distance(_SELF(self), NUM2UINT(distance));
- return self;
-}
-
-/* Don't implement this.
-GdkDisplayPointerHooks* gdk_display_set_pointer_hooks
- (GdkDisplay *display,
- const GdkDisplayPointerHooks *new_hooks);
- */
-
-static VALUE
-rg_supports_cursor_color_p(VALUE self)
-{
- return CBOOL2RVAL(gdk_display_supports_cursor_color(_SELF(self)));
-}
-
-static VALUE
-rg_supports_cursor_alpha_p(VALUE self)
-{
- return CBOOL2RVAL(gdk_display_supports_cursor_alpha(_SELF(self)));
-}
-
-static VALUE
-rg_default_cursor_size(VALUE self)
-{
- return UINT2NUM(gdk_display_get_default_cursor_size(_SELF(self)));
-}
-
-static VALUE
-rg_maximal_cursor_size(VALUE self)
-{
- guint width, height;
- gdk_display_get_maximal_cursor_size(_SELF(self), &width, &height);
- return rb_assoc_new(UINT2NUM(width), UINT2NUM(height));
-}
-
-static VALUE
-rg_default_group(VALUE self)
-{
- return GOBJ2RVAL(gdk_display_get_default_group(_SELF(self)));
-}
-
-static VALUE
-rg_supports_selection_notification_p(VALUE self)
-{
- return CBOOL2RVAL(gdk_display_supports_selection_notification(_SELF(self)));
-}
-
-static VALUE
-rg_request_selection_notification_p(VALUE self, VALUE selection)
-{
- return CBOOL2RVAL(gdk_display_request_selection_notification(_SELF(self),
- RVAL2ATOM(selection)));
-}
-
-static VALUE
-rg_supports_clipboard_persistence_p(VALUE self)
-{
- return CBOOL2RVAL(gdk_display_supports_clipboard_persistence(_SELF(self)));
-}
-
-static VALUE
-rg_store_clipboard(VALUE self, VALUE rbclipboard_window, VALUE rbtime_, VALUE rbtargets)
-{
- GdkDisplay *display = _SELF(self);
- GdkWindow *clipboard_window = RVAL2GDKWINDOW(rbclipboard_window);
- guint32 time_ = NUM2UINT(rbtime_);
- long n;
- GdkAtom *targets = RVAL2GDKATOMS(rbtargets, &n);
-
- gdk_display_store_clipboard(display, clipboard_window, time_, targets, n);
-
- g_free(targets);
-
- return self;
-}
-
-/* deprecated
-static VALUE
-rg_core_pointer(VALUE self)
-{
- return GOBJ2RVAL(gdk_display_get_core_pointer(_SELF(self)));
-}
-*/
-
-#ifdef GDK_WINDOWING_X11
-static VALUE
-rg_grab(VALUE self)
-{
- gdk_x11_display_grab(_SELF(self));
- return self;
-}
-static VALUE
-rg_ungrab(VALUE self)
-{
- gdk_x11_display_ungrab(_SELF(self));
- return self;
-}
-
-static VALUE
-rg_register_standard_event_type(VALUE self, VALUE event_base, VALUE n_events)
-{
- gdk_x11_register_standard_event_type(_SELF(self),
- NUM2INT(event_base), NUM2INT(n_events));
- return self;
-}
-
-static VALUE
-rg_user_time(VALUE self)
-{
- return UINT2NUM(gdk_x11_display_get_user_time(_SELF(self)));
-}
-
-static VALUE
-rg_set_cursor_theme(VALUE self, VALUE theme, VALUE size)
-{
- gdk_x11_display_set_cursor_theme(_SELF(self), RVAL2CSTR(theme), NUM2INT(size));
- return self;
-}
-
-/*
-*** need gdk_x11_display_broadcast_startup_messagev() ***
-
-typedef struct _StartupMessageParameterData {
- gchar **parameters;
- guint i;
-} StartupMessageParameterData;
-
-static int
-collect_parameter(VALUE key, VALUE value, VALUE data)
-{
- StartupMessageParameterData *parameter_data;
- parameter_data = (StartupMessageParameterData *)data;
-
- parameter_data->parameters[parameter_data->i] = RVAL2CSTR(key);
- parameter_data->i++;
- parameter_data->parameters[parameter_data->i] = RVAL2CSTR(value);
- parameter_data->i++;
-
- return ST_CONTINUE;
-}
-
-static VALUE
-rg_broadcast_startup_message(int argc, VALUE *argv, VALUE self)
-{
- VALUE rb_message_type, rb_parameters;
- char *message_type;
- guint n_parameters;
- gchar **parameters;
-
- rb_scan_args(argc, argv, "11", &rb_message_type, &rb_parameters);
-
- message_type = RVAL2CSTR(rb_message_type);
- if (NIL_P(rb_parameters)) {
- n_parameters = 0;
- parameters = NULL;
- }
- else {
- StartupMessageParameterData data;
-
- Check_Type(rb_parameters, T_HASH);
- n_parameters = NUM2UINT(rb_funcall(rb_parameters, rb_intern("size"), 0));
- parameters = ALLOCA_N(gchar *, n_parameters * 2);
- data.i = 0;
- data.parameters = parameters;
- rb_hash_foreach(rb_parameters, collect_parameter, (VALUE)&data);
- }
-
- gdk_x11_display_broadcast_startup_messagev(_SELF(self),
- message_type,
- n_parameters,
- parameters);
-
- return self;
-}
-*/
-
-static VALUE
-rg_startup_notification_id(VALUE self)
-{
- return CSTR2RVAL(gdk_x11_display_get_startup_notification_id(_SELF(self)));
-}
-#endif
-
-static VALUE
-rg_supports_shapes_p(VALUE self)
-{
- return CBOOL2RVAL(gdk_display_supports_shapes(_SELF(self)));
-}
-
-static VALUE
-rg_supports_input_shapes_p(VALUE self)
-{
- return CBOOL2RVAL(gdk_display_supports_input_shapes(_SELF(self)));
-}
-
-static VALUE
-rg_supports_composite_p(VALUE self)
-{
- return CBOOL2RVAL(gdk_display_supports_composite(_SELF(self)));
-}
-
-void
-Init_gdk_display(VALUE mGdk)
-{
- VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GDK_TYPE_DISPLAY, "Display", mGdk);
-
- RG_DEF_SMETHOD(open, 1);
- RG_DEF_SMETHOD(default, 0);
- RG_DEF_METHOD(name, 0);
- RG_DEF_METHOD(n_screens, 0);
- RG_DEF_METHOD(get_screen, 1);
- RG_DEF_ALIAS("[]", "get_screen");
- RG_DEF_METHOD(default_screen, 0);
- RG_DEF_METHOD(device_manager, 0);
-
- RG_DEF_METHOD_P(device_is_grabbed, 1);
-
- RG_DEF_METHOD(beep, 0);
- RG_DEF_METHOD(sync, 0);
- RG_DEF_METHOD(flush, 0);
- RG_DEF_METHOD(close, 0);
-
- RG_DEF_METHOD(event, 0);
- RG_DEF_METHOD(peek_event, 0);
- RG_DEF_METHOD(put_event, 1);
- RG_DEF_METHOD(set_double_click_time, 1);
- RG_DEF_METHOD_P(closed, 0);
- RG_DEF_METHOD(set_double_click_distance, 1);
- RG_DEF_METHOD_P(supports_cursor_color, 0);
- RG_DEF_METHOD_P(supports_cursor_alpha, 0);
- RG_DEF_METHOD(default_cursor_size, 0);
- RG_DEF_METHOD(maximal_cursor_size, 0);
- RG_DEF_METHOD(default_group, 0);
- RG_DEF_METHOD_P(supports_selection_notification, 0);
- RG_DEF_METHOD_P(request_selection_notification, 1);
- RG_DEF_METHOD_P(supports_clipboard_persistence, 0);
- RG_DEF_METHOD(store_clipboard, 3);
-/* deprecated
- RG_DEF_METHOD(core_pointer, 0);
-*/
-#ifdef GDK_WINDOWING_X11
- RG_DEF_METHOD(grab, 0);
- RG_DEF_METHOD(ungrab, 0);
- RG_DEF_METHOD(register_standard_event_type, 2);
- RG_DEF_METHOD(user_time, 0);
- RG_DEF_METHOD(set_cursor_theme, 2);
-/*
- RG_DEF_METHOD(broadcast_startup_message, -1);
-*/
- RG_DEF_METHOD(startup_notification_id, 0);
- G_DEF_CLASS3("GdkDisplayX11", "DisplayX11", mGdk);
-#endif
-
- RG_DEF_METHOD_P(supports_shapes, 0);
- RG_DEF_METHOD_P(supports_input_shapes, 0);
- RG_DEF_METHOD_P(supports_composite, 0);
-}
diff --git a/gdk3/ext/gdk3/rbgdkdisplaymanager.c b/gdk3/ext/gdk3/rbgdkdisplaymanager.c
deleted file mode 100644
index c7e30bf..0000000
--- a/gdk3/ext/gdk3/rbgdkdisplaymanager.c
+++ /dev/null
@@ -1,55 +0,0 @@
-/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
-/*
- * Copyright (C) 2011 Ruby-GNOME2 Project Team
- * Copyright (C) 2002-2006 Ruby-GNOME2 Project Team
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- */
-
-#include "rbgdk3private.h"
-
-#define RG_TARGET_NAMESPACE cDisplayManager
-#define _SELF(obj) RVAL2GDKDISPLAYMANAGER(obj)
-
-static VALUE
-rg_s_get(G_GNUC_UNUSED VALUE self)
-{
- return GOBJ2RVAL(gdk_display_manager_get());
-}
-
-static VALUE
-rg_displays(VALUE self)
-{
- return GOBJGSLIST2RVAL_FREE(gdk_display_manager_list_displays(_SELF(self)),
- g_slist_free, NULL);
-}
-
-/* Move to Gdk::Display.
-static VALUE
-gdkdisplaymanager_get_core_pointer(VALUE self)
-{
- return GOBJ2RVAL(gdk_display_get_core_pointer(_SELF(self)));
-}
-*/
-
-void
-Init_gdk_display_manager(VALUE mGdk)
-{
- VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GDK_TYPE_DISPLAY_MANAGER, "DisplayManager", mGdk);
-
- RG_DEF_SMETHOD(get, 0);
- RG_DEF_METHOD(displays, 0);
-}
diff --git a/gdk3/ext/gdk3/rbgdkdragcontext.c b/gdk3/ext/gdk3/rbgdkdragcontext.c
deleted file mode 100644
index 9727288..0000000
--- a/gdk3/ext/gdk3/rbgdkdragcontext.c
+++ /dev/null
@@ -1,191 +0,0 @@
-/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
-/*
- * Copyright (C) 2011 Ruby-GNOME2 Project Team
- * Copyright (C) 2002,2003 Masao Mutoh
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- */
-
-#include "rbgdk3private.h"
-
-#define RG_TARGET_NAMESPACE cDragContext
-#define _SELF(self) (RVAL2GDKDRAGCONTEXT(self))
-
-static VALUE
-rg_protocol(VALUE self)
-{
- return GDKDRAGPROTOCOL2RVAL(gdk_drag_context_get_protocol(_SELF(self)));
-}
-
-static VALUE
-rg_source_window(VALUE self)
-{
- return GOBJ2RVAL(gdk_drag_context_get_source_window(_SELF(self)));
-}
-
-static VALUE
-rg_dest_window(VALUE self)
-{
- return GOBJ2RVAL(gdk_drag_context_get_dest_window(_SELF(self)));
-}
-
-static VALUE
-rg_targets(VALUE self)
-{
- GList *list, *cur;
- VALUE ary = rb_ary_new();
-
- list = gdk_drag_context_list_targets(_SELF(self));
- for (cur = list; cur != NULL; cur = cur->next) {
- rb_ary_push(ary, GDKATOM2RVAL((GdkAtom)cur->data));
- }
- return ary;
-}
-
-static VALUE
-rg_actions(VALUE self)
-{
- return GDKDRAGACTION2RVAL(gdk_drag_context_get_actions(_SELF(self)));
-}
-
-static VALUE
-rg_suggested_action(VALUE self)
-{
- return GDKDRAGACTION2RVAL(gdk_drag_context_get_suggested_action(_SELF(self)));
-}
-
-static VALUE
-rg_selected_action(VALUE self)
-{
- return GDKDRAGACTION2RVAL(gdk_drag_context_get_selected_action(_SELF(self)));
-}
-
-static VALUE
-rg_selection(VALUE self)
-{
- return GDKATOM2RVAL(gdk_drag_get_selection(_SELF(self)));
-}
-
-static VALUE
-rg_drag_abort(VALUE self, VALUE time)
-{
- gdk_drag_abort(_SELF(self), NUM2UINT(time));
- return self;
-}
-
-static VALUE
-rg_drop_reply(VALUE self, VALUE ok, VALUE time)
-{
- gdk_drop_reply(_SELF(self), RVAL2CBOOL(ok), NUM2UINT(time));
- return self;
-}
-
-static VALUE
-rg_drag_drop(VALUE self, VALUE time)
-{
- gdk_drag_drop(_SELF(self), NUM2UINT(time));
- return self;
-}
-
-static VALUE
-rg_find_window(int argc, VALUE *argv, VALUE self)
-{
- VALUE drag_window, x_root, y_root;
- GdkWindow *dest_window;
- GdkDragProtocol prot;
-
- if (argc == 3) {
-/* deprecated
- rb_scan_args(argc, argv, "30", &drag_window, &x_root, &y_root);
- gdk_drag_find_window(_SELF(self),
- RVAL2GDKWINDOW(drag_window),
- NUM2INT(x_root), NUM2INT(y_root),
- &dest_window, &prot);
-*/
- } else {
- VALUE screen;
- rb_scan_args(argc, argv, "40", &drag_window, &screen, &x_root, &y_root);
- gdk_drag_find_window_for_screen(_SELF(self),
- RVAL2GDKWINDOW(drag_window),
- RVAL2GDKSCREEN(screen),
- NUM2INT(x_root), NUM2INT(y_root),
- &dest_window, &prot);
- }
-
- return rb_ary_new3(2, GOBJ2RVAL(dest_window),
- GDKDRAGPROTOCOL2RVAL(prot));
-}
-
-static VALUE
-rg_drag_motion(VALUE self, VALUE dest_window, VALUE protocol, VALUE x_root, VALUE y_root, VALUE suggested_action, VALUE possible_actions, VALUE time)
-{
- gboolean ret = gdk_drag_motion(_SELF(self),
- RVAL2GDKWINDOW(dest_window),
- RVAL2GDKDRAGPROTOCOL(protocol),
- NUM2INT(x_root), NUM2INT(y_root),
- RVAL2GDKDRAGACTION(suggested_action),
- RVAL2GDKDRAGACTION(possible_actions),
- NUM2UINT(time));
- return CBOOL2RVAL(ret);
-}
-
-static VALUE
-rg_drop_finish(VALUE self, VALUE success, VALUE time)
-{
- gdk_drop_finish(_SELF(self), RVAL2CBOOL(success), NUM2UINT(time));
- return self;
-}
-
-static VALUE
-rg_drag_status(VALUE self, VALUE action, VALUE time)
-{
- gdk_drag_status(_SELF(self),
- RVAL2GDKDRAGACTION(action), NUM2UINT(time));
- return self;
-}
-
-static VALUE
-rg_drag_drop_succeeded_p(VALUE self)
-{
- return CBOOL2RVAL(gdk_drag_drop_succeeded(_SELF(self)));
-}
-
-void
-Init_gdk_dragcontext(VALUE mGdk)
-{
- VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GDK_TYPE_DRAG_CONTEXT, "DragContext", mGdk);
-
- RG_DEF_METHOD(protocol, 0);
- RG_DEF_METHOD(source_window, 0);
- RG_DEF_METHOD(dest_window, 0);
- RG_DEF_METHOD(targets, 0);
- RG_DEF_METHOD(actions, 0);
- RG_DEF_METHOD(suggested_action, 0);
- RG_DEF_METHOD(selected_action, 0);
-
- RG_DEF_METHOD(selection, 0);
- RG_DEF_METHOD(drag_abort, 1);
- RG_DEF_METHOD(drop_reply, 2);
- RG_DEF_METHOD(drag_drop, 1);
- RG_DEF_METHOD(find_window, 4);
- RG_DEF_METHOD(drag_motion, 7);
- RG_DEF_METHOD(drop_finish, 2);
- RG_DEF_METHOD(drag_status, 2);
- RG_DEF_METHOD_P(drag_drop_succeeded, 0);
-
- G_DEF_CLASS(GDK_TYPE_DRAG_PROTOCOL, "Protocol", RG_TARGET_NAMESPACE);
- G_DEF_CLASS(GDK_TYPE_DRAG_ACTION, "Action", RG_TARGET_NAMESPACE);
-}
diff --git a/gdk3/ext/gdk3/rbgdkevent.c b/gdk3/ext/gdk3/rbgdkevent.c
deleted file mode 100644
index b44977a..0000000
--- a/gdk3/ext/gdk3/rbgdkevent.c
+++ /dev/null
@@ -1,1173 +0,0 @@
-/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
-/*
- * Copyright (C) 2002-2014 Ruby-GNOME2 Project Team
- * Copyright (C) 1998-2000 Yukihiro Matsumoto,
- * Daisuke Kanda,
- * Hiroshi Igarashi
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- */
-
-#include "rbgdk3private.h"
-
-static VALUE rb_cGdkEvent;
-static VALUE rb_cGdkEventAny;
-static VALUE rb_cGdkEventExpose;
-static VALUE rb_cGdkEventVisibility;
-static VALUE rb_cGdkEventMotion;
-static VALUE rb_cGdkEventButton;
-static VALUE rb_cGdkEventTouch;
-static VALUE rb_cGdkEventScroll;
-static VALUE rb_cGdkEventKey;
-static VALUE rb_cGdkEventCrossing;
-static VALUE rb_cGdkEventFocus;
-static VALUE rb_cGdkEventConfigure;
-static VALUE rb_cGdkEventProperty;
-static VALUE rb_cGdkEventSelection;
-static VALUE rb_cGdkEventOwnerChange;
-static VALUE rb_cGdkEventProximity;
-static VALUE rb_cGdkEventDND;
-static VALUE rb_cGdkEventWindowState;
-static VALUE rb_cGdkEventSetting;
-static VALUE rb_cGdkEventGrabBroken;
-
-#define DEFINE_EVENT_TYPE(type_lower_case, type_upper_case) \
-static GType \
-rb_gdk_event_ ## type_lower_case ## _get_type(void) \
-{ \
- static GType type = 0; \
- if (type == 0) { \
- type = g_boxed_type_register_static("GdkEvent" # type_upper_case, \
- (GBoxedCopyFunc)gdk_event_copy, \
- (GBoxedFreeFunc)gdk_event_free); \
- } \
- return type; \
-}
-
-DEFINE_EVENT_TYPE(any, Any)
-DEFINE_EVENT_TYPE(expose, Expose)
-DEFINE_EVENT_TYPE(visibility, Visibility)
-DEFINE_EVENT_TYPE(motion, Motion)
-DEFINE_EVENT_TYPE(button, Button)
-DEFINE_EVENT_TYPE(touch, Touch)
-DEFINE_EVENT_TYPE(scroll, Scroll)
-DEFINE_EVENT_TYPE(key, Key)
-DEFINE_EVENT_TYPE(crossing, Crossing)
-DEFINE_EVENT_TYPE(focus, Focus)
-DEFINE_EVENT_TYPE(configure, Configure)
-DEFINE_EVENT_TYPE(property, Property)
-DEFINE_EVENT_TYPE(selection, Selection)
-DEFINE_EVENT_TYPE(owner_change, OwnerChange)
-DEFINE_EVENT_TYPE(proximity, Proximity)
-DEFINE_EVENT_TYPE(dnd, DND)
-DEFINE_EVENT_TYPE(window_state, WindowState)
-DEFINE_EVENT_TYPE(setting, Setting)
-DEFINE_EVENT_TYPE(grab_broken, GrabBroken)
-
-#define GDK_TYPE_EVENT_ANY (rb_gdk_event_any_get_type())
-#define GDK_TYPE_EVENT_EXPOSE (rb_gdk_event_expose_get_type())
-#define GDK_TYPE_EVENT_VISIBILITY (rb_gdk_event_visibility_get_type())
-#define GDK_TYPE_EVENT_MOTION (rb_gdk_event_motion_get_type())
-#define GDK_TYPE_EVENT_BUTTON (rb_gdk_event_button_get_type())
-#define GDK_TYPE_EVENT_TOUCH (rb_gdk_event_touch_get_type())
-#define GDK_TYPE_EVENT_SCROLL (rb_gdk_event_scroll_get_type())
-#define GDK_TYPE_EVENT_KEY (rb_gdk_event_key_get_type())
-#define GDK_TYPE_EVENT_CROSSING (rb_gdk_event_crossing_get_type())
-#define GDK_TYPE_EVENT_FOCUS (rb_gdk_event_focus_get_type())
-#define GDK_TYPE_EVENT_CONFIGURE (rb_gdk_event_configure_get_type())
-#define GDK_TYPE_EVENT_PROPERTY (rb_gdk_event_property_get_type())
-#define GDK_TYPE_EVENT_SELECTION (rb_gdk_event_selection_get_type())
-#define GDK_TYPE_EVENT_OWNER_CHANGE (rb_gdk_event_owner_change_get_type())
-#define GDK_TYPE_EVENT_PROXIMITY (rb_gdk_event_proximity_get_type())
-#define GDK_TYPE_EVENT_DND (rb_gdk_event_dnd_get_type())
-#define GDK_TYPE_EVENT_WINDOW_STATE (rb_gdk_event_window_state_get_type())
-#define GDK_TYPE_EVENT_SETTING (rb_gdk_event_setting_get_type())
-#define GDK_TYPE_EVENT_GRAB_BROKEN (rb_gdk_event_grab_broken_get_type())
-
-/***********************************************/
-
-static GType
-rb_gdk_event_type_to_gtype(GdkEventType event_type)
-{
- GType gtype = GDK_TYPE_EVENT_ANY;
-
- switch (event_type) {
- case GDK_NOTHING:
- case GDK_DELETE:
- case GDK_DESTROY:
- break;
- case GDK_EXPOSE:
- gtype = GDK_TYPE_EVENT_EXPOSE;
- break;
- case GDK_MOTION_NOTIFY:
- gtype = GDK_TYPE_EVENT_MOTION;
- break;
- case GDK_BUTTON_PRESS:
- case GDK_2BUTTON_PRESS:
- case GDK_3BUTTON_PRESS:
- case GDK_BUTTON_RELEASE:
- gtype = GDK_TYPE_EVENT_BUTTON;
- break;
- case GDK_KEY_PRESS:
- case GDK_KEY_RELEASE:
- gtype = GDK_TYPE_EVENT_KEY;
- break;
- case GDK_ENTER_NOTIFY:
- case GDK_LEAVE_NOTIFY:
- gtype = GDK_TYPE_EVENT_CROSSING;
- break;
- case GDK_FOCUS_CHANGE:
- gtype = GDK_TYPE_EVENT_FOCUS;
- break;
- case GDK_CONFIGURE:
- gtype = GDK_TYPE_EVENT_CONFIGURE;
- break;
- case GDK_MAP:
- case GDK_UNMAP:
- break;
- case GDK_PROPERTY_NOTIFY:
- gtype = GDK_TYPE_EVENT_PROPERTY;
- break;
- case GDK_SELECTION_CLEAR:
- case GDK_SELECTION_REQUEST:
- case GDK_SELECTION_NOTIFY:
- gtype = GDK_TYPE_EVENT_SELECTION;
- break;
- case GDK_PROXIMITY_IN:
- case GDK_PROXIMITY_OUT:
- gtype = GDK_TYPE_EVENT_PROXIMITY;
- break;
- case GDK_DRAG_ENTER:
- case GDK_DRAG_LEAVE:
- case GDK_DRAG_MOTION:
- case GDK_DRAG_STATUS:
- case GDK_DROP_START:
- case GDK_DROP_FINISHED:
- gtype = GDK_TYPE_EVENT_DND;
- break;
- case GDK_CLIENT_EVENT:
- break;
- case GDK_VISIBILITY_NOTIFY:
- gtype = GDK_TYPE_EVENT_VISIBILITY;
- break;
- case GDK_SCROLL:
- gtype = GDK_TYPE_EVENT_SCROLL;
- break;
- case GDK_WINDOW_STATE:
- gtype = GDK_TYPE_EVENT_WINDOW_STATE;
- break;
- case GDK_SETTING:
- gtype = GDK_TYPE_EVENT_SETTING;
- break;
- case GDK_OWNER_CHANGE:
- gtype = GDK_TYPE_EVENT_OWNER_CHANGE;
- break;
- case GDK_GRAB_BROKEN:
- gtype = GDK_TYPE_EVENT_GRAB_BROKEN;
- break;
- case GDK_DAMAGE:
- gtype = GDK_TYPE_EVENT_EXPOSE;
- break;
- case GDK_TOUCH_BEGIN:
- case GDK_TOUCH_UPDATE:
- case GDK_TOUCH_END:
- case GDK_TOUCH_CANCEL:
- gtype = GDK_TYPE_EVENT_TOUCH;
- break;
- case GDK_EVENT_LAST:
- break;
- default:
- break;
- }
-
- return gtype;
-}
-
-static VALUE
-rb_gdk_event_type_to_class(GdkEventType event_type)
-{
- VALUE klass = Qnil;
-
- switch (event_type) {
- case GDK_NOTHING:
- case GDK_DELETE:
- case GDK_DESTROY:
- break;
- case GDK_EXPOSE:
- klass = rb_cGdkEventExpose;
- break;
- case GDK_MOTION_NOTIFY:
- klass = rb_cGdkEventMotion;
- break;
- case GDK_BUTTON_PRESS:
- case GDK_2BUTTON_PRESS:
- case GDK_3BUTTON_PRESS:
- case GDK_BUTTON_RELEASE:
- klass = rb_cGdkEventButton;
- break;
- case GDK_KEY_PRESS:
- case GDK_KEY_RELEASE:
- klass = rb_cGdkEventKey;
- break;
- case GDK_ENTER_NOTIFY:
- case GDK_LEAVE_NOTIFY:
- klass = rb_cGdkEventCrossing;
- break;
- case GDK_FOCUS_CHANGE:
- klass = rb_cGdkEventFocus;
- break;
- case GDK_CONFIGURE:
- klass = rb_cGdkEventConfigure;
- break;
- case GDK_MAP:
- case GDK_UNMAP:
- break;
- case GDK_PROPERTY_NOTIFY:
- klass = rb_cGdkEventProperty;
- break;
- case GDK_SELECTION_CLEAR:
- case GDK_SELECTION_REQUEST:
- case GDK_SELECTION_NOTIFY:
- klass = rb_cGdkEventSelection;
- break;
- case GDK_PROXIMITY_IN:
- case GDK_PROXIMITY_OUT:
- klass = rb_cGdkEventProximity;
- break;
- case GDK_DRAG_ENTER:
- case GDK_DRAG_LEAVE:
- case GDK_DRAG_MOTION:
- case GDK_DRAG_STATUS:
- case GDK_DROP_START:
- case GDK_DROP_FINISHED:
- klass = rb_cGdkEventDND;
- break;
- case GDK_CLIENT_EVENT:
- break;
- case GDK_VISIBILITY_NOTIFY:
- klass = rb_cGdkEventVisibility;
- break;
- case GDK_SCROLL:
- klass = rb_cGdkEventScroll;
- break;
- case GDK_WINDOW_STATE:
- klass = rb_cGdkEventWindowState;
- break;
- case GDK_SETTING:
- klass = rb_cGdkEventSetting;
- break;
- case GDK_OWNER_CHANGE:
- klass = rb_cGdkEventOwnerChange;
- break;
- case GDK_GRAB_BROKEN:
- klass = rb_cGdkEventGrabBroken;
- break;
- case GDK_DAMAGE:
- klass = rb_cGdkEventExpose;
- break;
- case GDK_TOUCH_BEGIN:
- case GDK_TOUCH_UPDATE:
- case GDK_TOUCH_END:
- case GDK_TOUCH_CANCEL:
- klass = rb_cGdkEventTouch;
- break;
- case GDK_EVENT_LAST:
- break;
- default:
- break;
- }
-
- if (NIL_P(klass)) {
- klass = rb_cGdkEventAny;
- }
-
- return klass;
-}
-
-static GType
-rb_gdk_event_to_gtype(VALUE event)
-{
- VALUE klass;
- GType type = GDK_TYPE_EVENT;
-
- klass = rb_obj_class(event);
- if (klass == rb_cGdkEvent) {
- type = GDK_TYPE_EVENT;
- } else if (klass == rb_cGdkEventAny) {
- type = GDK_TYPE_EVENT_ANY;
- } else if (klass == rb_cGdkEventExpose) {
- type = GDK_TYPE_EVENT_EXPOSE;
- } else if (klass == rb_cGdkEventVisibility) {
- type = GDK_TYPE_EVENT_VISIBILITY;
- } else if (klass == rb_cGdkEventMotion) {
- type = GDK_TYPE_EVENT_MOTION;
- } else if (klass == rb_cGdkEventButton) {
- type = GDK_TYPE_EVENT_BUTTON;
- } else if (klass == rb_cGdkEventScroll) {
- type = GDK_TYPE_EVENT_SCROLL;
- } else if (klass == rb_cGdkEventKey) {
- type = GDK_TYPE_EVENT_KEY;
- } else if (klass == rb_cGdkEventCrossing) {
- type = GDK_TYPE_EVENT_CROSSING;
- } else if (klass == rb_cGdkEventFocus) {
- type = GDK_TYPE_EVENT_FOCUS;
- } else if (klass == rb_cGdkEventConfigure) {
- type = GDK_TYPE_EVENT_CONFIGURE;
- } else if (klass == rb_cGdkEventProperty) {
- type = GDK_TYPE_EVENT_PROPERTY;
- } else if (klass == rb_cGdkEventSelection) {
- type = GDK_TYPE_EVENT_SELECTION;
- } else if (klass == rb_cGdkEventOwnerChange) {
- type = GDK_TYPE_EVENT_OWNER_CHANGE;
- } else if (klass == rb_cGdkEventProximity) {
- type = GDK_TYPE_EVENT_PROXIMITY;
- } else if (klass == rb_cGdkEventDND) {
- type = GDK_TYPE_EVENT_DND;
- } else if (klass == rb_cGdkEventWindowState) {
- type = GDK_TYPE_EVENT_WINDOW_STATE;
- } else if (klass == rb_cGdkEventSetting) {
- type = GDK_TYPE_EVENT_SETTING;
- } else if (klass == rb_cGdkEventGrabBroken) {
- type = GDK_TYPE_EVENT_GRAB_BROKEN;
- } else if (klass == rb_cGdkEventTouch) {
- type = GDK_TYPE_EVENT_TOUCH;
- } else {
- rb_raise(rb_eArgError, "Not event object: %s", RBG_INSPECT(event));
- }
-
- return type;
-}
-
-VALUE
-rbgdk_gdkevent2rval(GdkEvent *event)
-{
- return BOXED2RVAL(event, rb_gdk_event_type_to_gtype(event->any.type));
-}
-
-GdkEvent *
-rbgdk_rval2gdkevent(VALUE event)
-{
- return RVAL2BOXED(event, rb_gdk_event_to_gtype(event));
-}
-
-/***********************************************/
-#define ATTR_STR(type, name)\
-static VALUE \
-gdkevent ## type ## _ ## name (VALUE self)\
-{\
- return CSTR2RVAL(RVAL2GDKEVENT(self)->type.name);\
-}\
-static VALUE \
-gdkevent ## type ## _set_ ## name (VALUE self, VALUE val)\
-{\
- RVAL2GDKEVENT(self)->type.name = (gchar *)RVAL2CSTR(val);\
- return self;\
-}
-
-#define ATTR_INT(type, name)\
-static VALUE \
-gdkevent ## type ## _ ## name (VALUE self)\
-{\
- return INT2NUM(RVAL2GDKEVENT(self)->type.name);\
-}\
-static VALUE \
-gdkevent ## type ## _set_ ## name (VALUE self, VALUE val)\
-{\
- RVAL2GDKEVENT(self)->type.name = NUM2INT(val);\
- return self;\
-}
-
-#define ATTR_UINT(type, name)\
-static VALUE \
-gdkevent ## type ## _ ## name (VALUE self)\
-{\
- return UINT2NUM(RVAL2GDKEVENT(self)->type.name);\
-}\
-static VALUE \
-gdkevent ## type ## _set_ ## name (VALUE self, VALUE val)\
-{\
- RVAL2GDKEVENT(self)->type.name = NUM2UINT(val);\
- return self;\
-}
-
-#define ATTR_GDKWINDOW(type, name)\
-static VALUE \
-gdkevent ## type ## _ ## name (VALUE self)\
-{\
- return GOBJ2RVAL(RVAL2GDKEVENT(self)->type.name);\
-}\
-static VALUE \
-gdkevent ## type ## _set_ ## name (VALUE self, VALUE val)\
-{\
- RVAL2GDKEVENT(self)->type.name = RVAL2GDKWINDOW(val);\
- return self;\
-}
-
-#define ATTR_FLOAT(type, name)\
-static VALUE \
-gdkevent ## type ## _ ## name (VALUE self)\
-{\
- return rb_float_new(RVAL2GDKEVENT(self)->type.name);\
-}\
-static VALUE \
-gdkevent ## type ## _set_ ## name (VALUE self, VALUE val)\
-{\
- RVAL2GDKEVENT(self)->type.name = NUM2DBL(val);\
- return self;\
-}
-
-#define ATTR_GOBJ(type, name)\
-static VALUE \
-gdkevent ## type ## _ ## name (VALUE self)\
-{\
- return GOBJ2RVAL(RVAL2GDKEVENT(self)->type.name);\
-}\
-static VALUE \
-gdkevent ## type ## _set_ ## name (VALUE self, VALUE val)\
-{\
- GdkEvent *event;\
- event = RVAL2GDKEVENT(self);\
- if (event->type.name)\
- g_object_unref(event->type.name);\
- event->type.name = RVAL2GOBJ(val);\
- if (event->type.name)\
- g_object_ref(event->type.name);\
- return self;\
-}
-
-#define ATTR_BOOL(type, name)\
-static VALUE \
-gdkevent ## type ## _ ## name (VALUE self)\
-{\
- return CBOOL2RVAL(RVAL2GDKEVENT(self)->type.name);\
-}\
-static VALUE \
-gdkevent ## type ## _set_ ## name (VALUE self, VALUE val)\
-{\
- RVAL2GDKEVENT(self)->type.name = RVAL2CBOOL(val);\
- return self;\
-}
-
-#define ATTR_ATOM(type, name)\
-static VALUE \
-gdkevent ## type ## _ ## name (VALUE self)\
-{\
- GdkAtom atom = RVAL2GDKEVENT(self)->type.name;\
- return GDKATOM2RVAL(atom);\
-}\
-static VALUE \
-gdkevent ## type ## _set_ ## name (VALUE self, VALUE val)\
-{\
- RVAL2GDKEVENT(self)->type.name = RVAL2ATOM(val);\
- return self;\
-}
-
-#define ATTR_FLAGS(type, name, gtype)\
-static VALUE \
-gdkevent ## type ## _ ## name (VALUE self)\
-{\
- return GFLAGS2RVAL(RVAL2GDKEVENT(self)->type.name, gtype);\
-}\
-static VALUE \
-gdkevent ## type ## _set_ ## name (VALUE self, VALUE val)\
-{\
- RVAL2GDKEVENT(self)->type.name = RVAL2GFLAGS(val, gtype);\
- return self;\
-}
-
-#define ATTR_ENUM(type, name, gtype)\
-static VALUE \
-gdkevent ## type ## _ ## name (VALUE self)\
-{\
- return GENUM2RVAL(RVAL2GDKEVENT(self)->type.name, gtype);\
-}\
-static VALUE \
-gdkevent ## type ## _set_ ## name (VALUE self, VALUE val)\
-{\
- RVAL2GDKEVENT(self)->type.name = RVAL2GENUM(val, gtype);\
- return self;\
-}
-
-#define ATTR_AXES(type, gdkklass) \
-static VALUE \
-gdkevent ##type ## _axes(VALUE self)\
-{\
- gdkklass type = RVAL2GDKEVENT(self)->type;\
- return type.axes ? rb_ary_new3(2, \
- rb_float_new(type.axes[0]),\
- rb_float_new(type.axes[1])) : Qnil;\
-} \
-static VALUE \
-gdkevent ## type ## _set_axes(VALUE self, VALUE x, VALUE y)\
-{\
- gdkklass val = RVAL2GDKEVENT(self)->type;\
- val.axes[0] = NUM2DBL(x);\
- val.axes[1] = NUM2DBL(y);\
- return self;\
-}
-
-#define DEFINE_ACCESSOR(event, type, name) \
- rbg_define_method(event, G_STRINGIFY(name), gdkevent ## type ## _## name, 0);\
- rbg_define_method(event, G_STRINGIFY(set_ ## name), gdkevent ## type ## _set_## name, 1);
-
-
-/* initialize */
-#define GDKEVENT_INIT(type, default_gtype) \
-static VALUE \
-gdkevent ## type ## _initialize(int argc, VALUE *argv, VALUE self)\
-{\
- VALUE type;\
- GdkEventType gtype;\
-\
- rb_scan_args(argc, argv, "01", &type);\
- if (NIL_P(type)){\
- gtype = default_gtype;\
- } else {\
- gtype = RVAL2GDKEVENTTYPE(type);\
- }\
-\
- G_INITIALIZE(self, gdk_event_new(gtype));\
- return Qnil;\
-}
-
-#define DEFINE_INIT(event, type) \
- rbg_define_method(event, "initialize", gdkevent ## type ## _initialize, -1);
-
-/***********************************************/
-
-/* GdkEvent Singleton Methods */
-static VALUE
-gdkevent_s_events_pending(G_GNUC_UNUSED VALUE self)
-{
- return CBOOL2RVAL(gdk_events_pending());
-}
-
-static VALUE
-gdkevent_s_peek(G_GNUC_UNUSED VALUE self)
-{
- return GDKEVENT2RVAL(gdk_event_peek());
-}
-
-static VALUE
-gdkevent_s_get(G_GNUC_UNUSED VALUE self)
-{
- return GDKEVENT2RVAL(gdk_event_get());
-}
-
-/* GdkEvent */
-static VALUE
-gdkevent_initialize(VALUE self, VALUE type)
-{
- GdkEventType event_type;
- VALUE klass;
-
- event_type = RVAL2GDKEVENTTYPE(type);
- klass = rb_gdk_event_type_to_class(event_type);
- if (!RVAL2CBOOL(rb_obj_is_kind_of(self, klass))) {
- rb_raise(rb_eArgError, "Wrong event type for this class.");
- }
-
- G_INITIALIZE(self, gdk_event_new(event_type));
- return Qnil;
-}
-
-static VALUE
-gdkevent_type(VALUE self)
-{
- return GDKEVENTTYPE2RVAL(RVAL2GDKEVENT(self)->type);
-}
-
-static VALUE
-gdkevent_put(VALUE self)
-{
- gdk_event_put(RVAL2GDKEVENT(self));
- return self;
-}
-
-/* We don't need this.
-gdk_event_get_time();
-gboolean gdk_event_get_state (GdkEvent *event,
- GdkModifierType *state);
-*/
-
-static VALUE
-gdkevent_get_axis(VALUE self, VALUE axis_use)
-{
- gdouble value;
- gboolean ret = gdk_event_get_axis(RVAL2GDKEVENT(self),
- RVAL2GDKAXISUSE(axis_use), &value);
- return ret ? rb_float_new(value) : Qnil;
-}
-
-static VALUE
-gdkevent_get_coords(VALUE self)
-{
- gdouble x_win, y_win;
- gboolean ret = gdk_event_get_coords(RVAL2GDKEVENT(self), &x_win, &y_win);
-
- return ret ? rb_ary_new3(2, rb_float_new(x_win), rb_float_new(y_win)) : Qnil;
-}
-
-static VALUE
-gdkevent_get_root_coords(VALUE self)
-{
- gdouble x_root, y_root;
- gboolean ret = gdk_event_get_root_coords(RVAL2GDKEVENT(self), &x_root, &y_root);
-
- return ret ? rb_ary_new3(2, rb_float_new(x_root), rb_float_new(y_root)) : Qnil;
-}
-
-static void
-handler_func(GdkEvent *event, gpointer func)
-{
- rb_funcall((VALUE)func, id_call, 1, GDKEVENT2RVAL(event));
-}
-
-static VALUE
-gdkevent_s_handler_set(VALUE self)
-{
- volatile VALUE func = rb_block_proc();
- G_RELATIVE(self, func);
-
- gdk_event_handler_set((GdkEventFunc)handler_func, (gpointer)func, NULL);
- return self;
-}
-
-static VALUE
-gdkevent_s_get_show_events(G_GNUC_UNUSED VALUE self)
-{
- return CBOOL2RVAL(gdk_get_show_events());
-}
-
-static VALUE
-gdkevent_s_set_show_events(VALUE self, VALUE show_events)
-{
- gdk_set_show_events(RVAL2CBOOL(show_events));
- return self;
-}
-
-static VALUE
-gdkevent_set_screen(VALUE self, VALUE screen)
-{
- gdk_event_set_screen(RVAL2GDKEVENT(self), RVAL2GDKSCREEN(screen));
- return self;
-}
-
-static VALUE
-gdkevent_screen(VALUE self)
-{
- return GOBJ2RVAL(gdk_event_get_screen(RVAL2GDKEVENT(self)));
-}
-
-/*
- type: String, Integer, Gdk::Color.
- */
-static VALUE
-gdkevent_s_setting_get(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
-{
- VALUE name, type;
- GType gtype;
- GValue val = G_VALUE_INIT;
- gboolean ret;
- VALUE value;
-
- rb_scan_args(argc, argv, "11", &name, &type);
- if (NIL_P(type))
- gtype = G_TYPE_STRING;
- else
- gtype = CLASS2GTYPE(type);
-
- g_value_init(&val, gtype);
- ret = gdk_setting_get(RVAL2CSTR(name), &val);
-
- value = ret ? GVAL2RVAL(&val) : Qnil;
- g_value_unset(&val);
- return value;
-}
-
-/* GdkEventAny */
-ATTR_GOBJ(any, window);
-ATTR_BOOL(any, send_event);
-
-/* GdkEventKey */
-ATTR_UINT(key, time);
-ATTR_FLAGS(key, state, GDK_TYPE_MODIFIER_TYPE);
-ATTR_INT(key, keyval);
-ATTR_UINT(key, hardware_keycode);
-ATTR_UINT(key, group);
-
-/* GdkEventButton */
-ATTR_UINT(button, time);
-ATTR_FLOAT(button, x);
-ATTR_FLOAT(button, y);
-ATTR_AXES(button, GdkEventButton);
-ATTR_INT(button, button);
-ATTR_FLAGS(button, state, GDK_TYPE_MODIFIER_TYPE);
-ATTR_GOBJ(button, device);
-ATTR_FLOAT(button, x_root);
-ATTR_FLOAT(button, y_root);
-
-/* GdkEventTouch */
-ATTR_UINT(touch, time);
-ATTR_FLOAT(touch, x);
-ATTR_FLOAT(touch, y);
-ATTR_AXES(touch, GdkEventTouch);
-ATTR_FLAGS(touch, state, GDK_TYPE_MODIFIER_TYPE);
-ATTR_BOOL(touch, emulating_pointer);
-ATTR_GOBJ(touch, device);
-ATTR_FLOAT(touch, x_root);
-ATTR_FLOAT(touch, y_root);
-
-/* GdkEventScroll */
-ATTR_UINT(scroll, time);
-ATTR_FLOAT(scroll, x);
-ATTR_FLOAT(scroll, y);
-ATTR_FLAGS(scroll, state, GDK_TYPE_MODIFIER_TYPE);
-ATTR_ENUM(scroll, direction, GDK_TYPE_SCROLL_DIRECTION);
-ATTR_GOBJ(scroll, device);
-ATTR_FLOAT(scroll, x_root);
-ATTR_FLOAT(scroll, y_root);
-GDKEVENT_INIT(scroll, GDK_SCROLL);
-
-/* GdkEventMotion */
-ATTR_UINT(motion, time);
-ATTR_FLOAT(motion, x);
-ATTR_FLOAT(motion, y);
-ATTR_AXES(motion, GdkEventMotion);
-ATTR_FLOAT(motion, x_root);
-ATTR_FLOAT(motion, y_root);
-ATTR_FLAGS(motion, state, GDK_TYPE_MODIFIER_TYPE);
-ATTR_BOOL(motion, is_hint);
-ATTR_GOBJ(motion, device);
-GDKEVENT_INIT(motion, GDK_MOTION_NOTIFY);
-
-static VALUE
-gdkeventmotion_request_motions(VALUE self)
-{
- gdk_event_request_motions(&(RVAL2GDKEVENT(self)->motion));
- return self;
-}
-
-/* GdkEventExpose */
-static VALUE
-gdkeventexpose_area(VALUE self)
-{
- return GDKRECTANGLE2RVAL(&RVAL2GDKEVENT(self)->expose.area);
-}
-
-static VALUE
-gdkeventexpose_set_area(VALUE self, VALUE rect)
-{
- GdkRectangle* grect = RVAL2GDKRECTANGLE(rect);
- GdkEventExpose *event = &(RVAL2GDKEVENT(self)->expose);
- event->area.x = grect->x;
- event->area.y = grect->y;
- event->area.width = grect->width;
- event->area.height = grect->height;
- return self;
-}
-
-static VALUE
-gdkeventexpose_region(VALUE self)
-{
- return CRREGION2RVAL(RVAL2GDKEVENT(self)->expose.region);
-}
-
-static VALUE
-gdkeventexpose_set_region(VALUE self, VALUE region)
-{
- RVAL2GDKEVENT(self)->expose.region = RVAL2CRREGION(region);
- return self;
-}
-
-ATTR_INT(expose, count);
-GDKEVENT_INIT(expose, GDK_EXPOSE);
-
-/* GdkEventVisibility */
-ATTR_ENUM(visibility, state, GDK_TYPE_VISIBILITY_STATE);
-GDKEVENT_INIT(visibility, GDK_VISIBILITY_NOTIFY);
-
-/* GdkEventCrossing */
-ATTR_GOBJ(crossing, subwindow);
-ATTR_UINT(crossing, time);
-ATTR_INT(crossing, x);
-ATTR_INT(crossing, y);
-ATTR_FLOAT(crossing, x_root);
-ATTR_FLOAT(crossing, y_root);
-ATTR_ENUM(crossing, mode, GDK_TYPE_CROSSING_MODE);
-ATTR_ENUM(crossing, detail, GDK_TYPE_NOTIFY_TYPE);
-ATTR_BOOL(crossing, focus);
-ATTR_FLAGS(crossing, state, GDK_TYPE_MODIFIER_TYPE);
-
-/* GdkEventFocus */
-ATTR_BOOL(focus_change, in);
-GDKEVENT_INIT(focus_change, GDK_FOCUS_CHANGE);
-
-/* GdkEventConfigure */
-ATTR_INT(configure, x);
-ATTR_INT(configure, y);
-ATTR_INT(configure, width);
-ATTR_INT(configure, height);
-GDKEVENT_INIT(configure, GDK_CONFIGURE);
-
-/* GdkEventProperty */
-ATTR_ATOM(property, atom);
-ATTR_UINT(property, time);
-ATTR_ENUM(property, state, GDK_TYPE_PROPERTY_STATE);
-GDKEVENT_INIT(property, GDK_PROPERTY_NOTIFY);
-
-/* GdkEventSelection */
-ATTR_ATOM(selection, selection);
-ATTR_ATOM(selection, target);
-ATTR_ATOM(selection, property);
-ATTR_GDKWINDOW(selection, requestor);
-ATTR_INT(selection, time);
-
-/* GdkEventDND */
-ATTR_GOBJ(dnd, context);
-ATTR_UINT(dnd, time);
-ATTR_INT(dnd, x_root);
-ATTR_INT(dnd, y_root);
-
-/* GdkEventProximity */
-ATTR_UINT(proximity, time);
-ATTR_GOBJ(proximity, device);
-
-/* GdkEventWindowState */
-ATTR_FLAGS(window_state, changed_mask, GDK_TYPE_WINDOW_STATE);
-ATTR_FLAGS(window_state, new_window_state, GDK_TYPE_WINDOW_STATE);
-GDKEVENT_INIT(window_state, GDK_WINDOW_STATE);
-
-/* GdkEventSetting */
-ATTR_ENUM(setting, action, GDK_TYPE_SETTING_ACTION);
-ATTR_STR(setting, name);
-GDKEVENT_INIT(setting, GDK_SETTING);
-
-/* GdkEventOwnerChange */
-ATTR_GDKWINDOW(owner_change, owner);
-ATTR_ENUM(owner_change, reason, GDK_TYPE_OWNER_CHANGE);
-ATTR_ATOM(owner_change, selection);
-ATTR_UINT(owner_change, time);
-ATTR_UINT(owner_change, selection_time);
-GDKEVENT_INIT(owner_change, GDK_OWNER_CHANGE);
-
-/* GdkEventGrabBroken */
-ATTR_BOOL(grab_broken, keyboard);
-ATTR_BOOL(grab_broken, implicit);
-ATTR_GOBJ(grab_broken, grab_window);
-GDKEVENT_INIT(grab_broken, GDK_GRAB_BROKEN);
-
-/* MISC */
-static VALUE
-gdkevent_g2r(const GValue *values)
-{
- return GDKEVENT2RVAL(g_value_get_boxed(&values[0]));
-}
-
-void
-Init_gdk_event(VALUE mGdk)
-{
- /* GdkEvent */
- rb_cGdkEvent = G_DEF_CLASS(GDK_TYPE_EVENT, "Event", mGdk);
- rbg_define_method(rb_cGdkEvent, "initialize", gdkevent_initialize, 1);
- rbg_define_method(rb_cGdkEvent, "event_type", gdkevent_type, 0);
-
- rbg_define_singleton_method(rb_cGdkEvent, "events_pending?", gdkevent_s_events_pending, 0);
- rbg_define_singleton_method(rb_cGdkEvent, "peek", gdkevent_s_peek, 0);
- rbg_define_singleton_method(rb_cGdkEvent, "get", gdkevent_s_get, 0);
- rbg_define_method(rb_cGdkEvent, "put", gdkevent_put, 0);
- rbg_define_method(rb_cGdkEvent, "get_axis", gdkevent_get_axis, 1);
- rbg_define_method(rb_cGdkEvent, "coords", gdkevent_get_coords, 0);
- rbg_define_method(rb_cGdkEvent, "root_coords", gdkevent_get_root_coords, 0);
-
- rbg_define_singleton_method(rb_cGdkEvent, "handler_set", gdkevent_s_handler_set, 0);
- rbg_define_singleton_method(rb_cGdkEvent, "show_events?", gdkevent_s_get_show_events, 0);
- rbg_define_singleton_method(rb_cGdkEvent, "set_show_events", gdkevent_s_set_show_events, 1);
- rbg_define_singleton_method(rb_cGdkEvent, "setting_get", gdkevent_s_setting_get, -1);
- rbg_define_method(rb_cGdkEvent, "screen", gdkevent_screen, 0);
- rbg_define_method(rb_cGdkEvent, "set_screen", gdkevent_set_screen, 1);
-
- /* GdkEventAny's fields */
- DEFINE_ACCESSOR(rb_cGdkEvent, any, window);
- rbg_define_method(rb_cGdkEvent, "send_event?", gdkeventany_send_event, 0);
- rbg_define_method(rb_cGdkEvent, "set_send_event", gdkeventany_set_send_event, 1);
-
- /*
- * GdkEvent's Constants
- */
- rb_define_const(rb_cGdkEvent, "CURRENT_TIME", INT2FIX(GDK_CURRENT_TIME));
- rb_define_const(rb_cGdkEvent, "PROPAGATE", CBOOL2RVAL(GDK_EVENT_PROPAGATE));
- rb_define_const(rb_cGdkEvent, "STOP", CBOOL2RVAL(GDK_EVENT_STOP));
- rb_define_const(rb_cGdkEvent, "PRIORITY_EVENTS", INT2FIX(GDK_PRIORITY_EVENTS));
- rb_define_const(rb_cGdkEvent, "PRIORITY_REDRAW", INT2FIX(GDK_PRIORITY_REDRAW));
-
- /* GdkEventType */
- /* XXX */
- G_RENAME_CONSTANT("2BUTTON_PRESS","BUTTON2_PRESS");
- G_RENAME_CONSTANT("3BUTTON_PRESS","BUTTON3_PRESS");
- G_DEF_CLASS(GDK_TYPE_EVENT_TYPE, "Type", rb_cGdkEvent);
- G_RENAME_CONSTANT("2BUTTON_PRESS","BUTTON2_PRESS");
- G_RENAME_CONSTANT("3BUTTON_PRESS","BUTTON3_PRESS");
- G_DEF_CONSTANTS(rb_cGdkEvent, GDK_TYPE_EVENT_TYPE, "GDK_");
-
- /* GdkEventMask */
- G_DEF_CLASS(GDK_TYPE_EVENT_MASK, "Mask", rb_cGdkEvent);
- G_DEF_CONSTANTS(rb_cGdkEvent, GDK_TYPE_EVENT_MASK, "GDK_");
-
- /* GdkEventAny */
- rb_cGdkEventAny =
- G_DEF_CLASS_WITH_PARENT(GDK_TYPE_EVENT_ANY, "EventAny",
- mGdk, rb_cGdkEvent);
-
- /* GdkEventExpose */
- rb_cGdkEventExpose =
- G_DEF_CLASS_WITH_PARENT(GDK_TYPE_EVENT_EXPOSE, "EventExpose",
- mGdk, rb_cGdkEvent);
- DEFINE_ACCESSOR(rb_cGdkEventExpose, expose, area);
- DEFINE_ACCESSOR(rb_cGdkEventExpose, expose, region);
- DEFINE_ACCESSOR(rb_cGdkEventExpose, expose, count);
- DEFINE_INIT(rb_cGdkEventExpose, expose);
-
- /* GdkEventVisibility */
- rb_cGdkEventVisibility =
- G_DEF_CLASS_WITH_PARENT(GDK_TYPE_EVENT_VISIBILITY, "EventVisibility",
- mGdk, rb_cGdkEvent);
- DEFINE_ACCESSOR(rb_cGdkEventVisibility, visibility, state);
- DEFINE_INIT(rb_cGdkEventVisibility, visibility);
-
- /* GdkVisibilityState */
- G_DEF_CLASS(GDK_TYPE_VISIBILITY_STATE, "State", rb_cGdkEventVisibility);
- G_DEF_CONSTANTS(rb_cGdkEventVisibility,
- GDK_TYPE_VISIBILITY_STATE, "GDK_VISIBILITY_");
-
- /* GdkEventMotion */
- rb_cGdkEventMotion =
- G_DEF_CLASS_WITH_PARENT(GDK_TYPE_EVENT_MOTION, "EventMotion",
- mGdk, rb_cGdkEvent);
- DEFINE_ACCESSOR(rb_cGdkEventMotion, motion, time);
- DEFINE_ACCESSOR(rb_cGdkEventMotion, motion, x);
- DEFINE_ACCESSOR(rb_cGdkEventMotion, motion, y);
- rbg_define_method(rb_cGdkEventMotion, "axes", gdkeventmotion_axes, 0);
- rbg_define_method(rb_cGdkEventMotion, "set_axes", gdkeventmotion_set_axes, 1);
- DEFINE_ACCESSOR(rb_cGdkEventMotion, motion, state);
- rbg_define_method(rb_cGdkEventMotion, "hint?", gdkeventmotion_is_hint, 0);
- rbg_define_method(rb_cGdkEventMotion, "set_hint", gdkeventmotion_set_is_hint, 1);
- DEFINE_ACCESSOR(rb_cGdkEventMotion, motion, device);
- DEFINE_ACCESSOR(rb_cGdkEventMotion, motion, x_root);
- DEFINE_ACCESSOR(rb_cGdkEventMotion, motion, y_root);
- DEFINE_INIT(rb_cGdkEventMotion, motion);
- rbg_define_method(rb_cGdkEventMotion, "request", gdkeventmotion_request_motions, 0);
-
- /* GdkEventButton */
- rb_cGdkEventButton =
- G_DEF_CLASS_WITH_PARENT(GDK_TYPE_EVENT_BUTTON, "EventButton",
- mGdk, rb_cGdkEvent);
- DEFINE_ACCESSOR(rb_cGdkEventButton, button, time);
- DEFINE_ACCESSOR(rb_cGdkEventButton, button, x);
- DEFINE_ACCESSOR(rb_cGdkEventButton, button, y);
- rbg_define_method(rb_cGdkEventButton, "axes", gdkeventbutton_axes, 0);
- rbg_define_method(rb_cGdkEventButton, "set_axes", gdkeventbutton_set_axes, 2);
- DEFINE_ACCESSOR(rb_cGdkEventButton, button, state);
- DEFINE_ACCESSOR(rb_cGdkEventButton, button, button);
- DEFINE_ACCESSOR(rb_cGdkEventButton, button, device);
- DEFINE_ACCESSOR(rb_cGdkEventButton, button, x_root);
- DEFINE_ACCESSOR(rb_cGdkEventButton, button, y_root);
-
- /* GdkEventTouch */
- rb_cGdkEventTouch =
- G_DEF_CLASS_WITH_PARENT(GDK_TYPE_EVENT_TOUCH, "EventTouch",
- mGdk, rb_cGdkEvent);
- DEFINE_ACCESSOR(rb_cGdkEventTouch, touch, time);
- DEFINE_ACCESSOR(rb_cGdkEventTouch, touch, x);
- DEFINE_ACCESSOR(rb_cGdkEventTouch, touch, y);
- rbg_define_method(rb_cGdkEventTouch, "axes", gdkeventtouch_axes, 0);
- rbg_define_method(rb_cGdkEventTouch, "set_axes", gdkeventtouch_set_axes, 2);
- DEFINE_ACCESSOR(rb_cGdkEventTouch, touch, state);
- DEFINE_ACCESSOR(rb_cGdkEventTouch, touch, emulating_pointer);
- DEFINE_ACCESSOR(rb_cGdkEventTouch, touch, device);
- DEFINE_ACCESSOR(rb_cGdkEventTouch, touch, x_root);
- DEFINE_ACCESSOR(rb_cGdkEventTouch, touch, y_root);
-
- /* GdkEventScroll */
- rb_cGdkEventScroll =
- G_DEF_CLASS_WITH_PARENT(GDK_TYPE_EVENT_SCROLL, "EventScroll",
- mGdk, rb_cGdkEvent);
- DEFINE_ACCESSOR(rb_cGdkEventScroll, scroll, time);
- DEFINE_ACCESSOR(rb_cGdkEventScroll, scroll, x);
- DEFINE_ACCESSOR(rb_cGdkEventScroll, scroll, y);
- DEFINE_ACCESSOR(rb_cGdkEventScroll, scroll, state);
- DEFINE_ACCESSOR(rb_cGdkEventScroll, scroll, direction);
- DEFINE_ACCESSOR(rb_cGdkEventScroll, scroll, device);
- DEFINE_ACCESSOR(rb_cGdkEventScroll, scroll, x_root);
- DEFINE_ACCESSOR(rb_cGdkEventScroll, scroll, y_root);
- DEFINE_INIT(rb_cGdkEventScroll, scroll);
-
- /* GdkScrollDirection */
- G_DEF_CLASS(GDK_TYPE_SCROLL_DIRECTION, "Direction", rb_cGdkEventScroll);
- G_DEF_CONSTANTS(rb_cGdkEventScroll,
- GDK_TYPE_SCROLL_DIRECTION, "GDK_SCROLL_");
-
- /* GdkEventKey */
- rb_cGdkEventKey =
- G_DEF_CLASS_WITH_PARENT(GDK_TYPE_EVENT_KEY, "EventKey",
- mGdk, rb_cGdkEvent);
- DEFINE_ACCESSOR(rb_cGdkEventKey, key, time);
- DEFINE_ACCESSOR(rb_cGdkEventKey, key, state);
- DEFINE_ACCESSOR(rb_cGdkEventKey, key, keyval);
- DEFINE_ACCESSOR(rb_cGdkEventKey, key, hardware_keycode);
- DEFINE_ACCESSOR(rb_cGdkEventKey, key, group);
-
- /* GdkEventCrossing */
- rb_cGdkEventCrossing =
- G_DEF_CLASS_WITH_PARENT(GDK_TYPE_EVENT_CROSSING, "EventCrossing",
- mGdk, rb_cGdkEvent);
- DEFINE_ACCESSOR(rb_cGdkEventCrossing, crossing, subwindow);
- DEFINE_ACCESSOR(rb_cGdkEventCrossing, crossing, time);
- DEFINE_ACCESSOR(rb_cGdkEventCrossing, crossing, x);
- DEFINE_ACCESSOR(rb_cGdkEventCrossing, crossing, y);
- DEFINE_ACCESSOR(rb_cGdkEventCrossing, crossing, x_root);
- DEFINE_ACCESSOR(rb_cGdkEventCrossing, crossing, y_root);
- DEFINE_ACCESSOR(rb_cGdkEventCrossing, crossing, mode);
- DEFINE_ACCESSOR(rb_cGdkEventCrossing, crossing, detail);
- rbg_define_method(rb_cGdkEventCrossing, "focus?", gdkeventcrossing_focus, 0);
- rbg_define_method(rb_cGdkEventCrossing, "set_focus", gdkeventcrossing_set_focus, 1);
- DEFINE_ACCESSOR(rb_cGdkEventCrossing, crossing, state);
-
- /* GdkCrossingMode */
- G_DEF_CLASS(GDK_TYPE_CROSSING_MODE, "Mode", rb_cGdkEventCrossing);
- G_DEF_CONSTANTS(rb_cGdkEventCrossing,
- GDK_TYPE_CROSSING_MODE, "GDK_CROSSING_");
- /* GdkNotifyType */
- G_DEF_CLASS(GDK_TYPE_NOTIFY_TYPE, "NotifyType", rb_cGdkEventScroll);
- G_DEF_CONSTANTS(rb_cGdkEventScroll, GDK_TYPE_NOTIFY_TYPE, "GDK_");
-
- /* GdkEventFocus */
- rb_cGdkEventFocus =
- G_DEF_CLASS_WITH_PARENT(GDK_TYPE_EVENT_FOCUS, "EventFocus",
- mGdk, rb_cGdkEvent);
- rbg_define_method(rb_cGdkEventFocus, "in?", gdkeventfocus_change_in, 0);
- rbg_define_method(rb_cGdkEventFocus, "set_in",
- gdkeventfocus_change_set_in, 1);
- DEFINE_INIT(rb_cGdkEventFocus, focus_change);
-
- /* GdkEventConfigure */
- rb_cGdkEventConfigure =
- G_DEF_CLASS_WITH_PARENT(GDK_TYPE_EVENT_CONFIGURE, "EventConfigure",
- mGdk, rb_cGdkEvent);
- DEFINE_ACCESSOR(rb_cGdkEventConfigure, configure, x);
- DEFINE_ACCESSOR(rb_cGdkEventConfigure, configure, y);
- DEFINE_ACCESSOR(rb_cGdkEventConfigure, configure, width);
- DEFINE_ACCESSOR(rb_cGdkEventConfigure, configure, height);
- DEFINE_INIT(rb_cGdkEventConfigure, configure);
-
- /* GdkEventProperty */
- rb_cGdkEventProperty =
- G_DEF_CLASS_WITH_PARENT(GDK_TYPE_EVENT_PROPERTY, "EventProperty",
- mGdk, rb_cGdkEvent);
- DEFINE_ACCESSOR(rb_cGdkEventProperty, property, atom);
- DEFINE_ACCESSOR(rb_cGdkEventProperty, property, time);
- DEFINE_ACCESSOR(rb_cGdkEventProperty, property, state);
- DEFINE_INIT(rb_cGdkEventProperty, property);
-
- /* GdkPropertyState */
- G_DEF_CLASS(GDK_TYPE_PROPERTY_STATE, "State", rb_cGdkEventProperty);
- G_DEF_CONSTANTS(rb_cGdkEventProperty, GDK_TYPE_PROPERTY_STATE, "GDK_");
-
- /* GdkEventSelection */
- rb_cGdkEventSelection =
- G_DEF_CLASS_WITH_PARENT(GDK_TYPE_EVENT_SELECTION, "EventSelection",
- mGdk, rb_cGdkEvent);
- DEFINE_ACCESSOR(rb_cGdkEventSelection, selection, selection);
- DEFINE_ACCESSOR(rb_cGdkEventSelection, selection, target);
- DEFINE_ACCESSOR(rb_cGdkEventSelection, selection, property);
- DEFINE_ACCESSOR(rb_cGdkEventSelection, selection, requestor);
- DEFINE_ACCESSOR(rb_cGdkEventSelection, selection, time);
-
- /* GdkEventOwnerChange */
- rb_cGdkEventOwnerChange =
- G_DEF_CLASS_WITH_PARENT(GDK_TYPE_EVENT_OWNER_CHANGE, "EventOwnerChange",
- mGdk, rb_cGdkEvent);
- DEFINE_ACCESSOR(rb_cGdkEventOwnerChange, owner_change, owner);
- DEFINE_ACCESSOR(rb_cGdkEventOwnerChange, owner_change, reason);
- DEFINE_ACCESSOR(rb_cGdkEventOwnerChange, owner_change, selection);
- DEFINE_ACCESSOR(rb_cGdkEventOwnerChange, owner_change, time);
- DEFINE_ACCESSOR(rb_cGdkEventOwnerChange, owner_change, selection_time);
- DEFINE_INIT(rb_cGdkEventOwnerChange, owner_change);
-
- /* GdkOwnerChange */
- G_DEF_CLASS(GDK_TYPE_OWNER_CHANGE, "OwnerChange", rb_cGdkEventScroll);
- G_DEF_CONSTANTS(rb_cGdkEventScroll,
- GDK_TYPE_OWNER_CHANGE, "GDK_OWNER_CHANGE_");
-
- /* GdkEventProximity */
- rb_cGdkEventProximity =
- G_DEF_CLASS_WITH_PARENT(GDK_TYPE_EVENT_PROXIMITY, "EventProximity",
- mGdk, rb_cGdkEvent);
- DEFINE_ACCESSOR(rb_cGdkEventProximity, proximity, time);
- DEFINE_ACCESSOR(rb_cGdkEventProximity, proximity, device);
-
- /* GdkEventDND */
- rb_cGdkEventDND =
- G_DEF_CLASS_WITH_PARENT(GDK_TYPE_EVENT_DND, "EventDND",
- mGdk, rb_cGdkEvent);
- DEFINE_ACCESSOR(rb_cGdkEventDND, dnd, context);
- DEFINE_ACCESSOR(rb_cGdkEventDND, dnd, time);
- DEFINE_ACCESSOR(rb_cGdkEventDND, dnd, x_root);
- DEFINE_ACCESSOR(rb_cGdkEventDND, dnd, y_root);
-
- /* GdkEventWindowState */
- rb_cGdkEventWindowState =
- G_DEF_CLASS_WITH_PARENT(GDK_TYPE_EVENT_WINDOW_STATE, "EventWindowState",
- mGdk, rb_cGdkEvent);
- DEFINE_ACCESSOR(rb_cGdkEventWindowState, window_state, changed_mask);
- DEFINE_ACCESSOR(rb_cGdkEventWindowState, window_state, new_window_state);
- DEFINE_INIT(rb_cGdkEventWindowState, window_state);
-
- /* GdkWindowState */
- G_DEF_CLASS(GDK_TYPE_WINDOW_STATE, "WindowState", rb_cGdkEventScroll);
- G_DEF_CONSTANTS(rb_cGdkEventWindowState,
- GDK_TYPE_WINDOW_STATE, "GDK_WINDOW_STATE_");
-
- /* GdkEventSetting */
- rb_cGdkEventSetting =
- G_DEF_CLASS_WITH_PARENT(GDK_TYPE_EVENT_SETTING, "EventSetting",
- mGdk, rb_cGdkEvent);
- DEFINE_ACCESSOR(rb_cGdkEventSetting, setting, action);
- DEFINE_ACCESSOR(rb_cGdkEventSetting, setting, name);
- DEFINE_INIT(rb_cGdkEventSetting, setting);
-
- /* GdkSettingAction */
- G_DEF_CLASS(GDK_TYPE_SETTING_ACTION, "Action", rb_cGdkEventScroll);
- G_DEF_CONSTANTS(rb_cGdkEventSetting,
- GDK_TYPE_SETTING_ACTION, "GDK_SETTING_");
-
- /* GdkEventGrabBroken */
- rb_cGdkEventGrabBroken =
- G_DEF_CLASS_WITH_PARENT(GDK_TYPE_EVENT_GRAB_BROKEN, "EventGrabBroken",
- mGdk, rb_cGdkEvent);
- rbg_define_method(rb_cGdkEventGrabBroken,
- "keyboard?", gdkeventgrab_broken_keyboard, 0);
- rbg_define_method(rb_cGdkEventGrabBroken,
- "set_keyboard", gdkeventgrab_broken_set_keyboard, 1);
- rbg_define_method(rb_cGdkEventGrabBroken,
- "implicit?", gdkeventgrab_broken_implicit, 0);
- rbg_define_method(rb_cGdkEventGrabBroken,
- "set_implicit", gdkeventgrab_broken_set_implicit, 1);
- DEFINE_ACCESSOR(rb_cGdkEventGrabBroken, grab_broken, grab_window);
- DEFINE_INIT(rb_cGdkEventGrabBroken, grab_broken);
-
- rbgobj_register_g2r_func(GDK_TYPE_EVENT, &gdkevent_g2r);
-}
diff --git a/gdk3/ext/gdk3/rbgdkgeometry.c b/gdk3/ext/gdk3/rbgdkgeometry.c
deleted file mode 100644
index 9c3e51f..0000000
--- a/gdk3/ext/gdk3/rbgdkgeometry.c
+++ /dev/null
@@ -1,253 +0,0 @@
-/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
-/*
- * Copyright (C) 2011 Ruby-GNOME2 Project Team
- * Copyright (C) 2002,2003 Masao Mutoh
- * Copyright (C) 1998-2000 Yukihiro Matsumoto,
- * Daisuke Kanda,
- * Hiroshi Igarashi
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- */
-
-#include "rbgdk3private.h"
-
-/*****************************************/
-static GdkGeometry*
-geo_copy(const GdkGeometry* geo)
-{
- GdkGeometry* new_geo;
- g_return_val_if_fail (geo != NULL, NULL);
- new_geo = g_new(GdkGeometry, 1);
- *new_geo = *geo;
- return new_geo;
-}
-
-GType
-gdk_geometry_get_type(void)
-{
- static GType our_type = 0;
- if (our_type == 0)
- our_type = g_boxed_type_register_static ("GdkGeometry",
- (GBoxedCopyFunc)geo_copy,
- (GBoxedFreeFunc)g_free);
- return our_type;
-}
-/*****************************************/
-
-#define RG_TARGET_NAMESPACE cGeometry
-#define _SELF(g) (RVAL2GDKGEOMETRY(g))
-
-static VALUE
-rg_initialize(VALUE self)
-{
- GdkGeometry geometry;
- memset(&geometry, 0, sizeof(GdkGeometry));
- G_INITIALIZE(self, g_boxed_copy(GDK_TYPE_GEOMETRY, &geometry));
- return Qnil;
-}
-
-static VALUE
-rg_set(VALUE self, VALUE min_width, VALUE min_height, VALUE max_width, VALUE max_height, VALUE base_width, VALUE base_height, VALUE width_inc, VALUE height_inc, VALUE min_aspect, VALUE max_aspect, VALUE gravity)
-{
- GdkGeometry *geo = _SELF(self);
- geo->min_width = NUM2INT(min_width);
- geo->min_height = NUM2INT(min_height);
- geo->max_width = NUM2INT(max_width);
- geo->max_height = NUM2INT(max_height);
- geo->base_width = NUM2INT(base_width);
- geo->base_height = NUM2INT(base_height);
- geo->width_inc = NUM2INT(width_inc);
- geo->height_inc = NUM2INT(height_inc);
- geo->min_aspect = NUM2DBL(min_aspect);
- geo->max_aspect = NUM2DBL(max_aspect);
- geo->win_gravity = RVAL2GDKGRAVITY(gravity);
-
- return self;
-}
-
-static VALUE
-rg_min_width(VALUE self)
-{
- return INT2NUM(_SELF(self)->min_width);
-}
-
-static VALUE
-rg_min_height(VALUE self)
-{
- return INT2NUM(_SELF(self)->min_height);
-}
-
-static VALUE
-rg_max_width(VALUE self)
-{
- return INT2NUM(_SELF(self)->max_width);
-}
-
-static VALUE
-rg_max_height(VALUE self)
-{
- return INT2NUM(_SELF(self)->max_height);
-}
-
-static VALUE
-rg_base_width(VALUE self)
-{
- return INT2NUM(_SELF(self)->base_width);
-}
-
-static VALUE
-rg_base_height(VALUE self)
-{
- return INT2NUM(_SELF(self)->base_height);
-}
-
-static VALUE
-rg_width_inc(VALUE self)
-{
- return INT2NUM(_SELF(self)->width_inc);
-}
-
-static VALUE
-rg_height_inc(VALUE self)
-{
- return INT2NUM(_SELF(self)->height_inc);
-}
-
-static VALUE
-rg_min_aspect(VALUE self)
-{
- return rb_float_new(_SELF(self)->min_aspect);
-}
-
-static VALUE
-rg_max_aspect(VALUE self)
-{
- return rb_float_new(_SELF(self)->max_aspect);
-}
-
-static VALUE
-rg_win_gravity(VALUE self)
-{
- return GDKGRAVITY2RVAL(_SELF(self)->win_gravity);
-}
-
-static VALUE
-rg_set_min_width(VALUE self, VALUE min_width)
-{
- _SELF(self)->min_width = NUM2INT(min_width);
- return self;
-}
-
-static VALUE
-rg_set_min_height(VALUE self, VALUE min_height)
-{
- _SELF(self)->min_height = NUM2INT(min_height);
- return self;
-}
-
-static VALUE
-rg_set_max_width(VALUE self, VALUE max_width)
-{
- _SELF(self)->max_width = NUM2INT(max_width);
- return self;
-}
-
-static VALUE
-rg_set_max_height(VALUE self, VALUE max_height)
-{
- _SELF(self)->max_height = NUM2INT(max_height);
- return self;
-}
-
-static VALUE
-rg_set_base_width(VALUE self, VALUE base_width)
-{
- _SELF(self)->base_width = NUM2INT(base_width);
- return self;
-}
-
-static VALUE
-rg_set_base_height(VALUE self, VALUE base_height)
-{
- _SELF(self)->base_height = NUM2INT(base_height);
- return self;
-}
-
-static VALUE
-rg_set_width_inc(VALUE self, VALUE width_inc)
-{
- _SELF(self)->width_inc = NUM2INT(width_inc);
- return self;
-}
-
-static VALUE
-rg_set_height_inc(VALUE self, VALUE height_inc)
-{
- _SELF(self)->height_inc = NUM2INT(height_inc);
- return self;
-}
-
-static VALUE
-rg_set_min_aspect(VALUE self, VALUE min_aspect)
-{
- _SELF(self)->min_aspect = NUM2DBL(min_aspect);
- return self;
-}
-
-static VALUE
-rg_set_max_aspect(VALUE self, VALUE max_aspect)
-{
- _SELF(self)->max_aspect = NUM2DBL(max_aspect);
- return self;
-}
-
-static VALUE
-rg_set_win_gravity(VALUE self, VALUE gravity)
-{
- _SELF(self)->win_gravity = RVAL2GDKGRAVITY(gravity);
- return self;
-}
-
-void
-Init_gdk_geometry(VALUE mGdk)
-{
- VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GDK_TYPE_GEOMETRY, "Geometry", mGdk);
-
- RG_DEF_METHOD(initialize, 0);
- RG_DEF_METHOD(min_width, 0);
- RG_DEF_METHOD(min_height, 0);
- RG_DEF_METHOD(max_width, 0);
- RG_DEF_METHOD(max_height, 0);
- RG_DEF_METHOD(base_width, 0);
- RG_DEF_METHOD(base_height, 0);
- RG_DEF_METHOD(width_inc, 0);
- RG_DEF_METHOD(height_inc, 0);
- RG_DEF_METHOD(min_aspect, 0);
- RG_DEF_METHOD(max_aspect, 0);
- RG_DEF_METHOD(win_gravity, 0);
- RG_DEF_METHOD(set, 11);
- RG_DEF_METHOD(set_min_width, 1);
- RG_DEF_METHOD(set_min_height, 1);
- RG_DEF_METHOD(set_max_width, 1);
- RG_DEF_METHOD(set_max_height, 1);
- RG_DEF_METHOD(set_base_width, 1);
- RG_DEF_METHOD(set_base_height, 1);
- RG_DEF_METHOD(set_width_inc, 1);
- RG_DEF_METHOD(set_height_inc, 1);
- RG_DEF_METHOD(set_min_aspect, 1);
- RG_DEF_METHOD(set_max_aspect, 1);
- RG_DEF_METHOD(set_win_gravity, 1);
-}
diff --git a/gdk3/ext/gdk3/rbgdkkeymap.c b/gdk3/ext/gdk3/rbgdkkeymap.c
deleted file mode 100644
index 4b698f3..0000000
--- a/gdk3/ext/gdk3/rbgdkkeymap.c
+++ /dev/null
@@ -1,151 +0,0 @@
-/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
-/*
- * Copyright (C) 2011 Ruby-GNOME2 Project Team
- * Copyright (C) 2003,2004 Masao Mutoh
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- */
-
-#include "rbgdk3private.h"
-
-#define RG_TARGET_NAMESPACE cKeymap
-#define _SELF(s) RVAL2GDKKEYMAP(s)
-
-static VALUE
-rg_s_default(G_GNUC_UNUSED VALUE self)
-{
- return GOBJ2RVAL(gdk_keymap_get_default());
-}
-
-static VALUE
-rg_s_for_display(G_GNUC_UNUSED VALUE self, VALUE display)
-{
- return GOBJ2RVAL(gdk_keymap_get_for_display(RVAL2GDKDISPLAYOBJECT(display)));
-}
-
-static VALUE
-rg_lookup_key(VALUE self, VALUE keycode, VALUE group, VALUE level)
-{
- GdkKeymapKey key;
-
- key.keycode = NUM2UINT(keycode);
- key.group = NUM2INT(group);
- key.level = NUM2INT(level);
-
- return INT2NUM(gdk_keymap_lookup_key(_SELF(self), &key));
-}
-
-static VALUE
-rg_translate_keyboard_state(VALUE self, VALUE hardware_keycode, VALUE state, VALUE group)
-{
- guint keyval;
- gint effective_group, level;
- GdkModifierType consumed_modifiers;
- gboolean ret;
-
- ret = gdk_keymap_translate_keyboard_state(_SELF(self),
- NUM2UINT(hardware_keycode),
- RVAL2GDKMODIFIERTYPE(state),
- NUM2INT(group),
- &keyval, &effective_group,
- &level, &consumed_modifiers);
- return ret ? rb_ary_new3(4, UINT2NUM(keyval), INT2NUM(effective_group),
- INT2NUM(level),
- GDKMODIFIERTYPE2RVAL(consumed_modifiers)) : Qnil;
-}
-
-static VALUE
-rg_get_entries_for_keyval(VALUE self, VALUE keyval)
-{
- GdkKeymapKey* keys;
- gint n_keys;
- gboolean ret;
- ret = gdk_keymap_get_entries_for_keyval(_SELF(self),
- NUM2UINT(keyval), &keys, &n_keys);
-
- if (ret){
- VALUE key;
- VALUE ary = rb_ary_new();
- gint i;
- for (i = 0; i < n_keys; i++){
- key = rb_ary_new3(3, UINT2NUM(keys[i].keycode), INT2NUM(keys[i].group),
- INT2NUM(keys[i].level));
- rb_ary_push(ary, key);
- }
- g_free(keys);
- return ary;
- } else {
- return Qnil;
- }
-}
-
-static VALUE
-rg_get_entries_for_keycode(VALUE self, VALUE hardware_keycode)
-{
- GdkKeymapKey* keys;
- guint* keyvals;
- gint n_entries;
- gboolean ret = gdk_keymap_get_entries_for_keycode(_SELF(self),
- NUM2UINT(hardware_keycode),
- &keys, &keyvals, &n_entries);
- if (ret){
- VALUE key;
- VALUE ary = rb_ary_new();
- gint i;
- for (i = 0; i < n_entries; i++){
- key = rb_ary_new3(4, UINT2NUM(keys[i].keycode), INT2NUM(keys[i].group),
- INT2NUM(keys[i].level), UINT2NUM(keyvals[i]));
- rb_ary_push(ary, key);
- }
- g_free(keys);
- g_free(keyvals);
- return ary;
- } else {
- return Qnil;
- }
-}
-
-static VALUE
-rg_direction(VALUE self)
-{
- return PANGODIRECTION2RVAL(gdk_keymap_get_direction(_SELF(self)));
-}
-
-static VALUE
-rg_have_bidi_layouts_p(VALUE self)
-{
- return CBOOL2RVAL(gdk_keymap_have_bidi_layouts(_SELF(self)));
-}
-
-void
-Init_gdk_keymap(VALUE mGdk)
-{
- VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GDK_TYPE_KEYMAP, "Keymap", mGdk);
-
- RG_DEF_SMETHOD(default, 0);
- RG_DEF_SMETHOD(for_display, 0);
- RG_DEF_METHOD(lookup_key, 3);
- RG_DEF_METHOD(translate_keyboard_state, 3);
- RG_DEF_METHOD(get_entries_for_keyval, 1);
- RG_DEF_METHOD(get_entries_for_keycode, 1);
- RG_DEF_METHOD(direction, 0);
- RG_DEF_METHOD_P(have_bidi_layouts, 0);
-
-#ifdef GDK_WINDOWING_X11
- G_DEF_CLASS3("GdkKeymapX11", "KeymapX11", mGdk);
-#endif
-
-}
diff --git a/gdk3/ext/gdk3/rbgdkkeyval.c b/gdk3/ext/gdk3/rbgdkkeyval.c
deleted file mode 100644
index b68851a..0000000
--- a/gdk3/ext/gdk3/rbgdkkeyval.c
+++ /dev/null
@@ -1,108 +0,0 @@
-/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
-/*
- * Copyright (C) 2011 Ruby-GNOME2 Project Team
- * Copyright (C) 2002,2003 Ruby-GNOME2 Project Team
- * Copyright (C) 1998-2000 Yukihiro Matsumoto,
- * Daisuke Kanda,
- * Hiroshi Igarashi
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- */
-
-#include "rbgdk3private.h"
-#include <gdk/gdkkeysyms.h>
-
-#define RG_TARGET_NAMESPACE mGdkKeyval
-
-static VALUE
-rg_s_to_name(G_GNUC_UNUSED VALUE self, VALUE keyval)
-{
- gchar* name = gdk_keyval_name(NUM2UINT(keyval));
- return name ? CSTR2RVAL(name) : Qnil;
-}
-
-static VALUE
-rg_s_from_name(G_GNUC_UNUSED VALUE self, VALUE keyval_name)
-{
- return UINT2NUM(gdk_keyval_from_name(RVAL2CSTR(keyval_name)));
-}
-
-static VALUE
-rg_s_upper_p(G_GNUC_UNUSED VALUE self, VALUE keyval)
-{
- return CBOOL2RVAL(gdk_keyval_is_upper(NUM2UINT(keyval)));
-}
-
-static VALUE
-rg_s_lower_p(G_GNUC_UNUSED VALUE self, VALUE keyval)
-{
- return CBOOL2RVAL(gdk_keyval_is_lower(NUM2UINT(keyval)));
-}
-
-static VALUE
-rg_s_convert_case(G_GNUC_UNUSED VALUE self, VALUE symbol)
-{
- guint upper, lower;
- gdk_keyval_convert_case(NUM2UINT(symbol), &lower, &upper);
- return rb_ary_new3(2, UINT2NUM(lower), UINT2NUM(upper));
-}
-
-static VALUE
-rg_s_to_upper(G_GNUC_UNUSED VALUE self, VALUE keyval)
-{
- return INT2NUM(gdk_keyval_to_upper(NUM2UINT(keyval)));
-}
-
-static VALUE
-rg_s_to_lower(G_GNUC_UNUSED VALUE self, VALUE keyval)
-{
- return INT2NUM(gdk_keyval_to_lower(NUM2UINT(keyval)));
-}
-
-static VALUE
-rg_s_to_unicode(G_GNUC_UNUSED VALUE self, VALUE keyval)
-{
- return UINT2NUM(gdk_keyval_to_unicode(NUM2UINT(keyval)));
-}
-
-static VALUE
-rg_s_from_unicode(G_GNUC_UNUSED VALUE self, VALUE wc)
-{
- VALUE unicode;
- if (TYPE(wc) == T_STRING) {
- unicode = NUM2UINT(rb_funcall(wc, rb_intern("[]"), 1, INT2FIX(0)));
- } else {
- unicode = NUM2UINT(wc);
- }
- return UINT2NUM(gdk_unicode_to_keyval(unicode));
-}
-
-void
-Init_gdk_keyval(VALUE mGdk)
-{
- VALUE RG_TARGET_NAMESPACE = rb_define_module_under(mGdk, "Keyval");
- RG_DEF_SMETHOD(to_name, 1);
- RG_DEF_SMETHOD(from_name, 1);
- RG_DEF_SMETHOD_P(upper, 1);
- RG_DEF_SMETHOD_P(lower, 1);
- RG_DEF_SMETHOD(convert_case, 1);
- RG_DEF_SMETHOD(to_upper, 1);
- RG_DEF_SMETHOD(to_lower, 1);
- RG_DEF_SMETHOD(to_unicode, 1);
- RG_DEF_SMETHOD(from_unicode, 1);
-
-#include "rbgdkkeysyms.h"
-}
diff --git a/gdk3/ext/gdk3/rbgdkpango.c b/gdk3/ext/gdk3/rbgdkpango.c
deleted file mode 100644
index e2ffc35..0000000
--- a/gdk3/ext/gdk3/rbgdkpango.c
+++ /dev/null
@@ -1,197 +0,0 @@
-/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
-/*
- * Copyright (C) 2011 Ruby-GNOME2 Project Team
- * Copyright (C) 2003,2004 Masao Mutoh
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- */
-
-#include "rbgdk3private.h"
-#include "rbpango.h"
-
-#define RG_TARGET_NAMESPACE mPango
-
-static VALUE
-rg_s_context(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
-{
- VALUE screen, ret;
- rb_scan_args(argc, argv, "01", &screen);
- if (NIL_P(screen)){
- ret = GOBJ2RVAL(gdk_pango_context_get());
- } else {
- ret = GOBJ2RVAL(gdk_pango_context_get_for_screen(RVAL2GDKSCREEN(screen)));
- }
- return ret;
-}
-
-/* deprecated
-static VALUE
-gdkpango_context_set_colormap(VALUE self, VALUE colormap)
-{
- gdk_pango_context_set_colormap(RVAL2PANGOCONTEXT(self),
- RVAL2GDKCOLORMAP(colormap));
- return self;
-}
-
-static VALUE
-gdkpango_attr_embossed_initialize(VALUE self, VALUE embossed)
-{
- DATA_PTR(self) = gdk_pango_attr_embossed_new(RVAL2CBOOL(embossed));
- return Qnil;
-}
-
-static VALUE
-gdkpango_attr_embossed_value(VALUE self)
-{
- return CBOOL2RVAL(((GdkPangoAttrEmbossed*)RVAL2ATTR(self))->embossed);
-}
-*/
-
-/* deprecated
-static VALUE
-gdkpango_attr_stipple_initialize(VALUE self, VALUE stipple)
-{
- DATA_PTR(self) = gdk_pango_attr_stipple_new(RVAL2GDKBITMAP(stipple));
- return Qnil;
-}
-
-static VALUE
-gdkpango_attr_stipple_value(VALUE self)
-{
- return GOBJ2RVAL(((GdkPangoAttrStipple*)RVAL2ATTR(self))->stipple);
-}
-*/
-
-static VALUE
-gdkpango_layout_get_clip_region(VALUE self, VALUE rbx_origin, VALUE rby_origin, VALUE rbindex_ranges)
-{
- PangoLayout *layout = RVAL2PANGOLAYOUT(self);
- gint x_origin = NUM2INT(rbx_origin);
- gint y_origin = NUM2INT(rby_origin);
- long n;
- gint *index_ranges = RVAL2GINTS(rbindex_ranges, n);
- cairo_region_t *result;
-
- if (n % 2 != 0) {
- g_free(index_ranges);
-
- rb_raise(rb_eArgError,
- "an even number of byte indexes must be given");
- }
-
- result = gdk_pango_layout_get_clip_region(layout, x_origin, y_origin, index_ranges, n / 2);
-
- g_free(index_ranges);
-
- return CRREGION2RVAL(result);
-}
-
-static VALUE
-gdkpango_layout_line_get_clip_region(VALUE self, VALUE rbx_origin, VALUE rby_origin, VALUE rbindex_ranges)
-{
- PangoLayoutLine *line = RVAL2PANGOLAYOUTLINE(self);
- gint x_origin = NUM2INT(rbx_origin);
- gint y_origin = NUM2INT(rby_origin);
- long n;
- gint *index_ranges = RVAL2GINTS(rbindex_ranges, n);
- cairo_region_t *result;
-
- if (n % 2 != 0) {
- g_free(index_ranges);
-
- rb_raise(rb_eArgError,
- "an even number of byte indexes must be given");
- }
-
- result = gdk_pango_layout_line_get_clip_region(line, x_origin, y_origin, index_ranges, n / 2);
-
- g_free(index_ranges);
-
- return CRREGION2RVAL(result);
-}
-
-/* deprecated
-static VALUE
-gdkpango_attr_emboss_color_initialize(VALUE self, VALUE color)
-{
- DATA_PTR(self) = gdk_pango_attr_emboss_color_new(RVAL2GDKCOLOR(color));
- return Qnil;
-}
-
-static VALUE
-gdkpango_attr_emboss_color_value(VALUE self)
-{
- return PANGOCOLOR2RVAL(&(((GdkPangoAttrEmbossColor *)RVAL2ATTR(self))->color));
-}
-*/
-
-void
-Init_gdk_pango(VALUE mGdk)
-{
-/* deprecated
- VALUE klass;
- PangoAttribute* tmpattr;
- GdkColor color;
-*/
-
- VALUE RG_TARGET_NAMESPACE = rb_define_module_under(mGdk, "Pango");
-/* deprecated
- VALUE context = GTYPE2CLASS(PANGO_TYPE_CONTEXT);
-*/
- VALUE layout = GTYPE2CLASS(PANGO_TYPE_LAYOUT);
- VALUE layoutline = GTYPE2CLASS(PANGO_TYPE_LAYOUT_LINE);
-/* deprecated
- VALUE pattr = ATTRTYPE2CLASS(CSTR2RVAL("Attribute"));
- VALUE pattrbool = ATTRTYPE2CLASS(CSTR2RVAL("AttrBool"));
- VALUE pattr_color = ATTRTYPE2CLASS(CSTR2RVAL("AttrColor"));
-*/
-
- RG_DEF_SMETHOD(context, -1);
-
-/* deprecated
- rbg_define_method(context, "set_colormap", gdkpango_context_set_colormap, 1);
-*/
- rbg_define_method(layout, "get_clip_region", gdkpango_layout_get_clip_region, 3);
- rbg_define_method(layoutline, "get_clip_region", gdkpango_layout_line_get_clip_region, 3);
-
-/* deprecated
- klass = rb_define_class_under(mGdk, "PangoAttrEmbossed", pattrbool);
- rbg_define_method(klass, "initialize", gdkpango_attr_embossed_initialize, 1);
- tmpattr = gdk_pango_attr_embossed_new(TRUE);
- rbg_define_method(klass, "value", gdkpango_attr_embossed_value, 0);
- RBPANGO_ADD_ATTRIBUTE(tmpattr->klass->type, klass);
- pango_attribute_destroy(tmpattr);
-*/
-
-/* deprecated
- klass = rb_define_class_under(mGdk, "PangoAttrStipple", pattr);
- rbg_define_method(klass, "initialize", gdkpango_attr_stipple_initialize, 1);
- rbg_define_method(klass, "value", gdkpango_attr_stipple_value, 0);
- tmpattr = gdk_pango_attr_stipple_new(NULL);
- RBPANGO_ADD_ATTRIBUTE(tmpattr->klass->type, klass);
- pango_attribute_destroy(tmpattr);
-*/
-
-/* deprecated
- klass = rb_define_class_under(mGdk, "PangoAttrEmbossColor", pattr_color);
- rbg_define_method(klass, "initialize",
- gdkpango_attr_emboss_color_initialize, 1);
- rbg_define_method(klass, "value", gdkpango_attr_emboss_color_value, 0);
- tmpattr = gdk_pango_attr_emboss_color_new(&color);
- RBPANGO_ADD_ATTRIBUTE(tmpattr->klass->type, klass);
- pango_attribute_destroy(tmpattr);
-*/
-}
diff --git a/gdk3/ext/gdk3/rbgdkpangorenderer.c b/gdk3/ext/gdk3/rbgdkpangorenderer.c
deleted file mode 100644
index 158cc4f..0000000
--- a/gdk3/ext/gdk3/rbgdkpangorenderer.c
+++ /dev/null
@@ -1,144 +0,0 @@
-/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
-/*
- * Copyright (C) 2011 Ruby-GNOME2 Project Team
- * Copyright (C) 2005 Masao Mutoh
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- */
-
-/* deprecated
-#include "rbgdk3private.h"
-
-#define RG_TARGET_NAMESPACE cPangoRenderer
-#define _SELF(s) (RVAL2GDKPANGORENDERER(s))
-
-static VALUE
-rg_initialize(int argc, VALUE *argv, VALUE self)
-{
- VALUE screen;
- GdkScreen* gscreen;
-
- rb_scan_args(argc, argv, "01", &screen);
-
- if (NIL_P(screen)){
- gscreen = gdk_screen_get_default();
- } else {
- gscreen = RVAL2GDKSCREEN(screen);
- }
-
- G_INITIALIZE(self, gdk_pango_renderer_new(gscreen));
-
- return Qnil;
-}
-
-static VALUE
-rg_s_get_default(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
-{
- VALUE screen;
- GdkScreen* gscreen;
-
- rb_scan_args(argc, argv, "01", &screen);
-
- if (NIL_P(screen)){
- gscreen = gdk_screen_get_default();
- } else {
- gscreen = RVAL2GDKSCREEN(screen);
- }
- return GOBJ2RVAL(gdk_pango_renderer_get_default(gscreen));
-}
-
-static VALUE
-rg_s_default(G_GNUC_UNUSED VALUE self)
-{
- GdkScreen* gscreen = gdk_screen_get_default();
- return GOBJ2RVAL(gdk_pango_renderer_get_default(gscreen));
-}
-
-static VALUE
-rg_set_drawable(VALUE self, VALUE drawable)
-{
- gdk_pango_renderer_set_drawable(_SELF(self),
- RVAL2GDKDRAWABLE(drawable));
- return self;
-}
-
-static VALUE
-rg_set_gc(VALUE self, VALUE gc)
-{
- gdk_pango_renderer_set_gc(_SELF(self),
- NIL_P(gc) ? NULL : RVAL2GDKGC(gc));
- return self;
-}
-
-#ifdef HAVE_PANGO_RENDER_PART_GET_TYPE
-static VALUE
-rg_set_stipple(VALUE self, VALUE part, VALUE stipple)
-{
- gdk_pango_renderer_set_stipple(_SELF(self), RVAL2PANGORENDERPART(part),
- NIL_P(stipple) ? NULL : RVAL2GDKBITMAP(stipple));
-
- return self;
-}
-#else
-static VALUE
-prenderer_set_stipple(G_GNUC_UNUSED VALUE self,
- G_GNUC_UNUSED VALUE part,
- G_GNUC_UNUSED VALUE stipple)
-{
- rb_warning("Gdk::PangoRender#set_tipple is not supported (Require pango-1.8.1 or later");
-
- return self;
-}
-#endif
-
-#ifdef HAVE_PANGO_RENDER_PART_GET_TYPE
-static VALUE
-rg_set_override_color(VALUE self, VALUE part, VALUE color)
-{
- gdk_pango_renderer_set_override_color(_SELF(self),
- RVAL2PANGORENDERPART(part),
- RVAL2GDKCOLOR(color));
-
- return self;
-}
-#else
-static VALUE
-prenderer_set_override_color(G_GNUC_UNUSED VALUE self,
- G_GNUC_UNUSED VALUE part,
- G_GNUC_UNUSED VALUE color)
-{
- rb_warning("Gdk::PangoRender#set_override_color is not supported (Require pango-1.8.1 or later");
-
- return self;
-}
-#endif
-
-void
-Init_gdk_pangorenderer(VALUE mGdk)
-{
- VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GDK_TYPE_PANGO_RENDERER, "PangoRenderer", mGdk);
-
- RG_DEF_METHOD(initialize, -1);
- RG_DEF_METHOD(set_drawable, 1);
- RG_DEF_METHOD(set_gc, 1);
- RG_DEF_METHOD(set_stipple, 2);
- RG_DEF_METHOD(set_override_color, 2);
-
- RG_DEF_SMETHOD(get_default, -1);
- RG_DEF_SMETHOD(default, 0);
-}
-*/
-
diff --git a/gdk3/ext/gdk3/rbgdkpixbuf.c b/gdk3/ext/gdk3/rbgdkpixbuf.c
deleted file mode 100644
index 7523852..0000000
--- a/gdk3/ext/gdk3/rbgdkpixbuf.c
+++ /dev/null
@@ -1,176 +0,0 @@
-/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
-/*
- * Copyright (C) 2011 Ruby-GNOME2 Project Team
- * Copyright (C) 2002,2003 Masao Mutoh
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- */
-
-#include "rbgdk3private.h"
-
-#define RG_TARGET_NAMESPACE cPixbuf
-#define _SELF(s) RVAL2GDKPIXBUF(s)
-
-/* deprecated
-static VALUE
-rg_render_threshold_alpha(VALUE self, VALUE bitmap, VALUE src_x, VALUE src_y, VALUE dest_x, VALUE dest_y, VALUE width, VALUE height, VALUE alpha_threshold)
-{
- gdk_pixbuf_render_threshold_alpha(_SELF(self), RVAL2GDKBITMAP(bitmap),
- NUM2INT(src_x), NUM2INT(src_y),
- NUM2INT(dest_x), NUM2INT(dest_y),
- NUM2INT(width), NUM2INT(height),
- NUM2INT(alpha_threshold));
- return self;
-}
-
-static VALUE
-rg_render_to_drawable(int argc, VALUE *argv, VALUE self)
-{
- VALUE gc, src_x, src_y, dest_x, dest_y, width, height,
- dither, x_dither, y_dither;
-
- rb_warn("Gdk::Pixbuf#render_to_drawable is obsolete. Use Gdk::Drawable#draw_pixbuf instead.");
-
- rb_scan_args(argc, argv, "73", &gc, &src_x, &src_y, &dest_x, &dest_y,
- &width, &height, &dither, &x_dither, &y_dither);
-
- if (NIL_P(gc))
- rb_raise(rb_eArgError, "arguments 1 must be non nil");
- if (NIL_P(src_x))
- rb_raise(rb_eArgError, "arguments 2 must be non nil");
- if (NIL_P(src_y))
- rb_raise(rb_eArgError, "arguments 3 must be non nil");
- if (NIL_P(dest_x))
- rb_raise(rb_eArgError, "arguments 4 must be non nil");
- if (NIL_P(dest_y))
- rb_raise(rb_eArgError, "arguments 5 must be non nil");
- if (NIL_P(width))
- rb_raise(rb_eArgError, "arguments 6 must be non nil");
- if (NIL_P(height))
- rb_raise(rb_eArgError, "arguments 7 must be non nil");
-
- gdk_pixbuf_render_to_drawable(_SELF(self),
- RVAL2GDKDRAWABLE(self),
- RVAL2GDKGC(gc),
- NUM2INT(src_x), NUM2INT(src_y),
- NUM2INT(dest_x), NUM2INT(dest_y),
- NUM2INT(width), NUM2INT(height),
- NIL_P(dither) ? GDK_RGB_DITHER_NONE : RVAL2GDKRGBDITHER(dither),
- NIL_P(x_dither) ? 0 : NUM2INT(x_dither),
- NIL_P(y_dither) ? 0 : NUM2INT(y_dither));
- return self;
-}
-
-static VALUE
-rg_render_pixmap_and_mask(int argc, VALUE *argv, VALUE self)
-{
- VALUE colormap_or_alpha, alpha;
- GdkPixmap *pixmap;
- GdkBitmap *mask;
-
- rb_scan_args(argc, argv, "11", &colormap_or_alpha, &alpha);
-
- if (rb_obj_is_kind_of(colormap_or_alpha, GTYPE2CLASS(GDK_TYPE_COLORMAP))){
- gdk_pixbuf_render_pixmap_and_mask_for_colormap(_SELF(self),
- RVAL2GOBJ(colormap_or_alpha),
- &pixmap,
- &mask,
- NIL_P(alpha)?0:NUM2INT(alpha));
- } else {
- gdk_pixbuf_render_pixmap_and_mask(_SELF(self),
- &pixmap,
- &mask,
- NIL_P(colormap_or_alpha)?
- 0:NUM2INT(colormap_or_alpha));
- }
-
- return rb_ary_new3(2,
- pixmap ? GOBJ2RVAL(pixmap) : Qnil,
- mask ? GOBJ2RVAL(mask) : Qnil);
-}
-
-static VALUE
-rg_s_from_drawable(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
-{
- VALUE cmap, src, src_x, src_y, width, height, dest, dest_x, dest_y;
- GdkPixbuf* buf;
-
- rb_scan_args(argc, argv, "63", &cmap, &src, &src_x, &src_y, &width, &height,
- &dest, &dest_x, &dest_y);
-
- buf = gdk_pixbuf_get_from_drawable(RVAL2GDKPIXBUF(dest),
- RVAL2GDKDRAWABLE(src),
- RVAL2GDKCOLORMAP(cmap),
- NUM2INT(src_x), NUM2INT(src_y),
- NIL_P(dest_x) ? 0 : NUM2INT(dest_x),
- NIL_P(dest_y) ? 0 : NUM2INT(dest_y),
- NUM2INT(width), NUM2INT(height));
- if (NIL_P(dest)) {
- if (buf) {
- return GOBJ2RVALU(buf);
- } else {
- return Qnil;
- }
- } else {
- return dest;
- }
-}
-
-static VALUE
-rg_s_from_image(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
-{
- VALUE cmap, src, src_x, src_y, width, height, dest, dest_x, dest_y;
- GdkPixbuf* buf;
-
- rb_scan_args(argc, argv, "63", &cmap, &src, &src_x, &src_y, &width, &height,
- &dest, &dest_x, &dest_y);
-
- buf = gdk_pixbuf_get_from_image(RVAL2GDKPIXBUF(dest),
- RVAL2GDKIMAGE(src),
- RVAL2GDKCOLORMAP(cmap),
- NUM2INT(src_x), NUM2INT(src_y),
- NIL_P(dest_x) ? 0 : NUM2INT(dest_x),
- NIL_P(dest_y) ? 0 : NUM2INT(dest_y),
- NUM2INT(width), NUM2INT(height));
- if (NIL_P(dest)) {
- if (buf) {
- return GOBJ2RVAL(buf);
- } else {
- return Qnil;
- }
- } else {
- return dest;
- }
-}
-*/
-
-void
-Init_gdk_pixbuf(VALUE mGdk)
-{
- /*
- * This defines Gdk::Pixbuf methods of GDK side.
- */
- VALUE RG_TARGET_NAMESPACE = GTYPE2CLASS(GDK_TYPE_PIXBUF);
-
-/* deprecated
- RG_DEF_METHOD(render_threshold_alpha, 8);
- RG_DEF_METHOD(render_to_drawable, -1);
- RG_DEF_METHOD(render_pixmap_and_mask, -1);
-
- RG_DEF_SMETHOD(from_drawable, -1);
- RG_DEF_SMETHOD(from_image, -1);
-*/
-}
diff --git a/gdk3/ext/gdk3/rbgdkproperty.c b/gdk3/ext/gdk3/rbgdkproperty.c
deleted file mode 100644
index e6240a8..0000000
--- a/gdk3/ext/gdk3/rbgdkproperty.c
+++ /dev/null
@@ -1,305 +0,0 @@
-/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
-/*
- * Copyright (C) 2011 Ruby-GNOME2 Project Team
- * Copyright (C) 2002-2004 Ruby-GNOME2 Project Team
- * Copyright (C) 1998-2000 Yukihiro Matsumoto,
- * Daisuke Kanda,
- * Hiroshi Igarashi
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- */
-
-#include "rbgdk3private.h"
-
-#define RG_TARGET_NAMESPACE mProperty
-
-/* deprecated
-static VALUE
-rg_s_text_property_to_text_list(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
-{
- gint num, i;
- gchar** list;
- VALUE ret = Qnil;
-
- if (argc == 3) {
- VALUE encoding, format, text;
- rb_scan_args(argc, argv, "30", &encoding, &format, &text);
- StringValue(text);
-
- num = gdk_text_property_to_text_list(RVAL2ATOM(encoding),
- NUM2INT(format),
- (const guchar*)RVAL2CSTR(text),
- RSTRING_LEN(text), &list);
- } else {
- VALUE display, encoding, format, text;
- rb_scan_args(argc, argv, "40", &display, &encoding, &format, &text);
- StringValue(text);
-
- num = gdk_text_property_to_text_list_for_display(RVAL2GDKDISPLAYOBJECT(display),
- RVAL2ATOM(encoding),
- NUM2INT(format),
- (const guchar*)RVAL2CSTR(text),
- RSTRING_LEN(text),
- &list);
- }
-
- ret = rb_ary_new2(num);
- for (i =0; i < num; i++){
- rb_ary_push(ret, CSTR2RVAL(list[i]));
- }
- gdk_free_text_list(list);
- return ret;
-}
-*/
-
-/* TODO
-static VALUE
-rg_s_text_property_to_utf8_list(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
-{
- gint num, i;
- gchar** list;
- VALUE ret = Qnil;
-
- if (argc == 3) {
- VALUE encoding, format, text;
- rb_scan_args(argc, argv, "30", &encoding, &format, &text);
- StringValue(text);
-
- num = gdk_text_property_to_utf8_list(RVAL2ATOM(encoding),
- NUM2INT(format),
- (const guchar*)RVAL2CSTR(text),
- RSTRING_LEN(text), &list);
- } else {
- VALUE display, encoding, format, text;
- rb_scan_args(argc, argv, "40", &display, &encoding, &format, &text);
- StringValue(text);
-
- num = gdk_text_property_to_utf8_list_for_display(RVAL2GDKDISPLAYOBJECT(display),
- RVAL2ATOM(encoding),
- NUM2INT(format),
- (const guchar*)RVAL2CSTR(text),
- RSTRING_LEN(text),
- &list);
- }
-
- ret = rb_ary_new2(num);
- for (i =0; i < num; i++){
- rb_ary_push(ret, CSTR2RVAL(list[i]));
- }
- g_strfreev(list);
- return ret;
-}
-*/
-
-/* deprecated
-static VALUE
-rg_s_string_to_compound_text(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
-{
- gint num;
- GdkAtom encoding;
- gint format;
- guchar *ctext;
- gint length;
-
- if (argc == 1) {
- VALUE str;
- rb_scan_args(argc, argv, "10", &str);
- num = gdk_string_to_compound_text(RVAL2CSTR(str),
- &encoding, &format,
- &ctext, &length);
- } else {
- VALUE display, str;
-
- rb_scan_args(argc, argv, "20", &display, &str);
- num = gdk_string_to_compound_text_for_display(RVAL2GDKDISPLAYOBJECT(display),
- RVAL2CSTR(str),
- &encoding, &format,
- &ctext, &length);
- }
-
- if (num == 0){
- VALUE ret = CSTR2RVAL((const char*)ctext);
- gdk_free_compound_text(ctext);
- return rb_ary_new3(3, GDKATOM2RVAL(encoding),
- INT2NUM(format), ret);
- } else {
- rb_raise(rb_eRuntimeError, "failed to converts a string %d\n", num);
- }
- return Qnil;
-}
-*/
-
-static VALUE
-rg_s_utf8_to_string_target(G_GNUC_UNUSED VALUE self, VALUE str)
-{
- return CSTR2RVAL((const char*)gdk_utf8_to_string_target(RVAL2CSTR(str)));
-}
-
-/* deprecated
-static VALUE
-rg_s_utf8_to_compound_text(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
-{
- GdkAtom encoding;
- gint format;
- guchar *ctext;
- gint length;
- gint ret;
-
- if (argc == 1) {
- VALUE str;
- rb_scan_args(argc, argv, "10", &str);
-
- ret = gdk_utf8_to_compound_text(RVAL2CSTR(str),
- &encoding, &format,
- &ctext, &length);
- } else {
- VALUE display, str;
-
- rb_scan_args(argc, argv, "20", &display, &str);
- ret = gdk_utf8_to_compound_text_for_display(RVAL2GDKDISPLAYOBJECT(display),
- RVAL2CSTR(str),
- &encoding, &format,
- &ctext, &length);
- }
-
- if (ret){
- VALUE val = CSTR2RVAL((const char*)ctext);
- gdk_free_compound_text(ctext);
- return rb_ary_new3(3, GDKATOM2RVAL(encoding),
- INT2NUM(format), val);
- } else {
- rb_raise(rb_eRuntimeError, "failed to converts a string %d\n", ret);
- }
- return Qnil;
-}
-*/
-
-/* TODO
-static VALUE
-rg_s_change(int argc, VALUE *argv, VALUE self)
-{
- int fmt, len;
- void* dat;
- GdkAtom ntype;
- VALUE win, property, type, size= Qnil, mode, src;
-
- if(6 == argc)
- rb_scan_args(argc, argv, "60", &win, &property, &type, &size, &mode, &src);
- else
- rb_scan_args(argc, argv, "50", &win, &property, &type, &mode, &src);
-
- rbgtk_atom2selectiondata(type, size, src, &ntype, &dat, &fmt, &len);
-
- gdk_property_change(RVAL2GDKWINDOW(win), RVAL2ATOM(property),
- ntype, fmt, RVAL2GDKPROPMODE(mode), dat, len);
-
- rbgtk_atom2selectiondata_free(ntype, dat);
-
- return self;
-}
-*/
-
-static VALUE
-rg_s_get(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
-{
- /* for argument processing */
- GdkAtom rtype;
- gint rfmt, rlen;
- guchar* rdat;
- VALUE win, property, type, offset=INT2FIX(0), length=INT2FIX(9999), delete;
-
- /* for inner processing */
- gint i;
- size_t j;
- VALUE ret = 0;
-
- if(6 == argc)
- rb_scan_args(argc, argv, "60", &win, &property, &type, &offset, &length, &delete);
- else
- rb_scan_args(argc, argv, "40", &win, &property, &type, &delete);
-
- if(gdk_property_get(RVAL2GDKWINDOW(win), RVAL2ATOM(property), RVAL2ATOM(type),
- NUM2INT(offset), NUM2INT(length),
- RVAL2CBOOL(delete), &rtype, &rfmt, &rlen, &rdat) == FALSE){
- return Qnil;
- }
-
- switch(rfmt){
- case 8:
- default:
- ret = RBG_STRING_SET_UTF8_ENCODING(rb_str_new((const char*)rdat, rlen));
- break;
-
- case 16:
- ret = rb_ary_new();
-
- for( i = 0; i < rlen; i++){
- rb_ary_push(ret, rb_Integer(((unsigned short*)rdat)[i]));
- }
- break;
-
- case 32:
- ret = rb_ary_new();
-
- if(rtype != GDK_SELECTION_TYPE_ATOM){
- for(j = 0; j < (rlen/sizeof(unsigned long)); j++){
- rb_ary_push(ret, INT2FIX(((unsigned long*)rdat)[j]));
- }
- } else {
- for(j = 0; j < (rlen/sizeof(unsigned long)); j++){
- rb_ary_push(ret, GDKATOM2RVAL((GdkAtom)((unsigned long*)rdat)[j]));
- }
- }
- break;
- }
-
- return rb_ary_new3(3, GDKATOM2RVAL(rtype),
- ret, INT2NUM(rlen));
-}
-
-static VALUE
-rg_s_delete(VALUE self, VALUE win, VALUE property)
-{
- gdk_property_delete(RVAL2GDKWINDOW(win), RVAL2ATOM(property));
- return self;
-}
-
-void
-Init_gdk_property(VALUE mGdk)
-{
- VALUE RG_TARGET_NAMESPACE = rb_define_module_under(mGdk, "Property");
-
-/* deprecated
- RG_DEF_SMETHOD(text_property_to_text_list, -1);
-*/
-/* TODO
- RG_DEF_SMETHOD(text_property_to_utf8_list, -1);
-*/
-/* deprecated
- RG_DEF_SMETHOD(string_to_compound_text, -1);
-*/
- RG_DEF_SMETHOD(utf8_to_string_target, 1);
-/* deprecated
- RG_DEF_SMETHOD(utf8_to_compound_text, -1);
-*/
-/* TODO
- RG_DEF_SMETHOD(change, -1);
-*/
- RG_DEF_SMETHOD(get, -1);
- RG_DEF_SMETHOD(delete, 2);
-
- G_DEF_CLASS(GDK_TYPE_PROP_MODE, "PropMode", RG_TARGET_NAMESPACE);
-}
diff --git a/gdk3/ext/gdk3/rbgdkrectangle.c b/gdk3/ext/gdk3/rbgdkrectangle.c
deleted file mode 100644
index 335e0da..0000000
--- a/gdk3/ext/gdk3/rbgdkrectangle.c
+++ /dev/null
@@ -1,140 +0,0 @@
-/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
-/*
- * Copyright (C) 2011-2013 Ruby-GNOME2 Project Team
- * Copyright (C) 2002,2003 Masao Mutoh
- * Copyright (C) 1998-2000 Yukihiro Matsumoto,
- * Daisuke Kanda,
- * Hiroshi Igarashi
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- */
-
-#include "rbgdk3private.h"
-
-#define RG_TARGET_NAMESPACE cRectangle
-#define _SELF(r) (RVAL2GDKRECTANGLE(r))
-
-static VALUE
-rg_initialize(VALUE self, VALUE x, VALUE y, VALUE width, VALUE height)
-{
- GdkRectangle rectangle;
-
- rectangle.x = NUM2INT(x);
- rectangle.y = NUM2INT(y);
- rectangle.width = NUM2INT(width);
- rectangle.height = NUM2INT(height);
-
- G_INITIALIZE(self, g_boxed_copy(GDK_TYPE_RECTANGLE, &rectangle));
- return Qnil;
-}
-
-static VALUE
-rg_intersect(VALUE self, VALUE other)
-{
- GdkRectangle dest;
- gboolean ret = gdk_rectangle_intersect(_SELF(self), _SELF(other), &dest);
- return ret ? GDKRECTANGLE2RVAL(&dest) : Qnil;
-}
-
-static VALUE
-rg_union(VALUE self, VALUE other)
-{
- GdkRectangle dest;
- gdk_rectangle_union(_SELF(self), _SELF(other), &dest);
- return GDKRECTANGLE2RVAL(&dest);
-}
-
-/* Struct accessors */
-static VALUE
-rg_x(VALUE self)
-{
- return INT2NUM(_SELF(self)->x);
-}
-
-static VALUE
-rg_y(VALUE self)
-{
- return INT2NUM(_SELF(self)->y);
-}
-
-static VALUE
-rg_width(VALUE self)
-{
- return INT2NUM(_SELF(self)->width);
-}
-
-static VALUE
-rg_height(VALUE self)
-{
- return INT2NUM(_SELF(self)->height);
-}
-
-static VALUE
-rg_set_x(VALUE self, VALUE x)
-{
- _SELF(self)->x = NUM2INT(x);
- return self;
-}
-
-static VALUE
-rg_set_y(VALUE self, VALUE y)
-{
- _SELF(self)->y = NUM2INT(y);
- return self;
-}
-
-static VALUE
-rg_set_width(VALUE self, VALUE width)
-{
- _SELF(self)->width = NUM2INT(width);
- return self;
-}
-
-static VALUE
-rg_set_height(VALUE self, VALUE height)
-{
- _SELF(self)->height = NUM2INT(height);
- return self;
-}
-
-static VALUE
-rg_to_a(VALUE self)
-{
- GdkRectangle* a = _SELF(self);
- return rb_ary_new3(4, INT2FIX(a->x), INT2FIX(a->y),
- INT2FIX(a->width), INT2FIX(a->height));
-}
-
-void
-Init_gdk_rectangle(VALUE mGdk)
-{
- VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GDK_TYPE_RECTANGLE, "Rectangle", mGdk);
-
- RG_DEF_METHOD(initialize, 4);
- RG_DEF_METHOD(intersect, 1);
- RG_DEF_ALIAS("&", "intersect");
- RG_DEF_METHOD(union, 1);
- RG_DEF_ALIAS("|", "union");
- RG_DEF_METHOD(x, 0);
- RG_DEF_METHOD(y, 0);
- RG_DEF_METHOD(width, 0);
- RG_DEF_METHOD(height, 0);
- RG_DEF_METHOD(set_x, 1);
- RG_DEF_METHOD(set_y, 1);
- RG_DEF_METHOD(set_width, 1);
- RG_DEF_METHOD(set_height, 1);
- RG_DEF_METHOD(to_a, 0);
-}
diff --git a/gdk3/ext/gdk3/rbgdkrgb.c b/gdk3/ext/gdk3/rbgdkrgb.c
deleted file mode 100644
index a84d676..0000000
--- a/gdk3/ext/gdk3/rbgdkrgb.c
+++ /dev/null
@@ -1,199 +0,0 @@
-/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
-/*
- * Copyright (C) 2011 Ruby-GNOME2 Project Team
- * Copyright (C) 2002,2003 Ruby-GNOME2 Project Team
- * Copyright (C) 1998-2000 Yukihiro Matsumoto,
- * Daisuke Kanda,
- * Hiroshi Igarashi
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- */
-
-/* deprecated
-#include "rbgdk3private.h"
-
-#define RG_TARGET_NAMESPACE mRGB
-#define RVAL2DRAW(s) RVAL2GDKDRAWABLE(s)
-
-static VALUE
-rg_s_draw_rgb_image(int argc, VALUE *argv, VALUE self)
-{
- VALUE win, gc, x, y, w, h, dither, buf, rowstride, xdith, ydith;
-
- rb_scan_args(argc, argv, "92", &win, &gc, &x, &y, &w, &h, &dither,
- &buf, &rowstride, &xdith, &ydith);
-
- if (argc == 9){
- gdk_draw_rgb_image(RVAL2DRAW(win), RVAL2GDKGC(gc),
- NUM2INT(x), NUM2INT(y),
- NUM2INT(w), NUM2INT(h),
- RVAL2GDKRGBDITHER(dither),
- (guchar*)RVAL2CSTR(buf),
- NUM2INT(rowstride));
- } else {
- gdk_draw_rgb_image_dithalign(RVAL2DRAW(win), RVAL2GDKGC(gc),
- NUM2INT(x), NUM2INT(y),
- NUM2INT(w), NUM2INT(h),
- RVAL2GDKRGBDITHER(dither),
- (guchar*)RVAL2CSTR(buf),
- NUM2INT(rowstride),
- NUM2INT(xdith), NUM2INT(ydith));
- }
-
- return self;
-}
-
-static VALUE
-rg_s_draw_indexed_image(VALUE self, VALUE win, VALUE rbgc, VALUE rbx, VALUE rby,
- VALUE rbwidth, VALUE rbheight, VALUE rbdither,
- VALUE rbbuf, VALUE rbrowstride, VALUE rbcolors)
-{
- GdkDrawable *drawable = RVAL2DRAW(win);
- GdkGC *gc = RVAL2GDKGC(rbgc);
- gint x = NUM2INT(rbx);
- gint y = NUM2INT(rby);
- gint width = NUM2INT(rbwidth);
- gint height = NUM2INT(rbheight);
- GdkRgbDither dither = RVAL2GDKRGBDITHER(rbdither);
- const guchar *buf = (const guchar *)RVAL2CSTR(rbbuf);
- gint rowstride = NUM2INT(rbrowstride);
- long n;
- guint32 *colors = RVAL2GUINT32S(rbcolors, n);
- GdkRgbCmap *cmap;
-
- if (n < 0 || n > 255) {
- g_free(colors);
-
- rb_raise(rb_eArgError, "colors: out of range (0 - 255)");
- }
-
- cmap = gdk_rgb_cmap_new(colors, n);
-
- g_free(colors);
-
- gdk_draw_indexed_image(drawable, gc, x, y, width, height, dither, buf, rowstride, cmap);
-
- gdk_rgb_cmap_free(cmap);
-
- return self;
-}
-
-static VALUE
-rg_s_draw_gray_image(VALUE self, VALUE win, VALUE gc, VALUE x, VALUE y, VALUE w, VALUE h, VALUE dither, VALUE buf, VALUE rowstride)
-{
- gdk_draw_gray_image(RVAL2DRAW(win), RVAL2GDKGC(gc),
- NUM2INT(x), NUM2INT(y),
- NUM2INT(w), NUM2INT(h),
- RVAL2GDKRGBDITHER(dither),
- (guchar*)RVAL2CSTR(buf),
- NUM2INT(rowstride));
- return self;
-}
-
-static VALUE
-rg_s_draw_rgb_32_image(int argc, VALUE *argv, VALUE self)
-{
- VALUE win, gc, x, y, w, h, dither, buf, rowstride, xdith, ydith;
-
- rb_scan_args(argc, argv, "92", &win, &gc, &x, &y, &w, &h, &dither,
- &buf, &rowstride, &xdith, &ydith);
-
- if (argc == 9){
- gdk_draw_rgb_32_image(RVAL2DRAW(win), RVAL2GDKGC(gc),
- NUM2INT(x), NUM2INT(y),
- NUM2INT(w), NUM2INT(h),
- RVAL2GDKRGBDITHER(dither),
- (guchar*)RVAL2CSTR(buf),
- NUM2INT(rowstride));
- } else {
- gdk_draw_rgb_32_image_dithalign(RVAL2DRAW(win), RVAL2GDKGC(gc),
- NUM2INT(x), NUM2INT(y),
- NUM2INT(w), NUM2INT(h),
- RVAL2GDKRGBDITHER(dither),
- (guchar*)RVAL2CSTR(buf),
- NUM2INT(rowstride), NUM2INT(xdith), NUM2INT(ydith));
- }
- return self;
-}
-
-static VALUE
-rg_s_find_color(VALUE self, VALUE colormap, VALUE color)
-{
- gdk_rgb_find_color(RVAL2GDKCOLORMAP(colormap),
- RVAL2GDKCOLOR(color));
- return self;
-}
-
-static VALUE
-rg_s_set_install(VALUE self, VALUE install)
-{
- gdk_rgb_set_install(RVAL2CBOOL(install));
- return self;
-}
-
-static VALUE
-rg_s_set_min_colors(VALUE self, VALUE min_colors)
-{
- gdk_rgb_set_min_colors(NUM2INT(min_colors));
- return self;
-}
-
-static VALUE
-rg_s_visual(G_GNUC_UNUSED VALUE self)
-{
- return GOBJ2RVAL(gdk_rgb_get_visual());
-}
-
-static VALUE
-rg_s_colormap(G_GNUC_UNUSED VALUE self)
-{
- return GOBJ2RVAL(gdk_rgb_get_colormap());
-}
-
-static VALUE
-rg_s_ditherable_p(G_GNUC_UNUSED VALUE self)
-{
- return CBOOL2RVAL(gdk_rgb_ditherable());
-}
-
-static VALUE
-rg_s_set_verbose(VALUE self, VALUE verbose)
-{
- gdk_rgb_set_verbose(RVAL2CBOOL(verbose));
- return self;
-}
-
-void
-Init_gdk_rgb(VALUE mGdk)
-{
- VALUE RG_TARGET_NAMESPACE = rb_define_module_under(mGdk, "RGB");
-
- RG_DEF_SMETHOD(draw_rgb_image, -1);
- RG_DEF_SMETHOD(draw_indexed_image, 10);
- RG_DEF_SMETHOD(draw_gray_image, 9);
- RG_DEF_SMETHOD(draw_rgb_32_image, -1);
- RG_DEF_SMETHOD(find_color, 2);
- RG_DEF_SMETHOD(set_install, 1);
- RG_DEF_SMETHOD(set_min_colors, 0);
- RG_DEF_SMETHOD(visual, 0);
- RG_DEF_SMETHOD(colormap, 0);
- RG_DEF_SMETHOD_P(ditherable, 0);
- RG_DEF_SMETHOD(set_verbose, 1);
-
- G_DEF_CLASS(GDK_TYPE_RGB_DITHER, "Dither", RG_TARGET_NAMESPACE);
-}
-*/
-
diff --git a/gdk3/ext/gdk3/rbgdkrgba.c b/gdk3/ext/gdk3/rbgdkrgba.c
deleted file mode 100644
index bfdfb60..0000000
--- a/gdk3/ext/gdk3/rbgdkrgba.c
+++ /dev/null
@@ -1,142 +0,0 @@
-/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
-/*
- * Copyright (C) 2011 Ruby-GNOME2 Project Team
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- */
-
-#include "rbgdk3private.h"
-
-#define RG_TARGET_NAMESPACE cRGBA
-#define _SELF(self) (RVAL2GDKRGBA(self))
-
-static VALUE
-rg_s_parse(G_GNUC_UNUSED VALUE self, VALUE spec)
-{
- GdkRGBA color;
- if (!gdk_rgba_parse(&color, RVAL2CSTR(spec)))
- rb_raise(rb_eArgError, "can't parse color representation `%s'", RVAL2CSTR(spec));
- return GDKRGBA2RVAL(&color);
-}
-
-static VALUE
-rg_initialize(VALUE self, VALUE red, VALUE green, VALUE blue, VALUE alpha)
-{
- GdkRGBA rgba;
-
- rgba.red = NUM2DBL(red);
- rgba.green = NUM2DBL(green);
- rgba.blue = NUM2DBL(blue);
- rgba.alpha = NUM2DBL(alpha);
-
- G_INITIALIZE(self, g_boxed_copy(GDK_TYPE_RGBA, &rgba));
-
- return Qnil;
-}
-
-static VALUE
-rg_red(VALUE self)
-{
- return DBL2NUM(_SELF(self)->red);
-}
-
-static VALUE
-rg_set_red(VALUE self, VALUE red)
-{
- _SELF(self)->red = NUM2DBL(red);
- return self;
-}
-
-static VALUE
-rg_green(VALUE self)
-{
- return DBL2NUM(_SELF(self)->green);
-}
-
-static VALUE
-rg_set_green(VALUE self, VALUE green)
-{
- _SELF(self)->green = NUM2DBL(green);
- return self;
-}
-
-static VALUE
-rg_blue(VALUE self)
-{
- return DBL2NUM(_SELF(self)->blue);
-}
-
-static VALUE
-rg_set_blue(VALUE self, VALUE blue)
-{
- _SELF(self)->blue = NUM2DBL(blue);
- return self;
-}
-
-static VALUE
-rg_alpha(VALUE self)
-{
- return DBL2NUM(_SELF(self)->alpha);
-}
-
-static VALUE
-rg_set_alpha(VALUE self, VALUE alpha)
-{
- _SELF(self)->alpha = NUM2DBL(alpha);
- return self;
-}
-
-static VALUE
-rg_to_a(VALUE self)
-{
- GdkRGBA *rgba = _SELF(self);
- return rb_ary_new3(4, DBL2NUM(rgba->red),
- DBL2NUM(rgba->green),
- DBL2NUM(rgba->blue),
- DBL2NUM(rgba->alpha));
-}
-
-static VALUE
-rg_to_s(VALUE self)
-{
- return CSTR2RVAL_FREE(gdk_rgba_to_string(_SELF(self)));
-}
-
-static VALUE
-rg_operator_equal(VALUE self, VALUE other)
-{
- return CBOOL2RVAL(gdk_rgba_equal(_SELF(self), _SELF(other)));
-}
-
-void
-Init_gdk_rgba(VALUE mGdk)
-{
- VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GDK_TYPE_RGBA, "RGBA", mGdk);
-
- RG_DEF_SMETHOD(parse, 1);
- RG_DEF_METHOD(initialize, 4);
- RG_DEF_METHOD(red, 0);
- RG_DEF_METHOD(set_red, 1);
- RG_DEF_METHOD(green, 0);
- RG_DEF_METHOD(set_green, 1);
- RG_DEF_METHOD(blue, 0);
- RG_DEF_METHOD(set_blue, 1);
- RG_DEF_METHOD(alpha, 0);
- RG_DEF_METHOD(set_alpha, 1);
- RG_DEF_METHOD(to_a, 0);
- RG_DEF_METHOD(to_s, 0);
- RG_DEF_METHOD_OPERATOR("==", equal, 1);
-}
diff --git a/gdk3/ext/gdk3/rbgdkscreen.c b/gdk3/ext/gdk3/rbgdkscreen.c
deleted file mode 100644
index 08efe23..0000000
--- a/gdk3/ext/gdk3/rbgdkscreen.c
+++ /dev/null
@@ -1,443 +0,0 @@
-/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
-/*
- * Copyright (C) 2011 Ruby-GNOME2 Project Team
- * Copyright (C) 2003-2006 Ruby-GNOME2 Project Team
- * Copyright (C) 2003 Geoff Youngs
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- */
-
-#include "rbgdk3private.h"
-#ifdef HAVE_RB_CAIRO_H
-#include <rb_cairo.h>
-#endif
-
-#define RG_TARGET_NAMESPACE cScreen
-#define _SELF(i) RVAL2GDKSCREEN(i)
-
-static ID id_new;
-
-static VALUE
-rg_s_default(G_GNUC_UNUSED VALUE self)
-{
- return GOBJ2RVAL(gdk_screen_get_default());
-}
-
-/* deprecated
-static VALUE
-rg_default_colormap(VALUE self)
-{
- return GOBJ2RVAL(gdk_screen_get_default_colormap(_SELF(self)));
-}
-
-static VALUE
-rg_set_default_colormap(VALUE self, VALUE colormap)
-{
- gdk_screen_set_default_colormap(_SELF(self),
- RVAL2GDKCOLORMAP(colormap));
- return self;
-}
-
-static VALUE
-rg_system_colormap(VALUE self)
-{
- return GOBJ2RVAL(gdk_screen_get_system_colormap(_SELF(self)));
-}
-*/
-
-static VALUE
-rg_system_visual(VALUE self)
-{
- return GOBJ2RVAL(gdk_screen_get_system_visual(_SELF(self)));
-}
-
-/* deprecated
-static VALUE
-rg_rgb_colormap(VALUE self)
-{
- return GOBJ2RVAL(gdk_screen_get_rgb_colormap(_SELF(self)));
-}
-
-static VALUE
-rg_rgb_visual(VALUE self)
-{
- return GOBJ2RVAL(gdk_screen_get_rgb_visual(_SELF(self)));
-}
-*/
-
-/* deprecated
-static VALUE
-rg_rgba_colormap(VALUE self)
-{
- return GOBJ2RVAL(gdk_screen_get_rgba_colormap(_SELF(self)));
-}
-*/
-
-static VALUE
-rg_rgba_visual(VALUE self)
-{
- return GOBJ2RVAL(gdk_screen_get_rgba_visual(_SELF(self)));
-}
-
-static VALUE
-rg_composited_p(VALUE self)
-{
- return CBOOL2RVAL(gdk_screen_is_composited(_SELF(self)));
-}
-
-static VALUE
-rg_root_window(VALUE self)
-{
- return GOBJ2RVAL(gdk_screen_get_root_window(_SELF(self)));
-}
-
-static VALUE
-rg_display(VALUE self)
-{
- return GOBJ2RVAL(gdk_screen_get_display(_SELF(self)));
-}
-
-static VALUE
-rg_number(VALUE self)
-{
- return INT2NUM(gdk_screen_get_number(_SELF(self)));
-}
-static VALUE
-rg_width(VALUE self)
-{
- return INT2NUM(gdk_screen_get_width(_SELF(self)));
-}
-static VALUE
-rg_height(VALUE self)
-{
- return INT2NUM(gdk_screen_get_height(_SELF(self)));
-}
-static VALUE
-rg_width_mm(VALUE self)
-{
- return INT2NUM(gdk_screen_get_width_mm(_SELF(self)));
-}
-static VALUE
-rg_height_mm(VALUE self)
-{
- return INT2NUM(gdk_screen_get_height_mm(_SELF(self)));
-}
-
-static VALUE
-rg_visuals(VALUE self)
-{
- return GOBJGLIST2RVAL_FREE(gdk_screen_list_visuals(_SELF(self)),
- g_list_free, NULL);
-}
-
-static VALUE
-rg_toplevel_windows(VALUE self)
-{
- return GOBJGLIST2RVAL_FREE(gdk_screen_get_toplevel_windows(_SELF(self)),
- g_list_free, NULL);
-}
-
-static VALUE
-rg_display_name(VALUE self)
-{
- gchar* name = gdk_screen_make_display_name(_SELF(self));
- VALUE ret = CSTR2RVAL(name);
- g_free(name);
- return ret;
-}
-
-static VALUE
-rg_n_monitors(VALUE self)
-{
- return INT2NUM(gdk_screen_get_n_monitors(_SELF(self)));
-}
-
-static VALUE
-rg_monitor_geometry(VALUE self, VALUE num)
-{
- GdkRectangle rect;
- gdk_screen_get_monitor_geometry(_SELF(self), NUM2INT(num), &rect);
- return GDKRECTANGLE2RVAL(&rect);
-}
-
-static VALUE
-rg_get_monitor(int argc, VALUE *argv, VALUE self)
-{
- VALUE arg1, arg2;
- VALUE ret;
-
- rb_scan_args(argc, argv, "11", &arg1, &arg2);
- if (argc == 2){
- ret = INT2NUM(gdk_screen_get_monitor_at_point(_SELF(self),
- NUM2INT(arg1), NUM2INT(arg2)));
- } else if (argc == 1){
- ret = INT2NUM(gdk_screen_get_monitor_at_window(_SELF(self),
- RVAL2GDKWINDOW(arg1)));
- } else {
- rb_raise(rb_eArgError, "Wrong number of arguments: %d", argc);
- }
- return ret;
-}
-
-/* deprecated
-static VALUE
-rg_broadcast_client_message(VALUE self, VALUE event)
-{
- gdk_screen_broadcast_client_message(_SELF(self), RVAL2GEV(event));
- return self;
-}
-*/
-
-/*
- type: String, Integer, Gdk::Color.
- */
-static VALUE
-rg_get_setting(int argc, VALUE *argv, VALUE self)
-{
- VALUE name, type;
- GType gtype;
- GValue val = G_VALUE_INIT;
- gboolean ret;
- VALUE value;
-
- rb_scan_args(argc, argv, "11", &name, &type);
- if (NIL_P(type))
- gtype = G_TYPE_STRING;
- else
- gtype = CLASS2GTYPE(type);
-
- g_value_init(&val, gtype);
- ret = gdk_screen_get_setting(_SELF(self), RVAL2CSTR(name), &val);
- value = ret ? GVAL2RVAL(&val) : Qnil;
- g_value_unset(&val);
- return value;
-}
-
-#ifdef HAVE_RB_CAIRO_H
-static VALUE
-gdkscreen_get_font_options(VALUE self)
-{
- return CRFONTOPTIONS2RVAL((cairo_font_options_t *)gdk_screen_get_font_options(_SELF(self)));
-}
-
-static VALUE
-gdkscreen_set_font_options(VALUE self, VALUE options)
-{
- gdk_screen_set_font_options(_SELF(self),
- (const cairo_font_options_t *)RVAL2CRFONTOPTIONS(options));
- return self;
-}
-#endif
-
-static VALUE
-rg_active_window(VALUE self)
-{
- return GOBJ2RVAL(gdk_screen_get_active_window(_SELF(self)));
-}
-
-static VALUE
-rg_window_stack(VALUE self)
-{
- GList* list = gdk_screen_get_window_stack(_SELF(self));
- VALUE ary = rb_ary_new();
- while (list) {
- rb_ary_push(ary, GOBJ2RVAL(list->data));
- g_object_unref(list->data);
- list = list->next;
- }
- g_list_free(list);
- return ary;
-}
-
-static void
-child_setup(gpointer func)
-{
- if (! NIL_P(func)){
- rb_funcall((VALUE)func, id_call, 0);
- }
-}
-
-/* deprecated
-static VALUE
-rg_spawn_on_screen(VALUE self, VALUE working_directory, VALUE argv, VALUE envp, VALUE flags)
-{
- GError *err = NULL;
- gboolean ret;
- gint child_pid;
- VALUE func = Qnil;
- gchar **gargv;
- gchar **genvp;
-
- if (rb_block_given_p()) {
- func = rb_block_proc();
- G_RELATIVE(self, func);
- }
-
- gargv = (gchar **)RVAL2STRV(argv);
- genvp = (gchar **)RVAL2STRV_ACCEPT_NIL(envp);
- ret = gdk_spawn_on_screen(_SELF(self),
- RVAL2CSTR_ACCEPT_NIL(working_directory),
- gargv, genvp, NUM2INT(flags),
- (GSpawnChildSetupFunc)child_setup, (gpointer)func,
- &child_pid, &err);
- g_free(gargv);
- g_free(genvp);
- if (!ret)
- RAISE_GERROR(err);
-
- return INT2NUM(child_pid);
-}
-
-static VALUE
-rg_spawn_on_screen_with_pipes(VALUE self, VALUE working_directory, VALUE argv, VALUE envp, VALUE flags)
-{
- GError *err = NULL;
- gboolean ret;
- gint child_pid;
- VALUE func = Qnil;
- gchar **gargv;
- gchar **genvp;
- gint standard_input, standard_output, standard_error;
-
- if (rb_block_given_p()) {
- func = rb_block_proc();
- G_RELATIVE(self, func);
- }
-
- gargv = (gchar **)RVAL2STRV(argv);
- genvp = (gchar **)RVAL2STRV_ACCEPT_NIL(envp);
- ret = gdk_spawn_on_screen_with_pipes(_SELF(self),
- RVAL2CSTR_ACCEPT_NIL(working_directory),
- gargv, genvp, NUM2INT(flags),
- (GSpawnChildSetupFunc)child_setup, (gpointer)func,
- &child_pid,
- &standard_input, &standard_output,
- &standard_error, &err);
- g_free(gargv);
- g_free(genvp);
- if (!ret)
- RAISE_GERROR(err);
-
- return rb_ary_new3(4, INT2NUM(child_pid),
- rb_funcall(rb_cIO, id_new, 1, INT2NUM(standard_input)),
- rb_funcall(rb_cIO, id_new, 1, INT2NUM(standard_output)),
- rb_funcall(rb_cIO, id_new, 1, INT2NUM(standard_error)));
-}
-*/
-
-static VALUE
-rg_spawn_command_line_on_screen(G_GNUC_UNUSED VALUE self, VALUE command_line)
-{
- GError *err = NULL;
- VALUE ret;
-
- ret = CBOOL2RVAL(g_spawn_command_line_async(RVAL2CSTR(command_line), &err));
- if (!ret) RAISE_GERROR(err);
-
- return ret;
-}
-
-/* From X Window System Interaction */
-#ifdef GDK_WINDOWING_X11
-#include <gdk/gdkx.h>
-static VALUE
-rg_xnumber(VALUE self)
-{
- return INT2NUM(GDK_SCREEN_XNUMBER(_SELF(self)));
-}
-static VALUE
-rg_supports_net_wm_hint_p(VALUE self, VALUE property)
-{
- return CBOOL2RVAL(gdk_x11_screen_supports_net_wm_hint(_SELF(self),
- RVAL2ATOM(property)));
-}
-
-static VALUE
-rg_window_manager_name(VALUE self)
-{
- return CSTR2RVAL(gdk_x11_screen_get_window_manager_name(_SELF(self)));
-}
-static VALUE
-rg_screen_number(VALUE self)
-{
- return INT2NUM(gdk_x11_screen_get_screen_number(_SELF(self)));
-}
-#endif
-
-void
-Init_gdk_screen(VALUE mGdk)
-{
- VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GDK_TYPE_SCREEN, "Screen", mGdk);
-
- id_new = rb_intern("new");
-
- RG_DEF_SMETHOD(default, 0);
-/* deprecated
- RG_DEF_METHOD(default_colormap, 0);
- RG_DEF_METHOD(set_default_colormap, 1);
- RG_DEF_METHOD(system_colormap, 0);
-*/
- RG_DEF_METHOD(system_visual, 0);
-/* deprecated
- RG_DEF_METHOD(rgb_colormap, 0);
- RG_DEF_METHOD(rgb_visual, 0);
-*/
-/* deprecated
- RG_DEF_METHOD(rgba_colormap, 0);
-*/
- RG_DEF_METHOD(rgba_visual, 0);
- RG_DEF_METHOD_P(composited, 0);
- RG_DEF_METHOD(root_window, 0);
- RG_DEF_METHOD(display, 0);
- RG_DEF_METHOD(number, 0);
- RG_DEF_METHOD(width, 0);
- RG_DEF_METHOD(height, 0);
- RG_DEF_METHOD(width_mm, 0);
- RG_DEF_METHOD(height_mm, 0);
- RG_DEF_METHOD(visuals, 0);
- RG_DEF_METHOD(toplevel_windows, 0);
- RG_DEF_METHOD(display_name, 0);
- RG_DEF_METHOD(n_monitors, 0);
- RG_DEF_METHOD(monitor_geometry, 1);
- RG_DEF_METHOD(get_monitor, -1);
-/* deprecated
- RG_DEF_METHOD(broadcast_client_message, 1);
-*/
- RG_DEF_METHOD(get_setting, -1);
-#ifdef HAVE_RB_CAIRO_H
- G_REPLACE_GET_PROPERTY(RG_TARGET_NAMESPACE, "font_options", gdkscreen_get_font_options, 0);
- G_REPLACE_SET_PROPERTY(RG_TARGET_NAMESPACE, "font_options", gdkscreen_set_font_options, 1);
-#endif
- RG_DEF_METHOD(active_window, 0);
- RG_DEF_METHOD(window_stack, 0);
-
-/* deprecated
- RG_DEF_METHOD(spawn_on_screen, 4);
- RG_DEF_METHOD(spawn_on_screen_with_pipes, 4);
-*/
- RG_DEF_METHOD(spawn_command_line_on_screen, 1);
-
-#ifdef GDK_WINDOWING_X11
- RG_DEF_METHOD(xnumber, 0);
- RG_DEF_METHOD_P(supports_net_wm_hint, 0);
- RG_DEF_METHOD(window_manager_name, 0);
- RG_DEF_METHOD(screen_number, 0);
-#endif
-
-#ifdef GDK_WINDOWING_X11
- G_DEF_CLASS3("GdkScreenX11", "ScreenX11", mGdk);
-#endif
-}
diff --git a/gdk3/ext/gdk3/rbgdkselection.c b/gdk3/ext/gdk3/rbgdkselection.c
deleted file mode 100644
index 29246ca..0000000
--- a/gdk3/ext/gdk3/rbgdkselection.c
+++ /dev/null
@@ -1,146 +0,0 @@
-/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
-/*
- * Copyright (C) 2011 Ruby-GNOME2 Project Team
- * Copyright (C) 2002-2004 Masao Mutoh
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- */
-
-#include "rbgdk3private.h"
-
-#define RG_TARGET_NAMESPACE mSelection
-
-static VALUE
-rg_s_owner_set(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
-{
- VALUE owner, selection, time, send_event;
- int ret;
-
- if (argc == 4){
- rb_scan_args(argc, argv, "40", &owner, &selection, &time, &send_event);
- ret = gdk_selection_owner_set(RVAL2GDKWINDOW(owner),
- RVAL2ATOM(selection),
- NUM2UINT(time), RVAL2CBOOL(send_event));
- } else {
- VALUE display = Qnil;
- rb_scan_args(argc, argv, "50", &display, &owner, &selection, &time, &send_event);
- ret = gdk_selection_owner_set_for_display(RVAL2GDKDISPLAYOBJECT(display),
- RVAL2GDKWINDOW(owner),
- RVAL2ATOM(selection),
- NUM2UINT(time), RVAL2CBOOL(send_event));
- }
- return CBOOL2RVAL(ret);
-}
-
-static VALUE
-rg_s_owner_get(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
-{
- VALUE selection;
-
- if (argc == 1) {
- rb_scan_args(argc, argv, "10", &selection);
- return GOBJ2RVAL(gdk_selection_owner_get(RVAL2ATOM(selection)));
- } else {
- VALUE display = Qnil;
- rb_scan_args(argc, argv, "20", &display, &selection);
- return GOBJ2RVAL(gdk_selection_owner_get_for_display(RVAL2GDKDISPLAYOBJECT(display),
- RVAL2ATOM(selection)));
- }
-}
-
-static VALUE
-rg_s_convert(VALUE self, VALUE requestor, VALUE selection, VALUE target, VALUE time)
-{
- gdk_selection_convert(RVAL2GDKWINDOW(requestor),
- RVAL2ATOM(selection),
- RVAL2ATOM(target), NUM2INT(time));
- return self;
-}
-
-static VALUE
-rg_s_property_get(G_GNUC_UNUSED VALUE self, VALUE requestor)
-{
- guchar *data;
- GdkAtom prop_type;
- gint prop_format;
- VALUE ary;
-
- gdk_selection_property_get(RVAL2GDKWINDOW(requestor), &data,
- &prop_type, &prop_format);
-
- ary = rb_ary_new3(3, CSTR2RVAL((const char*)data), GDKATOM2RVAL(prop_type),
- INT2NUM(prop_format));
- g_free(data);
- return ary;
-}
-
-static VALUE
-rg_s_send_notify(int argc, VALUE *argv, VALUE self)
-{
- VALUE requestor, selection, target, property, time;
-
- if (argc == 5) {
- rb_scan_args(argc, argv, "50", &requestor, &selection, &target, &property, &time);
- gdk_selection_send_notify(RVAL2GDKWINDOW(requestor), RVAL2ATOM(selection),
- RVAL2ATOM(target),
- NIL_P(property) ? GDK_NONE : RVAL2ATOM(property),
- NUM2INT(time));
- } else {
- VALUE display = Qnil;
- rb_scan_args(argc, argv, "60", &display, &requestor, &selection, &target, &property, &time);
- gdk_selection_send_notify_for_display(RVAL2GDKDISPLAYOBJECT(display),
- RVAL2GDKWINDOW(requestor), RVAL2ATOM(selection),
- RVAL2ATOM(target),
- NIL_P(property) ? GDK_NONE : RVAL2ATOM(property),
- NUM2INT(time));
- }
- return self;
-}
-
-void
-Init_gdk_selection(VALUE mGdk)
-{
- VALUE RG_TARGET_NAMESPACE = rb_define_module_under(mGdk, "Selection");
-
- RG_DEF_SMETHOD(owner_set, -1);
- RG_DEF_SMETHOD(owner_get, -1);
- RG_DEF_SMETHOD(convert, 4);
- RG_DEF_SMETHOD(property_get, 1);
- RG_DEF_SMETHOD(send_notify, -1);
-
- /* Constants */
- rb_define_const(RG_TARGET_NAMESPACE, "PRIMARY", GDKATOM2RVAL(GDK_SELECTION_PRIMARY));
- rb_define_const(RG_TARGET_NAMESPACE, "SECONDARY", GDKATOM2RVAL(GDK_SELECTION_SECONDARY));
- rb_define_const(RG_TARGET_NAMESPACE, "CLIPBOARD", GDKATOM2RVAL(GDK_SELECTION_CLIPBOARD));
-
- /* GdkSelectionType */
- rb_define_const(RG_TARGET_NAMESPACE, "TYPE_ATOM", GDKATOM2RVAL(GDK_SELECTION_TYPE_ATOM));
- rb_define_const(RG_TARGET_NAMESPACE, "TYPE_BITMAP", GDKATOM2RVAL(GDK_SELECTION_TYPE_BITMAP));
- rb_define_const(RG_TARGET_NAMESPACE, "TYPE_COLORMAP", GDKATOM2RVAL(GDK_SELECTION_TYPE_COLORMAP));
- rb_define_const(RG_TARGET_NAMESPACE, "TYPE_DRAWABLE", GDKATOM2RVAL(GDK_SELECTION_TYPE_DRAWABLE));
- rb_define_const(RG_TARGET_NAMESPACE, "TYPE_INTEGER", GDKATOM2RVAL(GDK_SELECTION_TYPE_INTEGER));
- rb_define_const(RG_TARGET_NAMESPACE, "TYPE_PIXMAP", GDKATOM2RVAL(GDK_SELECTION_TYPE_PIXMAP));
- rb_define_const(RG_TARGET_NAMESPACE, "TYPE_WINDOW", GDKATOM2RVAL(GDK_SELECTION_TYPE_WINDOW));
- rb_define_const(RG_TARGET_NAMESPACE, "TYPE_STRING", GDKATOM2RVAL(GDK_SELECTION_TYPE_STRING));
-
- /* GdkTarget */
- rb_define_const(RG_TARGET_NAMESPACE, "TARGET_BITMAP", GDKATOM2RVAL(GDK_TARGET_BITMAP));
- rb_define_const(RG_TARGET_NAMESPACE, "TARGET_COLORMAP", GDKATOM2RVAL(GDK_TARGET_COLORMAP));
- rb_define_const(RG_TARGET_NAMESPACE, "TARGET_DRAWABLE", GDKATOM2RVAL(GDK_TARGET_DRAWABLE));
- rb_define_const(RG_TARGET_NAMESPACE, "TARGET_PIXMAP", GDKATOM2RVAL(GDK_TARGET_PIXMAP));
- rb_define_const(RG_TARGET_NAMESPACE, "TARGET_STRING", GDKATOM2RVAL(GDK_TARGET_STRING));
-
-}
diff --git a/gdk3/ext/gdk3/rbgdkthreads.c b/gdk3/ext/gdk3/rbgdkthreads.c
deleted file mode 100644
index 59aa46f..0000000
--- a/gdk3/ext/gdk3/rbgdkthreads.c
+++ /dev/null
@@ -1,77 +0,0 @@
-/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
-/*
- * Copyright (C) 2011 Ruby-GNOME2 Project Team
- * Copyright (C) 2003-2005 Masao Mutoh
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- */
-
-#include "rbgdk3private.h"
-
-#ifdef G_THREADS_ENABLED
-
-#define RG_TARGET_NAMESPACE mThreads
-
-static VALUE
-rg_s_init(VALUE self)
-{
-#ifndef GDK_WINDOWING_WIN32
- if (!g_thread_supported()){
- g_thread_init(NULL);
- }
- gdk_threads_init();
-#endif
- return self;
-}
-
-static VALUE
-rg_s_enter(VALUE self)
-{
- gdk_threads_enter();
- return self;
-}
-
-static VALUE
-rg_s_leave(VALUE self)
-{
- gdk_threads_leave();
- return self;
-}
-
-static VALUE
-rg_s_synchronize(G_GNUC_UNUSED VALUE self)
-{
- VALUE func = rb_block_proc();
- gdk_threads_enter();
- func = rb_block_proc();
- rb_funcall(func, id_call, 0);
- gdk_threads_leave();
- return Qnil;
-}
-#endif
-
-void
-Init_gdk_threads(VALUE mGdk)
-{
-#ifdef G_THREADS_ENABLED
- VALUE RG_TARGET_NAMESPACE = rb_define_module_under(mGdk, "Threads");
-
- RG_DEF_SMETHOD(init, 0);
- RG_DEF_SMETHOD(enter, 0);
- RG_DEF_SMETHOD(leave, 0);
- RG_DEF_SMETHOD(synchronize, 0);
-#endif
-}
diff --git a/gdk3/ext/gdk3/rbgdktimecoord.c b/gdk3/ext/gdk3/rbgdktimecoord.c
deleted file mode 100644
index 10c4ee2..0000000
--- a/gdk3/ext/gdk3/rbgdktimecoord.c
+++ /dev/null
@@ -1,133 +0,0 @@
-/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
-/*
- * Copyright (C) 2011 Ruby-GNOME2 Project Team
- * Copyright (C) 2003 Masao Mutoh
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- */
-
-#include "rbgdk3private.h"
-
-#define RG_TARGET_NAMESPACE cTimeCoord
-#define _SELF(s) (RVAL2GDKTIMECOORD(s))
-
-/**********************************/
-static GdkTimeCoord*
-timecoord_copy(const GdkTimeCoord* val)
-{
- GdkTimeCoord* new_val;
- g_return_val_if_fail (val != NULL, NULL);
- new_val = g_new(GdkTimeCoord, 1);
- *new_val = *val;
- return new_val;
-}
-
-GType
-gdk_timecoord_get_type(void)
-{
- static GType our_type = 0;
-
- if (our_type == 0)
- our_type = g_boxed_type_register_static ("GdkTimeCoord",
- (GBoxedCopyFunc)timecoord_copy,
- (GBoxedFreeFunc)g_free);
- return our_type;
-}
-/**********************************/
-
-static VALUE
-rg_initialize(VALUE self, VALUE rbtime, VALUE rbaxes)
-{
- guint32 time = NUM2UINT(rbtime);
- long n;
- gdouble *axes = RVAL2GDOUBLES(rbaxes, n);
- GdkTimeCoord *coord;
-
- if (n > GDK_MAX_TIMECOORD_AXES) {
- g_free(axes);
-
- rb_raise(rb_eArgError,
- "axes out of range: %ld (0..%d)",
- n, GDK_MAX_TIMECOORD_AXES);
- }
-
- coord = g_new(GdkTimeCoord, 1);
- coord->time = time;
- MEMCPY(coord->axes, axes, gdouble, n);
-
- g_free(axes);
-
- G_INITIALIZE(self, coord);
-
- return Qnil;
-}
-
-static VALUE
-rg_time(VALUE self)
-{
- return UINT2NUM(_SELF(self)->time);
-}
-
-static VALUE
-rg_set_time(VALUE self, VALUE time)
-{
- _SELF(self)->time = NUM2UINT(time);
- return self;
-}
-
-static VALUE
-rg_axes(VALUE self)
-{
- VALUE ary = rb_ary_new();
- int i;
- for (i = 0; i < GDK_MAX_TIMECOORD_AXES; i++){
- rb_ary_push(ary, rb_float_new(_SELF(self)->axes[i]));
- }
- return ary;
-}
-
-static VALUE
-rg_set_axes(VALUE self, VALUE rbaxes)
-{
- GdkTimeCoord *coord = _SELF(self);
- VALUE axes = rb_ary_to_ary(rbaxes);
- long i;
- long n = RARRAY_LEN(axes);
-
- if (n < 0 || n > GDK_MAX_TIMECOORD_AXES)
- rb_raise(rb_eArgError,
- "axes out of range: %ld (0..%d)",
- n, GDK_MAX_TIMECOORD_AXES);
-
- for (i = 0; i < n; i++)
- coord->axes[i] = NUM2DBL(RARRAY_PTR(axes)[i]);
-
- return self;
-}
-
-void
-Init_gdk_timecoord(VALUE mGdk)
-{
- VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GDK_TYPE_TIME_COORD, "TimeCoord", mGdk);
-
- RG_DEF_METHOD(initialize, 2);
- RG_DEF_METHOD(time, 0);
- RG_DEF_METHOD(set_time, 1);
- RG_DEF_METHOD(axes, 0);
- RG_DEF_METHOD(set_axes, 1);
-
- rb_define_const(RG_TARGET_NAMESPACE, "MAX_AXES", INT2NUM(GDK_MAX_TIMECOORD_AXES));
-}
diff --git a/gdk3/ext/gdk3/rbgdkvisual.c b/gdk3/ext/gdk3/rbgdkvisual.c
deleted file mode 100644
index 4d76d8c..0000000
--- a/gdk3/ext/gdk3/rbgdkvisual.c
+++ /dev/null
@@ -1,251 +0,0 @@
-/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
-/*
- * Copyright (C) 2011 Ruby-GNOME2 Project Team
- * Copyright (C) 2002-2004 Masao Mutoh
- * Copyright (C) 1998-2000 Yukihiro Matsumoto,
- * Daisuke Kanda,
- * Hiroshi Igarashi
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- */
-
-#include "rbgdk3private.h"
-
-#define RG_TARGET_NAMESPACE cVisual
-#define _SELF(self) (RVAL2GDKVISUAL(self))
-
-static VALUE
-rg_s_query_depths(G_GNUC_UNUSED VALUE self)
-{
- gint *depth;
- gint count;
- VALUE ary;
- int i;
-
- gdk_query_depths(&depth, &count);
- ary = rb_ary_new2(count);
- for (i = 0; i < count; i++) {
- rb_ary_push(ary, INT2NUM((depth)[i]));
- }
- return ary;
-}
-
-static VALUE
-rg_s_query_visual_types(G_GNUC_UNUSED VALUE self)
-{
- GdkVisualType *visual_types;
- gint count;
- VALUE ary;
- int i;
-
- gdk_query_visual_types(&visual_types, &count);
- ary = rb_ary_new2(count);
- for (i = 0; i < count; i++) {
- rb_ary_push(ary, GDKVISUALTYPE2RVAL((visual_types)[i]));
- }
- return ary;
-}
-
-static VALUE
-rg_s_visuals(G_GNUC_UNUSED VALUE self)
-{
- GList *list = gdk_list_visuals(), *cur;
- VALUE ary = rb_ary_new();
-
- for (cur = list; cur != NULL; cur = cur->next) {
- rb_ary_push(ary, GOBJ2RVAL((GdkVisual *)cur->data));
- }
- g_list_free(list);
- return ary;
-}
-
-static VALUE
-rg_s_best_depth(G_GNUC_UNUSED VALUE self)
-{
- return INT2NUM(gdk_visual_get_best_depth());
-}
-
-static VALUE
-rg_s_best_type(G_GNUC_UNUSED VALUE self)
-{
- return INT2NUM(gdk_visual_get_best_type());
-}
-
-static VALUE
-rg_s_system(G_GNUC_UNUSED VALUE self)
-{
- return GOBJ2RVAL(gdk_visual_get_system());
-}
-
-static VALUE
-rg_s_best(G_GNUC_UNUSED VALUE self)
-{
- return GOBJ2RVAL(gdk_visual_get_best());
-}
-
-static VALUE
-rg_s_best_with_depth(G_GNUC_UNUSED VALUE self, VALUE depth)
-{
- return GOBJ2RVAL(gdk_visual_get_best_with_depth(NUM2INT(depth)));
-}
-
-static VALUE
-rg_s_best_with_type(G_GNUC_UNUSED VALUE self, VALUE type)
-{
- return GOBJ2RVAL(gdk_visual_get_best_with_depth(
- (GdkVisualType)GDKVISUALTYPE2RVAL(type)));
-}
-
-static VALUE
-rg_s_best_with_both(G_GNUC_UNUSED VALUE self, VALUE depth, VALUE type)
-{
- return GOBJ2RVAL(gdk_visual_get_best_with_both(
- NUM2INT(depth),
- (GdkVisualType)RVAL2GDKVISUALTYPE(type)));
-}
-
-static VALUE
-rg_screen(VALUE self)
-{
- return GOBJ2RVAL(gdk_visual_get_screen(_SELF(self)));
-}
-
-/* Structure accessors */
-static VALUE
-rg_visual_type(VALUE self)
-{
- return GDKVISUALTYPE2RVAL(gdk_visual_get_visual_type(_SELF(self)));
-}
-
-static VALUE
-rg_depth(VALUE self)
-{
- return INT2FIX(gdk_visual_get_depth(_SELF(self)));
-}
-
-static VALUE
-rg_byte_order(VALUE self)
-{
- return GDKBYTEORDER2RVAL(gdk_visual_get_byte_order(_SELF(self)));
-}
-
-static VALUE
-rg_colormap_size(VALUE self)
-{
- return INT2FIX(gdk_visual_get_colormap_size(_SELF(self)));
-}
-
-static VALUE
-rg_bits_per_rgb(VALUE self)
-{
- return INT2FIX(gdk_visual_get_bits_per_rgb(_SELF(self)));
-}
-
-/* TODO
-static VALUE
-rg_red_mask(VALUE self)
-{
- return INT2FIX(_SELF(self)->red_mask);
-}
-
-static VALUE
-rg_red_shift(VALUE self)
-{
- return INT2FIX(_SELF(self)->red_shift);
-}
-
-static VALUE
-rg_red_prec(VALUE self)
-{
- return INT2FIX(_SELF(self)->red_prec);
-}
-
-static VALUE
-rg_green_mask(VALUE self)
-{
- return INT2FIX(_SELF(self)->green_mask);
-}
-
-static VALUE
-rg_green_shift(VALUE self)
-{
- return INT2FIX(_SELF(self)->green_shift);
-}
-
-static VALUE
-rg_green_prec(VALUE self)
-{
- return INT2FIX(_SELF(self)->green_prec);
-}
-
-static VALUE
-rg_blue_mask(VALUE self)
-{
- return INT2FIX(_SELF(self)->blue_mask);
-}
-
-static VALUE
-rg_blue_shift(VALUE self)
-{
- return INT2FIX(_SELF(self)->blue_shift);
-}
-
-static VALUE
-rg_blue_prec(VALUE self)
-{
- return INT2FIX(_SELF(self)->blue_prec);
-}
-*/
-
-void
-Init_gdk_visual(VALUE mGdk)
-{
- VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GDK_TYPE_VISUAL, "Visual", mGdk);
-
- /* class methods */
- RG_DEF_SMETHOD(query_depths, 0);
- RG_DEF_SMETHOD(query_visual_types, 0);
- RG_DEF_SMETHOD(visuals, 0);
- RG_DEF_SMETHOD(best_depth, 0);
- RG_DEF_SMETHOD(best_type, 0);
- RG_DEF_SMETHOD(system, 0);
- RG_DEF_SMETHOD(best, 0);
- RG_DEF_SMETHOD(best_with_depth, 1);
- RG_DEF_SMETHOD(best_with_type, 1);
- RG_DEF_SMETHOD(best_with_both, 2);
-
- /* instance methods */
- RG_DEF_METHOD(screen, 0);
- RG_DEF_METHOD(visual_type, 0);
- RG_DEF_METHOD(depth, 0);
- RG_DEF_METHOD(byte_order, 0);
- RG_DEF_METHOD(colormap_size, 0);
- RG_DEF_METHOD(bits_per_rgb, 0);
-/* TODO
- RG_DEF_METHOD(red_mask, 0);
- RG_DEF_METHOD(red_shift, 0);
- RG_DEF_METHOD(red_prec, 0);
- RG_DEF_METHOD(green_mask, 0);
- RG_DEF_METHOD(green_shift, 0);
- RG_DEF_METHOD(green_prec, 0);
- RG_DEF_METHOD(blue_mask, 0);
- RG_DEF_METHOD(blue_shift, 0);
- RG_DEF_METHOD(blue_prec, 0);
-*/
-
- G_DEF_CLASS(GDK_TYPE_VISUAL_TYPE, "Type", RG_TARGET_NAMESPACE);
- G_DEF_CLASS(GDK_TYPE_BYTE_ORDER, "ByteOrder", RG_TARGET_NAMESPACE);
-}
diff --git a/gdk3/ext/gdk3/rbgdkwindow.c b/gdk3/ext/gdk3/rbgdkwindow.c
deleted file mode 100644
index 1861c16..0000000
--- a/gdk3/ext/gdk3/rbgdkwindow.c
+++ /dev/null
@@ -1,1069 +0,0 @@
-/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
-/*
- * Copyright (C) 2002-2013 Ruby-GNOME2 Project Team
- * Copyright (C) 1998-2000 Yukihiro Matsumoto,
- * Daisuke Kanda,
- * Hiroshi Igarashi
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- */
-
-#include "rbgdk3private.h"
-
-#ifdef HAVE_RB_CAIRO_H
-#include <rb_cairo.h>
-#endif
-
-#define RG_TARGET_NAMESPACE cWindow
-#define _SELF(s) RVAL2GDKWINDOW(s)
-
-static VALUE
-rg_initialize(VALUE self, VALUE parent, VALUE attributes, VALUE attributes_mask)
-{
- GdkWindow *win;
- win = gdk_window_new(NIL_P(parent) ? NULL : _SELF(parent),
- RVAL2GDKWINDOWATTR(attributes),
- RVAL2GDKWINDOWATTRIBUTESTYPE(attributes_mask));
- G_INITIALIZE(self, win);
-
- return Qnil;
-}
-
-static VALUE
-rg_destroy(VALUE self)
-{
- gdk_window_destroy(_SELF(self));
- return Qnil;
-}
-
-static VALUE
-rg_window_type(VALUE self)
-{
- return GDKWINDOWTYPE2RVAL(gdk_window_get_window_type(_SELF(self)));
-}
-
-static VALUE
-rg_display(VALUE self)
-{
- return GOBJ2RVAL(gdk_window_get_display(_SELF(self)));
-}
-
-static VALUE
-rg_show(VALUE self)
-{
- gdk_window_show(_SELF(self));
- return self;
-}
-
-static VALUE
-rg_show_unraised(VALUE self)
-{
- gdk_window_show_unraised(_SELF(self));
- return self;
-}
-
-static VALUE
-rg_hide(VALUE self)
-{
- gdk_window_hide(_SELF(self));
- return Qnil;
-}
-
-static VALUE
-rg_visible_p(VALUE self)
-{
- return CBOOL2RVAL(gdk_window_is_visible(_SELF(self)));
-}
-
-static VALUE
-rg_viewable_p(VALUE self)
-{
- return CBOOL2RVAL(gdk_window_is_viewable(_SELF(self)));
-}
-
-static VALUE
-rg_state(VALUE self)
-{
- return GDKWINDOWSTATE2RVAL(gdk_window_get_state(_SELF(self)));
-}
-
-static VALUE
-rg_withdraw(VALUE self)
-{
- gdk_window_withdraw(_SELF(self));
- return Qnil;
-}
-
-static VALUE
-rg_iconify(VALUE self)
-{
- gdk_window_iconify(_SELF(self));
- return self;
-}
-
-static VALUE
-rg_deiconify(VALUE self)
-{
- gdk_window_deiconify(_SELF(self));
- return self;
-}
-
-static VALUE
-rg_stick(VALUE self)
-{
- gdk_window_stick(_SELF(self));
- return self;
-}
-
-static VALUE
-rg_unstick(VALUE self)
-{
- gdk_window_unstick(_SELF(self));
- return self;
-}
-
-static VALUE
-rg_maximize(VALUE self)
-{
- gdk_window_maximize(_SELF(self));
- return self;
-}
-
-static VALUE
-rg_unmaximize(VALUE self)
-{
- gdk_window_unmaximize(_SELF(self));
- return self;
-}
-
-static VALUE
-rg_fullscreen(VALUE self)
-{
- gdk_window_fullscreen(_SELF(self));
- return self;
-}
-
-static VALUE
-rg_unfullscreen(VALUE self)
-{
- gdk_window_unfullscreen(_SELF(self));
- return self;
-}
-
-static VALUE
-rg_set_keep_above(VALUE self, VALUE setting)
-{
- gdk_window_set_keep_above(_SELF(self), RVAL2CBOOL(setting));
- return self;
-}
-
-static VALUE
-rg_set_keep_below(VALUE self, VALUE setting)
-{
- gdk_window_set_keep_below(_SELF(self), RVAL2CBOOL(setting));
- return self;
-}
-
-static VALUE
-rg_move(VALUE self, VALUE x, VALUE y)
-{
- gdk_window_move(_SELF(self), NUM2INT(x), NUM2INT(y));
- return self;
-}
-
-static VALUE
-rg_resize(VALUE self, VALUE w, VALUE h)
-{
- gdk_window_resize(_SELF(self), NUM2INT(w), NUM2INT(h));
- return self;
-}
-
-static VALUE
-rg_move_resize(VALUE self, VALUE x, VALUE y, VALUE w, VALUE h)
-{
- gdk_window_move_resize(_SELF(self), NUM2INT(x), NUM2INT(y), NUM2INT(w), NUM2INT(h));
- return self;
-}
-
-static VALUE
-rg_scroll(VALUE self, VALUE dx, VALUE dy)
-{
- gdk_window_scroll(_SELF(self), NUM2INT(dx), NUM2INT(dy));
- return self;
-}
-
-static VALUE
-rg_move_region(VALUE self, VALUE region, VALUE dx, VALUE dy)
-{
- gdk_window_move_region(_SELF(self),
- RVAL2CRREGION(region),
- NUM2INT(dx),
- NUM2INT(dy));
- return self;
-}
-
-static VALUE
-rg_reparent(VALUE self, VALUE new_parent, VALUE x, VALUE y)
-{
- gdk_window_reparent(_SELF(self), _SELF(new_parent), NUM2INT(x), NUM2INT(y));
- return self;
-}
-
-static VALUE
-rg_raise(VALUE self)
-{
- gdk_window_raise(_SELF(self));
- return self;
-}
-
-static VALUE
-rg_lower(VALUE self)
-{
- gdk_window_lower(_SELF(self));
- return self;
-}
-
-static VALUE
-rg_focus(VALUE self, VALUE timestamp)
-{
- gdk_window_focus(_SELF(self), NUM2UINT(timestamp));
- return self;
-}
-
-static VALUE
-rg_register_dnd(VALUE self)
-{
- gdk_window_register_dnd(_SELF(self));
- return self;
-}
-
-static VALUE
-rg_begin_resize_drag(VALUE self, VALUE edge, VALUE button, VALUE root_x, VALUE root_y, VALUE timestamp)
-{
- gdk_window_begin_resize_drag(_SELF(self),
- RVAL2GDKWINDOWEDGE(edge),
- NUM2INT(button),
- NUM2INT(root_x), NUM2INT(root_y),
- NUM2UINT(timestamp));
- return self;
-}
-
-static VALUE
-rg_begin_move_drag(VALUE self, VALUE button, VALUE root_x, VALUE root_y, VALUE timestamp)
-{
- gdk_window_begin_move_drag(_SELF(self), NUM2INT(button),
- NUM2INT(root_x), NUM2INT(root_y),
- NUM2UINT(timestamp));
- return self;
-}
-
-static VALUE
-rg_s_constrain_size(G_GNUC_UNUSED VALUE self, VALUE geometry, VALUE flags, VALUE w, VALUE h)
-{
- gint new_width, new_height;
- gdk_window_constrain_size(RVAL2GDKGEOMETRY(geometry),
- RVAL2GDKWINDOWHINTS(flags),
- NUM2INT(w), NUM2INT(h), &new_width, &new_height);
- return rb_assoc_new(INT2NUM(new_width), INT2NUM(new_height));
-}
-
-static VALUE
-rg_beep(VALUE self)
-{
- gdk_window_beep(_SELF(self));
- return self;
-}
-
-static VALUE
-rg_begin_paint(VALUE self, VALUE area)
-{
- if (rb_obj_is_kind_of(area, GTYPE2CLASS(GDK_TYPE_RECTANGLE))){
- gdk_window_begin_paint_rect(_SELF(self),
- RVAL2GDKRECTANGLE(area));
- } else {
- gdk_window_begin_paint_region(_SELF(self), RVAL2CRREGION(area));
- }
- return self;
-}
-
-static VALUE
-rg_end_paint(VALUE self)
-{
- gdk_window_end_paint(_SELF(self));
- return self;
-}
-
-static VALUE
-rg_invalidate(VALUE self, VALUE area, VALUE invalidate_children)
-{
- if (rb_obj_is_kind_of(area, GTYPE2CLASS(GDK_TYPE_RECTANGLE))){
- gdk_window_invalidate_rect(_SELF(self),
- RVAL2GDKRECTANGLE(area),
- RVAL2CBOOL(invalidate_children));
- } else {
- gdk_window_invalidate_region(_SELF(self),
- RVAL2CRREGION(area),
- RVAL2CBOOL(invalidate_children));
- }
- return self;
-}
-
-static gboolean
-invalidate_child_func_wrap(GdkWindow *window, VALUE func)
-{
- VALUE result = rb_funcall(func, id_call, 1, GOBJ2RVAL(window));
- return RVAL2CBOOL(result);
-}
-
-static VALUE
-rg_invalidate_maybe_recurse(VALUE self, VALUE region)
-{
- VALUE func = (VALUE)NULL;
- if (rb_block_given_p()){
- func = rb_block_proc();
- G_RELATIVE(self, func);
- }
- gdk_window_invalidate_maybe_recurse(_SELF(self),
- RVAL2CRREGION(region),
- (GdkWindowChildFunc)invalidate_child_func_wrap,
- (gpointer)func);
- return self;
-}
-
-static VALUE
-rg_update_area(VALUE self)
-{
- return CRREGION2RVAL(gdk_window_get_update_area(_SELF(self)));
-}
-
-static VALUE
-rg_freeze_updates(VALUE self)
-{
- gdk_window_freeze_updates(_SELF(self));
- return self;
-}
-
-static VALUE
-rg_thaw_updates(VALUE self)
-{
- gdk_window_thaw_updates(_SELF(self));
- return self;
-}
-
-static VALUE
-rg_s_process_all_updates(VALUE self)
-{
- gdk_window_process_all_updates();
- return self;
-}
-
-static VALUE
-rg_process_updates(VALUE self, VALUE update_children)
-{
- gdk_window_process_updates(_SELF(self), RVAL2CBOOL(update_children));
- return self;
-}
-
-static VALUE
-rg_s_set_debug_updates(VALUE self, VALUE setting)
-{
- gdk_window_set_debug_updates(RVAL2CBOOL(setting));
- return self;
-}
-
-static VALUE
-rg_configure_finished(VALUE self)
-{
- gdk_window_configure_finished(_SELF(self));
- return self;
-}
-
-static VALUE
-rg_enable_synchronized_configure(VALUE self)
-{
- gdk_window_enable_synchronized_configure(_SELF(self));
-
- if (rb_block_given_p()) {
- rb_ensure(rb_yield, self, rg_configure_finished, self);
- }
- return self;
-}
-
-static VALUE
-rg_set_user_data(VALUE self, VALUE user_data)
-{
- gdk_window_set_user_data(_SELF(self), (gpointer)RVAL2GOBJ(user_data));
- return self;
-}
-
-static VALUE
-rg_set_override_redirect(VALUE self, VALUE override_redirect)
-{
- gdk_window_set_override_redirect(_SELF(self),
- RVAL2CBOOL(override_redirect));
- return self;
-}
-
-static VALUE
-rg_set_accept_focus(VALUE self, VALUE accept_focus)
-{
- gdk_window_set_accept_focus(_SELF(self), RVAL2CBOOL(accept_focus));
- return self;
-}
-
-static VALUE
-rg_set_focus_on_map(VALUE self, VALUE focus_on_map)
-{
- gdk_window_set_focus_on_map(_SELF(self), RVAL2CBOOL(focus_on_map));
- return self;
-}
-
-static VALUE
-rg_shape_combine_region(VALUE self, VALUE shape_region, VALUE offset_x, VALUE offset_y)
-{
- gdk_window_shape_combine_region(_SELF(self),
- NIL_P(shape_region) ? NULL : RVAL2CRREGION(shape_region),
- INT2NUM(offset_x), INT2NUM(offset_y));
- return self;
-}
-
-static VALUE
-rg_set_child_shapes(VALUE self)
-{
- gdk_window_set_child_shapes(_SELF(self));
- return self;
-}
-
-static VALUE
-rg_merge_child_shapes(VALUE self)
-{
- gdk_window_merge_child_shapes(_SELF(self));
- return self;
-}
-
-static VALUE
-rg_input_shape_combine_region(VALUE self, VALUE shape_region, VALUE offset_x, VALUE offset_y)
-{
- gdk_window_input_shape_combine_region(_SELF(self),
- RVAL2CRREGION(shape_region),
- NUM2INT(offset_x),
- NUM2INT(offset_y));
- return self;
-}
-
-static VALUE
-rg_set_child_input_shapes(VALUE self)
-{
- gdk_window_set_child_input_shapes(_SELF(self));
- return self;
-}
-
-static VALUE
-rg_merge_child_input_shapes(VALUE self)
-{
- gdk_window_merge_child_input_shapes(_SELF(self));
- return self;
-}
-
-static VALUE
-rg_set_static_gravities(VALUE self, VALUE use_static)
-{
- gboolean ret = gdk_window_set_static_gravities(_SELF(self),
- RVAL2CBOOL(use_static));
- if (! ret)
- rb_raise(rb_eRuntimeError, "couldn't turn on static gravity");
-
- return self;
-}
-
-static VALUE
-rg_set_title(VALUE self, VALUE title)
-{
- gdk_window_set_title(_SELF(self),RVAL2CSTR(title));
- return self;
-}
-
-static VALUE
-rg_set_background(VALUE self, VALUE color)
-{
- gdk_window_set_background(_SELF(self), RVAL2GDKCOLOR(color));
- return self;
-}
-
-static VALUE
-rg_user_data(VALUE self)
-{
- GObject *data = NULL;
- gdk_window_get_user_data(_SELF(self), (gpointer)&data);
- return GOBJ2RVAL(data);
-}
-
-static VALUE
-rg_geometry(VALUE self)
-{
- gint x, y, w, h;
- gdk_window_get_geometry(_SELF(self), &x, &y, &w, &h);
- return rb_ary_new3(4, INT2NUM(x), INT2NUM(y),
- INT2NUM(w), INT2NUM(h));
-}
-
-static VALUE
-rg_set_geometry_hints(VALUE self, VALUE geometry, VALUE geom_mask)
-{
- gdk_window_set_geometry_hints(_SELF(self),
- NIL_P(geometry) ? (GdkGeometry*)NULL : RVAL2GDKGEOMETRY(geometry),
- RVAL2GDKWINDOWHINTS(geom_mask));
- return self;
-}
-
-static VALUE
-rg_width(VALUE self)
-{
- return INT2NUM(gdk_window_get_width(_SELF(self)));
-}
-
-static VALUE
-rg_height(VALUE self)
-{
- return INT2NUM(gdk_window_get_height(_SELF(self)));
-}
-
-static VALUE
-rg_set_icon_list(VALUE self, VALUE rbpixbufs)
-{
- GdkWindow *window = _SELF(self);
- GList *pixbufs = RVAL2GDKPIXBUFGLIST(rbpixbufs);
-
- gdk_window_set_icon_list(window, pixbufs);
-
- g_list_free(pixbufs);
-
- return self;
-}
-
-static VALUE
-rg_set_modal_hint(VALUE self, VALUE modal)
-{
- gdk_window_set_modal_hint(_SELF(self), RVAL2CBOOL(modal));
- return self;
-}
-
-static VALUE
-rg_set_type_hint(VALUE self, VALUE hint)
-{
- gdk_window_set_type_hint(_SELF(self), RVAL2GDKWINDOWHINT(hint));
- return self;
-}
-
-static VALUE
-rg_type_hint(VALUE self)
-{
- return GDKWINDOWHINT2RVAL(gdk_window_get_type_hint(_SELF(self)));
-}
-
-static VALUE
-rg_set_skip_taskbar_hint(VALUE self, VALUE hint)
-{
- gdk_window_set_skip_taskbar_hint(_SELF(self), RVAL2CBOOL(hint));
- return self;
-}
-
-static VALUE
-rg_set_skip_pager_hint(VALUE self, VALUE hint)
-{
- gdk_window_set_skip_pager_hint(_SELF(self), RVAL2CBOOL(hint));
- return self;
-}
-
-static VALUE
-rg_set_urgency_hint(VALUE self, VALUE hint)
-{
- gdk_window_set_urgency_hint(_SELF(self), RVAL2CBOOL(hint));
- return self;
-}
-
-static VALUE
-rg_position(VALUE self)
-{
- gint x, y;
- gdk_window_get_position(_SELF(self), &x, &y);
- return rb_assoc_new(INT2NUM(x), INT2NUM(y));
-}
-
-static VALUE
-rg_root_origin(VALUE self)
-{
- int x, y;
- gdk_window_get_root_origin(_SELF(self), &x, &y);
- return rb_assoc_new(INT2FIX(x), INT2FIX(y));
-}
-
-static VALUE
-rg_frame_extents(VALUE self)
-{
- GdkRectangle rect;
- gdk_window_get_frame_extents(_SELF(self), &rect);
- return GDKRECTANGLE2RVAL(&rect);
-}
-
-static VALUE
-rg_origin(VALUE self)
-{
- gint x, y;
- gdk_window_get_origin(_SELF(self), &x, &y);
- return rb_assoc_new(INT2NUM(x), INT2NUM(y));
-}
-
-static VALUE
-rg_parent(VALUE self)
-{
- return GOBJ2RVAL(gdk_window_get_parent(_SELF(self)));
-}
-
-static VALUE
-rg_toplevel(VALUE self)
-{
- return GOBJ2RVAL(gdk_window_get_toplevel(_SELF(self)));
-}
-
-static VALUE
-rg_children(VALUE self)
-{
- /* Don't use gdk_window_get_children() here */
- GList *list = gdk_window_peek_children(_SELF(self));
- VALUE ary = rb_ary_new();
- while (list) {
- rb_ary_push(ary, GOBJ2RVAL(list->data));
- list = list->next;
- }
- return ary;
-}
-
-static VALUE
-rg_events(VALUE self)
-{
- return GDKEVENTMASK2RVAL(gdk_window_get_events(_SELF(self)));
-}
-
-static VALUE
-rg_set_events(VALUE self, VALUE mask)
-{
- gdk_window_set_events(_SELF(self), RVAL2GDKEVENTMASK(mask));
- return self;
-}
-
-/* deprecated
-static VALUE
-rg_set_icon(VALUE self, VALUE icon, VALUE pixmap, VALUE mask)
-{
- gdk_window_set_icon(_SELF(self), NIL_P(icon) ? NULL :_SELF(icon),
- NIL_P(pixmap) ? NULL : RVAL2GDKPIXMAP(pixmap),
- NIL_P(mask) ? NULL : RVAL2GDKBITMAP(mask));
- return self;
-}
-*/
-
-static VALUE
-rg_set_icon_name(VALUE self, VALUE name)
-{
- gdk_window_set_icon_name(_SELF(self), RVAL2CSTR(name));
- return self;
-}
-
-static VALUE
-rg_set_transient_for(VALUE self, VALUE parent)
-{
- gdk_window_set_transient_for(_SELF(self), _SELF(parent));
- return self;
-}
-
-static VALUE
-rg_set_role(VALUE self, VALUE role)
-{
- gdk_window_set_role(_SELF(self), RVAL2CSTR(role));
- return self;
-}
-
-static VALUE
-rg_set_group(VALUE self, VALUE leader)
-{
- gdk_window_set_group(_SELF(self), _SELF(leader));
- return self;
-}
-
-static VALUE
-rg_group(VALUE self)
-{
- return GOBJ2RVAL(gdk_window_get_group(_SELF(self)));
-}
-
-static VALUE
-rg_set_decorations(VALUE self, VALUE decor)
-{
- gdk_window_set_decorations(_SELF(self), RVAL2GDKWMDECORATION(decor));
- return self;
-}
-
-static VALUE
-rg_decorations(VALUE self)
-{
- GdkWMDecoration decorations;
- gboolean ret = gdk_window_get_decorations(_SELF(self), &decorations);
- return ret ? GDKWMDECORATION2RVAL(decorations) : Qnil;
-}
-
-static VALUE
-rg_set_functions(VALUE self, VALUE func)
-{
- gdk_window_set_functions(_SELF(self), RVAL2GDKWMFUNCTION(func));
- return self;
-}
-
-static VALUE
-rg_set_composited(VALUE self, VALUE composited)
-{
- gdk_window_set_composited(_SELF(self), RVAL2CBOOL(composited));
- return self;
-}
-
-static VALUE
-rg_set_opacity(VALUE self, VALUE opacity)
-{
- gdk_window_set_opacity(_SELF(self), NUM2DBL(opacity));
- return self;
-}
-
-static VALUE
-rg_set_startup_id(VALUE self, VALUE startup_id)
-{
- gdk_window_set_startup_id(_SELF(self), RVAL2CSTR_ACCEPT_NIL(startup_id));
- return self;
-}
-
-/* deprecated
-static VALUE
-rg_s_toplevels(G_GNUC_UNUSED VALUE self)
-{
- return GOBJGLIST2RVAL_FREE(gdk_window_get_toplevels(), g_list_free, NULL);
-}
-*/
-
-static VALUE
-rg_s_default_root_window(G_GNUC_UNUSED VALUE self)
-{
- return GOBJ2RVAL(gdk_get_default_root_window());
-}
-
-/* Would you need this?
-GdkPointerHooks* gdk_set_pointer_hooks (const GdkPointerHooks *new_hooks);
-*/
-
-/* From X Window System Interaction */
-/* deprecated
-static VALUE
-rg_s_foreign_new(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
-{
- VALUE arg[2];
- GdkWindow * win = NULL;
-
- rb_scan_args(argc, argv, "11", &arg[0], &arg[1]);
-
- switch(argc)
- {
- case 1:
- win = gdk_window_foreign_new(RVAL2GDKNATIVEWINDOW(arg[0]));
- break;
- case 2:
- win = gdk_window_foreign_new_for_display(RVAL2GOBJ(arg[0]),
- RVAL2GDKNATIVEWINDOW(arg[1]));
- break;
- default:
- break;
- }
- if (win == NULL)
- return Qnil;
- else {
- return GOBJ2RVAL(win);
- }
-}
-
-static VALUE
-rg_s_lookup(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
-{
- VALUE arg[2];
- GdkWindow * win = NULL;
-
- rb_scan_args(argc, argv, "11", &arg[0], &arg[1]);
-
- switch(argc)
- {
- case 1:
- win = gdk_window_lookup(RVAL2GDKNATIVEWINDOW(arg[0]));
- break;
- case 2:
- win = gdk_window_lookup_for_display(RVAL2GOBJ(arg[0]), RVAL2GDKNATIVEWINDOW(arg[1]));
- break;
- default:
- break;
- }
- if (win == NULL)
- return Qnil;
- else {
- return GOBJ2RVAL(win);
- }
-}
-*/
-
-struct rbgdk_rval2gdkatomglist_args {
- VALUE ary;
- long n;
- GList *result;
-};
-
-static VALUE
-rbgdk_rval2gdkatomglist_body(VALUE value)
-{
- long i;
- struct rbgdk_rval2gdkatomglist_args *args = (struct rbgdk_rval2gdkatomglist_args *)value;
-
- for (i = 0; i < args->n; i++)
- args->result = g_list_append(args->result, GINT_TO_POINTER(RVAL2ATOM(RARRAY_PTR(args->ary)[i])));
-
- return Qnil;
-}
-
-static G_GNUC_NORETURN VALUE
-rbgdk_rval2gdkatomglist_rescue(VALUE value)
-{
- g_free(((struct rbgdk_rval2gdkatomglist_args *)value)->result);
-
- rb_exc_raise(rb_errinfo());
-}
-
-static GList *
-rbgdk_rval2gdkatomglist(VALUE value)
-{
- struct rbgdk_rval2gdkatomglist_args args;
-
- args.ary = rb_ary_to_ary(value);
- args.n = RARRAY_LEN(args.ary);
- args.result = NULL;
-
- rb_rescue(rbgdk_rval2gdkatomglist_body, (VALUE)&args,
- rbgdk_rval2gdkatomglist_rescue, (VALUE)&args);
-
- return args.result;
-}
-
-#define RVAL2GDKATOMGLIST(value) rbgdk_rval2gdkatomglist(value)
-
-static VALUE
-rg_drag_begin(VALUE self, VALUE targets)
-{
- GList *list = RVAL2GDKATOMGLIST(targets);
- GdkDragContext *result = gdk_drag_begin(_SELF(self), list);
- g_list_free(list);
-
- return GOBJ2RVAL(result);
-}
-
-static VALUE
-rg_drag_protocol(VALUE self)
-{
- GdkWindow *target;
- GdkWindow **p;
- GdkDragProtocol prot;
- VALUE ary = rb_ary_new();
-
- prot = gdk_window_get_drag_protocol(_SELF(self), &target);
- for (p = ⌖ *p; p++)
- rb_ary_push(ary, GOBJ2RVAL(*p));
-
- return rb_ary_new3(2, GDKDRAGPROTOCOL2RVAL(prot), ary);
-}
-
-static VALUE
-rg_get_device_position(VALUE self, VALUE device)
-{
- gint x, y;
- GdkModifierType state;
- GdkWindow *underneath_window;
-
- underneath_window =
- gdk_window_get_device_position(_SELF(self),
- RVAL2GDKDEVICE(device),
- &x, &y, &state);
- return rb_ary_new3(4,
- GOBJ2RVAL(underneath_window),
- INT2NUM(x), INT2NUM(y), GDKMODIFIERTYPE2RVAL(state));
-}
-
-#ifdef HAVE_RB_CAIRO_H
-static VALUE
-rg_create_cairo_context(VALUE self)
-{
- VALUE rb_cr;
- cairo_t *cr;
- cr = gdk_cairo_create(_SELF(self));
- rb_cairo_check_status(cairo_status(cr));
- rb_cr = CRCONTEXT2RVAL(cr);
- cairo_destroy (cr);
- return rb_cr;
-}
-#endif
-
-void
-Init_gdk_window(VALUE mGdk)
-{
- GObjectClass *g_class;
- VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GDK_TYPE_WINDOW, "Window", mGdk);
-
- g_class = g_type_class_peek(GDK_TYPE_WINDOW);
-
- RG_DEF_METHOD(initialize, 3);
- RG_DEF_METHOD(destroy, 0);
- RG_DEF_METHOD(window_type, 0);
- RG_DEF_METHOD(display, 0);
- RG_DEF_SMETHOD(constrain_size, 4);
- RG_DEF_SMETHOD(process_all_updates, 0);
- RG_DEF_SMETHOD(set_debug_updates, 1);
- RG_DEF_METHOD(show, 0);
- RG_DEF_METHOD(show_unraised, 0);
- RG_DEF_METHOD(hide, 0);
- RG_DEF_METHOD_P(visible, 0);
- RG_DEF_METHOD_P(viewable, 0);
- RG_DEF_METHOD(withdraw, 0);
- RG_DEF_METHOD(state, 0);
- RG_DEF_METHOD(iconify, 0);
- RG_DEF_METHOD(deiconify, 0);
- RG_DEF_METHOD(stick, 0);
- RG_DEF_METHOD(unstick, 0);
- RG_DEF_METHOD(maximize, 0);
- RG_DEF_METHOD(unmaximize, 0);
- RG_DEF_METHOD(fullscreen, 0);
- RG_DEF_METHOD(unfullscreen, 0);
- RG_DEF_METHOD(set_keep_above, 1);
- RG_DEF_METHOD(set_keep_below, 1);
- RG_DEF_METHOD(move, 2);
- RG_DEF_METHOD(resize, 2);
- RG_DEF_METHOD(move_resize, 4);
- RG_DEF_METHOD(scroll, 2);
- RG_DEF_METHOD(move_region, 3);
- RG_DEF_METHOD(reparent, 3);
- RG_DEF_METHOD(raise, 0);
- RG_DEF_METHOD(lower, 0);
- RG_DEF_METHOD(focus, 1);
- RG_DEF_METHOD(register_dnd, 0);
- RG_DEF_METHOD(beep, 0);
- RG_DEF_METHOD(begin_resize_drag, 5);
- RG_DEF_METHOD(begin_move_drag, 4);
- RG_DEF_METHOD(begin_paint, 1);
- RG_DEF_METHOD(end_paint, 0);
- RG_DEF_METHOD(invalidate, 2);
- RG_DEF_METHOD(invalidate_maybe_recurse, 1);
- RG_DEF_METHOD(update_area, 0);
- RG_DEF_METHOD(freeze_updates, 0);
- RG_DEF_METHOD(thaw_updates, 0);
- RG_DEF_METHOD(process_updates, 1);
- RG_DEF_METHOD(configure_finished, 0);
- RG_DEF_METHOD(enable_synchronized_configure, 0);
- RG_DEF_METHOD(set_user_data, 1);
- RG_DEF_METHOD(set_override_redirect, 1);
- RG_DEF_METHOD(set_accept_focus, 1);
- RG_DEF_METHOD(set_focus_on_map, 1);
- RG_DEF_METHOD(shape_combine_region, 3);
- RG_DEF_METHOD(set_child_shapes, 0);
- RG_DEF_METHOD(merge_child_shapes, 0);
- RG_DEF_METHOD(input_shape_combine_region, 3);
- RG_DEF_METHOD(set_child_input_shapes, 0);
- RG_DEF_METHOD(merge_child_input_shapes, 0);
- RG_DEF_METHOD(set_static_gravities, 1);
- RG_DEF_METHOD(set_title, 1);
- RG_DEF_METHOD(set_background, 1);
- RG_DEF_METHOD(user_data, 0);
- RG_DEF_METHOD(geometry, 0);
- RG_DEF_METHOD(set_geometry_hints, 2);
- RG_DEF_METHOD(width, 0);
- RG_DEF_METHOD(height, 0);
- RG_DEF_METHOD(set_icon_list, 1);
- RG_DEF_METHOD(set_modal_hint, 1);
- RG_DEF_METHOD(set_type_hint, 1);
- RG_DEF_METHOD(type_hint, 0);
-
- RG_DEF_METHOD(set_skip_taskbar_hint, 1);
- RG_DEF_METHOD(set_skip_pager_hint, 1);
- RG_DEF_METHOD(set_urgency_hint, 1);
- RG_DEF_METHOD(position, 0);
- RG_DEF_METHOD(root_origin, 0);
- RG_DEF_METHOD(frame_extents, 0);
- RG_DEF_METHOD(origin, 0);
- RG_DEF_METHOD(parent, 0);
- RG_DEF_METHOD(toplevel, 0);
- RG_DEF_SMETHOD(default_root_window, 0);
- RG_DEF_METHOD(children, 0);
- RG_DEF_METHOD(events, 0);
- RG_DEF_METHOD(set_events, 1);
-/* deprecated
- RG_DEF_METHOD(set_icon, 3);
-*/
- RG_DEF_METHOD(set_icon_name, 1);
- RG_DEF_METHOD(set_transient_for, 1);
- RG_DEF_METHOD(set_role, 1);
- RG_DEF_METHOD(set_group, 1);
- RG_DEF_METHOD(group, 0);
- RG_DEF_METHOD(set_decorations, 1);
- RG_DEF_METHOD(decorations, 0);
- RG_DEF_METHOD(set_functions, 1);
- RG_DEF_METHOD(set_composited, 1);
- RG_DEF_METHOD(set_opacity, 1);
- RG_DEF_METHOD(set_startup_id, 1);
-/* deprecated
- RG_DEF_SMETHOD(toplevels, 0);
-
- RG_DEF_SMETHOD(foreign_new, -1);
- RG_DEF_SMETHOD(lookup, -1);
-*/
- RG_DEF_METHOD(drag_begin, 1);
- RG_DEF_METHOD(drag_protocol, 0);
- RG_DEF_METHOD(get_device_position, 1);
-
-#ifdef HAVE_RB_CAIRO_H
- RG_DEF_METHOD(create_cairo_context, 0);
-#endif
-
- G_DEF_CLASS(GDK_TYPE_WINDOW_TYPE, "Type", RG_TARGET_NAMESPACE);
- G_DEF_CLASS(GDK_TYPE_WINDOW_WINDOW_CLASS, "WindowClass",
- RG_TARGET_NAMESPACE);
- G_DEF_CLASS(GDK_TYPE_WINDOW_HINTS, "Hints", RG_TARGET_NAMESPACE);
- G_DEF_CLASS(GDK_TYPE_GRAVITY, "Gravity", RG_TARGET_NAMESPACE);
- G_DEF_CLASS(GDK_TYPE_WINDOW_EDGE, "Edge", RG_TARGET_NAMESPACE);
- G_DEF_CLASS(GDK_TYPE_WINDOW_TYPE_HINT, "TypeHint", RG_TARGET_NAMESPACE);
- G_DEF_CLASS(GDK_TYPE_WINDOW_ATTRIBUTES_TYPE, "AttributesType", RG_TARGET_NAMESPACE);
- G_DEF_CLASS(GDK_TYPE_FILTER_RETURN, "FilterReturn", RG_TARGET_NAMESPACE);
- G_DEF_CLASS(GDK_TYPE_MODIFIER_TYPE, "ModifierType", RG_TARGET_NAMESPACE);
- G_DEF_CLASS(GDK_TYPE_WM_DECORATION, "WMDecoration", RG_TARGET_NAMESPACE);
- G_DEF_CLASS(GDK_TYPE_WM_FUNCTION, "WMFunction", RG_TARGET_NAMESPACE);
-
- rb_define_const(RG_TARGET_NAMESPACE, "PARENT_RELATIVE", INT2FIX(GDK_PARENT_RELATIVE));
-
-#ifdef GDK_WINDOWING_X11
- G_DEF_CLASS3("GdkWindowImplX11", "WindowImplX11", mGdk);
-#elif defined(GDK_WINDOWING_WIN32)
- G_DEF_CLASS3("GdkWindowImplWin32", "WindowImplWin32", mGdk);
-#elif defined(GDK_WINDOWING_FB)
- G_DEF_CLASS3("GdkWindowFB", "WindowFB", mGdk);
-#endif
-}
diff --git a/gdk3/ext/gdk3/rbgdkwindowattr.c b/gdk3/ext/gdk3/rbgdkwindowattr.c
deleted file mode 100644
index 918647b..0000000
--- a/gdk3/ext/gdk3/rbgdkwindowattr.c
+++ /dev/null
@@ -1,191 +0,0 @@
-/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
-/*
- * Copyright (C) 2011 Ruby-GNOME2 Project Team
- * Copyright (C) 2003 Masao Mutoh
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- */
-
-#include "rbgdk3private.h"
-
-/*****************************************/
-static GdkWindowAttr*
-attr_copy(const GdkWindowAttr* win)
-{
- GdkWindowAttr* new_win;
- g_return_val_if_fail (win != NULL, NULL);
- new_win = g_new(GdkWindowAttr, 1);
- *new_win = *win;
- return new_win;
-}
-
-GType
-gdk_windowattr_get_type(void)
-{
- static GType our_type = 0;
- if (our_type == 0)
- our_type = g_boxed_type_register_static ("GdkWindowAttr",
- (GBoxedCopyFunc)attr_copy,
- (GBoxedFreeFunc)g_free);
- return our_type;
-}
-/*****************************************/
-
-#define RG_TARGET_NAMESPACE cWindowAttr
-#define _SELF(w) (RVAL2GDKWINDOWATTR(w))
-
-static VALUE
-rg_initialize(VALUE self, VALUE width, VALUE height, VALUE wclass,
- VALUE window_type)
-{
- GdkWindowAttr attribute;
- attribute.width = NUM2INT(width);
- attribute.height = NUM2INT(height);
- attribute.wclass = RVAL2GDKWINDOWWINDOWCLASS(wclass);
- attribute.window_type = RVAL2GDKWINDOWTYPE(window_type);
- G_INITIALIZE(self, g_boxed_copy(GDK_TYPE_WINDOW_ATTR, &attribute));
- return Qnil;
-}
-
-#define ATTR_STR(name)\
-static VALUE \
-attr_get_ ## name (VALUE self)\
-{\
- return CSTR2RVAL(_SELF(self)->name);\
-}\
-static VALUE \
-attr_set_ ## name (VALUE self, VALUE val)\
-{\
- _SELF(self)->name = (gchar *)RVAL2CSTR(val);\
- return self;\
-}
-
-#define ATTR_INT(name)\
-static VALUE \
-attr_get_ ## name (VALUE self)\
-{\
- return INT2NUM(_SELF(self)->name);\
-}\
-static VALUE \
-attr_set_ ## name (VALUE self, VALUE val)\
-{\
- _SELF(self)->name = NUM2INT(val);\
- return self;\
-}
-
-ATTR_STR(title);
-ATTR_INT(event_mask);
-ATTR_INT(x);
-ATTR_INT(y);
-ATTR_INT(width);
-ATTR_INT(height);
-
-static VALUE
-rg_wclass(VALUE self)
-{
- return GDKWINDOWWINDOWCLASS2RVAL(_SELF(self)->wclass);
-}
-static VALUE
-rg_set_wclass(VALUE self, VALUE val)
-{
- _SELF(self)->wclass = RVAL2GDKWINDOWWINDOWCLASS(val);
- return self;
-}
-
-static VALUE
-rg_visual(VALUE self)
-{
- return GOBJ2RVAL(_SELF(self)->visual);
-}
-static VALUE
-rg_set_visual(VALUE self, VALUE val)
-{
- _SELF(self)->visual = RVAL2GDKVISUAL(val);
- return self;
-}
-
-static VALUE
-rg_window_type(VALUE self)
-{
- return GDKWINDOWTYPE2RVAL(_SELF(self)->window_type);
-}
-static VALUE
-rg_set_window_type(VALUE self, VALUE val)
-{
- _SELF(self)->window_type = RVAL2GDKWINDOWTYPE(val);
- return self;
-}
-
-static VALUE
-rg_cursor(VALUE self)
-{
- return GDKCURSOR2RVAL(_SELF(self)->cursor);
-}
-static VALUE
-rg_set_cursor(VALUE self, VALUE val)
-{
- _SELF(self)->cursor = RVAL2GDKCURSOR(val);
- return self;
-}
-
-ATTR_STR(wmclass_name);
-ATTR_STR(wmclass_class);
-
-static VALUE
-rg_override_redirect(VALUE self)
-{
- return CBOOL2RVAL(_SELF(self)->override_redirect);
-}
-static VALUE
-rg_set_override_redirect(VALUE self, VALUE val)
-{
- _SELF(self)->override_redirect = RVAL2CBOOL(val);
- return self;
-}
-
-void
-Init_gdk_windowattr(VALUE mGdk)
-{
- VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GDK_TYPE_WINDOW_ATTR, "WindowAttr", mGdk);
-
- RG_DEF_METHOD(initialize, 4);
- rbg_define_method(RG_TARGET_NAMESPACE, "title", attr_get_title, 0);
- rbg_define_method(RG_TARGET_NAMESPACE, "set_title", attr_set_title, 1);
- rbg_define_method(RG_TARGET_NAMESPACE, "event_mask", attr_get_event_mask, 0);
- rbg_define_method(RG_TARGET_NAMESPACE, "set_event_mask", attr_set_event_mask, 1);
- rbg_define_method(RG_TARGET_NAMESPACE, "x", attr_get_x, 0);
- rbg_define_method(RG_TARGET_NAMESPACE, "set_x", attr_set_x, 1);
- rbg_define_method(RG_TARGET_NAMESPACE, "y", attr_get_y, 0);
- rbg_define_method(RG_TARGET_NAMESPACE, "set_y", attr_set_y, 1);
- rbg_define_method(RG_TARGET_NAMESPACE, "width", attr_get_width, 0);
- rbg_define_method(RG_TARGET_NAMESPACE, "set_width", attr_set_width, 1);
- rbg_define_method(RG_TARGET_NAMESPACE, "height", attr_get_height, 0);
- rbg_define_method(RG_TARGET_NAMESPACE, "set_height", attr_set_height, 1);
- RG_DEF_METHOD(wclass, 0);
- RG_DEF_METHOD(set_wclass, 1);
- RG_DEF_METHOD(visual, 0);
- RG_DEF_METHOD(set_visual, 1);
- RG_DEF_METHOD(window_type, 0);
- RG_DEF_METHOD(set_window_type, 1);
- RG_DEF_METHOD(cursor, 0);
- RG_DEF_METHOD(set_cursor, 1);
- rbg_define_method(RG_TARGET_NAMESPACE, "wmclass_name", attr_get_wmclass_name, 0);
- rbg_define_method(RG_TARGET_NAMESPACE, "set_wmclass_name", attr_set_wmclass_name, 1);
- rbg_define_method(RG_TARGET_NAMESPACE, "wmclass_class", attr_get_wmclass_class, 0);
- rbg_define_method(RG_TARGET_NAMESPACE, "set_wmclass_class", attr_set_wmclass_class, 1);
- RG_DEF_METHOD(override_redirect, 0);
- RG_DEF_METHOD(set_override_redirect, 1);
-}
diff --git a/gdk3/ext/gdk3/rbgdkx11.c b/gdk3/ext/gdk3/rbgdkx11.c
deleted file mode 100644
index 8a7bc2d..0000000
--- a/gdk3/ext/gdk3/rbgdkx11.c
+++ /dev/null
@@ -1,102 +0,0 @@
-/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
-/*
- * Copyright (C) 2011 Ruby-GNOME2 Project Team
- * Copyright (C) 2005 Masao Mutoh
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- */
-
-#include "rbgdk3private.h"
-#ifdef GDK_WINDOWING_X11
-
-#define RG_TARGET_NAMESPACE mGdkX11
-
-/* deprecated
-static VALUE
-rg_s_xid_table_lookup(int argc, VALUE *argv, VALUE self)
-{
- VALUE arg[2];
- GdkPixmap* win = NULL;
-
- rb_scan_args(argc, argv, "11", &arg[0], &arg[1]);
-
- switch(argc)
- {
- case 1:
- win = gdk_xid_table_lookup(NUM2UINT(arg[0]));
- break;
- case 2:
- win = gdk_xid_table_lookup_for_display(RVAL2GOBJ(arg[0]), NUM2UINT(arg[1]));
- break;
- }
- if (win == NULL)
- return Qnil;
- else {
- return GOBJ2RVAL(win);
- }
-}
-*/
-
-/* deprecated
-static VALUE
-rg_s_net_wm_supports_p(VALUE self, VALUE property)
-{
- return CBOOL2RVAL(gdk_net_wm_supports(RVAL2ATOM(property)));
-}
-*/
-
-static VALUE
-rg_s_default_screen(G_GNUC_UNUSED VALUE self)
-{
- return INT2NUM(gdk_x11_get_default_screen());
-}
-
-static VALUE
-rg_s_grab_server(G_GNUC_UNUSED VALUE self)
-{
- gdk_x11_grab_server();
- return Qnil;
-}
-
-static VALUE
-rg_s_ungrab_server(G_GNUC_UNUSED VALUE self)
-{
- gdk_x11_ungrab_server();
- return Qnil;
-}
-#endif
-
-void
-Init_gdkx11(void)
-{
-#ifdef GDK_WINDOWING_X11
- VALUE RG_TARGET_NAMESPACE = rb_define_module("GdkX11");
-
-/* deprecated
- RG_DEF_SMETHOD(xid_table_lookup, -1);
-*/
-/* deprecated
- RG_DEF_SMETHOD_P(net_wm_supports, 1);
-*/
-
- RG_DEF_SMETHOD(default_screen, 0);
- RG_DEF_SMETHOD(grab_server, 0);
-
- RG_DEF_SMETHOD(ungrab_server, 0);
-
- Init_gdkx11_x11window(RG_TARGET_NAMESPACE);
-#endif
-}
diff --git a/gdk3/ext/gdk3/rbgdkx11x11window.c b/gdk3/ext/gdk3/rbgdkx11x11window.c
deleted file mode 100644
index 1d09d0f..0000000
--- a/gdk3/ext/gdk3/rbgdkx11x11window.c
+++ /dev/null
@@ -1,66 +0,0 @@
-/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
-/*
- * Copyright (C) 2012 Ruby-GNOME2 Project Team
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- */
-
-#include "rbgdk3private.h"
-
-#ifdef GDK_WINDOWING_X11
-#define RG_TARGET_NAMESPACE cX11Window
-#define _SELF(self) (RVAL2GDKX11WINDOW(self))
-
-static VALUE
-rg_xid(VALUE self)
-{
- return ULONG2NUM(gdk_x11_window_get_xid(_SELF(self)));
-}
-
-static VALUE
-rg_move_to_current_desktop(VALUE self)
-{
- gdk_x11_window_move_to_current_desktop(_SELF(self));
-
- return self;
-}
-
-static VALUE
-rg_server_time(VALUE self)
-{
- return UINT2NUM(gdk_x11_get_server_time(_SELF(self)));
-}
-
-static VALUE
-rg_set_user_time(VALUE self, VALUE time)
-{
- gdk_x11_window_set_user_time(_SELF(self), NUM2UINT(time));
- return Qnil;
-}
-#endif
-
-void
-Init_gdkx11_x11window(VALUE mGdkX11)
-{
-#ifdef GDK_WINDOWING_X11
- VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GDK_TYPE_X11_WINDOW, "X11Window", mGdkX11);
-
- RG_DEF_METHOD(xid, 0);
- RG_DEF_METHOD(move_to_current_desktop, 0);
- RG_DEF_METHOD(server_time, 0);
- RG_DEF_METHOD(set_user_time, 1);
-#endif
-}
diff --git a/gdk3/extconf.rb b/gdk3/extconf.rb
deleted file mode 100644
index 8e29b4f..0000000
--- a/gdk3/extconf.rb
+++ /dev/null
@@ -1,49 +0,0 @@
-#!/usr/bin/env ruby
-
-require 'pathname'
-require 'mkmf'
-require 'rbconfig'
-require 'fileutils'
-
-package = "gdk3"
-
-base_dir = Pathname(__FILE__).dirname.expand_path
-ext_dir = base_dir + "ext" + package
-mkmf_gnome2_dir = base_dir + 'lib'
-
-ruby = File.join(RbConfig::CONFIG['bindir'],
- RbConfig::CONFIG['ruby_install_name'] +
- RbConfig::CONFIG["EXEEXT"])
-
-build_dir = Pathname("ext") + package
-FileUtils.mkdir_p(build_dir.to_s) unless build_dir.exist?
-extconf_rb_path = ext_dir + "extconf.rb"
-system(ruby, "-C", build_dir.to_s, extconf_rb_path.to_s, *ARGV) || exit(false)
-
-create_makefile(package)
-FileUtils.mv("Makefile", "Makefile.lib")
-
-File.open("Makefile", "w") do |makefile|
- makefile.puts(<<-EOM)
-all:
- (cd ext/#{package} && $(MAKE))
- $(MAKE) -f Makefile.lib
-
-install:
- (cd ext/#{package} && $(MAKE) install)
- $(MAKE) -f Makefile.lib install
-
-site-install:
- (cd ext/#{package} && $(MAKE) site-install)
- $(MAKE) -f Makefile.lib site-install
-
-clean:
- (cd ext/#{package} && $(MAKE) clean)
- $(MAKE) -f Makefile.lib clean
-
-distclean:
- (cd ext/#{package} && $(MAKE) distclean)
- $(MAKE) -f Makefile.lib distclean
- @rm -f Makefile.lib
-EOM
-end
diff --git a/gdk3/lib/gdk3.rb b/gdk3/lib/gdk3.rb
index eb8859e..d7f5797 100644
--- a/gdk3/lib/gdk3.rb
+++ b/gdk3/lib/gdk3.rb
@@ -1,3 +1,62 @@
-require 'gdk3/base'
-require 'gdk3/deprecated'
+# Copyright (C) 2013-2014 Ruby-GNOME2 Project Team
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+require "gobject-introspection"
+require "cairo-gobject"
+require "atk"
+require "pango"
+require "gdk_pixbuf2"
+
+base_dir = Pathname.new(__FILE__).dirname.dirname.expand_path
+vendor_dir = base_dir + "vendor" + "local"
+vendor_bin_dir = vendor_dir + "bin"
+GLib.prepend_dll_path(vendor_bin_dir)
+vendor_girepository_dir = vendor_dir + "lib" + "girepository-1.0"
+GObjectIntrospection.prepend_typelib_path(vendor_girepository_dir)
+
+require "gdk3/loader"
+
+module Gdk
+ LOG_DOMAIN = "Gdk"
+ GLib::Log.set_log_domain(LOG_DOMAIN)
+
+ class Error < StandardError
+ end
+
+ class << self
+ def const_missing(name)
+ init
+ if const_defined?(name)
+ const_get(name)
+ else
+ super
+ end
+ end
+
+ def init
+ class << self
+ remove_method(:init)
+ remove_method(:const_missing)
+ end
+ loader = Loader.new(self)
+ loader.load("Gdk")
+ end
+
+ def cairo_available?
+ true
+ end
+ end
+end
diff --git a/gio2/lib/gio2/output-stream.rb b/gdk3/lib/gdk3/atom.rb
similarity index 83%
copy from gio2/lib/gio2/output-stream.rb
copy to gdk3/lib/gdk3/atom.rb
index d686699..598ec90 100644
--- a/gio2/lib/gio2/output-stream.rb
+++ b/gdk3/lib/gdk3/atom.rb
@@ -14,11 +14,13 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-module Gio
- class OutputStream
- alias_method :write_raw, :write
- def write(data)
- write_raw(data, data.bytesize)
+module Gdk
+ class Atom
+ class << self
+ alias_method :intern_raw, :intern
+ def intern(name, exist=true)
+ intern_raw(name, exist)
+ end
end
end
end
diff --git a/gdk3/lib/gdk3/base.rb b/gdk3/lib/gdk3/base.rb
deleted file mode 100644
index 0847eb9..0000000
--- a/gdk3/lib/gdk3/base.rb
+++ /dev/null
@@ -1,59 +0,0 @@
-=begin
- Copyright (c) 2006-2011 Ruby-GNOME2 Project Team
- This program is licenced under the same licence as Ruby-GNOME2.
-=end
-
-require 'glib2'
-require 'pango'
-require 'gdk_pixbuf2'
-
-base_dir = Pathname.new(__FILE__).dirname.dirname.dirname.expand_path
-vendor_dir = base_dir + "vendor" + "local"
-vendor_bin_dir = vendor_dir + "bin"
-GLib.prepend_dll_path(vendor_bin_dir)
-begin
- major, minor, _ = RUBY_VERSION.split(/\./)
- require "#{major}.#{minor}/gdk3.so"
-rescue LoadError
- require "gdk3.so"
-end
-
-if vendor_dir.exist?
- begin
- require "gobject-introspection"
- vendor_girepository_dir = vendor_dir + "lib" + "girepository-1.0"
- GObjectIntrospection.prepend_typelib_path(vendor_girepository_dir)
- rescue LoadError
- end
-end
-
-module Gdk
- LOG_DOMAIN = "Gdk"
-end
-
-if Gdk.cairo_available?
- module Cairo
- class Context
- if method_defined?(:set_source_color)
- alias_method :set_source_not_gdk_color, :set_source_color
- def set_source_color(color)
- if color.is_a?(Gdk::Color)
- set_source_gdk_color(color)
- else
- set_source_not_gdk_color(color)
- end
- end
- else
- alias_method :set_source_color, :set_source_gdk_color
- end
-
- def source_color=(color)
- set_source_color(color)
- color
- end
- end
- end
-end
-
-GLib::Log.set_log_domain(Gdk::LOG_DOMAIN)
-
diff --git a/gdk3/lib/gdk3/cairo.rb b/gdk3/lib/gdk3/cairo.rb
new file mode 100644
index 0000000..3cac1c6
--- /dev/null
+++ b/gdk3/lib/gdk3/cairo.rb
@@ -0,0 +1,64 @@
+# Copyright (C) 2014 Ruby-GNOME2 Project Team
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+module Cairo
+ class Context
+ if method_defined?(:set_source_color)
+ alias_method :set_source_not_gdk_color, :set_source_color
+ def set_source_color(color)
+ if color.is_a?(Gdk::Color)
+ set_source_gdk_color(color)
+ else
+ set_source_not_gdk_color(color)
+ end
+ end
+ else
+ alias_method :set_source_color, :set_source_gdk_color
+ end
+
+ def source_color=(color)
+ set_source_color(color)
+ color
+ end
+
+ if method_defined?(:set_source_rgba)
+ alias_method :set_source_not_gdk_rgba, :set_source_rgba
+ def set_source_rgba(rgba, g=nil, b=nil, a=nil)
+ case rgba
+ when Gdk::RGBA
+ set_source_gdk_rgba(rgba)
+ when Array
+ set_source_not_gdk_rgba(rgba)
+ else
+ r = rgba
+ set_source_not_gdk_rgba([r, g, b, a])
+ end
+ end
+ else
+ alias_method :set_source_rgba, :set_source_gdk_rgba
+ end
+
+ def source_rgba=(rgba)
+ set_source_rgba(rgba)
+ rgba
+ end
+
+ alias_method :set_source_pixbuf_raw, :set_source_pixbuf
+ def set_source_pixbuf(pixbuf, pixbuf_x=0, pixbuf_y=0)
+ set_source_pixbuf_raw(pixbuf, pixbuf_x, pixbuf_y)
+ end
+ end
+end
diff --git a/gdk3/lib/gdk3/color.rb b/gdk3/lib/gdk3/color.rb
new file mode 100644
index 0000000..cd6de1f
--- /dev/null
+++ b/gdk3/lib/gdk3/color.rb
@@ -0,0 +1,49 @@
+# Copyright (C) 2014 Ruby-GNOME2 Project Team
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+module Gdk
+ class Color
+ class << self
+ alias_method :parse_raw, :parse
+ def parse(spec)
+ succeeded, color = parse_raw(spec)
+ unless succeeded
+ message = "Invalid color spec: <#{spec.inspect}>: "
+ message << "Color spec must be one of them: "
+ message << "\"\#rgb\", "
+ message << "\"\#rrggbb\", "
+ message << "\"\#rrggbb\", "
+ message << "\"\#rrrgggbbb\", "
+ message << "\"\#rrrrggggbbbb\", "
+ message << "\"\#fff\", "
+ message << "\"\#ffffff\", "
+ message << "\"\#fffffffff\", "
+ message << "\"\#fffffffffffff\""
+ raise ArgumentError, message
+ end
+ color
+ end
+ end
+
+ alias_method :initialize_raw, :initialize
+ def initialize(red, green, blue)
+ initialize_raw
+ self.red = red
+ self.green = green
+ self.blue = blue
+ end
+ end
+end
diff --git a/gdk3/lib/gdk3/deprecated.rb b/gdk3/lib/gdk3/deprecated.rb
index ee64152..e49ee3e 100644
--- a/gdk3/lib/gdk3/deprecated.rb
+++ b/gdk3/lib/gdk3/deprecated.rb
@@ -6,11 +6,6 @@ module Gdk
define_deprecated_const :Colormap, :raise => "Use 'Gdk::Visual' instead."
define_deprecated_const :Input, :raise => "Use 'GLib::IOChannel' instead."
define_deprecated_const :X11, 'GdkX11'
- define_deprecated_singleton_method :pointer_grab, :raise => "Use 'Gdk::Device#grab'."
- define_deprecated_singleton_method :pointer_ungrab, :raise => "Use 'Gdk::Device#ungrab'."
- define_deprecated_singleton_method :keyboard_grab, :raise => "Use 'Gdk::Device#grab'."
- define_deprecated_singleton_method :keyboard_ungrab, :raise => "Use 'Gdk::Device#ungrab'."
- define_deprecated_singleton_method :pointer_is_grabbed?, :raise => "Use 'Gdk::Display#device_is_grabbed?'."
class Cursor
extend GLib::Deprecatable
@@ -18,6 +13,9 @@ module Gdk
define_deprecated_method :pixmap?, :warn => "Don't use this method." do |_self|
false
end
+ Gdk::CursorType.constants.each do |cursor_type|
+ define_deprecated_const cursor_type, ['Gdk::CursorType', cursor_type].join('::')
+ end
end
class Device
@@ -26,7 +24,6 @@ module Gdk
define_deprecated_enums :ExtensionMode, 'EXTENSION_EVENTS'
define_deprecated_enums :InputMode, 'MODE'
define_deprecated_enums :InputSource, 'SOURCE'
- define_deprecated_method :source, :input_source
end
class Display
@@ -38,12 +35,6 @@ module Gdk
define_deprecated_method :button_number, :raise => "Don't use this method."
define_deprecated_method :button_x, :raise => "Don't use this method."
define_deprecated_method :button_y, :raise => "Don't use this method."
- define_deprecated_method :pointer, :raise => "Use 'Gdk::Device#get_position'."
- define_deprecated_method :pointer_ungrab, :raise => "Use 'Gdk::Device#ungrab'."
- define_deprecated_method :pointer_grabbed_p, :raise => "Use 'Gdk::Display#device_is_grabbed?'."
- define_deprecated_method :window_at_pointer, :raise => "Use 'Gdk::Device#get_window_at_position'."
- define_deprecated_method :warp_pointer, :raise => "Use 'Gdk::Device#warp'."
- define_deprecated_method :devices, :raise => "Use 'Gdk::DeviceManager#devices'."
end
class DragContext
@@ -62,8 +53,8 @@ module Gdk
class Event
extend GLib::Deprecatable
- define_deprecated_flags :Mask
- define_deprecated_enums :Type
+ define_deprecated_const :Mask, "Gdk::EventMask"
+ define_deprecated_const :Type, "Gdk::EventType"
end
class EventCrossing
@@ -105,7 +96,12 @@ module Gdk
module Keyval
extend GLib::Deprecatable
constants.each do |key|
- define_deprecated_const key.to_s.sub(/^GDK_KEY_/, 'GDK_'), [self, key].join('::')
+ old_names = []
+ old_names << key.to_s.sub(/^KEY_/, 'GDK_KEY_')
+ old_names << key.to_s.sub(/^KEY_/, 'GDK_')
+ old_names.each do |old_name|
+ define_deprecated_const old_name, [self, key].join('::')
+ end
end
end
@@ -135,25 +131,26 @@ module Gdk
class Window
extend GLib::Deprecatable
- define_deprecated_flags :AttributesType, 'WA'
- define_deprecated_enums :Edge, 'EDGE'
- define_deprecated_enums :FilterReturn, 'FILTER'
- define_deprecated_enums :Gravity, 'GRAVITY'
- define_deprecated_flags :Hints, 'HINT'
- define_deprecated_flags :ModifierType
- define_deprecated_enums :Type
- define_deprecated_enums :TypeHint, 'TYPE_HINT'
- define_deprecated_enums :WindowClass
- define_deprecated_flags :WMDecoration, 'DECOR'
- define_deprecated_flags :WMFunction, 'FUNC'
+
+ define_deprecated_const :Gravity, "Gdk::Gravity"
+ define_deprecated_const :AttributesType, "Gdk::WindowAttributesType"
+ define_deprecated_const :Edge, "Gdk::WindowEdge"
+ define_deprecated_const :FilterReturn, "Gdk::FilterReturn"
+ define_deprecated_const :Hints, "Gdk::WindowHints"
+ define_deprecated_const :ModifierType, "Gdk::ModifierType"
+ define_deprecated_const :Type, "Gdk::WindowType"
+ define_deprecated_const :TypeHint, "Gdk::WindowTypeHint"
+ define_deprecated_const :WindowClass, "Gdk::WindowWindowClass"
+ define_deprecated_const :Class, "Gdk::WindowWindowClass"
+ define_deprecated_const :WMDecoration, "Gdk::WMDecoration"
+ define_deprecated_const :WMFunction, "Gdk::WMFunction"
+ define_deprecated_const :PARENT_RELATIVE, "Gdk::PARENT_RELATIVE"
define_deprecated_method :clear, :warn => "Don't use this method."
define_deprecated_method :clear_area, :warn => "Don't use this method."
define_deprecated_method :internal_paint_info, :raise => "Don't use this method."
define_deprecated_method :shape_combine_mask, :warn => "Don't use this method."
define_deprecated_method :input_shape_combine_mask, :warn => "Don't use this method."
define_deprecated_method :set_back_pixmap, :warn => "Don't use this method."
- define_deprecated_singleton_method :at_pointer, :raise => "Use 'Gdk::Device#get_window_at_position'."
- define_deprecated_method :pointer, :raise => "Use 'Gdk::Device#get_device_position'."
end
class WindowAttr
@@ -163,3 +160,4 @@ module Gdk
alias :colormap= :set_colormap
end
end
+
diff --git a/gio2/lib/gio2/output-stream.rb b/gdk3/lib/gdk3/event.rb
similarity index 71%
copy from gio2/lib/gio2/output-stream.rb
copy to gdk3/lib/gdk3/event.rb
index d686699..103b79a 100644
--- a/gio2/lib/gio2/output-stream.rb
+++ b/gdk3/lib/gdk3/event.rb
@@ -14,11 +14,25 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-module Gio
- class OutputStream
- alias_method :write_raw, :write
- def write(data)
- write_raw(data, data.bytesize)
+module Gdk
+ class Event
+ unless const_defined?(:PROPAGATE)
+ PROPAGATE = false
+ end
+ unless const_defined?(:STOP)
+ STOP = true
+ end
+
+ def send_event?
+ not send_event.zero?
+ end
+ end
+
+ class EventFocus
+ alias_method :in_raw, :in
+ remove_method :in
+ def in?
+ not in_raw.zero?
end
end
end
diff --git a/gdk3/lib/gdk3/loader.rb b/gdk3/lib/gdk3/loader.rb
new file mode 100644
index 0000000..a04cfc6
--- /dev/null
+++ b/gdk3/lib/gdk3/loader.rb
@@ -0,0 +1,265 @@
+# Copyright (C) 2013-2014 Ruby-GNOME2 Project Team
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+module Gdk
+ class Loader < GObjectIntrospection::Loader
+ private
+ def window_class
+ @window_class ||= @base_module.const_get(:Window)
+ end
+
+ def event_class
+ @event_class ||= @base_module.const_get(:Event)
+ end
+
+ def event_motion_class
+ @event_motion_class ||= @base_module.const_get(:EventMotion)
+ end
+
+ def rectangle_class
+ @rectangle_class ||= @base_module.const_get(:Rectangle)
+ end
+
+ def pre_load(repository, namespace)
+ setup_pending_constants
+ define_keyval_module
+ define_selection_module
+ load_cairo_rectangle_int
+ end
+
+ def define_keyval_module
+ @keyval_module = Module.new
+ @base_module.const_set("Keyval", @keyval_module)
+ end
+
+ def define_selection_module
+ @selection_module = Module.new
+ @base_module.const_set("Selection", @selection_module)
+ end
+
+ def load_cairo_rectangle_int
+ info = find_cairo_rectangle_int_info
+ klass = self.class.define_class(info.gtype,
+ "Rectangle",
+ @base_module,
+ :size => info.size)
+ load_fields(info, klass)
+ load_methods(info, klass)
+ end
+
+ def find_cairo_rectangle_int_info
+ repository = GObjectIntrospection::Repository.default
+ repository.each("cairo") do |info|
+ if info.name == "RectangleInt"
+ return info
+ end
+ end
+ nil
+ end
+
+ def post_load(repository, namespace)
+ apply_pending_constants
+ require_libraries
+ convert_event_classes
+ define_selection_constants
+ end
+
+ def setup_pending_constants
+ @pending_constants = []
+ end
+
+ def apply_pending_constants
+ @pending_constants.each do |info|
+ case info.name
+ when /\AEVENT_/
+ event_class.const_set($POSTMATCH, info.value)
+ end
+ end
+ end
+
+ def require_libraries
+ require "gdk3/atom"
+ require "gdk3/color"
+ require "gdk3/event"
+ require "gdk3/rectangle"
+ require "gdk3/rgba"
+ require "gdk3/window"
+ require "gdk3/window-attr"
+
+ require "gdk3/cairo"
+
+ require "gdk3/deprecated"
+ end
+
+ def convert_event_classes
+ event_map = {
+ EventType::EXPOSE => EventExpose,
+ EventType::MOTION_NOTIFY => EventMotion,
+ EventType::BUTTON_PRESS => EventButton,
+ EventType::BUTTON2_PRESS => EventButton,
+ EventType::BUTTON3_PRESS => EventButton,
+ EventType::BUTTON_RELEASE => EventButton,
+ EventType::KEY_PRESS => EventKey,
+ EventType::KEY_RELEASE => EventKey,
+ EventType::ENTER_NOTIFY => EventCrossing,
+ EventType::LEAVE_NOTIFY => EventCrossing,
+ EventType::FOCUS_CHANGE => EventFocus,
+ EventType::CONFIGURE => EventConfigure,
+ EventType::PROPERTY_NOTIFY => EventProperty,
+ EventType::SELECTION_CLEAR => EventSelection,
+ EventType::SELECTION_REQUEST => EventSelection,
+ EventType::SELECTION_NOTIFY => EventSelection,
+ EventType::PROXIMITY_IN => EventProximity,
+ EventType::PROXIMITY_OUT => EventProximity,
+ EventType::DRAG_ENTER => EventDND,
+ EventType::DRAG_LEAVE => EventDND,
+ EventType::DRAG_MOTION => EventDND,
+ EventType::DRAG_STATUS => EventDND,
+ EventType::DROP_START => EventDND,
+ EventType::DROP_FINISHED => EventDND,
+ EventType::VISIBILITY_NOTIFY => EventVisibility,
+ EventType::SCROLL => EventScroll,
+ EventType::WINDOW_STATE => EventWindowState,
+ EventType::SETTING => EventSetting,
+ EventType::OWNER_CHANGE => EventOwnerChange,
+ EventType::GRAB_BROKEN => EventGrabBroken,
+ EventType::DAMAGE => EventExpose,
+ EventType::TOUCH_BEGIN => EventTouch,
+ EventType::TOUCH_UPDATE => EventTouch,
+ EventType::TOUCH_END => EventTouch,
+ EventType::TOUCH_CANCEL => EventTouch,
+ }
+ self.class.register_boxed_class_converter(Event.gtype) do |event|
+ event_map[event.type] || Event
+ end
+ end
+
+ def define_selection_constants
+ selections = {
+ "PRIMARY" => "PRIMARY",
+ "SECONDARY" => "SECONDARY",
+ "CLIPBOARD" => "CLIPBOARD",
+ "TARGET_BITMAP" => "BITMAP",
+ "TARGET_COLORMAP" => "COLORMAP",
+ "TARGET_DRAWABLE" => "DRAWABLE",
+ "TARGET_PIXMAP" => "PIXMAP",
+ "TARGET_STRING" => "STRING",
+ "TYPE_ATOM" => "ATOM",
+ "TYPE_BITMAP" => "BITMAP",
+ "TYPE_COLORMAP" => "COLORMAP",
+ "TYPE_DRAWABLE" => "DRAWABLE",
+ "TYPE_INTEGER" => "INTEGER",
+ "TYPE_PIXMAP" => "PIXMAP",
+ "TYPE_WINDOW" => "WINDOW",
+ "TYPE_STRING" => "STRING",
+ }
+ selections.each do |key, value|
+ # TODO: Gdk::Atom.intern is not working yet.
+ #@selection_module.const_set(key, Gdk::Atom.intern(value))
+ end
+ end
+
+ def load_function_info(info)
+ name = info.name
+ case name
+ when "init", /_get_type\z/
+ # ignore
+ when /\Arectangle_/
+ define_method(info, rectangle_class, $POSTMATCH)
+ when /\Apixbuf_/
+ target_class = nil
+ case $POSTMATCH
+ when "get_from_window"
+ target_class = window_class
+ when "get_from_surface"
+ target_class = Cairo::Surface
+ end
+ if target_class
+ define_method(info, target_class, "to_pixbuf")
+ else
+ super
+ end
+ when /\Aevent_/
+ name = $POSTMATCH
+ case name
+ when "request_motions"
+ define_method(info, event_motion_class, "request")
+ else
+ super # TODO
+ end
+ when /\Acairo_/
+ name = $POSTMATCH
+ case name
+ when "create"
+ define_method(info, window_class, "create_cairo_context")
+ when "set_source_color"
+ define_method(info, Cairo::Context, "set_source_gdk_color")
+ when "set_source_rgba"
+ define_method(info, Cairo::Context, "set_source_gdk_rgba")
+ when "rectangle"
+ define_method(info, Cairo::Context, "gdk_rectangle")
+ when "region_create_from_surface"
+ # TODO
+ when "surface_create_from_pixbuf"
+ # TODO
+ else
+ define_method(info, Cairo::Context, name)
+ end
+ when /\Akeyval_/
+ name = rubyish_method_name(info, :prefix => "keyval_")
+ define_module_function(@keyval_module, name, info)
+ else
+ super
+ end
+ end
+
+ def load_struct_info(info)
+ return if info.gtype_struct?
+
+ options = {}
+ case info.name
+ when /\AEvent/
+ options[:parent] = event_class
+ end
+
+ define_struct(info, options)
+ end
+
+ def define_enum(info)
+ case info.name
+ when "EventType"
+ self.class.register_constant_rename_map("2BUTTON_PRESS",
+ "BUTTON2_PRESS")
+ self.class.register_constant_rename_map("3BUTTON_PRESS",
+ "BUTTON3_PRESS")
+ super
+ else
+ super
+ end
+ end
+
+ def load_constant_info(info)
+ case info.name
+ when /\AEVENT_/
+ @pending_constants << info
+ when /\AKEY_/
+ @keyval_module.const_set(info.name, info.value)
+ else
+ super
+ end
+ end
+ end
+end
diff --git a/gio2/lib/gio2/pollable-output-stream.rb b/gdk3/lib/gdk3/rectangle.rb
similarity index 66%
copy from gio2/lib/gio2/pollable-output-stream.rb
copy to gdk3/lib/gdk3/rectangle.rb
index 49b5c8e..b21b827 100644
--- a/gio2/lib/gio2/pollable-output-stream.rb
+++ b/gdk3/lib/gdk3/rectangle.rb
@@ -14,19 +14,25 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-module Gio
- module PollableOutputStream
- alias_method :create_source_raw, :create_source
- def create_source(&block)
- source = create_source_raw
- source.extend(PollableSource)
- source.set_callback(&block)
- source
+module Gdk
+ class Rectangle
+ alias_method :initialize_raw, :initialize
+ def initialize(x, y, width, height)
+ initialize_raw
+ self.x = x
+ self.y = y
+ self.width = width
+ self.height = height
end
- alias_method :write_nonblocking_raw, :write_nonblocking
- def write_nonblocking(data)
- write_nonblocking_raw(data, data.bytesize)
+ alias_method :intersect_raw, :intersect
+ def intersect(other)
+ intersected, dest = intersect_raw(other)
+ if intersected
+ dest
+ else
+ nil
+ end
end
end
end
diff --git a/gio2/lib/gio2/output-stream.rb b/gdk3/lib/gdk3/rgba.rb
similarity index 73%
copy from gio2/lib/gio2/output-stream.rb
copy to gdk3/lib/gdk3/rgba.rb
index d686699..b278100 100644
--- a/gio2/lib/gio2/output-stream.rb
+++ b/gdk3/lib/gdk3/rgba.rb
@@ -14,11 +14,19 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-module Gio
- class OutputStream
- alias_method :write_raw, :write
- def write(data)
- write_raw(data, data.bytesize)
+module Gdk
+ class RGBA
+ alias_method :initialize_raw, :initialize
+ def initialize(red, green, blue, alpha)
+ initialize_raw
+ self.red = red
+ self.green = green
+ self.blue = blue
+ self.alpha = alpha
+ end
+
+ def to_a
+ [red, green, blue, alpha]
end
end
end
diff --git a/gio2/lib/gio2/output-stream.rb b/gdk3/lib/gdk3/window-attr.rb
similarity index 73%
copy from gio2/lib/gio2/output-stream.rb
copy to gdk3/lib/gdk3/window-attr.rb
index d686699..7c012ab 100644
--- a/gio2/lib/gio2/output-stream.rb
+++ b/gdk3/lib/gdk3/window-attr.rb
@@ -14,11 +14,15 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-module Gio
- class OutputStream
- alias_method :write_raw, :write
- def write(data)
- write_raw(data, data.bytesize)
+module Gdk
+ class WindowAttr
+ alias_method :initialize_raw, :initialize
+ def initialize(width, height, window_class, window_type)
+ initialize_raw
+ self.width = width
+ self.height = height
+ self.wclass = window_class
+ self.window_type = window_type
end
end
end
diff --git a/gio2/lib/gio2/output-stream.rb b/gdk3/lib/gdk3/window.rb
similarity index 85%
copy from gio2/lib/gio2/output-stream.rb
copy to gdk3/lib/gdk3/window.rb
index d686699..23e2aee 100644
--- a/gio2/lib/gio2/output-stream.rb
+++ b/gdk3/lib/gdk3/window.rb
@@ -14,11 +14,8 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-module Gio
- class OutputStream
- alias_method :write_raw, :write
- def write(data)
- write_raw(data, data.bytesize)
- end
+module Gdk
+ class Window
+ alias_method :invalidate, :invalidate_rect
end
end
diff --git a/gdk3/patches/gdk+-3.10.6-remove-def-use.diff b/gdk3/patches/gdk+-3.10.6-remove-def-use.diff
deleted file mode 100644
index 8621a5d..0000000
--- a/gdk3/patches/gdk+-3.10.6-remove-def-use.diff
+++ /dev/null
@@ -1,106 +0,0 @@
-diff -ru gtk+-3.10.6.orig/gdk/Makefile.am gtk+-3.10.6/gdk/Makefile.am
---- gtk+-3.10.6.orig/gdk/Makefile.am 2013-12-05 12:17:39.000000000 +0900
-+++ gtk+-3.10.6/gdk/Makefile.am 2013-12-25 23:10:14.691695701 +0900
-@@ -179,8 +179,8 @@
- if USE_WIN32
- libgdk_3_la_SOURCES += gdkkeynames.c
- libgdk_3_la_LIBADD += win32/libgdk-win32.la
--libgdk_3_la_DEPENDENCIES = win32/libgdk-win32.la win32/rc/gdk-win32-res.o gdk.def
--libgdk_3_la_LDFLAGS += -Wl,win32/rc/gdk-win32-res.o -export-symbols $(srcdir)/gdk.def
-+libgdk_3_la_DEPENDENCIES = win32/libgdk-win32.la win32/rc/gdk-win32-res.o
-+libgdk_3_la_LDFLAGS += -Wl,win32/rc/gdk-win32-res.o -no-undefined
- endif # USE_WIN32
-
- if USE_BROADWAY
-@@ -270,17 +270,6 @@
-
- endif # HAVE_INTROSPECTION
-
--if OS_WIN32
--install-def-file: gdk.def
-- mkdir -p $(DESTDIR)$(libdir)
-- $(INSTALL) $(srcdir)/gdk.def $(DESTDIR)$(libdir)/gdk-win32-3.0.def
--uninstall-def-file:
-- -rm $(DESTDIR)$(libdir)/gdk-win32-3.0.def
--else
--install-def-file:
--uninstall-def-file:
--endif
--
- if MS_LIB_AVAILABLE
- noinst_DATA = gdk-win32-$(GTK_API_VERSION).lib
-
-@@ -382,9 +371,9 @@
-
- DISTCLEANFILES = gdkconfig.h stamp-gc-h
-
--install-data-local: install-ms-lib install-def-file
-+install-data-local: install-ms-lib
-
--uninstall-local: uninstall-ms-lib uninstall-def-file
-+uninstall-local: uninstall-ms-lib
- rm -f $(DESTDIR)$(configexecincludedir)/gdkconfig.h
-
- # if srcdir!=builddir, clean out maintainer-clean files from builddir
-diff -ru gtk+-3.10.6.orig/gtk/Makefile.am gtk+-3.10.6/gtk/Makefile.am
---- gtk+-3.10.6.orig/gtk/Makefile.am 2013-12-05 12:51:06.000000000 +0900
-+++ gtk+-3.10.6/gtk/Makefile.am 2013-12-25 23:10:26.047429593 +0900
-@@ -61,29 +61,18 @@
- endif
-
- if OS_WIN32
--gtk_def = gtk.def
--gtk_win32_symbols = -export-symbols $(srcdir)/gtk.def
--
- gtk_win32_res = gtk-win32-res.o
- gtk_win32_res_ldflag = -Wl,gtk-win32-res.o
-
- gtk-win32-res.o : gtk-win32.rc
- $(WINDRES) gtk-win32.rc $@
--
--install-def-file: gtk.def
-- $(INSTALL) $(srcdir)/gtk.def $(DESTDIR)$(libdir)/gtk-win32-3.0.def
--uninstall-def-file:
-- -rm $(DESTDIR)$(libdir)/gtk-win32-3.0.def
--else
--install-def-file:
--uninstall-def-file:
- endif
-
- if MS_LIB_AVAILABLE
- noinst_DATA = gtk-win32-$(GTK_API_VERSION).lib
-
--gtk-win32-$(GTK_API_VERSION).lib: libgtk-win32-$(GTK_API_VERSION).la gtk.def
-- lib -machine:@LIB_EXE_MACHINE_FLAG@ -name:libgtk-win32-$(GTK_API_VERSION)- at LT_CURRENT_MINUS_AGE@.dll -def:gtk.def -out:$@
-+gtk-win32-$(GTK_API_VERSION).lib: libgtk-win32-$(GTK_API_VERSION).la
-+ lib -machine:@LIB_EXE_MACHINE_FLAG@ -name:libgtk-win32-$(GTK_API_VERSION)- at LT_CURRENT_MINUS_AGE@.dll -out:$@
-
- install-ms-lib:
- $(INSTALL) gtk-win32-$(GTK_API_VERSION).lib $(DESTDIR)$(libdir)
-@@ -1233,8 +1222,8 @@
- if USE_WIN32
- libgtk_3_la_LIBADD += -lole32 -lgdi32 -lcomdlg32 -lwinspool -lcomctl32
- libgtk_3_la_LDFLAGS += -Wl,-luuid
--libgtk_3_la_DEPENDENCIES += $(gtk_def) $(gtk_win32_res) $(deps)
--libgtk_target_ldflags = $(gtk_win32_res_ldflag) $(gtk_win32_symbols)
-+libgtk_3_la_DEPENDENCIES += $(gtk_win32_res) $(deps)
-+libgtk_target_ldflags = $(gtk_win32_res_ldflag)
- endif
-
- install-exec-hook:
-@@ -1286,13 +1275,13 @@
- rm libgtk.vs10.sourcefiles.filters
-
- # Install a RC file for the default GTK+ theme, and key themes
--install-data-local: install-ms-lib install-def-file install-mac-key-theme
-+install-data-local: install-ms-lib install-mac-key-theme
- $(MKDIR_P) $(DESTDIR)$(datadir)/themes/Default/gtk-3.0
- $(INSTALL_DATA) $(srcdir)/gtk-keys.css.default $(DESTDIR)$(datadir)/themes/Default/gtk-3.0/gtk-keys.css
- $(MKDIR_P) $(DESTDIR)$(datadir)/themes/Emacs/gtk-3.0
- $(INSTALL_DATA) $(srcdir)/gtk-keys.css.emacs $(DESTDIR)$(datadir)/themes/Emacs/gtk-3.0/gtk-keys.css
-
--uninstall-local: uninstall-ms-lib uninstall-def-file uninstall-mac-key-theme
-+uninstall-local: uninstall-ms-lib uninstall-mac-key-theme
- rm -f $(DESTDIR)$(datadir)/themes/Raleigh/gtk-3.0/gtk.css
- rm -f $(DESTDIR)$(datadir)/themes/Default/gtk-3.0/gtk-keys.css
- rm -f $(DESTDIR)$(datadir)/themes/Emacs/gtk-3.0/gtk-keys.css
diff --git a/gdk3/test/run-test.rb b/gdk3/test/run-test.rb
index 4ea4d6f..bc88dde 100755
--- a/gdk3/test/run-test.rb
+++ b/gdk3/test/run-test.rb
@@ -1,6 +1,6 @@
#!/usr/bin/env ruby
#
-# Copyright (C) 2013 Ruby-GNOME2 Project Team
+# Copyright (C) 2013-2014 Ruby-GNOME2 Project Team
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -21,15 +21,20 @@ ruby_gnome2_base = File.expand_path(ruby_gnome2_base)
glib_base = File.join(ruby_gnome2_base, "glib2")
atk_base = File.join(ruby_gnome2_base, "atk")
+cairo_gobject_base = File.join(ruby_gnome2_base, "cairo-gobject")
pango_base = File.join(ruby_gnome2_base, "pango")
gdk_pixbuf_base = File.join(ruby_gnome2_base, "gdk_pixbuf2")
+gobject_introspection_base = File.join(ruby_gnome2_base, "gobject-introspection")
gdk3_base = File.join(ruby_gnome2_base, "gdk3")
-[[glib_base, "glib2"],
- [atk_base, "atk"],
- [pango_base, "pango"],
- [gdk_pixbuf_base, "gdk_pixbuf2"],
- [gdk3_base, "gdk3"]].each do |target, module_name|
+[
+ [glib_base, "glib2"],
+ [atk_base, "atk"],
+ [cairo_gobject_base, "cairo-gobject"],
+ [pango_base, "pango"],
+ [gdk_pixbuf_base, "gdk_pixbuf2"],
+ [gobject_introspection_base, "gobject-introspection"]
+].each do |target, module_name|
if system("which make > /dev/null")
`make -C #{target.dump} > /dev/null` or exit(false)
end
@@ -37,6 +42,8 @@ gdk3_base = File.join(ruby_gnome2_base, "gdk3")
$LOAD_PATH.unshift(File.join(target, "lib"))
end
+$LOAD_PATH.unshift(File.join(gdk3_base, "lib"))
+
$LOAD_PATH.unshift(File.join(glib_base, "test"))
require "glib-test-init"
@@ -44,5 +51,7 @@ $LOAD_PATH.unshift(File.join(gdk3_base, "test"))
require "gdk-test-utils"
require "gdk3"
+Gdk.init
+Gdk.init_check([$0])
exit Test::Unit::AutoRunner.run(true)
diff --git a/gdk3/test/test-gdk-cairo.rb b/gdk3/test/test-gdk-cairo.rb
new file mode 100644
index 0000000..3799e0e
--- /dev/null
+++ b/gdk3/test/test-gdk-cairo.rb
@@ -0,0 +1,71 @@
+# -*- coding: utf-8 -*-
+#
+# Copyright (C) 2014 Ruby-GNOME2 Project Team
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+require "stringio"
+
+class TestGdkCairo < Test::Unit::TestCase
+ def setup
+ output = StringIO.new
+ surface = Cairo::PDFSurface.new(output, 10, 10)
+ @context = Cairo::Context.new(surface)
+ end
+
+ def test_set_source_color
+ color = Gdk::Color.new(0xffff, 0x0000, 0xffff)
+ @context.source_color = color
+ assert_equal(Cairo::Color::RGB.new(1.0, 0.0, 1.0),
+ @context.source.color)
+ end
+
+ sub_test_case "#set_source_rgba" do
+ sub_test_case "RGBA" do
+ def test_rgba
+ rgba = Gdk::RGBA.new(0.1, 0.2, 0.3, 0.4)
+ @context.source_rgba = rgba
+ assert_equal(Cairo::Color::RGB.new(0.1, 0.2, 0.3, 0.4),
+ @context.source.color)
+ end
+
+ def test_values
+ @context.set_source_rgba(0.1, 0.2, 0.3, 0.4)
+ assert_equal([0.1, 0.2, 0.3, 0.4],
+ @context.source.rgba)
+ end
+
+ def test_array
+ @context.set_source_rgba([0.1, 0.2, 0.3, 0.4])
+ assert_equal([0.1, 0.2, 0.3, 0.4],
+ @context.source.rgba)
+ end
+ end
+
+ sub_test_case "RGB" do
+ def test_values
+ @context.set_source_rgb(0.1, 0.2, 0.3)
+ assert_equal([0.1, 0.2, 0.3, 1.0],
+ @context.source.rgba)
+ end
+
+ def test_array
+ @context.set_source_rgb([0.1, 0.2, 0.3])
+ assert_equal([0.1, 0.2, 0.3, 1.0],
+ @context.source.rgba)
+ end
+ end
+ end
+end
diff --git a/gdk3/test/test-gdk-color.rb b/gdk3/test/test-gdk-color.rb
index c7a347f..b81f200 100644
--- a/gdk3/test/test-gdk-color.rb
+++ b/gdk3/test/test-gdk-color.rb
@@ -17,6 +17,31 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
class TestGdkColor < Test::Unit::TestCase
+ sub_test_case ".parse" do
+ def test_invalid_spec
+ spec = "fff"
+ message = "Invalid color spec: <#{spec.inspect}>: "
+ message << "Color spec must be one of them: "
+ message << "\"\#rgb\", "
+ message << "\"\#rrggbb\", "
+ message << "\"\#rrggbb\", "
+ message << "\"\#rrrgggbbb\", "
+ message << "\"\#rrrrggggbbbb\", "
+ message << "\"\#fff\", "
+ message << "\"\#ffffff\", "
+ message << "\"\#fffffffff\", "
+ message << "\"\#fffffffffffff\""
+ assert_raise(ArgumentError.new(message)) do
+ Gdk::Color.parse(spec)
+ end
+ end
+
+ def test_valid
+ color = Gdk::Color.parse("#abc")
+ assert_equal("#aaaabbbbcccc", color.to_s)
+ end
+ end
+
def test_to_s
color = Gdk::Color.new(0xffff, 0x1234, 0xabcd)
assert_equal("#ffff1234abcd", color.to_s)
diff --git a/gio2/lib/gio2/output-stream.rb b/gdk3/test/test-gdk-event-type.rb
similarity index 76%
copy from gio2/lib/gio2/output-stream.rb
copy to gdk3/test/test-gdk-event-type.rb
index d686699..a5efdb8 100644
--- a/gio2/lib/gio2/output-stream.rb
+++ b/gdk3/test/test-gdk-event-type.rb
@@ -14,11 +14,12 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-module Gio
- class OutputStream
- alias_method :write_raw, :write
- def write(data)
- write_raw(data, data.bytesize)
- end
+class TestGdkEventType < Test::Unit::TestCase
+ def test_2button_press
+ assert_equal("2button-press", Gdk::EventType::BUTTON2_PRESS.nick)
+ end
+
+ def test_3button_press
+ assert_equal("3button-press", Gdk::EventType::BUTTON3_PRESS.nick)
end
end
diff --git a/gdk3/test/test-gdk-event.rb b/gdk3/test/test-gdk-event.rb
index fb73e05..f04a855 100644
--- a/gdk3/test/test-gdk-event.rb
+++ b/gdk3/test/test-gdk-event.rb
@@ -30,9 +30,13 @@ class TestGdkEvent < Test::Unit::TestCase
module TestAnyMethods
def test_window
assert_nil(event.window)
+ attributes = Gdk::WindowAttr.new(100, 100, :input_only, :temp)
+ window = Gdk::Window.new(nil, attributes, 0)
+ event.window = window
+ assert_equal(window, event.window)
end
- def test_send_event
+ def test_send_event?
assert_false(event.send_event?)
end
end
@@ -50,12 +54,12 @@ class TestGdkEvent < Test::Unit::TestCase
def test_delete
assert_equal("GDK_DELETE",
- Gdk::EventAny.new(:delete).event_type.name)
+ Gdk::EventAny.new(:delete).type.name)
end
def test_destroy
assert_equal("GDK_DESTROY",
- Gdk::EventAny.new(:destroy).event_type.name)
+ Gdk::EventAny.new(:destroy).type.name)
end
end
@@ -72,12 +76,12 @@ class TestGdkEvent < Test::Unit::TestCase
def test_key_press
assert_equal("GDK_KEY_PRESS",
- Gdk::EventKey.new(:key_press).event_type.name)
+ Gdk::EventKey.new(:key_press).type.name)
end
def test_key_release
assert_equal("GDK_KEY_RELEASE",
- Gdk::EventKey.new(:key_release).event_type.name)
+ Gdk::EventKey.new(:key_release).type.name)
end
def test_time
@@ -106,22 +110,22 @@ class TestGdkEvent < Test::Unit::TestCase
def test_button_press
assert_equal("GDK_BUTTON_PRESS",
- Gdk::EventButton.new(:button_press).event_type.name)
+ Gdk::EventButton.new(:button_press).type.name)
end
def test_button2_press
assert_equal("GDK_2BUTTON_PRESS",
- Gdk::EventButton.new(:button2_press).event_type.name)
+ Gdk::EventButton.new(:button2_press).type.name)
end
def test_button3_press
assert_equal("GDK_3BUTTON_PRESS",
- Gdk::EventButton.new(:button3_press).event_type.name)
+ Gdk::EventButton.new(:button3_press).type.name)
end
def test_button_release
assert_equal("GDK_BUTTON_RELEASE",
- Gdk::EventButton.new(:button_release).event_type.name)
+ Gdk::EventButton.new(:button_release).type.name)
end
def test_time
@@ -188,28 +192,26 @@ class TestGdkEvent < Test::Unit::TestCase
def test_touch_begin
assert_equal("GDK_TOUCH_BEGIN",
- Gdk::EventTouch.new(:touch_begin).event_type.name)
+ Gdk::EventTouch.new(:touch_begin).type.name)
end
def test_touch_update
assert_equal("GDK_TOUCH_UPDATE",
- Gdk::EventTouch.new(:touch_update).event_type.name)
+ Gdk::EventTouch.new(:touch_update).type.name)
end
def test_touch_cancel
assert_equal("GDK_TOUCH_CANCEL",
- Gdk::EventTouch.new(:touch_cancel).event_type.name)
+ Gdk::EventTouch.new(:touch_cancel).type.name)
end
def test_touch_end
assert_equal("GDK_TOUCH_END",
- Gdk::EventTouch.new(:touch_end).event_type.name)
+ Gdk::EventTouch.new(:touch_end).type.name)
end
def test_emulating_pointer
- assert_nothing_raised do
- @touch.emulating_pointer
- end
+ assert_boolean(@touch.emulating_pointer?)
end
def test_device
@@ -231,7 +233,7 @@ class TestGdkEvent < Test::Unit::TestCase
include TestAnyMethods
def setup
- @scroll = Gdk::EventScroll.new
+ @scroll = Gdk::EventScroll.new(:scroll)
end
def event
@@ -255,7 +257,7 @@ class TestGdkEvent < Test::Unit::TestCase
end
def test_direction
- assert_kind_of(Gdk::EventScroll::Direction, @scroll.direction)
+ assert_kind_of(Gdk::ScrollDirection, @scroll.direction)
end
def test_x_root
@@ -271,7 +273,7 @@ class TestGdkEvent < Test::Unit::TestCase
include TestAnyMethods
def setup
- @motion = Gdk::EventMotion.new
+ @motion = Gdk::EventMotion.new(:motion_notify)
end
def event
@@ -321,7 +323,7 @@ class TestGdkEvent < Test::Unit::TestCase
end
def test_state
- assert_kind_of(Gdk::EventVisibility::State, @visibility.state)
+ assert_kind_of(Gdk::VisibilityState, @visibility.state)
end
end
@@ -338,12 +340,12 @@ class TestGdkEvent < Test::Unit::TestCase
def test_enter_notify
assert_equal("GDK_ENTER_NOTIFY",
- Gdk::EventCrossing.new(:enter_notify).event_type.name)
+ Gdk::EventCrossing.new(:enter_notify).type.name)
end
def test_leave_notify
assert_equal("GDK_LEAVE_NOTIFY",
- Gdk::EventCrossing.new(:leave_notify).event_type.name)
+ Gdk::EventCrossing.new(:leave_notify).type.name)
end
def test_time
@@ -351,13 +353,11 @@ class TestGdkEvent < Test::Unit::TestCase
end
def test_x
- # TODO: Is Float better?
- assert_kind_of(Integer, @crossing.x)
+ assert_kind_of(Float, @crossing.x)
end
def test_y
- # TODO: Is Float better?
- assert_kind_of(Integer, @crossing.y)
+ assert_kind_of(Float, @crossing.y)
end
def test_x_root
@@ -369,7 +369,7 @@ class TestGdkEvent < Test::Unit::TestCase
end
def test_mode
- assert_kind_of(Gdk::EventCrossing::Mode, @crossing.mode)
+ assert_kind_of(Gdk::CrossingMode, @crossing.mode)
end
def test_detail
@@ -385,7 +385,7 @@ class TestGdkEvent < Test::Unit::TestCase
include TestAnyMethods
def setup
- @focus = Gdk::EventFocus.new
+ @focus = Gdk::EventFocus.new(:focus_change)
end
def event
@@ -401,7 +401,7 @@ class TestGdkEvent < Test::Unit::TestCase
include TestAnyMethods
def setup
- @configure = Gdk::EventConfigure.new
+ @configure = Gdk::EventConfigure.new(:configure)
end
def event
@@ -429,7 +429,7 @@ class TestGdkEvent < Test::Unit::TestCase
include TestAnyMethods
def setup
- @property = Gdk::EventProperty.new
+ @property = Gdk::EventProperty.new(:property_notify)
end
def event
@@ -447,7 +447,7 @@ class TestGdkEvent < Test::Unit::TestCase
end
def test_state
- assert_equal(Gdk::EventProperty::State::NEW_VALUE, @property.state)
+ assert_equal(Gdk::PropertyState::NEW_VALUE, @property.state)
end
end
@@ -464,17 +464,17 @@ class TestGdkEvent < Test::Unit::TestCase
def test_selection_clear
assert_equal("GDK_SELECTION_CLEAR",
- Gdk::EventSelection.new(:selection_clear).event_type.name)
+ Gdk::EventSelection.new(:selection_clear).type.name)
end
def test_selection_notify
assert_equal("GDK_SELECTION_NOTIFY",
- Gdk::EventSelection.new(:selection_notify).event_type.name)
+ Gdk::EventSelection.new(:selection_notify).type.name)
end
def test_selection_request
assert_equal("GDK_SELECTION_REQUEST",
- Gdk::EventSelection.new(:selection_request).event_type.name)
+ Gdk::EventSelection.new(:selection_request).type.name)
end
def test_selection
@@ -513,32 +513,32 @@ class TestGdkEvent < Test::Unit::TestCase
def test_drag_enter
assert_equal("GDK_DRAG_ENTER",
- Gdk::EventDND.new(:drag_enter).event_type.name)
+ Gdk::EventDND.new(:drag_enter).type.name)
end
def test_drag_leave
assert_equal("GDK_DRAG_LEAVE",
- Gdk::EventDND.new(:drag_leave).event_type.name)
+ Gdk::EventDND.new(:drag_leave).type.name)
end
def test_drag_motion
assert_equal("GDK_DRAG_MOTION",
- Gdk::EventDND.new(:drag_motion).event_type.name)
+ Gdk::EventDND.new(:drag_motion).type.name)
end
def test_drag_status
assert_equal("GDK_DRAG_STATUS",
- Gdk::EventDND.new(:drag_status).event_type.name)
+ Gdk::EventDND.new(:drag_status).type.name)
end
def test_drop_start
assert_equal("GDK_DROP_START",
- Gdk::EventDND.new(:drop_start).event_type.name)
+ Gdk::EventDND.new(:drop_start).type.name)
end
def test_drop_finished
assert_equal("GDK_DROP_FINISHED",
- Gdk::EventDND.new(:drop_finished).event_type.name)
+ Gdk::EventDND.new(:drop_finished).type.name)
end
def test_context
@@ -573,12 +573,12 @@ class TestGdkEvent < Test::Unit::TestCase
def test_proximity_in
assert_equal("GDK_PROXIMITY_IN",
- Gdk::EventProximity.new(:proximity_in).event_type.name)
+ Gdk::EventProximity.new(:proximity_in).type.name)
end
def test_proximity_out
assert_equal("GDK_PROXIMITY_OUT",
- Gdk::EventProximity.new(:proximity_out).event_type.name)
+ Gdk::EventProximity.new(:proximity_out).type.name)
end
def test_time
@@ -596,7 +596,7 @@ class TestGdkEvent < Test::Unit::TestCase
include TestAnyMethods
def setup
- @window_state = Gdk::EventWindowState.new
+ @window_state = Gdk::EventWindowState.new(:window_state)
end
def event
@@ -620,7 +620,7 @@ class TestGdkEvent < Test::Unit::TestCase
include TestAnyMethods
def setup
- @setting = Gdk::EventSetting.new
+ @setting = Gdk::EventSetting.new(:setting)
end
def event
@@ -642,7 +642,7 @@ class TestGdkEvent < Test::Unit::TestCase
class TestOwnerChange < self
def setup
- @owner_change = Gdk::EventOwnerChange.new
+ @owner_change = Gdk::EventOwnerChange.new(:owner_change)
end
def event
@@ -680,7 +680,7 @@ class TestGdkEvent < Test::Unit::TestCase
include TestAnyMethods
def setup
- @grab_broken = Gdk::EventGrabBroken.new
+ @grab_broken = Gdk::EventGrabBroken.new(:grab_broken)
end
def event
@@ -696,9 +696,7 @@ class TestGdkEvent < Test::Unit::TestCase
end
def test_grab_window
- assert_nothing_raised do
- @grab_broken.grab_window
- end
+ assert_nil(@grab_broken.grab_window)
end
end
end
diff --git a/gdk3/test/test-gdk-keyval.rb b/gdk3/test/test-gdk-keyval.rb
new file mode 100644
index 0000000..96818cf
--- /dev/null
+++ b/gdk3/test/test-gdk-keyval.rb
@@ -0,0 +1,76 @@
+# Copyright (C) 2014 Ruby-GNOME2 Project Team
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+class TestGdkKeyval < Test::Unit::TestCase
+ def test_consntant_name
+ assert_equal("a".unpack("c")[0], Gdk::Keyval::KEY_a)
+ end
+
+ sub_test_case "#lower?" do
+ def test_lower
+ assert_true(Gdk::Keyval.lower?(Gdk::Keyval::KEY_a))
+ end
+
+ def test_upper
+ assert_false(Gdk::Keyval.lower?(Gdk::Keyval::KEY_A))
+ end
+ end
+
+ sub_test_case "#upper?" do
+ def test_lower
+ assert_false(Gdk::Keyval.upper?(Gdk::Keyval::KEY_a))
+ end
+
+ def test_upper
+ assert_true(Gdk::Keyval.upper?(Gdk::Keyval::KEY_A))
+ end
+ end
+
+ def test_name
+ assert_equal("A", Gdk::Keyval.name(Gdk::Keyval::KEY_A))
+ end
+
+ sub_test_case "#to_lower" do
+ def test_lower
+ assert_equal(Gdk::Keyval::KEY_a,
+ Gdk::Keyval.to_lower(Gdk::Keyval::KEY_a))
+ end
+
+ def test_upper
+ assert_equal(Gdk::Keyval::KEY_a,
+ Gdk::Keyval.to_lower(Gdk::Keyval::KEY_A))
+ end
+ end
+
+ sub_test_case "#to_upper" do
+ def test_lower
+ assert_equal(Gdk::Keyval::KEY_A,
+ Gdk::Keyval.to_upper(Gdk::Keyval::KEY_a))
+ end
+
+ def test_upper
+ assert_equal(Gdk::Keyval::KEY_A,
+ Gdk::Keyval.to_upper(Gdk::Keyval::KEY_A))
+ end
+ end
+
+ sub_test_case "#to_unicode" do
+ def test_to_unicode
+ assert_equal("\u02D8", # BREVE
+ [Gdk::Keyval.to_unicode(Gdk::Keyval::KEY_breve)].pack("U"))
+ end
+ end
+end
diff --git a/gdk3/test/test-gdk-pixbuf.rb b/gdk3/test/test-gdk-pixbuf.rb
new file mode 100644
index 0000000..1889d12
--- /dev/null
+++ b/gdk3/test/test-gdk-pixbuf.rb
@@ -0,0 +1,49 @@
+# -*- coding: utf-8 -*-
+#
+# Copyright (C) 2014 Ruby-GNOME2 Project Team
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+class TestGdkPixbuf < Test::Unit::TestCase
+ def test_window
+ gdk_window = Gdk.default_root_window
+ src_x = 0
+ src_y = 0
+ width = 290
+ height = 200
+
+ pixbuf = gdk_window.to_pixbuf(src_x,
+ src_y,
+ width,
+ height)
+ assert_equal([width, height],
+ [pixbuf.width, pixbuf.height])
+ end
+
+ def test_surface
+ surface = Cairo::ImageSurface.new(:argb32, 290, 200)
+ src_x = 0
+ src_y = 0
+ width = 290
+ height = 200
+
+ pixbuf = surface.to_pixbuf(src_x,
+ src_y,
+ width,
+ height)
+ assert_equal([width, height],
+ [pixbuf.width, pixbuf.height])
+ end
+end
diff --git a/gdk3/test/test-gdk-rectangle.rb b/gdk3/test/test-gdk-rectangle.rb
index 8c0548e..f81d272 100644
--- a/gdk3/test/test-gdk-rectangle.rb
+++ b/gdk3/test/test-gdk-rectangle.rb
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
-# Copyright (C) 2013 Ruby-GNOME2 Project Team
+# Copyright (C) 2013-2014 Ruby-GNOME2 Project Team
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -17,8 +17,39 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
class TestGdkRectangle < Test::Unit::TestCase
- def test_width
- rectangle = Gdk::Rectangle.new(0, 10, 20, 30)
- assert_equal(20, rectangle.width)
+ def test_intersect
+ rectangle1 = Gdk::Rectangle.new(0, 10, 20, 30)
+ rectangle2 = Gdk::Rectangle.new(5, 15, 10, 20)
+ intersected = rectangle1.intersect(rectangle2)
+ assert_equal([
+ 5,
+ 15,
+ 10,
+ 20,
+ ],
+ [
+ intersected.x,
+ intersected.y,
+ intersected.width,
+ intersected.height,
+ ])
+ end
+
+ def test_union
+ rectangle1 = Gdk::Rectangle.new(0, 10, 20, 30)
+ rectangle2 = Gdk::Rectangle.new(5, 15, 40, 20)
+ unioned_rectangle = rectangle1.union(rectangle2)
+ assert_equal([
+ 0,
+ 10,
+ 45,
+ 30,
+ ],
+ [
+ unioned_rectangle.x,
+ unioned_rectangle.y,
+ unioned_rectangle.width,
+ unioned_rectangle.height,
+ ])
end
end
diff --git a/gdk3/test/test-gdk-rgba.rb b/gdk3/test/test-gdk-rgba.rb
index 8ab33cf..67254d0 100644
--- a/gdk3/test/test-gdk-rgba.rb
+++ b/gdk3/test/test-gdk-rgba.rb
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
-# Copyright (C) 2013 Ruby-GNOME2 Project Team
+# Copyright (C) 2013-2014 Ruby-GNOME2 Project Team
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -21,4 +21,9 @@ class TestGdkRGBA < Test::Unit::TestCase
rgba = Gdk::RGBA.new(0.2, 0.4, 0.6, 0.5)
assert_equal("rgba(51,102,153,0.5)", rgba.to_s)
end
+
+ def test_to_a
+ rgba = Gdk::RGBA.new(0.2, 0.4, 0.6, 0.5)
+ assert_equal([0.2, 0.4, 0.6, 0.5], rgba.to_a)
+ end
end
diff --git a/gdk3/test/test-gdk-window-attr.rb b/gdk3/test/test-gdk-window-attr.rb
index 8678eec..dd61985 100644
--- a/gdk3/test/test-gdk-window-attr.rb
+++ b/gdk3/test/test-gdk-window-attr.rb
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
-# Copyright (C) 2013 Ruby-GNOME2 Project Team
+# Copyright (C) 2013-2014 Ruby-GNOME2 Project Team
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -24,8 +24,8 @@ class TestGdkWindowAttr < Test::Unit::TestCase
assert_equal([
100,
100,
- Gdk::Window::WindowClass::INPUT_ONLY,
- Gdk::Window::Type::TEMP,
+ Gdk::WindowWindowClass::INPUT_ONLY,
+ Gdk::WindowType::TEMP,
],
[attrs.width, attrs.height, attrs.wclass, attrs.window_type])
end
diff --git a/gdk_pixbuf2/Rakefile b/gdk_pixbuf2/Rakefile
index fe8c459..0d94dc3 100644
--- a/gdk_pixbuf2/Rakefile
+++ b/gdk_pixbuf2/Rakefile
@@ -18,7 +18,7 @@ package_task = GNOME2::Rake::PackageTask.new do |package|
:name => "gdk-pixbuf",
:download_site => :gnome,
:label => "gdk-pixbuf",
- :version => "2.30.6",
+ :version => "2.30.8",
:compression_method => "xz",
:windows => {
:configure_args => [
diff --git a/gdk_pixbuf2/ext/gdk_pixbuf2/extconf.rb b/gdk_pixbuf2/ext/gdk_pixbuf2/extconf.rb
index dc6b08b..55f3853 100644
--- a/gdk_pixbuf2/ext/gdk_pixbuf2/extconf.rb
+++ b/gdk_pixbuf2/ext/gdk_pixbuf2/extconf.rb
@@ -39,7 +39,7 @@ end
:target_build_dir => build_dir)
end
-setup_win32(module_name, base_dir)
+setup_windows(module_name, base_dir)
unless required_pkg_config_package(package_id,
:debian => "libgdk-pixbuf2.0-dev",
diff --git a/gio2/Makefile b/gio2/Makefile
new file mode 100644
index 0000000..27a3d42
--- /dev/null
+++ b/gio2/Makefile
@@ -0,0 +1,20 @@
+all:
+ (cd ext/gio2 && $(MAKE))
+ $(MAKE) -f Makefile.lib
+
+install:
+ (cd ext/gio2 && $(MAKE) install)
+ $(MAKE) -f Makefile.lib install
+
+site-install:
+ (cd ext/gio2 && $(MAKE) site-install)
+ $(MAKE) -f Makefile.lib site-install
+
+clean:
+ (cd ext/gio2 && $(MAKE) clean)
+ $(MAKE) -f Makefile.lib clean
+
+distclean:
+ (cd ext/gio2 && $(MAKE) distclean)
+ $(MAKE) -f Makefile.lib distclean
+ @rm -f Makefile.lib
diff --git a/gio2/Makefile.lib b/gio2/Makefile.lib
new file mode 100644
index 0000000..7bb4d00
--- /dev/null
+++ b/gio2/Makefile.lib
@@ -0,0 +1,226 @@
+
+SHELL = /bin/sh
+
+# V=0 quiet, V=1 verbose. other values don't work.
+V = 0
+Q1 = $(V:1=)
+Q = $(Q1:0=@)
+ECHO1 = $(V:1=@:)
+ECHO = $(ECHO1:0=@echo)
+
+#### Start of system configuration section. ####
+
+srcdir = /home/kou/work/ruby/ruby-gnome2.clean/gio2
+topdir = /usr/include/ruby-2.1.0
+hdrdir = $(topdir)
+arch_hdrdir = /usr/include/x86_64-linux-gnu/ruby-2.1.0
+PATH_SEPARATOR = :
+VPATH = $(srcdir):$(arch_hdrdir)/ruby:$(hdrdir)/ruby
+prefix = $(DESTDIR)/usr
+rubysitearchprefix = $(sitearchlibdir)/$(RUBY_BASE_NAME)
+rubyarchprefix = $(archlibdir)/$(RUBY_BASE_NAME)
+rubylibprefix = $(libdir)/$(RUBY_BASE_NAME)
+exec_prefix = $(prefix)
+vendorarchhdrdir = $(sitearchincludedir)/$(RUBY_VERSION_NAME)/vendor_ruby
+sitearchhdrdir = $(sitearchincludedir)/$(RUBY_VERSION_NAME)/site_ruby
+rubyarchhdrdir = $(archincludedir)/$(RUBY_VERSION_NAME)
+vendorhdrdir = $(rubyhdrdir)/vendor_ruby
+sitehdrdir = $(rubyhdrdir)/site_ruby
+rubyhdrdir = $(includedir)/$(RUBY_VERSION_NAME)
+vendorarchdir = $(rubysitearchprefix)/vendor_ruby/$(ruby_version)
+vendorlibdir = $(vendordir)/$(ruby_version)
+vendordir = $(rubylibprefix)/vendor_ruby
+sitearchdir = $(DESTDIR)/usr/local/lib/x86_64-linux-gnu/site_ruby
+sitelibdir = $(sitedir)/$(ruby_version)
+sitedir = $(DESTDIR)/usr/local/lib/site_ruby
+rubyarchdir = $(rubyarchprefix)/$(ruby_version)
+rubylibdir = $(rubylibprefix)/$(ruby_version)
+sitearchincludedir = $(includedir)/$(sitearch)
+archincludedir = $(includedir)/$(arch)
+sitearchlibdir = $(libdir)/$(sitearch)
+archlibdir = $(libdir)/$(arch)
+ridir = $(datarootdir)/$(RI_BASE_NAME)
+mandir = $(prefix)/share/man
+localedir = $(datarootdir)/locale
+libdir = $(exec_prefix)/lib
+psdir = $(docdir)
+pdfdir = $(docdir)
+dvidir = $(docdir)
+htmldir = $(docdir)
+infodir = $(prefix)/share/info
+docdir = $(datarootdir)/doc/$(PACKAGE)
+oldincludedir = $(DESTDIR)/usr/include
+includedir = $(prefix)/include
+localstatedir = $(DESTDIR)/var
+sharedstatedir = $(prefix)/com
+sysconfdir = $(DESTDIR)/etc
+datadir = $(datarootdir)
+datarootdir = $(prefix)/share
+libexecdir = $(prefix)/lib/ruby2.1
+sbindir = $(exec_prefix)/sbin
+bindir = $(exec_prefix)/bin
+archdir = $(rubyarchdir)
+
+
+CC = gcc
+CXX = g++
+LIBRUBY = $(LIBRUBY_SO)
+LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
+LIBRUBYARG_SHARED = -l$(RUBY_SO_NAME)
+LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)-static
+empty =
+OUTFLAG = -o $(empty)
+COUTFLAG = -o $(empty)
+
+RUBY_EXTCONF_H =
+cflags = $(optflags) $(debugflags) $(warnflags)
+optflags = -O3 -fno-fast-math
+debugflags = -ggdb3
+warnflags = -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration
+CCDLFLAGS = -fPIC
+CFLAGS = $(CCDLFLAGS) -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fPIC $(ARCH_FLAG)
+INCFLAGS = -I. -I$(arch_hdrdir) -I$(hdrdir)/ruby/backward -I$(hdrdir) -I$(srcdir)
+DEFS =
+CPPFLAGS = -D_FORTIFY_SOURCE=2 $(DEFS) $(cppflags)
+CXXFLAGS = $(CCDLFLAGS) -g -O2 -fstack-protector-strong -Wformat -Werror=format-security $(ARCH_FLAG)
+ldflags = -L. -Wl,-z,relro -L/build/ruby2.1-64qTCU/ruby2.1-2.1.5/debian/lib -fstack-protector -rdynamic -Wl,-export-dynamic
+dldflags =
+ARCH_FLAG =
+DLDFLAGS = $(ldflags) $(dldflags) $(ARCH_FLAG)
+LDSHARED = $(CC) -shared
+LDSHAREDXX = $(CXX) -shared
+AR = ar
+EXEEXT =
+
+RUBY_INSTALL_NAME = ruby2.1
+RUBY_SO_NAME = ruby-2.1
+RUBYW_INSTALL_NAME =
+RUBY_VERSION_NAME = $(RUBY_BASE_NAME)-$(ruby_version)
+RUBYW_BASE_NAME = rubyw
+RUBY_BASE_NAME = ruby
+
+arch = x86_64-linux-gnu
+sitearch = $(arch)
+ruby_version = 2.1.0
+ruby = $(bindir)/ruby2.1
+RUBY = $(ruby)
+ruby_headers = $(hdrdir)/ruby.h $(hdrdir)/ruby/ruby.h $(hdrdir)/ruby/defines.h $(hdrdir)/ruby/missing.h $(hdrdir)/ruby/intern.h $(hdrdir)/ruby/st.h $(hdrdir)/ruby/subst.h $(arch_hdrdir)/ruby/config.h
+
+RM = rm -f
+RM_RF = $(RUBY) -run -e rm -- -rf
+RMDIRS = rmdir --ignore-fail-on-non-empty -p
+MAKEDIRS = /bin/mkdir -p
+INSTALL = /usr/bin/install -c
+INSTALL_PROG = $(INSTALL) -m 0755
+INSTALL_DATA = $(INSTALL) -m 644
+COPY = cp
+TOUCH = exit >
+
+#### End of system configuration section. ####
+
+preload =
+
+libpath = . $(archlibdir)
+LIBPATH = -L. -L$(archlibdir)
+DEFFILE =
+
+CLEANFILES = mkmf.log
+DISTCLEANFILES =
+DISTCLEANDIRS =
+
+extout =
+extout_prefix =
+target_prefix =
+LOCAL_LIBS =
+LIBS = $(LIBRUBYARG_SHARED) -lpthread -lgmp -ldl -lcrypt -lm -lc
+ORIG_SRCS =
+SRCS = $(ORIG_SRCS)
+OBJS =
+HDRS =
+TARGET =
+TARGET_NAME =
+TARGET_ENTRY = Init_$(TARGET_NAME)
+DLLIB =
+EXTSTATIC =
+STATIC_LIB =
+
+TIMESTAMP_DIR = .
+BINDIR = $(bindir)
+RUBYCOMMONDIR = $(sitedir)$(target_prefix)
+RUBYLIBDIR = $(sitelibdir)$(target_prefix)
+RUBYARCHDIR = $(sitearchdir)$(target_prefix)
+HDRDIR = $(rubyhdrdir)/ruby$(target_prefix)
+ARCHHDRDIR = $(rubyhdrdir)/$(arch)/ruby$(target_prefix)
+
+TARGET_SO = $(DLLIB)
+CLEANLIBS = $(TARGET).so
+CLEANOBJS = *.o *.bak
+
+all: Makefile
+static: $(STATIC_LIB)
+.PHONY: all install static install-so install-rb
+.PHONY: clean clean-so clean-static clean-rb
+
+clean-static::
+clean-rb-default::
+clean-rb::
+clean-so::
+clean: clean-so clean-static clean-rb-default clean-rb
+ -$(Q)$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES) .*.time
+
+distclean-rb-default::
+distclean-rb::
+distclean-so::
+distclean-static::
+distclean: clean distclean-so distclean-static distclean-rb-default distclean-rb
+ -$(Q)$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log
+ -$(Q)$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES)
+ -$(Q)$(RMDIRS) $(DISTCLEANDIRS) 2> /dev/null || true
+
+realclean: distclean
+install: install-so install-rb
+
+install-so: Makefile
+install-rb: pre-install-rb install-rb-default
+install-rb-default: pre-install-rb-default
+pre-install-rb: Makefile
+pre-install-rb-default: Makefile
+pre-install-rb-default: $(TIMESTAMP_DIR)/.RUBYLIBDIR.-.gio2.time
+install-rb-default: $(RUBYLIBDIR)/gio2/inet-address.rb
+$(RUBYLIBDIR)/gio2/inet-address.rb: $(srcdir)/lib/gio2/inet-address.rb $(TIMESTAMP_DIR)/.RUBYLIBDIR.-.gio2.time
+ $(Q) $(INSTALL_DATA) $(srcdir)/lib/gio2/inet-address.rb $(@D)
+install-rb-default: $(RUBYLIBDIR)/gio2/deprecated.rb
+$(RUBYLIBDIR)/gio2/deprecated.rb: $(srcdir)/lib/gio2/deprecated.rb $(TIMESTAMP_DIR)/.RUBYLIBDIR.-.gio2.time
+ $(Q) $(INSTALL_DATA) $(srcdir)/lib/gio2/deprecated.rb $(@D)
+install-rb-default: $(RUBYLIBDIR)/gio2/pollable-input-stream.rb
+$(RUBYLIBDIR)/gio2/pollable-input-stream.rb: $(srcdir)/lib/gio2/pollable-input-stream.rb $(TIMESTAMP_DIR)/.RUBYLIBDIR.-.gio2.time
+ $(Q) $(INSTALL_DATA) $(srcdir)/lib/gio2/pollable-input-stream.rb $(@D)
+install-rb-default: $(RUBYLIBDIR)/gio2/input-stream.rb
+$(RUBYLIBDIR)/gio2/input-stream.rb: $(srcdir)/lib/gio2/input-stream.rb $(TIMESTAMP_DIR)/.RUBYLIBDIR.-.gio2.time
+ $(Q) $(INSTALL_DATA) $(srcdir)/lib/gio2/input-stream.rb $(@D)
+install-rb-default: $(RUBYLIBDIR)/gio2/loader.rb
+$(RUBYLIBDIR)/gio2/loader.rb: $(srcdir)/lib/gio2/loader.rb $(TIMESTAMP_DIR)/.RUBYLIBDIR.-.gio2.time
+ $(Q) $(INSTALL_DATA) $(srcdir)/lib/gio2/loader.rb $(@D)
+install-rb-default: $(RUBYLIBDIR)/gio2/resources.rb
+$(RUBYLIBDIR)/gio2/resources.rb: $(srcdir)/lib/gio2/resources.rb $(TIMESTAMP_DIR)/.RUBYLIBDIR.-.gio2.time
+ $(Q) $(INSTALL_DATA) $(srcdir)/lib/gio2/resources.rb $(@D)
+install-rb-default: $(RUBYLIBDIR)/gio2/pollable-output-stream.rb
+$(RUBYLIBDIR)/gio2/pollable-output-stream.rb: $(srcdir)/lib/gio2/pollable-output-stream.rb $(TIMESTAMP_DIR)/.RUBYLIBDIR.-.gio2.time
+ $(Q) $(INSTALL_DATA) $(srcdir)/lib/gio2/pollable-output-stream.rb $(@D)
+pre-install-rb-default: $(TIMESTAMP_DIR)/.RUBYLIBDIR.time
+install-rb-default: $(RUBYLIBDIR)/gio2.rb
+$(RUBYLIBDIR)/gio2.rb: $(srcdir)/lib/gio2.rb $(TIMESTAMP_DIR)/.RUBYLIBDIR.time
+ $(Q) $(INSTALL_DATA) $(srcdir)/lib/gio2.rb $(@D)
+pre-install-rb-default:
+ $(ECHO) installing default libraries
+$(TIMESTAMP_DIR)/.RUBYLIBDIR.-.gio2.time:
+ $(Q) $(MAKEDIRS) $(@D) $(RUBYLIBDIR)/gio2
+ $(Q) $(TOUCH) $@
+$(TIMESTAMP_DIR)/.RUBYLIBDIR.time:
+ $(Q) $(MAKEDIRS) $(@D) $(RUBYLIBDIR)
+ $(Q) $(TOUCH) $@
+
+site-install: site-install-so site-install-rb
+site-install-so: install-so
+site-install-rb: install-rb
+
diff --git a/gio2/ext/gio2/Makefile b/gio2/ext/gio2/Makefile
new file mode 100644
index 0000000..627ca91
--- /dev/null
+++ b/gio2/ext/gio2/Makefile
@@ -0,0 +1,244 @@
+
+SHELL = /bin/sh
+
+# V=0 quiet, V=1 verbose. other values don't work.
+V = 0
+Q1 = $(V:1=)
+Q = $(Q1:0=@)
+ECHO1 = $(V:1=@:)
+ECHO = $(ECHO1:0=@echo)
+
+#### Start of system configuration section. ####
+
+srcdir = /home/kou/work/ruby/ruby-gnome2.clean/gio2/ext/gio2
+topdir = /usr/include/ruby-2.1.0
+hdrdir = $(topdir)
+arch_hdrdir = /usr/include/x86_64-linux-gnu/ruby-2.1.0
+PATH_SEPARATOR = :
+VPATH = $(srcdir):$(arch_hdrdir)/ruby:$(hdrdir)/ruby
+prefix = $(DESTDIR)/usr
+rubysitearchprefix = $(sitearchlibdir)/$(RUBY_BASE_NAME)
+rubyarchprefix = $(archlibdir)/$(RUBY_BASE_NAME)
+rubylibprefix = $(libdir)/$(RUBY_BASE_NAME)
+exec_prefix = $(prefix)
+vendorarchhdrdir = $(sitearchincludedir)/$(RUBY_VERSION_NAME)/vendor_ruby
+sitearchhdrdir = $(sitearchincludedir)/$(RUBY_VERSION_NAME)/site_ruby
+rubyarchhdrdir = $(archincludedir)/$(RUBY_VERSION_NAME)
+vendorhdrdir = $(rubyhdrdir)/vendor_ruby
+sitehdrdir = $(rubyhdrdir)/site_ruby
+rubyhdrdir = $(includedir)/$(RUBY_VERSION_NAME)
+vendorarchdir = $(rubysitearchprefix)/vendor_ruby/$(ruby_version)
+vendorlibdir = $(vendordir)/$(ruby_version)
+vendordir = $(rubylibprefix)/vendor_ruby
+sitearchdir = $(DESTDIR)/usr/local/lib/x86_64-linux-gnu/site_ruby
+sitelibdir = $(sitedir)/$(ruby_version)
+sitedir = $(DESTDIR)/usr/local/lib/site_ruby
+rubyarchdir = $(rubyarchprefix)/$(ruby_version)
+rubylibdir = $(rubylibprefix)/$(ruby_version)
+sitearchincludedir = $(includedir)/$(sitearch)
+archincludedir = $(includedir)/$(arch)
+sitearchlibdir = $(libdir)/$(sitearch)
+archlibdir = $(libdir)/$(arch)
+ridir = $(datarootdir)/$(RI_BASE_NAME)
+mandir = $(prefix)/share/man
+localedir = $(datarootdir)/locale
+libdir = $(exec_prefix)/lib
+psdir = $(docdir)
+pdfdir = $(docdir)
+dvidir = $(docdir)
+htmldir = $(docdir)
+infodir = $(prefix)/share/info
+docdir = $(datarootdir)/doc/$(PACKAGE)
+oldincludedir = $(DESTDIR)/usr/include
+includedir = $(prefix)/include
+localstatedir = $(DESTDIR)/var
+sharedstatedir = $(prefix)/com
+sysconfdir = $(DESTDIR)/etc
+datadir = $(datarootdir)
+datarootdir = $(prefix)/share
+libexecdir = $(prefix)/lib/ruby2.1
+sbindir = $(exec_prefix)/sbin
+bindir = $(exec_prefix)/bin
+archdir = $(rubyarchdir)
+
+
+CC = gcc
+CXX = g++
+LIBRUBY = $(LIBRUBY_SO)
+LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
+LIBRUBYARG_SHARED = -l$(RUBY_SO_NAME)
+LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)-static
+empty =
+OUTFLAG = -o $(empty)
+COUTFLAG = -o $(empty)
+
+RUBY_EXTCONF_H =
+cflags = $(optflags) $(debugflags) $(warnflags)
+optflags = -O3 -fno-fast-math
+debugflags = -ggdb3
+warnflags = -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration
+CCDLFLAGS = -fPIC
+CFLAGS = $(CCDLFLAGS) -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fPIC -Wall -Waggregate-return -Wcast-align -Wextra -Wformat=2 -Winit-self -Wlarger-than-65500 -Wmissing-declarations -Wmissing-format-attribute -Wmissing-include-dirs -Wmissing-noreturn -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpacked -Wp,-D_FORTIFY_SOURCE=2 -Wpointer-arith -Wswitch-default -Wswitch-enum -Wundef -Wunsafe-loop-optimizations -Wwrite-strings -pthread -I/usr/include [...]
+INCFLAGS = -I. -I/home/kou/work/ruby/ruby-gnome2.clean/gobject-introspection/ext/gobject-introspection -I/home/kou/work/ruby/ruby-gnome2.clean/gobject-introspection/ext/gobject-introspection -I/home/kou/work/ruby/ruby-gnome2.clean/gobject-introspection/ext/gobject-introspection -I/home/kou/work/ruby/ruby-gnome2.clean/gobject-introspection/ext/gobject-introspection -I/var/lib/gems/2.1.0/gems/gobject-introspection-2.2.3/ext/gobject-introspection -I/home/kou/work/ruby/ruby-gnome2.clean/glib [...]
+DEFS =
+CPPFLAGS = -DHAVE_RB_DEFINE_ALLOC_FUNC -DHAVE_RB_BLOCK_PROC -DHAVE_OBJECT_ALLOCATE -DRUBY_GIO2_COMPILATION -D_FORTIFY_SOURCE=2 $(DEFS) $(cppflags)
+CXXFLAGS = $(CCDLFLAGS) -g -O2 -fstack-protector-strong -Wformat -Werror=format-security $(ARCH_FLAG)
+ldflags = -L. -Wl,-z,relro -L/build/ruby2.1-64qTCU/ruby2.1-2.1.5/debian/lib -fstack-protector -rdynamic -Wl,-export-dynamic -L/usr/lib/x86_64-linux-gnu -L/usr/lib/x86_64-linux-gnu
+dldflags =
+ARCH_FLAG =
+DLDFLAGS = $(ldflags) $(dldflags) $(ARCH_FLAG)
+LDSHARED = $(CC) -shared
+LDSHAREDXX = $(CXX) -shared
+AR = ar
+EXEEXT =
+
+RUBY_INSTALL_NAME = ruby2.1
+RUBY_SO_NAME = ruby-2.1
+RUBYW_INSTALL_NAME =
+RUBY_VERSION_NAME = $(RUBY_BASE_NAME)-$(ruby_version)
+RUBYW_BASE_NAME = rubyw
+RUBY_BASE_NAME = ruby
+
+arch = x86_64-linux-gnu
+sitearch = $(arch)
+ruby_version = 2.1.0
+ruby = $(bindir)/ruby2.1
+RUBY = $(ruby)
+ruby_headers = $(hdrdir)/ruby.h $(hdrdir)/ruby/ruby.h $(hdrdir)/ruby/defines.h $(hdrdir)/ruby/missing.h $(hdrdir)/ruby/intern.h $(hdrdir)/ruby/st.h $(hdrdir)/ruby/subst.h $(arch_hdrdir)/ruby/config.h
+
+RM = rm -f
+RM_RF = $(RUBY) -run -e rm -- -rf
+RMDIRS = rmdir --ignore-fail-on-non-empty -p
+MAKEDIRS = /bin/mkdir -p
+INSTALL = /usr/bin/install -c
+INSTALL_PROG = $(INSTALL) -m 0755
+INSTALL_DATA = $(INSTALL) -m 644
+COPY = cp
+TOUCH = exit >
+
+#### End of system configuration section. ####
+
+preload =
+
+libpath = . $(archlibdir)
+LIBPATH = -L. -L$(archlibdir)
+DEFFILE =
+
+CLEANFILES = mkmf.log
+DISTCLEANFILES = ruby-gio2.pc
+DISTCLEANDIRS =
+
+extout =
+extout_prefix =
+target_prefix =
+LOCAL_LIBS =
+LIBS = $(LIBRUBYARG_SHARED) -lgio-2.0 -lglib-2.0 -lgobject-2.0 -lgirepository-1.0 -lglib-2.0 -lgobject-2.0 -lpthread -lgmp -ldl -lcrypt -lm -lc
+ORIG_SRCS = rb-gio2-pollable-source.c rb-gio2.c
+SRCS = $(ORIG_SRCS)
+OBJS = rb-gio2-pollable-source.o rb-gio2.o
+HDRS = $(srcdir)/rb-gio2.h
+TARGET = gio2
+TARGET_NAME = gio2
+TARGET_ENTRY = Init_$(TARGET_NAME)
+DLLIB = $(TARGET).so
+EXTSTATIC =
+STATIC_LIB =
+
+TIMESTAMP_DIR = .
+BINDIR = $(bindir)
+RUBYCOMMONDIR = $(sitedir)$(target_prefix)
+RUBYLIBDIR = $(sitelibdir)$(target_prefix)
+RUBYARCHDIR = $(sitearchdir)$(target_prefix)
+HDRDIR = $(rubyhdrdir)/ruby$(target_prefix)
+ARCHHDRDIR = $(rubyhdrdir)/$(arch)/ruby$(target_prefix)
+
+TARGET_SO = $(DLLIB)
+CLEANLIBS = $(TARGET).so
+CLEANOBJS = *.o *.bak
+
+all: $(DLLIB)
+static: $(STATIC_LIB)
+.PHONY: all install static install-so install-rb
+.PHONY: clean clean-so clean-static clean-rb
+
+clean-static::
+clean-rb-default::
+clean-rb::
+clean-so::
+clean: clean-so clean-static clean-rb-default clean-rb
+ -$(Q)$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES) .*.time
+
+distclean-rb-default::
+distclean-rb::
+distclean-so::
+distclean-static::
+distclean: clean distclean-so distclean-static distclean-rb-default distclean-rb
+ -$(Q)$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log
+ -$(Q)$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES)
+ -$(Q)$(RMDIRS) $(DISTCLEANDIRS) 2> /dev/null || true
+
+realclean: distclean
+install: install-so install-rb
+
+install-so: $(DLLIB) $(TIMESTAMP_DIR)/.RUBYARCHDIR.time
+ $(INSTALL_PROG) $(DLLIB) $(RUBYARCHDIR)
+clean-static::
+ -$(Q)$(RM) $(STATIC_LIB)
+install-rb: pre-install-rb install-rb-default
+install-rb-default: pre-install-rb-default
+pre-install-rb: Makefile
+pre-install-rb-default: Makefile
+pre-install-rb-default:
+ $(ECHO) installing default gio2 libraries
+$(TIMESTAMP_DIR)/.RUBYARCHDIR.time:
+ $(Q) $(MAKEDIRS) $(@D) $(RUBYARCHDIR)
+ $(Q) $(TOUCH) $@
+
+site-install: site-install-so site-install-rb
+site-install-so: install-so
+site-install-rb: install-rb
+
+.SUFFIXES: .c .m .cc .mm .cxx .cpp .C .o
+
+.cc.o:
+ $(ECHO) compiling $(<)
+ $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
+
+.mm.o:
+ $(ECHO) compiling $(<)
+ $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
+
+.cxx.o:
+ $(ECHO) compiling $(<)
+ $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
+
+.cpp.o:
+ $(ECHO) compiling $(<)
+ $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
+
+.C.o:
+ $(ECHO) compiling $(<)
+ $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
+
+.c.o:
+ $(ECHO) compiling $(<)
+ $(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $<
+
+.m.o:
+ $(ECHO) compiling $(<)
+ $(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $<
+
+$(DLLIB): $(OBJS) Makefile
+ $(ECHO) linking shared-object $(DLLIB)
+ -$(Q)$(RM) $(@)
+ $(Q) $(LDSHARED) -o $@ $(OBJS) $(LIBPATH) $(DLDFLAGS) $(LOCAL_LIBS) $(LIBS)
+
+
+
+###
+install: install-pc
+install-pc:
+ if test -n "$(pkgconfigdir)"; then \
+ $(MAKEDIRS) $(pkgconfigdir); \
+ $(INSTALL_DATA) ruby-gio2.pc $(pkgconfigdir); \
+ fi
diff --git a/goocanvas/ext/goocanvas/depend b/gio2/ext/gio2/depend
similarity index 66%
rename from goocanvas/ext/goocanvas/depend
rename to gio2/ext/gio2/depend
index a77f4a5..c7a839e 100644
--- a/goocanvas/ext/goocanvas/depend
+++ b/gio2/ext/gio2/depend
@@ -2,5 +2,5 @@ install: install-pc
install-pc:
if test -n "$(pkgconfigdir)"; then \
$(MAKEDIRS) $(pkgconfigdir); \
- $(INSTALL_DATA) ruby-goocanvas.pc $(pkgconfigdir); \
+ $(INSTALL_DATA) ruby-gio2.pc $(pkgconfigdir); \
fi
diff --git a/gio2/ext/gio2/extconf.rb b/gio2/ext/gio2/extconf.rb
index 4b2ee1c..0f5bebc 100755
--- a/gio2/ext/gio2/extconf.rb
+++ b/gio2/ext/gio2/extconf.rb
@@ -49,7 +49,7 @@ require "mkmf-gnome2"
:target_build_dir => build_dir)
end
-setup_win32(module_name, base_dir)
+setup_windows(module_name, base_dir)
unless required_pkg_config_package(package_id,
:debian => "libglib2.0-dev",
diff --git a/gio2/ext/gio2/ruby-gio2.pc b/gio2/ext/gio2/ruby-gio2.pc
new file mode 100644
index 0000000..b12db7e
--- /dev/null
+++ b/gio2/ext/gio2/ruby-gio2.pc
@@ -0,0 +1,3 @@
+Name: Ruby/GIO2
+Description: Ruby bindings for glib I/O library
+Version: 2.2.4
\ No newline at end of file
diff --git a/gio2/lib/gio2/input-stream.rb b/gio2/lib/gio2/input-stream.rb
index f25ce1f..e5ba19f 100644
--- a/gio2/lib/gio2/input-stream.rb
+++ b/gio2/lib/gio2/input-stream.rb
@@ -23,17 +23,26 @@ module Gio
buffer_size = 8192
buffer = " ".force_encoding("ASCII-8BIT") * buffer_size
loop do
- read_bytes = read_raw(buffer, buffer.bytesize)
+ read_bytes = read_raw_compatible(buffer)
all << buffer.byteslice(0, read_bytes)
break if read_bytes != buffer_size
end
all
else
buffer = " " * size
- read_bytes = read_raw(buffer, buffer.bytesize)
+ read_bytes = read_raw_compatible(buffer)
buffer.replace(buffer.byteslice(0, read_bytes))
buffer
end
end
+
+ private
+ def read_raw_compatible(buffer)
+ if (GLib::VERSION <=> [2, 36, 0]) >= 0
+ read_raw(buffer)
+ else
+ read_raw(buffer, buffer.bytesize)
+ end
+ end
end
end
diff --git a/gio2/lib/gio2/loader.rb b/gio2/lib/gio2/loader.rb
index c56666b..375e23f 100644
--- a/gio2/lib/gio2/loader.rb
+++ b/gio2/lib/gio2/loader.rb
@@ -20,6 +20,7 @@ module Gio
def pre_load(repository, namespace)
define_content_type_class
define_mime_type_class
+ define_dbus_module
define_resources_module
@content_type_guess_for_tree_info = nil
end
@@ -52,7 +53,6 @@ module Gio
require "gio2/resources"
require "gio2/inet-address"
require "gio2/input-stream"
- require "gio2/output-stream"
require "gio2/pollable-input-stream"
require "gio2/pollable-output-stream"
end
@@ -83,6 +83,11 @@ module Gio
@base_module.const_set("MimeType", @mime_type_class)
end
+ def define_dbus_module
+ @dbus_module = Module.new
+ @base_module.const_set("DBus", @dbus_module)
+ end
+
def define_resources_module
@resources_module = Module.new
@base_module.const_set("Resources", @resources_module)
@@ -102,7 +107,11 @@ module Gio
end
end
when /\Aresources_/
- load_function_info_resources(info)
+ name = rubyish_method_name(info, :prefix => "resources_")
+ define_module_function(@resources_module, name, info)
+ when /\Adbus_/
+ name = rubyish_method_name(info, :prefix => "dbus_")
+ define_module_function(@dbus_module, name, info)
else
super
end
@@ -156,7 +165,7 @@ module Gio
else
case name
when /\Acan_be_/
- method_name = "#{$1}?"
+ method_name = "#{$POSTMATCH}?"
when /\Ais_/
method_name = "#{$POSTMATCH}?"
when /\Aget_/
@@ -170,19 +179,6 @@ module Gio
end
end
-
- def load_function_info_resources(info)
- method_name = info.name.gsub(/\Aresources_/, "")
- receiver = @resources_module
- validate = lambda do |arguments|
- validate_arguments(info, "#{receiver}.#{method_name}", arguments)
- end
- receiver.define_singleton_method(method_name) do |*arguments|
- validate.call(arguments)
- info.invoke(:arguments => arguments)
- end
- end
-
def load_function_infos(infos, klass)
case klass.name
when "Gio::File"
diff --git a/gio2/lib/gio2/pollable-input-stream.rb b/gio2/lib/gio2/pollable-input-stream.rb
index 43e0698..8e447a5 100644
--- a/gio2/lib/gio2/pollable-input-stream.rb
+++ b/gio2/lib/gio2/pollable-input-stream.rb
@@ -32,7 +32,7 @@ module Gio
buffer = " ".force_encoding("ASCII-8BIT") * buffer_size
loop do
begin
- read_bytes = read_nonblocking_raw(buffer, buffer.bytesize)
+ read_bytes = read_nonblocking_raw_compatible(buffer)
rescue IOError::WouldBlock
break
end
@@ -42,10 +42,19 @@ module Gio
all
else
buffer = " " * size
- read_bytes = read_nonblocking_raw(buffer, buffer.bytesize)
+ read_bytes = read_nonblocking_raw_compatible(buffer)
buffer.replace(buffer.byteslice(0, read_bytes))
buffer
end
end
+
+ private
+ def read_nonblocking_raw_compatible(buffer)
+ if (GLib::VERSION <=> [2, 42, 0]) >= 0
+ read_nonblocking_raw(buffer)
+ else
+ read_nonblocking_raw(buffer, buffer.bytesize)
+ end
+ end
end
end
diff --git a/gio2/lib/gio2/pollable-output-stream.rb b/gio2/lib/gio2/pollable-output-stream.rb
index 49b5c8e..bff488e 100644
--- a/gio2/lib/gio2/pollable-output-stream.rb
+++ b/gio2/lib/gio2/pollable-output-stream.rb
@@ -23,10 +23,5 @@ module Gio
source.set_callback(&block)
source
end
-
- alias_method :write_nonblocking_raw, :write_nonblocking
- def write_nonblocking(data)
- write_nonblocking_raw(data, data.bytesize)
- end
end
end
diff --git a/gio2/test/gio2-test-utils.rb b/gio2/test/gio2-test-utils.rb
index a014bd4..e943c24 100644
--- a/gio2/test/gio2-test-utils.rb
+++ b/gio2/test/gio2-test-utils.rb
@@ -18,4 +18,5 @@ require "test-unit"
require "test/unit/notify"
require "gio2-test-utils/fixture"
+require "gio2-test-utils/omissions"
require "gio2-test-utils/socket-client"
diff --git a/gio2/lib/gio2/output-stream.rb b/gio2/test/gio2-test-utils/omissions.rb
similarity index 86%
copy from gio2/lib/gio2/output-stream.rb
copy to gio2/test/gio2-test-utils/omissions.rb
index d686699..225138c 100644
--- a/gio2/lib/gio2/output-stream.rb
+++ b/gio2/test/gio2-test-utils/omissions.rb
@@ -14,11 +14,10 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-module Gio
- class OutputStream
- alias_method :write_raw, :write
- def write(data)
- write_raw(data, data.bytesize)
+module GioTestUtils
+ module Omissions
+ def omit_on_os_x
+ omit("Skip this test on OS X") if RUBY_PLATFORM =~ /darwin/
end
end
end
diff --git a/gio2/test/test-content-type.rb b/gio2/test/test-content-type.rb
index dd2585f..2586858 100644
--- a/gio2/test/test-content-type.rb
+++ b/gio2/test/test-content-type.rb
@@ -15,6 +15,8 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
class TestContentType < Test::Unit::TestCase
+ include GioTestUtils::Omissions
+
def setup
@content_type = Gio::ContentType.new("image/jpeg")
end
@@ -25,7 +27,13 @@ class TestContentType < Test::Unit::TestCase
end
def test_guess
+ omit_on_os_x
assert_equal(["audio/mpeg", false],
Gio::ContentType.guess("filename.mp3"))
end
+
+ def test_executable
+ content_type = Gio::ContentType.new("application/x-executable")
+ assert_true(content_type.executable?)
+ end
end
diff --git a/gio2/test/test-content-type.rb b/gio2/test/test-dbus.rb
similarity index 58%
copy from gio2/test/test-content-type.rb
copy to gio2/test/test-dbus.rb
index dd2585f..ee2f37d 100644
--- a/gio2/test/test-content-type.rb
+++ b/gio2/test/test-dbus.rb
@@ -14,18 +14,29 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-class TestContentType < Test::Unit::TestCase
- def setup
- @content_type = Gio::ContentType.new("image/jpeg")
+class TestDBus < Test::Unit::TestCase
+ def test_dbus_guid
+ guid = Gio::DBus.generate_guid
+ assert_true(Gio::DBus.guid?(guid))
end
- def test_icon
- assert_equal("image-jpeg",
- @content_type.icon.names.first)
+ def test_dbus_name
+ name = "org.freedesktop.DBus"
+ assert_true(Gio::DBus.name?(name))
end
- def test_guess
- assert_equal(["audio/mpeg", false],
- Gio::ContentType.guess("filename.mp3"))
+ def test_dbus_unique_name
+ name = ":org.freedesktop.DBus"
+ assert_true(Gio::DBus.unique_name?(name))
+ end
+
+ def test_dbus_interface_name
+ name = "org.freedesktop.DBus"
+ assert_true(Gio::DBus.interface_name?(name))
+ end
+
+ def test_dbus_member_name
+ member = "StartServiceByName"
+ assert_true(Gio::DBus.member_name?(member))
end
end
diff --git a/gio2/test/test-file.rb b/gio2/test/test-file.rb
index fa46d3d..b29f4e4 100644
--- a/gio2/test/test-file.rb
+++ b/gio2/test/test-file.rb
@@ -16,9 +16,11 @@
class TestFile < Test::Unit::TestCase
include GioTestUtils::Fixture
+ include GioTestUtils::Omissions
class TestContentType < self
def test_guess_content_type
+ omit_on_os_x
path = fixture_path("content-type", "x-content", "unix-software")
dir = Gio::File.path(path)
assert_equal(["x-content/unix-software"],
diff --git a/gio2/lib/gio2/output-stream.rb b/gio2/test/test-memory-input-stream.rb
similarity index 84%
copy from gio2/lib/gio2/output-stream.rb
copy to gio2/test/test-memory-input-stream.rb
index d686699..7c5d326 100644
--- a/gio2/lib/gio2/output-stream.rb
+++ b/gio2/test/test-memory-input-stream.rb
@@ -14,11 +14,10 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-module Gio
- class OutputStream
- alias_method :write_raw, :write
- def write(data)
- write_raw(data, data.bytesize)
+class TestMemoryInputStream < Test::Unit::TestCase
+ def test_memory_input_stream
+ assert_nothing_raised do
+ Gio::MemoryInputStream.new
end
end
end
diff --git a/gio2/lib/gio2/output-stream.rb b/gio2/test/test-memory-output-stream.rb
similarity index 84%
copy from gio2/lib/gio2/output-stream.rb
copy to gio2/test/test-memory-output-stream.rb
index d686699..fe2ecad 100644
--- a/gio2/lib/gio2/output-stream.rb
+++ b/gio2/test/test-memory-output-stream.rb
@@ -14,11 +14,10 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-module Gio
- class OutputStream
- alias_method :write_raw, :write
- def write(data)
- write_raw(data, data.bytesize)
+class TestMemoryOutputStream < Test::Unit::TestCase
+ def test_memory_output_stream
+ assert_nothing_raised do
+ Gio::MemoryOutputStream.new
end
end
end
diff --git a/glib2/Makefile b/glib2/Makefile
new file mode 100644
index 0000000..134c6fa
--- /dev/null
+++ b/glib2/Makefile
@@ -0,0 +1,20 @@
+all:
+ (cd ext/glib2 && $(MAKE))
+ $(MAKE) -f Makefile.lib
+
+install:
+ (cd ext/glib2 && $(MAKE) install)
+ $(MAKE) -f Makefile.lib install
+
+site-install:
+ (cd ext/glib2 && $(MAKE) site-install)
+ $(MAKE) -f Makefile.lib site-install
+
+clean:
+ (cd ext/glib2 && $(MAKE) clean)
+ $(MAKE) -f Makefile.lib clean
+
+distclean:
+ (cd ext/glib2 && $(MAKE) distclean)
+ $(MAKE) -f Makefile.lib distclean
+ @rm -f Makefile.lib
diff --git a/glib2/Makefile.lib b/glib2/Makefile.lib
new file mode 100644
index 0000000..ebd1391
--- /dev/null
+++ b/glib2/Makefile.lib
@@ -0,0 +1,242 @@
+
+SHELL = /bin/sh
+
+# V=0 quiet, V=1 verbose. other values don't work.
+V = 0
+Q1 = $(V:1=)
+Q = $(Q1:0=@)
+ECHO1 = $(V:1=@:)
+ECHO = $(ECHO1:0=@echo)
+
+#### Start of system configuration section. ####
+
+srcdir = /home/kou/work/ruby/ruby-gnome2.clean/glib2
+topdir = /usr/include/ruby-2.1.0
+hdrdir = $(topdir)
+arch_hdrdir = /usr/include/x86_64-linux-gnu/ruby-2.1.0
+PATH_SEPARATOR = :
+VPATH = $(srcdir):$(arch_hdrdir)/ruby:$(hdrdir)/ruby
+prefix = $(DESTDIR)/usr
+rubysitearchprefix = $(sitearchlibdir)/$(RUBY_BASE_NAME)
+rubyarchprefix = $(archlibdir)/$(RUBY_BASE_NAME)
+rubylibprefix = $(libdir)/$(RUBY_BASE_NAME)
+exec_prefix = $(prefix)
+vendorarchhdrdir = $(sitearchincludedir)/$(RUBY_VERSION_NAME)/vendor_ruby
+sitearchhdrdir = $(sitearchincludedir)/$(RUBY_VERSION_NAME)/site_ruby
+rubyarchhdrdir = $(archincludedir)/$(RUBY_VERSION_NAME)
+vendorhdrdir = $(rubyhdrdir)/vendor_ruby
+sitehdrdir = $(rubyhdrdir)/site_ruby
+rubyhdrdir = $(includedir)/$(RUBY_VERSION_NAME)
+vendorarchdir = $(rubysitearchprefix)/vendor_ruby/$(ruby_version)
+vendorlibdir = $(vendordir)/$(ruby_version)
+vendordir = $(rubylibprefix)/vendor_ruby
+sitearchdir = $(DESTDIR)/usr/local/lib/x86_64-linux-gnu/site_ruby
+sitelibdir = $(sitedir)/$(ruby_version)
+sitedir = $(DESTDIR)/usr/local/lib/site_ruby
+rubyarchdir = $(rubyarchprefix)/$(ruby_version)
+rubylibdir = $(rubylibprefix)/$(ruby_version)
+sitearchincludedir = $(includedir)/$(sitearch)
+archincludedir = $(includedir)/$(arch)
+sitearchlibdir = $(libdir)/$(sitearch)
+archlibdir = $(libdir)/$(arch)
+ridir = $(datarootdir)/$(RI_BASE_NAME)
+mandir = $(prefix)/share/man
+localedir = $(datarootdir)/locale
+libdir = $(exec_prefix)/lib
+psdir = $(docdir)
+pdfdir = $(docdir)
+dvidir = $(docdir)
+htmldir = $(docdir)
+infodir = $(prefix)/share/info
+docdir = $(datarootdir)/doc/$(PACKAGE)
+oldincludedir = $(DESTDIR)/usr/include
+includedir = $(prefix)/include
+localstatedir = $(DESTDIR)/var
+sharedstatedir = $(prefix)/com
+sysconfdir = $(DESTDIR)/etc
+datadir = $(datarootdir)
+datarootdir = $(prefix)/share
+libexecdir = $(prefix)/lib/ruby2.1
+sbindir = $(exec_prefix)/sbin
+bindir = $(exec_prefix)/bin
+archdir = $(rubyarchdir)
+
+
+CC = gcc
+CXX = g++
+LIBRUBY = $(LIBRUBY_SO)
+LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
+LIBRUBYARG_SHARED = -l$(RUBY_SO_NAME)
+LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)-static
+empty =
+OUTFLAG = -o $(empty)
+COUTFLAG = -o $(empty)
+
+RUBY_EXTCONF_H =
+cflags = $(optflags) $(debugflags) $(warnflags)
+optflags = -O3 -fno-fast-math
+debugflags = -ggdb3
+warnflags = -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration
+CCDLFLAGS = -fPIC
+CFLAGS = $(CCDLFLAGS) -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fPIC $(ARCH_FLAG)
+INCFLAGS = -I. -I$(arch_hdrdir) -I$(hdrdir)/ruby/backward -I$(hdrdir) -I$(srcdir)
+DEFS =
+CPPFLAGS = -D_FORTIFY_SOURCE=2 $(DEFS) $(cppflags)
+CXXFLAGS = $(CCDLFLAGS) -g -O2 -fstack-protector-strong -Wformat -Werror=format-security $(ARCH_FLAG)
+ldflags = -L. -Wl,-z,relro -L/build/ruby2.1-64qTCU/ruby2.1-2.1.5/debian/lib -fstack-protector -rdynamic -Wl,-export-dynamic
+dldflags =
+ARCH_FLAG =
+DLDFLAGS = $(ldflags) $(dldflags) $(ARCH_FLAG)
+LDSHARED = $(CC) -shared
+LDSHAREDXX = $(CXX) -shared
+AR = ar
+EXEEXT =
+
+RUBY_INSTALL_NAME = ruby2.1
+RUBY_SO_NAME = ruby-2.1
+RUBYW_INSTALL_NAME =
+RUBY_VERSION_NAME = $(RUBY_BASE_NAME)-$(ruby_version)
+RUBYW_BASE_NAME = rubyw
+RUBY_BASE_NAME = ruby
+
+arch = x86_64-linux-gnu
+sitearch = $(arch)
+ruby_version = 2.1.0
+ruby = $(bindir)/ruby2.1
+RUBY = $(ruby)
+ruby_headers = $(hdrdir)/ruby.h $(hdrdir)/ruby/ruby.h $(hdrdir)/ruby/defines.h $(hdrdir)/ruby/missing.h $(hdrdir)/ruby/intern.h $(hdrdir)/ruby/st.h $(hdrdir)/ruby/subst.h $(arch_hdrdir)/ruby/config.h
+
+RM = rm -f
+RM_RF = $(RUBY) -run -e rm -- -rf
+RMDIRS = rmdir --ignore-fail-on-non-empty -p
+MAKEDIRS = /bin/mkdir -p
+INSTALL = /usr/bin/install -c
+INSTALL_PROG = $(INSTALL) -m 0755
+INSTALL_DATA = $(INSTALL) -m 644
+COPY = cp
+TOUCH = exit >
+
+#### End of system configuration section. ####
+
+preload =
+
+libpath = . $(archlibdir)
+LIBPATH = -L. -L$(archlibdir)
+DEFFILE =
+
+CLEANFILES = mkmf.log
+DISTCLEANFILES =
+DISTCLEANDIRS =
+
+extout =
+extout_prefix =
+target_prefix =
+LOCAL_LIBS =
+LIBS = $(LIBRUBYARG_SHARED) -lpthread -lgmp -ldl -lcrypt -lm -lc
+ORIG_SRCS =
+SRCS = $(ORIG_SRCS)
+OBJS =
+HDRS =
+TARGET =
+TARGET_NAME =
+TARGET_ENTRY = Init_$(TARGET_NAME)
+DLLIB =
+EXTSTATIC =
+STATIC_LIB =
+
+TIMESTAMP_DIR = .
+BINDIR = $(bindir)
+RUBYCOMMONDIR = $(sitedir)$(target_prefix)
+RUBYLIBDIR = $(sitelibdir)$(target_prefix)
+RUBYARCHDIR = $(sitearchdir)$(target_prefix)
+HDRDIR = $(rubyhdrdir)/ruby$(target_prefix)
+ARCHHDRDIR = $(rubyhdrdir)/$(arch)/ruby$(target_prefix)
+
+TARGET_SO = $(DLLIB)
+CLEANLIBS = $(TARGET).so
+CLEANOBJS = *.o *.bak
+
+all: Makefile
+static: $(STATIC_LIB)
+.PHONY: all install static install-so install-rb
+.PHONY: clean clean-so clean-static clean-rb
+
+clean-static::
+clean-rb-default::
+clean-rb::
+clean-so::
+clean: clean-so clean-static clean-rb-default clean-rb
+ -$(Q)$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES) .*.time
+
+distclean-rb-default::
+distclean-rb::
+distclean-so::
+distclean-static::
+distclean: clean distclean-so distclean-static distclean-rb-default distclean-rb
+ -$(Q)$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log
+ -$(Q)$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES)
+ -$(Q)$(RMDIRS) $(DISTCLEANDIRS) 2> /dev/null || true
+
+realclean: distclean
+install: install-so install-rb
+
+install-so: Makefile
+install-rb: pre-install-rb install-rb-default
+install-rb-default: pre-install-rb-default
+pre-install-rb: Makefile
+pre-install-rb-default: Makefile
+pre-install-rb-default: $(TIMESTAMP_DIR)/.RUBYLIBDIR.time
+install-rb-default: $(RUBYLIBDIR)/gnome2-raketask.rb
+$(RUBYLIBDIR)/gnome2-raketask.rb: $(srcdir)/lib/gnome2-raketask.rb $(TIMESTAMP_DIR)/.RUBYLIBDIR.time
+ $(Q) $(INSTALL_DATA) $(srcdir)/lib/gnome2-raketask.rb $(@D)
+install-rb-default: $(RUBYLIBDIR)/mkmf-gnome2.rb
+$(RUBYLIBDIR)/mkmf-gnome2.rb: $(srcdir)/lib/mkmf-gnome2.rb $(TIMESTAMP_DIR)/.RUBYLIBDIR.time
+ $(Q) $(INSTALL_DATA) $(srcdir)/lib/mkmf-gnome2.rb $(@D)
+install-rb-default: $(RUBYLIBDIR)/glib-mkenums.rb
+$(RUBYLIBDIR)/glib-mkenums.rb: $(srcdir)/lib/glib-mkenums.rb $(TIMESTAMP_DIR)/.RUBYLIBDIR.time
+ $(Q) $(INSTALL_DATA) $(srcdir)/lib/glib-mkenums.rb $(@D)
+install-rb-default: $(RUBYLIBDIR)/glib2.rb
+$(RUBYLIBDIR)/glib2.rb: $(srcdir)/lib/glib2.rb $(TIMESTAMP_DIR)/.RUBYLIBDIR.time
+ $(Q) $(INSTALL_DATA) $(srcdir)/lib/glib2.rb $(@D)
+pre-install-rb-default: $(TIMESTAMP_DIR)/.RUBYLIBDIR.-.gnome2.-.rake.time
+install-rb-default: $(RUBYLIBDIR)/gnome2/rake/native-binary-build-task.rb
+$(RUBYLIBDIR)/gnome2/rake/native-binary-build-task.rb: $(srcdir)/lib/gnome2/rake/native-binary-build-task.rb $(TIMESTAMP_DIR)/.RUBYLIBDIR.-.gnome2.-.rake.time
+ $(Q) $(INSTALL_DATA) $(srcdir)/lib/gnome2/rake/native-binary-build-task.rb $(@D)
+install-rb-default: $(RUBYLIBDIR)/gnome2/rake/windows-binary-download-task.rb
+$(RUBYLIBDIR)/gnome2/rake/windows-binary-download-task.rb: $(srcdir)/lib/gnome2/rake/windows-binary-download-task.rb $(TIMESTAMP_DIR)/.RUBYLIBDIR.-.gnome2.-.rake.time
+ $(Q) $(INSTALL_DATA) $(srcdir)/lib/gnome2/rake/windows-binary-download-task.rb $(@D)
+install-rb-default: $(RUBYLIBDIR)/gnome2/rake/windows-binary-build-task.rb
+$(RUBYLIBDIR)/gnome2/rake/windows-binary-build-task.rb: $(srcdir)/lib/gnome2/rake/windows-binary-build-task.rb $(TIMESTAMP_DIR)/.RUBYLIBDIR.-.gnome2.-.rake.time
+ $(Q) $(INSTALL_DATA) $(srcdir)/lib/gnome2/rake/windows-binary-build-task.rb $(@D)
+install-rb-default: $(RUBYLIBDIR)/gnome2/rake/package-task.rb
+$(RUBYLIBDIR)/gnome2/rake/package-task.rb: $(srcdir)/lib/gnome2/rake/package-task.rb $(TIMESTAMP_DIR)/.RUBYLIBDIR.-.gnome2.-.rake.time
+ $(Q) $(INSTALL_DATA) $(srcdir)/lib/gnome2/rake/package-task.rb $(@D)
+install-rb-default: $(RUBYLIBDIR)/gnome2/rake/external-package.rb
+$(RUBYLIBDIR)/gnome2/rake/external-package.rb: $(srcdir)/lib/gnome2/rake/external-package.rb $(TIMESTAMP_DIR)/.RUBYLIBDIR.-.gnome2.-.rake.time
+ $(Q) $(INSTALL_DATA) $(srcdir)/lib/gnome2/rake/external-package.rb $(@D)
+install-rb-default: $(RUBYLIBDIR)/gnome2/rake/source-download-task.rb
+$(RUBYLIBDIR)/gnome2/rake/source-download-task.rb: $(srcdir)/lib/gnome2/rake/source-download-task.rb $(TIMESTAMP_DIR)/.RUBYLIBDIR.-.gnome2.-.rake.time
+ $(Q) $(INSTALL_DATA) $(srcdir)/lib/gnome2/rake/source-download-task.rb $(@D)
+install-rb-default: $(RUBYLIBDIR)/gnome2/rake/package.rb
+$(RUBYLIBDIR)/gnome2/rake/package.rb: $(srcdir)/lib/gnome2/rake/package.rb $(TIMESTAMP_DIR)/.RUBYLIBDIR.-.gnome2.-.rake.time
+ $(Q) $(INSTALL_DATA) $(srcdir)/lib/gnome2/rake/package.rb $(@D)
+pre-install-rb-default: $(TIMESTAMP_DIR)/.RUBYLIBDIR.-.glib2.time
+install-rb-default: $(RUBYLIBDIR)/glib2/deprecatable.rb
+$(RUBYLIBDIR)/glib2/deprecatable.rb: $(srcdir)/lib/glib2/deprecatable.rb $(TIMESTAMP_DIR)/.RUBYLIBDIR.-.glib2.time
+ $(Q) $(INSTALL_DATA) $(srcdir)/lib/glib2/deprecatable.rb $(@D)
+pre-install-rb-default:
+ $(ECHO) installing default libraries
+$(TIMESTAMP_DIR)/.RUBYLIBDIR.time:
+ $(Q) $(MAKEDIRS) $(@D) $(RUBYLIBDIR)
+ $(Q) $(TOUCH) $@
+$(TIMESTAMP_DIR)/.RUBYLIBDIR.-.gnome2.-.rake.time:
+ $(Q) $(MAKEDIRS) $(@D) $(RUBYLIBDIR)/gnome2/rake
+ $(Q) $(TOUCH) $@
+$(TIMESTAMP_DIR)/.RUBYLIBDIR.-.glib2.time:
+ $(Q) $(MAKEDIRS) $(@D) $(RUBYLIBDIR)/glib2
+ $(Q) $(TOUCH) $@
+
+site-install: site-install-so site-install-rb
+site-install-so: install-so
+site-install-rb: install-rb
+
diff --git a/glib2/Rakefile b/glib2/Rakefile
index 1875ca9..07c2edc 100644
--- a/glib2/Rakefile
+++ b/glib2/Rakefile
@@ -1,7 +1,7 @@
# -*- ruby -*-
$LOAD_PATH.unshift("./lib")
-require 'gnome2-raketask'
+require 'gnome2/rake/package-task'
bin_dir = nil
include_dir = nil
@@ -10,33 +10,56 @@ libffi_lib_dir = nil
build_host = nil
-package = GNOME2Package.new do |_package|
- bin_dir = (_package.windows.absolute_binary_dir + "bin").to_s
- include_dir = (_package.windows.absolute_binary_dir + "include").to_s
+package_task = GNOME2::Rake::PackageTask.new do |package|
+ bin_dir = (package.windows.absolute_binary_dir + "bin").to_s
+ include_dir = (package.windows.absolute_binary_dir + "include").to_s
glib2_include_dir = File.join(include_dir, "glib-2.0")
- libffi_lib_dir = (_package.windows.absolute_binary_dir + "lib").to_s
+ libffi_lib_dir = (package.windows.absolute_binary_dir + "lib").to_s
- build_host = _package.windows.build_host
+ build_host = package.windows.build_host
- _package.summary = "Ruby/GLib2 is a Ruby binding of GLib-2.x."
- _package.description = "Ruby/GLib2 is a Ruby binding of GLib-2.x."
- _package.dependency.gem.runtime = [["pkg-config", ">= 0"]]
- _package.dependency.gem.development = [["test-unit", ">= 2"]]
- _package.win32.packages = []
- _package.win32.dependencies = ["libffi", "gettext-runtime"]
- _package.external_packages = [
+ package.summary = "Ruby/GLib2 is a Ruby binding of GLib-2.x."
+ package.description = "Ruby/GLib2 is a Ruby binding of GLib-2.x."
+ package.dependency.gem.runtime = [["pkg-config", ">= 0"]]
+ package.dependency.gem.development = [["test-unit", ">= 2"]]
+ package.windows.packages = []
+ package.windows.dependencies = []
+ package.external_packages = [
+ {
+ :name => "libiconv",
+ :download_site => :gnu,
+ :label => "libiconv",
+ :version => "1.14",
+ :windows => {
+ :built_file => "bin/libiconv-2.dll",
+ },
+ },
+ {
+ :name => "gettext",
+ :download_site => :gnu,
+ :label => "gettext-runtime",
+ :version => "0.19.2",
+ :base_dir_in_package => "gettext-runtime",
+ :windows => {
+ :built_file => "bin/libintl-8.dll",
+ },
+ },
+ {
+ :name => "libffi",
+ :download_base_url => "ftp://sourceware.org/pub/libffi",
+ :label => "libffi",
+ :version => "3.2.1",
+ :windows => {
+ :built_file => "bin/libffi-6.dll",
+ },
+ },
{
:name => "glib",
:download_site => :gnome,
:label => "GLib",
- :version => "2.38.2",
+ :version => "2.42.1",
:compression_method => "xz",
:windows => {
- :configure_args => [
- "LIBFFI_CFLAGS=-I#{include_dir}",
- "LIBFFI_LIBS=-L#{libffi_lib_dir} -lffi",
- "--disable-modular-tests",
- ],
:need_autoreconf => true,
:patches => [
"glib-2.38.2-add-missing-exeext.diff",
@@ -46,9 +69,9 @@ package = GNOME2Package.new do |_package|
},
{
:name => "gmp",
- :download_base_url => "ftp://ftp.gmplib.org/pub/gmp-5.1.3",
+ :download_base_url => "ftp://ftp.gmplib.org/pub/gmp-6.0.0",
:label => "GNU MP",
- :version => "5.1.3",
+ :version => "6.0.0",
:compression_method => "xz",
:windows => {
:configure_args => [
@@ -72,7 +95,7 @@ package = GNOME2Package.new do |_package|
:name => "gnutls",
:download_base_url => "ftp://ftp.gnutls.org/gcrypt/gnutls/v3.2",
:label => "GnuTLS",
- :version => "3.2.12",
+ :version => "3.2.21",
:compression_method => "xz",
:windows => {
:configure_args => [
@@ -88,7 +111,7 @@ package = GNOME2Package.new do |_package|
:name => "glib-networking",
:download_site => :gnome,
:label => "glib-networking",
- :version => "2.38.2",
+ :version => "2.42.1",
:compression_method => "xz",
:windows => {
:configure_args => [
@@ -100,50 +123,35 @@ package = GNOME2Package.new do |_package|
},
},
]
- _package.cross_compiling do |spec|
+ package.cross_compiling do |spec|
if /mingw|mswin/ =~ spec.platform.to_s
spec.add_runtime_dependency("cairo", ">= 1.12.8")
end
end
end
-package.define_tasks
+package_task.define
-namespace :win32 do
- namespace :libffi do
- namespace :header do
- desc "Move libffi headers to include/"
- task :fix do
- libffi_version = "libffi-3.0.6"
- mv(Dir.glob(File.join(libffi_lib_dir, libffi_version, "include", "*.h")),
- include_dir)
- rm_rf(File.join(libffi_lib_dir, libffi_version))
+namespace :windows do
+ namespace :glib do
+ pkg_config_dir = package_task.windows.absolute_binary_dir + "lib/pkgconfig"
+ pc_path = pkg_config_dir + "glib-2.0.pc"
+ patched_path = pkg_config_dir + "patched"
+ file patched_path.to_s do
+ original_pc = pc_path.read
+ new_pc = original_pc.gsub(/^Cflags:/) do |matched|
+ "#{matched} -I${includedir}"
end
- end
- end
-
- namespace :downloader do
- task :after => [
- "win32:libffi:header:fix",
- ]
- end
-
- namespace :gettext do
- namespace :header do
- desc "Copy gettext headers to include/glib-2.0/"
- task :fix do
- cp(File.join(include_dir, "libintl.h"),
- glib2_include_dir)
+ pc_path.open("w") do |pc_file|
+ pc_file.write(new_pc)
end
+ touch(patched_path)
end
+
+ desc "Add include path for libintl.h"
+ task :cross => patched_path.to_s
end
namespace :builder do
- namespace :build do
- namespace :glib do
- task :after => [
- "win32:gettext:header:fix",
- ]
- end
- end
+ task :after => "windows:glib:cross"
end
end
diff --git a/glib2/ext/glib2/Makefile b/glib2/ext/glib2/Makefile
new file mode 100644
index 0000000..5e1689b
--- /dev/null
+++ b/glib2/ext/glib2/Makefile
@@ -0,0 +1,256 @@
+
+SHELL = /bin/sh
+
+# V=0 quiet, V=1 verbose. other values don't work.
+V = 0
+Q1 = $(V:1=)
+Q = $(Q1:0=@)
+ECHO1 = $(V:1=@:)
+ECHO = $(ECHO1:0=@echo)
+
+#### Start of system configuration section. ####
+
+srcdir = /home/kou/work/ruby/ruby-gnome2.clean/glib2/ext/glib2
+topdir = /usr/include/ruby-2.1.0
+hdrdir = $(topdir)
+arch_hdrdir = /usr/include/x86_64-linux-gnu/ruby-2.1.0
+PATH_SEPARATOR = :
+VPATH = $(srcdir):$(arch_hdrdir)/ruby:$(hdrdir)/ruby
+prefix = $(DESTDIR)/usr
+rubysitearchprefix = $(sitearchlibdir)/$(RUBY_BASE_NAME)
+rubyarchprefix = $(archlibdir)/$(RUBY_BASE_NAME)
+rubylibprefix = $(libdir)/$(RUBY_BASE_NAME)
+exec_prefix = $(prefix)
+vendorarchhdrdir = $(sitearchincludedir)/$(RUBY_VERSION_NAME)/vendor_ruby
+sitearchhdrdir = $(sitearchincludedir)/$(RUBY_VERSION_NAME)/site_ruby
+rubyarchhdrdir = $(archincludedir)/$(RUBY_VERSION_NAME)
+vendorhdrdir = $(rubyhdrdir)/vendor_ruby
+sitehdrdir = $(rubyhdrdir)/site_ruby
+rubyhdrdir = $(includedir)/$(RUBY_VERSION_NAME)
+vendorarchdir = $(rubysitearchprefix)/vendor_ruby/$(ruby_version)
+vendorlibdir = $(vendordir)/$(ruby_version)
+vendordir = $(rubylibprefix)/vendor_ruby
+sitearchdir = $(DESTDIR)/usr/local/lib/x86_64-linux-gnu/site_ruby
+sitelibdir = $(sitedir)/$(ruby_version)
+sitedir = $(DESTDIR)/usr/local/lib/site_ruby
+rubyarchdir = $(rubyarchprefix)/$(ruby_version)
+rubylibdir = $(rubylibprefix)/$(ruby_version)
+sitearchincludedir = $(includedir)/$(sitearch)
+archincludedir = $(includedir)/$(arch)
+sitearchlibdir = $(libdir)/$(sitearch)
+archlibdir = $(libdir)/$(arch)
+ridir = $(datarootdir)/$(RI_BASE_NAME)
+mandir = $(prefix)/share/man
+localedir = $(datarootdir)/locale
+libdir = $(exec_prefix)/lib
+psdir = $(docdir)
+pdfdir = $(docdir)
+dvidir = $(docdir)
+htmldir = $(docdir)
+infodir = $(prefix)/share/info
+docdir = $(datarootdir)/doc/$(PACKAGE)
+oldincludedir = $(DESTDIR)/usr/include
+includedir = $(prefix)/include
+localstatedir = $(DESTDIR)/var
+sharedstatedir = $(prefix)/com
+sysconfdir = $(DESTDIR)/etc
+datadir = $(datarootdir)
+datarootdir = $(prefix)/share
+libexecdir = $(prefix)/lib/ruby2.1
+sbindir = $(exec_prefix)/sbin
+bindir = $(exec_prefix)/bin
+archdir = $(rubyarchdir)
+
+
+CC = gcc
+CXX = g++
+LIBRUBY = $(LIBRUBY_SO)
+LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
+LIBRUBYARG_SHARED = -l$(RUBY_SO_NAME)
+LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)-static
+empty =
+OUTFLAG = -o $(empty)
+COUTFLAG = -o $(empty)
+
+RUBY_EXTCONF_H =
+cflags = $(optflags) $(debugflags) $(warnflags)
+optflags = -O3 -fno-fast-math
+debugflags = -ggdb3
+warnflags = -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration
+CCDLFLAGS = -fPIC
+CFLAGS = $(CCDLFLAGS) -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fPIC -Wall -Waggregate-return -Wcast-align -Wextra -Wformat=2 -Winit-self -Wlarger-than-65500 -Wmissing-declarations -Wmissing-format-attribute -Wmissing-include-dirs -Wmissing-noreturn -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpacked -Wp,-D_FORTIFY_SOURCE=2 -Wpointer-arith -Wswitch-default -Wswitch-enum -Wundef -Wunsafe-loop-optimizations -Wwrite-strings -I/usr/include/glib-2.0 [...]
+INCFLAGS = -I. -I$(arch_hdrdir) -I$(hdrdir)/ruby/backward -I$(hdrdir) -I$(srcdir) -I$(vendorarchdir)
+DEFS =
+CPPFLAGS = -DHAVE_RB_DEFINE_ALLOC_FUNC -DHAVE_RB_BLOCK_PROC -DHAVE_OBJECT_ALLOCATE -DHAVE_UNISTD_H -DHAVE_G_SPAWN_CLOSE_PID -DHAVE_G_THREAD_INIT -DHAVE_G_MAIN_DEPTH -DHAVE_G_LISTENV -DHAVE_RB_CHECK_ARRAY_TYPE -DHAVE_RB_CHECK_HASH_TYPE -DHAVE_RB_EXEC_RECURSIVE -DHAVE_RB_ERRINFO -DHAVE_RB_SOURCEFILE -DHAVE_RB_SOURCELINE -DHAVE_RB_THREAD_CALL_WITHOUT_GVL -DHAVE_RUBY_NATIVE_THREAD_P -DHAVE_RB_THREAD_CALL_WITH_GVL -DHAVE_RB_STR_NEW_CSTR -DHAVE_RB_GC_REGISTER_MARK_OBJECT -DHAVE_RB_EXC_NEW_STR [...]
+CXXFLAGS = $(CCDLFLAGS) -g -O2 -fstack-protector-strong -Wformat -Werror=format-security $(ARCH_FLAG)
+ldflags = -L. -Wl,-z,relro -L/build/ruby2.1-64qTCU/ruby2.1-2.1.5/debian/lib -fstack-protector -rdynamic -Wl,-export-dynamic -L/usr/lib/x86_64-linux-gnu -L/usr/lib/x86_64-linux-gnu -pthread
+dldflags =
+ARCH_FLAG =
+DLDFLAGS = $(ldflags) $(dldflags) $(ARCH_FLAG)
+LDSHARED = $(CC) -shared
+LDSHAREDXX = $(CXX) -shared
+AR = ar
+EXEEXT =
+
+RUBY_INSTALL_NAME = ruby2.1
+RUBY_SO_NAME = ruby-2.1
+RUBYW_INSTALL_NAME =
+RUBY_VERSION_NAME = $(RUBY_BASE_NAME)-$(ruby_version)
+RUBYW_BASE_NAME = rubyw
+RUBY_BASE_NAME = ruby
+
+arch = x86_64-linux-gnu
+sitearch = $(arch)
+ruby_version = 2.1.0
+ruby = $(bindir)/ruby2.1
+RUBY = $(ruby)
+ruby_headers = $(hdrdir)/ruby.h $(hdrdir)/ruby/ruby.h $(hdrdir)/ruby/defines.h $(hdrdir)/ruby/missing.h $(hdrdir)/ruby/intern.h $(hdrdir)/ruby/st.h $(hdrdir)/ruby/subst.h $(arch_hdrdir)/ruby/config.h
+
+RM = rm -f
+RM_RF = $(RUBY) -run -e rm -- -rf
+RMDIRS = rmdir --ignore-fail-on-non-empty -p
+MAKEDIRS = /bin/mkdir -p
+INSTALL = /usr/bin/install -c
+INSTALL_PROG = $(INSTALL) -m 0755
+INSTALL_DATA = $(INSTALL) -m 644
+COPY = cp
+TOUCH = exit >
+
+#### End of system configuration section. ####
+
+preload =
+
+libpath = . $(archlibdir)
+LIBPATH = -L. -L$(archlibdir)
+DEFFILE =
+
+CLEANFILES = mkmf.log
+DISTCLEANFILES = ruby-glib2.pc glib-enum-types.h glib-enum-types.c
+DISTCLEANDIRS =
+
+extout =
+extout_prefix =
+target_prefix =
+LOCAL_LIBS =
+LIBS = $(LIBRUBYARG_SHARED) -lgobject-2.0 -lglib-2.0 -lgthread-2.0 -lglib-2.0 -lpthread -lgmp -ldl -lcrypt -lm -lc
+ORIG_SRCS = rbgobj_value.c rbglibdeprecated.c rbglib_win32.c rbglib_mainloop.c rbgobj_convert.c rbglib_spawn.c rbglib_unicode.c rbglib_pollfd.c rbgobj_strv.c rbgutil.c rbglib_bookmarkfile.c rbglib_fileutils.c rbglib.c rbgobj_object.c rbglib_unichar.c rbgobj_valuearray.c rbgobj_typemodule.c rbglib_gettext.c rbglib_int64.c rbglib_iochannel_win32_socket.c rbglib_utf16.c rbgobj_signal.c rbglib_source.c rbglib_error.c rbgobj_closure.c rbglib_ucs4.c rbglib_threads.c rbgobj_param.c rbglib_shell [...]
+SRCS = $(ORIG_SRCS) rbgobj_value.c rbglibdeprecated.c rbglib_win32.c rbglib_mainloop.c rbgobj_convert.c rbglib_spawn.c rbglib_unicode.c rbglib_pollfd.c rbgobj_strv.c rbgutil.c rbglib_bookmarkfile.c rbglib_fileutils.c rbglib.c rbgobj_object.c rbglib_unichar.c rbgobj_valuearray.c rbgobj_typemodule.c rbglib_gettext.c rbglib_int64.c rbglib_iochannel_win32_socket.c rbglib_utf16.c rbgobj_signal.c rbglib_source.c rbglib_error.c rbgobj_closure.c rbglib_ucs4.c rbglib_threads.c rbgobj_param.c rbgl [...]
+OBJS = rbgobj_value.o rbglibdeprecated.o rbglib_win32.o rbglib_mainloop.o rbgobj_convert.o rbglib_spawn.o rbglib_unicode.o rbglib_pollfd.o rbgobj_strv.o rbgutil.o rbglib_bookmarkfile.o rbglib_fileutils.o rbglib.o rbgobj_object.o rbglib_unichar.o rbgobj_valuearray.o rbgobj_typemodule.o rbglib_gettext.o rbglib_int64.o rbglib_iochannel_win32_socket.o rbglib_utf16.o rbgobj_signal.o rbglib_source.o rbglib_error.o rbgobj_closure.o rbglib_ucs4.o rbglib_threads.o rbgobj_param.o rbglib_shell.o gl [...]
+HDRS = $(srcdir)/rbgutildeprecated.h $(srcdir)/rbglib.h $(srcdir)/rbglibdeprecated.h $(srcdir)/glib-enum-types.h $(srcdir)/rbgutil_list.h $(srcdir)/rbgprivate.h $(srcdir)/rbglib2conversions.h $(srcdir)/rbgobject.h $(srcdir)/rbgutil.h $(srcdir)/rbgcompat.h
+TARGET = glib2
+TARGET_NAME = glib2
+TARGET_ENTRY = Init_$(TARGET_NAME)
+DLLIB = $(TARGET).so
+EXTSTATIC =
+STATIC_LIB =
+
+TIMESTAMP_DIR = .
+BINDIR = $(bindir)
+RUBYCOMMONDIR = $(sitedir)$(target_prefix)
+RUBYLIBDIR = $(sitelibdir)$(target_prefix)
+RUBYARCHDIR = $(sitearchdir)$(target_prefix)
+HDRDIR = $(rubyhdrdir)/ruby$(target_prefix)
+ARCHHDRDIR = $(rubyhdrdir)/$(arch)/ruby$(target_prefix)
+
+TARGET_SO = $(DLLIB)
+CLEANLIBS = $(TARGET).so
+CLEANOBJS = *.o *.bak
+
+all: $(DLLIB)
+static: $(STATIC_LIB)
+.PHONY: all install static install-so install-rb
+.PHONY: clean clean-so clean-static clean-rb
+
+clean-static::
+clean-rb-default::
+clean-rb::
+clean-so::
+clean: clean-so clean-static clean-rb-default clean-rb
+ -$(Q)$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES) .*.time
+
+distclean-rb-default::
+distclean-rb::
+distclean-so::
+distclean-static::
+distclean: clean distclean-so distclean-static distclean-rb-default distclean-rb
+ -$(Q)$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log
+ -$(Q)$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES)
+ -$(Q)$(RMDIRS) $(DISTCLEANDIRS) 2> /dev/null || true
+
+realclean: distclean
+install: install-so install-rb
+
+install-so: $(DLLIB) $(TIMESTAMP_DIR)/.RUBYARCHDIR.time
+ $(INSTALL_PROG) $(DLLIB) $(RUBYARCHDIR)
+clean-static::
+ -$(Q)$(RM) $(STATIC_LIB)
+install-rb: pre-install-rb install-rb-default
+install-rb-default: pre-install-rb-default
+pre-install-rb: Makefile
+pre-install-rb-default: Makefile
+pre-install-rb-default:
+ $(ECHO) installing default glib2 libraries
+$(TIMESTAMP_DIR)/.RUBYARCHDIR.time:
+ $(Q) $(MAKEDIRS) $(@D) $(RUBYARCHDIR)
+ $(Q) $(TOUCH) $@
+
+site-install: site-install-so site-install-rb
+site-install-so: install-so
+site-install-rb: install-rb
+
+.SUFFIXES: .c .m .cc .mm .cxx .cpp .C .o
+
+.cc.o:
+ $(ECHO) compiling $(<)
+ $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
+
+.mm.o:
+ $(ECHO) compiling $(<)
+ $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
+
+.cxx.o:
+ $(ECHO) compiling $(<)
+ $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
+
+.cpp.o:
+ $(ECHO) compiling $(<)
+ $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
+
+.C.o:
+ $(ECHO) compiling $(<)
+ $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
+
+.c.o:
+ $(ECHO) compiling $(<)
+ $(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $<
+
+.m.o:
+ $(ECHO) compiling $(<)
+ $(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $<
+
+$(DLLIB): $(OBJS) Makefile
+ $(ECHO) linking shared-object $(DLLIB)
+ -$(Q)$(RM) $(@)
+ $(Q) $(LDSHARED) -o $@ $(OBJS) $(LIBPATH) $(DLDFLAGS) $(LOCAL_LIBS) $(LIBS)
+
+
+
+###
+install-so: install-headers
+install-headers:
+ $(INSTALL_DATA) $(srcdir)/rbglib.h $(RUBYARCHDIR)
+ $(INSTALL_DATA) $(srcdir)/rbglibdeprecated.h $(RUBYARCHDIR)
+ $(INSTALL_DATA) $(srcdir)/rbglib2conversions.h $(RUBYARCHDIR)
+ $(INSTALL_DATA) $(srcdir)/rbgutil.h $(RUBYARCHDIR)
+ $(INSTALL_DATA) $(srcdir)/rbgutil_list.h $(RUBYARCHDIR)
+ $(INSTALL_DATA) $(srcdir)/rbgutildeprecated.h $(RUBYARCHDIR)
+ $(INSTALL_DATA) $(srcdir)/rbgobject.h $(RUBYARCHDIR)
+ $(INSTALL_DATA) $(srcdir)/rbgcompat.h $(RUBYARCHDIR)
+ $(INSTALL_DATA) glib-enum-types.h $(RUBYARCHDIR)
+
+install: install-pc
+install-pc:
+ if test -n "$(pkgconfigdir)"; then \
+ $(MAKEDIRS) $(pkgconfigdir); \
+ $(INSTALL_DATA) ruby-glib2.pc $(pkgconfigdir); \
+ fi
diff --git a/glib2/ext/glib2/extconf.rb b/glib2/ext/glib2/extconf.rb
index b81ea03..1c5cd8d 100644
--- a/glib2/ext/glib2/extconf.rb
+++ b/glib2/ext/glib2/extconf.rb
@@ -14,7 +14,7 @@ package_id = "gobject-2.0"
require 'mkmf-gnome2'
-setup_win32(module_name, base_dir)
+setup_windows(module_name, base_dir)
unless required_pkg_config_package([package_id, 2, 12, 0],
:debian => "libglib2.0-dev",
@@ -42,7 +42,7 @@ have_func("rb_errinfo", ruby_header)
have_func("rb_sourcefile", ruby_header)
have_func("rb_sourceline", ruby_header)
have_func("ruby_set_current_source", ruby_header)
-have_func("rb_thread_blocking_region", ruby_header)
+have_func("rb_thread_call_without_gvl", ruby_header)
have_func("ruby_native_thread_p", ruby_header)
have_func("rb_thread_call_with_gvl", ruby_header)
have_func("rb_str_new_cstr", ruby_header)
@@ -56,10 +56,18 @@ create_pkg_config_file("Ruby/GLib2", package_id)
enum_types_prefix = "glib-enum-types"
include_paths = PKGConfig.cflags_only_I("glib-2.0")
+ignore_headers = [
+ "giochannel.h",
+ "gmain.h",
+ "gscanner.h",
+]
+unless (/mingw|cygwin|mswin/ === RUBY_PLATFORM)
+ ignore_headers << "gwin32.h"
+end
headers = include_paths.split.inject([]) do |result, path|
result + Dir.glob(File.join(path.sub(/^-I/, ""), "glib", "*.h"))
end.reject do |file|
- /g(iochannel|main|scanner)\.h/ =~ file
+ ignore_headers.include?(File.basename(file))
end
include_paths = PKGConfig.cflags_only_I("gobject-2.0")
headers = include_paths.split.inject(headers) do |result, path|
@@ -68,6 +76,7 @@ end
glib_mkenums(enum_types_prefix, headers, "G_TYPE_", ["glib-object.h"])
$defs << "-DRUBY_GLIB2_COMPILATION"
+
create_makefile(module_name)
pkg_config_dir = with_config("pkg-config-dir")
diff --git a/glib2/ext/glib2/glib-enum-types.c b/glib2/ext/glib2/glib-enum-types.c
new file mode 100644
index 0000000..72edad2
--- /dev/null
+++ b/glib2/ext/glib2/glib-enum-types.c
@@ -0,0 +1,1233 @@
+
+/* Generated by glib-mkenums.rb ($Id$) */
+
+#include "glib-enum-types.h"
+#include <glib-object.h>
+
+
+
+/* enumerations from "/usr/include/glib-2.0/glib/gvariant.h" */
+GType
+g_variant_class_get_type (void)
+{
+ static GType etype = 0;
+ if (etype == 0) {
+ static const GEnumValue values[] = {
+ { G_VARIANT_CLASS_BOOLEAN, "G_VARIANT_CLASS_BOOLEAN", "boolean" },
+ { G_VARIANT_CLASS_BYTE, "G_VARIANT_CLASS_BYTE", "byte" },
+ { G_VARIANT_CLASS_INT16, "G_VARIANT_CLASS_INT16", "int16" },
+ { G_VARIANT_CLASS_UINT16, "G_VARIANT_CLASS_UINT16", "uint16" },
+ { G_VARIANT_CLASS_INT32, "G_VARIANT_CLASS_INT32", "int32" },
+ { G_VARIANT_CLASS_UINT32, "G_VARIANT_CLASS_UINT32", "uint32" },
+ { G_VARIANT_CLASS_INT64, "G_VARIANT_CLASS_INT64", "int64" },
+ { G_VARIANT_CLASS_UINT64, "G_VARIANT_CLASS_UINT64", "uint64" },
+ { G_VARIANT_CLASS_HANDLE, "G_VARIANT_CLASS_HANDLE", "handle" },
+ { G_VARIANT_CLASS_DOUBLE, "G_VARIANT_CLASS_DOUBLE", "double" },
+ { G_VARIANT_CLASS_STRING, "G_VARIANT_CLASS_STRING", "string" },
+ { G_VARIANT_CLASS_OBJECT_PATH, "G_VARIANT_CLASS_OBJECT_PATH", "object-path" },
+ { G_VARIANT_CLASS_SIGNATURE, "G_VARIANT_CLASS_SIGNATURE", "signature" },
+ { G_VARIANT_CLASS_VARIANT, "G_VARIANT_CLASS_VARIANT", "variant" },
+ { G_VARIANT_CLASS_MAYBE, "G_VARIANT_CLASS_MAYBE", "maybe" },
+ { G_VARIANT_CLASS_ARRAY, "G_VARIANT_CLASS_ARRAY", "array" },
+ { G_VARIANT_CLASS_TUPLE, "G_VARIANT_CLASS_TUPLE", "tuple" },
+ { G_VARIANT_CLASS_DICT_ENTRY, "G_VARIANT_CLASS_DICT_ENTRY", "dict-entry" },
+ { 0, NULL, NULL }
+ };
+ etype = g_enum_register_static ("GVariantClass", values);
+ }
+ return etype;
+}
+
+GType
+g_variant_parse_error_get_type (void)
+{
+ static GType etype = 0;
+ if (etype == 0) {
+ static const GEnumValue values[] = {
+ { G_VARIANT_PARSE_ERROR_FAILED, "G_VARIANT_PARSE_ERROR_FAILED", "failed" },
+ { G_VARIANT_PARSE_ERROR_BASIC_TYPE_EXPECTED, "G_VARIANT_PARSE_ERROR_BASIC_TYPE_EXPECTED", "basic-type-expected" },
+ { G_VARIANT_PARSE_ERROR_CANNOT_INFER_TYPE, "G_VARIANT_PARSE_ERROR_CANNOT_INFER_TYPE", "cannot-infer-type" },
+ { G_VARIANT_PARSE_ERROR_DEFINITE_TYPE_EXPECTED, "G_VARIANT_PARSE_ERROR_DEFINITE_TYPE_EXPECTED", "definite-type-expected" },
+ { G_VARIANT_PARSE_ERROR_INPUT_NOT_AT_END, "G_VARIANT_PARSE_ERROR_INPUT_NOT_AT_END", "input-not-at-end" },
+ { G_VARIANT_PARSE_ERROR_INVALID_CHARACTER, "G_VARIANT_PARSE_ERROR_INVALID_CHARACTER", "invalid-character" },
+ { G_VARIANT_PARSE_ERROR_INVALID_FORMAT_STRING, "G_VARIANT_PARSE_ERROR_INVALID_FORMAT_STRING", "invalid-format-string" },
+ { G_VARIANT_PARSE_ERROR_INVALID_OBJECT_PATH, "G_VARIANT_PARSE_ERROR_INVALID_OBJECT_PATH", "invalid-object-path" },
+ { G_VARIANT_PARSE_ERROR_INVALID_SIGNATURE, "G_VARIANT_PARSE_ERROR_INVALID_SIGNATURE", "invalid-signature" },
+ { G_VARIANT_PARSE_ERROR_INVALID_TYPE_STRING, "G_VARIANT_PARSE_ERROR_INVALID_TYPE_STRING", "invalid-type-string" },
+ { G_VARIANT_PARSE_ERROR_NO_COMMON_TYPE, "G_VARIANT_PARSE_ERROR_NO_COMMON_TYPE", "no-common-type" },
+ { G_VARIANT_PARSE_ERROR_NUMBER_OUT_OF_RANGE, "G_VARIANT_PARSE_ERROR_NUMBER_OUT_OF_RANGE", "number-out-of-range" },
+ { G_VARIANT_PARSE_ERROR_NUMBER_TOO_BIG, "G_VARIANT_PARSE_ERROR_NUMBER_TOO_BIG", "number-too-big" },
+ { G_VARIANT_PARSE_ERROR_TYPE_ERROR, "G_VARIANT_PARSE_ERROR_TYPE_ERROR", "type-error" },
+ { G_VARIANT_PARSE_ERROR_UNEXPECTED_TOKEN, "G_VARIANT_PARSE_ERROR_UNEXPECTED_TOKEN", "unexpected-token" },
+ { G_VARIANT_PARSE_ERROR_UNKNOWN_KEYWORD, "G_VARIANT_PARSE_ERROR_UNKNOWN_KEYWORD", "unknown-keyword" },
+ { G_VARIANT_PARSE_ERROR_UNTERMINATED_STRING_CONSTANT, "G_VARIANT_PARSE_ERROR_UNTERMINATED_STRING_CONSTANT", "unterminated-string-constant" },
+ { G_VARIANT_PARSE_ERROR_VALUE_EXPECTED, "G_VARIANT_PARSE_ERROR_VALUE_EXPECTED", "value-expected" },
+ { 0, NULL, NULL }
+ };
+ etype = g_enum_register_static ("GVariantParseError", values);
+ }
+ return etype;
+}
+
+
+/* enumerations from "/usr/include/glib-2.0/glib/gspawn.h" */
+GType
+g_spawn_error_get_type (void)
+{
+ static GType etype = 0;
+ if (etype == 0) {
+ static const GEnumValue values[] = {
+ { G_SPAWN_ERROR_FORK, "G_SPAWN_ERROR_FORK", "fork" },
+ { G_SPAWN_ERROR_READ, "G_SPAWN_ERROR_READ", "read" },
+ { G_SPAWN_ERROR_CHDIR, "G_SPAWN_ERROR_CHDIR", "chdir" },
+ { G_SPAWN_ERROR_ACCES, "G_SPAWN_ERROR_ACCES", "acces" },
+ { G_SPAWN_ERROR_PERM, "G_SPAWN_ERROR_PERM", "perm" },
+ { G_SPAWN_ERROR_TOO_BIG, "G_SPAWN_ERROR_TOO_BIG", "too-big" },
+ { G_SPAWN_ERROR_2BIG, "G_SPAWN_ERROR_2BIG", "2big" },
+ { G_SPAWN_ERROR_NOEXEC, "G_SPAWN_ERROR_NOEXEC", "noexec" },
+ { G_SPAWN_ERROR_NAMETOOLONG, "G_SPAWN_ERROR_NAMETOOLONG", "nametoolong" },
+ { G_SPAWN_ERROR_NOENT, "G_SPAWN_ERROR_NOENT", "noent" },
+ { G_SPAWN_ERROR_NOMEM, "G_SPAWN_ERROR_NOMEM", "nomem" },
+ { G_SPAWN_ERROR_NOTDIR, "G_SPAWN_ERROR_NOTDIR", "notdir" },
+ { G_SPAWN_ERROR_LOOP, "G_SPAWN_ERROR_LOOP", "loop" },
+ { G_SPAWN_ERROR_TXTBUSY, "G_SPAWN_ERROR_TXTBUSY", "txtbusy" },
+ { G_SPAWN_ERROR_IO, "G_SPAWN_ERROR_IO", "io" },
+ { G_SPAWN_ERROR_NFILE, "G_SPAWN_ERROR_NFILE", "nfile" },
+ { G_SPAWN_ERROR_MFILE, "G_SPAWN_ERROR_MFILE", "mfile" },
+ { G_SPAWN_ERROR_INVAL, "G_SPAWN_ERROR_INVAL", "inval" },
+ { G_SPAWN_ERROR_ISDIR, "G_SPAWN_ERROR_ISDIR", "isdir" },
+ { G_SPAWN_ERROR_LIBBAD, "G_SPAWN_ERROR_LIBBAD", "libbad" },
+ { G_SPAWN_ERROR_FAILED, "G_SPAWN_ERROR_FAILED", "failed" },
+ { 0, NULL, NULL }
+ };
+ etype = g_enum_register_static ("GSpawnError", values);
+ }
+ return etype;
+}
+
+GType
+g_spawn_flags_get_type (void)
+{
+ static GType etype = 0;
+ if (etype == 0) {
+ static const GFlagsValue values[] = {
+ { G_SPAWN_DEFAULT, "G_SPAWN_DEFAULT", "default" },
+ { G_SPAWN_LEAVE_DESCRIPTORS_OPEN, "G_SPAWN_LEAVE_DESCRIPTORS_OPEN", "leave-descriptors-open" },
+ { G_SPAWN_DO_NOT_REAP_CHILD, "G_SPAWN_DO_NOT_REAP_CHILD", "do-not-reap-child" },
+ { G_SPAWN_SEARCH_PATH, "G_SPAWN_SEARCH_PATH", "search-path" },
+ { G_SPAWN_STDOUT_TO_DEV_NULL, "G_SPAWN_STDOUT_TO_DEV_NULL", "stdout-to-dev-null" },
+ { G_SPAWN_STDERR_TO_DEV_NULL, "G_SPAWN_STDERR_TO_DEV_NULL", "stderr-to-dev-null" },
+ { G_SPAWN_CHILD_INHERITS_STDIN, "G_SPAWN_CHILD_INHERITS_STDIN", "child-inherits-stdin" },
+ { G_SPAWN_FILE_AND_ARGV_ZERO, "G_SPAWN_FILE_AND_ARGV_ZERO", "file-and-argv-zero" },
+ { G_SPAWN_SEARCH_PATH_FROM_ENVP, "G_SPAWN_SEARCH_PATH_FROM_ENVP", "search-path-from-envp" },
+ { G_SPAWN_CLOEXEC_PIPES, "G_SPAWN_CLOEXEC_PIPES", "cloexec-pipes" },
+ { 0, NULL, NULL }
+ };
+ etype = g_flags_register_static ("GSpawnFlags", values);
+ }
+ return etype;
+}
+
+
+/* enumerations from "/usr/include/glib-2.0/glib/gkeyfile.h" */
+GType
+g_key_file_error_get_type (void)
+{
+ static GType etype = 0;
+ if (etype == 0) {
+ static const GEnumValue values[] = {
+ { G_KEY_FILE_ERROR_UNKNOWN_ENCODING, "G_KEY_FILE_ERROR_UNKNOWN_ENCODING", "unknown-encoding" },
+ { G_KEY_FILE_ERROR_PARSE, "G_KEY_FILE_ERROR_PARSE", "parse" },
+ { G_KEY_FILE_ERROR_NOT_FOUND, "G_KEY_FILE_ERROR_NOT_FOUND", "not-found" },
+ { G_KEY_FILE_ERROR_KEY_NOT_FOUND, "G_KEY_FILE_ERROR_KEY_NOT_FOUND", "key-not-found" },
+ { G_KEY_FILE_ERROR_GROUP_NOT_FOUND, "G_KEY_FILE_ERROR_GROUP_NOT_FOUND", "group-not-found" },
+ { G_KEY_FILE_ERROR_INVALID_VALUE, "G_KEY_FILE_ERROR_INVALID_VALUE", "invalid-value" },
+ { 0, NULL, NULL }
+ };
+ etype = g_enum_register_static ("GKeyFileError", values);
+ }
+ return etype;
+}
+
+GType
+g_key_file_flags_get_type (void)
+{
+ static GType etype = 0;
+ if (etype == 0) {
+ static const GFlagsValue values[] = {
+ { G_KEY_FILE_NONE, "G_KEY_FILE_NONE", "none" },
+ { G_KEY_FILE_KEEP_COMMENTS, "G_KEY_FILE_KEEP_COMMENTS", "keep-comments" },
+ { G_KEY_FILE_KEEP_TRANSLATIONS, "G_KEY_FILE_KEEP_TRANSLATIONS", "keep-translations" },
+ { 0, NULL, NULL }
+ };
+ etype = g_flags_register_static ("GKeyFileFlags", values);
+ }
+ return etype;
+}
+
+
+/* enumerations from "/usr/include/glib-2.0/glib/gnode.h" */
+GType
+g_traverse_flags_get_type (void)
+{
+ static GType etype = 0;
+ if (etype == 0) {
+ static const GFlagsValue values[] = {
+ { G_TRAVERSE_LEAVES, "G_TRAVERSE_LEAVES", "leaves" },
+ { G_TRAVERSE_NON_LEAVES, "G_TRAVERSE_NON_LEAVES", "non-leaves" },
+ { G_TRAVERSE_ALL, "G_TRAVERSE_ALL", "all" },
+ { G_TRAVERSE_MASK, "G_TRAVERSE_MASK", "mask" },
+ { G_TRAVERSE_LEAFS, "G_TRAVERSE_LEAFS", "leafs" },
+ { G_TRAVERSE_NON_LEAFS, "G_TRAVERSE_NON_LEAFS", "non-leafs" },
+ { 0, NULL, NULL }
+ };
+ etype = g_flags_register_static ("GTraverseFlags", values);
+ }
+ return etype;
+}
+
+GType
+g_traverse_type_get_type (void)
+{
+ static GType etype = 0;
+ if (etype == 0) {
+ static const GEnumValue values[] = {
+ { G_IN_ORDER, "G_IN_ORDER", "in-order" },
+ { G_PRE_ORDER, "G_PRE_ORDER", "pre-order" },
+ { G_POST_ORDER, "G_POST_ORDER", "post-order" },
+ { G_LEVEL_ORDER, "G_LEVEL_ORDER", "level-order" },
+ { 0, NULL, NULL }
+ };
+ etype = g_enum_register_static ("GTraverseType", values);
+ }
+ return etype;
+}
+
+
+/* enumerations from "/usr/include/glib-2.0/glib/gshell.h" */
+GType
+g_shell_error_get_type (void)
+{
+ static GType etype = 0;
+ if (etype == 0) {
+ static const GEnumValue values[] = {
+ { G_SHELL_ERROR_BAD_QUOTING, "G_SHELL_ERROR_BAD_QUOTING", "bad-quoting" },
+ { G_SHELL_ERROR_EMPTY_STRING, "G_SHELL_ERROR_EMPTY_STRING", "empty-string" },
+ { G_SHELL_ERROR_FAILED, "G_SHELL_ERROR_FAILED", "failed" },
+ { 0, NULL, NULL }
+ };
+ etype = g_enum_register_static ("GShellError", values);
+ }
+ return etype;
+}
+
+
+/* enumerations from "/usr/include/glib-2.0/glib/gslice.h" */
+GType
+g_slice_config_get_type (void)
+{
+ static GType etype = 0;
+ if (etype == 0) {
+ static const GEnumValue values[] = {
+ { G_SLICE_CONFIG_ALWAYS_MALLOC, "G_SLICE_CONFIG_ALWAYS_MALLOC", "always-malloc" },
+ { G_SLICE_CONFIG_BYPASS_MAGAZINES, "G_SLICE_CONFIG_BYPASS_MAGAZINES", "bypass-magazines" },
+ { G_SLICE_CONFIG_WORKING_SET_MSECS, "G_SLICE_CONFIG_WORKING_SET_MSECS", "working-set-msecs" },
+ { G_SLICE_CONFIG_COLOR_INCREMENT, "G_SLICE_CONFIG_COLOR_INCREMENT", "color-increment" },
+ { G_SLICE_CONFIG_CHUNK_SIZES, "G_SLICE_CONFIG_CHUNK_SIZES", "chunk-sizes" },
+ { G_SLICE_CONFIG_CONTENTION_COUNTER, "G_SLICE_CONFIG_CONTENTION_COUNTER", "contention-counter" },
+ { 0, NULL, NULL }
+ };
+ etype = g_enum_register_static ("GSliceConfig", values);
+ }
+ return etype;
+}
+
+
+/* enumerations from "/usr/include/glib-2.0/glib/gregex.h" */
+GType
+g_regex_error_get_type (void)
+{
+ static GType etype = 0;
+ if (etype == 0) {
+ static const GEnumValue values[] = {
+ { G_REGEX_ERROR_COMPILE, "G_REGEX_ERROR_COMPILE", "compile" },
+ { G_REGEX_ERROR_OPTIMIZE, "G_REGEX_ERROR_OPTIMIZE", "optimize" },
+ { G_REGEX_ERROR_REPLACE, "G_REGEX_ERROR_REPLACE", "replace" },
+ { G_REGEX_ERROR_MATCH, "G_REGEX_ERROR_MATCH", "match" },
+ { G_REGEX_ERROR_INTERNAL, "G_REGEX_ERROR_INTERNAL", "internal" },
+ { G_REGEX_ERROR_STRAY_BACKSLASH, "G_REGEX_ERROR_STRAY_BACKSLASH", "stray-backslash" },
+ { G_REGEX_ERROR_MISSING_CONTROL_CHAR, "G_REGEX_ERROR_MISSING_CONTROL_CHAR", "missing-control-char" },
+ { G_REGEX_ERROR_UNRECOGNIZED_ESCAPE, "G_REGEX_ERROR_UNRECOGNIZED_ESCAPE", "unrecognized-escape" },
+ { G_REGEX_ERROR_QUANTIFIERS_OUT_OF_ORDER, "G_REGEX_ERROR_QUANTIFIERS_OUT_OF_ORDER", "quantifiers-out-of-order" },
+ { G_REGEX_ERROR_QUANTIFIER_TOO_BIG, "G_REGEX_ERROR_QUANTIFIER_TOO_BIG", "quantifier-too-big" },
+ { G_REGEX_ERROR_UNTERMINATED_CHARACTER_CLASS, "G_REGEX_ERROR_UNTERMINATED_CHARACTER_CLASS", "unterminated-character-class" },
+ { G_REGEX_ERROR_INVALID_ESCAPE_IN_CHARACTER_CLASS, "G_REGEX_ERROR_INVALID_ESCAPE_IN_CHARACTER_CLASS", "invalid-escape-in-character-class" },
+ { G_REGEX_ERROR_RANGE_OUT_OF_ORDER, "G_REGEX_ERROR_RANGE_OUT_OF_ORDER", "range-out-of-order" },
+ { G_REGEX_ERROR_NOTHING_TO_REPEAT, "G_REGEX_ERROR_NOTHING_TO_REPEAT", "nothing-to-repeat" },
+ { G_REGEX_ERROR_UNRECOGNIZED_CHARACTER, "G_REGEX_ERROR_UNRECOGNIZED_CHARACTER", "unrecognized-character" },
+ { G_REGEX_ERROR_POSIX_NAMED_CLASS_OUTSIDE_CLASS, "G_REGEX_ERROR_POSIX_NAMED_CLASS_OUTSIDE_CLASS", "posix-named-class-outside-class" },
+ { G_REGEX_ERROR_UNMATCHED_PARENTHESIS, "G_REGEX_ERROR_UNMATCHED_PARENTHESIS", "unmatched-parenthesis" },
+ { G_REGEX_ERROR_INEXISTENT_SUBPATTERN_REFERENCE, "G_REGEX_ERROR_INEXISTENT_SUBPATTERN_REFERENCE", "inexistent-subpattern-reference" },
+ { G_REGEX_ERROR_UNTERMINATED_COMMENT, "G_REGEX_ERROR_UNTERMINATED_COMMENT", "unterminated-comment" },
+ { G_REGEX_ERROR_EXPRESSION_TOO_LARGE, "G_REGEX_ERROR_EXPRESSION_TOO_LARGE", "expression-too-large" },
+ { G_REGEX_ERROR_MEMORY_ERROR, "G_REGEX_ERROR_MEMORY_ERROR", "memory-error" },
+ { G_REGEX_ERROR_VARIABLE_LENGTH_LOOKBEHIND, "G_REGEX_ERROR_VARIABLE_LENGTH_LOOKBEHIND", "variable-length-lookbehind" },
+ { G_REGEX_ERROR_MALFORMED_CONDITION, "G_REGEX_ERROR_MALFORMED_CONDITION", "malformed-condition" },
+ { G_REGEX_ERROR_TOO_MANY_CONDITIONAL_BRANCHES, "G_REGEX_ERROR_TOO_MANY_CONDITIONAL_BRANCHES", "too-many-conditional-branches" },
+ { G_REGEX_ERROR_ASSERTION_EXPECTED, "G_REGEX_ERROR_ASSERTION_EXPECTED", "assertion-expected" },
+ { G_REGEX_ERROR_UNKNOWN_POSIX_CLASS_NAME, "G_REGEX_ERROR_UNKNOWN_POSIX_CLASS_NAME", "unknown-posix-class-name" },
+ { G_REGEX_ERROR_POSIX_COLLATING_ELEMENTS_NOT_SUPPORTED, "G_REGEX_ERROR_POSIX_COLLATING_ELEMENTS_NOT_SUPPORTED", "posix-collating-elements-not-supported" },
+ { G_REGEX_ERROR_HEX_CODE_TOO_LARGE, "G_REGEX_ERROR_HEX_CODE_TOO_LARGE", "hex-code-too-large" },
+ { G_REGEX_ERROR_INVALID_CONDITION, "G_REGEX_ERROR_INVALID_CONDITION", "invalid-condition" },
+ { G_REGEX_ERROR_SINGLE_BYTE_MATCH_IN_LOOKBEHIND, "G_REGEX_ERROR_SINGLE_BYTE_MATCH_IN_LOOKBEHIND", "single-byte-match-in-lookbehind" },
+ { G_REGEX_ERROR_INFINITE_LOOP, "G_REGEX_ERROR_INFINITE_LOOP", "infinite-loop" },
+ { G_REGEX_ERROR_MISSING_SUBPATTERN_NAME_TERMINATOR, "G_REGEX_ERROR_MISSING_SUBPATTERN_NAME_TERMINATOR", "missing-subpattern-name-terminator" },
+ { G_REGEX_ERROR_DUPLICATE_SUBPATTERN_NAME, "G_REGEX_ERROR_DUPLICATE_SUBPATTERN_NAME", "duplicate-subpattern-name" },
+ { G_REGEX_ERROR_MALFORMED_PROPERTY, "G_REGEX_ERROR_MALFORMED_PROPERTY", "malformed-property" },
+ { G_REGEX_ERROR_UNKNOWN_PROPERTY, "G_REGEX_ERROR_UNKNOWN_PROPERTY", "unknown-property" },
+ { G_REGEX_ERROR_SUBPATTERN_NAME_TOO_LONG, "G_REGEX_ERROR_SUBPATTERN_NAME_TOO_LONG", "subpattern-name-too-long" },
+ { G_REGEX_ERROR_TOO_MANY_SUBPATTERNS, "G_REGEX_ERROR_TOO_MANY_SUBPATTERNS", "too-many-subpatterns" },
+ { G_REGEX_ERROR_INVALID_OCTAL_VALUE, "G_REGEX_ERROR_INVALID_OCTAL_VALUE", "invalid-octal-value" },
+ { G_REGEX_ERROR_TOO_MANY_BRANCHES_IN_DEFINE, "G_REGEX_ERROR_TOO_MANY_BRANCHES_IN_DEFINE", "too-many-branches-in-define" },
+ { G_REGEX_ERROR_DEFINE_REPETION, "G_REGEX_ERROR_DEFINE_REPETION", "define-repetion" },
+ { G_REGEX_ERROR_INCONSISTENT_NEWLINE_OPTIONS, "G_REGEX_ERROR_INCONSISTENT_NEWLINE_OPTIONS", "inconsistent-newline-options" },
+ { G_REGEX_ERROR_MISSING_BACK_REFERENCE, "G_REGEX_ERROR_MISSING_BACK_REFERENCE", "missing-back-reference" },
+ { G_REGEX_ERROR_INVALID_RELATIVE_REFERENCE, "G_REGEX_ERROR_INVALID_RELATIVE_REFERENCE", "invalid-relative-reference" },
+ { G_REGEX_ERROR_BACKTRACKING_CONTROL_VERB_ARGUMENT_FORBIDDEN, "G_REGEX_ERROR_BACKTRACKING_CONTROL_VERB_ARGUMENT_FORBIDDEN", "backtracking-control-verb-argument-forbidden" },
+ { G_REGEX_ERROR_UNKNOWN_BACKTRACKING_CONTROL_VERB, "G_REGEX_ERROR_UNKNOWN_BACKTRACKING_CONTROL_VERB", "unknown-backtracking-control-verb" },
+ { G_REGEX_ERROR_NUMBER_TOO_BIG, "G_REGEX_ERROR_NUMBER_TOO_BIG", "number-too-big" },
+ { G_REGEX_ERROR_MISSING_SUBPATTERN_NAME, "G_REGEX_ERROR_MISSING_SUBPATTERN_NAME", "missing-subpattern-name" },
+ { G_REGEX_ERROR_MISSING_DIGIT, "G_REGEX_ERROR_MISSING_DIGIT", "missing-digit" },
+ { G_REGEX_ERROR_INVALID_DATA_CHARACTER, "G_REGEX_ERROR_INVALID_DATA_CHARACTER", "invalid-data-character" },
+ { G_REGEX_ERROR_EXTRA_SUBPATTERN_NAME, "G_REGEX_ERROR_EXTRA_SUBPATTERN_NAME", "extra-subpattern-name" },
+ { G_REGEX_ERROR_BACKTRACKING_CONTROL_VERB_ARGUMENT_REQUIRED, "G_REGEX_ERROR_BACKTRACKING_CONTROL_VERB_ARGUMENT_REQUIRED", "backtracking-control-verb-argument-required" },
+ { G_REGEX_ERROR_INVALID_CONTROL_CHAR, "G_REGEX_ERROR_INVALID_CONTROL_CHAR", "invalid-control-char" },
+ { G_REGEX_ERROR_MISSING_NAME, "G_REGEX_ERROR_MISSING_NAME", "missing-name" },
+ { G_REGEX_ERROR_NOT_SUPPORTED_IN_CLASS, "G_REGEX_ERROR_NOT_SUPPORTED_IN_CLASS", "not-supported-in-class" },
+ { G_REGEX_ERROR_TOO_MANY_FORWARD_REFERENCES, "G_REGEX_ERROR_TOO_MANY_FORWARD_REFERENCES", "too-many-forward-references" },
+ { G_REGEX_ERROR_NAME_TOO_LONG, "G_REGEX_ERROR_NAME_TOO_LONG", "name-too-long" },
+ { G_REGEX_ERROR_CHARACTER_VALUE_TOO_LARGE, "G_REGEX_ERROR_CHARACTER_VALUE_TOO_LARGE", "character-value-too-large" },
+ { 0, NULL, NULL }
+ };
+ etype = g_enum_register_static ("GRegexError", values);
+ }
+ return etype;
+}
+
+GType
+g_regex_compile_flags_get_type (void)
+{
+ static GType etype = 0;
+ if (etype == 0) {
+ static const GFlagsValue values[] = {
+ { G_REGEX_CASELESS, "G_REGEX_CASELESS", "caseless" },
+ { G_REGEX_MULTILINE, "G_REGEX_MULTILINE", "multiline" },
+ { G_REGEX_DOTALL, "G_REGEX_DOTALL", "dotall" },
+ { G_REGEX_EXTENDED, "G_REGEX_EXTENDED", "extended" },
+ { G_REGEX_ANCHORED, "G_REGEX_ANCHORED", "anchored" },
+ { G_REGEX_DOLLAR_ENDONLY, "G_REGEX_DOLLAR_ENDONLY", "dollar-endonly" },
+ { G_REGEX_UNGREEDY, "G_REGEX_UNGREEDY", "ungreedy" },
+ { G_REGEX_RAW, "G_REGEX_RAW", "raw" },
+ { G_REGEX_NO_AUTO_CAPTURE, "G_REGEX_NO_AUTO_CAPTURE", "no-auto-capture" },
+ { G_REGEX_OPTIMIZE, "G_REGEX_OPTIMIZE", "optimize" },
+ { G_REGEX_FIRSTLINE, "G_REGEX_FIRSTLINE", "firstline" },
+ { G_REGEX_DUPNAMES, "G_REGEX_DUPNAMES", "dupnames" },
+ { G_REGEX_NEWLINE_CR, "G_REGEX_NEWLINE_CR", "newline-cr" },
+ { G_REGEX_NEWLINE_LF, "G_REGEX_NEWLINE_LF", "newline-lf" },
+ { G_REGEX_NEWLINE_CRLF, "G_REGEX_NEWLINE_CRLF", "newline-crlf" },
+ { G_REGEX_NEWLINE_ANYCRLF, "G_REGEX_NEWLINE_ANYCRLF", "newline-anycrlf" },
+ { G_REGEX_BSR_ANYCRLF, "G_REGEX_BSR_ANYCRLF", "bsr-anycrlf" },
+ { G_REGEX_JAVASCRIPT_COMPAT, "G_REGEX_JAVASCRIPT_COMPAT", "javascript-compat" },
+ { 0, NULL, NULL }
+ };
+ etype = g_flags_register_static ("GRegexCompileFlags", values);
+ }
+ return etype;
+}
+
+GType
+g_regex_match_flags_get_type (void)
+{
+ static GType etype = 0;
+ if (etype == 0) {
+ static const GFlagsValue values[] = {
+ { G_REGEX_MATCH_ANCHORED, "G_REGEX_MATCH_ANCHORED", "anchored" },
+ { G_REGEX_MATCH_NOTBOL, "G_REGEX_MATCH_NOTBOL", "notbol" },
+ { G_REGEX_MATCH_NOTEOL, "G_REGEX_MATCH_NOTEOL", "noteol" },
+ { G_REGEX_MATCH_NOTEMPTY, "G_REGEX_MATCH_NOTEMPTY", "notempty" },
+ { G_REGEX_MATCH_PARTIAL, "G_REGEX_MATCH_PARTIAL", "partial" },
+ { G_REGEX_MATCH_NEWLINE_CR, "G_REGEX_MATCH_NEWLINE_CR", "newline-cr" },
+ { G_REGEX_MATCH_NEWLINE_LF, "G_REGEX_MATCH_NEWLINE_LF", "newline-lf" },
+ { G_REGEX_MATCH_NEWLINE_CRLF, "G_REGEX_MATCH_NEWLINE_CRLF", "newline-crlf" },
+ { G_REGEX_MATCH_NEWLINE_ANY, "G_REGEX_MATCH_NEWLINE_ANY", "newline-any" },
+ { G_REGEX_MATCH_NEWLINE_ANYCRLF, "G_REGEX_MATCH_NEWLINE_ANYCRLF", "newline-anycrlf" },
+ { G_REGEX_MATCH_BSR_ANYCRLF, "G_REGEX_MATCH_BSR_ANYCRLF", "bsr-anycrlf" },
+ { G_REGEX_MATCH_BSR_ANY, "G_REGEX_MATCH_BSR_ANY", "bsr-any" },
+ { G_REGEX_MATCH_PARTIAL_SOFT, "G_REGEX_MATCH_PARTIAL_SOFT", "partial-soft" },
+ { G_REGEX_MATCH_PARTIAL_HARD, "G_REGEX_MATCH_PARTIAL_HARD", "partial-hard" },
+ { G_REGEX_MATCH_NOTEMPTY_ATSTART, "G_REGEX_MATCH_NOTEMPTY_ATSTART", "notempty-atstart" },
+ { 0, NULL, NULL }
+ };
+ etype = g_flags_register_static ("GRegexMatchFlags", values);
+ }
+ return etype;
+}
+
+
+/* enumerations from "/usr/include/glib-2.0/glib/gmarkup.h" */
+GType
+g_markup_error_get_type (void)
+{
+ static GType etype = 0;
+ if (etype == 0) {
+ static const GEnumValue values[] = {
+ { G_MARKUP_ERROR_BAD_UTF8, "G_MARKUP_ERROR_BAD_UTF8", "bad-utf8" },
+ { G_MARKUP_ERROR_EMPTY, "G_MARKUP_ERROR_EMPTY", "empty" },
+ { G_MARKUP_ERROR_PARSE, "G_MARKUP_ERROR_PARSE", "parse" },
+ { G_MARKUP_ERROR_UNKNOWN_ELEMENT, "G_MARKUP_ERROR_UNKNOWN_ELEMENT", "unknown-element" },
+ { G_MARKUP_ERROR_UNKNOWN_ATTRIBUTE, "G_MARKUP_ERROR_UNKNOWN_ATTRIBUTE", "unknown-attribute" },
+ { G_MARKUP_ERROR_INVALID_CONTENT, "G_MARKUP_ERROR_INVALID_CONTENT", "invalid-content" },
+ { G_MARKUP_ERROR_MISSING_ATTRIBUTE, "G_MARKUP_ERROR_MISSING_ATTRIBUTE", "missing-attribute" },
+ { 0, NULL, NULL }
+ };
+ etype = g_enum_register_static ("GMarkupError", values);
+ }
+ return etype;
+}
+
+GType
+g_markup_parse_flags_get_type (void)
+{
+ static GType etype = 0;
+ if (etype == 0) {
+ static const GFlagsValue values[] = {
+ { G_MARKUP_DO_NOT_USE_THIS_UNSUPPORTED_FLAG, "G_MARKUP_DO_NOT_USE_THIS_UNSUPPORTED_FLAG", "do-not-use-this-unsupported-flag" },
+ { G_MARKUP_TREAT_CDATA_AS_TEXT, "G_MARKUP_TREAT_CDATA_AS_TEXT", "treat-cdata-as-text" },
+ { G_MARKUP_PREFIX_ERROR_POSITION, "G_MARKUP_PREFIX_ERROR_POSITION", "prefix-error-position" },
+ { G_MARKUP_IGNORE_QUALIFIED, "G_MARKUP_IGNORE_QUALIFIED", "ignore-qualified" },
+ { 0, NULL, NULL }
+ };
+ etype = g_flags_register_static ("GMarkupParseFlags", values);
+ }
+ return etype;
+}
+
+GType
+g_markup_collect_type_get_type (void)
+{
+ static GType etype = 0;
+ if (etype == 0) {
+ static const GFlagsValue values[] = {
+ { G_MARKUP_COLLECT_INVALID, "G_MARKUP_COLLECT_INVALID", "invalid" },
+ { G_MARKUP_COLLECT_STRING, "G_MARKUP_COLLECT_STRING", "string" },
+ { G_MARKUP_COLLECT_STRDUP, "G_MARKUP_COLLECT_STRDUP", "strdup" },
+ { G_MARKUP_COLLECT_BOOLEAN, "G_MARKUP_COLLECT_BOOLEAN", "boolean" },
+ { G_MARKUP_COLLECT_TRISTATE, "G_MARKUP_COLLECT_TRISTATE", "tristate" },
+ { G_MARKUP_COLLECT_OPTIONAL, "G_MARKUP_COLLECT_OPTIONAL", "optional" },
+ { 0, NULL, NULL }
+ };
+ etype = g_flags_register_static ("GMarkupCollectType", values);
+ }
+ return etype;
+}
+
+
+/* enumerations from "/usr/include/glib-2.0/glib/gtestutils.h" */
+GType
+g_test_trap_flags_get_type (void)
+{
+ static GType etype = 0;
+ if (etype == 0) {
+ static const GFlagsValue values[] = {
+ { G_TEST_TRAP_SILENCE_STDOUT, "G_TEST_TRAP_SILENCE_STDOUT", "silence-stdout" },
+ { G_TEST_TRAP_SILENCE_STDERR, "G_TEST_TRAP_SILENCE_STDERR", "silence-stderr" },
+ { G_TEST_TRAP_INHERIT_STDIN, "G_TEST_TRAP_INHERIT_STDIN", "inherit-stdin" },
+ { 0, NULL, NULL }
+ };
+ etype = g_flags_register_static ("GTestTrapFlags", values);
+ }
+ return etype;
+}
+
+GType
+g_test_subprocess_flags_get_type (void)
+{
+ static GType etype = 0;
+ if (etype == 0) {
+ static const GFlagsValue values[] = {
+ { G_TEST_SUBPROCESS_INHERIT_STDIN, "G_TEST_SUBPROCESS_INHERIT_STDIN", "in" },
+ { G_TEST_SUBPROCESS_INHERIT_STDOUT, "G_TEST_SUBPROCESS_INHERIT_STDOUT", "out" },
+ { G_TEST_SUBPROCESS_INHERIT_STDERR, "G_TEST_SUBPROCESS_INHERIT_STDERR", "err" },
+ { 0, NULL, NULL }
+ };
+ etype = g_flags_register_static ("GTestSubprocessFlags", values);
+ }
+ return etype;
+}
+
+GType
+g_test_log_type_get_type (void)
+{
+ static GType etype = 0;
+ if (etype == 0) {
+ static const GEnumValue values[] = {
+ { G_TEST_LOG_NONE, "G_TEST_LOG_NONE", "none" },
+ { G_TEST_LOG_ERROR, "G_TEST_LOG_ERROR", "error" },
+ { G_TEST_LOG_START_BINARY, "G_TEST_LOG_START_BINARY", "start-binary" },
+ { G_TEST_LOG_LIST_CASE, "G_TEST_LOG_LIST_CASE", "list-case" },
+ { G_TEST_LOG_SKIP_CASE, "G_TEST_LOG_SKIP_CASE", "skip-case" },
+ { G_TEST_LOG_START_CASE, "G_TEST_LOG_START_CASE", "start-case" },
+ { G_TEST_LOG_STOP_CASE, "G_TEST_LOG_STOP_CASE", "stop-case" },
+ { G_TEST_LOG_MIN_RESULT, "G_TEST_LOG_MIN_RESULT", "min-result" },
+ { G_TEST_LOG_MAX_RESULT, "G_TEST_LOG_MAX_RESULT", "max-result" },
+ { G_TEST_LOG_MESSAGE, "G_TEST_LOG_MESSAGE", "message" },
+ { G_TEST_LOG_START_SUITE, "G_TEST_LOG_START_SUITE", "start-suite" },
+ { G_TEST_LOG_STOP_SUITE, "G_TEST_LOG_STOP_SUITE", "stop-suite" },
+ { 0, NULL, NULL }
+ };
+ etype = g_enum_register_static ("GTestLogType", values);
+ }
+ return etype;
+}
+
+GType
+g_test_file_type_get_type (void)
+{
+ static GType etype = 0;
+ if (etype == 0) {
+ static const GEnumValue values[] = {
+ { G_TEST_DIST, "G_TEST_DIST", "dist" },
+ { G_TEST_BUILT, "G_TEST_BUILT", "built" },
+ { 0, NULL, NULL }
+ };
+ etype = g_enum_register_static ("GTestFileType", values);
+ }
+ return etype;
+}
+
+
+/* enumerations from "/usr/include/glib-2.0/glib/gfileutils.h" */
+GType
+g_file_error_get_type (void)
+{
+ static GType etype = 0;
+ if (etype == 0) {
+ static const GEnumValue values[] = {
+ { G_FILE_ERROR_EXIST, "G_FILE_ERROR_EXIST", "exist" },
+ { G_FILE_ERROR_ISDIR, "G_FILE_ERROR_ISDIR", "isdir" },
+ { G_FILE_ERROR_ACCES, "G_FILE_ERROR_ACCES", "acces" },
+ { G_FILE_ERROR_NAMETOOLONG, "G_FILE_ERROR_NAMETOOLONG", "nametoolong" },
+ { G_FILE_ERROR_NOENT, "G_FILE_ERROR_NOENT", "noent" },
+ { G_FILE_ERROR_NOTDIR, "G_FILE_ERROR_NOTDIR", "notdir" },
+ { G_FILE_ERROR_NXIO, "G_FILE_ERROR_NXIO", "nxio" },
+ { G_FILE_ERROR_NODEV, "G_FILE_ERROR_NODEV", "nodev" },
+ { G_FILE_ERROR_ROFS, "G_FILE_ERROR_ROFS", "rofs" },
+ { G_FILE_ERROR_TXTBSY, "G_FILE_ERROR_TXTBSY", "txtbsy" },
+ { G_FILE_ERROR_FAULT, "G_FILE_ERROR_FAULT", "fault" },
+ { G_FILE_ERROR_LOOP, "G_FILE_ERROR_LOOP", "loop" },
+ { G_FILE_ERROR_NOSPC, "G_FILE_ERROR_NOSPC", "nospc" },
+ { G_FILE_ERROR_NOMEM, "G_FILE_ERROR_NOMEM", "nomem" },
+ { G_FILE_ERROR_MFILE, "G_FILE_ERROR_MFILE", "mfile" },
+ { G_FILE_ERROR_NFILE, "G_FILE_ERROR_NFILE", "nfile" },
+ { G_FILE_ERROR_BADF, "G_FILE_ERROR_BADF", "badf" },
+ { G_FILE_ERROR_INVAL, "G_FILE_ERROR_INVAL", "inval" },
+ { G_FILE_ERROR_PIPE, "G_FILE_ERROR_PIPE", "pipe" },
+ { G_FILE_ERROR_AGAIN, "G_FILE_ERROR_AGAIN", "again" },
+ { G_FILE_ERROR_INTR, "G_FILE_ERROR_INTR", "intr" },
+ { G_FILE_ERROR_IO, "G_FILE_ERROR_IO", "io" },
+ { G_FILE_ERROR_PERM, "G_FILE_ERROR_PERM", "perm" },
+ { G_FILE_ERROR_NOSYS, "G_FILE_ERROR_NOSYS", "nosys" },
+ { G_FILE_ERROR_FAILED, "G_FILE_ERROR_FAILED", "failed" },
+ { 0, NULL, NULL }
+ };
+ etype = g_enum_register_static ("GFileError", values);
+ }
+ return etype;
+}
+
+GType
+g_file_test_get_type (void)
+{
+ static GType etype = 0;
+ if (etype == 0) {
+ static const GFlagsValue values[] = {
+ { G_FILE_TEST_IS_REGULAR, "G_FILE_TEST_IS_REGULAR", "is-regular" },
+ { G_FILE_TEST_IS_SYMLINK, "G_FILE_TEST_IS_SYMLINK", "is-symlink" },
+ { G_FILE_TEST_IS_DIR, "G_FILE_TEST_IS_DIR", "is-dir" },
+ { G_FILE_TEST_IS_EXECUTABLE, "G_FILE_TEST_IS_EXECUTABLE", "is-executable" },
+ { G_FILE_TEST_EXISTS, "G_FILE_TEST_EXISTS", "exists" },
+ { 0, NULL, NULL }
+ };
+ etype = g_flags_register_static ("GFileTest", values);
+ }
+ return etype;
+}
+
+
+/* enumerations from "/usr/include/glib-2.0/glib/gtimezone.h" */
+GType
+g_time_type_get_type (void)
+{
+ static GType etype = 0;
+ if (etype == 0) {
+ static const GEnumValue values[] = {
+ { G_TIME_TYPE_STANDARD, "G_TIME_TYPE_STANDARD", "standard" },
+ { G_TIME_TYPE_DAYLIGHT, "G_TIME_TYPE_DAYLIGHT", "daylight" },
+ { G_TIME_TYPE_UNIVERSAL, "G_TIME_TYPE_UNIVERSAL", "universal" },
+ { 0, NULL, NULL }
+ };
+ etype = g_enum_register_static ("GTimeType", values);
+ }
+ return etype;
+}
+
+
+/* enumerations from "/usr/include/glib-2.0/glib/gdate.h" */
+GType
+g_date_dm_y_get_type (void)
+{
+ static GType etype = 0;
+ if (etype == 0) {
+ static const GEnumValue values[] = {
+ { G_DATE_DAY, "G_DATE_DAY", "day" },
+ { G_DATE_MONTH, "G_DATE_MONTH", "month" },
+ { G_DATE_YEAR, "G_DATE_YEAR", "year" },
+ { 0, NULL, NULL }
+ };
+ etype = g_enum_register_static ("GDateDMY", values);
+ }
+ return etype;
+}
+
+GType
+g_date_weekday_get_type (void)
+{
+ static GType etype = 0;
+ if (etype == 0) {
+ static const GEnumValue values[] = {
+ { G_DATE_BAD_WEEKDAY, "G_DATE_BAD_WEEKDAY", "bad-weekday" },
+ { G_DATE_MONDAY, "G_DATE_MONDAY", "monday" },
+ { G_DATE_TUESDAY, "G_DATE_TUESDAY", "tuesday" },
+ { G_DATE_WEDNESDAY, "G_DATE_WEDNESDAY", "wednesday" },
+ { G_DATE_THURSDAY, "G_DATE_THURSDAY", "thursday" },
+ { G_DATE_FRIDAY, "G_DATE_FRIDAY", "friday" },
+ { G_DATE_SATURDAY, "G_DATE_SATURDAY", "saturday" },
+ { G_DATE_SUNDAY, "G_DATE_SUNDAY", "sunday" },
+ { 0, NULL, NULL }
+ };
+ etype = g_enum_register_static ("GDateWeekday", values);
+ }
+ return etype;
+}
+
+GType
+g_date_month_get_type (void)
+{
+ static GType etype = 0;
+ if (etype == 0) {
+ static const GEnumValue values[] = {
+ { G_DATE_BAD_MONTH, "G_DATE_BAD_MONTH", "bad-month" },
+ { G_DATE_JANUARY, "G_DATE_JANUARY", "january" },
+ { G_DATE_FEBRUARY, "G_DATE_FEBRUARY", "february" },
+ { G_DATE_MARCH, "G_DATE_MARCH", "march" },
+ { G_DATE_APRIL, "G_DATE_APRIL", "april" },
+ { G_DATE_MAY, "G_DATE_MAY", "may" },
+ { G_DATE_JUNE, "G_DATE_JUNE", "june" },
+ { G_DATE_JULY, "G_DATE_JULY", "july" },
+ { G_DATE_AUGUST, "G_DATE_AUGUST", "august" },
+ { G_DATE_SEPTEMBER, "G_DATE_SEPTEMBER", "september" },
+ { G_DATE_OCTOBER, "G_DATE_OCTOBER", "october" },
+ { G_DATE_NOVEMBER, "G_DATE_NOVEMBER", "november" },
+ { G_DATE_DECEMBER, "G_DATE_DECEMBER", "december" },
+ { 0, NULL, NULL }
+ };
+ etype = g_enum_register_static ("GDateMonth", values);
+ }
+ return etype;
+}
+
+
+/* enumerations from "/usr/include/glib-2.0/glib/gunicode.h" */
+GType
+g_unicode_type_get_type (void)
+{
+ static GType etype = 0;
+ if (etype == 0) {
+ static const GEnumValue values[] = {
+ { G_UNICODE_CONTROL, "G_UNICODE_CONTROL", "control" },
+ { G_UNICODE_FORMAT, "G_UNICODE_FORMAT", "format" },
+ { G_UNICODE_UNASSIGNED, "G_UNICODE_UNASSIGNED", "unassigned" },
+ { G_UNICODE_PRIVATE_USE, "G_UNICODE_PRIVATE_USE", "private-use" },
+ { G_UNICODE_SURROGATE, "G_UNICODE_SURROGATE", "surrogate" },
+ { G_UNICODE_LOWERCASE_LETTER, "G_UNICODE_LOWERCASE_LETTER", "lowercase-letter" },
+ { G_UNICODE_MODIFIER_LETTER, "G_UNICODE_MODIFIER_LETTER", "modifier-letter" },
+ { G_UNICODE_OTHER_LETTER, "G_UNICODE_OTHER_LETTER", "other-letter" },
+ { G_UNICODE_TITLECASE_LETTER, "G_UNICODE_TITLECASE_LETTER", "titlecase-letter" },
+ { G_UNICODE_UPPERCASE_LETTER, "G_UNICODE_UPPERCASE_LETTER", "uppercase-letter" },
+ { G_UNICODE_SPACING_MARK, "G_UNICODE_SPACING_MARK", "spacing-mark" },
+ { G_UNICODE_ENCLOSING_MARK, "G_UNICODE_ENCLOSING_MARK", "enclosing-mark" },
+ { G_UNICODE_NON_SPACING_MARK, "G_UNICODE_NON_SPACING_MARK", "non-spacing-mark" },
+ { G_UNICODE_DECIMAL_NUMBER, "G_UNICODE_DECIMAL_NUMBER", "decimal-number" },
+ { G_UNICODE_LETTER_NUMBER, "G_UNICODE_LETTER_NUMBER", "letter-number" },
+ { G_UNICODE_OTHER_NUMBER, "G_UNICODE_OTHER_NUMBER", "other-number" },
+ { G_UNICODE_CONNECT_PUNCTUATION, "G_UNICODE_CONNECT_PUNCTUATION", "connect-punctuation" },
+ { G_UNICODE_DASH_PUNCTUATION, "G_UNICODE_DASH_PUNCTUATION", "dash-punctuation" },
+ { G_UNICODE_CLOSE_PUNCTUATION, "G_UNICODE_CLOSE_PUNCTUATION", "close-punctuation" },
+ { G_UNICODE_FINAL_PUNCTUATION, "G_UNICODE_FINAL_PUNCTUATION", "final-punctuation" },
+ { G_UNICODE_INITIAL_PUNCTUATION, "G_UNICODE_INITIAL_PUNCTUATION", "initial-punctuation" },
+ { G_UNICODE_OTHER_PUNCTUATION, "G_UNICODE_OTHER_PUNCTUATION", "other-punctuation" },
+ { G_UNICODE_OPEN_PUNCTUATION, "G_UNICODE_OPEN_PUNCTUATION", "open-punctuation" },
+ { G_UNICODE_CURRENCY_SYMBOL, "G_UNICODE_CURRENCY_SYMBOL", "currency-symbol" },
+ { G_UNICODE_MODIFIER_SYMBOL, "G_UNICODE_MODIFIER_SYMBOL", "modifier-symbol" },
+ { G_UNICODE_MATH_SYMBOL, "G_UNICODE_MATH_SYMBOL", "math-symbol" },
+ { G_UNICODE_OTHER_SYMBOL, "G_UNICODE_OTHER_SYMBOL", "other-symbol" },
+ { G_UNICODE_LINE_SEPARATOR, "G_UNICODE_LINE_SEPARATOR", "line-separator" },
+ { G_UNICODE_PARAGRAPH_SEPARATOR, "G_UNICODE_PARAGRAPH_SEPARATOR", "paragraph-separator" },
+ { G_UNICODE_SPACE_SEPARATOR, "G_UNICODE_SPACE_SEPARATOR", "space-separator" },
+ { 0, NULL, NULL }
+ };
+ etype = g_enum_register_static ("GUnicodeType", values);
+ }
+ return etype;
+}
+
+GType
+g_unicode_break_type_get_type (void)
+{
+ static GType etype = 0;
+ if (etype == 0) {
+ static const GEnumValue values[] = {
+ { G_UNICODE_BREAK_MANDATORY, "G_UNICODE_BREAK_MANDATORY", "mandatory" },
+ { G_UNICODE_BREAK_CARRIAGE_RETURN, "G_UNICODE_BREAK_CARRIAGE_RETURN", "carriage-return" },
+ { G_UNICODE_BREAK_LINE_FEED, "G_UNICODE_BREAK_LINE_FEED", "line-feed" },
+ { G_UNICODE_BREAK_COMBINING_MARK, "G_UNICODE_BREAK_COMBINING_MARK", "combining-mark" },
+ { G_UNICODE_BREAK_SURROGATE, "G_UNICODE_BREAK_SURROGATE", "surrogate" },
+ { G_UNICODE_BREAK_ZERO_WIDTH_SPACE, "G_UNICODE_BREAK_ZERO_WIDTH_SPACE", "zero-width-space" },
+ { G_UNICODE_BREAK_INSEPARABLE, "G_UNICODE_BREAK_INSEPARABLE", "inseparable" },
+ { G_UNICODE_BREAK_NON_BREAKING_GLUE, "G_UNICODE_BREAK_NON_BREAKING_GLUE", "non-breaking-glue" },
+ { G_UNICODE_BREAK_CONTINGENT, "G_UNICODE_BREAK_CONTINGENT", "contingent" },
+ { G_UNICODE_BREAK_SPACE, "G_UNICODE_BREAK_SPACE", "space" },
+ { G_UNICODE_BREAK_AFTER, "G_UNICODE_BREAK_AFTER", "after" },
+ { G_UNICODE_BREAK_BEFORE, "G_UNICODE_BREAK_BEFORE", "before" },
+ { G_UNICODE_BREAK_BEFORE_AND_AFTER, "G_UNICODE_BREAK_BEFORE_AND_AFTER", "before-and-after" },
+ { G_UNICODE_BREAK_HYPHEN, "G_UNICODE_BREAK_HYPHEN", "hyphen" },
+ { G_UNICODE_BREAK_NON_STARTER, "G_UNICODE_BREAK_NON_STARTER", "non-starter" },
+ { G_UNICODE_BREAK_OPEN_PUNCTUATION, "G_UNICODE_BREAK_OPEN_PUNCTUATION", "open-punctuation" },
+ { G_UNICODE_BREAK_CLOSE_PUNCTUATION, "G_UNICODE_BREAK_CLOSE_PUNCTUATION", "close-punctuation" },
+ { G_UNICODE_BREAK_QUOTATION, "G_UNICODE_BREAK_QUOTATION", "quotation" },
+ { G_UNICODE_BREAK_EXCLAMATION, "G_UNICODE_BREAK_EXCLAMATION", "exclamation" },
+ { G_UNICODE_BREAK_IDEOGRAPHIC, "G_UNICODE_BREAK_IDEOGRAPHIC", "ideographic" },
+ { G_UNICODE_BREAK_NUMERIC, "G_UNICODE_BREAK_NUMERIC", "numeric" },
+ { G_UNICODE_BREAK_INFIX_SEPARATOR, "G_UNICODE_BREAK_INFIX_SEPARATOR", "infix-separator" },
+ { G_UNICODE_BREAK_SYMBOL, "G_UNICODE_BREAK_SYMBOL", "symbol" },
+ { G_UNICODE_BREAK_ALPHABETIC, "G_UNICODE_BREAK_ALPHABETIC", "alphabetic" },
+ { G_UNICODE_BREAK_PREFIX, "G_UNICODE_BREAK_PREFIX", "prefix" },
+ { G_UNICODE_BREAK_POSTFIX, "G_UNICODE_BREAK_POSTFIX", "postfix" },
+ { G_UNICODE_BREAK_COMPLEX_CONTEXT, "G_UNICODE_BREAK_COMPLEX_CONTEXT", "complex-context" },
+ { G_UNICODE_BREAK_AMBIGUOUS, "G_UNICODE_BREAK_AMBIGUOUS", "ambiguous" },
+ { G_UNICODE_BREAK_UNKNOWN, "G_UNICODE_BREAK_UNKNOWN", "unknown" },
+ { G_UNICODE_BREAK_NEXT_LINE, "G_UNICODE_BREAK_NEXT_LINE", "next-line" },
+ { G_UNICODE_BREAK_WORD_JOINER, "G_UNICODE_BREAK_WORD_JOINER", "word-joiner" },
+ { G_UNICODE_BREAK_HANGUL_L_JAMO, "G_UNICODE_BREAK_HANGUL_L_JAMO", "hangul-l-jamo" },
+ { G_UNICODE_BREAK_HANGUL_V_JAMO, "G_UNICODE_BREAK_HANGUL_V_JAMO", "hangul-v-jamo" },
+ { G_UNICODE_BREAK_HANGUL_T_JAMO, "G_UNICODE_BREAK_HANGUL_T_JAMO", "hangul-t-jamo" },
+ { G_UNICODE_BREAK_HANGUL_LV_SYLLABLE, "G_UNICODE_BREAK_HANGUL_LV_SYLLABLE", "hangul-lv-syllable" },
+ { G_UNICODE_BREAK_HANGUL_LVT_SYLLABLE, "G_UNICODE_BREAK_HANGUL_LVT_SYLLABLE", "hangul-lvt-syllable" },
+ { G_UNICODE_BREAK_CLOSE_PARANTHESIS, "G_UNICODE_BREAK_CLOSE_PARANTHESIS", "close-paranthesis" },
+ { G_UNICODE_BREAK_CONDITIONAL_JAPANESE_STARTER, "G_UNICODE_BREAK_CONDITIONAL_JAPANESE_STARTER", "conditional-japanese-starter" },
+ { G_UNICODE_BREAK_HEBREW_LETTER, "G_UNICODE_BREAK_HEBREW_LETTER", "hebrew-letter" },
+ { G_UNICODE_BREAK_REGIONAL_INDICATOR, "G_UNICODE_BREAK_REGIONAL_INDICATOR", "regional-indicator" },
+ { 0, NULL, NULL }
+ };
+ etype = g_enum_register_static ("GUnicodeBreakType", values);
+ }
+ return etype;
+}
+
+GType
+g_unicode_script_get_type (void)
+{
+ static GType etype = 0;
+ if (etype == 0) {
+ static const GEnumValue values[] = {
+ { G_UNICODE_SCRIPT_INVALID_CODE, "G_UNICODE_SCRIPT_INVALID_CODE", "invalid-code" },
+ { G_UNICODE_SCRIPT_COMMON, "G_UNICODE_SCRIPT_COMMON", "common" },
+ { G_UNICODE_SCRIPT_INHERITED, "G_UNICODE_SCRIPT_INHERITED", "inherited" },
+ { G_UNICODE_SCRIPT_ARABIC, "G_UNICODE_SCRIPT_ARABIC", "arabic" },
+ { G_UNICODE_SCRIPT_ARMENIAN, "G_UNICODE_SCRIPT_ARMENIAN", "armenian" },
+ { G_UNICODE_SCRIPT_BENGALI, "G_UNICODE_SCRIPT_BENGALI", "bengali" },
+ { G_UNICODE_SCRIPT_BOPOMOFO, "G_UNICODE_SCRIPT_BOPOMOFO", "bopomofo" },
+ { G_UNICODE_SCRIPT_CHEROKEE, "G_UNICODE_SCRIPT_CHEROKEE", "cherokee" },
+ { G_UNICODE_SCRIPT_COPTIC, "G_UNICODE_SCRIPT_COPTIC", "coptic" },
+ { G_UNICODE_SCRIPT_CYRILLIC, "G_UNICODE_SCRIPT_CYRILLIC", "cyrillic" },
+ { G_UNICODE_SCRIPT_DESERET, "G_UNICODE_SCRIPT_DESERET", "deseret" },
+ { G_UNICODE_SCRIPT_DEVANAGARI, "G_UNICODE_SCRIPT_DEVANAGARI", "devanagari" },
+ { G_UNICODE_SCRIPT_ETHIOPIC, "G_UNICODE_SCRIPT_ETHIOPIC", "ethiopic" },
+ { G_UNICODE_SCRIPT_GEORGIAN, "G_UNICODE_SCRIPT_GEORGIAN", "georgian" },
+ { G_UNICODE_SCRIPT_GOTHIC, "G_UNICODE_SCRIPT_GOTHIC", "gothic" },
+ { G_UNICODE_SCRIPT_GREEK, "G_UNICODE_SCRIPT_GREEK", "greek" },
+ { G_UNICODE_SCRIPT_GUJARATI, "G_UNICODE_SCRIPT_GUJARATI", "gujarati" },
+ { G_UNICODE_SCRIPT_GURMUKHI, "G_UNICODE_SCRIPT_GURMUKHI", "gurmukhi" },
+ { G_UNICODE_SCRIPT_HAN, "G_UNICODE_SCRIPT_HAN", "han" },
+ { G_UNICODE_SCRIPT_HANGUL, "G_UNICODE_SCRIPT_HANGUL", "hangul" },
+ { G_UNICODE_SCRIPT_HEBREW, "G_UNICODE_SCRIPT_HEBREW", "hebrew" },
+ { G_UNICODE_SCRIPT_HIRAGANA, "G_UNICODE_SCRIPT_HIRAGANA", "hiragana" },
+ { G_UNICODE_SCRIPT_KANNADA, "G_UNICODE_SCRIPT_KANNADA", "kannada" },
+ { G_UNICODE_SCRIPT_KATAKANA, "G_UNICODE_SCRIPT_KATAKANA", "katakana" },
+ { G_UNICODE_SCRIPT_KHMER, "G_UNICODE_SCRIPT_KHMER", "khmer" },
+ { G_UNICODE_SCRIPT_LAO, "G_UNICODE_SCRIPT_LAO", "lao" },
+ { G_UNICODE_SCRIPT_LATIN, "G_UNICODE_SCRIPT_LATIN", "latin" },
+ { G_UNICODE_SCRIPT_MALAYALAM, "G_UNICODE_SCRIPT_MALAYALAM", "malayalam" },
+ { G_UNICODE_SCRIPT_MONGOLIAN, "G_UNICODE_SCRIPT_MONGOLIAN", "mongolian" },
+ { G_UNICODE_SCRIPT_MYANMAR, "G_UNICODE_SCRIPT_MYANMAR", "myanmar" },
+ { G_UNICODE_SCRIPT_OGHAM, "G_UNICODE_SCRIPT_OGHAM", "ogham" },
+ { G_UNICODE_SCRIPT_OLD_ITALIC, "G_UNICODE_SCRIPT_OLD_ITALIC", "old-italic" },
+ { G_UNICODE_SCRIPT_ORIYA, "G_UNICODE_SCRIPT_ORIYA", "oriya" },
+ { G_UNICODE_SCRIPT_RUNIC, "G_UNICODE_SCRIPT_RUNIC", "runic" },
+ { G_UNICODE_SCRIPT_SINHALA, "G_UNICODE_SCRIPT_SINHALA", "sinhala" },
+ { G_UNICODE_SCRIPT_SYRIAC, "G_UNICODE_SCRIPT_SYRIAC", "syriac" },
+ { G_UNICODE_SCRIPT_TAMIL, "G_UNICODE_SCRIPT_TAMIL", "tamil" },
+ { G_UNICODE_SCRIPT_TELUGU, "G_UNICODE_SCRIPT_TELUGU", "telugu" },
+ { G_UNICODE_SCRIPT_THAANA, "G_UNICODE_SCRIPT_THAANA", "thaana" },
+ { G_UNICODE_SCRIPT_THAI, "G_UNICODE_SCRIPT_THAI", "thai" },
+ { G_UNICODE_SCRIPT_TIBETAN, "G_UNICODE_SCRIPT_TIBETAN", "tibetan" },
+ { G_UNICODE_SCRIPT_CANADIAN_ABORIGINAL, "G_UNICODE_SCRIPT_CANADIAN_ABORIGINAL", "canadian-aboriginal" },
+ { G_UNICODE_SCRIPT_YI, "G_UNICODE_SCRIPT_YI", "yi" },
+ { G_UNICODE_SCRIPT_TAGALOG, "G_UNICODE_SCRIPT_TAGALOG", "tagalog" },
+ { G_UNICODE_SCRIPT_HANUNOO, "G_UNICODE_SCRIPT_HANUNOO", "hanunoo" },
+ { G_UNICODE_SCRIPT_BUHID, "G_UNICODE_SCRIPT_BUHID", "buhid" },
+ { G_UNICODE_SCRIPT_TAGBANWA, "G_UNICODE_SCRIPT_TAGBANWA", "tagbanwa" },
+ { G_UNICODE_SCRIPT_BRAILLE, "G_UNICODE_SCRIPT_BRAILLE", "braille" },
+ { G_UNICODE_SCRIPT_CYPRIOT, "G_UNICODE_SCRIPT_CYPRIOT", "cypriot" },
+ { G_UNICODE_SCRIPT_LIMBU, "G_UNICODE_SCRIPT_LIMBU", "limbu" },
+ { G_UNICODE_SCRIPT_OSMANYA, "G_UNICODE_SCRIPT_OSMANYA", "osmanya" },
+ { G_UNICODE_SCRIPT_SHAVIAN, "G_UNICODE_SCRIPT_SHAVIAN", "shavian" },
+ { G_UNICODE_SCRIPT_LINEAR_B, "G_UNICODE_SCRIPT_LINEAR_B", "linear-b" },
+ { G_UNICODE_SCRIPT_TAI_LE, "G_UNICODE_SCRIPT_TAI_LE", "tai-le" },
+ { G_UNICODE_SCRIPT_UGARITIC, "G_UNICODE_SCRIPT_UGARITIC", "ugaritic" },
+ { G_UNICODE_SCRIPT_NEW_TAI_LUE, "G_UNICODE_SCRIPT_NEW_TAI_LUE", "new-tai-lue" },
+ { G_UNICODE_SCRIPT_BUGINESE, "G_UNICODE_SCRIPT_BUGINESE", "buginese" },
+ { G_UNICODE_SCRIPT_GLAGOLITIC, "G_UNICODE_SCRIPT_GLAGOLITIC", "glagolitic" },
+ { G_UNICODE_SCRIPT_TIFINAGH, "G_UNICODE_SCRIPT_TIFINAGH", "tifinagh" },
+ { G_UNICODE_SCRIPT_SYLOTI_NAGRI, "G_UNICODE_SCRIPT_SYLOTI_NAGRI", "syloti-nagri" },
+ { G_UNICODE_SCRIPT_OLD_PERSIAN, "G_UNICODE_SCRIPT_OLD_PERSIAN", "old-persian" },
+ { G_UNICODE_SCRIPT_KHAROSHTHI, "G_UNICODE_SCRIPT_KHAROSHTHI", "kharoshthi" },
+ { G_UNICODE_SCRIPT_UNKNOWN, "G_UNICODE_SCRIPT_UNKNOWN", "unknown" },
+ { G_UNICODE_SCRIPT_BALINESE, "G_UNICODE_SCRIPT_BALINESE", "balinese" },
+ { G_UNICODE_SCRIPT_CUNEIFORM, "G_UNICODE_SCRIPT_CUNEIFORM", "cuneiform" },
+ { G_UNICODE_SCRIPT_PHOENICIAN, "G_UNICODE_SCRIPT_PHOENICIAN", "phoenician" },
+ { G_UNICODE_SCRIPT_PHAGS_PA, "G_UNICODE_SCRIPT_PHAGS_PA", "phags-pa" },
+ { G_UNICODE_SCRIPT_NKO, "G_UNICODE_SCRIPT_NKO", "nko" },
+ { G_UNICODE_SCRIPT_KAYAH_LI, "G_UNICODE_SCRIPT_KAYAH_LI", "kayah-li" },
+ { G_UNICODE_SCRIPT_LEPCHA, "G_UNICODE_SCRIPT_LEPCHA", "lepcha" },
+ { G_UNICODE_SCRIPT_REJANG, "G_UNICODE_SCRIPT_REJANG", "rejang" },
+ { G_UNICODE_SCRIPT_SUNDANESE, "G_UNICODE_SCRIPT_SUNDANESE", "sundanese" },
+ { G_UNICODE_SCRIPT_SAURASHTRA, "G_UNICODE_SCRIPT_SAURASHTRA", "saurashtra" },
+ { G_UNICODE_SCRIPT_CHAM, "G_UNICODE_SCRIPT_CHAM", "cham" },
+ { G_UNICODE_SCRIPT_OL_CHIKI, "G_UNICODE_SCRIPT_OL_CHIKI", "ol-chiki" },
+ { G_UNICODE_SCRIPT_VAI, "G_UNICODE_SCRIPT_VAI", "vai" },
+ { G_UNICODE_SCRIPT_CARIAN, "G_UNICODE_SCRIPT_CARIAN", "carian" },
+ { G_UNICODE_SCRIPT_LYCIAN, "G_UNICODE_SCRIPT_LYCIAN", "lycian" },
+ { G_UNICODE_SCRIPT_LYDIAN, "G_UNICODE_SCRIPT_LYDIAN", "lydian" },
+ { G_UNICODE_SCRIPT_AVESTAN, "G_UNICODE_SCRIPT_AVESTAN", "avestan" },
+ { G_UNICODE_SCRIPT_BAMUM, "G_UNICODE_SCRIPT_BAMUM", "bamum" },
+ { G_UNICODE_SCRIPT_EGYPTIAN_HIEROGLYPHS, "G_UNICODE_SCRIPT_EGYPTIAN_HIEROGLYPHS", "egyptian-hieroglyphs" },
+ { G_UNICODE_SCRIPT_IMPERIAL_ARAMAIC, "G_UNICODE_SCRIPT_IMPERIAL_ARAMAIC", "imperial-aramaic" },
+ { G_UNICODE_SCRIPT_INSCRIPTIONAL_PAHLAVI, "G_UNICODE_SCRIPT_INSCRIPTIONAL_PAHLAVI", "inscriptional-pahlavi" },
+ { G_UNICODE_SCRIPT_INSCRIPTIONAL_PARTHIAN, "G_UNICODE_SCRIPT_INSCRIPTIONAL_PARTHIAN", "inscriptional-parthian" },
+ { G_UNICODE_SCRIPT_JAVANESE, "G_UNICODE_SCRIPT_JAVANESE", "javanese" },
+ { G_UNICODE_SCRIPT_KAITHI, "G_UNICODE_SCRIPT_KAITHI", "kaithi" },
+ { G_UNICODE_SCRIPT_LISU, "G_UNICODE_SCRIPT_LISU", "lisu" },
+ { G_UNICODE_SCRIPT_MEETEI_MAYEK, "G_UNICODE_SCRIPT_MEETEI_MAYEK", "meetei-mayek" },
+ { G_UNICODE_SCRIPT_OLD_SOUTH_ARABIAN, "G_UNICODE_SCRIPT_OLD_SOUTH_ARABIAN", "old-south-arabian" },
+ { G_UNICODE_SCRIPT_OLD_TURKIC, "G_UNICODE_SCRIPT_OLD_TURKIC", "old-turkic" },
+ { G_UNICODE_SCRIPT_SAMARITAN, "G_UNICODE_SCRIPT_SAMARITAN", "samaritan" },
+ { G_UNICODE_SCRIPT_TAI_THAM, "G_UNICODE_SCRIPT_TAI_THAM", "tai-tham" },
+ { G_UNICODE_SCRIPT_TAI_VIET, "G_UNICODE_SCRIPT_TAI_VIET", "tai-viet" },
+ { G_UNICODE_SCRIPT_BATAK, "G_UNICODE_SCRIPT_BATAK", "batak" },
+ { G_UNICODE_SCRIPT_BRAHMI, "G_UNICODE_SCRIPT_BRAHMI", "brahmi" },
+ { G_UNICODE_SCRIPT_MANDAIC, "G_UNICODE_SCRIPT_MANDAIC", "mandaic" },
+ { G_UNICODE_SCRIPT_CHAKMA, "G_UNICODE_SCRIPT_CHAKMA", "chakma" },
+ { G_UNICODE_SCRIPT_MEROITIC_CURSIVE, "G_UNICODE_SCRIPT_MEROITIC_CURSIVE", "meroitic-cursive" },
+ { G_UNICODE_SCRIPT_MEROITIC_HIEROGLYPHS, "G_UNICODE_SCRIPT_MEROITIC_HIEROGLYPHS", "meroitic-hieroglyphs" },
+ { G_UNICODE_SCRIPT_MIAO, "G_UNICODE_SCRIPT_MIAO", "miao" },
+ { G_UNICODE_SCRIPT_SHARADA, "G_UNICODE_SCRIPT_SHARADA", "sharada" },
+ { G_UNICODE_SCRIPT_SORA_SOMPENG, "G_UNICODE_SCRIPT_SORA_SOMPENG", "sora-sompeng" },
+ { G_UNICODE_SCRIPT_TAKRI, "G_UNICODE_SCRIPT_TAKRI", "takri" },
+ { G_UNICODE_SCRIPT_BASSA_VAH, "G_UNICODE_SCRIPT_BASSA_VAH", "bassa-vah" },
+ { G_UNICODE_SCRIPT_CAUCASIAN_ALBANIAN, "G_UNICODE_SCRIPT_CAUCASIAN_ALBANIAN", "caucasian-albanian" },
+ { G_UNICODE_SCRIPT_DUPLOYAN, "G_UNICODE_SCRIPT_DUPLOYAN", "duployan" },
+ { G_UNICODE_SCRIPT_ELBASAN, "G_UNICODE_SCRIPT_ELBASAN", "elbasan" },
+ { G_UNICODE_SCRIPT_GRANTHA, "G_UNICODE_SCRIPT_GRANTHA", "grantha" },
+ { G_UNICODE_SCRIPT_KHOJKI, "G_UNICODE_SCRIPT_KHOJKI", "khojki" },
+ { G_UNICODE_SCRIPT_KHUDAWADI, "G_UNICODE_SCRIPT_KHUDAWADI", "khudawadi" },
+ { G_UNICODE_SCRIPT_LINEAR_A, "G_UNICODE_SCRIPT_LINEAR_A", "linear-a" },
+ { G_UNICODE_SCRIPT_MAHAJANI, "G_UNICODE_SCRIPT_MAHAJANI", "mahajani" },
+ { G_UNICODE_SCRIPT_MANICHAEAN, "G_UNICODE_SCRIPT_MANICHAEAN", "manichaean" },
+ { G_UNICODE_SCRIPT_MENDE_KIKAKUI, "G_UNICODE_SCRIPT_MENDE_KIKAKUI", "mende-kikakui" },
+ { G_UNICODE_SCRIPT_MODI, "G_UNICODE_SCRIPT_MODI", "modi" },
+ { G_UNICODE_SCRIPT_MRO, "G_UNICODE_SCRIPT_MRO", "mro" },
+ { G_UNICODE_SCRIPT_NABATAEAN, "G_UNICODE_SCRIPT_NABATAEAN", "nabataean" },
+ { G_UNICODE_SCRIPT_OLD_NORTH_ARABIAN, "G_UNICODE_SCRIPT_OLD_NORTH_ARABIAN", "old-north-arabian" },
+ { G_UNICODE_SCRIPT_OLD_PERMIC, "G_UNICODE_SCRIPT_OLD_PERMIC", "old-permic" },
+ { G_UNICODE_SCRIPT_PAHAWH_HMONG, "G_UNICODE_SCRIPT_PAHAWH_HMONG", "pahawh-hmong" },
+ { G_UNICODE_SCRIPT_PALMYRENE, "G_UNICODE_SCRIPT_PALMYRENE", "palmyrene" },
+ { G_UNICODE_SCRIPT_PAU_CIN_HAU, "G_UNICODE_SCRIPT_PAU_CIN_HAU", "pau-cin-hau" },
+ { G_UNICODE_SCRIPT_PSALTER_PAHLAVI, "G_UNICODE_SCRIPT_PSALTER_PAHLAVI", "psalter-pahlavi" },
+ { G_UNICODE_SCRIPT_SIDDHAM, "G_UNICODE_SCRIPT_SIDDHAM", "siddham" },
+ { G_UNICODE_SCRIPT_TIRHUTA, "G_UNICODE_SCRIPT_TIRHUTA", "tirhuta" },
+ { G_UNICODE_SCRIPT_WARANG_CITI, "G_UNICODE_SCRIPT_WARANG_CITI", "warang-citi" },
+ { 0, NULL, NULL }
+ };
+ etype = g_enum_register_static ("GUnicodeScript", values);
+ }
+ return etype;
+}
+
+GType
+g_normalize_mode_get_type (void)
+{
+ static GType etype = 0;
+ if (etype == 0) {
+ static const GEnumValue values[] = {
+ { G_NORMALIZE_DEFAULT, "G_NORMALIZE_DEFAULT", "default" },
+ { G_NORMALIZE_NFD, "G_NORMALIZE_NFD", "nfd" },
+ { G_NORMALIZE_DEFAULT_COMPOSE, "G_NORMALIZE_DEFAULT_COMPOSE", "default-compose" },
+ { G_NORMALIZE_NFC, "G_NORMALIZE_NFC", "nfc" },
+ { G_NORMALIZE_ALL, "G_NORMALIZE_ALL", "all" },
+ { G_NORMALIZE_NFKD, "G_NORMALIZE_NFKD", "nfkd" },
+ { G_NORMALIZE_ALL_COMPOSE, "G_NORMALIZE_ALL_COMPOSE", "all-compose" },
+ { G_NORMALIZE_NFKC, "G_NORMALIZE_NFKC", "nfkc" },
+ { 0, NULL, NULL }
+ };
+ etype = g_enum_register_static ("GNormalizeMode", values);
+ }
+ return etype;
+}
+
+
+/* enumerations from "/usr/include/glib-2.0/glib/ghook.h" */
+GType
+g_hook_flag_mask_get_type (void)
+{
+ static GType etype = 0;
+ if (etype == 0) {
+ static const GFlagsValue values[] = {
+ { G_HOOK_FLAG_ACTIVE, "G_HOOK_FLAG_ACTIVE", "active" },
+ { G_HOOK_FLAG_IN_CALL, "G_HOOK_FLAG_IN_CALL", "in-call" },
+ { G_HOOK_FLAG_MASK, "G_HOOK_FLAG_MASK", "mask" },
+ { 0, NULL, NULL }
+ };
+ etype = g_flags_register_static ("GHookFlagMask", values);
+ }
+ return etype;
+}
+
+
+/* enumerations from "/usr/include/glib-2.0/glib/gthread.h" */
+GType
+g_thread_error_get_type (void)
+{
+ static GType etype = 0;
+ if (etype == 0) {
+ static const GEnumValue values[] = {
+ { G_THREAD_ERROR_AGAIN, "G_THREAD_ERROR_AGAIN", "again" },
+ { 0, NULL, NULL }
+ };
+ etype = g_enum_register_static ("GThreadError", values);
+ }
+ return etype;
+}
+
+GType
+g_once_status_get_type (void)
+{
+ static GType etype = 0;
+ if (etype == 0) {
+ static const GEnumValue values[] = {
+ { G_ONCE_STATUS_NOTCALLED, "G_ONCE_STATUS_NOTCALLED", "notcalled" },
+ { G_ONCE_STATUS_PROGRESS, "G_ONCE_STATUS_PROGRESS", "progress" },
+ { G_ONCE_STATUS_READY, "G_ONCE_STATUS_READY", "ready" },
+ { 0, NULL, NULL }
+ };
+ etype = g_enum_register_static ("GOnceStatus", values);
+ }
+ return etype;
+}
+
+
+/* enumerations from "/usr/include/glib-2.0/glib/gstrfuncs.h" */
+GType
+g_ascii_type_get_type (void)
+{
+ static GType etype = 0;
+ if (etype == 0) {
+ static const GFlagsValue values[] = {
+ { G_ASCII_ALNUM, "G_ASCII_ALNUM", "alnum" },
+ { G_ASCII_ALPHA, "G_ASCII_ALPHA", "alpha" },
+ { G_ASCII_CNTRL, "G_ASCII_CNTRL", "cntrl" },
+ { G_ASCII_DIGIT, "G_ASCII_DIGIT", "digit" },
+ { G_ASCII_GRAPH, "G_ASCII_GRAPH", "graph" },
+ { G_ASCII_LOWER, "G_ASCII_LOWER", "lower" },
+ { G_ASCII_PRINT, "G_ASCII_PRINT", "print" },
+ { G_ASCII_PUNCT, "G_ASCII_PUNCT", "punct" },
+ { G_ASCII_SPACE, "G_ASCII_SPACE", "space" },
+ { G_ASCII_UPPER, "G_ASCII_UPPER", "upper" },
+ { G_ASCII_XDIGIT, "G_ASCII_XDIGIT", "xdigit" },
+ { 0, NULL, NULL }
+ };
+ etype = g_flags_register_static ("GAsciiType", values);
+ }
+ return etype;
+}
+
+
+/* enumerations from "/usr/include/glib-2.0/glib/gmessages.h" */
+GType
+g_log_level_flags_get_type (void)
+{
+ static GType etype = 0;
+ if (etype == 0) {
+ static const GFlagsValue values[] = {
+ { G_LOG_FLAG_RECURSION, "G_LOG_FLAG_RECURSION", "flag-recursion" },
+ { G_LOG_FLAG_FATAL, "G_LOG_FLAG_FATAL", "flag-fatal" },
+ { G_LOG_LEVEL_ERROR, "G_LOG_LEVEL_ERROR", "level-error" },
+ { G_LOG_LEVEL_CRITICAL, "G_LOG_LEVEL_CRITICAL", "level-critical" },
+ { G_LOG_LEVEL_WARNING, "G_LOG_LEVEL_WARNING", "level-warning" },
+ { G_LOG_LEVEL_MESSAGE, "G_LOG_LEVEL_MESSAGE", "level-message" },
+ { G_LOG_LEVEL_INFO, "G_LOG_LEVEL_INFO", "level-info" },
+ { G_LOG_LEVEL_DEBUG, "G_LOG_LEVEL_DEBUG", "level-debug" },
+ { G_LOG_LEVEL_MASK, "G_LOG_LEVEL_MASK", "level-mask" },
+ { 0, NULL, NULL }
+ };
+ etype = g_flags_register_static ("GLogLevelFlags", values);
+ }
+ return etype;
+}
+
+
+/* enumerations from "/usr/include/glib-2.0/glib/gchecksum.h" */
+GType
+g_checksum_type_get_type (void)
+{
+ static GType etype = 0;
+ if (etype == 0) {
+ static const GEnumValue values[] = {
+ { G_CHECKSUM_MD5, "G_CHECKSUM_MD5", "md5" },
+ { G_CHECKSUM_SHA1, "G_CHECKSUM_SHA1", "sha1" },
+ { G_CHECKSUM_SHA256, "G_CHECKSUM_SHA256", "sha256" },
+ { G_CHECKSUM_SHA512, "G_CHECKSUM_SHA512", "sha512" },
+ { 0, NULL, NULL }
+ };
+ etype = g_enum_register_static ("GChecksumType", values);
+ }
+ return etype;
+}
+
+
+/* enumerations from "/usr/include/glib-2.0/glib/gutils.h" */
+GType
+g_user_directory_get_type (void)
+{
+ static GType etype = 0;
+ if (etype == 0) {
+ static const GEnumValue values[] = {
+ { G_USER_DIRECTORY_DESKTOP, "G_USER_DIRECTORY_DESKTOP", "directory-desktop" },
+ { G_USER_DIRECTORY_DOCUMENTS, "G_USER_DIRECTORY_DOCUMENTS", "directory-documents" },
+ { G_USER_DIRECTORY_DOWNLOAD, "G_USER_DIRECTORY_DOWNLOAD", "directory-download" },
+ { G_USER_DIRECTORY_MUSIC, "G_USER_DIRECTORY_MUSIC", "directory-music" },
+ { G_USER_DIRECTORY_PICTURES, "G_USER_DIRECTORY_PICTURES", "directory-pictures" },
+ { G_USER_DIRECTORY_PUBLIC_SHARE, "G_USER_DIRECTORY_PUBLIC_SHARE", "directory-public-share" },
+ { G_USER_DIRECTORY_TEMPLATES, "G_USER_DIRECTORY_TEMPLATES", "directory-templates" },
+ { G_USER_DIRECTORY_VIDEOS, "G_USER_DIRECTORY_VIDEOS", "directory-videos" },
+ { G_USER_N_DIRECTORIES, "G_USER_N_DIRECTORIES", "n-directories" },
+ { 0, NULL, NULL }
+ };
+ etype = g_enum_register_static ("GUserDirectory", values);
+ }
+ return etype;
+}
+
+GType
+g_format_size_flags_get_type (void)
+{
+ static GType etype = 0;
+ if (etype == 0) {
+ static const GFlagsValue values[] = {
+ { G_FORMAT_SIZE_DEFAULT, "G_FORMAT_SIZE_DEFAULT", "default" },
+ { G_FORMAT_SIZE_LONG_FORMAT, "G_FORMAT_SIZE_LONG_FORMAT", "long-format" },
+ { G_FORMAT_SIZE_IEC_UNITS, "G_FORMAT_SIZE_IEC_UNITS", "iec-units" },
+ { 0, NULL, NULL }
+ };
+ etype = g_flags_register_static ("GFormatSizeFlags", values);
+ }
+ return etype;
+}
+
+
+/* enumerations from "/usr/include/glib-2.0/glib/goption.h" */
+GType
+g_option_flags_get_type (void)
+{
+ static GType etype = 0;
+ if (etype == 0) {
+ static const GFlagsValue values[] = {
+ { G_OPTION_FLAG_NONE, "G_OPTION_FLAG_NONE", "none" },
+ { G_OPTION_FLAG_HIDDEN, "G_OPTION_FLAG_HIDDEN", "hidden" },
+ { G_OPTION_FLAG_IN_MAIN, "G_OPTION_FLAG_IN_MAIN", "in-main" },
+ { G_OPTION_FLAG_REVERSE, "G_OPTION_FLAG_REVERSE", "reverse" },
+ { G_OPTION_FLAG_NO_ARG, "G_OPTION_FLAG_NO_ARG", "no-arg" },
+ { G_OPTION_FLAG_FILENAME, "G_OPTION_FLAG_FILENAME", "filename" },
+ { G_OPTION_FLAG_OPTIONAL_ARG, "G_OPTION_FLAG_OPTIONAL_ARG", "optional-arg" },
+ { G_OPTION_FLAG_NOALIAS, "G_OPTION_FLAG_NOALIAS", "noalias" },
+ { 0, NULL, NULL }
+ };
+ etype = g_flags_register_static ("GOptionFlags", values);
+ }
+ return etype;
+}
+
+GType
+g_option_arg_get_type (void)
+{
+ static GType etype = 0;
+ if (etype == 0) {
+ static const GEnumValue values[] = {
+ { G_OPTION_ARG_NONE, "G_OPTION_ARG_NONE", "none" },
+ { G_OPTION_ARG_STRING, "G_OPTION_ARG_STRING", "string" },
+ { G_OPTION_ARG_INT, "G_OPTION_ARG_INT", "int" },
+ { G_OPTION_ARG_CALLBACK, "G_OPTION_ARG_CALLBACK", "callback" },
+ { G_OPTION_ARG_FILENAME, "G_OPTION_ARG_FILENAME", "filename" },
+ { G_OPTION_ARG_STRING_ARRAY, "G_OPTION_ARG_STRING_ARRAY", "string-array" },
+ { G_OPTION_ARG_FILENAME_ARRAY, "G_OPTION_ARG_FILENAME_ARRAY", "filename-array" },
+ { G_OPTION_ARG_DOUBLE, "G_OPTION_ARG_DOUBLE", "double" },
+ { G_OPTION_ARG_INT64, "G_OPTION_ARG_INT64", "int64" },
+ { 0, NULL, NULL }
+ };
+ etype = g_enum_register_static ("GOptionArg", values);
+ }
+ return etype;
+}
+
+GType
+g_option_error_get_type (void)
+{
+ static GType etype = 0;
+ if (etype == 0) {
+ static const GEnumValue values[] = {
+ { G_OPTION_ERROR_UNKNOWN_OPTION, "G_OPTION_ERROR_UNKNOWN_OPTION", "unknown-option" },
+ { G_OPTION_ERROR_BAD_VALUE, "G_OPTION_ERROR_BAD_VALUE", "bad-value" },
+ { G_OPTION_ERROR_FAILED, "G_OPTION_ERROR_FAILED", "failed" },
+ { 0, NULL, NULL }
+ };
+ etype = g_enum_register_static ("GOptionError", values);
+ }
+ return etype;
+}
+
+
+/* enumerations from "/usr/include/glib-2.0/glib/gconvert.h" */
+GType
+g_convert_error_get_type (void)
+{
+ static GType etype = 0;
+ if (etype == 0) {
+ static const GEnumValue values[] = {
+ { G_CONVERT_ERROR_NO_CONVERSION, "G_CONVERT_ERROR_NO_CONVERSION", "no-conversion" },
+ { G_CONVERT_ERROR_ILLEGAL_SEQUENCE, "G_CONVERT_ERROR_ILLEGAL_SEQUENCE", "illegal-sequence" },
+ { G_CONVERT_ERROR_FAILED, "G_CONVERT_ERROR_FAILED", "failed" },
+ { G_CONVERT_ERROR_PARTIAL_INPUT, "G_CONVERT_ERROR_PARTIAL_INPUT", "partial-input" },
+ { G_CONVERT_ERROR_BAD_URI, "G_CONVERT_ERROR_BAD_URI", "bad-uri" },
+ { G_CONVERT_ERROR_NOT_ABSOLUTE_PATH, "G_CONVERT_ERROR_NOT_ABSOLUTE_PATH", "not-absolute-path" },
+ { G_CONVERT_ERROR_NO_MEMORY, "G_CONVERT_ERROR_NO_MEMORY", "no-memory" },
+ { 0, NULL, NULL }
+ };
+ etype = g_enum_register_static ("GConvertError", values);
+ }
+ return etype;
+}
+
+
+/* enumerations from "/usr/include/glib-2.0/glib/gbookmarkfile.h" */
+GType
+g_bookmark_file_error_get_type (void)
+{
+ static GType etype = 0;
+ if (etype == 0) {
+ static const GEnumValue values[] = {
+ { G_BOOKMARK_FILE_ERROR_INVALID_URI, "G_BOOKMARK_FILE_ERROR_INVALID_URI", "invalid-uri" },
+ { G_BOOKMARK_FILE_ERROR_INVALID_VALUE, "G_BOOKMARK_FILE_ERROR_INVALID_VALUE", "invalid-value" },
+ { G_BOOKMARK_FILE_ERROR_APP_NOT_REGISTERED, "G_BOOKMARK_FILE_ERROR_APP_NOT_REGISTERED", "app-not-registered" },
+ { G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND, "G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND", "uri-not-found" },
+ { G_BOOKMARK_FILE_ERROR_READ, "G_BOOKMARK_FILE_ERROR_READ", "read" },
+ { G_BOOKMARK_FILE_ERROR_UNKNOWN_ENCODING, "G_BOOKMARK_FILE_ERROR_UNKNOWN_ENCODING", "unknown-encoding" },
+ { G_BOOKMARK_FILE_ERROR_WRITE, "G_BOOKMARK_FILE_ERROR_WRITE", "write" },
+ { G_BOOKMARK_FILE_ERROR_FILE_NOT_FOUND, "G_BOOKMARK_FILE_ERROR_FILE_NOT_FOUND", "file-not-found" },
+ { 0, NULL, NULL }
+ };
+ etype = g_enum_register_static ("GBookmarkFileError", values);
+ }
+ return etype;
+}
+
+
+/* enumerations from "/usr/include/glib-2.0/gobject/gsignal.h" */
+GType
+g_signal_flags_get_type (void)
+{
+ static GType etype = 0;
+ if (etype == 0) {
+ static const GFlagsValue values[] = {
+ { G_SIGNAL_RUN_FIRST, "G_SIGNAL_RUN_FIRST", "run-first" },
+ { G_SIGNAL_RUN_LAST, "G_SIGNAL_RUN_LAST", "run-last" },
+ { G_SIGNAL_RUN_CLEANUP, "G_SIGNAL_RUN_CLEANUP", "run-cleanup" },
+ { G_SIGNAL_NO_RECURSE, "G_SIGNAL_NO_RECURSE", "no-recurse" },
+ { G_SIGNAL_DETAILED, "G_SIGNAL_DETAILED", "detailed" },
+ { G_SIGNAL_ACTION, "G_SIGNAL_ACTION", "action" },
+ { G_SIGNAL_NO_HOOKS, "G_SIGNAL_NO_HOOKS", "no-hooks" },
+ { G_SIGNAL_MUST_COLLECT, "G_SIGNAL_MUST_COLLECT", "must-collect" },
+ { G_SIGNAL_DEPRECATED, "G_SIGNAL_DEPRECATED", "deprecated" },
+ { 0, NULL, NULL }
+ };
+ etype = g_flags_register_static ("GSignalFlags", values);
+ }
+ return etype;
+}
+
+GType
+g_connect_flags_get_type (void)
+{
+ static GType etype = 0;
+ if (etype == 0) {
+ static const GFlagsValue values[] = {
+ { G_CONNECT_AFTER, "G_CONNECT_AFTER", "after" },
+ { G_CONNECT_SWAPPED, "G_CONNECT_SWAPPED", "swapped" },
+ { 0, NULL, NULL }
+ };
+ etype = g_flags_register_static ("GConnectFlags", values);
+ }
+ return etype;
+}
+
+GType
+g_signal_match_type_get_type (void)
+{
+ static GType etype = 0;
+ if (etype == 0) {
+ static const GFlagsValue values[] = {
+ { G_SIGNAL_MATCH_ID, "G_SIGNAL_MATCH_ID", "id" },
+ { G_SIGNAL_MATCH_DETAIL, "G_SIGNAL_MATCH_DETAIL", "detail" },
+ { G_SIGNAL_MATCH_CLOSURE, "G_SIGNAL_MATCH_CLOSURE", "closure" },
+ { G_SIGNAL_MATCH_FUNC, "G_SIGNAL_MATCH_FUNC", "func" },
+ { G_SIGNAL_MATCH_DATA, "G_SIGNAL_MATCH_DATA", "data" },
+ { G_SIGNAL_MATCH_UNBLOCKED, "G_SIGNAL_MATCH_UNBLOCKED", "unblocked" },
+ { 0, NULL, NULL }
+ };
+ etype = g_flags_register_static ("GSignalMatchType", values);
+ }
+ return etype;
+}
+
+
+/* Generated data ends here */
+
diff --git a/glib2/ext/glib2/glib-enum-types.h b/glib2/ext/glib2/glib-enum-types.h
new file mode 100644
index 0000000..bacd0c0
--- /dev/null
+++ b/glib2/ext/glib2/glib-enum-types.h
@@ -0,0 +1,154 @@
+
+/* Generated by glib-mkenums.rb ($Id$) */
+
+#ifndef __GLIB_ENUM_TYPES_H__
+#define __GLIB_ENUM_TYPES_H__
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+/* enumerations from "/usr/include/glib-2.0/glib/gvariant.h" */
+GType g_variant_class_get_type (void);
+#define G_TYPE_VARIANT_CLASS (g_variant_class_get_type())
+GType g_variant_parse_error_get_type (void);
+#define G_TYPE_VARIANT_PARSE_ERROR (g_variant_parse_error_get_type())
+
+/* enumerations from "/usr/include/glib-2.0/glib/gspawn.h" */
+GType g_spawn_error_get_type (void);
+#define G_TYPE_SPAWN_ERROR (g_spawn_error_get_type())
+GType g_spawn_flags_get_type (void);
+#define G_TYPE_SPAWN_FLAGS (g_spawn_flags_get_type())
+
+/* enumerations from "/usr/include/glib-2.0/glib/gkeyfile.h" */
+GType g_key_file_error_get_type (void);
+#define G_TYPE_KEY_FILE_ERROR (g_key_file_error_get_type())
+GType g_key_file_flags_get_type (void);
+#define G_TYPE_KEY_FILE_FLAGS (g_key_file_flags_get_type())
+
+/* enumerations from "/usr/include/glib-2.0/glib/gnode.h" */
+GType g_traverse_flags_get_type (void);
+#define G_TYPE_TRAVERSE_FLAGS (g_traverse_flags_get_type())
+GType g_traverse_type_get_type (void);
+#define G_TYPE_TRAVERSE_TYPE (g_traverse_type_get_type())
+
+/* enumerations from "/usr/include/glib-2.0/glib/gshell.h" */
+GType g_shell_error_get_type (void);
+#define G_TYPE_SHELL_ERROR (g_shell_error_get_type())
+
+/* enumerations from "/usr/include/glib-2.0/glib/gslice.h" */
+GType g_slice_config_get_type (void);
+#define G_TYPE_SLICE_CONFIG (g_slice_config_get_type())
+
+/* enumerations from "/usr/include/glib-2.0/glib/gregex.h" */
+GType g_regex_error_get_type (void);
+#define G_TYPE_REGEX_ERROR (g_regex_error_get_type())
+GType g_regex_compile_flags_get_type (void);
+#define G_TYPE_REGEX_COMPILE_FLAGS (g_regex_compile_flags_get_type())
+GType g_regex_match_flags_get_type (void);
+#define G_TYPE_REGEX_MATCH_FLAGS (g_regex_match_flags_get_type())
+
+/* enumerations from "/usr/include/glib-2.0/glib/gmarkup.h" */
+GType g_markup_error_get_type (void);
+#define G_TYPE_MARKUP_ERROR (g_markup_error_get_type())
+GType g_markup_parse_flags_get_type (void);
+#define G_TYPE_MARKUP_PARSE_FLAGS (g_markup_parse_flags_get_type())
+GType g_markup_collect_type_get_type (void);
+#define G_TYPE_MARKUP_COLLECT_TYPE (g_markup_collect_type_get_type())
+
+/* enumerations from "/usr/include/glib-2.0/glib/gtestutils.h" */
+GType g_test_trap_flags_get_type (void);
+#define G_TYPE_TEST_TRAP_FLAGS (g_test_trap_flags_get_type())
+GType g_test_subprocess_flags_get_type (void);
+#define G_TYPE_TEST_SUBPROCESS_FLAGS (g_test_subprocess_flags_get_type())
+GType g_test_log_type_get_type (void);
+#define G_TYPE_TEST_LOG_TYPE (g_test_log_type_get_type())
+GType g_test_file_type_get_type (void);
+#define G_TYPE_TEST_FILE_TYPE (g_test_file_type_get_type())
+
+/* enumerations from "/usr/include/glib-2.0/glib/gfileutils.h" */
+GType g_file_error_get_type (void);
+#define G_TYPE_FILE_ERROR (g_file_error_get_type())
+GType g_file_test_get_type (void);
+#define G_TYPE_FILE_TEST (g_file_test_get_type())
+
+/* enumerations from "/usr/include/glib-2.0/glib/gtimezone.h" */
+GType g_time_type_get_type (void);
+#define G_TYPE_TIME_TYPE (g_time_type_get_type())
+
+/* enumerations from "/usr/include/glib-2.0/glib/gdate.h" */
+GType g_date_dm_y_get_type (void);
+#define G_TYPE_DATE_DM_Y (g_date_dm_y_get_type())
+GType g_date_weekday_get_type (void);
+#define G_TYPE_DATE_WEEKDAY (g_date_weekday_get_type())
+GType g_date_month_get_type (void);
+#define G_TYPE_DATE_MONTH (g_date_month_get_type())
+
+/* enumerations from "/usr/include/glib-2.0/glib/gunicode.h" */
+GType g_unicode_type_get_type (void);
+#define G_TYPE_UNICODE_TYPE (g_unicode_type_get_type())
+GType g_unicode_break_type_get_type (void);
+#define G_TYPE_UNICODE_BREAK_TYPE (g_unicode_break_type_get_type())
+GType g_unicode_script_get_type (void);
+#define G_TYPE_UNICODE_SCRIPT (g_unicode_script_get_type())
+GType g_normalize_mode_get_type (void);
+#define G_TYPE_NORMALIZE_MODE (g_normalize_mode_get_type())
+
+/* enumerations from "/usr/include/glib-2.0/glib/ghook.h" */
+GType g_hook_flag_mask_get_type (void);
+#define G_TYPE_HOOK_FLAG_MASK (g_hook_flag_mask_get_type())
+
+/* enumerations from "/usr/include/glib-2.0/glib/gthread.h" */
+GType g_thread_error_get_type (void);
+#define G_TYPE_THREAD_ERROR (g_thread_error_get_type())
+GType g_once_status_get_type (void);
+#define G_TYPE_ONCE_STATUS (g_once_status_get_type())
+
+/* enumerations from "/usr/include/glib-2.0/glib/gstrfuncs.h" */
+GType g_ascii_type_get_type (void);
+#define G_TYPE_ASCII_TYPE (g_ascii_type_get_type())
+
+/* enumerations from "/usr/include/glib-2.0/glib/gmessages.h" */
+GType g_log_level_flags_get_type (void);
+#define G_TYPE_LOG_LEVEL_FLAGS (g_log_level_flags_get_type())
+
+/* enumerations from "/usr/include/glib-2.0/glib/gchecksum.h" */
+GType g_checksum_type_get_type (void);
+#define G_TYPE_CHECKSUM_TYPE (g_checksum_type_get_type())
+
+/* enumerations from "/usr/include/glib-2.0/glib/gutils.h" */
+GType g_user_directory_get_type (void);
+#define G_TYPE_USER_DIRECTORY (g_user_directory_get_type())
+GType g_format_size_flags_get_type (void);
+#define G_TYPE_FORMAT_SIZE_FLAGS (g_format_size_flags_get_type())
+
+/* enumerations from "/usr/include/glib-2.0/glib/goption.h" */
+GType g_option_flags_get_type (void);
+#define G_TYPE_OPTION_FLAGS (g_option_flags_get_type())
+GType g_option_arg_get_type (void);
+#define G_TYPE_OPTION_ARG (g_option_arg_get_type())
+GType g_option_error_get_type (void);
+#define G_TYPE_OPTION_ERROR (g_option_error_get_type())
+
+/* enumerations from "/usr/include/glib-2.0/glib/gconvert.h" */
+GType g_convert_error_get_type (void);
+#define G_TYPE_CONVERT_ERROR (g_convert_error_get_type())
+
+/* enumerations from "/usr/include/glib-2.0/glib/gbookmarkfile.h" */
+GType g_bookmark_file_error_get_type (void);
+#define G_TYPE_BOOKMARK_FILE_ERROR (g_bookmark_file_error_get_type())
+
+/* enumerations from "/usr/include/glib-2.0/gobject/gsignal.h" */
+GType g_signal_flags_get_type (void);
+#define G_TYPE_SIGNAL_FLAGS (g_signal_flags_get_type())
+GType g_connect_flags_get_type (void);
+#define G_TYPE_CONNECT_FLAGS (g_connect_flags_get_type())
+GType g_signal_match_type_get_type (void);
+#define G_TYPE_SIGNAL_MATCH_TYPE (g_signal_match_type_get_type())
+
+G_END_DECLS
+
+#endif /* __GLIB_ENUM_TYPES_H__ */
+
+/* Generated data ends here */
+
diff --git a/glib2/ext/glib2/glib2.def b/glib2/ext/glib2/glib2.def
index c2f834c..4c9660c 100644
--- a/glib2/ext/glib2/glib2.def
+++ b/glib2/ext/glib2/glib2.def
@@ -108,6 +108,8 @@ EXPORTS
rbg_check_array_type
rbg_check_hash_type
rbg_scan_options
+ rbg_inspect
+ rbg_interrupt_source_new
rbgutil_id_module_eval DATA
rbgutil_def_setters
rbgutil_glist2ary
diff --git a/glib2/ext/glib2/rbglib.c b/glib2/ext/glib2/rbglib.c
index 02a0d7c..5cfc3a3 100644
--- a/glib2/ext/glib2/rbglib.c
+++ b/glib2/ext/glib2/rbglib.c
@@ -912,14 +912,14 @@ So they occur "cross-thread violation".
static gpointer
my_malloc(gsize n_bytes)
{
- /* Should we rescue NoMemoryError? */
+ /* Should we rescue NoMemoryError? */
return ruby_xmalloc(n_bytes);
}
static gpointer
my_realloc(gpointer mem, gsize n_bytes)
{
- /* Should we rescue NoMemoryError? */
+ /* Should we rescue NoMemoryError? */
return ruby_xrealloc(mem, n_bytes);
}
diff --git a/glib2/ext/glib2/rbglib.h b/glib2/ext/glib2/rbglib.h
index 16b6eda..d822663 100644
--- a/glib2/ext/glib2/rbglib.h
+++ b/glib2/ext/glib2/rbglib.h
@@ -36,7 +36,7 @@ extern "C" {
#define RBGLIB_MAJOR_VERSION 2
#define RBGLIB_MINOR_VERSION 2
-#define RBGLIB_MICRO_VERSION 0
+#define RBGLIB_MICRO_VERSION 5
#ifndef RSTRING_PTR
# define RSTRING_PTR(s) (RSTRING(s)->ptr)
diff --git a/glib2/ext/glib2/rbglib2conversions.h b/glib2/ext/glib2/rbglib2conversions.h
index 3922dec..94f0605 100644
--- a/glib2/ext/glib2/rbglib2conversions.h
+++ b/glib2/ext/glib2/rbglib2conversions.h
@@ -52,4 +52,6 @@
#define RVAL2GKEYFILEFLAGS(o) (RVAL2GFLAGS(o, G_TYPE_KEY_FILE_FLAGS))
#define GKEYFILEFLAGS2RVAL(o) (GFLAGS2RVAL(o, G_TYPE_KEY_FILE_FLAGS))
+#define RVAL2GFORMATSIZEFLAGS(o) (RVAL2GFLAGS(o, G_TYPE_FORMAT_SIZE_FLAGS))
+#define GFORMATSIZEFLAGS2RVAL(o) (GFLAGS2RVAL(o, G_TYPE_FORMAT_SIZE_FLAGS))
#endif /* __GLIB2CONVERSIONS_H__ */
diff --git a/glib2/ext/glib2/rbglib_fileutils.c b/glib2/ext/glib2/rbglib_fileutils.c
index 1b5c279..a583f6e 100644
--- a/glib2/ext/glib2/rbglib_fileutils.c
+++ b/glib2/ext/glib2/rbglib_fileutils.c
@@ -57,6 +57,27 @@ rbglib_m_format_size_for_display(G_GNUC_UNUSED VALUE self, VALUE size)
}
#endif
+#if GLIB_CHECK_VERSION(2, 30, 0)
+static VALUE
+rbglib_m_format_size(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
+{
+ VALUE rb_size, rb_options;
+
+ rb_scan_args(argc, argv, "11", &rb_size, &rb_options);
+ if (NIL_P(rb_options)) {
+ return CSTR2RVAL_FREE(g_format_size(NUM2UINT(rb_size)));
+ } else {
+ VALUE rb_flags;
+ rbg_scan_options(rb_options,
+ "flags", &rb_flags,
+ NULL);
+
+ return CSTR2RVAL_FREE(g_format_size_full(NUM2UINT(rb_size),
+ RVAL2GFORMATSIZEFLAGS(rb_flags)));
+ }
+}
+#endif
+
void
Init_glib_fileutils(void)
{
@@ -91,4 +112,8 @@ Init_glib_fileutils(void)
rbg_define_singleton_method(mGLib, "format_size_for_display",
rbglib_m_format_size_for_display, 1);
#endif
+#if GLIB_CHECK_VERSION(2, 30, 0)
+ rbg_define_singleton_method(mGLib, "format_size",
+ rbglib_m_format_size, -1);
+#endif
}
diff --git a/glib2/ext/glib2/rbglib_maincontext.c b/glib2/ext/glib2/rbglib_maincontext.c
index 3a8817f..246f03b 100644
--- a/glib2/ext/glib2/rbglib_maincontext.c
+++ b/glib2/ext/glib2/rbglib_maincontext.c
@@ -1,6 +1,6 @@
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
/*
- * Copyright (C) 2011 Ruby-GNOME2 Project Team
+ * Copyright (C) 2011-2014 Ruby-GNOME2 Project Team
* Copyright (C) 2005 Masao Mutoh
*
* This library is free software; you can redistribute it and/or
@@ -21,16 +21,6 @@
#include "rbgprivate.h"
-#ifndef HAVE_RB_THREAD_BLOCKING_REGION
-# include <version.h>
-# include <rubysig.h>
-# include <node.h>
-# include <time.h>
-# ifdef HAVE_CURR_THREAD
-# define rb_curr_thread curr_thread
-# endif
-#endif
-
GStaticPrivate rg_polling_key = G_STATIC_PRIVATE_INIT;
/*
@@ -51,13 +41,6 @@ typedef struct _callback_info_t
/*****************************************/
static GPollFunc default_poll_func;
-#ifdef HAVE_RB_THREAD_BLOCKING_REGION
-
-/* just for ruby-1.9.0. */
-#if !defined(RUBY_UBF_IO) && defined(RB_UBF_DFL)
-# define RUBY_UBF_IO RB_UBF_DFL
-#endif
-
typedef struct _PollInfo
{
GPollFD *ufds;
@@ -87,7 +70,11 @@ rg_poll(GPollFD *ufds, guint nfsd, gint timeout)
info.result = 0;
g_static_private_set(&rg_polling_key, GINT_TO_POINTER(TRUE), NULL);
+#ifdef HAVE_RB_THREAD_CALL_WITHOUT_GVL
+ rb_thread_call_without_gvl(rg_poll_in_blocking, &info, RUBY_UBF_IO, NULL);
+#else
rb_thread_blocking_region(rg_poll_in_blocking, &info, RUBY_UBF_IO, NULL);
+#endif
g_static_private_set(&rg_polling_key, GINT_TO_POINTER(FALSE), NULL);
return info.result;
@@ -99,20 +86,6 @@ ruby_source_set_priority (G_GNUC_UNUSED VALUE self, G_GNUC_UNUSED VALUE priority
return Qnil;
}
-#else
-static gint
-rg_poll(GPollFD *ufds, guint nfsd, gint timeout)
-{
- gint result;
-
- TRAP_BEG;
- result = default_poll_func(ufds, nfsd, timeout);
- TRAP_END;
-
- return result;
-}
-#endif
-
static void
restore_poll_func(G_GNUC_UNUSED VALUE data)
{
@@ -121,294 +94,6 @@ restore_poll_func(G_GNUC_UNUSED VALUE data)
}
}
-#ifndef HAVE_RB_THREAD_BLOCKING_REGION
-static guint ruby_source_id = 0;
-
-/* from eval.c */
-#define WAIT_FD (1<<0)
-#define WAIT_SELECT (1<<1)
-#define WAIT_TIME (1<<2)
-#define WAIT_JOIN (1<<3)
-#define WAIT_PID (1<<4)
-
-#define DELAY_INFTY 1E30
-
-#ifdef RUBY_RELEASE_YEAR
-# define CHECK_RUBY_RELEASE_DATE(year, month, day) \
- (RUBY_RELEASE_YEAR >= (year) && \
- RUBY_RELEASE_MONTH >= (month) && \
- RUBY_RELEASE_DAY >= (day))
-#else
-# define CHECK_RUBY_RELEASE_DATE(year, month, day) 0
-#endif
-
-static double
-timeofday(void)
-{
- struct timeval tv;
-#if CHECK_RUBY_RELEASE_DATE(2009, 1, 7)
-/* The following CLOCK_MONOTONIC change was introduced into
- * Ruby 1.8.6 and 1.8.7 at 2009-01-07.
- *
- * 1.8.6:
- * Wed Jan 7 10:06:12 2009 Nobuyoshi Nakada <nobu at ruby-lang.org>
- *
- * * eval.c (timeofday): use monotonic clock. based on a patch
- * from zimbatm <zimbatm at oree.ch> in [ruby-core:16627].
- *
- * 1.8.7:
- * Wed Jan 7 10:09:46 2009 Nobuyoshi Nakada <nobu at ruby-lang.org>
- *
- * * eval.c (timeofday): use monotonic clock. based on a patch
- * from zimbatm <zimbatm at oree.ch> in [ruby-core:16627].
- */
-# ifdef CLOCK_MONOTONIC
- struct timespec tp;
-
- if (clock_gettime(CLOCK_MONOTONIC, &tp) == 0) {
- return (double)tp.tv_sec + (double)tp.tv_nsec * 1e-9;
- }
-# endif
-#endif
- gettimeofday(&tv, NULL);
- return (double)tv.tv_sec + (double)tv.tv_usec * 1e-6;
-}
-
-/*****************************************/
-typedef struct _RGSource
-{
- GSource source;
-
- GList *poll_fds;
- GList *old_poll_fds;
- gboolean ready;
-} RGSource;
-
-static void
-source_cleanup_poll_fds(GSource *source)
-{
- RGSource *rg_source = (RGSource *)source;
- GList *node;
-
- for (node = rg_source->old_poll_fds; node; node = g_list_next(node)) {
- GPollFD *poll_fd = node->data;
-
- g_source_remove_poll(source, poll_fd);
- g_slice_free(GPollFD, poll_fd);
- }
- g_list_free(rg_source->old_poll_fds);
- rg_source->old_poll_fds = NULL;
-}
-
-static inline void
-source_prepare_add_poll_fd(GSource *source, gint fd, guchar events)
-{
- GPollFD *poll_fd;
- GList *node;
- RGSource *rg_source = (RGSource *)source;
-
- for (node = rg_source->old_poll_fds; node; node = g_list_next(node)) {
- poll_fd = node->data;
- if (poll_fd->fd == fd && poll_fd->events == events) {
- rg_source->old_poll_fds =
- g_list_remove_link(rg_source->old_poll_fds, node);
- rg_source->poll_fds = g_list_concat(rg_source->poll_fds, node);
- return;
- }
- }
-
- poll_fd = g_slice_new0(GPollFD);
- poll_fd->fd = fd;
- poll_fd->events = events;
-
- g_source_add_poll(source, poll_fd);
- rg_source->poll_fds = g_list_prepend(rg_source->poll_fds, poll_fd);
-}
-
-static inline void
-source_prepare_add_poll(GSource *source, rb_thread_t thread)
-{
- if (thread->wait_for == WAIT_FD) {
- /* The thread is blocked on thread->fd for read. */
- source_prepare_add_poll_fd(source, thread->fd, G_IO_IN);
- return;
- }
-
- if (thread->wait_for & WAIT_SELECT) {
- /* thread->fd is the maximum fd of the fds in the various sets. Need to
- * check the sets to see which fd's to wait for */
- int fd;
-
- for (fd = 0; fd < thread->fd; fd++) {
- gushort events = 0;
-
- if (FD_ISSET(fd, &thread->readfds))
- events |= G_IO_IN;
- if (FD_ISSET(fd, &thread->writefds))
- events |= G_IO_OUT;
- if (FD_ISSET(fd, &thread->exceptfds))
- events |= G_IO_PRI | G_IO_ERR | G_IO_HUP;
-
- if (events != 0)
- source_prepare_add_poll_fd(source, fd, events);
- }
- }
-}
-
-static inline gboolean
-source_prepare_setup_poll_fd(GSource *source, gint *timeout)
-{
- RGSource *rg_source = (RGSource *)source;
- rb_thread_t thread;
- gdouble now;
-
- g_assert(rg_source->old_poll_fds == NULL);
- rg_source->old_poll_fds = rg_source->poll_fds;
- rg_source->poll_fds = NULL;
-
- now = timeofday();
- thread = rb_curr_thread;
- do {
- thread = thread->next;
-
- if ((thread->wait_for == 0 && thread->status == THREAD_RUNNABLE &&
- thread != rb_curr_thread) ||
- (thread->wait_for & WAIT_JOIN &&
- thread->join->status == THREAD_KILLED)) {
- rg_source->poll_fds = g_list_concat(rg_source->poll_fds,
- rg_source->old_poll_fds);
- rg_source->old_poll_fds = NULL;
- return TRUE;
- }
-
- if (thread->wait_for & WAIT_TIME && thread->delay != DELAY_INFTY) {
- gint delay;
-
- delay = (thread->delay - now) * 1000;
- if (delay <= 0) {
- rg_source->poll_fds = g_list_concat(rg_source->poll_fds,
- rg_source->old_poll_fds);
- rg_source->old_poll_fds = NULL;
- return TRUE;
- }
- if (*timeout == -1 || delay < *timeout)
- *timeout = delay;
- }
-
- if (thread->wait_for == WAIT_FD || thread->wait_for & WAIT_SELECT)
- source_prepare_add_poll(source, thread);
- } while (thread != rb_curr_thread);
-
- source_cleanup_poll_fds(source);
-
- return FALSE;
-}
-
-static gboolean
-source_prepare(GSource *source, gint *timeout)
-{
- RGSource *rg_source = (RGSource *)source;
-
- *timeout = -1;
- rg_source->ready = source_prepare_setup_poll_fd(source, timeout);
-
- return rg_source->ready;
-}
-
-static gboolean
-source_check(GSource *source)
-{
- RGSource *rg_source = (RGSource *)source;
- GList *node;
-
- if (rg_source->ready)
- return TRUE;
-
- for (node = rg_source->poll_fds; node; node = g_list_next(node)) {
- GPollFD *poll_fd = node->data;
-
- if (poll_fd->revents)
- return TRUE;
- }
-
- return FALSE;
-}
-
-static gboolean
-source_dispatch(G_GNUC_UNUSED GSource *source,
- G_GNUC_UNUSED GSourceFunc callback,
- G_GNUC_UNUSED gpointer user_data)
-{
- TRAP_BEG;
- rb_thread_schedule();
- TRAP_END;
-
- return TRUE;
-}
-
-static void
-source_finalize(GSource *source)
-{
- RGSource *rg_source = (RGSource *)source;
- GList *node;
-
- for (node = rg_source->old_poll_fds; node; node = g_list_next(node)) {
- GPollFD *poll_fd = node->data;
- g_slice_free(GPollFD, poll_fd);
- }
-
- for (node = rg_source->poll_fds; node; node = g_list_next(node)) {
- GPollFD *poll_fd = node->data;
- g_slice_free(GPollFD, poll_fd);
- }
-
- g_list_free(rg_source->old_poll_fds);
- rg_source->old_poll_fds = NULL;
-
- g_list_free(rg_source->poll_fds);
- rg_source->poll_fds = NULL;
-}
-
-static GSourceFuncs source_funcs = {
- source_prepare,
- source_check,
- source_dispatch,
- source_finalize,
- NULL,
- NULL
-};
-
-static GSource *
-ruby_source_new(void)
-{
- GSource *source;
- RGSource *rg_source;
-
- source = g_source_new(&source_funcs, sizeof(RGSource));
- g_source_set_can_recurse(source, TRUE);
-
- rg_source = (RGSource *)source;
- rg_source->poll_fds = NULL;
- rg_source->old_poll_fds = NULL;
-
- return source;
-}
-
-static VALUE
-ruby_source_set_priority(G_GNUC_UNUSED VALUE self, VALUE priority)
-{
- GSource *ruby_source = NULL;
-
- if (ruby_source_id != 0)
- ruby_source = g_main_context_find_source_by_id(NULL, ruby_source_id);
-
- if (ruby_source)
- g_source_set_priority(ruby_source, NUM2INT(priority));
-
- return Qnil;
-}
-#endif
-
static VALUE
source_remove(G_GNUC_UNUSED VALUE self, VALUE tag)
{
@@ -463,14 +148,6 @@ rg_initialize(VALUE self)
context = g_main_context_new();
g_main_context_set_poll_func(context, rg_poll);
-#ifndef HAVE_RB_THREAD_BLOCKING_REGION
- {
- GSource *source;
- source = ruby_source_new();
- g_source_attach(source, context);
- g_source_unref(source);
- }
-#endif
G_INITIALIZE(self, context);
return Qnil;
@@ -822,17 +499,6 @@ child_watch_add(VALUE self, VALUE pid)
(GChildWatchFunc)child_watch_func, (gpointer)func));
}
-#ifndef HAVE_RB_THREAD_BLOCKING_REGION
-static void
-ruby_source_remove(G_GNUC_UNUSED VALUE data)
-{
- if (ruby_source_id != 0) {
- g_source_remove(ruby_source_id);
- ruby_source_id = 0;
- }
-}
-#endif
-
void
Init_glib_main_context(void)
{
@@ -896,16 +562,4 @@ Init_glib_main_context(void)
default_poll_func = g_main_context_get_poll_func(NULL);
g_main_context_set_poll_func(NULL, rg_poll);
rb_set_end_proc(restore_poll_func, Qnil);
-
-#ifndef HAVE_RB_THREAD_BLOCKING_REGION
- {
- GSource *source;
-
- source = ruby_source_new();
- g_source_set_priority(source, G_PRIORITY_DEFAULT_IDLE);
- ruby_source_id = g_source_attach(source, NULL);
- g_source_unref(source);
- rb_set_end_proc(ruby_source_remove, Qnil);
- }
-#endif
}
diff --git a/glib2/ext/glib2/rbglib_mainloop.c b/glib2/ext/glib2/rbglib_mainloop.c
index bafba14..50c90b0 100644
--- a/glib2/ext/glib2/rbglib_mainloop.c
+++ b/glib2/ext/glib2/rbglib_mainloop.c
@@ -1,6 +1,6 @@
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
/*
- * Copyright (C) 2011 Ruby-GNOME2 Project Team
+ * Copyright (C) 2011-2014 Ruby-GNOME2 Project Team
* Copyright (C) 2005,2006 Masao Mutoh
*
* This library is free software; you can redistribute it and/or
@@ -57,10 +57,35 @@ rg_initialize(int argc, VALUE *argv, VALUE self)
return Qnil;
}
+static gboolean
+quit_loop(gpointer user_data)
+{
+ GMainLoop *loop = user_data;
+ g_main_loop_quit(loop);
+ return G_SOURCE_REMOVE;
+}
+
static VALUE
rg_run(VALUE self)
{
- g_main_loop_run(_SELF(self));
+ GMainLoop *loop;
+ GSource *interrupt_source;
+
+ loop = _SELF(self);
+
+ interrupt_source = rbg_interrupt_source_new();
+ g_source_set_callback(interrupt_source,
+ quit_loop,
+ loop,
+ NULL);
+ g_source_attach(interrupt_source,
+ g_main_loop_get_context(loop));
+ g_main_loop_run(loop);
+ g_source_destroy(interrupt_source);
+ g_source_unref(interrupt_source);
+
+ rb_thread_check_ints();
+
return self;
}
diff --git a/glib2/ext/glib2/rbglib_source.c b/glib2/ext/glib2/rbglib_source.c
index 0217a57..c42a5d5 100644
--- a/glib2/ext/glib2/rbglib_source.c
+++ b/glib2/ext/glib2/rbglib_source.c
@@ -64,6 +64,13 @@ rg_attach(int argc, VALUE *argv, VALUE self)
}
static VALUE
+rg_destroy(VALUE self)
+{
+ g_source_destroy(_SELF(self));
+ return self;
+}
+
+static VALUE
rg_destroyed_p(VALUE self)
{
return CBOOL2RVAL(g_source_is_destroyed(_SELF(self)));
@@ -101,6 +108,21 @@ rg_id(VALUE self)
return UINT2NUM(g_source_get_id(_SELF(self)));
}
+#if GLIB_CHECK_VERSION(2, 26, 0)
+static VALUE
+rg_name(VALUE self)
+{
+ return CSTR2RVAL(g_source_get_name(_SELF(self)));
+}
+
+static VALUE
+rg_set_name(VALUE self, VALUE name)
+{
+ g_source_set_name(_SELF(self), RVAL2CSTR(name));
+ return self;
+}
+#endif
+
static VALUE
rg_context(VALUE self)
{
@@ -121,7 +143,7 @@ rg_set_callback(VALUE self)
G_RELATIVE(self, func);
g_source_set_callback(_SELF(self),
(GSourceFunc)source_func,
- (gpointer)func,
+ (gpointer)func,
(GDestroyNotify)NULL);
return self;
}
@@ -132,6 +154,23 @@ void g_source_set_callback_indirect (GSource *source,
GSourceCallbackFuncs *callback_funcs);
*/
+#if GLIB_CHECK_VERSION(2, 36, 0)
+static VALUE
+rg_ready_time(VALUE self)
+{
+ gint64 ready_time;
+ ready_time = g_source_get_ready_time(_SELF(self));
+ return LL2NUM(ready_time);
+}
+
+static VALUE
+rg_set_ready_time(VALUE self, VALUE ready_time)
+{
+ g_source_set_ready_time(_SELF(self), NUM2LL(ready_time));
+ return self;
+}
+#endif
+
static VALUE
rg_add_poll(VALUE self, VALUE fd)
{
@@ -166,7 +205,7 @@ gboolean g_source_remove_by_user_data (gpointer user_data);
void
Init_glib_source(void)
{
- VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_SOURCE, "Source", mGLib);
+ VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_SOURCE, "Source", mGLib);
id_call = rb_intern("call");
@@ -176,14 +215,23 @@ Init_glib_source(void)
"CONTINUE", CBOOL2RVAL(G_SOURCE_CONTINUE));
RG_DEF_METHOD(attach, -1);
+ RG_DEF_METHOD(destroy, 0);
RG_DEF_METHOD_P(destroyed, 0);
RG_DEF_METHOD(set_priority, 1);
RG_DEF_METHOD(priority, 0);
RG_DEF_METHOD(set_can_recurse, 1);
RG_DEF_METHOD_P(can_recurse, 0);
RG_DEF_METHOD(id, 0);
+#if GLIB_CHECK_VERSION(2, 26, 0)
+ RG_DEF_METHOD(name, 0);
+ RG_REPLACE_SET_PROPERTY(name, 1);
+#endif
RG_DEF_METHOD(context, 0);
RG_DEF_METHOD(set_callback, 0);
+#if GLIB_CHECK_VERSION(2, 36, 0)
+ RG_DEF_METHOD(ready_time, 0);
+ RG_REPLACE_SET_PROPERTY(ready_time, 1);
+#endif
RG_DEF_METHOD(add_poll, 1);
RG_DEF_METHOD(remove_poll, 1);
#if GLIB_CHECK_VERSION(2, 28, 0)
diff --git a/glib2/ext/glib2/rbglib_threads.c b/glib2/ext/glib2/rbglib_threads.c
index c1c9773..504fce5 100644
--- a/glib2/ext/glib2/rbglib_threads.c
+++ b/glib2/ext/glib2/rbglib_threads.c
@@ -29,7 +29,7 @@ static VALUE
rg_s_init(VALUE self)
{
#ifdef HAVE_G_THREAD_INIT
-#ifdef G_THREADS_ENABLED
+#if defined(G_THREADS_ENABLED) && !GLIB_CHECK_VERSION(2, 32, 0)
g_thread_init(NULL);
#endif
#endif
diff --git a/glib2/ext/glib2/rbglib_utils.c b/glib2/ext/glib2/rbglib_utils.c
index 6ad0e1e..176f4ce 100644
--- a/glib2/ext/glib2/rbglib_utils.c
+++ b/glib2/ext/glib2/rbglib_utils.c
@@ -59,7 +59,7 @@ rg_s_getenv(G_GNUC_UNUSED VALUE self, VALUE variable)
static VALUE
rg_s_setenv(G_GNUC_UNUSED VALUE self, VALUE variable, VALUE value, VALUE overwrite)
{
- return CBOOL2RVAL(g_setenv(RVAL2CSTR(variable),
+ return CBOOL2RVAL(g_setenv(RVAL2CSTR(variable),
RVAL2CSTR_ACCEPT_NIL(value),
RVAL2CBOOL(overwrite)));
}
@@ -277,9 +277,9 @@ static VALUE
rg_s_check_version_p(G_GNUC_UNUSED VALUE self, VALUE major, VALUE minor, VALUE micro)
{
return CBOOL2RVAL(glib_major_version > NUM2UINT(major) ||
- (glib_major_version == NUM2UINT(major) &&
+ (glib_major_version == NUM2UINT(major) &&
glib_minor_version > NUM2UINT(minor)) ||
- (glib_major_version == NUM2UINT(major) &&
+ (glib_major_version == NUM2UINT(major) &&
glib_minor_version == NUM2UINT(minor) &&
glib_micro_version >= NUM2UINT(micro)));
}
@@ -293,6 +293,11 @@ Init_glib_utils(void)
G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, G_TYPE_USER_DIRECTORY, "G_");
#endif
+#if GLIB_CHECK_VERSION(2, 30, 0)
+ G_DEF_CLASS(G_TYPE_FORMAT_SIZE_FLAGS,
+ "FormatSizeFlags", RG_TARGET_NAMESPACE);
+#endif
+
RG_DEF_SMETHOD(application_name, 0);
RG_DEF_SMETHOD(set_application_name, 1);
RG_DEF_SMETHOD(prgname, 0);
diff --git a/glib2/ext/glib2/rbgobj_boxed.c b/glib2/ext/glib2/rbgobj_boxed.c
index 7070d76..68425f0 100644
--- a/glib2/ext/glib2/rbgobj_boxed.c
+++ b/glib2/ext/glib2/rbgobj_boxed.c
@@ -47,7 +47,7 @@ boxed_free(boxed_holder *holder)
if (holder->own && holder->boxed)
g_boxed_free(holder->type, holder->boxed);
- free(holder);
+ xfree(holder);
}
/**********************************************************************/
@@ -71,11 +71,27 @@ rbgobj_boxed_s_allocate(VALUE klass)
return result;
}
-static G_GNUC_NORETURN VALUE
+static VALUE
rg_initialize(VALUE self)
{
- rb_raise(rb_eTypeError, "can't initialize %s",
- rb_class2name(CLASS_OF(self)));
+ VALUE rb_class;
+
+ rb_class = CLASS_OF(self);
+ if (RVAL2CBOOL(rb_ivar_defined(rb_class, rb_intern("@size")))) {
+ const RGObjClassInfo *cinfo;
+ gpointer instance;
+ gsize instance_size;
+ cinfo = rbgobj_lookup_class(rb_class);
+ instance_size = NUM2UINT(rb_iv_get(rb_class, "@size"));
+ instance = alloca(instance_size);
+ memset(instance, 0, instance_size);
+ G_INITIALIZE(self, g_boxed_copy(cinfo->gtype, instance));
+ } else {
+ rb_raise(rb_eTypeError, "can't initialize %s",
+ rb_class2name(rb_class));
+ }
+
+ return Qnil;
}
static VALUE
diff --git a/glib2/ext/glib2/rbgobj_convert.c b/glib2/ext/glib2/rbgobj_convert.c
index da2ee2d..fcde0e8 100644
--- a/glib2/ext/glib2/rbgobj_convert.c
+++ b/glib2/ext/glib2/rbgobj_convert.c
@@ -1,6 +1,6 @@
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
/*
- * Copyright (C) 2011-2013 Ruby-GNOME2 Project Team
+ * Copyright (C) 2011-2014 Ruby-GNOME2 Project Team
* Copyright (C) 2006 Sjoerd Simons, Masao Mutoh
*
* This library is free software; you can redistribute it and/or
@@ -39,9 +39,9 @@ void
Init_gobject_convert(void)
{
/* TODO: unref the below tables on exit. */
- tables = g_hash_table_new_full(g_int_hash, g_int_equal, NULL,
+ tables = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL,
rg_convert_table_free);
- class_to_g_type_map = g_hash_table_new(g_int_hash, g_int_equal);
+ class_to_g_type_map = g_hash_table_new(g_direct_hash, g_direct_equal);
}
void
@@ -49,17 +49,20 @@ rbgobj_convert_define(const RGConvertTable *table)
{
RGConvertTable *copied_table;
copied_table = g_memdup(table, sizeof(RGConvertTable));
- g_hash_table_insert(tables, &(copied_table->type), copied_table);
+ g_hash_table_insert(tables,
+ GUINT_TO_POINTER(copied_table->type),
+ copied_table);
if (copied_table->klass != Qfalse && !NIL_P(copied_table->klass)) {
g_hash_table_insert(class_to_g_type_map,
- &(copied_table->klass), &(copied_table->type));
+ GUINT_TO_POINTER(copied_table->klass),
+ GUINT_TO_POINTER(copied_table->type));
}
}
RGConvertTable *
rbgobj_convert_lookup(GType type)
{
- return g_hash_table_lookup(tables, &type);
+ return g_hash_table_lookup(tables, GUINT_TO_POINTER(type));
}
gboolean
@@ -128,11 +131,11 @@ GType
rbgobj_convert_rvalue2gtype(VALUE value)
{
VALUE klass;
- GType *result;
+ gpointer result;
klass = rb_class_of(value);
- result = g_hash_table_lookup(class_to_g_type_map, &klass);
- return result ? *result : 0;
+ result = g_hash_table_lookup(class_to_g_type_map, GUINT_TO_POINTER(klass));
+ return GPOINTER_TO_UINT(result);
}
gboolean
diff --git a/glib2/ext/glib2/rbgobj_object.c b/glib2/ext/glib2/rbgobj_object.c
index 6139066..06e834c 100644
--- a/glib2/ext/glib2/rbgobj_object.c
+++ b/glib2/ext/glib2/rbgobj_object.c
@@ -58,7 +58,7 @@ holder_mark(gobj_holder *holder)
}
static void
-holder_free(gobj_holder *holder)
+holder_unref(gobj_holder *holder)
{
if (holder->gobj) {
if (!holder->destroyed) {
@@ -68,6 +68,12 @@ holder_free(gobj_holder *holder)
}
holder->gobj = NULL;
}
+}
+
+static void
+holder_free(gobj_holder *holder)
+{
+ holder_unref(holder);
xfree(holder);
}
@@ -609,6 +615,23 @@ rg_inspect(VALUE self)
}
static VALUE
+rg_unref(VALUE self)
+{
+ gobj_holder* holder;
+
+ Data_Get_Struct(self, gobj_holder, holder);
+
+ if (holder->destroyed)
+ rb_raise(rb_eTypeError, "destroyed GLib::Object");
+ if (!holder->gobj)
+ rb_raise(rb_eTypeError, "uninitialize GLib::Object");
+
+ holder_unref(holder);
+
+ return self;
+}
+
+static VALUE
rg_type_name(VALUE self)
{
return CSTR2RVAL(G_OBJECT_TYPE_NAME(RVAL2GOBJ(self)));
@@ -842,6 +865,7 @@ Init_gobject_gobject(void)
RG_DEF_METHOD(initialize, -1);
rbg_define_method(RG_TARGET_NAMESPACE, "ref_count", gobj_ref_count, 0); /* for debugging */
+ RG_DEF_METHOD(unref, 0);
RG_DEF_METHOD(inspect, 0);
RG_DEF_METHOD(type_name, 0);
diff --git a/glib2/ext/glib2/rbgobj_type.c b/glib2/ext/glib2/rbgobj_type.c
index 55dde1c..8ee147f 100644
--- a/glib2/ext/glib2/rbgobj_type.c
+++ b/glib2/ext/glib2/rbgobj_type.c
@@ -26,7 +26,9 @@
/**********************************************************************/
/* Type Mapping */
+#ifndef rb_cMutex
static VALUE rb_cMutex;
+#endif
static VALUE lookup_class_mutex;
static ID id_new;
@@ -69,11 +71,7 @@ rbgobj_lookup_class(VALUE klass)
if (TYPE(klass) == T_CLASS) {
VALUE super;
- if (FL_TEST(klass, FL_SINGLETON)) {
- super = rb_class_real(klass);
- } else {
- super = rb_funcall(klass, id_superclass, 0);
- }
+ super = rb_funcall(klass, id_superclass, 0);
return rbgobj_lookup_class(super);
}
@@ -768,7 +766,9 @@ Init_gobject_gtype(void)
init_typemap();
/* type */
+#ifndef rb_cMutex
rb_cMutex = rb_const_get(rb_cObject, rb_intern("Mutex"));
+#endif
id_lock = rb_intern("lock");
id_unlock = rb_intern("unlock");
lookup_class_mutex = rb_funcall(rb_cMutex, id_new, 0);
diff --git a/glib2/ext/glib2/rbgprivate.h b/glib2/ext/glib2/rbgprivate.h
index 4ad22d6..6255143 100644
--- a/glib2/ext/glib2/rbgprivate.h
+++ b/glib2/ext/glib2/rbgprivate.h
@@ -56,9 +56,7 @@ typedef struct {
GType type;
} boxed_holder;
-#ifdef HAVE_RB_THREAD_BLOCKING_REGION
G_GNUC_INTERNAL extern GStaticPrivate rg_polling_key;
-#endif
extern VALUE rbgobj_cEnum;
extern VALUE rbgobj_cFlags;
diff --git a/glib2/ext/glib2/rbgutil.c b/glib2/ext/glib2/rbgutil.c
index 705ad88..44111a4 100644
--- a/glib2/ext/glib2/rbgutil.c
+++ b/glib2/ext/glib2/rbgutil.c
@@ -1,6 +1,6 @@
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
/*
- * Copyright (C) 2011-2013 Ruby-GNOME2 Project Team
+ * Copyright (C) 2011-2014 Ruby-GNOME2 Project Team
* Copyright (C) 2002-2004 Masao Mutoh
*
* This library is free software; you can redistribute it and/or
@@ -133,6 +133,44 @@ rbgutil_key_equal(VALUE rb_key, const char *key)
}
}
+static gboolean
+rbg_interrupt_prepare (G_GNUC_UNUSED GSource *soruce,
+ G_GNUC_UNUSED gint *timouet)
+{
+ return rb_thread_interrupted(rb_thread_current());
+}
+
+static gboolean
+rbg_interrupt_check (G_GNUC_UNUSED GSource *soruce)
+{
+ return rb_thread_interrupted(rb_thread_current());
+}
+
+static gboolean
+rbg_interrupt_dispatch (G_GNUC_UNUSED GSource *soruce,
+ GSourceFunc callback,
+ gpointer user_data)
+{
+ if (callback) {
+ return callback(user_data);
+ } else {
+ return G_SOURCE_REMOVE;
+ }
+}
+
+static GSourceFuncs rbg_interrupt_funcs = {
+ rbg_interrupt_prepare,
+ rbg_interrupt_check,
+ rbg_interrupt_dispatch,
+ NULL
+};
+
+GSource *
+rbg_interrupt_source_new(void)
+{
+ return g_source_new(&rbg_interrupt_funcs, sizeof(GSource));
+}
+
void
Init_gutil(void)
{
diff --git a/glib2/ext/glib2/rbgutil.h b/glib2/ext/glib2/rbgutil.h
index 8a3fa4d..040b47e 100644
--- a/glib2/ext/glib2/rbgutil.h
+++ b/glib2/ext/glib2/rbgutil.h
@@ -1,6 +1,6 @@
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
/*
- * Copyright (C) 2011-2013 Ruby-GNOME2 Project Team
+ * Copyright (C) 2011-2014 Ruby-GNOME2 Project Team
* Copyright (C) 2002,2003 Masao Mutoh
*
* This library is free software; you can redistribute it and/or
@@ -105,6 +105,7 @@ extern VALUE rbgutil_string_set_utf8_encoding(VALUE string);
extern gboolean rbgutil_key_equal(VALUE rb_string, const char *key);
extern const gchar *rbg_inspect(VALUE object);
+extern GSource *rbg_interrupt_source_new(void);
/*< protected >*/
RUBY_GLIB2_VAR ID rbgutil_id_module_eval;
diff --git a/glib2/ext/glib2/rbgutil_callback.c b/glib2/ext/glib2/rbgutil_callback.c
index 8f7ae42..faafd0f 100644
--- a/glib2/ext/glib2/rbgutil_callback.c
+++ b/glib2/ext/glib2/rbgutil_callback.c
@@ -195,11 +195,9 @@ rbgutil_invoke_callback(VALUE (*func)(VALUE), VALUE arg)
{
#ifdef HAVE_NATIVETHREAD
if (ruby_native_thread_p()) {
-# ifdef HAVE_RB_THREAD_BLOCKING_REGION
if (!GPOINTER_TO_INT(g_static_private_get(&rg_polling_key))) {
return rbgutil_protect(func, arg);
}
-# endif
# ifdef HAVE_RB_THREAD_CALL_WITH_GVL
{
CallbackRequest req;
diff --git a/glib2/ext/glib2/ruby-glib2.pc b/glib2/ext/glib2/ruby-glib2.pc
new file mode 100644
index 0000000..b5804ee
--- /dev/null
+++ b/glib2/ext/glib2/ruby-glib2.pc
@@ -0,0 +1,3 @@
+Name: Ruby/GLib2
+Description: Ruby bindings for GLib Type, Object, Parameter and Signal Library
+Version: 2.2.4
\ No newline at end of file
diff --git a/glib2/lib/glib2/deprecatable.rb b/glib2/lib/glib2/deprecatable.rb
index 7da4e61..c4a9089 100644
--- a/glib2/lib/glib2/deprecatable.rb
+++ b/glib2/lib/glib2/deprecatable.rb
@@ -91,29 +91,33 @@ module GLib
private
def const_missing(deprecated_const)
- if new_const = (@@deprecated_const[self] || {})[deprecated_const.to_sym]
- msg = "#{caller[0]}: '#{[name, deprecated_const].join('::')}' has been deprecated."
- case new_const
- when String, Symbol
- new_const_val = constant_get(new_const)
- case new_const_val
- when GLib::Enum, GLib::Flags
- alt = " or ':#{new_const_val.nick.gsub('-', '_')}'"
- end
- warn "#{msg} Use '#{new_const}'#{alt}."
- return const_set(deprecated_const, new_const_val)
- when Hash
- if new_const[:raise]
- raise DeprecatedError.new("#{msg} #{new_const[:raise]}")
- elsif new_const[:warn]
- warn "#{msg} #{new_const[:warn]}"
- else
- warn "#{msg} Don't use this constant anymore."
- end
- return
+ new_const = (@@deprecated_const[self] || {})[deprecated_const.to_sym]
+ if new_const.nil?
+ return super
+ end
+
+ msg = "#{caller[0]}: '#{[name, deprecated_const].join('::')}' has been deprecated."
+ case new_const
+ when String, Symbol
+ new_const_val = constant_get(new_const)
+ case new_const_val
+ when GLib::Enum, GLib::Flags
+ alt = " or ':#{new_const_val.nick.gsub('-', '_')}'"
+ end
+ warn "#{msg} Use '#{new_const}'#{alt}."
+ return const_set(deprecated_const, new_const_val)
+ when Hash
+ if new_const[:raise]
+ raise DeprecatedError.new("#{msg} #{new_const[:raise]}")
+ elsif new_const[:warn]
+ warn "#{msg} #{new_const[:warn]}"
+ else
+ warn "#{msg} Don't use this constant anymore."
end
+ return
+ else
+ super
end
- raise NameError.new("uninitialized constant #{[self, deprecated_const].join('::')}")
end
def constant_get(const)
diff --git a/glib2/lib/gnome2/rake/external-package.rb b/glib2/lib/gnome2/rake/external-package.rb
index 9039555..fdbe065 100644
--- a/glib2/lib/gnome2/rake/external-package.rb
+++ b/glib2/lib/gnome2/rake/external-package.rb
@@ -26,6 +26,7 @@ module GNOME2
:download_site,
:download_base_url,
:compression_method,
+ :base_dir_in_package,
:windows,
:native,
:patches,
@@ -72,6 +73,10 @@ module GNOME2
need_autoreconf
end
+ def base_dir_in_package
+ super || "."
+ end
+
def windows
super || WindowsConfiguration.new({})
end
@@ -99,6 +104,8 @@ module GNOME2
base_url = "http://ftp.gnome.org/pub/gnome/sources"
release_series = version.gsub(/\A(\d+\.\d+)(?:[^\d].*)?\z/, '\1')
base_url << "/#{name}/#{release_series}"
+ when :gnu
+ base_url = "http://ftp.gnu.org/pub/gnu/#{name}"
else
base_url = nil
end
@@ -109,6 +116,7 @@ module GNOME2
:include_paths,
:library_paths,
:configure_args,
+ :cmake_args,
:cc_args,
:patches,
:built_file,
@@ -139,6 +147,10 @@ module GNOME2
super || []
end
+ def cmake_args
+ super || []
+ end
+
def cc_args
super || []
end
diff --git a/glib2/lib/gnome2/rake/native-binary-build-task.rb b/glib2/lib/gnome2/rake/native-binary-build-task.rb
index c6a525a..7732c0a 100644
--- a/glib2/lib/gnome2/rake/native-binary-build-task.rb
+++ b/glib2/lib/gnome2/rake/native-binary-build-task.rb
@@ -75,7 +75,7 @@ module GNOME2
end
def build_package_task_body(package)
- package_tmp_dir = @package.tmp_dir + package.name
+ package_tmp_dir = @package.tmp_dir + "native" + package.name
rm_rf(package_tmp_dir)
mkdir_p(package_tmp_dir)
@@ -84,7 +84,9 @@ module GNOME2
sh("tar", "xf", tar_full_path.to_s) or exit(false)
end
- Dir.chdir((package_tmp_dir + package.base_name).to_s) do
+ package_dir_path =
+ package_tmp_dir + package.base_name + package.base_dir_in_package
+ Dir.chdir(package_dir_path.to_s) do
package.native.patches.each do |patch|
sh("patch -p1 < #{@package.patches_dir}/#{patch}")
end
@@ -94,6 +96,8 @@ module GNOME2
"PKG_CONFIG_PATH=#{pkg_config_path}",
"--prefix=#{dist_dir}",
*package.native.configure_args) or exit(false)
+ env = []
+ env << "PKG_CONFIG_PATH=#{pkg_config_path}"
common_make_args = []
common_make_args << "GLIB_COMPILE_SCHEMAS=glib-compile-schemas"
build_make_args = common_make_args.dup
@@ -102,8 +106,8 @@ module GNOME2
make_n_jobs = ENV["MAKE_N_JOBS"]
build_make_args << "-j#{make_n_jobs}" if make_n_jobs
end
- sh("nice", "make", *build_make_args) or exit(false)
- sh("make", "install", *install_make_args) or exit(false)
+ sh("env", *env, "nice", "make", *build_make_args) or exit(false)
+ sh("env", *env, "make", "install", *install_make_args) or exit(false)
end
end
diff --git a/glib2/lib/gnome2/rake/package-task.rb b/glib2/lib/gnome2/rake/package-task.rb
index e3a79bd..bfc0cad 100644
--- a/glib2/lib/gnome2/rake/package-task.rb
+++ b/glib2/lib/gnome2/rake/package-task.rb
@@ -1,6 +1,6 @@
# coding: utf-8
-# Copyright(C) 2011 Ruby-GNOME2 Project.
+# Copyright(C) 2011-2014 Ruby-GNOME2 Project.
#
# This program is licenced under the same license of Ruby-GNOME2.
@@ -14,8 +14,8 @@ require "gnome2/rake/package"
require "gnome2/rake/external-package"
require "gnome2/rake/source-download-task"
require "gnome2/rake/native-binary-build-task"
-require "gnome2/rake/win32-binary-download-task"
-require "gnome2/rake/win32-binary-build-task"
+require "gnome2/rake/windows-binary-download-task"
+require "gnome2/rake/windows-binary-build-task"
module GNOME2
module Rake
@@ -44,7 +44,7 @@ module GNOME2
define_spec
define_source_tasks
define_native_tasks
- define_win32_tasks
+ define_windows_tasks
define_package_tasks
end
@@ -69,11 +69,6 @@ module GNOME2
@package.windows
end
- # For backward compatibility
- def win32
- windows
- end
-
def native
@package.native
end
@@ -112,6 +107,10 @@ module GNOME2
@dependency_configuration = DependencyConfiguration.new(self)
end
+ def cross_platform
+ "#{windows.build_architecture}-mingw32"
+ end
+
def define_spec
@spec = Gem::Specification.new do |s|
s.name = @name
@@ -129,7 +128,9 @@ module GNOME2
files = FileList["ChangeLog", "README",
"Rakefile", "extconf.rb",
"lib/**/*.rb",
- "{ext,sample,test,test-unit}/**/*"]
+ "ext/**/depend",
+ "ext/**/*.{c,h,def,rb}",
+ "{sample,test}/**/*"]
files.existing!
s.files = files
s.required_ruby_version = @required_ruby_version || ">= 1.9.3"
@@ -156,39 +157,44 @@ module GNOME2
task.define
end
- def define_win32_tasks
- define_win32_extension_task
- define_win32_download_task
- define_win32_build_task
+ def define_windows_tasks
+ define_windows_extension_task
+ define_windows_download_task
+ define_windows_build_task
end
def so_base_name
@name.gsub(/-/, "_")
end
- def define_win32_extension_task
+ def define_windows_extension_task
::Rake::ExtensionTask.new(so_base_name, @spec) do |ext|
+ ext.cross_platform = cross_platform
ext.ext_dir = "ext/#{@name}"
ext.cross_compile = true
ext.cross_compiling do |spec|
if /mingw|mswin/ =~ spec.platform.to_s
- win32_binary_dir = @package.windows.relative_binary_dir
- win32_files = []
- if win32_binary_dir.exist?
- Find.find(win32_binary_dir.to_s) do |path|
+ windows_binary_dir = @package.windows.relative_binary_dir
+ windows_files = []
+ if windows_binary_dir.exist?
+ Find.find(windows_binary_dir.to_s) do |path|
next unless File.file?(path)
next if /\.zip\z/ =~ path
- win32_files << path
+ windows_files << path
end
end
- spec.files += win32_files
+ spec.files += windows_files
stage_path = "#{ext.tmp_dir}/#{ext.cross_platform}/stage"
- win32_files.each do |win32_file|
- stage_win32_file = "#{stage_path}/#{win32_file}"
- stage_win32_binary_dir = File.dirname(stage_win32_file)
- directory stage_win32_binary_dir
- file stage_win32_file => [stage_win32_binary_dir, win32_file] do
- cp win32_file, stage_win32_file
+ windows_files.each do |windows_file|
+ stage_windows_file = "#{stage_path}/#{windows_file}"
+ stage_windows_binary_dir = File.dirname(stage_windows_file)
+ directory stage_windows_binary_dir
+ stage_windows_file_dependencies = [
+ stage_windows_binary_dir,
+ windows_file,
+ ]
+ file stage_windows_file => stage_windows_file_dependencies do
+ cp windows_file, stage_windows_file
end
end
end
@@ -198,13 +204,21 @@ module GNOME2
end
end
- def define_win32_download_task
- GNOME2Win32BinaryDownloadTask.new(@package)
+ extconf_rb = "ext/#{@name}/extconf.rb"
+ unless File.exist?(extconf_rb)
+ native_task_name = "native:#{@name}:#{cross_platform}"
+ if ::Rake::Task.task_defined?(native_task_name)
+ ::Rake::Task[native_task_name].prerequisites.clear
+ end
end
+ end
- def define_win32_build_task
- GNOME2Win32BinaryBuildTask.new(@package)
- end
+ def define_windows_download_task
+ GNOME2WindowsBinaryDownloadTask.new(@package)
+ end
+
+ def define_windows_build_task
+ GNOME2WindowsBinaryBuildTask.new(@package)
end
def define_package_tasks
diff --git a/glib2/lib/gnome2/rake/package.rb b/glib2/lib/gnome2/rake/package.rb
index 9c94e61..071c0a9 100644
--- a/glib2/lib/gnome2/rake/package.rb
+++ b/glib2/lib/gnome2/rake/package.rb
@@ -1,6 +1,6 @@
# -*- ruby -*-
#
-# Copyright (C) 2013 Ruby-GNOME2 Project Team
+# Copyright (C) 2013-2014 Ruby-GNOME2 Project Team
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -106,7 +106,37 @@ module GNOME2
end
def build_host
- super || "i686-w64-mingw32"
+ super || guess_build_host
+ end
+
+ def guess_build_host
+ ENV["RUBY_GNOME2_BUILD_HOST"] ||
+ guess_build_host_from_architecture ||
+ "i686-w64-mingw32"
+ end
+
+ def guess_build_host_from_architecture
+ case build_architecture
+ when "x86"
+ "i686-w64-mingw32"
+ when "x64"
+ "x86_64-w64-mingw32"
+ else
+ nil
+ end
+ end
+
+ def build_architecture
+ ENV["RUBY_GNOME2_BUILD_ARCHITECTURE"] || "x86"
+ end
+
+ def build_architecture_suffix
+ case build_architecture
+ when "x86"
+ "win32"
+ when "x64"
+ "win64"
+ end
end
end
diff --git a/glib2/lib/gnome2/rake/win32-binary-build-task.rb b/glib2/lib/gnome2/rake/windows-binary-build-task.rb
similarity index 65%
rename from glib2/lib/gnome2/rake/win32-binary-build-task.rb
rename to glib2/lib/gnome2/rake/windows-binary-build-task.rb
index 89107e7..1de6664 100644
--- a/glib2/lib/gnome2/rake/win32-binary-build-task.rb
+++ b/glib2/lib/gnome2/rake/windows-binary-build-task.rb
@@ -5,7 +5,7 @@
require "open-uri"
require "pathname"
-class GNOME2Win32BinaryBuildTask
+class GNOME2WindowsBinaryBuildTask
include Rake::DSL
def initialize(package)
@@ -15,20 +15,20 @@ class GNOME2Win32BinaryBuildTask
private
def define
- namespace :win32 do
+ namespace :windows do
namespace :builder do
task :before
define_build_tasks
build_tasks = build_packages.collect do |package|
- "win32:builder:build:#{package.name}"
+ "windows:builder:build:#{package.name}"
end
task :build => build_tasks
task :after
end
desc "Build Windows binaries"
- task :build => ["win32:builder:before",
- "win32:builder:build",
- "win32:builder:after"]
+ task :build => ["windows:builder:before",
+ "windows:builder:build",
+ "windows:builder:after"]
end
end
@@ -46,17 +46,18 @@ class GNOME2Win32BinaryBuildTask
ENV["PKG_CONFIG_PATH"] = pkg_config_path.collect do |path|
File.expand_path(path)
end.join(":")
- ENV["PKG_CONFIG_LIBDIR"] = rcairo_win32_pkgconfig_path
+ ENV["PKG_CONFIG_LIBDIR"] = rcairo_windows_pkgconfig_path
end
prepare_task_names << "pkg_config_for_build"
task :pkg_config_for_build do
- ENV["PKG_CONFIG_FOR_BUILD"] = "env - pkg-config"
+ # XXX: Is it needless?
+ # ENV["PKG_CONFIG_FOR_BUILD"] = "env - pkg-config"
end
end
full_prepare_task_names = prepare_task_names.collect do |name|
- "win32:builder:build:prepare:#{name}"
+ "windows:builder:build:prepare:#{name}"
end
task :prepare => full_prepare_task_names
@@ -68,7 +69,7 @@ class GNOME2Win32BinaryBuildTask
if built_file
built_file = dist_dir + built_file
file built_file.to_s do
- Rake::Task["win32:builder:build:prepare"].invoke
+ Rake::Task["windows:builder:build:prepare"].invoke
Rake::Task[download_task].invoke
build_package_task_body(package)
end
@@ -81,7 +82,7 @@ class GNOME2Win32BinaryBuildTask
task :after
end
- prefix = "win32:builder:build:#{package.name}"
+ prefix = "windows:builder:build:#{package.name}"
desc "Build #{package.label} and install it into #{dist_dir}."
task package.name => [
"#{prefix}:before",
@@ -93,7 +94,7 @@ class GNOME2Win32BinaryBuildTask
end
def build_package_task_body(package)
- package_tmp_dir = @package.tmp_dir + package.name
+ package_tmp_dir = @package.tmp_dir + "windows" + package.name
rm_rf(package_tmp_dir)
mkdir_p(package_tmp_dir)
@@ -102,25 +103,22 @@ class GNOME2Win32BinaryBuildTask
sh("tar", "xf", tar_full_path.to_s)
end
- Dir.chdir((package_tmp_dir + package.base_name).to_s) do
+ package_dir_path =
+ package_tmp_dir + package.base_name + package.base_dir_in_package
+ Dir.chdir(package_dir_path.to_s) do
package.windows.patches.each do |patch|
sh("patch -p1 < #{@package.patches_dir}/#{patch}")
end
- sh("./autogen.sh") if package.windows.need_autogen?
- sh("autoreconf --install") if package.windows.need_autoreconf?
- cc_env = "CC=#{cc(package)}"
- sh("./configure",
- cc_env,
- "CPPFLAGS=#{cppflags(package)}",
- "LDFLAGS=#{ldflags(package)}",
- "--prefix=#{dist_dir}",
- "--host=#{@package.windows.build_host}",
- *package.windows.configure_args) or exit(false)
+ if File.exist?("configure")
+ configure(package)
+ else
+ cmake(package)
+ end
common_make_args = []
common_make_args << "MAKE=make"
common_make_args << "GLIB_COMPILE_SCHEMAS=glib-compile-schemas"
if package.windows.use_cc_environment_variable?
- common_make_args << cc_env
+ common_make_args << cc_env(package)
end
add_gobject_introspection_make_args(common_make_args)
build_make_args = common_make_args.dup
@@ -152,6 +150,43 @@ class GNOME2Win32BinaryBuildTask
end
end
+ def configure(package)
+ sh("./autogen.sh") if package.windows.need_autogen?
+ sh("autoreconf --install") if package.windows.need_autoreconf?
+ sh("./configure",
+ cc_env(package),
+ "CPPFLAGS=#{cppflags(package)}",
+ "LDFLAGS=#{ldflags(package)}",
+ "--prefix=#{dist_dir}",
+ "--host=#{@package.windows.build_host}",
+ *package.windows.configure_args) or exit(false)
+ end
+
+ def cmake(package)
+ toolchain_cmake_path = "toolchain.cmake"
+ File.open(toolchain_cmake_path, "w") do |toolchain|
+ toolchain.puts(<<-CMAKE)
+SET(CMAKE_SYSTEM_NAME Windows)
+SET(MSVC_CXX_ARCHITECTURE_ID #{@package.windows.build_architecture})
+SET(CMAKE_SYSTEM_PROCESSOR #{@package.windows.build_architecture})
+
+SET(CMAKE_C_COMPILER #{@package.windows.build_host}-gcc)
+SET(CMAKE_CXX_COMPILER #{@package.windows.build_host}-g++)
+SET(CMAKE_RC_COMPILER #{@package.windows.build_host}-windres)
+
+SET(CMAKE_FIND_ROOT_PATH #{cmake_root_paths.join(" ")})
+ CMAKE
+ end
+ sh("cmake",
+ ".",
+ "-DCMAKE_TOOLCHAIN_FILE=#{toolchain_cmake_path}",
+ *package.windows.cmake_args) or exit(false)
+ end
+
+ def cc_env(package)
+ "CC=#{cc(package)}"
+ end
+
def build_packages
packages = @package.external_packages.select do |package|
package.windows.build?
@@ -168,28 +203,37 @@ class GNOME2Win32BinaryBuildTask
dist_dir + "share" + "license"
end
+ def glib2_binary_base_dir
+ @package.glib2_root_dir + "vendor" + "local"
+ end
+
def glib2_include_path
- "#{@package.glib2_root_dir}/vendor/local/include"
+ "#{glib2_binary_base_dir}/include"
end
def glib2_lib_path
- "#{@package.glib2_root_dir}/vendor/local/lib"
+ "#{glib2_binary_base_dir}/lib"
+ end
+
+ def rcairo_windows_dir
+ suffix = @package.windows.build_architecture_suffix
+ @package.project_root_dir.parent + "rcairo.#{suffix}"
end
- def rcairo_win32_dir
- @package.project_root_dir.parent + "rcairo.win32"
+ def rcairo_windows_binary_base_dir
+ rcairo_windows_dir + "vendor" + "local"
end
- def rcairo_win32_pkgconfig_path
- "#{rcairo_win32_dir}/vendor/local/lib/pkgconfig"
+ def rcairo_windows_pkgconfig_path
+ "#{rcairo_windows_binary_base_dir}/lib/pkgconfig"
end
- def rcairo_win32_include_path
- "#{rcairo_win32_dir}/vendor/local/include"
+ def rcairo_windows_include_path
+ "#{rcairo_windows_binary_base_dir}/include"
end
- def rcairo_win32_lib_path
- "#{rcairo_win32_dir}/vendor/local/lib"
+ def rcairo_windows_lib_path
+ "#{rcairo_windows_binary_base_dir}/lib"
end
def cc(package)
@@ -206,7 +250,7 @@ class GNOME2Win32BinaryBuildTask
include_paths += [glib2_include_path]
end
include_paths += [
- rcairo_win32_include_path,
+ rcairo_windows_include_path,
dist_dir + 'include',
]
cppflags = include_paths.collect do |path|
@@ -221,7 +265,7 @@ class GNOME2Win32BinaryBuildTask
library_paths += [glib2_lib_path]
end
library_paths += [
- rcairo_win32_lib_path,
+ rcairo_windows_lib_path,
dist_dir + 'lib',
]
ldflags = library_paths.collect do |path|
@@ -230,6 +274,17 @@ class GNOME2Win32BinaryBuildTask
ldflags.join(" ")
end
+ def cmake_root_paths
+ paths = [
+ "/usr/#{@package.windows.build_host}",
+ rcairo_windows_binary_base_dir.to_path,
+ ]
+ @package.windows.build_dependencies.each do |package|
+ paths << "#{@package.project_root_dir}/#{package}/vendor/local"
+ end
+ paths
+ end
+
def add_gobject_introspection_make_args(common_make_args)
unless @package.windows.build_dependencies.include?("gobject-introspection")
return
diff --git a/glib2/lib/gnome2/rake/win32-binary-download-task.rb b/glib2/lib/gnome2/rake/windows-binary-download-task.rb
similarity index 84%
rename from glib2/lib/gnome2/rake/win32-binary-download-task.rb
rename to glib2/lib/gnome2/rake/windows-binary-download-task.rb
index 7509cd5..fc2fbb1 100644
--- a/glib2/lib/gnome2/rake/win32-binary-download-task.rb
+++ b/glib2/lib/gnome2/rake/windows-binary-download-task.rb
@@ -6,10 +6,10 @@ require 'open-uri'
require 'rubygems'
require 'mechanize'
-class GNOME2Win32BinaryDownloadTask
+class GNOME2WindowsBinaryDownloadTask
include Rake::DSL
- URL_BASE = "http://ftp.gnome.org/pub/gnome/binaries/win32"
+ URL_BASE = "http://ftp.gnome.org/pub/gnome/binaries"
def initialize(package)
@package = package
define
@@ -17,7 +17,7 @@ class GNOME2Win32BinaryDownloadTask
private
def define
- namespace :win32 do
+ namespace :windows do
namespace :downloader do
task :before
@@ -45,7 +45,7 @@ class GNOME2Win32BinaryDownloadTask
end
download_tasks = download_tasks.collect do |task|
- "win32:downloader:download:#{task}"
+ "windows:downloader:download:#{task}"
end
desc "download Windows binaries into #{dist_dir}"
task :download => download_tasks
@@ -53,9 +53,9 @@ class GNOME2Win32BinaryDownloadTask
task :after
end
desc "download Windows binaries"
- task :download => ["win32:downloader:before",
- "win32:downloader:download",
- "win32:downloader:after"]
+ task :download => ["windows:downloader:before",
+ "windows:downloader:download",
+ "windows:downloader:after"]
end
end
@@ -71,8 +71,13 @@ class GNOME2Win32BinaryDownloadTask
@package.windows.dependencies
end
+ def build_architecture_suffix
+ @package.windows.build_architecture_suffix
+ end
+
def download_package(package)
- version_page_url = "#{URL_BASE}/#{package}"
+ suffix = build_architecture_suffix
+ version_page_url = "#{URL_BASE}/#{suffix}/#{package}"
version_page = agent.get(version_page_url)
latest_version_link = version_page.links.sort_by do |link|
if /\A(\d+\.\d+)\/\z/ =~ link.href
@@ -86,8 +91,8 @@ class GNOME2Win32BinaryDownloadTask
latest_version_page = latest_version_link.click
latest_version = latest_version_page.links.collect do |link|
case link.href
- when /#{escaped_package}_([\d\.\-]+)_win32\.zip\z/,
- /#{escaped_package}-([\d\.\-]+)-win32\.zip\z/, # old
+ when /#{escaped_package}_([\d\.\-]+)_#{suffix}\.zip\z/,
+ /#{escaped_package}-([\d\.\-]+)-#{suffix}\.zip\z/, # old
/#{escaped_package}-([\d\.\-]+)\.zip\z/ # old
version = $1
normalized_version = version.split(/[\.\-]/).collect do |component|
@@ -107,8 +112,8 @@ class GNOME2Win32BinaryDownloadTask
escaped_latest_version = Regexp.escape(latest_version)
latest_version_page.links.each do |link|
case link.href
- when /#{escaped_package}(?:-dev)?_#{escaped_latest_version}_win32\.zip\z/,
- /#{escaped_package}(?:-dev)?-#{escaped_latest_version}-win32\.zip\z/, # old
+ when /#{escaped_package}(?:-dev)?_#{escaped_latest_version}_#{suffix}\.zip\z/,
+ /#{escaped_package}(?:-dev)?-#{escaped_latest_version}-#{suffix}\.zip\z/, # old
/#{escaped_package}(?:-dev)?-#{escaped_latest_version}\.zip\z/ # old
click_zip_link(link)
end
@@ -116,6 +121,7 @@ class GNOME2Win32BinaryDownloadTask
end
def download_dependency(dependency)
+ suffix = build_architecture_suffix
dependency_version = "any"
dependency_version_re = /[\d\.\-]+/
if dependency.is_a?(Array)
@@ -127,7 +133,7 @@ class GNOME2Win32BinaryDownloadTask
dependencies_page = agent.get(dependencies_url)
latest_version = dependencies_page.links.collect do |link|
case link.href
- when /\A#{escaped_dependency}_(#{dependency_version_re})_win32\.zip\z/
+ when /\A#{escaped_dependency}_(#{dependency_version_re})_#{suffix}\.zip\z/
version = $1
[version.split(/[\.\-]/).collect {|component| component.to_i}, version]
else
@@ -145,7 +151,7 @@ class GNOME2Win32BinaryDownloadTask
escaped_latest_version = Regexp.escape(latest_version)
dependencies_page.links.each do |link|
case link.href
- when /\A#{escaped_dependency}(?:-dev)?_#{escaped_latest_version}_win32\.zip\z/
+ when /\A#{escaped_dependency}(?:-dev)?_#{escaped_latest_version}_#{suffix}\.zip\z/
click_zip_link(link)
end
end
diff --git a/glib2/lib/mkmf-gnome2.rb b/glib2/lib/mkmf-gnome2.rb
index c665d05..6340838 100644
--- a/glib2/lib/mkmf-gnome2.rb
+++ b/glib2/lib/mkmf-gnome2.rb
@@ -16,9 +16,51 @@ require 'glib-mkenums'
$CFLAGS += " #{ENV['CFLAGS']}" if ENV['CFLAGS']
+def gcc?
+ CONFIG["GCC"] == "yes"
+end
+
+def disable_optimization_build_flag(flags)
+ if gcc?
+ flags.gsub(/(^|\s)?-O\d(\s|$)?/, '\\1-O0\\2')
+ else
+ flags
+ end
+end
+
+def enable_debug_build_flag(flags)
+ if gcc?
+ debug_option_pattern = /(^|\s)?-g\d?(\s|$)?/
+ if debug_option_pattern =~ flags
+ flags.gsub(debug_option_pattern, '\\1-g3\\2')
+ else
+ flags + " -g3"
+ end
+ else
+ flags
+ end
+end
+
+checking_for(checking_message("--enable-debug-build option")) do
+ enable_debug_build = enable_config("debug-build", false)
+ if enable_debug_build
+ $CFLAGS = disable_optimization_build_flag($CFLAGS)
+ $CFLAGS = enable_debug_build_flag($CFLAGS)
+
+ CONFIG["CXXFLAGS"] = disable_optimization_build_flag(CONFIG["CXXFLAGS"])
+ CONFIG["CXXFLAGS"] = enable_debug_build_flag(CONFIG["CXXFLAGS"])
+ end
+ enable_debug_build
+end
+
def try_compiler_option(opt, &block)
checking_for "#{opt} option to compiler" do
- $CFLAGS += " #{opt}" if try_compile '', opt, &block
+ if try_compile '', opt + " -Werror", &block
+ $CFLAGS += " #{opt}"
+ true
+ else
+ false
+ end
end
end
@@ -52,6 +94,7 @@ try_compiler_option '-Wswitch-enum'
try_compiler_option '-Wundef'
# NOTE: Incredible amounts of false positives.
#try_compiler_option '-Wunreachable-code'
+try_compiler_option '-Wout-of-line-declaration'
try_compiler_option '-Wunsafe-loop-optimizations'
try_compiler_option '-Wwrite-strings'
@@ -66,8 +109,8 @@ if ENV['GTK_BASEPATH'] and /cygwin/ !~ RUBY_PLATFORM
$CFLAGS += " -I#{include_path} "
end
-def setup_win32(target_name, base_dir=nil)
- checking_for(checking_message("Win32 OS")) do
+def setup_windows(target_name, base_dir=nil)
+ checking_for(checking_message("Windows")) do
case RUBY_PLATFORM
when /cygwin|mingw|mswin/
import_library_name = "libruby-#{target_name}.a"
@@ -87,6 +130,10 @@ def setup_win32(target_name, base_dir=nil)
end
end
end
+# For backward compatibility
+def setup_win32(*args, &block)
+ setup_windows(*args, &block)
+end
def find_gem_spec(package)
begin
@@ -142,6 +189,17 @@ def add_depend_package_path(target_name, target_source_dir, target_build_dir)
$INCFLAGS = "-I#{target_source_dir} #{$INCFLAGS}"
end
+ case RUBY_PLATFORM
+ when /cygwin|mingw|mswin/
+ target_base_dir = Pathname.new(target_source_dir).parent.parent
+ target_binary_base_dir = target_base_dir + "vendor" + "local"
+ if target_binary_base_dir.exist?
+ $INCFLAGS = "-I#{target_binary_base_dir}/include #{$INCFLAGS}"
+ target_pkg_config_dir = target_binary_base_dir + "lib" + "pkgconfig"
+ PKGConfig.add_path(target_pkg_config_dir.to_s)
+ end
+ end
+
return unless File.exist?(target_build_dir)
if target_source_dir != target_build_dir
$INCFLAGS = "-I#{target_build_dir} #{$INCFLAGS}"
@@ -158,13 +216,6 @@ def add_depend_package_path(target_name, target_source_dir, target_build_dir)
$DLDFLAGS << " /libpath:#{target_build_dir}"
$libs << " lib#{library_base_name}.lib"
end
- target_base_dir = Pathname.new(target_source_dir).parent.parent
- target_binary_base_dir = target_base_dir + "vendor" + "local"
- if target_binary_base_dir.exist?
- $INCFLAGS = "-I#{target_binary_base_dir}/include #{$INCFLAGS}"
- target_pkg_config_dir = target_binary_base_dir + "lib" + "pkgconfig"
- PKGConfig.add_path(target_pkg_config_dir.to_s)
- end
end
end
@@ -399,7 +450,27 @@ def glib_mkenums(prefix, files, g_type_prefix, include_files, options={})
end
def check_cairo(options={})
+ is_windows = (/mingw|cygwin|mswin/ === RUBY_PLATFORM)
+
rcairo_source_dir = options[:rcairo_source_dir]
+ if rcairo_source_dir.nil?
+ suffix = nil
+ if is_windows
+ case RUBY_PLATFORM
+ when /\Ax86-mingw/
+ suffix = "win32"
+ when /\Ax64-mingw/
+ suffix = "win64"
+ end
+ end
+ rcairo_source_base_dir = "rcairo"
+ rcairo_source_base_dir << ".#{suffix}" if suffix
+ top_dir = options[:top_dir]
+ if top_dir
+ rcairo_source_dir = File.join(top_dir, "..", rcairo_source_base_dir)
+ end
+ end
+
if rcairo_source_dir and !File.exist?(rcairo_source_dir)
rcairo_source_dir = nil
end
@@ -409,7 +480,7 @@ def check_cairo(options={})
end
unless rcairo_source_dir.nil?
- if /mingw|cygwin|mswin/ =~ RUBY_PLATFORM
+ if is_windows
options = {}
build_dir = "tmp/#{RUBY_PLATFORM}/cairo/#{RUBY_VERSION}"
if File.exist?(File.join(rcairo_source_dir, build_dir))
@@ -431,6 +502,8 @@ def package_platform
:fedora
elsif File.exist?("/etc/redhat-release")
:redhat
+ elsif File.exist?("/etc/SuSE-release")
+ :suse
elsif find_executable("brew")
:homebrew
elsif find_executable("port")
@@ -448,6 +521,7 @@ def normalize_native_package_info(native_package_info)
native_package_info ||= {}
native_package_info = native_package_info.dup
native_package_info[:fedora] ||= native_package_info[:redhat]
+ native_package_info[:suse] ||= native_package_info[:fedora]
native_package_info
end
@@ -457,17 +531,21 @@ def install_missing_native_package(native_package_info)
package = native_package_info[platform]
return false if package.nil?
+ package_name, *options = package
+ package_command_line = [package_name, *options].join(" ")
need_super_user_priviledge = true
case platform
when :debian
- install_command = "apt-get install -V -y #{package}"
+ install_command = "apt-get install -V -y #{package_command_line}"
when :fedora, :redhat
- install_command = "yum install -y #{package}"
+ install_command = "yum install -y #{package_command_line}"
+ when :suse
+ install_command = "zypper --non-interactive install #{package_command_line}"
when :homebrew
need_super_user_priviledge = false
- install_command = "brew install #{package}"
+ install_command = "brew install #{package_command_line}"
when :macports
- install_command = "port install -y #{package}"
+ install_command = "port install -y #{package_command_line}"
else
return false
end
@@ -477,14 +555,14 @@ def install_missing_native_package(native_package_info)
sudo = find_executable("sudo")
end
- installing_message = "installing '#{package}' native package... "
+ installing_message = "installing '#{package_name}' native package... "
message("%s", installing_message)
failed_to_get_super_user_priviledge = false
if have_priviledge
succeeded = xsystem(install_command)
else
if sudo
- prompt = "[sudo] password for %u to install <#{package}>: "
+ prompt = "[sudo] password for %u to install <#{package_name}>: "
sudo_options = "-p #{Shellwords.escape(prompt)}"
install_command = "#{sudo} #{sudo_options} #{install_command}"
succeeded = xsystem(install_command)
@@ -508,7 +586,7 @@ def install_missing_native_package(native_package_info)
unless succeeded
if failed_to_get_super_user_priviledge
error_message = <<-EOM
-'#{package}' native package is required.
+'#{package_name}' native package is required.
run the following command as super user to install required native package:
\# #{install_command}
EOM
@@ -557,4 +635,3 @@ check_ruby_func
if /mingw/ =~ RUBY_PLATFORM
$ruby.gsub!('\\', '/')
end
-
diff --git a/glib2/test/test_file_utils.rb b/glib2/test/test_file_utils.rb
index 1c65c8b..ebc9e41 100644
--- a/glib2/test/test_file_utils.rb
+++ b/glib2/test/test_file_utils.rb
@@ -12,4 +12,42 @@ class TestGLibFileUtils < Test::Unit::TestCase
assert_equal("1.5 MB", GLib.format_size_for_display(1024 * 1024 * 1.5))
assert_equal("1.0 GB", GLib.format_size_for_display(1024 * 1024 * 1024))
end
+
+ sub_test_case "#format_size" do
+ def setup
+ only_glib_version(2, 30, 0)
+ end
+
+ def test_kb
+ assert_equal("1.0 kB", GLib.format_size(1000))
+ end
+
+ def test_mb
+ assert_equal("1.0 MB", GLib.format_size(1000 * 1000))
+ end
+
+ def test_gb
+ assert_equal("1.0 GB", GLib.format_size(1000 * 1000 * 1000))
+ end
+
+ sub_test_case "flags" do
+ sub_test_case ":iec_units" do
+ def format_size(size)
+ GLib.format_size(size, :flags => :iec_units)
+ end
+
+ def test_kib
+ assert_equal("1.0 KiB", format_size(1024))
+ end
+
+ def test_mib
+ assert_equal("1.0 MiB", format_size(1024 * 1024))
+ end
+
+ def test_gib
+ assert_equal("1.0 GiB", format_size(1024 * 1024 * 1024))
+ end
+ end
+ end
+ end
end
diff --git a/glib2/test/test_source.rb b/glib2/test/test_source.rb
index ee932db..1432851 100644
--- a/glib2/test/test_source.rb
+++ b/glib2/test/test_source.rb
@@ -22,8 +22,42 @@ class TestGLibSource < Test::Unit::TestCase
def test_time
context = GLib::MainContext.default
source = GLib::Idle.source_new
- source.attach(context)
- time = source.time
- assert_operator(0, :<, time)
+ id = source.attach(context)
+ begin
+ time = source.time
+ assert_operator(0, :<, time)
+ ensure
+ GLib::Source.remove(id)
+ end
+ end
+
+ def test_destroy
+ context = GLib::MainContext.new
+ source = GLib::Idle.source_new
+ id = source.attach(context)
+ assert_not_nil(context.find_source(id))
+ source.destroy
+ assert_nil(context.find_source(id))
+ end
+
+ def test_name
+ only_glib_version(2, 26, 0)
+
+ source = GLib::Idle.source_new
+ assert_nil(source.name)
+
+ source_name = "glib source"
+ source.name = source_name
+ assert_equal(source_name, source.name)
+ end
+
+ def test_ready_time
+ only_glib_version(2, 36, 0)
+
+ source = GLib::Idle.source_new
+
+ ready_time = 5
+ source.ready_time = 5
+ assert_equal(ready_time, source.ready_time)
end
end
diff --git a/gobject-introspection/Makefile b/gobject-introspection/Makefile
new file mode 100644
index 0000000..0cfd172
--- /dev/null
+++ b/gobject-introspection/Makefile
@@ -0,0 +1,20 @@
+all:
+ (cd ext/gobject-introspection && $(MAKE))
+ $(MAKE) -f Makefile.lib
+
+install:
+ (cd ext/gobject-introspection && $(MAKE) install)
+ $(MAKE) -f Makefile.lib install
+
+site-install:
+ (cd ext/gobject-introspection && $(MAKE) site-install)
+ $(MAKE) -f Makefile.lib site-install
+
+clean:
+ (cd ext/gobject-introspection && $(MAKE) clean)
+ $(MAKE) -f Makefile.lib clean
+
+distclean:
+ (cd ext/gobject-introspection && $(MAKE) distclean)
+ $(MAKE) -f Makefile.lib distclean
+ @rm -f Makefile.lib
diff --git a/gobject-introspection/Makefile.lib b/gobject-introspection/Makefile.lib
new file mode 100644
index 0000000..eb0a491
--- /dev/null
+++ b/gobject-introspection/Makefile.lib
@@ -0,0 +1,232 @@
+
+SHELL = /bin/sh
+
+# V=0 quiet, V=1 verbose. other values don't work.
+V = 0
+Q1 = $(V:1=)
+Q = $(Q1:0=@)
+ECHO1 = $(V:1=@:)
+ECHO = $(ECHO1:0=@echo)
+
+#### Start of system configuration section. ####
+
+srcdir = /home/kou/work/ruby/ruby-gnome2.clean/gobject-introspection
+topdir = /usr/include/ruby-2.1.0
+hdrdir = $(topdir)
+arch_hdrdir = /usr/include/x86_64-linux-gnu/ruby-2.1.0
+PATH_SEPARATOR = :
+VPATH = $(srcdir):$(arch_hdrdir)/ruby:$(hdrdir)/ruby
+prefix = $(DESTDIR)/usr
+rubysitearchprefix = $(sitearchlibdir)/$(RUBY_BASE_NAME)
+rubyarchprefix = $(archlibdir)/$(RUBY_BASE_NAME)
+rubylibprefix = $(libdir)/$(RUBY_BASE_NAME)
+exec_prefix = $(prefix)
+vendorarchhdrdir = $(sitearchincludedir)/$(RUBY_VERSION_NAME)/vendor_ruby
+sitearchhdrdir = $(sitearchincludedir)/$(RUBY_VERSION_NAME)/site_ruby
+rubyarchhdrdir = $(archincludedir)/$(RUBY_VERSION_NAME)
+vendorhdrdir = $(rubyhdrdir)/vendor_ruby
+sitehdrdir = $(rubyhdrdir)/site_ruby
+rubyhdrdir = $(includedir)/$(RUBY_VERSION_NAME)
+vendorarchdir = $(rubysitearchprefix)/vendor_ruby/$(ruby_version)
+vendorlibdir = $(vendordir)/$(ruby_version)
+vendordir = $(rubylibprefix)/vendor_ruby
+sitearchdir = $(DESTDIR)/usr/local/lib/x86_64-linux-gnu/site_ruby
+sitelibdir = $(sitedir)/$(ruby_version)
+sitedir = $(DESTDIR)/usr/local/lib/site_ruby
+rubyarchdir = $(rubyarchprefix)/$(ruby_version)
+rubylibdir = $(rubylibprefix)/$(ruby_version)
+sitearchincludedir = $(includedir)/$(sitearch)
+archincludedir = $(includedir)/$(arch)
+sitearchlibdir = $(libdir)/$(sitearch)
+archlibdir = $(libdir)/$(arch)
+ridir = $(datarootdir)/$(RI_BASE_NAME)
+mandir = $(prefix)/share/man
+localedir = $(datarootdir)/locale
+libdir = $(exec_prefix)/lib
+psdir = $(docdir)
+pdfdir = $(docdir)
+dvidir = $(docdir)
+htmldir = $(docdir)
+infodir = $(prefix)/share/info
+docdir = $(datarootdir)/doc/$(PACKAGE)
+oldincludedir = $(DESTDIR)/usr/include
+includedir = $(prefix)/include
+localstatedir = $(DESTDIR)/var
+sharedstatedir = $(prefix)/com
+sysconfdir = $(DESTDIR)/etc
+datadir = $(datarootdir)
+datarootdir = $(prefix)/share
+libexecdir = $(prefix)/lib/ruby2.1
+sbindir = $(exec_prefix)/sbin
+bindir = $(exec_prefix)/bin
+archdir = $(rubyarchdir)
+
+
+CC = gcc
+CXX = g++
+LIBRUBY = $(LIBRUBY_SO)
+LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
+LIBRUBYARG_SHARED = -l$(RUBY_SO_NAME)
+LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)-static
+empty =
+OUTFLAG = -o $(empty)
+COUTFLAG = -o $(empty)
+
+RUBY_EXTCONF_H =
+cflags = $(optflags) $(debugflags) $(warnflags)
+optflags = -O3 -fno-fast-math
+debugflags = -ggdb3
+warnflags = -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration
+CCDLFLAGS = -fPIC
+CFLAGS = $(CCDLFLAGS) -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fPIC $(ARCH_FLAG)
+INCFLAGS = -I. -I$(arch_hdrdir) -I$(hdrdir)/ruby/backward -I$(hdrdir) -I$(srcdir)
+DEFS =
+CPPFLAGS = -D_FORTIFY_SOURCE=2 $(DEFS) $(cppflags)
+CXXFLAGS = $(CCDLFLAGS) -g -O2 -fstack-protector-strong -Wformat -Werror=format-security $(ARCH_FLAG)
+ldflags = -L. -Wl,-z,relro -L/build/ruby2.1-64qTCU/ruby2.1-2.1.5/debian/lib -fstack-protector -rdynamic -Wl,-export-dynamic
+dldflags =
+ARCH_FLAG =
+DLDFLAGS = $(ldflags) $(dldflags) $(ARCH_FLAG)
+LDSHARED = $(CC) -shared
+LDSHAREDXX = $(CXX) -shared
+AR = ar
+EXEEXT =
+
+RUBY_INSTALL_NAME = ruby2.1
+RUBY_SO_NAME = ruby-2.1
+RUBYW_INSTALL_NAME =
+RUBY_VERSION_NAME = $(RUBY_BASE_NAME)-$(ruby_version)
+RUBYW_BASE_NAME = rubyw
+RUBY_BASE_NAME = ruby
+
+arch = x86_64-linux-gnu
+sitearch = $(arch)
+ruby_version = 2.1.0
+ruby = $(bindir)/ruby2.1
+RUBY = $(ruby)
+ruby_headers = $(hdrdir)/ruby.h $(hdrdir)/ruby/ruby.h $(hdrdir)/ruby/defines.h $(hdrdir)/ruby/missing.h $(hdrdir)/ruby/intern.h $(hdrdir)/ruby/st.h $(hdrdir)/ruby/subst.h $(arch_hdrdir)/ruby/config.h
+
+RM = rm -f
+RM_RF = $(RUBY) -run -e rm -- -rf
+RMDIRS = rmdir --ignore-fail-on-non-empty -p
+MAKEDIRS = /bin/mkdir -p
+INSTALL = /usr/bin/install -c
+INSTALL_PROG = $(INSTALL) -m 0755
+INSTALL_DATA = $(INSTALL) -m 644
+COPY = cp
+TOUCH = exit >
+
+#### End of system configuration section. ####
+
+preload =
+
+libpath = . $(archlibdir)
+LIBPATH = -L. -L$(archlibdir)
+DEFFILE =
+
+CLEANFILES = mkmf.log
+DISTCLEANFILES =
+DISTCLEANDIRS =
+
+extout =
+extout_prefix =
+target_prefix =
+LOCAL_LIBS =
+LIBS = $(LIBRUBYARG_SHARED) -lpthread -lgmp -ldl -lcrypt -lm -lc
+ORIG_SRCS =
+SRCS = $(ORIG_SRCS)
+OBJS =
+HDRS =
+TARGET =
+TARGET_NAME =
+TARGET_ENTRY = Init_$(TARGET_NAME)
+DLLIB =
+EXTSTATIC =
+STATIC_LIB =
+
+TIMESTAMP_DIR = .
+BINDIR = $(bindir)
+RUBYCOMMONDIR = $(sitedir)$(target_prefix)
+RUBYLIBDIR = $(sitelibdir)$(target_prefix)
+RUBYARCHDIR = $(sitearchdir)$(target_prefix)
+HDRDIR = $(rubyhdrdir)/ruby$(target_prefix)
+ARCHHDRDIR = $(rubyhdrdir)/$(arch)/ruby$(target_prefix)
+
+TARGET_SO = $(DLLIB)
+CLEANLIBS = $(TARGET).so
+CLEANOBJS = *.o *.bak
+
+all: Makefile
+static: $(STATIC_LIB)
+.PHONY: all install static install-so install-rb
+.PHONY: clean clean-so clean-static clean-rb
+
+clean-static::
+clean-rb-default::
+clean-rb::
+clean-so::
+clean: clean-so clean-static clean-rb-default clean-rb
+ -$(Q)$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES) .*.time
+
+distclean-rb-default::
+distclean-rb::
+distclean-so::
+distclean-static::
+distclean: clean distclean-so distclean-static distclean-rb-default distclean-rb
+ -$(Q)$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log
+ -$(Q)$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES)
+ -$(Q)$(RMDIRS) $(DISTCLEANDIRS) 2> /dev/null || true
+
+realclean: distclean
+install: install-so install-rb
+
+install-so: Makefile
+install-rb: pre-install-rb install-rb-default
+install-rb-default: pre-install-rb-default
+pre-install-rb: Makefile
+pre-install-rb-default: Makefile
+pre-install-rb-default: $(TIMESTAMP_DIR)/.RUBYLIBDIR.time
+install-rb-default: $(RUBYLIBDIR)/gobject-introspection.rb
+$(RUBYLIBDIR)/gobject-introspection.rb: $(srcdir)/lib/gobject-introspection.rb $(TIMESTAMP_DIR)/.RUBYLIBDIR.time
+ $(Q) $(INSTALL_DATA) $(srcdir)/lib/gobject-introspection.rb $(@D)
+pre-install-rb-default: $(TIMESTAMP_DIR)/.RUBYLIBDIR.-.gobject-introspection.time
+install-rb-default: $(RUBYLIBDIR)/gobject-introspection/struct-info.rb
+$(RUBYLIBDIR)/gobject-introspection/struct-info.rb: $(srcdir)/lib/gobject-introspection/struct-info.rb $(TIMESTAMP_DIR)/.RUBYLIBDIR.-.gobject-introspection.time
+ $(Q) $(INSTALL_DATA) $(srcdir)/lib/gobject-introspection/struct-info.rb $(@D)
+install-rb-default: $(RUBYLIBDIR)/gobject-introspection/union-info.rb
+$(RUBYLIBDIR)/gobject-introspection/union-info.rb: $(srcdir)/lib/gobject-introspection/union-info.rb $(TIMESTAMP_DIR)/.RUBYLIBDIR.-.gobject-introspection.time
+ $(Q) $(INSTALL_DATA) $(srcdir)/lib/gobject-introspection/union-info.rb $(@D)
+install-rb-default: $(RUBYLIBDIR)/gobject-introspection/callable-info.rb
+$(RUBYLIBDIR)/gobject-introspection/callable-info.rb: $(srcdir)/lib/gobject-introspection/callable-info.rb $(TIMESTAMP_DIR)/.RUBYLIBDIR.-.gobject-introspection.time
+ $(Q) $(INSTALL_DATA) $(srcdir)/lib/gobject-introspection/callable-info.rb $(@D)
+install-rb-default: $(RUBYLIBDIR)/gobject-introspection/collection-reader.rb
+$(RUBYLIBDIR)/gobject-introspection/collection-reader.rb: $(srcdir)/lib/gobject-introspection/collection-reader.rb $(TIMESTAMP_DIR)/.RUBYLIBDIR.-.gobject-introspection.time
+ $(Q) $(INSTALL_DATA) $(srcdir)/lib/gobject-introspection/collection-reader.rb $(@D)
+install-rb-default: $(RUBYLIBDIR)/gobject-introspection/boxed-info.rb
+$(RUBYLIBDIR)/gobject-introspection/boxed-info.rb: $(srcdir)/lib/gobject-introspection/boxed-info.rb $(TIMESTAMP_DIR)/.RUBYLIBDIR.-.gobject-introspection.time
+ $(Q) $(INSTALL_DATA) $(srcdir)/lib/gobject-introspection/boxed-info.rb $(@D)
+install-rb-default: $(RUBYLIBDIR)/gobject-introspection/object-info.rb
+$(RUBYLIBDIR)/gobject-introspection/object-info.rb: $(srcdir)/lib/gobject-introspection/object-info.rb $(TIMESTAMP_DIR)/.RUBYLIBDIR.-.gobject-introspection.time
+ $(Q) $(INSTALL_DATA) $(srcdir)/lib/gobject-introspection/object-info.rb $(@D)
+install-rb-default: $(RUBYLIBDIR)/gobject-introspection/interface-info.rb
+$(RUBYLIBDIR)/gobject-introspection/interface-info.rb: $(srcdir)/lib/gobject-introspection/interface-info.rb $(TIMESTAMP_DIR)/.RUBYLIBDIR.-.gobject-introspection.time
+ $(Q) $(INSTALL_DATA) $(srcdir)/lib/gobject-introspection/interface-info.rb $(@D)
+install-rb-default: $(RUBYLIBDIR)/gobject-introspection/repository.rb
+$(RUBYLIBDIR)/gobject-introspection/repository.rb: $(srcdir)/lib/gobject-introspection/repository.rb $(TIMESTAMP_DIR)/.RUBYLIBDIR.-.gobject-introspection.time
+ $(Q) $(INSTALL_DATA) $(srcdir)/lib/gobject-introspection/repository.rb $(@D)
+install-rb-default: $(RUBYLIBDIR)/gobject-introspection/loader.rb
+$(RUBYLIBDIR)/gobject-introspection/loader.rb: $(srcdir)/lib/gobject-introspection/loader.rb $(TIMESTAMP_DIR)/.RUBYLIBDIR.-.gobject-introspection.time
+ $(Q) $(INSTALL_DATA) $(srcdir)/lib/gobject-introspection/loader.rb $(@D)
+pre-install-rb-default:
+ $(ECHO) installing default libraries
+$(TIMESTAMP_DIR)/.RUBYLIBDIR.time:
+ $(Q) $(MAKEDIRS) $(@D) $(RUBYLIBDIR)
+ $(Q) $(TOUCH) $@
+$(TIMESTAMP_DIR)/.RUBYLIBDIR.-.gobject-introspection.time:
+ $(Q) $(MAKEDIRS) $(@D) $(RUBYLIBDIR)/gobject-introspection
+ $(Q) $(TOUCH) $@
+
+site-install: site-install-so site-install-rb
+site-install-so: install-so
+site-install-rb: install-rb
+
diff --git a/gobject-introspection/Rakefile b/gobject-introspection/Rakefile
index 3544792..e5ecd22 100644
--- a/gobject-introspection/Rakefile
+++ b/gobject-introspection/Rakefile
@@ -1,6 +1,6 @@
# -*- ruby -*-
#
-# Copyright (C) 2012-2013 Ruby-GNOME2 Project Team
+# Copyright (C) 2012-2014 Ruby-GNOME2 Project Team
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -32,7 +32,7 @@ package_task = GNOME2::Rake::PackageTask.new do |package|
:name => "glib",
:download_site => :gnome,
:label => "GLib",
- :version => "2.38.2",
+ :version => "2.42.1",
:compression_method => "xz",
:windows => {
:build => false,
@@ -47,7 +47,7 @@ package_task = GNOME2::Rake::PackageTask.new do |package|
:name => "gobject-introspection",
:download_site => :gnome,
:label => "gobject-introspection",
- :version => "1.38.0",
+ :version => "1.42.0",
:compression_method => "xz",
:windows => {
:configure_args => [
@@ -55,7 +55,7 @@ package_task = GNOME2::Rake::PackageTask.new do |package|
"--disable-tests",
],
:patches => [
- "0001-Support-external-g-ir-scanner.patch",
+ "support-external-g-ir-scanner.diff",
],
:need_autoreconf => true,
:built_file => "bin/libgirepository-1.0-1.dll",
@@ -74,16 +74,20 @@ package_task.define
namespace :native do
namespace :"gobject-introspection" do
- desc "Make g-ir-scanner workable for Windows on non Windows"
- task :cross do
- g_ir_scanner_dir = package_task.native.absolute_binary_dir
- g_ir_scanner_dir += "lib/gobject-introspection/giscanner"
+ g_ir_scanner_dir = package_task.native.absolute_binary_dir
+ g_ir_scanner_dir += "lib/gobject-introspection/giscanner"
+ patched_path = g_ir_scanner_dir + "patched"
+ file patched_path.to_s do
Dir.chdir(g_ir_scanner_dir.to_s) do
patch = "#{package_task.package.patches_dir}/cross-g-ir-scanner.diff"
sh("patch -p2 < #{patch}")
rm_f(Dir.glob("*.{pyc,pyo}"))
end
+ touch(patched_path)
end
+
+ desc "Make g-ir-scanner workable for Windows on non Windows"
+ task :cross => patched_path
end
namespace :builder do
@@ -91,12 +95,12 @@ namespace :native do
end
end
-namespace :win32 do
+namespace :windows do
namespace :"gobject-introspection" do
- desc "Use native tools"
- task :cross do
- pkg_config_dir = package_task.windows.absolute_binary_dir + "lib/pkgconfig"
- pc_path = pkg_config_dir + "gobject-introspection-1.0.pc"
+ pkg_config_dir = package_task.windows.absolute_binary_dir + "lib/pkgconfig"
+ pc_path = pkg_config_dir + "gobject-introspection-1.0.pc"
+ patched_path = pkg_config_dir + "patched"
+ file patched_path.to_s do
original_pc = pc_path.read
new_pc = ""
new_pc << "native_prefix=#{package_task.native.absolute_binary_dir}\n"
@@ -104,7 +108,7 @@ namespace :win32 do
original_pc.each_line do |line|
case line
when /\Ag_ir_(scanner|compiler)=/
- new_pc << line.gsub(/\${bindir}/, "${native_bindir}")
+ new_pc << line.gsub(/\${bindir}/, "${native_bindir}").gsub(/\.exe/, "")
else
new_pc << line
end
@@ -112,10 +116,14 @@ namespace :win32 do
pc_path.open("w") do |pc_file|
pc_file.write(new_pc)
end
+ touch(patched_path)
end
+
+ desc "Use native tools"
+ task :cross => patched_path.to_s
end
namespace :builder do
- task :after => "win32:gobject-introspection:cross"
+ task :after => "windows:gobject-introspection:cross"
end
end
diff --git a/gobject-introspection/ext/gobject-introspection/Makefile b/gobject-introspection/ext/gobject-introspection/Makefile
new file mode 100644
index 0000000..975c432
--- /dev/null
+++ b/gobject-introspection/ext/gobject-introspection/Makefile
@@ -0,0 +1,248 @@
+
+SHELL = /bin/sh
+
+# V=0 quiet, V=1 verbose. other values don't work.
+V = 0
+Q1 = $(V:1=)
+Q = $(Q1:0=@)
+ECHO1 = $(V:1=@:)
+ECHO = $(ECHO1:0=@echo)
+
+#### Start of system configuration section. ####
+
+srcdir = /home/kou/work/ruby/ruby-gnome2.clean/gobject-introspection/ext/gobject-introspection
+topdir = /usr/include/ruby-2.1.0
+hdrdir = $(topdir)
+arch_hdrdir = /usr/include/x86_64-linux-gnu/ruby-2.1.0
+PATH_SEPARATOR = :
+VPATH = $(srcdir):$(arch_hdrdir)/ruby:$(hdrdir)/ruby
+prefix = $(DESTDIR)/usr
+rubysitearchprefix = $(sitearchlibdir)/$(RUBY_BASE_NAME)
+rubyarchprefix = $(archlibdir)/$(RUBY_BASE_NAME)
+rubylibprefix = $(libdir)/$(RUBY_BASE_NAME)
+exec_prefix = $(prefix)
+vendorarchhdrdir = $(sitearchincludedir)/$(RUBY_VERSION_NAME)/vendor_ruby
+sitearchhdrdir = $(sitearchincludedir)/$(RUBY_VERSION_NAME)/site_ruby
+rubyarchhdrdir = $(archincludedir)/$(RUBY_VERSION_NAME)
+vendorhdrdir = $(rubyhdrdir)/vendor_ruby
+sitehdrdir = $(rubyhdrdir)/site_ruby
+rubyhdrdir = $(includedir)/$(RUBY_VERSION_NAME)
+vendorarchdir = $(rubysitearchprefix)/vendor_ruby/$(ruby_version)
+vendorlibdir = $(vendordir)/$(ruby_version)
+vendordir = $(rubylibprefix)/vendor_ruby
+sitearchdir = $(DESTDIR)/usr/local/lib/x86_64-linux-gnu/site_ruby
+sitelibdir = $(sitedir)/$(ruby_version)
+sitedir = $(DESTDIR)/usr/local/lib/site_ruby
+rubyarchdir = $(rubyarchprefix)/$(ruby_version)
+rubylibdir = $(rubylibprefix)/$(ruby_version)
+sitearchincludedir = $(includedir)/$(sitearch)
+archincludedir = $(includedir)/$(arch)
+sitearchlibdir = $(libdir)/$(sitearch)
+archlibdir = $(libdir)/$(arch)
+ridir = $(datarootdir)/$(RI_BASE_NAME)
+mandir = $(prefix)/share/man
+localedir = $(datarootdir)/locale
+libdir = $(exec_prefix)/lib
+psdir = $(docdir)
+pdfdir = $(docdir)
+dvidir = $(docdir)
+htmldir = $(docdir)
+infodir = $(prefix)/share/info
+docdir = $(datarootdir)/doc/$(PACKAGE)
+oldincludedir = $(DESTDIR)/usr/include
+includedir = $(prefix)/include
+localstatedir = $(DESTDIR)/var
+sharedstatedir = $(prefix)/com
+sysconfdir = $(DESTDIR)/etc
+datadir = $(datarootdir)
+datarootdir = $(prefix)/share
+libexecdir = $(prefix)/lib/ruby2.1
+sbindir = $(exec_prefix)/sbin
+bindir = $(exec_prefix)/bin
+archdir = $(rubyarchdir)
+
+
+CC = gcc
+CXX = g++
+LIBRUBY = $(LIBRUBY_SO)
+LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
+LIBRUBYARG_SHARED = -l$(RUBY_SO_NAME)
+LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)-static
+empty =
+OUTFLAG = -o $(empty)
+COUTFLAG = -o $(empty)
+
+RUBY_EXTCONF_H =
+cflags = $(optflags) $(debugflags) $(warnflags)
+optflags = -O3 -fno-fast-math
+debugflags = -ggdb3
+warnflags = -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration
+CCDLFLAGS = -fPIC
+CFLAGS = $(CCDLFLAGS) -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fPIC -Wall -Waggregate-return -Wcast-align -Wextra -Wformat=2 -Winit-self -Wlarger-than-65500 -Wmissing-declarations -Wmissing-format-attribute -Wmissing-include-dirs -Wmissing-noreturn -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpacked -Wp,-D_FORTIFY_SOURCE=2 -Wpointer-arith -Wswitch-default -Wswitch-enum -Wundef -Wunsafe-loop-optimizations -Wwrite-strings -pthread -I/usr/include [...]
+INCFLAGS = -I. -I/home/kou/work/ruby/ruby-gnome2.clean/glib2/ext/glib2 -I/home/kou/work/ruby/ruby-gnome2.clean/glib2/ext/glib2 -I/home/kou/work/ruby/ruby-gnome2.clean/glib2/ext/glib2 -I/home/kou/work/ruby/ruby-gnome2.clean/glib2/ext/glib2 -I/var/lib/gems/2.1.0/gems/glib2-2.2.3/ext/glib2 -I$(arch_hdrdir) -I$(hdrdir)/ruby/backward -I$(hdrdir) -I$(srcdir) -I$(vendorarchdir)
+DEFS =
+CPPFLAGS = -DHAVE_RB_DEFINE_ALLOC_FUNC -DHAVE_RB_BLOCK_PROC -DHAVE_OBJECT_ALLOCATE -DHAVE_G_INTERFACE_INFO_FIND_SIGNAL -DRUBY_GOBJECT_INTROSPECTION_COMPILATION -D_FORTIFY_SOURCE=2 $(DEFS) $(cppflags)
+CXXFLAGS = $(CCDLFLAGS) -g -O2 -fstack-protector-strong -Wformat -Werror=format-security $(ARCH_FLAG)
+ldflags = -L. -Wl,-z,relro -L/build/ruby2.1-64qTCU/ruby2.1-2.1.5/debian/lib -fstack-protector -rdynamic -Wl,-export-dynamic -L/usr/lib/x86_64-linux-gnu
+dldflags =
+ARCH_FLAG =
+DLDFLAGS = $(ldflags) $(dldflags) $(ARCH_FLAG)
+LDSHARED = $(CC) -shared
+LDSHAREDXX = $(CXX) -shared
+AR = ar
+EXEEXT =
+
+RUBY_INSTALL_NAME = ruby2.1
+RUBY_SO_NAME = ruby-2.1
+RUBYW_INSTALL_NAME =
+RUBY_VERSION_NAME = $(RUBY_BASE_NAME)-$(ruby_version)
+RUBYW_BASE_NAME = rubyw
+RUBY_BASE_NAME = ruby
+
+arch = x86_64-linux-gnu
+sitearch = $(arch)
+ruby_version = 2.1.0
+ruby = $(bindir)/ruby2.1
+RUBY = $(ruby)
+ruby_headers = $(hdrdir)/ruby.h $(hdrdir)/ruby/ruby.h $(hdrdir)/ruby/defines.h $(hdrdir)/ruby/missing.h $(hdrdir)/ruby/intern.h $(hdrdir)/ruby/st.h $(hdrdir)/ruby/subst.h $(arch_hdrdir)/ruby/config.h
+
+RM = rm -f
+RM_RF = $(RUBY) -run -e rm -- -rf
+RMDIRS = rmdir --ignore-fail-on-non-empty -p
+MAKEDIRS = /bin/mkdir -p
+INSTALL = /usr/bin/install -c
+INSTALL_PROG = $(INSTALL) -m 0755
+INSTALL_DATA = $(INSTALL) -m 644
+COPY = cp
+TOUCH = exit >
+
+#### End of system configuration section. ####
+
+preload =
+
+libpath = . $(archlibdir)
+LIBPATH = -L. -L$(archlibdir)
+DEFFILE =
+
+CLEANFILES = mkmf.log
+DISTCLEANFILES = rbgiversion.h gobject-introspection-enum-types.h gobject-introspection-enum-types.c ruby-gobject-introspection.pc
+DISTCLEANDIRS =
+
+extout =
+extout_prefix =
+target_prefix =
+LOCAL_LIBS =
+LIBS = $(LIBRUBYARG_SHARED) -lgirepository-1.0 -lglib-2.0 -lgobject-2.0 -lpthread -lgmp -ldl -lcrypt -lm -lc
+ORIG_SRCS = rb-gi-method-info.c rb-gi-constructor-info.c rb-gi-field-info.c rb-gi-callback-info.c rb-gi-registered-type-info.c rb-gi-type-tag.c rb-gi-object-info.c rb-gobject-introspection.c gobject-introspection-enum-types.c rb-gi-boxed-info.c rb-gi-vfunc-info.c rb-gi-signal-info.c rb-gi-constant-info.c rb-gi-flags-info.c rb-gi-property-info.c rb-gi-value-info.c rb-gi-enum-info.c rb-gi-loader.c rb-gi-interface-info.c rb-gi-argument.c rb-gi-arg-info.c rb-gi-repository.c rb-gi-type-info.c [...]
+SRCS = $(ORIG_SRCS) rb-gi-method-info.c rb-gi-constructor-info.c rb-gi-field-info.c rb-gi-callback-info.c rb-gi-registered-type-info.c rb-gi-type-tag.c rb-gi-object-info.c rb-gobject-introspection.c gobject-introspection-enum-types.c rb-gi-boxed-info.c rb-gi-vfunc-info.c rb-gi-signal-info.c rb-gi-constant-info.c rb-gi-flags-info.c rb-gi-property-info.c rb-gi-value-info.c rb-gi-enum-info.c rb-gi-loader.c rb-gi-interface-info.c rb-gi-argument.c rb-gi-arg-info.c rb-gi-repository.c rb-gi-typ [...]
+OBJS = rb-gi-method-info.o rb-gi-constructor-info.o rb-gi-field-info.o rb-gi-callback-info.o rb-gi-registered-type-info.o rb-gi-type-tag.o rb-gi-object-info.o rb-gobject-introspection.o gobject-introspection-enum-types.o rb-gi-boxed-info.o rb-gi-vfunc-info.o rb-gi-signal-info.o rb-gi-constant-info.o rb-gi-flags-info.o rb-gi-property-info.o rb-gi-value-info.o rb-gi-enum-info.o rb-gi-loader.o rb-gi-interface-info.o rb-gi-argument.o rb-gi-arg-info.o rb-gi-repository.o rb-gi-type-info.o rb-g [...]
+HDRS = $(srcdir)/gobject-introspection-enum-types.h $(srcdir)/rb-gi-types.h $(srcdir)/rb-gobject-introspection.h $(srcdir)/rbgiversion.h $(srcdir)/rb-gi-private.h $(srcdir)/rb-gi-conversions.h
+TARGET = gobject_introspection
+TARGET_NAME = gobject_introspection
+TARGET_ENTRY = Init_$(TARGET_NAME)
+DLLIB = $(TARGET).so
+EXTSTATIC =
+STATIC_LIB =
+
+TIMESTAMP_DIR = .
+BINDIR = $(bindir)
+RUBYCOMMONDIR = $(sitedir)$(target_prefix)
+RUBYLIBDIR = $(sitelibdir)$(target_prefix)
+RUBYARCHDIR = $(sitearchdir)$(target_prefix)
+HDRDIR = $(rubyhdrdir)/ruby$(target_prefix)
+ARCHHDRDIR = $(rubyhdrdir)/$(arch)/ruby$(target_prefix)
+
+TARGET_SO = $(DLLIB)
+CLEANLIBS = $(TARGET).so
+CLEANOBJS = *.o *.bak
+
+all: $(DLLIB)
+static: $(STATIC_LIB)
+.PHONY: all install static install-so install-rb
+.PHONY: clean clean-so clean-static clean-rb
+
+clean-static::
+clean-rb-default::
+clean-rb::
+clean-so::
+clean: clean-so clean-static clean-rb-default clean-rb
+ -$(Q)$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES) .*.time
+
+distclean-rb-default::
+distclean-rb::
+distclean-so::
+distclean-static::
+distclean: clean distclean-so distclean-static distclean-rb-default distclean-rb
+ -$(Q)$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log
+ -$(Q)$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES)
+ -$(Q)$(RMDIRS) $(DISTCLEANDIRS) 2> /dev/null || true
+
+realclean: distclean
+install: install-so install-rb
+
+install-so: $(DLLIB) $(TIMESTAMP_DIR)/.RUBYARCHDIR.time
+ $(INSTALL_PROG) $(DLLIB) $(RUBYARCHDIR)
+clean-static::
+ -$(Q)$(RM) $(STATIC_LIB)
+install-rb: pre-install-rb install-rb-default
+install-rb-default: pre-install-rb-default
+pre-install-rb: Makefile
+pre-install-rb-default: Makefile
+pre-install-rb-default:
+ $(ECHO) installing default gobject_introspection libraries
+$(TIMESTAMP_DIR)/.RUBYARCHDIR.time:
+ $(Q) $(MAKEDIRS) $(@D) $(RUBYARCHDIR)
+ $(Q) $(TOUCH) $@
+
+site-install: site-install-so site-install-rb
+site-install-so: install-so
+site-install-rb: install-rb
+
+.SUFFIXES: .c .m .cc .mm .cxx .cpp .C .o
+
+.cc.o:
+ $(ECHO) compiling $(<)
+ $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
+
+.mm.o:
+ $(ECHO) compiling $(<)
+ $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
+
+.cxx.o:
+ $(ECHO) compiling $(<)
+ $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
+
+.cpp.o:
+ $(ECHO) compiling $(<)
+ $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
+
+.C.o:
+ $(ECHO) compiling $(<)
+ $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
+
+.c.o:
+ $(ECHO) compiling $(<)
+ $(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $<
+
+.m.o:
+ $(ECHO) compiling $(<)
+ $(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $<
+
+$(DLLIB): $(OBJS) Makefile
+ $(ECHO) linking shared-object $(DLLIB)
+ -$(Q)$(RM) $(@)
+ $(Q) $(LDSHARED) -o $@ $(OBJS) $(LIBPATH) $(DLDFLAGS) $(LOCAL_LIBS) $(LIBS)
+
+
+
+###
+install-so: install-headers
+install-headers:
+ $(INSTALL_DATA) $(srcdir)/rb-gobject-introspection.h $(RUBYARCHDIR)
+
+install: install-pc
+install-pc:
+ if test -n "$(pkgconfigdir)"; then \
+ $(MAKEDIRS) $(pkgconfigdir); \
+ $(INSTALL_DATA) ruby-gobject-introspection.pc $(pkgconfigdir);\
+ fi
diff --git a/gobject-introspection/ext/gobject-introspection/extconf.rb b/gobject-introspection/ext/gobject-introspection/extconf.rb
index a0b704d..ab69323 100755
--- a/gobject-introspection/ext/gobject-introspection/extconf.rb
+++ b/gobject-introspection/ext/gobject-introspection/extconf.rb
@@ -54,7 +54,7 @@ end
:target_build_dir => build_dir)
end
-setup_win32(module_name, base_dir)
+setup_windows(module_name, base_dir)
unless required_pkg_config_package(package_id,
:debian => "libgirepository1.0-dev",
diff --git a/gobject-introspection/ext/gobject-introspection/gobject-introspection-enum-types.c b/gobject-introspection/ext/gobject-introspection/gobject-introspection-enum-types.c
new file mode 100644
index 0000000..9881ce8
--- /dev/null
+++ b/gobject-introspection/ext/gobject-introspection/gobject-introspection-enum-types.c
@@ -0,0 +1,230 @@
+
+/* Generated by glib-mkenums.rb ($Id$) */
+
+#include "gobject-introspection-enum-types.h"
+#include <girepository.h>
+
+
+
+/* enumerations from "/usr/include/gobject-introspection-1.0/girepository.h" */
+GType
+g_i_repository_load_flags_get_type (void)
+{
+ static GType etype = 0;
+ if (etype == 0) {
+ static const GFlagsValue values[] = {
+ { G_IREPOSITORY_LOAD_FLAG_LAZY, "G_IREPOSITORY_LOAD_FLAG_LAZY", "g-irepository-load-flag-lazy" },
+ { 0, NULL, NULL }
+ };
+ etype = g_flags_register_static ("GIRepositoryLoadFlags", values);
+ }
+ return etype;
+}
+
+GType
+g_i_repository_error_get_type (void)
+{
+ static GType etype = 0;
+ if (etype == 0) {
+ static const GEnumValue values[] = {
+ { G_IREPOSITORY_ERROR_TYPELIB_NOT_FOUND, "G_IREPOSITORY_ERROR_TYPELIB_NOT_FOUND", "typelib-not-found" },
+ { G_IREPOSITORY_ERROR_NAMESPACE_MISMATCH, "G_IREPOSITORY_ERROR_NAMESPACE_MISMATCH", "namespace-mismatch" },
+ { G_IREPOSITORY_ERROR_NAMESPACE_VERSION_CONFLICT, "G_IREPOSITORY_ERROR_NAMESPACE_VERSION_CONFLICT", "namespace-version-conflict" },
+ { G_IREPOSITORY_ERROR_LIBRARY_NOT_FOUND, "G_IREPOSITORY_ERROR_LIBRARY_NOT_FOUND", "library-not-found" },
+ { 0, NULL, NULL }
+ };
+ etype = g_enum_register_static ("GIRepositoryError", values);
+ }
+ return etype;
+}
+
+
+/* enumerations from "/usr/include/gobject-introspection-1.0/gitypes.h" */
+GType
+g_i_info_type_get_type (void)
+{
+ static GType etype = 0;
+ if (etype == 0) {
+ static const GEnumValue values[] = {
+ { GI_INFO_TYPE_INVALID, "GI_INFO_TYPE_INVALID", "invalid" },
+ { GI_INFO_TYPE_FUNCTION, "GI_INFO_TYPE_FUNCTION", "function" },
+ { GI_INFO_TYPE_CALLBACK, "GI_INFO_TYPE_CALLBACK", "callback" },
+ { GI_INFO_TYPE_STRUCT, "GI_INFO_TYPE_STRUCT", "struct" },
+ { GI_INFO_TYPE_BOXED, "GI_INFO_TYPE_BOXED", "boxed" },
+ { GI_INFO_TYPE_ENUM, "GI_INFO_TYPE_ENUM", "enum" },
+ { GI_INFO_TYPE_FLAGS, "GI_INFO_TYPE_FLAGS", "flags" },
+ { GI_INFO_TYPE_OBJECT, "GI_INFO_TYPE_OBJECT", "object" },
+ { GI_INFO_TYPE_INTERFACE, "GI_INFO_TYPE_INTERFACE", "interface" },
+ { GI_INFO_TYPE_CONSTANT, "GI_INFO_TYPE_CONSTANT", "constant" },
+ { GI_INFO_TYPE_INVALID_0, "GI_INFO_TYPE_INVALID_0", "invalid-0" },
+ { GI_INFO_TYPE_UNION, "GI_INFO_TYPE_UNION", "union" },
+ { GI_INFO_TYPE_VALUE, "GI_INFO_TYPE_VALUE", "value" },
+ { GI_INFO_TYPE_SIGNAL, "GI_INFO_TYPE_SIGNAL", "signal" },
+ { GI_INFO_TYPE_VFUNC, "GI_INFO_TYPE_VFUNC", "vfunc" },
+ { GI_INFO_TYPE_PROPERTY, "GI_INFO_TYPE_PROPERTY", "property" },
+ { GI_INFO_TYPE_FIELD, "GI_INFO_TYPE_FIELD", "field" },
+ { GI_INFO_TYPE_ARG, "GI_INFO_TYPE_ARG", "arg" },
+ { GI_INFO_TYPE_TYPE, "GI_INFO_TYPE_TYPE", "type" },
+ { GI_INFO_TYPE_UNRESOLVED, "GI_INFO_TYPE_UNRESOLVED", "unresolved" },
+ { 0, NULL, NULL }
+ };
+ etype = g_enum_register_static ("GIInfoType", values);
+ }
+ return etype;
+}
+
+GType
+g_i_transfer_get_type (void)
+{
+ static GType etype = 0;
+ if (etype == 0) {
+ static const GEnumValue values[] = {
+ { GI_TRANSFER_NOTHING, "GI_TRANSFER_NOTHING", "nothing" },
+ { GI_TRANSFER_CONTAINER, "GI_TRANSFER_CONTAINER", "container" },
+ { GI_TRANSFER_EVERYTHING, "GI_TRANSFER_EVERYTHING", "everything" },
+ { 0, NULL, NULL }
+ };
+ etype = g_enum_register_static ("GITransfer", values);
+ }
+ return etype;
+}
+
+GType
+g_i_direction_get_type (void)
+{
+ static GType etype = 0;
+ if (etype == 0) {
+ static const GEnumValue values[] = {
+ { GI_DIRECTION_IN, "GI_DIRECTION_IN", "in" },
+ { GI_DIRECTION_OUT, "GI_DIRECTION_OUT", "out" },
+ { GI_DIRECTION_INOUT, "GI_DIRECTION_INOUT", "inout" },
+ { 0, NULL, NULL }
+ };
+ etype = g_enum_register_static ("GIDirection", values);
+ }
+ return etype;
+}
+
+GType
+g_i_scope_type_get_type (void)
+{
+ static GType etype = 0;
+ if (etype == 0) {
+ static const GEnumValue values[] = {
+ { GI_SCOPE_TYPE_INVALID, "GI_SCOPE_TYPE_INVALID", "invalid" },
+ { GI_SCOPE_TYPE_CALL, "GI_SCOPE_TYPE_CALL", "call" },
+ { GI_SCOPE_TYPE_ASYNC, "GI_SCOPE_TYPE_ASYNC", "async" },
+ { GI_SCOPE_TYPE_NOTIFIED, "GI_SCOPE_TYPE_NOTIFIED", "notified" },
+ { 0, NULL, NULL }
+ };
+ etype = g_enum_register_static ("GIScopeType", values);
+ }
+ return etype;
+}
+
+GType
+g_i_type_tag_get_type (void)
+{
+ static GType etype = 0;
+ if (etype == 0) {
+ static const GEnumValue values[] = {
+ { GI_TYPE_TAG_VOID, "GI_TYPE_TAG_VOID", "void" },
+ { GI_TYPE_TAG_BOOLEAN, "GI_TYPE_TAG_BOOLEAN", "boolean" },
+ { GI_TYPE_TAG_INT8, "GI_TYPE_TAG_INT8", "int8" },
+ { GI_TYPE_TAG_UINT8, "GI_TYPE_TAG_UINT8", "uint8" },
+ { GI_TYPE_TAG_INT16, "GI_TYPE_TAG_INT16", "int16" },
+ { GI_TYPE_TAG_UINT16, "GI_TYPE_TAG_UINT16", "uint16" },
+ { GI_TYPE_TAG_INT32, "GI_TYPE_TAG_INT32", "int32" },
+ { GI_TYPE_TAG_UINT32, "GI_TYPE_TAG_UINT32", "uint32" },
+ { GI_TYPE_TAG_INT64, "GI_TYPE_TAG_INT64", "int64" },
+ { GI_TYPE_TAG_UINT64, "GI_TYPE_TAG_UINT64", "uint64" },
+ { GI_TYPE_TAG_FLOAT, "GI_TYPE_TAG_FLOAT", "float" },
+ { GI_TYPE_TAG_DOUBLE, "GI_TYPE_TAG_DOUBLE", "double" },
+ { GI_TYPE_TAG_GTYPE, "GI_TYPE_TAG_GTYPE", "gtype" },
+ { GI_TYPE_TAG_UTF8, "GI_TYPE_TAG_UTF8", "utf8" },
+ { GI_TYPE_TAG_FILENAME, "GI_TYPE_TAG_FILENAME", "filename" },
+ { GI_TYPE_TAG_ARRAY, "GI_TYPE_TAG_ARRAY", "array" },
+ { GI_TYPE_TAG_INTERFACE, "GI_TYPE_TAG_INTERFACE", "interface" },
+ { GI_TYPE_TAG_GLIST, "GI_TYPE_TAG_GLIST", "glist" },
+ { GI_TYPE_TAG_GSLIST, "GI_TYPE_TAG_GSLIST", "gslist" },
+ { GI_TYPE_TAG_GHASH, "GI_TYPE_TAG_GHASH", "ghash" },
+ { GI_TYPE_TAG_ERROR, "GI_TYPE_TAG_ERROR", "error" },
+ { GI_TYPE_TAG_UNICHAR, "GI_TYPE_TAG_UNICHAR", "unichar" },
+ { 0, NULL, NULL }
+ };
+ etype = g_enum_register_static ("GITypeTag", values);
+ }
+ return etype;
+}
+
+GType
+g_i_array_type_get_type (void)
+{
+ static GType etype = 0;
+ if (etype == 0) {
+ static const GEnumValue values[] = {
+ { GI_ARRAY_TYPE_C, "GI_ARRAY_TYPE_C", "c" },
+ { GI_ARRAY_TYPE_ARRAY, "GI_ARRAY_TYPE_ARRAY", "array" },
+ { GI_ARRAY_TYPE_PTR_ARRAY, "GI_ARRAY_TYPE_PTR_ARRAY", "ptr-array" },
+ { GI_ARRAY_TYPE_BYTE_ARRAY, "GI_ARRAY_TYPE_BYTE_ARRAY", "byte-array" },
+ { 0, NULL, NULL }
+ };
+ etype = g_enum_register_static ("GIArrayType", values);
+ }
+ return etype;
+}
+
+GType
+g_i_field_info_flags_get_type (void)
+{
+ static GType etype = 0;
+ if (etype == 0) {
+ static const GFlagsValue values[] = {
+ { GI_FIELD_IS_READABLE, "GI_FIELD_IS_READABLE", "readable" },
+ { GI_FIELD_IS_WRITABLE, "GI_FIELD_IS_WRITABLE", "writable" },
+ { 0, NULL, NULL }
+ };
+ etype = g_flags_register_static ("GIFieldInfoFlags", values);
+ }
+ return etype;
+}
+
+GType
+g_iv_func_info_flags_get_type (void)
+{
+ static GType etype = 0;
+ if (etype == 0) {
+ static const GFlagsValue values[] = {
+ { GI_VFUNC_MUST_CHAIN_UP, "GI_VFUNC_MUST_CHAIN_UP", "must-chain-up" },
+ { GI_VFUNC_MUST_OVERRIDE, "GI_VFUNC_MUST_OVERRIDE", "must-override" },
+ { GI_VFUNC_MUST_NOT_OVERRIDE, "GI_VFUNC_MUST_NOT_OVERRIDE", "must-not-override" },
+ { GI_VFUNC_THROWS, "GI_VFUNC_THROWS", "throws" },
+ { 0, NULL, NULL }
+ };
+ etype = g_flags_register_static ("GIVFuncInfoFlags", values);
+ }
+ return etype;
+}
+
+GType
+g_i_function_info_flags_get_type (void)
+{
+ static GType etype = 0;
+ if (etype == 0) {
+ static const GFlagsValue values[] = {
+ { GI_FUNCTION_IS_METHOD, "GI_FUNCTION_IS_METHOD", "is-method" },
+ { GI_FUNCTION_IS_CONSTRUCTOR, "GI_FUNCTION_IS_CONSTRUCTOR", "is-constructor" },
+ { GI_FUNCTION_IS_GETTER, "GI_FUNCTION_IS_GETTER", "is-getter" },
+ { GI_FUNCTION_IS_SETTER, "GI_FUNCTION_IS_SETTER", "is-setter" },
+ { GI_FUNCTION_WRAPS_VFUNC, "GI_FUNCTION_WRAPS_VFUNC", "wraps-vfunc" },
+ { GI_FUNCTION_THROWS, "GI_FUNCTION_THROWS", "throws" },
+ { 0, NULL, NULL }
+ };
+ etype = g_flags_register_static ("GIFunctionInfoFlags", values);
+ }
+ return etype;
+}
+
+
+/* Generated data ends here */
+
diff --git a/gobject-introspection/ext/gobject-introspection/gobject-introspection-enum-types.h b/gobject-introspection/ext/gobject-introspection/gobject-introspection-enum-types.h
new file mode 100644
index 0000000..3489c81
--- /dev/null
+++ b/gobject-introspection/ext/gobject-introspection/gobject-introspection-enum-types.h
@@ -0,0 +1,42 @@
+
+/* Generated by glib-mkenums.rb ($Id$) */
+
+#ifndef __GOBJECT_INTROSPECTION_ENUM_TYPES_H__
+#define __GOBJECT_INTROSPECTION_ENUM_TYPES_H__
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+/* enumerations from "/usr/include/gobject-introspection-1.0/girepository.h" */
+GType g_i_repository_load_flags_get_type (void);
+#define G_TYPE_I_REPOSITORY_LOAD_FLAGS (g_i_repository_load_flags_get_type())
+GType g_i_repository_error_get_type (void);
+#define G_TYPE_I_REPOSITORY_ERROR (g_i_repository_error_get_type())
+
+/* enumerations from "/usr/include/gobject-introspection-1.0/gitypes.h" */
+GType g_i_info_type_get_type (void);
+#define G_TYPE_I_INFO_TYPE (g_i_info_type_get_type())
+GType g_i_transfer_get_type (void);
+#define G_TYPE_I_TRANSFER (g_i_transfer_get_type())
+GType g_i_direction_get_type (void);
+#define G_TYPE_I_DIRECTION (g_i_direction_get_type())
+GType g_i_scope_type_get_type (void);
+#define G_TYPE_I_SCOPE_TYPE (g_i_scope_type_get_type())
+GType g_i_type_tag_get_type (void);
+#define G_TYPE_I_TYPE_TAG (g_i_type_tag_get_type())
+GType g_i_array_type_get_type (void);
+#define G_TYPE_I_ARRAY_TYPE (g_i_array_type_get_type())
+GType g_i_field_info_flags_get_type (void);
+#define G_TYPE_I_FIELD_INFO_FLAGS (g_i_field_info_flags_get_type())
+GType g_iv_func_info_flags_get_type (void);
+#define G_TYPE_IV_FUNC_INFO_FLAGS (g_iv_func_info_flags_get_type())
+GType g_i_function_info_flags_get_type (void);
+#define G_TYPE_I_FUNCTION_INFO_FLAGS (g_i_function_info_flags_get_type())
+
+G_END_DECLS
+
+#endif /* __GOBJECT_INTROSPECTION_ENUM_TYPES_H__ */
+
+/* Generated data ends here */
+
diff --git a/gobject-introspection/ext/gobject-introspection/rb-gi-argument.c b/gobject-introspection/ext/gobject-introspection/rb-gi-argument.c
index cffc4c7..358fb0e 100644
--- a/gobject-introspection/ext/gobject-introspection/rb-gi-argument.c
+++ b/gobject-introspection/ext/gobject-introspection/rb-gi-argument.c
@@ -274,6 +274,65 @@ interface_to_ruby(GIArgument *argument, GITypeInfo *type_info)
return rb_interface;
}
+static VALUE
+rb_gi_argument_to_ruby_glist(GIArgument *argument, GITypeInfo *type_info)
+{
+ VALUE rb_argument;
+ GITypeInfo *element_type_info;
+ GITypeTag element_type_tag;
+
+ element_type_info = g_type_info_get_param_type(type_info, 0);
+ element_type_tag = g_type_info_get_tag(element_type_info);
+ g_base_info_unref(element_type_info);
+
+ switch (element_type_tag) {
+ case GI_TYPE_TAG_VOID:
+ case GI_TYPE_TAG_BOOLEAN:
+ case GI_TYPE_TAG_INT8:
+ case GI_TYPE_TAG_UINT8:
+ case GI_TYPE_TAG_INT16:
+ case GI_TYPE_TAG_UINT16:
+ case GI_TYPE_TAG_INT32:
+ case GI_TYPE_TAG_UINT32:
+ case GI_TYPE_TAG_INT64:
+ case GI_TYPE_TAG_UINT64:
+ case GI_TYPE_TAG_FLOAT:
+ case GI_TYPE_TAG_DOUBLE:
+ case GI_TYPE_TAG_GTYPE:
+ rb_raise(rb_eNotImpError,
+ "TODO: GIArgument(GList)[%s] -> Ruby",
+ g_type_tag_to_string(element_type_tag));
+ break;
+ case GI_TYPE_TAG_UTF8:
+ rb_argument = CSTRGLIST2RVAL(argument->v_pointer);
+ break;
+ case GI_TYPE_TAG_FILENAME:
+ case GI_TYPE_TAG_ARRAY:
+ rb_raise(rb_eNotImpError,
+ "TODO: GIArgument(GList)[%s] -> Ruby",
+ g_type_tag_to_string(element_type_tag));
+ break;
+ case GI_TYPE_TAG_INTERFACE:
+ GOBJGLIST2RVAL(argument->v_pointer);
+ break;
+ case GI_TYPE_TAG_GLIST:
+ case GI_TYPE_TAG_GSLIST:
+ case GI_TYPE_TAG_GHASH:
+ case GI_TYPE_TAG_ERROR:
+ case GI_TYPE_TAG_UNICHAR:
+ rb_raise(rb_eNotImpError,
+ "TODO: GIArgument(GList)[%s] -> Ruby",
+ g_type_tag_to_string(element_type_tag));
+ break;
+ default:
+ g_assert_not_reached();
+ break;
+ }
+
+ return rb_argument;
+}
+
+
VALUE
rb_gi_argument_to_ruby(GIArgument *argument, GITypeInfo *type_info)
{
@@ -340,7 +399,7 @@ rb_gi_argument_to_ruby(GIArgument *argument, GITypeInfo *type_info)
rb_argument = interface_to_ruby(argument, type_info);
break;
case GI_TYPE_TAG_GLIST:
- rb_argument = GOBJGLIST2RVAL(argument->v_pointer);
+ rb_argument = rb_gi_argument_to_ruby_glist(argument, type_info);
break;
case GI_TYPE_TAG_GSLIST:
case GI_TYPE_TAG_GHASH:
@@ -844,6 +903,64 @@ rb_gi_return_argument_free_everything_interface(GIArgument *argument,
}
static void
+rb_gi_return_argument_free_everything_glist(GIArgument *argument,
+ GITypeInfo *type_info)
+{
+ GITypeInfo *element_type_info;
+ GITypeTag element_type_tag;
+
+ element_type_info = g_type_info_get_param_type(type_info, 0);
+ element_type_tag = g_type_info_get_tag(element_type_info);
+ g_base_info_unref(element_type_info);
+
+ switch (element_type_tag) {
+ case GI_TYPE_TAG_VOID:
+ case GI_TYPE_TAG_BOOLEAN:
+ case GI_TYPE_TAG_INT8:
+ case GI_TYPE_TAG_UINT8:
+ case GI_TYPE_TAG_INT16:
+ case GI_TYPE_TAG_UINT16:
+ case GI_TYPE_TAG_INT32:
+ case GI_TYPE_TAG_UINT32:
+ case GI_TYPE_TAG_INT64:
+ case GI_TYPE_TAG_UINT64:
+ case GI_TYPE_TAG_FLOAT:
+ case GI_TYPE_TAG_DOUBLE:
+ case GI_TYPE_TAG_GTYPE:
+ rb_raise(rb_eNotImpError,
+ "TODO: free GIArgument(GList)[%s] everything",
+ g_type_tag_to_string(element_type_tag));
+ break;
+ case GI_TYPE_TAG_UTF8:
+ g_list_foreach(argument->v_pointer, (GFunc)g_free, NULL);
+ g_list_free(argument->v_pointer);
+ break;
+ case GI_TYPE_TAG_FILENAME:
+ case GI_TYPE_TAG_ARRAY:
+ rb_raise(rb_eNotImpError,
+ "TODO: free GIArgument(GList)[%s] everything",
+ g_type_tag_to_string(element_type_tag));
+ break;
+ case GI_TYPE_TAG_INTERFACE:
+ g_list_foreach(argument->v_pointer, (GFunc)g_object_unref, NULL);
+ g_list_free(argument->v_pointer);
+ break;
+ case GI_TYPE_TAG_GLIST:
+ case GI_TYPE_TAG_GSLIST:
+ case GI_TYPE_TAG_GHASH:
+ case GI_TYPE_TAG_ERROR:
+ case GI_TYPE_TAG_UNICHAR:
+ rb_raise(rb_eNotImpError,
+ "TODO: free GIArgument(GList)[%s] everything",
+ g_type_tag_to_string(element_type_tag));
+ break;
+ default:
+ g_assert_not_reached();
+ break;
+ }
+}
+
+static void
rb_gi_return_argument_free_everything(GIArgument *argument,
GITypeInfo *type_info)
{
@@ -883,8 +1000,7 @@ rb_gi_return_argument_free_everything(GIArgument *argument,
rb_gi_return_argument_free_everything_interface(argument, type_info);
break;
case GI_TYPE_TAG_GLIST:
- g_list_foreach(argument->v_pointer, (GFunc)g_object_unref, NULL);
- g_list_free(argument->v_pointer);
+ rb_gi_return_argument_free_everything_glist(argument, type_info);
break;
case GI_TYPE_TAG_GSLIST:
case GI_TYPE_TAG_GHASH:
@@ -953,7 +1069,9 @@ rb_gi_argument_from_ruby_interface(GIArgument *argument, GITypeInfo *type_info,
g_base_info_get_name(interface_info));
break;
case GI_INFO_TYPE_STRUCT:
- if (gtype == G_TYPE_VALUE) {
+ if (gtype == G_TYPE_NONE) {
+ argument->v_pointer = DATA_PTR(rb_argument);
+ } else if (gtype == G_TYPE_VALUE) {
GValue *gvalue;
gvalue = ALLOC(GValue);
memset(gvalue, 0, sizeof(GValue));
@@ -1420,6 +1538,22 @@ set_in_array_length_argument(GIArgument *argument,
}
static void
+set_in_array_gtype_arguments_from_ruby(GIArgument *array_argument,
+ VALUE rb_class_array)
+{
+ GType *types;
+ gint i, n_args;
+
+ n_args = RARRAY_LEN(rb_class_array);
+ types = ALLOC_N(GType, n_args);
+ for (i = 0; i < n_args; i++) {
+ types[i] = CLASS2GTYPE(RARRAY_PTR(rb_class_array)[i]);
+ }
+
+ array_argument->v_pointer = types;
+}
+
+static void
in_array_c_argument_from_ruby(GIArgument *array_argument,
GIArgument *length_argument,
G_GNUC_UNUSED GITypeInfo *array_type_info,
@@ -1451,11 +1585,16 @@ in_array_c_argument_from_ruby(GIArgument *array_argument,
case GI_TYPE_TAG_UINT64:
case GI_TYPE_TAG_FLOAT:
case GI_TYPE_TAG_DOUBLE:
- case GI_TYPE_TAG_GTYPE:
rb_raise(rb_eNotImpError,
"TODO: Ruby -> GIArgument(array)[%s]",
g_type_tag_to_string(element_type_tag));
break;
+ case GI_TYPE_TAG_GTYPE:
+ set_in_array_gtype_arguments_from_ruby(array_argument,
+ rb_argument);
+ set_in_array_length_argument(length_argument, length_type_info,
+ RARRAY_LEN(rb_argument));
+ break;
case GI_TYPE_TAG_UTF8:
case GI_TYPE_TAG_FILENAME:
array_argument->v_pointer = RVAL2STRV(rb_argument);
@@ -1685,11 +1824,13 @@ rb_gi_value_argument_free_array_c(GIArgument *argument,
case GI_TYPE_TAG_UINT64:
case GI_TYPE_TAG_FLOAT:
case GI_TYPE_TAG_DOUBLE:
- case GI_TYPE_TAG_GTYPE:
rb_raise(rb_eNotImpError,
"TODO: free GIArgument(array)[%s]",
g_type_tag_to_string(element_type_tag));
break;
+ case GI_TYPE_TAG_GTYPE:
+ xfree(argument->v_pointer);
+ break;
case GI_TYPE_TAG_UTF8:
case GI_TYPE_TAG_FILENAME:
g_free(argument->v_pointer);
diff --git a/gobject-introspection/ext/gobject-introspection/rb-gi-constructor-info.c b/gobject-introspection/ext/gobject-introspection/rb-gi-constructor-info.c
index 6e0d0e5..c2387b0 100644
--- a/gobject-introspection/ext/gobject-introspection/rb-gi-constructor-info.c
+++ b/gobject-introspection/ext/gobject-introspection/rb-gi-constructor-info.c
@@ -65,7 +65,12 @@ initialize_receiver(VALUE receiver, GITypeInfo *info, GIArgument *value)
case GI_INFO_TYPE_INTERFACE:
case GI_INFO_TYPE_CONSTANT:
case GI_INFO_TYPE_INVALID_0:
+ rb_raise(rb_eRuntimeError,
+ "TODO: returned value isn't object, struct or union");
+ break;
case GI_INFO_TYPE_UNION:
+ G_INITIALIZE(receiver, value->v_pointer);
+ break;
case GI_INFO_TYPE_VALUE:
case GI_INFO_TYPE_SIGNAL:
case GI_INFO_TYPE_VFUNC:
@@ -76,7 +81,7 @@ initialize_receiver(VALUE receiver, GITypeInfo *info, GIArgument *value)
case GI_INFO_TYPE_UNRESOLVED:
default:
rb_raise(rb_eRuntimeError,
- "TODO: returned value isn't object or struct");
+ "TODO: returned value isn't object, struct or union");
break;
}
}
diff --git a/gobject-introspection/ext/gobject-introspection/rb-gi-function-info.c b/gobject-introspection/ext/gobject-introspection/rb-gi-function-info.c
index 4bc8338..7225976 100644
--- a/gobject-introspection/ext/gobject-introspection/rb-gi-function-info.c
+++ b/gobject-introspection/ext/gobject-introspection/rb-gi-function-info.c
@@ -93,7 +93,6 @@ allocate_arguments(GICallableInfo *info,
GPtrArray *args_metadata)
{
gint i, n_args;
- gint rb_arg_index = 0;
n_args = g_callable_info_get_n_args(info);
for (i = 0; i < n_args; i++) {
@@ -127,7 +126,6 @@ allocate_arguments(GICallableInfo *info,
if (direction == GI_DIRECTION_IN || direction == GI_DIRECTION_INOUT) {
metadata->in_arg_index = in_args->len;
g_array_append_val(in_args, argument);
- metadata->rb_arg_index = rb_arg_index++;
}
if (direction == GI_DIRECTION_OUT || direction == GI_DIRECTION_INOUT) {
metadata->out_arg_index = out_args->len;
@@ -161,7 +159,6 @@ fill_metadata_callback(GPtrArray *args_metadata)
closure_metadata = g_ptr_array_index(args_metadata, closure_index);
closure_metadata->closure_p = TRUE;
metadata->closure_in_arg_index = closure_metadata->in_arg_index;
- closure_metadata->rb_arg_index = -1;
}
destroy_index = g_arg_info_get_destroy(arg_info);
@@ -170,7 +167,6 @@ fill_metadata_callback(GPtrArray *args_metadata)
destroy_metadata = g_ptr_array_index(args_metadata, destroy_index);
destroy_metadata->destroy_p = TRUE;
metadata->destroy_in_arg_index = destroy_metadata->in_arg_index;
- destroy_metadata->rb_arg_index = -1;
}
}
}
@@ -214,10 +210,43 @@ fill_metadata_array(GPtrArray *args_metadata)
}
static void
+fill_metadata_rb_arg_index(GPtrArray *args_metadata)
+{
+ guint i;
+ gint rb_arg_index = 0;
+
+ for (i = 0; i < args_metadata->len; i++) {
+ RBGIArgMetadata *metadata;
+
+ metadata = g_ptr_array_index(args_metadata, i);
+
+ if (metadata->closure_p) {
+ continue;
+ }
+
+ if (metadata->destroy_p) {
+ continue;
+ }
+
+ if (metadata->array_length_p) {
+ continue;
+ }
+
+ if (metadata->in_arg_index == -1) {
+ continue;
+ }
+
+ metadata->rb_arg_index = rb_arg_index;
+ rb_arg_index++;
+ }
+}
+
+static void
fill_metadata(GPtrArray *args_metadata)
{
fill_metadata_callback(args_metadata);
fill_metadata_array(args_metadata);
+ fill_metadata_rb_arg_index(args_metadata);
}
static void
diff --git a/gobject-introspection/ext/gobject-introspection/rb-gi-loader.c b/gobject-introspection/ext/gobject-introspection/rb-gi-loader.c
index 9285d8f..6009777 100644
--- a/gobject-introspection/ext/gobject-introspection/rb-gi-loader.c
+++ b/gobject-introspection/ext/gobject-introspection/rb-gi-loader.c
@@ -27,18 +27,24 @@ static const gchar *boxed_class_converters_name = "@@boxed_class_converters";
static VALUE
rg_s_define_class(int argc, VALUE *argv, G_GNUC_UNUSED VALUE klass)
{
+ VALUE rb_class;
VALUE rb_gtype, rb_name, rb_module;
- VALUE rb_options, rb_parent;
+ VALUE rb_options, rb_parent, rb_size;
GType gtype;
rb_scan_args(argc, argv, "31", &rb_gtype, &rb_name, &rb_module, &rb_options);
rbg_scan_options(rb_options,
"parent", &rb_parent,
+ "size", &rb_size,
NULL);
gtype = NUM2ULONG(rb_to_int(rb_gtype));
- return G_DEF_CLASS_WITH_PARENT(gtype, RVAL2CSTR(rb_name),
- rb_module, rb_parent);
+ rb_class = G_DEF_CLASS_WITH_PARENT(gtype, RVAL2CSTR(rb_name),
+ rb_module, rb_parent);
+ if (!NIL_P(rb_size)) {
+ rb_iv_set(rb_class, "@size", rb_size);
+ }
+ return rb_class;
}
static VALUE
@@ -184,6 +190,15 @@ rg_s_register_boxed_class_converter(VALUE klass, VALUE rb_gtype)
}
static VALUE
+rg_s_register_constant_rename_map(G_GNUC_UNUSED VALUE klass,
+ VALUE rb_original,
+ VALUE rb_renamed)
+{
+ G_RENAME_CONSTANT(RVAL2CSTR(rb_original), RVAL2CSTR(rb_renamed));
+ return Qnil;
+}
+
+static VALUE
rg_s_start_callback_dispatch_thread(G_GNUC_UNUSED VALUE klass)
{
rbgutil_start_callback_dispatch_thread();
@@ -204,5 +219,6 @@ rb_gi_loader_init(VALUE rb_mGI)
RG_DEF_SMETHOD(define_struct, -1);
RG_DEF_SMETHOD(define_error, -1);
RG_DEF_SMETHOD(register_boxed_class_converter, 1);
+ RG_DEF_SMETHOD(register_constant_rename_map, 2);
RG_DEF_SMETHOD(start_callback_dispatch_thread, 0);
}
diff --git a/gobject-introspection/ext/gobject-introspection/rb-gi-repository.c b/gobject-introspection/ext/gobject-introspection/rb-gi-repository.c
index e9a9ed0..a4f57a8 100644
--- a/gobject-introspection/ext/gobject-introspection/rb-gi-repository.c
+++ b/gobject-introspection/ext/gobject-introspection/rb-gi-repository.c
@@ -18,17 +18,43 @@
* MA 02110-1301 USA
*/
+
+/* GObjectIntrospection::Repository is used to manage repositories of
+ * namespaces. Namespaces are represented on disk by type libraries
+ * (.typelib files).
+ */
+
#include "rb-gi-private.h"
#define RG_TARGET_NAMESPACE rb_cGIRepository
#define SELF(self) RVAL2GI_REPOSITORY(self)
+
+/* Returns the singleton process-global default
+ * GObjectIntrospection::Repository. It is not currently supported to have
+ * multiple repositories in a particular process, but this function is provided
+ * in the unlikely eventuality that it would become possible, and as a
+ * convenience for higher level language bindings to conform to the GObject
+ * method call conventions.
+ *
+ * @return [GObjectIntrospection::Repository] The global singleton
+ * GObjectIntrospection::Repository.
+ */
static VALUE
rg_s_default(G_GNUC_UNUSED VALUE klass)
{
return GOBJ2RVAL(g_irepository_get_default());
}
+
+/* Force the namespace to be loaded if it isn't already. If namespace is not
+ * loaded, this function will search for a ".typelib" file using the repository
+ * search path. In addition, a version of namespace may be specified. If version
+ * is not specified, the latest will be used.
+ *
+ * @param [String] namespace The namespace to load
+ * @param [String, nil] version An optional version
+ */
static VALUE
rg_require(int argc, VALUE *argv, VALUE self)
{
@@ -53,6 +79,16 @@ rg_require(int argc, VALUE *argv, VALUE self)
return Qnil;
}
+
+/* Return an array of all (transitive) versioned dependencies for namespace.
+ * Returned strings are of the form "namespace-version".
+ * Note: namespace must have already been loaded using a function such as
+ * GObjectIntrospection::Repository.require() before calling this method.
+ *
+ * @param [String] namespace The namespace to get the dependencies for.
+ *
+ * @return [Array<String>] The dependencies.
+ */
static VALUE
rg_get_dependencies(VALUE self, VALUE rb_namespace)
{
@@ -74,6 +110,11 @@ rg_get_dependencies(VALUE self, VALUE rb_namespace)
return rb_dependencies;
}
+
+/* Return the list of currently loaded namespaces.
+ *
+ * @return [Array<String>] The loaded namespaces.
+ */
static VALUE
rg_loaded_namespaces(VALUE self)
{
@@ -93,6 +134,14 @@ rg_loaded_namespaces(VALUE self)
return rb_namespaces;
}
+
+/* This method returns the number of metadata entries in given namespace. The
+ * namespace must have already been loaded before calling this function.
+ *
+ * @param [String] namespace The namespace to fetch the entries from.
+ *
+ * @return [Integer] The number of metadata entries.
+ */
static VALUE
rg_get_n_infos(VALUE self, VALUE rb_namespace)
{
@@ -105,6 +154,17 @@ rg_get_n_infos(VALUE self, VALUE rb_namespace)
return INT2NUM(n_infos);
}
+
+/* This method returns a particular metadata entry in the given namespace. The
+ * namespace must have already been loaded before calling this function. See
+ * GObjectIntrospection::Repository#get_n_infos() to find the maximum number
+ * of entries.
+ *
+ * @param [String] namespace The namespace to fetch the metadata entry from.
+ * @param [Fixnum] index The index of the entry.
+ *
+ * @return [GObjectIntrospection::BaseInfo] The metadata entry.
+ */
static VALUE
rg_get_info(VALUE self, VALUE rb_namespace, VALUE rb_n)
{
@@ -120,6 +180,28 @@ rg_get_info(VALUE self, VALUE rb_namespace, VALUE rb_n)
return GI_BASE_INFO2RVAL_WITH_UNREF(info);
}
+
+/* This method searches for a particular type or name. If only one argument is
+ * given, it is interpreted as a gtype and all loaded namespaces are searched
+ * for it. If two arguments are given the first is a particular namespace and
+ * the second the name of an entry to search for.
+ *
+ * @overload find(type)
+ *
+ * @param [String] type The type to search for.
+ *
+ * @return [GObjectIntrospection::BaseInfo] The metadata entry.
+ *
+ *
+ * @overload find(namespace, type)
+ *
+ * @param [String] namespace The namespace to search in.
+ *
+ * @param [String] type The type to search for.
+ *
+ * @return [GObjectIntrospection::BaseInfo] The metadata entry.
+ */
+
static VALUE
rg_find(int argc, VALUE *argv, VALUE self)
{
diff --git a/gobject-introspection/ext/gobject-introspection/rb-gi-struct-info.c b/gobject-introspection/ext/gobject-introspection/rb-gi-struct-info.c
index 7bd815a..419e3c6 100644
--- a/gobject-introspection/ext/gobject-introspection/rb-gi-struct-info.c
+++ b/gobject-introspection/ext/gobject-introspection/rb-gi-struct-info.c
@@ -55,28 +55,42 @@ rg_get_field(VALUE self, VALUE rb_n)
return GI_BASE_INFO2RVAL_WITH_UNREF(g_struct_info_get_field(info, n));
}
+static gpointer
+extract_raw_struct(VALUE rb_struct,
+ GIStructInfo *struct_info)
+{
+ GType gtype;
+ gpointer raw_struct;
+
+ gtype = g_registered_type_info_get_g_type(struct_info);
+ if (gtype == G_TYPE_NONE && rb_respond_to(rb_struct, rb_intern("gtype"))) {
+ VALUE rb_gtype;
+ rb_gtype = rb_funcall(rb_struct, rb_intern("gtype"), 0);
+ gtype = NUM2ULONG(rb_funcall(rb_gtype, rb_intern("to_i"), 0));
+ }
+ if (gtype == G_TYPE_NONE) {
+ raw_struct = DATA_PTR(rb_struct);
+ } else {
+ raw_struct = RVAL2BOXED(rb_struct, gtype);
+ }
+
+ return raw_struct;
+}
+
static VALUE
rg_get_field_value(VALUE self, VALUE rb_struct, VALUE rb_n)
{
GIStructInfo *info;
+ gpointer raw_struct;
gint n;
GIFieldInfo *field_info;
VALUE rb_value;
- gpointer instance;
info = SELF(self);
+ raw_struct = extract_raw_struct(rb_struct, info);
n = NUM2INT(rb_n);
field_info = g_struct_info_get_field(info, n);
- if (rb_respond_to(rb_struct, rb_intern("gtype"))) {
- VALUE rb_gtype;
- GType gtype;
- rb_gtype = rb_funcall(rb_struct, rb_intern("gtype"), 0);
- gtype = NUM2ULONG(rb_funcall(rb_gtype, rb_intern("to_i"), 0));
- instance = RVAL2BOXED(rb_struct, gtype);
- } else {
- Data_Get_Struct(rb_struct, void, instance);
- }
- rb_value = rb_gi_field_info_get_field_raw(field_info, instance);
+ rb_value = rb_gi_field_info_get_field_raw(field_info, raw_struct);
g_base_info_unref(field_info);
return rb_value;
@@ -86,17 +100,15 @@ static VALUE
rg_set_field_value(VALUE self, VALUE rb_struct, VALUE rb_n, VALUE rb_value)
{
GIStructInfo *info;
+ gpointer raw_struct;
gint n;
GIFieldInfo *field_info;
- GType gtype;
info = SELF(self);
+ raw_struct = extract_raw_struct(rb_struct, info);
n = NUM2INT(rb_n);
field_info = g_struct_info_get_field(info, n);
- gtype = g_registered_type_info_get_g_type(info);
- rb_gi_field_info_set_field_raw(field_info,
- RVAL2BOXED(rb_struct, gtype),
- rb_value);
+ rb_gi_field_info_set_field_raw(field_info, raw_struct, rb_value);
/* TODO: use rb_ensure() to unref field_info. */
g_base_info_unref(field_info);
diff --git a/gobject-introspection/ext/gobject-introspection/rbgiversion.h b/gobject-introspection/ext/gobject-introspection/rbgiversion.h
new file mode 100644
index 0000000..295fc92
--- /dev/null
+++ b/gobject-introspection/ext/gobject-introspection/rbgiversion.h
@@ -0,0 +1,24 @@
+/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
+/************************************************
+
+ rbgiversion.h -
+
+ This file was generated by mkmf-gnome2.rb.
+
+************************************************/
+
+#ifndef __RBGI_VERSION_H__
+#define __RBGI_VERSION_H__
+
+#define GI_MAJOR_VERSION (1)
+#define GI_MINOR_VERSION (42)
+#define GI_MICRO_VERSION (0)
+
+#define GI_CHECK_VERSION(major,minor,micro) \
+ (GI_MAJOR_VERSION > (major) || \
+ (GI_MAJOR_VERSION == (major) && GI_MINOR_VERSION > (minor)) || \
+ (GI_MAJOR_VERSION == (major) && GI_MINOR_VERSION == (minor) && \
+ GI_MICRO_VERSION >= (micro)))
+
+
+#endif /* __RBGI_VERSION_H__ */
diff --git a/gobject-introspection/ext/gobject-introspection/ruby-gobject-introspection.pc b/gobject-introspection/ext/gobject-introspection/ruby-gobject-introspection.pc
new file mode 100644
index 0000000..f6b240c
--- /dev/null
+++ b/gobject-introspection/ext/gobject-introspection/ruby-gobject-introspection.pc
@@ -0,0 +1,3 @@
+Name: Ruby/GObjectIntrospection
+Description: Ruby bindings for GObject Introspection
+Version: 2.2.4
\ No newline at end of file
diff --git a/gobject-introspection/lib/gobject-introspection/callable-info.rb b/gobject-introspection/lib/gobject-introspection/callable-info.rb
index 2456f90..bd13106 100644
--- a/gobject-introspection/lib/gobject-introspection/callable-info.rb
+++ b/gobject-introspection/lib/gobject-introspection/callable-info.rb
@@ -23,22 +23,31 @@ module GObjectIntrospection
collection_reader("args")
def in_args
+ array_length_indexes = []
callback_indexes = []
closure_indexes = []
destroy_indexes = []
args.each_with_index do |arg, i|
- next if arg.scope == ScopeType::INVALID
- callback_indexes << i
- closure_index = arg.closure
- closure_indexes << closure_index if closure_index != -1
- destroy_index = arg.destroy
- destroy_indexes << destroy_index if destroy_index != -1
+ if arg.type.tag == TypeTag::ARRAY
+ array_length = arg.type.array_length
+ array_length_indexes << array_length if array_length != -1
+ end
+
+ unless arg.scope == ScopeType::INVALID
+ callback_indexes << i
+ closure_index = arg.closure
+ closure_indexes << closure_index if closure_index != -1
+ destroy_index = arg.destroy
+ destroy_indexes << destroy_index if destroy_index != -1
+ end
end
args.find_all.with_index do |arg, i|
case arg.direction
when Direction::IN, Direction::INOUT
- if callback_indexes.include?(i)
+ if array_length_indexes.include?(i)
+ false
+ elsif callback_indexes.include?(i)
false
elsif closure_indexes.include?(i)
false
diff --git a/gobject-introspection/lib/gobject-introspection/loader.rb b/gobject-introspection/lib/gobject-introspection/loader.rb
index 5472889..ab0a32a 100644
--- a/gobject-introspection/lib/gobject-introspection/loader.rb
+++ b/gobject-introspection/lib/gobject-introspection/loader.rb
@@ -120,7 +120,8 @@ module GObjectIntrospection
:parent => options[:parent])
else
klass = self.class.define_class(info.gtype, info.name, @base_module,
- :parent => options[:parent])
+ :parent => options[:parent],
+ :size => info.size)
end
load_fields(info, klass)
load_methods(info, klass)
@@ -134,6 +135,7 @@ module GObjectIntrospection
def define_boxed(info)
klass = self.class.define_class(info.gtype, info.name, @base_module)
+ _ = klass # TODO: Remove me. It is just for suppressing a warning.
# TODO
# load_fields(info, klass)
# load_methods(info, klass)
@@ -223,7 +225,12 @@ module GObjectIntrospection
flags = field_info.flags
if flags.readable?
- klass.__send__(:define_method, name) do ||
+ if field_info.type.tag == TypeTag::BOOLEAN
+ reader_method_name = "#{name}?"
+ else
+ reader_method_name = name
+ end
+ klass.__send__(:define_method, reader_method_name) do ||
info.get_field_value(self, i)
end
end
@@ -291,9 +298,9 @@ module GObjectIntrospection
detail = "#{arguments.size} for "
if n_in_args == n_required_in_args
- detail << "#{info.n_in_args}"
+ detail << "#{n_in_args}"
else
- detail << "#{info.n_required_in_args}..#{info.n_in_args}"
+ detail << "#{n_required_in_args}..#{n_in_args}"
end
message = "#{method_name}: wrong number of arguments (#{detail})"
raise ArgumentError, message
@@ -304,11 +311,12 @@ module GObjectIntrospection
max_n_args = nil
candidate_infos = []
infos.each do |info|
- if arguments.size == info.n_in_args
+ n_in_args = info.n_in_args
+ n_required_in_args = info.n_required_in_args
+ if (n_required_in_args..n_in_args).cover?(arguments.size)
candidate_infos << info
end
- n_in_args = info.n_in_args
- min_n_args = [min_n_args || n_in_args, n_in_args].min
+ min_n_args = [min_n_args || n_required_in_args, n_required_in_args].min
max_n_args = [max_n_args || n_in_args, n_in_args].max
end
@@ -316,8 +324,9 @@ module GObjectIntrospection
return candidate_infos.first
elsif candidate_infos.size > 1
candidate_info = candidate_infos.find do |info|
- info.in_args.each.with_index.all? do |arg_info, i|
- match_argument?(arg_info, arguments[i])
+ in_arg_infos = info.in_args
+ arguments.each.with_index.all? do |argument, i|
+ match_argument?(in_arg_infos[i], argument)
end
end
return candidate_info || candidate_infos.first
@@ -340,13 +349,22 @@ module GObjectIntrospection
end
end
- def rubyish_method_name(function_info)
+ def rubyish_method_name(function_info, options={})
name = function_info.name
+ if options[:prefix]
+ name = name.gsub(/\A#{Regexp.escape(options[:prefix])}/, "")
+ end
return_type = function_info.return_type
if return_type.tag == GObjectIntrospection::TypeTag::BOOLEAN
case name
- when /\A(?:is|get_is|get)_/
+ when /\A(?:is|get_is)_/
"#{$POSTMATCH}?"
+ when /\Aget_/
+ if function_info.n_in_args.zero?
+ "#{$POSTMATCH}?"
+ else
+ name
+ end
when /\A(?:has|use)_/
"#{name}?"
else
@@ -374,29 +392,48 @@ module GObjectIntrospection
infos.each do |info|
method_name = rubyish_method_name(info)
load_method_info(info, klass, method_name)
- if /\Aset_/ =~ method_name and info.n_args == 1
- klass.__send__(:alias_method, "#{$POSTMATCH}=", method_name)
- end
end
end
def load_method_info(info, klass, method_name)
+ define_method(info, klass, method_name)
+ define_equal_style_setter(info, klass, method_name)
+ end
+
+ def define_method(info, klass, method_name)
unlock_gvl = should_unlock_gvl?(info, klass)
validate = lambda do |arguments|
validate_arguments(info, "#{klass}\##{method_name}", arguments)
end
+ if klass.method_defined?(method_name) and
+ klass.instance_method(method_name).owner == klass
+ klass.__send__(:remove_method, method_name)
+ end
+ function_info_p = (info.class == FunctionInfo)
klass.__send__(:define_method, method_name) do |*arguments, &block|
+ arguments = [self] + arguments if function_info_p
validate.call(arguments, &block)
if block.nil? and info.require_callback?
- Enumerator.new(self, method_name, *arguments)
+ to_enum(method_name, *arguments)
else
- info.invoke({
- :receiver => self,
- :arguments => arguments,
- :unlock_gvl => unlock_gvl,
- },
- &block)
+ options = {
+ :arguments => arguments,
+ :unlock_gvl => unlock_gvl,
+ }
+ options[:receiver] = self unless function_info_p
+ info.invoke(options, &block)
+ end
+ end
+ end
+
+ def define_equal_style_setter(info, klass, method_name)
+ if /\Aset_/ =~ method_name and info.n_args == 1
+ setter_method_name = "#{$POSTMATCH}="
+ if klass.method_defined?(setter_method_name) and
+ klass.instance_method(setter_method_name).owner == klass
+ klass.__send__(:remove_method, setter_method_name)
end
+ klass.__send__(:alias_method, setter_method_name, method_name)
end
end
diff --git a/gobject-introspection/patches/cross-g-ir-scanner.diff b/gobject-introspection/patches/cross-g-ir-scanner.diff
index ccb97b6..76b6db3 100644
--- a/gobject-introspection/patches/cross-g-ir-scanner.diff
+++ b/gobject-introspection/patches/cross-g-ir-scanner.diff
@@ -1,36 +1,48 @@
+diff --git a/giscanner/ccompiler.py b/giscanner/ccompiler.py
+index 1c66aac..e922feb 100644
+--- a/giscanner/ccompiler.py
++++ b/giscanner/ccompiler.py
+@@ -137,17 +137,16 @@ class CCompiler(object):
+ is_msvc = False
+ libtool = utils.get_libtool_command(options)
+ if libtool:
+- args.append(utils.which(os.environ.get('SHELL', 'sh.exe')))
+ args.extend(libtool)
+ args.append('--mode=execute')
+- # FIXME: it could have prefix (i686-w64-mingw32-dlltool.exe)
+- args.extend(['dlltool.exe', '--identify'])
++ args.extend([compiler_cmd.replace('gcc', 'dlltool'), '--identify'])
+ proc = subprocess.Popen([compiler_cmd, '-print-search-dirs'],
+ stdout=subprocess.PIPE)
+ o, e = proc.communicate()
+ for line in o.splitlines():
+ if line.startswith('libraries: '):
+ libsearch = line[len('libraries: '):].split(';')
++ libsearch = options.library_paths + libsearch
+
+ shlibs = []
+ not_resolved = []
diff --git a/giscanner/dumper.py b/giscanner/dumper.py
-index d95ea6b..84a7afc 100644
+index 45a09fc..3c70be6 100644
--- a/giscanner/dumper.py
+++ b/giscanner/dumper.py
-@@ -157,8 +157,9 @@ class DumpCompiler(object):
+@@ -160,6 +160,7 @@ class DumpCompiler(object):
else:
o_path = self._generate_tempfile(tmpdir, '.o')
+ os.name = 'nt'
if os.name == 'nt':
-- ext = 'exe'
-+ ext = '.exe'
+ ext = '.exe'
else:
- ext = ''
-
-@@ -257,10 +258,7 @@ class DumpCompiler(object):
+@@ -263,10 +264,7 @@ class DumpCompiler(object):
else:
args.extend(['-o', output])
if libtool:
- if os.name == 'nt':
-- args.append('-export-all-symbols')
+- args.append('-Wl,--export-all-symbols')
- else:
- args.append('-export-dynamic')
+ args.append('-export-dynamic')
- cflags = os.environ.get('CFLAGS', '')
- for cflag in cflags.split():
-@@ -354,6 +352,8 @@ class DumpCompiler(object):
- if self._pkgconfig_msvc_flags == '':
- if library.endswith(".la"): # explicitly specified libtool library
- args.append(library)
-+ elif library.startswith("lib") and library.endswith("-0"):
-+ args.append('-l' + library[3:-2])
- else:
- args.append('-l' + library)
-
+ cppflags = os.environ.get('CPPFLAGS', '')
+ for cppflag in cppflags.split():
diff --git a/gobject-introspection/patches/0001-Support-external-g-ir-scanner.patch b/gobject-introspection/patches/support-external-g-ir-scanner.diff
similarity index 66%
rename from gobject-introspection/patches/0001-Support-external-g-ir-scanner.patch
rename to gobject-introspection/patches/support-external-g-ir-scanner.diff
index 4e0b699..c4bd75d 100644
--- a/gobject-introspection/patches/0001-Support-external-g-ir-scanner.patch
+++ b/gobject-introspection/patches/support-external-g-ir-scanner.diff
@@ -1,66 +1,18 @@
-From be397a8f143edc9808035f78c60159bb9aeedca2 Mon Sep 17 00:00:00 2001
-From: Kouhei Sutou <kou at clear-code.com>
-Date: Sun, 7 Apr 2013 18:51:45 +0900
-Subject: [PATCH] Support external g-ir-scanner
-
-With this change, you can build binaries for Windows on Debian
-GNU/Linux.
-
-Run configure with the following options:
-
- % ./configure \
- --host=i686-w64-mingw32 \
- --with-g-ir-scanner=/usr/bin/g-ir-scanner \
- --disable-tests
----
- Makefile-gir.am | 29 +++++++++++++----------
- Makefile-giscanner.am | 6 +++++
- Makefile-tools.am | 15 +++++++++++-
- Makefile.am | 5 +++-
- common.mk | 9 ++++---
- configure.ac | 54 ++++++++++++++++++++++++++++++++----------
- tests/Makefile.am | 2 ++
- tests/offsets/Makefile.am | 6 +++++
- tests/repository/Makefile.am | 2 ++
- tests/scanner/Makefile.am | 4 ++++
- 10 files changed, 103 insertions(+), 29 deletions(-)
-
diff --git a/Makefile-gir.am b/Makefile-gir.am
-index 2b39e54..63b2f2b 100644
+index 52f7ee3..c03f4e2 100644
--- a/Makefile-gir.am
+++ b/Makefile-gir.am
-@@ -27,18 +27,18 @@ CLEANFILES += gir/cairo-1.0.gir
- EXTRA_DIST += gir/cairo-1.0.gir.in
-
- # Doesn't seem to work to do gir/%.typelib =(
--gir/cairo-1.0.typelib: g-ir-compiler
--gir/DBus-1.0.typelib: g-ir-compiler
--gir/DBusGLib-1.0.typelib: g-ir-compiler
--gir/fontconfig-2.0.typelib: g-ir-compiler
--gir/freetype2-2.0.typelib: g-ir-compiler
--gir/GL-1.0.typelib: g-ir-compiler
--gir/libxml2-2.0.typelib: g-ir-compiler
--gir/xft-2.0.typelib: g-ir-compiler
--gir/xlib-2.0.typelib: g-ir-compiler
--gir/xfixes-4.0.typelib: g-ir-compiler
--gir/xrandr-1.3.typelib: g-ir-compiler
--gir/win32-1.0.typelib: g-ir-compiler
-+gir/cairo-1.0.typelib: g-ir-compiler$(EXEEXT)
-+gir/DBus-1.0.typelib: g-ir-compiler$(EXEEXT)
-+gir/DBusGLib-1.0.typelib: g-ir-compiler$(EXEEXT)
-+gir/fontconfig-2.0.typelib: g-ir-compiler$(EXEEXT)
-+gir/freetype2-2.0.typelib: g-ir-compiler$(EXEEXT)
-+gir/GL-1.0.typelib: g-ir-compiler$(EXEEXT)
-+gir/libxml2-2.0.typelib: g-ir-compiler$(EXEEXT)
-+gir/xft-2.0.typelib: g-ir-compiler$(EXEEXT)
-+gir/xlib-2.0.typelib: g-ir-compiler$(EXEEXT)
-+gir/xfixes-4.0.typelib: g-ir-compiler$(EXEEXT)
-+gir/xrandr-1.3.typelib: g-ir-compiler$(EXEEXT)
-+gir/win32-1.0.typelib: g-ir-compiler$(EXEEXT)
-
- # glib with source (to enable documentation)
- if WITH_GLIBSRC
-@@ -91,7 +91,12 @@ endif
+@@ -68,7 +68,8 @@ GLib_2_0_gir_SCANNERFLAGS = \
+ --symbol-prefix=g \
+ --symbol-prefix=glib \
+ --c-include="glib.h" \
+- $(GLib_2_0_gir_DOCSRC)
++ $(GLib_2_0_gir_DOCSRC) \
++ --library-path=$(GLIB_LIBDIR)
+ GLib_2_0_gir_PACKAGES = glib-2.0
+ GLib_2_0_gir_CFLAGS = \
+ -I$(GLIB_INCLUDEDIR) \
+@@ -87,7 +88,12 @@ endif
BUILT_GIRSOURCES += GLib-2.0.gir
@@ -74,8 +26,38 @@ index 2b39e54..63b2f2b 100644
gir/DBusGLib-1.0.typelib: GObject-2.0.gir
+@@ -105,7 +111,8 @@ GObject_2_0_gir_SCANNERFLAGS = \
+ --identifier-prefix=G \
+ --c-include="glib-object.h" \
+ --add-include-path=. \
+- $(GObject_2_0_gir_DOCSRC)
++ $(GObject_2_0_gir_DOCSRC) \
++ --library-path=$(GOBJECT_LIBDIR)
+
+ GObject_2_0_gir_PACKAGES = gobject-2.0
+ GObject_2_0_gir_INCLUDES = GLib-2.0
+@@ -133,7 +140,8 @@ GModule_2_0_gir_SCANNERFLAGS = \
+ --identifier-prefix=G \
+ --c-include="gmodule.h" \
+ --add-include-path=. \
+- $(GModule_2_0_gir_DOCSRC)
++ $(GModule_2_0_gir_DOCSRC) \
++ --library-path=$(GMODULE_LIBDIR)
+
+ GModule_2_0_gir_PACKAGES = gmodule-2.0
+ GModule_2_0_gir_INCLUDES = GLib-2.0
+@@ -171,7 +179,8 @@ Gio_2_0_gir_SCANNERFLAGS = \
+ --c-include="gio/gio.h" \
+ $(GIO_CINCLUDES) \
+ --add-include-path=. \
+- $(Gio_2_0_gir_DOCSRC)
++ $(Gio_2_0_gir_DOCSRC) \
++ --library-path=$(GIO_LIBDIR)
+
+ Gio_2_0_gir_PACKAGES = gio-2.0 $(GIO_UNIX_PACKAGES)
+ Gio_2_0_gir_INCLUDES = GObject-2.0
diff --git a/Makefile-giscanner.am b/Makefile-giscanner.am
-index e8def0e..4c1d21e 100644
+index c2273cd..0f47126 100644
--- a/Makefile-giscanner.am
+++ b/Makefile-giscanner.am
@@ -1,17 +1,21 @@
@@ -100,7 +82,7 @@ index e8def0e..4c1d21e 100644
libgiscanner_la_SOURCES = \
giscanner/sourcescanner.c \
-@@ -25,7 +29,9 @@ libgiscanner_la_CFLAGS = $(GOBJECT_CFLAGS) $(GIO_CFLAGS)
+@@ -24,7 +28,9 @@ libgiscanner_la_CFLAGS = $(GOBJECT_CFLAGS) $(GIO_CFLAGS)
# Python module
pkgpyexecdir = $(pkglibdir)/giscanner
@@ -158,10 +140,10 @@ index 34d2a25..87c3a1f 100644
+CLEANFILES += g-ir-doc-tool
+endif
diff --git a/Makefile.am b/Makefile.am
-index 736f3ad..08014bc 100644
+index 1a988a5..b14b745 100644
--- a/Makefile.am
+++ b/Makefile.am
-@@ -33,8 +33,11 @@ DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc
+@@ -35,8 +35,11 @@ DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc --enable-doctool
man_MANS += \
docs/g-ir-compiler.1 \
@@ -175,12 +157,12 @@ index 736f3ad..08014bc 100644
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = gobject-introspection-1.0.pc gobject-introspection-no-export-1.0.pc
diff --git a/common.mk b/common.mk
-index 28b73c7..15552fa 100644
+index 303622f..30a011a 100644
--- a/common.mk
+++ b/common.mk
@@ -9,11 +9,14 @@
INTROSPECTION_SCANNER = \
- env PATH=.libs:$(PATH) \
+ env PATH=".libs:$(PATH)" \
LPATH=.libs \
- CC="$(CC)" \
+ CC="$(CC)"
@@ -197,10 +179,10 @@ index 28b73c7..15552fa 100644
INTROSPECTION_SCANNER_ARGS = \
--verbose \
diff --git a/configure.ac b/configure.ac
-index 3537af1..604b164 100644
+index 1fd260a..615ff18 100644
--- a/configure.ac
+++ b/configure.ac
-@@ -246,19 +246,42 @@ AC_FUNC_STRTOD
+@@ -250,19 +250,42 @@ AC_FUNC_STRTOD
AC_CHECK_FUNCS([memchr strchr strspn strstr strtol strtoull])
AC_CHECK_FUNCS([backtrace backtrace_symbols])
@@ -255,7 +237,7 @@ index 3537af1..604b164 100644
dnl Not enabled by default until 3.6 cycle when we can propose mako as
dnl an external dependency
-@@ -310,6 +333,13 @@ fi
+@@ -347,6 +370,13 @@ fi
AC_SUBST(EXTRA_LINK_FLAGS)
@@ -268,100 +250,108 @@ index 3537af1..604b164 100644
+
AC_CONFIG_FILES([
Makefile
- m4/Makefile
+ tests/Makefile
diff --git a/tests/Makefile.am b/tests/Makefile.am
-index b4985b9..5c9db00 100644
+index bdd0fa7..70f1825 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
-@@ -16,7 +16,9 @@ tests_DATA = \
- gimarshallingtests.c \
- gimarshallingtests.h
+@@ -17,7 +17,9 @@ tests_DATA = \
+ gimarshallingtests.h \
+ gitestmacros.h
+if ENABLE_TESTS
- check_LTLIBRARIES = libeverything-1.0.la libgimarshallingtests-1.0.la
+ EXTRA_LTLIBRARIES = libeverything-1.0.la libgimarshallingtests-1.0.la
+endif
libeverything_1_0_la_SOURCES = everything.c
libgimarshallingtests_1_0_la_SOURCES = gimarshallingtests.c
+@@ -27,7 +29,9 @@ EXTRA_DIST += \
+ gi-tester \
+ gitestmacros.h
+
++if ENABLE_TESTS
+ BUILT_SOURCES += everything.c everything.h
++endif
+
+ CLEANFILES += \
+ $(BUILT_SOURCES) \
diff --git a/tests/offsets/Makefile.am b/tests/offsets/Makefile.am
-index 4f03830..053bd93 100644
+index 65d8773..66b00b1 100644
--- a/tests/offsets/Makefile.am
+++ b/tests/offsets/Makefile.am
-@@ -11,7 +11,9 @@ check_PROGRAMS =
+@@ -11,7 +11,9 @@ EXTRA_PROGRAMS =
############################################################
+if ENABLE_TESTS
- check_LTLIBRARIES += liboffsets.la
+ EXTRA_LTLIBRARIES += liboffsets.la
+endif
liboffsets_la_SOURCES = \
offsets.h \
-@@ -32,7 +34,9 @@ CLEANFILES += Offsets-1.0.gir Offsets-1.0.typelib
+@@ -32,7 +34,9 @@ CLEANFILES += Offsets-1.0.gir Offsets-1.0.typelib liboffsets.la
############################################################
+if ENABLE_TESTS
- check_PROGRAMS += gitestoffsets
+ EXTRA_PROGRAMS += gitestoffsets
+endif
nodist_gitestoffsets_SOURCES = gitestoffsets.c
- gitestoffsets_CPPFLAGS = $(GIREPO_CFLAGS) -I$(top_srcdir)/girepository
-@@ -42,8 +46,10 @@ gitestoffsets.c: gen-gitestoffsets offsets.h
+ gitestoffsets_CPPFLAGS = $(GIREPO_CFLAGS) -I$(top_srcdir)/girepository -I$(top_srcdir)/tests
+@@ -41,9 +45,11 @@ gitestoffsets_LDADD = $(top_builddir)/libgirepository-1.0.la $(GIREPO_LIBS)
+ gitestoffsets.c: gen-gitestoffsets offsets.h Offsets-1.0.typelib
$(AM_V_GEN) $(PYTHON) $(srcdir)/gen-gitestoffsets $(srcdir)/offsets.h > $@ || ( rm -f $@ && false )
- EXTRA_DIST += gen-gitestoffsets
+if ENABLE_TESTS
+ EXTRA_DIST += gen-gitestoffsets
BUILT_SOURCES += gitestoffsets.c
- CLEANFILES += gitestoffsets.c
+ CLEANFILES += gitestoffsets.c $(EXTRA_PROGRAMS)
+endif
############################################################
diff --git a/tests/repository/Makefile.am b/tests/repository/Makefile.am
-index 96afb89..0553a8b 100644
+index 882fa9e..89c9069 100644
--- a/tests/repository/Makefile.am
+++ b/tests/repository/Makefile.am
-@@ -2,7 +2,9 @@ AM_CFLAGS = $(GOBJECT_CFLAGS)
+@@ -2,8 +2,10 @@ AM_CFLAGS = $(GOBJECT_CFLAGS)
AM_LDFLAGS = -module -avoid-version
LIBS = $(GOBJECT_LIBS)
+if ENABLE_TESTS
- check_PROGRAMS = gitestrepo gitestthrows gitypelibtest
+ EXTRA_PROGRAMS = gitestrepo gitestthrows gitypelibtest
+ CLEANFILES = $(EXTRA_PROGRAMS)
+endif
gitestrepo_SOURCES = $(srcdir)/gitestrepo.c
gitestrepo_CPPFLAGS = $(GIREPO_CFLAGS) -I$(top_srcdir)/girepository
diff --git a/tests/scanner/Makefile.am b/tests/scanner/Makefile.am
-index 31487a6..65c02fa 100644
+index 92ab12a..41f4de8 100644
--- a/tests/scanner/Makefile.am
+++ b/tests/scanner/Makefile.am
-@@ -5,6 +5,7 @@ include $(top_srcdir)/Makefile.introspection
+@@ -9,6 +9,7 @@ INTROSPECTION_SCANNER_ARGS += --warn-all
- INTROSPECTION_SCANNER_ARGS += --warn-all
+ CLEANFILES =
+if ENABLE_TESTS
- check_LTLIBRARIES = \
+ EXTRA_LTLIBRARIES = \
libsletter.la \
libutility.la \
-@@ -13,6 +14,7 @@ check_LTLIBRARIES = \
- libregress.la \
- libwarnlib.la \
+@@ -19,6 +20,7 @@ EXTRA_LTLIBRARIES = \
+ libtypedefs.la \
$(NULL)
+ CLEANFILES += $(EXTRA_LTLIBRARIES)
+endif
+ GI_SCANNER_CFLAGS = -I$(top_srcdir)/tests
AM_CPPFLAGS = -I$(top_srcdir)/girepository
- AM_CFLAGS = $(GIO_CFLAGS) $(GOBJECT_CFLAGS) $(GTHREAD_CFLAGS)
-@@ -126,7 +128,9 @@ GetType_1_0_gir_SCANNERFLAGS = --c-include="gettype.h" --identifier-prefix=GetTy
- GIRS += GetType-1.0.gir
+@@ -147,7 +149,7 @@ Typedefs_1_0_gir_FILES = $(libtypedefs_la_SOURCES)
+ Typedefs_1_0_gir_SCANNERFLAGS = --c-include="typedefs.h" --identifier-prefix=Typedefs --symbol-prefix=typedefs
+ GIRS += Typedefs-1.0.gir
- if !OS_WIN32
+-if !OS_WIN32
+if ENABLE_TESTS
- check_PROGRAMS = barapp
-+endif
+ EXTRA_PROGRAMS = barapp
+ CLEANFILES += $(EXTRA_PROGRAMS)
- barapp_SOURCES = $(srcdir)/barapp.c $(srcdir)/barapp.h
- barapp_LDADD = $(top_builddir)/libgirepository-1.0.la
---
-1.7.10.4
-
diff --git a/gobject-introspection/test/test-object-info.rb b/gobject-introspection/test/test-object-info.rb
index 675e682..bfc0fff 100644
--- a/gobject-introspection/test/test-object-info.rb
+++ b/gobject-introspection/test/test-object-info.rb
@@ -86,7 +86,7 @@ class TestObjectInfo < Test::Unit::TestCase
def test_n_signals
info = @repository.find("Gio", "Application")
- assert_equal(5, info.n_signals)
+ assert_operator(5, :<=, info.n_signals)
end
def test_get_signal
diff --git a/gobject-introspection/test/test-signal-info.rb b/gobject-introspection/test/test-signal-info.rb
index e114acd..ec03923 100644
--- a/gobject-introspection/test/test-signal-info.rb
+++ b/gobject-introspection/test/test-signal-info.rb
@@ -25,8 +25,8 @@ class TestSignalInfo < Test::Unit::TestCase
end
def test_flags
- require_version(1, 39, 0)
- assert_equal(GLib::SignalFlags::RUN_LAST,
+ require_version(1, 40, 0)
+ assert_equal(GLib::SignalFlags::RUN_FIRST,
@info.flags)
end
diff --git a/gobject-introspection/test/test-struct-info.rb b/gobject-introspection/test/test-struct-info.rb
index c5439a1..e3eed77 100644
--- a/gobject-introspection/test/test-struct-info.rb
+++ b/gobject-introspection/test/test-struct-info.rb
@@ -31,7 +31,7 @@ class TestStructInfo < Test::Unit::TestCase
end
def test_n_methods
- assert_equal(62, @info.n_methods)
+ assert_operator(@info.n_methods, :>=, 62)
end
def test_get_method
diff --git a/goocanvas/README b/goocanvas/README
deleted file mode 100644
index c0aeb0b..0000000
--- a/goocanvas/README
+++ /dev/null
@@ -1,37 +0,0 @@
-Ruby/GooCanvas
-==============
-Ruby/GooCanvas is a Ruby binding of GooCanvas.
-
-Requirements
-------------
- Ruby: http://www.ruby-lang.org/
- GooCanvas: http://live.gnome.org/GooCanvas
-
-Install
--------
- 0. install ruby-1.9.x or later and GooCanvas.
- 1. ruby extconf.rb
- 2. make
- 3. su
- 4. make install
-
-Copying
--------
- Copyright (c) 2008 Ruby-GNOME2 Project Team
- Copyright (c) 2007 Vincent Isambart
- Copyright (c) 2007 Kouhei Sutou <kou at cozmixng.org>
- Copyright (c) 2007 Manu
-
- This program is free software.
- You can distribute/modify this program under the terms of
- the GNU LESSER GENERAL PUBLIC LICENSE Version 2.1.
-
-Project Website
----------------
- http://ruby-gnome2.sourceforge.jp/
-
-Thanks
-------
-
- * Andrew Whyte
- - improved rbgoocanvasitem.c.
diff --git a/goocanvas/Rakefile b/goocanvas/Rakefile
deleted file mode 100644
index 278de3b..0000000
--- a/goocanvas/Rakefile
+++ /dev/null
@@ -1,14 +0,0 @@
-# -*- ruby -*-
-
-$LOAD_PATH.unshift("./../glib2/lib")
-require 'gnome2-raketask'
-
-package = GNOME2Package.new do |_package|
- _package.summary = "Ruby/GooCanvas is a Ruby binding of GooCanvas."
- _package.description = "Ruby/GooCanvas is a Ruby binding of GooCanvas."
- _package.dependency.gem.runtime = ["gtk3", "gobject-introspection"]
- _package.win32.packages = ["goocanvas"]
- _package.win32.dependencies = []
-end
-package.define_tasks
-
diff --git a/goocanvas/ext/goocanvas/extconf.rb b/goocanvas/ext/goocanvas/extconf.rb
deleted file mode 100644
index 59764f3..0000000
--- a/goocanvas/ext/goocanvas/extconf.rb
+++ /dev/null
@@ -1,82 +0,0 @@
-=begin
-extconf.rb for Ruby/GooCanvas extension library
-=end
-
-require 'pathname'
-
-base_dir = Pathname(__FILE__).dirname.parent.parent.expand_path
-top_dir = base_dir.parent.expand_path
-top_build_dir = Pathname(".").parent.parent.parent.expand_path
-
-mkmf_gnome2_dir = top_dir + "glib2" + 'lib'
-version_suffix = ""
-unless mkmf_gnome2_dir.exist?
- if /(-\d+\.\d+\.\d+)(?:\.\d+)?\z/ =~ base_dir.basename.to_s
- version_suffix = $1
- mkmf_gnome2_dir = top_dir + "glib2#{version_suffix}" + 'lib'
- end
-end
-
-$LOAD_PATH.unshift(mkmf_gnome2_dir.to_s)
-
-module_name = "goocanvas"
-package_id = "goocanvas-2.0"
-
-begin
- require 'mkmf-gnome2'
-rescue LoadError
- require 'rubygems'
- gem 'glib2'
- require 'mkmf-gnome2'
-end
-
-[
- "glib2",
- "atk",
- "pango",
- "gdk_pixbuf2",
- "gdk3",
- "gtk3",
- "gobject-introspection",
-].each do |package|
- directory = "#{package}#{version_suffix}"
- build_base_path = "#{directory}/tmp/#{RUBY_PLATFORM}"
- package_library_name = package.gsub(/-/, "_")
- build_dir = "#{build_base_path}/#{package_library_name}/#{RUBY_VERSION}"
- add_depend_package(package, "#{directory}/ext/#{package}",
- top_dir.to_s,
- :top_build_dir => top_build_dir.to_s,
- :target_build_dir => build_dir)
-end
-
-rcairo_options = {}
-rcairo_source_dir_names = ["rcairo"]
-if /mingw|cygwin|mswin/ =~ RUBY_PLATFORM
- rcairo_source_dir_names.unshift("rcairo.win32")
-end
-rcairo_source_dir_names.each do |rcairo_source_dir_name|
- rcairo_source_dir = top_dir.parent.expand_path + rcairo_source_dir_name
- if rcairo_source_dir.exist?
- rcairo_options[:rcairo_source_dir] = rcairo_source_dir.to_s
- break
- end
-end
-check_cairo(rcairo_options) or exit(false)
-
-setup_win32(module_name, base_dir)
-
-unless required_pkg_config_package(package_id)
- exit(false)
-end
-
-create_pkg_config_file("Ruby/GooCanvas", package_id)
-$defs << "-DRUBY_GOO_CANVAS_COMPILATION"
-create_makefile(module_name)
-pkg_config_dir = with_config("pkg-config-dir")
-if pkg_config_dir.is_a?(String)
- File.open("Makefile", "ab") do |makefile|
- makefile.puts
- makefile.puts("pkgconfigdir=#{pkg_config_dir}")
- end
-end
-
diff --git a/goocanvas/ext/goocanvas/goocanvas.def b/goocanvas/ext/goocanvas/goocanvas.def
deleted file mode 100644
index 881000d..0000000
--- a/goocanvas/ext/goocanvas/goocanvas.def
+++ /dev/null
@@ -1,2 +0,0 @@
-EXPORTS
- Init_goocanvas
diff --git a/goocanvas/ext/goocanvas/rbgoocanvas.c b/goocanvas/ext/goocanvas/rbgoocanvas.c
deleted file mode 100644
index ad137e2..0000000
--- a/goocanvas/ext/goocanvas/rbgoocanvas.c
+++ /dev/null
@@ -1,58 +0,0 @@
-/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
-/*
- * Copyright (C) 2011-2013 Ruby-GNOME2 Project Team
- * Copyright (C) 2007 Vincent Isambart <vincent.isambart at gmail.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- */
-
-#include "rbgoocanvas.h"
-
-static void
-rgoo_canvas_mark(gpointer object)
-{
- GooCanvas *canvas = object;
- GooCanvasItem *root_item;
-
- rbgobj_gc_mark_instance(object);
- root_item = goo_canvas_get_root_item(canvas);
- if (root_item) {
- rbgobj_gc_mark_instance(root_item);
- }
-}
-
-static void
-rgoo_canvas_item_mark(gpointer object)
-{
- GooCanvasItem *item = object;
- gint i, n_children;
-
- rbgobj_gc_mark_instance(object);
-
- n_children = goo_canvas_item_get_n_children(item);
- for (i = 0; i < n_children; i++) {
- GooCanvasItem *child;
- child = goo_canvas_item_get_child(item, i);
- rbgobj_gc_mark_instance(child);
- }
-}
-
-void
-Init_goocanvas(void)
-{
- rbgobj_register_mark_func(GOO_TYPE_CANVAS, rgoo_canvas_mark);
- rbgobj_register_mark_func(GOO_TYPE_CANVAS_ITEM, rgoo_canvas_item_mark);
-}
diff --git a/goocanvas/ext/goocanvas/rbgoocanvas.h b/goocanvas/ext/goocanvas/rbgoocanvas.h
deleted file mode 100644
index 9346eb6..0000000
--- a/goocanvas/ext/goocanvas/rbgoocanvas.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
-/*
- * Copyright (C) 2011-2013 Ruby-GNOME2 Project Team
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- */
-
-#ifndef __RBGOOCANVAS_H__
-#define __RBGOOCANVAS_H__
-
-#include <rbgobject.h>
-#include <goocanvas.h>
-
-extern void Init_goocanvas(void);
-
-#endif /* __RBGOOCANVAS_H__ */
diff --git a/goocanvas/extconf.rb b/goocanvas/extconf.rb
deleted file mode 100644
index fed2d83..0000000
--- a/goocanvas/extconf.rb
+++ /dev/null
@@ -1,49 +0,0 @@
-#!/usr/bin/env ruby
-
-require 'pathname'
-require 'mkmf'
-require 'rbconfig'
-require 'fileutils'
-
-package = "goocanvas"
-
-base_dir = Pathname(__FILE__).dirname.expand_path
-ext_dir = base_dir + "ext" + package
-mkmf_gnome2_dir = base_dir + 'lib'
-
-ruby = File.join(RbConfig::CONFIG['bindir'],
- RbConfig::CONFIG['ruby_install_name'] +
- RbConfig::CONFIG["EXEEXT"])
-
-build_dir = Pathname("ext") + package
-FileUtils.mkdir_p(build_dir.to_s) unless build_dir.exist?
-extconf_rb_path = ext_dir + "extconf.rb"
-system(ruby, "-C", build_dir.to_s, extconf_rb_path.to_s, *ARGV) || exit(false)
-
-create_makefile(package)
-FileUtils.mv("Makefile", "Makefile.lib")
-
-File.open("Makefile", "w") do |makefile|
- makefile.puts(<<-EOM)
-all:
- (cd ext/#{package} && $(MAKE))
- $(MAKE) -f Makefile.lib
-
-install:
- (cd ext/#{package} && $(MAKE) install)
- $(MAKE) -f Makefile.lib install
-
-site-install:
- (cd ext/#{package} && $(MAKE) site-install)
- $(MAKE) -f Makefile.lib site-install
-
-clean:
- (cd ext/#{package} && $(MAKE) clean)
- $(MAKE) -f Makefile.lib clean
-
-distclean:
- (cd ext/#{package} && $(MAKE) distclean)
- $(MAKE) -f Makefile.lib distclean
- @rm -f Makefile.lib
-EOM
-end
diff --git a/goocanvas/lib/goo/canvas-item.rb b/goocanvas/lib/goo/canvas-item.rb
deleted file mode 100644
index 91f27bb..0000000
--- a/goocanvas/lib/goo/canvas-item.rb
+++ /dev/null
@@ -1,32 +0,0 @@
-# Copyright (C) 2013 Ruby-GNOME2 Project Team
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
-module Goo
- module CanvasItem
- alias_method :remove_child_raw, :remove_child
- private :remove_child_raw
- def remove_child(child_or_position)
- if child_or_position.is_a?(CanvasItem)
- child = child_or_position
- position = find_child(child)
- else
- position = child_or_position
- child = get_child(position)
- end
- remove_child_raw(position)
- end
- end
-end
diff --git a/goocanvas/lib/goocanvas.rb b/goocanvas/lib/goocanvas.rb
deleted file mode 100644
index e96ec99..0000000
--- a/goocanvas/lib/goocanvas.rb
+++ /dev/null
@@ -1,72 +0,0 @@
-# Copyright (C) 2013 Ruby-GNOME2 Project Team
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
-require "gtk3"
-require "gobject-introspection"
-
-base_dir = Pathname.new(__FILE__).dirname.dirname.dirname.expand_path
-vendor_dir = base_dir + "vendor" + "local"
-vendor_bin_dir = vendor_dir + "bin"
-GLib.prepend_dll_path(vendor_bin_dir)
-
-if vendor_dir.exist?
- begin
- require "gobject-introspection"
- vendor_girepository_dir = vendor_dir + "lib" + "girepository-1.0"
- GObjectIntrospection.prepend_typelib_path(vendor_girepository_dir)
- rescue LoadError
- end
-end
-
-module Goo
- LOG_DOMAIN = "GooCanvas"
- GLib::Log.set_log_domain(LOG_DOMAIN)
-
- class << self
- def const_missing(name)
- init
- if const_defined?(name)
- const_get(name)
- else
- super
- end
- end
-
- def init
- class << self
- remove_method(:init)
- remove_method(:const_missing)
- end
- loader = Loader.new(self)
- loader.load("GooCanvas")
- begin
- major, minor, _ = RUBY_VERSION.split(/\./)
- require "#{major}.#{minor}/goocanvas.so"
- rescue LoadError
- require "goocanvas.so"
- end
- require "goo/canvas-item"
- end
- end
-
- class Loader < GObjectIntrospection::Loader
- private
- def load_field(info, i, field_info, klass)
- return if field_info.name == "parent"
- super
- end
- end
-end
diff --git a/goocanvas/sample/demo-animation.rb b/goocanvas/sample/demo-animation.rb
deleted file mode 100644
index 73d0934..0000000
--- a/goocanvas/sample/demo-animation.rb
+++ /dev/null
@@ -1,176 +0,0 @@
-#!/usr/bin/env ruby
-#
-# This sample code is a port of
-# goocanvas/demo/demo-animation.c. It is licensed
-# under the terms of the GNU Library General Public License, version
-# 2 or (at your option) later.
-#
-# Copyright (C) 2013 Ruby-GNOME2 Project Team
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
-class CanvasSampleAnimation < Gtk::Box
- def initialize
- super(:vertical, 4)
- set_border_width(4)
- show
- create_animation_page(self)
- end
-
- private
- def create_animation_page(vbox)
- hbox = Gtk::Box.new(:horizontal, 4)
- vbox.pack_start(hbox, :expand => false,
- :fill => false,
- :padding => 0)
- hbox.show
-
- start_button = Gtk::Button.new(:label => "Start Animation")
- hbox.pack_start(start_button, :expand => false,
- :fill => false,
- :padding => 0)
- start_button.show
-
- stop_button = Gtk::Button.new(:label => "Stop Animation")
- hbox.pack_start(stop_button, :expand => false,
- :fill => false,
- :padding => 0)
- stop_button.show
-
- scrolled_win = Gtk::ScrolledWindow.new
- scrolled_win.shadow_type = :in
- vbox.pack_start(scrolled_win, :expand => true,
- :fill => true,
- :padding => 0)
- scrolled_win.show
-
- canvas = Goo::Canvas.new
- canvas.set_size_request(600, 450)
- canvas.set_bounds(0, 0, 1000, 1000)
- canvas.show
- scrolled_win.add(canvas)
-
- items = setup_canvas(canvas)
-
- start_button.signal_connect("clicked") do
- start_animation_clicked(*items)
- end
-
- stop_button.signal_connect("clicked") do
- stop_animation_clicked(*items)
- end
- end
-
- def setup_canvas(canvas)
- root = canvas.root_item
-
- # Absolute.
- ellipse1 = Goo::CanvasEllipse.new(:parent => root,
- :center_x => 0,
- :center_y => 0,
- :radius_x => 25,
- :radius_y => 15,
- :fill_color => "blue")
- ellipse1.translate(100, 100)
- ellipse1.signal_connect("animation_finished") do |_, event|
- on_animation_finished(event, ellipse1)
- end
-
- rect1 = Goo::CanvasRect.new(:parent => root,
- :x => -10,
- :y => -10,
- :width => 20,
- :height => 20,
- :fill_color => "blue")
- rect1.translate(100, 200)
-
- rect3 = Goo::CanvasRect.new(:parent => root,
- :x => -10,
- :y => -10,
- :width => 20,
- :height => 20,
- :fill_color => "blue")
- rect3.translate(200, 200)
-
- # Relative.
- ellipse2 = Goo::CanvasEllipse.new(:parent => root,
- :center_x => 0,
- :center_y => 0,
- :radius_x => 25,
- :radius_y => 15,
- :fill_color => "red")
- ellipse2.translate(100, 400)
-
- rect2 = Goo::CanvasRect.new(:parent => root,
- :x => -10,
- :y => -10,
- :width => 20,
- :height => 20,
- :fill_color => "red")
- rect2.translate(100, 500)
-
- rect4 = Goo::CanvasRect.new(:parent => root,
- :x => -10,
- :y => -10,
- :width => 20,
- :height => 20,
- :fill_color => "red")
- rect4.translate(200, 500)
-
- [ellipse1, rect1, rect3, ellipse2, rect2, rect4]
- end
-
- def start_animation_clicked(ellipse1, rect1, rect3,
- ellipse2, rect2, rect4)
- # Absolute.
- ellipse1.set_simple_transform(100, 100, 1, 0)
- ellipse1.animate(500, 100, 2, 720, true, 2000, 40,
- Goo::CanvasAnimateType::BOUNCE)
-
- rect1.set_simple_transform(100, 200, 1, 0)
- rect1.animate(100, 200, 1, 350, true, 40 * 36, 40,
- Goo::CanvasAnimateType::RESTART)
-
- rect3.set_simple_transform(200, 200, 1, 0)
- rect3.animate(200, 200, 3, 0, true, 400, 40,
- Goo::CanvasAnimateType::BOUNCE)
-
- # Relative.
- ellipse2.set_simple_transform(100, 400, 1, 0)
- ellipse2.animate(400, 0, 2, 720, false, 2000, 40,
- Goo::CanvasAnimateType::BOUNCE)
-
- rect2.set_simple_transform(100, 500, 1, 0)
- rect2.animate(0, 0, 1, 350, false, 40 * 36, 40,
- Goo::CanvasAnimateType::RESTART)
-
- rect4.set_simple_transform(200, 500, 1, 0)
- rect4.animate(0, 0, 3, 0, false, 400, 40,
- Goo::CanvasAnimateType::BOUNCE)
- end
-
- def stop_animation_clicked(*items)
- items.each do |item|
- item.stop_animation
- end
- end
-
- def on_animation_finished(event, ellipse1)
- puts "Animation finished stopped: #{event}"
- # Test starting another animation. */
- #ellipse1.animate(500, 100, 2, 720, true, 2000, 40,
- # Goo::CanvasAnimateType::BOUNCE)
- end
-end
diff --git a/goocanvas/sample/demo-arrowhead.rb b/goocanvas/sample/demo-arrowhead.rb
deleted file mode 100644
index 574cb05..0000000
--- a/goocanvas/sample/demo-arrowhead.rb
+++ /dev/null
@@ -1,354 +0,0 @@
-class CanvasSampleArrowhead < Gtk::Box
- LEFT = 50.0
- RIGHT = 350.0
- MIDDLE = 150.0
- DEFAULT_WIDTH = 2
- DEFAULT_SHAPE_A = 4
- DEFAULT_SHAPE_B = 5
- DEFAULT_SHAPE_C = 4
-
- def initialize()
- super(:vertical, 4)
- border_width = 4
- show()
-
- w = Gtk::Label.new <<-END
-This demo allows you to edit arrowhead shapes. Drag the little boxes
-to change the shape of the line and its arrowhead. You can see the
-arrows at their normal scale on the right hand side of the window.
- END
- pack_start(w, :expand => false, :fill => false, :padding => 0)
- w.show
-
- w = Gtk::Alignment.new(0.5, 0.5, 0.0, 0.0)
- pack_start(w, :expand => true, :fill => true, :padding => 0)
- w.show
-
- frame = Gtk::Frame.new
- frame.shadow_type = :in
- w.add(frame)
- frame.show
-
- canvas = Goo::Canvas.new
- root = canvas.root_item
-
- canvas.set_size_request(500, 350)
- canvas.set_bounds(0, 0, 500, 350)
- frame.add(canvas)
- canvas.show
-
- canvas.instance_variable_set(:@width, DEFAULT_WIDTH)
- canvas.instance_variable_set(:@shape_a, DEFAULT_SHAPE_A)
- canvas.instance_variable_set(:@shape_b, DEFAULT_SHAPE_B)
- canvas.instance_variable_set(:@shape_c, DEFAULT_SHAPE_C)
-
- # Big arrow
-
- points = Goo::CanvasPoints.new(2)
- points.set_point(0, LEFT, MIDDLE)
- points.set_point(1, RIGHT, MIDDLE)
- item = Goo::CanvasPolyline.new(:parent => root,
- :points => points,
- :stroke_color => "mediumseagreen",
- :end_arrow => true)
- canvas.instance_variable_set(:@big_arrow, item)
-
- # Arrow outline
-
- item = Goo::CanvasPolyline.new(:parent => root,
- :close_path => true,
- :points => Goo::CanvasPoints.new(0),
- :stroke_color => "black",
- :line_width => 2.0,
- :line_cap => Cairo::LINE_CAP_ROUND,
- :line_join => Cairo::LINE_JOIN_ROUND)
- canvas.instance_variable_set(:@outline, item)
-
- # Drag boxes
-
- create_drag_box(canvas, root, "width_drag_box")
- create_drag_box(canvas, root, "shape_a_drag_box")
- create_drag_box(canvas, root, "shape_b_c_drag_box")
-
- # Dimensions
-
- create_dimension(canvas, root, "width_arrow", "width_text", :e)
- create_dimension(canvas, root, "shape_a_arrow", "shape_a_text", :n)
- create_dimension(canvas, root, "shape_b_arrow", "shape_b_text", :n)
- create_dimension(canvas, root, "shape_c_arrow", "shape_c_text", :w)
-
- # Info
-
- create_info(canvas, root, "width_info", LEFT, 260)
- create_info(canvas, root, "shape_a_info", LEFT, 280)
- create_info(canvas, root, "shape_b_info", LEFT, 300)
- create_info(canvas, root, "shape_c_info", LEFT, 320)
-
- # Division line
-
- points = Goo::CanvasPoints.new(2)
- points.set_point(0, RIGHT + 50, 0)
- points.set_point(1, RIGHT + 50, 1000)
- Goo::CanvasPolyline.new(:parent => root,
- :points => points,
- :fill_color => "black", :line_width => 2.0)
-
- # Sample arrows
-
- create_sample_arrow(canvas, root, "sample_1",
- RIGHT + 100, 30, RIGHT + 100, MIDDLE - 30)
- create_sample_arrow(canvas, root, "sample_2",
- RIGHT + 70, MIDDLE, RIGHT + 130, MIDDLE)
- create_sample_arrow(canvas, root, "sample_3",
- RIGHT + 70, MIDDLE + 30, RIGHT + 130, MIDDLE + 120)
-
- # Done!
- set_arrow_shape(canvas)
- end
-
- def set_dimension(canvas, arrow_name, text_name, x1, y1, x2, y2, tx, ty, dim)
- points = Goo::CanvasPoints.new(2)
- points.set_point(0, x1, y1)
- points.set_point(1, x2, y2)
-
- arrow = canvas.instance_variable_get("@#{arrow_name}")
- arrow.points = points
-
- text = canvas.instance_variable_get("@#{text_name}")
- text.text = dim.to_s
- text.x = tx
- text.y = ty
- end
-
- def move_drag_box(item, x, y)
- item.x = x - 5.0
- item.y = y - 5.0
- end
-
- def set_arrow_shape(canvas)
- width = canvas.instance_variable_get(:@width)
- shape_a = canvas.instance_variable_get(:@shape_a)
- shape_b = canvas.instance_variable_get(:@shape_b)
- shape_c = canvas.instance_variable_get(:@shape_c)
-
- # Big arrow
-
- big_arrow = canvas.instance_variable_get(:@big_arrow)
- big_arrow.line_width = 10.0 * width
- big_arrow.arrow_tip_length = shape_a
- big_arrow.arrow_length = shape_b
- big_arrow.arrow_width = shape_c
-
- # Outline
-
- points0 = RIGHT - 10 * shape_a * width
- points1 = MIDDLE - 10 * width / 2
- points2 = RIGHT - 10 * shape_b * width
- points3 = MIDDLE - 10 * (shape_c * width / 2.0)
- points4 = RIGHT
- points5 = MIDDLE
- points6 = points2
- points7 = MIDDLE + 10 * (shape_c * width / 2.0)
- points8 = points0
- points9 = MIDDLE + 10 * width / 2
-
- points = Goo::CanvasPoints.new(5)
- points.set_point(0, points0, points1)
- points.set_point(1, points2, points3)
- points.set_point(2, points4, points5)
- points.set_point(3, points6, points7)
- points.set_point(4, points8, points9)
-
- outline = canvas.instance_variable_get(:@outline)
- outline.points = points
-
- # Drag boxes
- move_drag_box(canvas.instance_variable_get(:@width_drag_box), LEFT, MIDDLE - 10 * width / 2.0)
- move_drag_box(canvas.instance_variable_get(:@shape_a_drag_box), RIGHT - 10 * shape_a * width, MIDDLE)
- move_drag_box(canvas.instance_variable_get(:@shape_b_c_drag_box), RIGHT - 10 * shape_b * width, MIDDLE - 10 * (shape_c * width / 2.0))
-
- # Dimensions
-
- set_dimension(canvas, "width_arrow", "width_text",
- LEFT - 10,
- MIDDLE - 10 * width / 2.0,
- LEFT - 10,
- MIDDLE + 10 * width / 2.0,
- LEFT - 15,
- MIDDLE,
- width)
-
- set_dimension(canvas, "shape_a_arrow", "shape_a_text",
- RIGHT - 10 * shape_a * width,
- MIDDLE + 10 * (shape_c * width / 2.0) + 10,
- RIGHT,
- MIDDLE + 10 * (shape_c * width / 2.0) + 10,
- RIGHT - 10 * shape_a * width / 2.0,
- MIDDLE + 10 * (shape_c * width / 2.0) + 15,
- shape_a)
-
- set_dimension(canvas, "shape_b_arrow", "shape_b_text",
- RIGHT - 10 * shape_b * width,
- MIDDLE + 10 * (shape_c * width / 2.0) + 35,
- RIGHT,
- MIDDLE + 10 * (shape_c * width / 2.0) + 35,
- RIGHT - 10 * shape_b * width / 2.0,
- MIDDLE + 10 * (shape_c * width / 2.0) + 40,
- shape_b)
-
- set_dimension(canvas, "shape_c_arrow", "shape_c_text",
- RIGHT + 10,
- MIDDLE - 10 * shape_c * width / 2.0,
- RIGHT + 10,
- MIDDLE + 10 * shape_c * width / 2.0,
- RIGHT + 15,
- MIDDLE,
- shape_c)
-
- # Info
-
- width_info = canvas.instance_variable_get(:@width_info)
- width_info.text = "line-width: #{width}"
-
- shape_a_info = canvas.instance_variable_get(:@shape_a_info)
- shape_a_info.text = "arrow-tip-length: #{shape_a} (* line-width)"
-
- shape_b_info = canvas.instance_variable_get(:@shape_b_info)
- shape_b_info.text = "arrow-length: #{shape_b} (* line-width)"
-
- shape_c_info = canvas.instance_variable_get(:@shape_c_info)
- shape_c_info.text = "arrow-length: #{shape_c} (* line-width)"
-
- # Sample arrows
-
- sample_1 = canvas.instance_variable_get(:@sample_1)
- sample_1.line_width = width
- sample_1.arrow_tip_length = shape_a
- sample_1.arrow_length = shape_b
- sample_1.arrow_width = shape_c
- sample_2 = canvas.instance_variable_get(:@sample_2)
- sample_2.line_width = width
- sample_2.arrow_tip_length = shape_a
- sample_2.arrow_length = shape_b
- sample_2.arrow_width = shape_c
- sample_3 = canvas.instance_variable_get(:@sample_3)
- sample_3.line_width = width
- sample_3.arrow_tip_length = shape_a
- sample_3.arrow_length = shape_b
- sample_3.arrow_width = shape_c
- end
-
- def create_dimension(canvas, root, arrow_name, text_name, anchor)
- item = Goo::CanvasPolyline.new(:parent => root,
- :close_path => false,
- :points => Goo::CanvasPoints.new(0),
- :fill_color => "black",
- :start_arrow => true,
- :end_arrow => true)
- canvas.instance_variable_set("@#{arrow_name}", item)
-
- item = Goo::CanvasText.new(:parent => root,
- :text => nil,
- :x => 0,
- :y => 0,
- :width => -1,
- :anchor => anchor,
- :fill_color => "black",
- :font => "Sans 12")
- canvas.instance_variable_set("@#{text_name}", item)
- end
-
- def create_info(canvas, root, info_name, x, y)
- item = Goo::CanvasText.new(:parent => root,
- :text => nil,
- :x => x,
- :y => y,
- :width => -1,
- :anchor => :nw,
- :fill_color => "black",
- :font => "Sans 14")
- canvas.instance_variable_set("@#{info_name}", item)
- end
-
- def create_sample_arrow(canvas, root, sample_name, x1, y1, x2, y2)
- points = Goo::CanvasPoints.new(2)
- points.set_point(0, x1, y1)
- points.set_point(1, x2, y2)
- item = Goo::CanvasPolyline.new(:parent => root,
- :points => points,
- :start_arrow => true,
- :end_arrow => true)
- canvas.instance_variable_set("@#{sample_name}", item)
- end
-
- def create_drag_box(canvas, root, box_name)
- item = Goo::CanvasRect.new(:parent => root,
- :x => 0,
- :y => 0,
- :width => 10,
- :height => 10,
- :fill_color => 'black',
- :stroke_color => 'black',
- :line_width => 1.0)
- canvas.instance_variable_set("@#{box_name}", item)
-
- item.signal_connect('enter_notify_event') do
- item.fill_color = 'red'
- true
- end
- item.signal_connect('leave_notify_event') do
- item.fill_color = 'black'
- true
- end
- item.signal_connect('button_press_event') do |item, target, event|
- # fixed "`initialize': ruby wrapper for this GObject* already exists."
- fleur = @fleur ||= Gdk::Cursor.new(:fleur)
- # Symbol is not allowed. Because "undefined method `|' for :pointer_motion_mask:Symbol"
- canvas.pointer_grab(item, Gdk::Event::Mask::POINTER_MOTION_MASK | Gdk::Event::Mask::BUTTON_RELEASE_MASK, fleur, event.time)
- true
- end
- item.signal_connect('button_release_event') do |item, target, event|
- canvas.pointer_ungrab(item, event.time)
- true
- end
- item.signal_connect('motion_notify_event') do |item, target, event|
- catch :done do
- throw :done, false unless event.state & :button1_mask == :button1_mask
-
- if item == canvas.instance_variable_get(:@width_drag_box)
- y = event.y
- width = ((MIDDLE - y) / 5).round
- throw :done, false if width < 0
- canvas.instance_variable_set(:@width, width)
- set_arrow_shape(canvas)
- elsif item == canvas.instance_variable_get(:@shape_a_drag_box)
- x = event.x
- width = canvas.instance_variable_get(:@width)
- shape_a = ((RIGHT - x) / 10 / width).round
- throw :done, false if (shape_a < 0) || (shape_a > 30)
- width = canvas.instance_variable_set(:@shape_a, shape_a)
- set_arrow_shape(canvas)
- elsif item == canvas.instance_variable_get(:@shape_b_c_drag_box)
- change = false
- width = canvas.instance_variable_get(:@width)
- x = event.x
- shape_b = ((RIGHT - x) / 10 / width).round
- if (shape_b >= 0) && (shape_b <= 30)
- canvas.instance_variable_set(:@shape_b, shape_b)
- change = true
- end
-
- y = event.y
- shape_c = ((MIDDLE - y) * 2 / 10 / width).round
- if shape_c >= 0
- canvas.instance_variable_set(:@shape_c, shape_c)
- change = true
- end
-
- set_arrow_shape(canvas) if change
- end
- true
- end
- end
- end
-end
diff --git a/goocanvas/sample/demo-events.rb b/goocanvas/sample/demo-events.rb
deleted file mode 100644
index e75d1dc..0000000
--- a/goocanvas/sample/demo-events.rb
+++ /dev/null
@@ -1,187 +0,0 @@
-#!/usr/bin/env ruby
-#
-# This sample code is a port of
-# goocanvas/demo/demo-events.c. It is licensed
-# under the terms of the GNU Library General Public License, version
-# 2 or (at your option) later.
-#
-# Copyright (C) 2013 Ruby-GNOME2 Project Team
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
-class CanvasSampleEvents < Gtk::Box
- def initialize
- super(:vertical, 4)
- border_width = 4
- show
- create_events_page(self)
- end
-
- private
- def create_events_page(vbox)
- # Instructions
-
- label = Gtk::Label.new(<<-EOT)
-Move the mouse over the items to check they receive the right motion events.
-The first 2 items in each group are 1) invisible and 2) visible but unpainted.
- EOT
- vbox.pack_start(label, :expand => false,
- :fill => false,
- :padding => 0)
- label.show
-
- # Frame and canvas
-
- alignment = Gtk::Alignment.new(0.5, 0.5, 0.0, 0.0)
- vbox.pack_start(alignment, :expand => false,
- :fill => false,
- :padding => 0)
- alignment.show
-
- frame = Gtk::Frame.new
- frame.shadow_type = :in
- alignment.add(frame)
- frame.show
-
- canvas = Goo::Canvas.new
-
- canvas.set_size_request(600, 450)
- canvas.set_bounds(0, 0, 600, 450)
- frame.add(canvas)
- canvas.show
-
- create_events_area(canvas, 0, :none, "none")
- create_events_area(canvas, 1, :visible_painted, "visible-painted")
- create_events_area(canvas, 2, :visible_fill, "visible-fill")
- create_events_area(canvas, 3, :visible_stroke, "visible-stroke")
- create_events_area(canvas, 4, :visible, "visible")
- create_events_area(canvas, 5, :painted, "painted")
- create_events_area(canvas, 6, :fill, "fill")
- create_events_area(canvas, 7, :stroke, "stroke")
- create_events_area(canvas, 8, :all, "all")
- end
-
- def create_events_area(canvas, area_num, pointer_events, label)
- row = area_num / 3
- col = area_num % 3
- x = col * 200
- y = row * 150
-
- root = canvas.root_item
-
- dash = Goo::CanvasLineDash.new(5.0, 5.0)
-
- # Create invisible item.
- rect = Goo::CanvasRect.new(:parent => root,
- :x => x + 45,
- :y => y + 35,
- :width => 30,
- :height => 30,
- :fill_color => "red",
- :visibility => :invisible,
- :line_width => 5.0,
- :pointer_events => pointer_events)
- view_id = sprintf("%s invisible", label)
- setup_item_signals(rect, view_id)
-
- # Display a thin rect around it to indicate it is there.
- rect = Goo::CanvasRect.new(:parent => root,
- :x => x + 42.5,
- :y => y + 32.5,
- :width => 36,
- :height => 36,
- # TODO: [BUG] Segmentation fault
- #:line_dash => dash,
- :line_width => 1.0,
- :stroke_color => "gray")
-
- # Create unpainted item.
- rect = Goo::CanvasRect.new(:parent => root,
- :x => x + 85,
- :y => y + 35,
- :width => 30,
- :height => 30,
- :stroke_pattern => nil,
- :line_width => 5.0,
- :pointer_events => pointer_events)
- view_id = sprintf("%s unpainted", label)
- setup_item_signals(rect, view_id)
-
- # Display a thin rect around it to indicate it is there.
- rect = Goo::CanvasRect.new(:parent => root,
- :x => x + 82.5,
- :y => y + 32.5,
- :width => 36,
- :height => 36,
- # TODO: [BUG] Segmentation fault
- #:line_dash => dash,
- :line_width => 1.0,
- :stroke_color => "gray")
-
- # Create stroked item.
- rect = Goo::CanvasRect.new(:parent => root,
- :x => x + 125,
- :y => y + 35,
- :width => 30,
- :height => 30,
- :line_width => 5.0,
- :pointer_events => pointer_events)
- view_id = sprintf("%s stroked", label)
- setup_item_signals(rect, view_id)
-
- # Create filled item.
- rect = Goo::CanvasRect.new(:parent => root,
- :x => x + 60,
- :y => y + 75,
- :width => 30,
- :height => 30,
- :fill_color => "red",
- :stroke_pattern => nil,
- :line_width => 5.0,
- :pointer_events => pointer_events)
- view_id = sprintf("%s filled", label)
- setup_item_signals(rect, view_id)
-
- # Create stroked & filled item.
- rect = Goo::CanvasRect.new(:parent => root,
- :x => x + 100,
- :y => y + 75,
- :width => 30,
- :height => 30,
- :fill_color => "red",
- :line_width => 5.0,
- :pointer_events => pointer_events)
- view_id = sprintf("%s stroked & filled", label)
- setup_item_signals(rect, view_id)
-
- Goo::CanvasText.new(:parent => root,
- :text => label,
- :x => x + 100,
- :y => y + 130,
- :width => -1,
- :anchor => :center,
- :font => "Sans 12",
- :fill_color => "blue")
- end
-
- def setup_item_signals(item, item_id)
- item.signal_connect("motion_notify_event") do |widget, event|
- if item_id
- printf("%s item received 'motion-notify' signal\n", item_id)
- end
- false
- end
- end
-end
diff --git a/goocanvas/sample/demo-features.rb b/goocanvas/sample/demo-features.rb
deleted file mode 100644
index d7dc676..0000000
--- a/goocanvas/sample/demo-features.rb
+++ /dev/null
@@ -1,148 +0,0 @@
-#!/usr/bin/env ruby
-#
-# This sample code is a port of
-# goocanvas/demo/demo-features.c. It is licensed
-# under the terms of the GNU Library General Public License, version
-# 2 or (at your option) later.
-#
-# Copyright (C) 2013 Ruby-GNOME2 Project Team
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
-class CanvasSampleFeatures < Gtk::Box
- def initialize
- super(:vertical, 4)
- set_border_width(4)
- show
- create_canvas_features(self)
- end
-
- private
- def create_canvas_features(box)
- instructions(box)
- root = frame_and_canvas(box)
- parent1 = first_parent_and_box(root)
- parent2 = second_parent_and_box(root)
- big_circle_to_be_reparented(parent1, parent2)
- a_group_to_be_reparented(parent1, parent2)
- end
-
- def instructions(box)
- label = Gtk::Label.new(<<-EOT)
-Reparent test: click on the items to switch them between parents
- EOT
- box.pack_start(label, :expand => false,
- :fill => false,
- :padding => 0)
- label.show
- end
-
- def frame_and_canvas(box)
- alignment = Gtk::Alignment.new(0.5, 0.5, 0.0, 0.0)
- box.pack_start(alignment, :expand => false,
- :fill => false,
- :padding => 0)
- alignment.show
-
- frame = Gtk::Frame.new
- frame.shadow_type = :in
- alignment.add(frame)
- frame.show
-
- canvas = Goo::Canvas.new
- root = canvas.root_item
-
- canvas.set_size_request(400, 200)
- canvas.set_bounds(0, 0, 400, 200)
- frame.add(canvas)
- canvas.show
-
- root
- end
-
- def first_parent_and_box(root)
- parent1 = Goo::CanvasGroup.new(:parent => root)
- Goo::CanvasRect.new(:parent => parent1,
- :x => 0,
- :y => 0,
- :width => 200,
- :height => 200,
- :fill_color => "tan")
- parent1
- end
-
- def second_parent_and_box(root)
- parent2 = Goo::CanvasGroup.new(:parent => root)
- parent2.translate(200, 0)
- Goo::CanvasRect.new(:parent => parent2,
- :x => 0,
- :y => 0,
- :width => 200,
- :height => 200,
- :fill_color => "#204060")
- parent2
- end
-
- def big_circle_to_be_reparented(parent1, parent2)
- item = Goo::CanvasEllipse.new(:parent => parent1,
- :center_x => 100,
- :center_y => 100,
- :radius_x => 90,
- :radius_y => 90,
- :stroke_color => "black",
- :fill_color => "mediumseagreen",
- :line_width => 3.0)
-
- item.signal_connect("button-press-event") do |widget, event|
- on_button_press(widget, event, parent1, parent2)
- end
- end
-
- def a_group_to_be_reparented(parent1, parent2)
- group = Goo::CanvasGroup.new(:parent => parent2)
- group.translate(100, 100)
-
- Goo::CanvasEllipse.new(:parent => group,
- :center_x => 0,
- :center_y => 0,
- :radius_x => 50,
- :radius_y => 50,
- :stroke_color => "black",
- :fill_color => "wheat",
- :line_width => 3.0)
-
- Goo::CanvasEllipse.new(:parent => group,
- :center_x => 0,
- :center_y => 0,
- :radius_x => 25,
- :radius_y => 25,
- :fill_color => "steelblue")
-
- group.signal_connect("button-press-event") do |widget, event|
- on_button_press(widget, event, parent1, parent2)
- end
- end
-
- def on_button_press(item, event, parent1, parent2)
- puts "In on_button_press"
- parent = item.parent
- item.remove
- if parent == parent1
- parent2.add_child(item, -1)
- else
- parent1.add_child(item, -1)
- end
- end
-end
diff --git a/goocanvas/sample/demo-fifteen.rb b/goocanvas/sample/demo-fifteen.rb
deleted file mode 100644
index f7790f2..0000000
--- a/goocanvas/sample/demo-fifteen.rb
+++ /dev/null
@@ -1,226 +0,0 @@
-# -*- indent-tabs-mode: nil -*-
-=begin header
-
- demo-fifteen.rb - Canvas test rewritten in Ruby/GNOME
-
- Rewritten by Emmanuel Pinault <seatmanu at yahoo.com>
-
-Original Copyright:
-
- Author : Richard Hestilow <hestgray at ionet.net>
-
- Copyright (C) 1998 Free Software Foundation
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-
-=end
-
-class CanvasSampleFifteen < Gtk::Box
- PIECE_SIZE = 50
- SCRAMBLE_MOVES = 32
-
- def initialize
- super(:vertical, 4)
- border_width = 4
- show()
-
- alignment = Gtk::Alignment.new(0.5, 0.5, 0.0, 0.0)
- pack_start(alignment, :expand => true, :fill => true, :padding => 0)
- alignment.show()
-
- frame = Gtk::Frame.new
- frame.set_shadow_type(:in);
- alignment.add(frame)
- frame.show()
-
- # Create the canvas and board
-
- @canvas = Goo::Canvas.new()
- @canvas.set_size_request(PIECE_SIZE * 4 + 1, PIECE_SIZE * 4 + 1)
- #@canvas.set_scroll_region(0, 0, PIECE_SIZE * 4 + 1, PIECE_SIZE * 4 + 1)
- frame.add(@canvas)
- @canvas.show()
-
- @board = Array.new(16)
-
- 0.upto(14) do |i|
- @board[i] = Piece.new(:parent => @canvas.root_item)
- @board[i].setup(self, i)
- end
- @board[15] = nil;
-
- # Scramble button
- button = Gtk::Button.new(:label => "Scramble")
- pack_start(button, :expand => false, :fill => false, :padding => 0)
- button.signal_connect("clicked") do |button|
- scramble()
- end
- button.show()
- end
-
- def test_win
- 0.upto(14) do |i|
- if @board[i].nil? || @board[i].num != i
- return
- end
- end
- dialog = Gtk::MessageDialog.new(:parent => parent.parent,
- :flags => :destroy_with_parent,
- :type => :info,
- :buttons_type => :ok,
- :message => "You stud, you win!")
- dialog.set_modal(true)
- dialog.run
- dialog.hide
- end
-
- def piece_enter_notify(item)
- item.text.set_property(:fill_color, "white")
- end
-
- def piece_leave_notify(item)
- item.text.set_property(:fill_color, "black")
- end
-
- def piece_button_press(item)
- y = item.pos / 4
- x = item.pos % 4
-
- move = true
-
- if (y > 0) && @board[(y - 1) * 4 + x].nil?
- dx = 0.0
- dy = -1.0
- y -= 1
- elsif (y < 3) && @board[(y + 1) * 4 + x].nil?
- dx = 0.0
- dy = 1.0
- y += 1
- elsif (x > 0) && @board[y * 4 + x - 1].nil?
- dx = -1.0
- dy = 0.0
- x -= 1
- elsif (x < 3) && @board[y * 4 + x + 1].nil?
- dx = 1.0
- dy = 0.0
- x += 1
- else
- move = false
- end
-
- if move
- newpos = y * 4 + x
- @board[item.pos] = nil
- @board[newpos] = item
- item.pos = newpos
- item.translate(dx * PIECE_SIZE, dy * PIECE_SIZE)
- test_win()
- end
- end
-
-
- def scramble
- srand()
- # First, find the blank spot
- pos = 0
- 0.upto(15) do |i|
- if @board[i].nil?
- pos = i
- break
- end
- end
- # "Move the blank spot" around in order to scramble the pieces
-
- 0.upto(SCRAMBLE_MOVES) do
- dir = rand(4).to_i
- x = y = 0
-
- if (dir == 0) && (pos > 3) # up
- y = -1
- elsif (dir == 1) && (pos < 12) # down
- y = 1
- elsif (dir == 2) && ((pos % 4) != 0) # left
- x = -1
- elsif (dir == 3) && ((pos % 4) != 3) # right
- x = 1
- else
- redo
- end
-
- oldpos = pos + y * 4 + x;
- @board[pos] = @board[oldpos];
- @board[oldpos] = nil
- @board[pos].pos = pos
- @board[pos].translate(-x * PIECE_SIZE, -y * PIECE_SIZE)
- pos = oldpos
- end
- end
-
- class Piece < Goo::CanvasGroup
- attr_reader :text, :num, :pos
- attr_writer :pos
-
- def initialize(*arg)
- super(*arg)
- end
-
- def setup(app, i)
- y = i / 4
- x = i % 4
- translate( x * PIECE_SIZE,y * PIECE_SIZE)
-
- Goo::CanvasRect.new(:parent => self,
- :x => 0,
- :y => 0,
- :width => PIECE_SIZE,
- :height => PIECE_SIZE,
- :line_width => 1.0,
- :fill_color => get_piece_color(x, y),
- :stroke_color => "black")
-
-
- @text = Goo::CanvasText.new(:parent => self,
- :text => i.to_s,
- :x => PIECE_SIZE / 2.0,
- :y => PIECE_SIZE / 2.0,
- :width => -1,
- :anchor => :center,
- :font=>"Sans bold 24",
- :fill_color => "black")
- @num = i
- @pos = i
-
- self.signal_connect("enter_notify_event") do |item, event|
- app.piece_enter_notify(item)
- end
-
- self.signal_connect("leave_notify_event") do |item, event|
- app.piece_leave_notify(item)
- end
-
- self.signal_connect("button_press_event") do |item, event|
- app.piece_button_press(item)
- end
- end
-
- private
- def get_piece_color(x, y)
- r = ((4 - x) * 255) / 4;
- g = ((4 - y) * 255) / 4;
- b = 128;
- return sprintf("#%02x%02x%02x", r, g, b)
- end
- end
-end
diff --git a/goocanvas/sample/demo-focus.rb b/goocanvas/sample/demo-focus.rb
deleted file mode 100644
index bef597f..0000000
--- a/goocanvas/sample/demo-focus.rb
+++ /dev/null
@@ -1,135 +0,0 @@
-#!/usr/bin/env ruby
-#
-# This sample code is a port of
-# goocanvas/demo/demo-focus.c. It is licensed
-# under the terms of the GNU Library General Public License, version
-# 2 or (at your option) later.
-#
-# Copyright (C) 2013 Ruby-GNOME2 Project Team
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
-class CanvasSampleFocus < Gtk::Box
- def initialize
- super(:vertical, 4)
- set_border_width(4)
- show
- create_focus_page(self)
- end
-
- private
- def create_focus_page(vbox)
- label = Gtk::Label.new(<<-EOT)
-Use Tab, Shift+Tab or the arrow keys to move the keyboard focus between the canvas items.
- EOT
- vbox.pack_start(label, :expand => false,
- :fill => false,
- :padding => 0)
- label.show
-
- scrolled_win = Gtk::ScrolledWindow.new
- scrolled_win.shadow_type = :in
- scrolled_win.show
- vbox.pack_start(scrolled_win, :expand => true,
- :fill => true,
- :padding => 0)
-
- canvas = Goo::Canvas.new
- canvas.can_focus = true
- canvas.set_size_request(600, 450)
- canvas.set_bounds(0, 0, 1000, 1000)
- canvas.show
- scrolled_win.add(canvas)
-
- setup_canvas(canvas)
- end
-
- def setup_canvas(canvas)
- create_focus_box(canvas, 109, 80, 50, 30, "red")
- create_focus_box(canvas, 300, 160, 50, 30, "orange")
- create_focus_box(canvas, 500, 50, 50, 30, "yellow")
- create_focus_box(canvas, 70, 400, 50, 30, "blue")
- create_focus_box(canvas, 130, 200, 50, 30, "magenta")
- create_focus_box(canvas, 200, 160, 50, 30, "green")
- create_focus_box(canvas, 450, 450, 50, 30, "cyan")
- create_focus_box(canvas, 300, 350, 50, 30, "grey")
- create_focus_box(canvas, 900, 900, 50, 30, "gold")
- create_focus_box(canvas, 800, 150, 50, 30, "thistle")
- create_focus_box(canvas, 600, 800, 50, 30, "azure")
- create_focus_box(canvas, 700, 250, 50, 30, "moccasin")
- create_focus_box(canvas, 500, 100, 50, 30, "cornsilk")
- create_focus_box(canvas, 200, 750, 50, 30, "plum")
- create_focus_box(canvas, 400, 800, 50, 30, "orchid")
- end
-
- def create_focus_box(canvas, x, y, width, height, color)
- root = canvas.root_item
- item = Goo::CanvasRect.new(:parent => root,
- :x => x,
- :y => y,
- :width => width,
- :height => height,
- :stroke_pattern => nil,
- :fill_color => color,
- :line_width => 5.0,
- :can_focus => true)
-
- item.signal_connect("focus-in-event") do |widget|
- on_focus_in(widget, color)
- end
- item.signal_connect("focus-out-event") do |widget|
- on_focus_out(widget, color)
- end
-
- item.signal_connect("button-press-event") do |widget|
- on_button_press(widget, color)
- end
-
- item.signal_connect("key-press-event") do
- on_key_press(color)
- end
- end
-
- def on_focus_in (item, color)
- puts "#{color} received focus-in event"
-
- # Note that this is only for testing. Setting item properties to indicate
- # focus isn't a good idea for real apps, as there may be multiple views.
- item.stroke_color = "black"
-
- false
- end
-
- def on_focus_out(item, color)
- puts "#{color} received focus-out event"
-
- # Note that this is only for testing. Setting item properties to indicate
- # focus isn't a good idea for real apps, as there may be multiple views.
- item.stroke_pattern = nil
-
- false
- end
-
- def on_button_press(item, color)
- puts "#{color} received button-press event"
- item.canvas.grab_focus(item)
- false
- end
-
- def on_key_press(color)
- puts "#{color} received key-press event"
- false
- end
-end
diff --git a/goocanvas/sample/demo-primitives.rb b/goocanvas/sample/demo-primitives.rb
deleted file mode 100644
index e4c5794..0000000
--- a/goocanvas/sample/demo-primitives.rb
+++ /dev/null
@@ -1,719 +0,0 @@
-# -*- coding: utf-8 -*-
-# -*- indent-tabs-mode: nil -*-
-=begin header
-
- Rewritten by Emmanuel Pinault <seatmanu at yahoo.com>
-
-Original Copyright:
-
- Author : Richard Hestilow <hestgray at ionet.net>
-
- Copyright (C) 1998 Free Software Foundation
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-
-=end
-class CanvasSamplePrimitives < Gtk::VBox
- VERTICES = 10
- RADIUS = 60.0
-
- def initialize(aa)
- super(false, 4)
- @dragging = false
- self.border_width = 4
- show
-
- label = Gtk::Label.new("Drag an item with button 1. " +
- "Click button 2 on an item to lower it, " +
- "or button 3 to raise it.")
- pack_start(label, false, false, 0)
- label.show
-
- hbox = Gtk::HBox.new(false, 4)
- pack_start(hbox, false, false, 0)
- hbox.show
-
- # Create the canvas
- canvas = Goo::Canvas.new
- canvas.automatic_bounds = true
- canvas.bounds_from_origin = false
- canvas.bounds_padding = 4.0
- canvas.background_color_rgb = 0xc3c3ff
- canvas.set_bounds(0, 0, 604, 454)
-
- # Scale
- label = Gtk::Label.new("Scale:")
- hbox.pack_start(label, false, false, 0)
- label.show
-
- adjustment = Gtk::Adjustment.new(1.00, 0.05, 50.00, 0.05, 0.50, 0.50)
- button = Gtk::SpinButton.new(adjustment, 0.0, 2)
- adjustment.signal_connect('value_changed') do |adj,|
- canvas.scale = adj.value
- end
- button.set_size_request(50, -1)
- hbox.pack_start(button, false, false, 0)
- button.show
-
- label = Gtk::Label.new("Scale X:")
- hbox.pack_start(label, false, false, 0)
- label.show
-
- adjustment = Gtk::Adjustment.new(1.00, 0.05, 50.00, 0.05, 0.50, 0.50)
- button = Gtk::SpinButton.new(adjustment, 0.0, 2)
- adjustment.signal_connect('value_changed') do |adj,|
- canvas.scale_x = adj.value
- end
- button.set_size_request(50, -1)
- hbox.pack_start(button, false, false, 0)
- button.show
-
- label = Gtk::Label.new("Scale Y:")
- hbox.pack_start(label, false, false, 0)
- label.show
-
- adjustment = Gtk::Adjustment.new(1.00, 0.05, 50.00, 0.05, 0.50, 0.50)
- button = Gtk::SpinButton.new(adjustment, 0.0, 2)
- adjustment.signal_connect('value_changed') do |adj,|
- canvas.scale_y = adj.value
- end
- button.set_size_request(50, -1)
- hbox.pack_start(button, false, false, 0)
- button.show
-
- hbox = Gtk::HBox.new(false, 4)
- pack_start(hbox, false, false, 0)
- hbox.show
-
- # Center
- button = Gtk::CheckButton.new('Center scroll region')
- hbox.pack_start(button, false, false, 0)
- button.signal_connect("toggled") do |_button,|
- canvas.center_scroll_region = _button.active
- end
- # button.show
-
- # Move Ellipse
- button = Gtk::Button.new("Move Ellipse")
- hbox.pack_start(button, false, false, 0)
- button.show
- last_state = 0
- button.signal_connect("clicked") do |_button,|
- $ellipse2.transform = nil
-
- case last_state
- when 0
- $ellipse2.center_x = 300.0
- $ellipse2.center_y = 70.0
- $ellipse2.radius_x = 45.0
- $ellipse2.radius_y = 30.0
- $ellipse2.fill_color = 'red'
- $ellipse2.stroke_color = 'midnightblue'
- $ellipse2.line_width = 4.0
- $ellipse2.title = 'A red ellipse'
- when 1
- $ellipse2.center_x = 390.0
- $ellipse2.center_y = 150.0
- $ellipse2.radius_x = 45.0
- $ellipse2.radius_y = 40.0
- $ellipse2.fill_color = 'brown'
- $ellipse2.stroke_color = 'midnightblue'
- $ellipse2.line_width = 4.0
- $ellipse2.title = 'A brown ellipse'
- when 2
- $ellipse2.center_x = 0.0
- $ellipse2.center_y = 0.0
- $ellipse2.radius_y = 30.0
- $ellipse2.set_simple_transform(100, 100, 1, 0)
- when 3
- $ellipse2.set_simple_transform(200, 100, 2, 0)
- when 4
- $ellipse2.set_simple_transform(200, 200, 1, 45)
- when 5
- $ellipse2.set_simple_transform(50, 50, 0.2, 225)
- else
- $ellipse2.center_x = 335.0
- $ellipse2.center_y = 70.0
- $ellipse2.radius_x = 45.0
- $ellipse2.radius_y = 30.0
- $ellipse2.fill_color = 'purple'
- $ellipse2.stroke_color = 'midnightblue'
- $ellipse2.line_width = 4.0
- $ellipse2.title = 'A purple ellipse'
- end
- last_state = (last_state + 1) % 7
- end
-
- # Animate Ellipse
- button = Gtk::Button.new("Animate Ellipse")
- hbox.pack_start(button, false, false, 0)
- button.show
- button.signal_connect('clicked') do
- $ellipse2.animate(100, 100, 1, 90, true,
- 1000, 40, Goo::CanvasItem::ANIMATE_BOUNCE)
- end
-
- # Stop Animation
- button = Gtk::Button.new("Stop Animation")
- hbox.pack_start(button, false, false, 0)
- button.show
- button.signal_connect('clicked') do
- $ellipse2.stop_animation
- end
-
- # Create PDF
- button = Gtk::Button.new("Write PDF")
- hbox.pack_start(button, false, false, 0)
- button.show
- button.signal_connect('clicked') do
- puts "In write_pdf_clicked"
-
- Cairo::PDFSurface.new("demo.pdf", 9 * 72, 10 * 72) do |surface|
- Cairo::Context.new(surface) do |context|
-
- # Place it in the middle of our 9x10 page.
- context.translate(20, 130)
-
- canvas.render(context, nil, 1.0)
-
- context.show_page
- end
- end
- end
-
- button = Gtk::Button.new("Change Bounds")
- hbox.pack_start(button, false, false, 0)
- button.show
- bounds = [
- [-100, -100, 200, 200],
- [100, 100, 200, 200],
- [0, 0, 300, 300],
- [0, 0, 604, 454],
- ]
- bounds_n = 0
- button.signal_connect("clicked") do |_button,|
- if bounds_n < 4
- automatic_bounds = false
- bounds_from_origin = false
- canvas.set_bounds(*bounds[bounds_n])
- elsif bounds_n == 4
- automatic_bounds = true
- bounds_from_origin = true
- end
-
- canvas.automatic_bounds = automatic_bounds
- canvas.bounds_from_origin = bounds_from_origin
- canvas.bounds_padding = 50
- bounds_n = (bounds_n + 1) % 6
- end
-
- hbox = Gtk::HBox.new(false, 4)
- pack_start(hbox, false, false, 0)
- hbox.show
-
- # Scroll to
- label = Gtk::Label.new("Scroll To:")
- hbox.pack_start(label, false, false, 0)
- label.show
-
- button = Gtk::Button.new("50,50")
- hbox.pack_start(button, false, false, 0)
- button.show
- button.signal_connect('clicked') {canvas.scroll_to(50, 50)}
-
- button = Gtk::Button.new("250,250")
- hbox.pack_start(button, false, false, 0)
- button.show
- button.signal_connect('clicked') {canvas.scroll_to(250, 250)}
-
- button = Gtk::Button.new("500,500")
- hbox.pack_start(button, false, false, 0)
- button.show
- button.signal_connect('clicked') {canvas.scroll_to(500, 500)}
-
- # Scroll anchor
- label = Gtk::Label.new("Anchor:")
- hbox.pack_start(label, false, false, 0)
- label.show
-
- group = nil
- [
- ['NW', Gtk::ANCHOR_NW],
- ['NE', Gtk::ANCHOR_NE],
- ['W', Gtk::ANCHOR_W],
- ['C', Gtk::ANCHOR_CENTER],
- ['E', Gtk::ANCHOR_E],
- ['SW', Gtk::ANCHOR_SW],
- ['S', Gtk::ANCHOR_S],
- ['SE', Gtk::ANCHOR_SE],
- ].each do |name, anchor|
- if group
- button = Gtk::RadioButton.new(group, name)
- else
- button = Gtk::RadioButton.new(name)
- end
- group, = button.group
- hbox.pack_start(button, false, false, 0)
- button.show
- button.signal_connect('toggled') do |_button|
- canvas.anchor = anchor if _button.active?
- end
- end
-
- # Layout the stuff
- scrolled_window = Gtk::ScrolledWindow.new
- scrolled_window.show
- pack_start(scrolled_window, true, true, 0)
-
- canvas.show
- scrolled_window.add(canvas)
-
- # Add all the canvas items.
- setup_canvas(canvas)
- end
-
- def image_path(name)
- File.join(File.dirname(__FILE__), name)
- end
-
- def setup_item_signals(item)
- dragging = false
- drag_x = nil
- drag_y = nil
-
- item.signal_connect('motion_notify_event') do |item, target, event|
- if dragging && (event.state & Gdk::Window::BUTTON1_MASK == Gdk::Window::BUTTON1_MASK)
- item.translate(event.x - drag_x, event.y - drag_y)
- end
- true
- end
-
- item.signal_connect('button_press_event') do |item, target, event|
- case event.button
- when 1
- if event.state & Gdk::Window::SHIFT_MASK == Gdk::Window::SHIFT_MASK
- item.parent.remove_child(item)
- else
- drag_x = event.x
- drag_y = event.y
-
- fleur = Gdk::Cursor.new(Gdk::Cursor::FLEUR)
- canvas = item.canvas
- canvas.pointer_grab(item, Gdk::Event::POINTER_MOTION_MASK | Gdk::Event::BUTTON_RELEASE_MASK, fleur, event.time)
- dragging = true
- end
- when 2
- item.lower(nil)
- when 3
- item.raise(nil)
- end
- true
- end
-
- item.signal_connect('button_release_event') do |item, target, event|
- canvas = item.canvas
- canvas.pointer_ungrab(item, event.time) if canvas
- dragging = false
- true
- end
- end
-
- def setup_heading(root, text, pos)
- x = (pos % 3) * 200 + 100
- y = (pos / 3) * 150 + 5
-
- item = Goo::CanvasText.new(root, text, x, y, -1, Gtk::ANCHOR_N, :font => "Sans 12")
- item.skew_y(30, x, y)
- end
-
- def setup_divisions(root)
- group = Goo::CanvasGroup.new(root, nil)
- group.translate(2, 2)
-
- item = Goo::CanvasRect.new(group, 0, 0, 600, 450, :line_width => 4.0)
- item = Goo::CanvasPolyline.new_line(group, 0, 150, 600, 150, :line_width => 4.0)
- item = Goo::CanvasPolyline.new_line(group, 0, 300, 600, 300, :line_width => 4.0)
- item = Goo::CanvasPolyline.new_line(group, 200, 0, 200, 450, :line_width => 4.0)
- item = Goo::CanvasPolyline.new_line(group, 400, 0, 400, 450, :line_width => 4.0)
-
- setup_heading(group, 'Rectangles', 0)
- setup_heading(group, 'Ellipses', 1)
- setup_heading(group, 'Texts', 2)
- setup_heading(group, 'Images', 3)
- setup_heading(group, 'Lines', 4)
- setup_heading(group, 'Polygons', 7)
- end
-
- # FIXME: I think we may need to check byte order.
- def create_stipple(color_name, stipple_data)
- color = Gdk::Color.parse(color_name)
- stipple_data[2] = stipple_data[14] = (color.red >> 8)
- stipple_data[1] = stipple_data[13] = (color.green >> 8)
- stipple_data[0] = stipple_data[12] = (color.blue >> 8)
- surface = Cairo::ImageSurface.new(stipple_data.pack('C*'), Cairo::FORMAT_ARGB32, 2, 2, 8)
- pattern = Cairo::SurfacePattern.new(surface)
- pattern.extend = Cairo::EXTEND_REPEAT
-
- return pattern
- end
-
- def setup_rectangles(root)
- stipple_data = [ 0, 0, 0, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255 ]
-
- item = Goo::CanvasRect.new(root, 20, 30, 50, 30,
- :stroke_color => "red",
- :line_width => 8.0)
- setup_item_signals(item)
-
- pattern = create_stipple("mediumseagreen", stipple_data)
- item = Goo::CanvasRect.new(root, 90, 40, 90, 60,
- :fill_pattern => pattern,
- :stroke_color => 'black',
- :line_width => 4.0)
- setup_item_signals(item)
-
- item = Goo::CanvasRect.new(root, 10, 80, 70, 60, :fill_color => "steelblue")
- setup_item_signals(item)
-
- item = Goo::CanvasRect.new(root, 20, 90, 70, 60,
- :fill_color_rgba => 0x3cb37180,
- :stroke_color => "blue",
- :line_width => 2.0)
- setup_item_signals(item)
-
- item = Goo::CanvasRect.new(root, 110, 80, 50, 30,
- :radius_x => 20.0,
- :radius_y => 10.0,
- :stroke_color => "yellow",
- :fill_color_rgba => 0x3cb3f180)
- setup_item_signals(item)
-
- #TODO
- # item = goo_demo_item_new(root, 30, 20, 50, 30,
- # :fill_color => "yellow")
- # setup_item_signals(item)
- end
-
- def setup_ellipses(root)
- stipple_data = [ 0, 0, 0, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255 ]
-
- ellipse1 = Goo::CanvasEllipse.new(root, 245, 45, 25, 15,
- :stroke_color => 'goldenrod',
- :line_width => 8.0)
- setup_item_signals(ellipse1)
-
- $ellipse2 = Goo::CanvasEllipse.new(root, 335, 70, 45, 30,
- :fill_color => 'wheat',
- :stroke_color => 'midnightblue',
- :line_width => 4.0,
- :title => 'An ellipse')
- setup_item_signals($ellipse2)
-
- pattern = create_stipple('cadetblue', stipple_data)
- ellipse3 = Goo::CanvasEllipse.new(root, 245, 110, 35, 30,
- :fill_pattern => pattern,
- :stroke_color => 'black',
- :line_width => 1.0)
- setup_item_signals(ellipse3)
- end
-
-
-
- def polish_diamond(root)
- group = Goo::CanvasGroup.new(root,
- :line_width => 1.0,
- :line_cap => Cairo::LINE_CAP_ROUND)
- group.translate(270, 230)
- setup_item_signals(group)
-
- VERTICES.times do |i|
- a = 2.0 * Math::PI * i / VERTICES
- x1 = RADIUS * Math.cos(a)
- y1 = RADIUS * Math.sin(a)
-
- ((i + 1)...VERTICES).each do |j|
- a = 2.0 * Math::PI * j / VERTICES
- x2 = RADIUS * Math.cos(a)
- y2 = RADIUS * Math.sin(a)
- item = Goo::CanvasPolyline.new_line(group, x1, y1, x2, y2)
- end
- end
- end
-
- SCALE = 7.0
-
- def make_hilbert(root)
- hilbert = "urdrrulurulldluuruluurdrurddldrrruluurdrurddldrddlulldrdldrrurd".split(//)
- stipple_data = [ 0, 0, 0, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255 ]
-
- points = [ 340.0, 290.0 ]
-
- i = 0
- hilbert.each do |c|
- case c
- when 'u'
- points[i+2] = points[i+0]
- points[i+3] = points[i+1] - SCALE
- when 'd'
- points[i+2] = points[i+0]
- points[i+3] = points[i+1] + SCALE
- when 'l'
- points[i+2] = points[i+0] - SCALE
- points[i+3] = points[i+1]
- when 'r'
- points[i+2] = points[i+0] + SCALE
- points[i+3] = points[i+1]
- end
- i += 2
- end
-
- pattern = create_stipple("red", stipple_data)
- item = Goo::CanvasPolyline.new(root, false, points,
- :line_width => 4.0,
- :stroke_pattern => pattern,
- :line_cap => Cairo::LINE_CAP_SQUARE,
- :line_join => Cairo::LINE_JOIN_MITER)
- setup_item_signals(item)
- end
-
- def setup_lines(root)
- polish_diamond(root)
- make_hilbert(root)
-
- # Arrow tests
-
- polyline1 = Goo::CanvasPolyline.new(root, false,
- [ 340.0, 170.0,
- 340.0, 230.0,
- 390.0, 230.0,
- 390.0, 170.0,
- ],
- :stroke_color => 'midnightblue',
- :line_width => 3.0,
- :start_arrow => true,
- :end_arrow => true,
- :arrow_tip_length => 3.0,
- :arrow_length => 4.0,
- :arrow_width => 3.5)
- setup_item_signals(polyline1)
-
- polyline2 = Goo::CanvasPolyline.new(root, false,
- [ 356.0, 180.0,
- 374.0, 220.0,
- ] ,
- :stroke_color => "blue",
- :line_width => 1.0,
- :start_arrow => true,
- :end_arrow => true,
- :arrow_tip_length => 5.0,
- :arrow_length => 6.0,
- :arrow_width => 6.0)
- setup_item_signals(polyline2)
-
- polyline3 = Goo::CanvasPolyline.new(root, false,
- [ 356.0, 220.0,
- 374.0, 180.0,
- ],
- :stroke_color => "blue",
- :line_width => 1.0,
- :start_arrow => true,
- :end_arrow => true,
- :arrow_tip_length => 5.0,
- :arrow_length => 6.0,
- :arrow_width => 6.0)
- setup_item_signals(polyline3)
-
- # Test polyline without any coords.
- polyline4 = Goo::CanvasPolyline.new(root, false, [])
- setup_item_signals(polyline4)
-
- # Test polyline with 1 coord and arrows.
- polyline5 = Goo::CanvasPolyline.new(root, false,
- [ 356.0, 220.0 ],
- :start_arrow => true,
- :end_arrow => true)
- setup_item_signals(polyline5)
- end
-
- def setup_polygons(root)
- stipple_data = [ 0, 0, 0, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255 ]
-
- points =
- [ 210.0, 320.0,
- 210.0, 380.0,
- 260.0, 350.0,
- ]
- pattern = create_stipple("blue", stipple_data)
- polyline1 = Goo::CanvasPolyline.new(root, true, points,
- :line_width => 1.0,
- :fill_pattern => pattern,
- :stroke_color => "black")
- setup_item_signals(polyline1)
-
- points =
- [ 270.0, 330.0,
- 270.0, 430.0,
- 390.0, 430.0,
- 390.0, 330.0,
- 310.0, 330.0,
- 310.0, 390.0,
- 350.0, 390.0,
- 350.0, 370.0,
- 330.0, 370.0,
- 330.0, 350.0,
- 370.0, 350.0,
- 370.0, 410.0,
- 290.0, 410.0,
- 290.0, 330.0,
- ]
- polyline2 = Goo::CanvasPolyline.new(root, true, points,
- :fill_color => 'tan',
- :stroke_color => 'black',
- :line_width => 3.0)
- setup_item_signals(polyline2)
- end
-
- def make_anchor(root, x, y)
- transform = Cairo::Matrix.new(0.8, 0.2, -0.3, 0.5, x, y)
-
- group = Goo::CanvasGroup.new(root)
- group.translate(x, y)
- group.transform = transform
- $transforms ||= []
- $transforms << transform
-
- item = Goo::CanvasRect.new(group, -2.5, -2.5, 4, 4, :line_width => 1.0)
- setup_item_signals(item)
-
- group
- end
-
- def setup_texts(root)
- stipple_data = [ 0, 0, 0, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255 ]
-
- pattern = create_stipple('blue', stipple_data)
- item = Goo::CanvasText.new(make_anchor(root, 420, 20),
- 'Anchor NW', 0, 0, -1, Gtk::ANCHOR_NW,
- :font => 'Sans Bold 24',
- :fill_pattern => pattern)
- setup_item_signals(item)
-
- item = Goo::CanvasText.new(make_anchor(root, 470, 75),
- "Anchor center\nJustify center\nMultiline text\nb8bit text ÅÄÖåäö",
- 0, 0, -1, Gtk::ANCHOR_CENTER,
- :font => "monospace bold 14",
- :alignment => Pango::ALIGN_CENTER,
- :fill_color => 'firebrick')
- setup_item_signals(item)
-
- textitem = Goo::CanvasText.new(make_anchor(root, 420, 240),
- "This is a very long paragraph that will need to be wrapped over several lines so we can see what happens to line-breaking as the view is zoomed in and out.",
- 0, 0, 180, Gtk::ANCHOR_W,
- :font => 'Sans 12',
- :fill_color => 'goldenrod')
- setup_item_signals(textitem)
-
- textitem = Goo::CanvasText.new(root,
- "Ellipsized text.",
- 20, 420, 115, Gtk::ANCHOR_W,
- :font => 'Sans 12',
- :fill_color => "blue",
- :ellipsize => Pango::ELLIPSIZE_END)
- setup_item_signals(textitem)
- end
-
- def setup_invisible_texts(root)
- Goo::CanvasText.new(root, "Visible above 0.8x", 500, 330, -1,
- Gtk::ANCHOR_CENTER,
- :visibility => Goo::CanvasItem::VISIBLE_ABOVE_THRESHOLD,
- :visibility_threshold => 0.8)
- Goo::CanvasRect.new(root, 410.5, 322.5, 180, 15,
- :line_width => 1.0,
- :visibility => Goo::CanvasItem::VISIBLE_ABOVE_THRESHOLD,
- :visibility_threshold => 0.8)
-
- Goo::CanvasText.new(root, "Visible above 1.5x", 500, 350, -1,
- Gtk::ANCHOR_CENTER,
- :visibility => Goo::CanvasItem::VISIBLE_ABOVE_THRESHOLD,
- :visibility_threshold => 1.5)
- Goo::CanvasRect.new(root, 410.5, 342.5, 180, 15,
- :line_width => 1.0,
- :visibility => Goo::CanvasItem::VISIBLE_ABOVE_THRESHOLD,
- :visibility_threshold => 1.5)
-
- Goo::CanvasText.new(root, "Visible above 3.0x", 500, 370, -1,
- Gtk::ANCHOR_CENTER,
- :visibility => Goo::CanvasItem::VISIBLE_ABOVE_THRESHOLD,
- :visibility_threshold => 3.0)
- Goo::CanvasRect.new(root, 410.5, 362.5, 180, 15,
- :line_width => 1.0,
- :visibility => Goo::CanvasItem::VISIBLE_ABOVE_THRESHOLD,
- :visibility_threshold => 3.0)
-
- # This should never be seen.
- Goo::CanvasText.new(root, "Always Invisible", 500, 390, -1,
- Gtk::ANCHOR_CENTER,
- :visibility => Goo::CanvasItem::INVISIBLE)
- Goo::CanvasRect.new(root, 410.5, 350.5, 180, 15,
- :line_width => 1.0,
- :visibility => Goo::CanvasItem::INVISIBLE)
- end
-
- def plant_flower(root, x, y, anchor)
- surface = Cairo::ImageSurface.from_png(image_path('flower.png'))
- w = surface.width
- h = surface.height
-
- pattern = Cairo::SurfacePattern.new(surface)
-
- image = Goo::CanvasImage.new(root, nil, x, y,
- :pattern => pattern,
- :width => w,
- :height => h)
- setup_item_signals(image)
- end
-
- def setup_images(root)
- im = Gdk::Pixbuf.new(image_path('toroid.png'))
-
- w = im.width
- h = im.height
- image = Goo::CanvasImage.new(root, im, 100.0 - w / 2, 225.0 - h / 2,
- :width => w, :height => h)
- setup_item_signals(image)
-
- plant_flower(root, 20.0, 170.0, Gtk::ANCHOR_NW)
- plant_flower(root, 180.0, 170.0, Gtk::ANCHOR_NE)
- plant_flower(root, 20.0, 280.0, Gtk::ANCHOR_SW)
- plant_flower(root, 180.0, 280.0, Gtk::ANCHOR_SE)
- end
-
- def setup_canvas(canvas)
- root = canvas.root_item
- root.signal_connect("button_press_event") {
- puts "background received 'button-press' signal"
- }
-
- # Setup canvas items
- setup_divisions(root)
- setup_rectangles(root)
- setup_ellipses(root)
- setup_lines(root)
- setup_polygons(root)
- setup_texts(root)
- setup_images(root)
- setup_invisible_texts(root)
- end
-end
diff --git a/goocanvas/sample/demo.rb b/goocanvas/sample/demo.rb
deleted file mode 100755
index 6d11b15..0000000
--- a/goocanvas/sample/demo.rb
+++ /dev/null
@@ -1,94 +0,0 @@
-#!/usr/bin/env ruby
-# -*- indent-tabs-mode: nil -*-
-=begin header
-
- demo.rb - Canvas test rewritten in Ruby/GooCanvas
-
- Rewritten by Emmanuel Pinault <seatmanu at yahoo.com>
-
-Original Copyright:
-
- Author : Richard Hestilow <hestgray at ionet.net>
-
- Copyright (C) 1998 Free Software Foundation
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-
-=end
-
-base_dir = File.dirname(__FILE__)
-src_dir = File.expand_path(File.join(base_dir, "..", "src"))
-lib_dir = File.join(src_dir, "lib")
-
-$LOAD_PATH.unshift(src_dir)
-$LOAD_PATH.unshift(lib_dir)
-$LOAD_PATH.unshift(base_dir)
-
-require 'goocanvas'
-require 'demo-primitives'
-require 'demo-arrowhead'
-require 'demo-fifteen'
-require 'demo-features'
-require 'demo-events'
-require 'demo-focus'
-require 'demo-animation'
-
-class GooCanvasSample < Gtk::Window
- def initialize
- super(:toplevel)
-
- signal_connect("destroy") do |widget, event|
- Gtk::main_quit()
- end
-
- signal_connect("key_press_event") do |widget, event|
- if event.state.control_mask? and event.keyval == Gdk::Keyval::GDK_q
- destroy
- true
- else
- false
- end
- end
-
- set_default_size(640, 600)
- notebook = Gtk::Notebook.new
- add(notebook)
- notebook.show
-
- notebook.append_page(CanvasSamplePrimitives.new(false),
- Gtk::Label.new("Primitives"))
- notebook.append_page(CanvasSampleArrowhead.new,
- Gtk::Label.new("Arrowhead"))
- notebook.append_page(CanvasSampleFifteen.new,
- Gtk::Label.new("Fifteen"))
- notebook.append_page(CanvasSampleFeatures.new,
- Gtk::Label.new("Reparent"))
- notebook.append_page(CanvasSampleEvents.new,
- Gtk::Label.new("Events"))
- notebook.append_page(CanvasSampleFocus.new,
- Gtk::Label.new("Focus"))
- notebook.append_page(CanvasSampleAnimation.new,
- Gtk::Label.new("Animation"))
-# notebook.append_page(CanvasSampleRichText.new,
-# Gtk::Label.new("Rich Text"))
-# notebook.append_page(CanvasSampleBezierCurve.new,
-# Gtk::Label.new("Bezier Curve"))
- show
- end
-end
-
-canvas = GooCanvasSample.new
-
-Gtk.main
diff --git a/goocanvas/sample/flower.png b/goocanvas/sample/flower.png
deleted file mode 100644
index 13a07cc..0000000
Binary files a/goocanvas/sample/flower.png and /dev/null differ
diff --git a/goocanvas/sample/scalability-demo.rb b/goocanvas/sample/scalability-demo.rb
deleted file mode 100755
index e44d0cd..0000000
--- a/goocanvas/sample/scalability-demo.rb
+++ /dev/null
@@ -1,169 +0,0 @@
-#!/usr/bin/env ruby
-#
-# This sample code is a port of
-# goocanvas/demo/scalability-demo.c. It is licensed
-# under the terms of the GNU Library General Public License, version
-# 2 or (at your option) later.
-#
-# Copyright (C) 2013 Ruby-GNOME2 Project Team
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
-require "goocanvas"
-
-# the values behind the comments are the ones used in the C version
-# but as with them it takes more than 20 sec on my computer for the window
-# to show upm I decreased them a little
-N_GROUP_COLS = 15 #25
-N_GROUP_ROWS = 10 #20
-N_COLS = 10
-N_ROWS = 10
-
-PADDING = 10
-
-ONLY_ONE = false
-
-def setup_canvas(canvas)
- root = canvas.root_item
- root.font = 'Sans 8'
-
- item_width = 400
- item_height = 19
-
- cell_width = item_width + PADDING * 2
- cell_height = item_height + PADDING * 2
-
- group_width = N_COLS * cell_width
- group_height = N_ROWS * cell_height
-
- total_width = N_GROUP_COLS * group_width
- total_height = N_GROUP_ROWS * group_height
-
- # We use -ve offsets to test if -ve coords are handled correctly.
- left_offset = -total_width / 2
- top_offset = -total_height / 2
-
- style = Goo::CanvasStyle.new
- color = Gdk::Color.parse("mediumseagreen")
- pattern = Cairo::SolidPattern.new(color.red / 65535.0, color.green / 65535.0, color.blue / 65535.0)
- # NOTE: "Goo::CanvasStyle#fill_pattern=" doesn't work. (undefined method)
- # Substitution is "Goo::CanvasRect#fill_color=".
- #style.fill_pattern = pattern
-
- style2 = Goo::CanvasStyle.new
- color = Gdk::Color.parse("steelblue")
- pattern = Cairo::SolidPattern.new(color.red / 65535.0, color.green / 65535.0, color.blue / 65535.0)
- # NOTE: "Goo::CanvasStyle#fill_pattern=" doesn't work. (undefined method)
- # Substitution is "Goo::CanvasRect#fill_color=".
- #style2.fill_pattern = pattern
-
- total_items = 0
-
- N_GROUP_COLS.times do |group_i|
- N_GROUP_ROWS.times do |group_j|
- group_x = left_offset + (group_i * group_width);
- group_y = top_offset + (group_j * group_height);
-
- group = Goo::CanvasGroup.new(:parent => root)
- total_items += 1
- group.translate(group_x, group_y)
-
- N_COLS.times do |i|
- N_ROWS.times do |j|
- item_x = (i * cell_width) + PADDING
- item_y = (j * cell_height) + PADDING
- rotation = i % 10 * 2
- rotation_x = item_x + item_width / 2
- rotation_y = item_y + item_height / 2
-
- current_id = "#{group_x + item_x}, #{group_y + item_y}"
-
- item = Goo::CanvasRect.new(:parent => group,
- :x => item_x,
- :y => item_y,
- :width => item_width,
- :height => item_height)
- # NOTE: "Goo::CanvasStyle#fill_pattern=" doesn't work. (undefined method)
- # "Goo::CanvasRect#fill_color=" is substitution.
- item.fill_color = (j % 2) == 1 ? "mediumseagreen" : "steelblue"
- #item.style = (j % 2) == 1 ? style : style2
- item.rotate(rotation, rotation_x, rotation_y)
-
- item.signal_connect('motion_notify_event') do
- puts "#{current_id} item received 'motion-notify' signal"
- end
-
- item = Goo::CanvasText.new(:parent => group,
- :text => current_id,
- :x => item_x + item_width / 2,
- :y => item_y + item_height / 2,
- :width => -1,
- :anchor => Goo::CanvasAnchorType::CENTER)
- item.rotate(rotation, rotation_x, rotation_y)
-
- total_items += 2
- break if ONLY_ONE
- end
- break if ONLY_ONE
- end
- break if ONLY_ONE
- end
- break if ONLY_ONE
- end
-
- puts "Total items: #{total_items}"
- [ total_width, total_height, left_offset, top_offset ]
-end
-
-def create_canvas
- # Create the canvas.
- canvas = Goo::Canvas.new
- canvas.set_size_request(600, 450)
-
- start = Time.new
- total_width, total_height, left_offset, top_offset = setup_canvas(canvas)
- puts "Create Canvas Time Used: #{Time.new - start}"
-
- start = Time.new
- canvas.set_bounds(left_offset, top_offset, left_offset + total_width, top_offset + total_height)
- canvas.show
-
- first_time = true
- canvas.signal_connect("draw") do
- if first_time
- puts "Update Canvas Time Used: #{Time.new - start}"
- first_time = false
- end
- false
- end
-
- canvas
-end
-
-window = Gtk::Window.new(:toplevel)
-window.set_default_size(640, 600)
-window.show
-window.signal_connect('delete_event') { Gtk.main_quit }
-
-scrolled_win = Gtk::ScrolledWindow.new
-scrolled_win.show
-window.add(scrolled_win)
-
-GC.disable
-canvas = create_canvas
-scrolled_win.add(canvas)
-GC.enable
-
-Gtk.main
diff --git a/goocanvas/sample/simple-demo.rb b/goocanvas/sample/simple-demo.rb
deleted file mode 100755
index 6ff0349..0000000
--- a/goocanvas/sample/simple-demo.rb
+++ /dev/null
@@ -1,70 +0,0 @@
-#!/usr/bin/env ruby
-#
-# This sample code is a port of
-# goocanvas/demo/simple-demo.c. It is licensed
-# under the terms of the GNU Library General Public License, version
-# 2 or (at your option) later.
-#
-# Copyright (C) 2013 Ruby-GNOME2 Project Team
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
-require 'goocanvas'
-
-# Create the window and widgets.
-window = Gtk::Window.new(:toplevel)
-window.set_default_size(640, 600)
-window.show
-window.signal_connect('delete_event') { Gtk.main_quit }
-
-scrolled_win = Gtk::ScrolledWindow.new
-scrolled_win.shadow_type = :in
-scrolled_win.show
-window.add(scrolled_win)
-
-canvas = Goo::Canvas.new
-canvas.set_size_request(600, 450)
-canvas.set_bounds(0, 0, 1000, 1000)
-canvas.show
-scrolled_win.add(canvas)
-
-root = canvas.root_item
-
-rect_item = Goo::CanvasRect.new(:parent => root,
- :x => 100,
- :y => 100,
- :width => 400,
- :height => 400,
- :line_width => 10.0,
- :radius_x => 20.0,
- :radius_y => 10.0,
- :stroke_color => 'yellow',
- :fill_color => 'red')
-
-rect_item.signal_connect('button_press_event') do
- puts("rect item received button press event")
-end
-
-text_item = Goo::CanvasText.new(:parent => root,
- :text => 'Hello World',
- :x => 300,
- :y => 300,
- :width => -1,
- :anchor => :center,
- :font => 'Sans 24')
-
-text_item.rotate(45, 300, 300)
-
-Gtk.main
diff --git a/goocanvas/sample/table-demo.rb b/goocanvas/sample/table-demo.rb
deleted file mode 100755
index ce6fe31..0000000
--- a/goocanvas/sample/table-demo.rb
+++ /dev/null
@@ -1,218 +0,0 @@
-#!/usr/bin/env ruby
-#
-# This sample code is a port of
-# goocanvas/demo/table-demo.c. It is licensed
-# under the terms of the GNU Library General Public License, version
-# 2 or (at your option) later.
-#
-# Copyright (C) 2013 Ruby-GNOME2 Project Team
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
-require "goocanvas"
-
-DEMO_RECT_ITEM = 0
-DEMO_TEXT_ITEM = 1
-DEMO_WIDGET_ITEM = 2
-
-def create_demo_item(table, demo_item_type, row, column, rows, columns, text)
- case demo_item_type
- when DEMO_RECT_ITEM
- item = Goo::CanvasRect.new(:parent => table,
- :x => 0,
- :y => 0,
- :width => 38,
- :height => 19,
- :fill_color => "red")
- when DEMO_TEXT_ITEM
- item = Goo::CanvasText.new(:parent => table,
- :text => text,
- :x => 0,
- :y => 0,
- :width => -1,
- :anchor => :nw)
- when DEMO_WIDGET_ITEM
- widget = Gtk::Button.new(:label => text)
- item = Goo::CanvasWidget.new(:parent => table,
- :widget => widget,
- :x => 0,
- :y => 0,
- :width => -1,
- :height => -1)
- end
-
- table.set_child_property(item, "row", row)
- table.set_child_property(item, "column", column)
- table.set_child_property(item, "rows", rows)
- table.set_child_property(item, "columns", columns)
- table.set_child_property(item, "x-expand", true)
- table.set_child_property(item, "x-fill", true)
- table.set_child_property(item, "y-expand", true)
- table.set_child_property(item, "y-fill", true)
-
- item.signal_connect('button_press_event') do |item, target, event|
- puts "#{text} received 'button-press' signal at #{event.x}, #{event.y} (root: #{event.x_root}, #{event.y_root})"
- true
- end
-end
-
-def create_table(parent, row, column, embedding_level, x, y, rotation, scale, demo_item_type)
- # Add a few simple items.
- table = Goo::CanvasTable.new(:parent => parent,
- :row_spacing => 4.0,
- :column_spacing => 4.0)
-
- table.translate(x, y)
- table.rotate(rotation, 0, 0)
- table.scale(scale, scale)
-
- if row
- parent.set_child_property(table, "row", row)
- parent.set_child_property(table, "column", column)
- parent.set_child_property(table, "x-expand", true)
- parent.set_child_property(table, "x_fill", true)
- end
-
- if embedding_level > 0
- level = embedding_level - 1
- create_table(table, 0, 0, level, 50, 50, 0, 0.7, demo_item_type)
- create_table(table, 0, 1, level, 50, 50, 45, 1.0, demo_item_type)
- create_table(table, 0, 2, level, 50, 50, 90, 1.0, demo_item_type)
- create_table(table, 1, 0, level, 50, 50, 135, 1.0, demo_item_type)
- create_table(table, 1, 1, level, 50, 50, 180, 1.5, demo_item_type)
- create_table(table, 1, 2, level, 50, 50, 225, 1.0, demo_item_type)
- create_table(table, 2, 0, level, 50, 50, 270, 1.0, demo_item_type)
- create_table(table, 2, 1, level, 50, 50, 315, 1.0, demo_item_type)
- create_table(table, 2, 2, level, 50, 50, 360, 2.0, demo_item_type)
- else
- create_demo_item(table, demo_item_type, 0, 0, 1, 1, "(0,0)")
- create_demo_item(table, demo_item_type, 0, 1, 1, 1, "(1,0)")
- create_demo_item(table, demo_item_type, 0, 2, 1, 1, "(2,0)")
- create_demo_item(table, demo_item_type, 1, 0, 1, 1, "(0,1)")
- create_demo_item(table, demo_item_type, 1, 1, 1, 1, "(1,1)")
- create_demo_item(table, demo_item_type, 1, 2, 1, 1, "(2,1)")
- create_demo_item(table, demo_item_type, 2, 0, 1, 1, "(0,2)")
- create_demo_item(table, demo_item_type, 2, 1, 1, 1, "(1,2)")
- create_demo_item(table, demo_item_type, 2, 2, 1, 1, "(2,2)")
- end
- table
-end
-
-def create_demo_table(root, x, y, width, height)
- table = Goo::CanvasTable.new(:parent => root,
- :row_spacing => 4.0,
- :column_spacing => 4.0,
- :width => width,
- :height => height)
- table.translate(x, y)
-
- square = Goo::CanvasRect.new(:parent => table,
- :x => 0.0,
- :y => 0.0,
- :width => 50.0,
- :height => 50.0,
- :fill_color => "red")
- table.set_child_property(square, "row", 0)
- table.set_child_property(square, "column", 0)
- table.set_child_property(square, "x_shrink", true)
- square.signal_connect('button_press_event') do |item, target, event|
- puts "Red square received 'button-press' signal at #{event.x}, #{event.y} (root: #{event.x_root}, #{event.y_root})"
- true
- end
-
- circle = Goo::CanvasEllipse.new(:parent => table,
- :x => 0.0,
- :y => 0.0,
- :radius_x => 25.0,
- :radius_y => 25.0,
- :fill_color => "blue")
- table.set_child_property(circle, "row", 0)
- table.set_child_property(circle, "column", 1)
- table.set_child_property(circle, "x_shrink", true)
- circle.signal_connect('button_press_event') do |item, target, event|
- puts "Blue circle received 'button-press' signal at #{event.x}, #{event.y} (root: #{event.x_root}, #{event.y_root})"
- true
- end
-
- points = Goo::CanvasPoints.new(3)
- points.set_point(0, 25.0, 0.0)
- points.set_point(1, 0.0, 50.0)
- points.set_point(2, 50.0, 50.0)
- triangle = Goo::CanvasPolyline.new(:parent => table,
- :close_path => true,
- :points => points,
- :fill_color => "yellow")
- table.set_child_property(triangle, "row", 0)
- table.set_child_property(triangle, "column", 2)
- table.set_child_property(triangle, "x_shrink", true)
- triangle.signal_connect('button_press_event') do |item, target, event|
- puts "Yellow triangle received 'button-press' signal at #{event.x}, #{event.y} (root: #{event.x_root}, #{event.y_root})"
- true
- end
-end
-
-window = Gtk::Window.new(:toplevel)
-window.set_default_size(640, 600)
-window.signal_connect('delete_event') { Gtk.main_quit }
-
-vbox = Gtk::Box.new(:vertical, 4)
-vbox.border_width = 4
-vbox.show
-window.add(vbox)
-
-hbox = Gtk::Box.new(:horizontal, 4)
-vbox.pack_start(hbox, :expand => false,
- :fill => false,
- :padding => 0)
-hbox.show
-
-scrolled_win = Gtk::ScrolledWindow.new
-scrolled_win.shadow_type = :in
-scrolled_win.show
-vbox.pack_start(scrolled_win, :expand => true,
- :fill => true,
- :padding => 0)
-
-canvas = Goo::Canvas.new
-canvas.set_size_request(600, 450)
-canvas.set_bounds(0, 0, 1000, 1000)
-scrolled_win.add(canvas)
-
-root = canvas.root_item
-
-create_demo_table(root, 400, 200, -1, -1)
-create_demo_table(root, 400, 260, 100, -1)
-
-create_table(root, nil, nil, 0, 10, 10, 0, 1.0, DEMO_TEXT_ITEM)
-create_table(root, nil, nil, 0, 180, 10, 30, 1.0, DEMO_TEXT_ITEM)
-create_table(root, nil, nil, 0, 350, 10, 60, 1.0, DEMO_TEXT_ITEM)
-create_table(root, nil, nil, 0, 500, 10, 90, 1.0, DEMO_TEXT_ITEM)
-
-table = create_table(root, nil, nil, 0, 30, 150, 0, 1.0, DEMO_TEXT_ITEM)
-table.width = 300.0
-table.height = 100.0
-
-create_table(root, nil, nil, 1, 200, 200, 30, 0.8, DEMO_TEXT_ITEM)
-
-table = create_table(root, nil, nil, 0, 10, 700, 0, 1.0, DEMO_WIDGET_ITEM)
-table.width = 300.0
-table.height = 200.0
-
-canvas.show
-
-window.show
-
-Gtk.main
-
diff --git a/goocanvas/sample/toroid.png b/goocanvas/sample/toroid.png
deleted file mode 100644
index bd5beab..0000000
Binary files a/goocanvas/sample/toroid.png and /dev/null differ
diff --git a/goocanvas/sample/units-demo.rb b/goocanvas/sample/units-demo.rb
deleted file mode 100755
index 509ca14..0000000
--- a/goocanvas/sample/units-demo.rb
+++ /dev/null
@@ -1,129 +0,0 @@
-#!/usr/bin/env ruby
-#
-# This sample code is a port of
-# goocanvas/demo/units-demo.c. It is licensed
-# under the terms of the GNU Library General Public License, version
-# 2 or (at your option) later.
-#
-# Copyright (C) 2013 Ruby-GNOME2 Project Team
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
-require 'goocanvas'
-
-DATA = {
- :pixel => [ 100, 100, 200, 20, 10, 200, 310, 24 ],
- :points => [ 100, 100, 200, 20, 10, 200, 310, 24 ],
- :inch => [ 1, 1, 3, 0.5, 0.16, 3, 4, 0.3 ],
- :mm => [ 30, 30, 100, 10, 5, 80, 60, 10 ],
-}
-
-def setup_canvas(canvas, units, units_name)
- d = DATA[units]
-
- root = canvas.root_item
-
- item = Goo::CanvasRect.new(:parent => root,
- :x => d[0],
- :y => d[1],
- :width => d[2],
- :height => d[3])
-
- item.signal_connect('motion_notify_event') do
- puts("item received 'motion-notify' signal")
- end
-
- item = Goo::CanvasText.new(:parent => root,
- :text => "This box is #{d[2]}x#{d[3]} #{units_name}",
- :x => d[0] + d[2] / 2.0,
- :y => d[1] + d[3] / 2.0,
- :width => -1,
- :anchor => :center,
- :font => "Sans #{d[4]}px")
-
- item = Goo::CanvasText.new(:parent => root,
- :text => "This font is #{d[7]} #{units_name} high",
- :x => d[5],
- :y => d[6],
- :width => -1,
- :anchor => :center,
- :font => "Sans #{d[7]}px")
-end
-
-def create_canvas(units, units_name)
- vbox = Gtk::Box.new(:vertical, 4)
- vbox.show
-
- hbox = Gtk::Box.new(:horizontal, 4)
- vbox.pack_start(hbox, :expand => false,
- :fill => false,
- :padding => 0)
- hbox.show
-
- canvas = Goo::Canvas.new
-
- w = Gtk::Label.new('Zoom:')
- hbox.pack_start(w, :expand => false,
- :fill => false,
- :padding => 0)
- w.show
-
- adj = Gtk::Adjustment.new(1, 0.05, 100, 0.05, 0.5, 0.5)
- w = Gtk::SpinButton.new(adj, 0, 2)
- adj.signal_connect('value_changed') do |new_adj|
- canvas.scale = new_adj.value
- end
-
- w.set_size_request(50, -1)
- hbox.pack_start(w, :expand => false,
- :fill => false,
- :padding => 0)
- w.show
-
- scrolled_win = Gtk::ScrolledWindow.new
- vbox.pack_start(scrolled_win, :expand => true,
- :fill => true,
- :padding => 0)
- scrolled_win.show
-
- # Create the canvas.
- canvas.set_size_request(600, 450)
- setup_canvas(canvas, units, units_name)
-
- canvas.set_bounds(0, 0, 1000, 1000)
- canvas.units = units
- canvas.anchor = :center
- canvas.show
-
- scrolled_win.add(canvas)
-
- vbox
-end
-
-window = Gtk::Window.new(:toplevel)
-window.set_default_size(640, 600)
-window.show
-window.signal_connect('delete_event') { Gtk.main_quit }
-
-notebook = Gtk::Notebook.new
-notebook.show
-window.add(notebook)
-
-notebook.append_page(create_canvas(:pixel, 'pixels'), Gtk::Label.new('Pixels'))
-notebook.append_page(create_canvas(:points, 'points'), Gtk::Label.new('Points'))
-notebook.append_page(create_canvas(:inch, 'inches'), Gtk::Label.new('Inches'))
-notebook.append_page(create_canvas(:mm, 'millimeters'), Gtk::Label.new('Millimeters'))
-
-Gtk.main
diff --git a/goocanvas/sample/widgets-demo.rb b/goocanvas/sample/widgets-demo.rb
deleted file mode 100755
index 97566b2..0000000
--- a/goocanvas/sample/widgets-demo.rb
+++ /dev/null
@@ -1,277 +0,0 @@
-#!/usr/bin/env ruby
-#
-# This sample code is a port of
-# goocanvas/demo/widgets-demo.c. It is licensed
-# under the terms of the GNU Library General Public License, version
-# 2 or (at your option) later.
-#
-# Copyright (C) 2013 Ruby-GNOME2 Project Team
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
-require "goocanvas"
-
-num_added_widgets = 0
-added_widget_items = []
-canvas = nil
-move_item = nil
-
-def create_focus_box(canvas, x, y, width, height, color)
- root = canvas.root_item
- item = Goo::CanvasRect.new(:parent => root,
- :x => x,
- :y => y,
- :width => width,
- :height => height,
- :stroke_pattern => nil,
- :fill_color => color,
- :line_width => 5.0,
- :can_focus => true)
-
- item.signal_connect('focus_in_event') do
- puts "#{color} received focus-in event"
- # Note that this is only for testing. Setting item properties to indicate
- # focus isn't a good idea for real apps, as there may be multiple views.
- item.stroke_color = 'black'
- false
- end
-
- item.signal_connect('focus_out_event') do
- puts "#{color} received focus-out event"
- # Note that this is only for testing. Setting item properties to indicate
- # focus isn't a good idea for real apps, as there may be multiple views.
- item.stroke_pattern = nil
- false
- end
-
- item.signal_connect('button_press_event') do
- puts "#{color} received button-press event"
- item.canvas.grab_focus(item)
- true
- end
-
- item.signal_connect('key_press_event') do
- puts "#{color} received key-press event"
- false
- end
-end
-
-def add_button(hbox, button_name, &click_action)
- w = Gtk::Button.new(:label => button_name)
- hbox.pack_start(w, :expand => false,
- :fill => false,
- :padding => 0)
- w.show
- w.signal_connect('clicked', &click_action)
-end
-
-# Create the window and widgets.
-window = Gtk::Window.new(:toplevel)
-window.set_default_size(640, 600)
-window.show
-window.signal_connect('delete_event') { Gtk.main_quit }
-
-vbox = Gtk::Box.new(:vertical, 4)
-vbox.border_width = 4
-vbox.show
-window.add(vbox)
-
-hbox = Gtk::Box.new(:horizontal, 4)
-vbox.pack_start(hbox, :expand => false,
- :fill => false,
- :padding => 0)
-hbox.show
-
-add_button(hbox, 'Add Widget') do
- if num_added_widgets % 2 == 1
- widget = Gtk::Label.new("Hello World")
- else
- widget = Gtk::Entry.new
- end
-
- root = canvas.root_item
- witem = Goo::CanvasWidget.new(:parent => root,
- :widget => widget,
- :x => num_added_widgets * 50,
- :y => num_added_widgets * 50,
- :width => 200,
- :height => 50)
-
- added_widget_items.push(witem)
- num_added_widgets += 1
-end
-
-add_button(hbox, 'Remove Widget') do
- root = canvas.root_item
- witem = added_widget_items.pop
- if witem
- root.remove_child(witem)
- num_added_widgets -= 1
- end
-end
-
-move_index = 0
-Moves = [
- [ 50, 50, -1, -1 ],
- [ 300, 100, -1, -1 ],
- [ 200, 200, -1, -1 ],
- [ 400, 100, -1, -1 ],
-]
-
-add_button(hbox, 'Move Widget') do
- move_item.x = Moves[move_index][0]
- move_item.y = Moves[move_index][1]
- move_item.width = Moves[move_index][2]
- move_item.height = Moves[move_index][3]
- move_index = (move_index + 1) % 4
-end
-
-# here we have to do a little more complicated than in C because Ruby/Gtk+'s enums are not ints and we can't do + 1 on them
-moving_anchor = Goo::CanvasAnchorType::CENTER.to_i
-add_button(hbox, 'Change Anchor') do
- puts "Setting anchor to: #{Goo::CanvasAnchorType.new(moving_anchor).name}"
- move_item.anchor = moving_anchor
- moving_anchor += 1
- if moving_anchor > Goo::CanvasAnchorType::EAST.to_i
- moving_anchor = Goo::CanvasAnchorType::CENTER.to_i
- end
-end
-
-add_button(hbox, 'Change Widget') do
- witem = added_widget_items.last
- if witem
- if witem.widget.instance_of?(Gtk::Entry)
- witem.widget = Gtk::Label.new("Hello World")
- else
- witem.widget = Gtk::Entry.new
- end
- end
-end
-
-hbox = Gtk::Box.new(:horizontal, 4)
-vbox.pack_start(hbox, :expand => false,
- :fill => false,
- :padding => 0)
-hbox.show
-
-add_button(hbox, 'Hide Canvas') { canvas.hide }
-add_button(hbox, 'Show Canvas') { canvas.show }
-add_button(hbox, 'Hide Item') { move_item.visibility = :invisible }
-add_button(hbox, 'Show Item') { move_item.visibility = :visible }
-add_button(hbox, 'Change Transform') { move_item.translate(25, 25) }
-
-scrolled_win = Gtk::ScrolledWindow.new
-scrolled_win.shadow_type = :in
-scrolled_win.show
-vbox.pack_start(scrolled_win, :expand => true,
- :fill => true,
- :padding => 0)
-
-canvas = Goo::Canvas.new
-canvas.set_size_request(600, 450)
-canvas.set_bounds(0, 0, 1000, 1000)
-scrolled_win.add(canvas)
-
-root = canvas.root_item
-
-# Add a few simple items.
-label = Gtk::Label.new("Hello World")
-witem = Goo::CanvasWidget.new(:parent => root,
- :widget => label,
- :x => 50,
- :y => 50,
- :width => 200,
- :height => 100)
-
-entry = Gtk::Entry.new
-move_item = Goo::CanvasWidget.new(:parent => root,
- :widget => entry,
- :x => 50,
- :y => 250,
- :width => 200,
- :height => 50)
-
-entry = Gtk::Entry.new
-entry.text = "Size: -1 x -1"
-witem = Goo::CanvasWidget.new(:parent => root,
- :widget => entry,
- :x => 50,
- :y => 300,
- :width => -1,
- :height => -1)
-
-entry = Gtk::Entry.new
-entry.text = "Size: 100 x -1"
-witem = Goo::CanvasWidget.new(:parent => root,
- :widget => entry,
- :x => 50,
- :y => 350,
- :width => 100,
- :height => -1)
-
-# Use a textview so we can see the width & height of the widget.
-scrolled_win = Gtk::ScrolledWindow.new
-scrolled_win.shadow_type = :in
-scrolled_win.set_policy(:never, :never)
-textview = Gtk::TextView.new
-buffer = textview.buffer
-buffer.text = "Size: -1 x 100"
-textview.show
-scrolled_win.add(textview)
-scrolled_win.set_size_request(160, 50)
-witem = Goo::CanvasWidget.new(:parent => root,
- :widget => scrolled_win,
- :x => 50,
- :y => 400,
- :width => -1,
- :height => 100)
-
-# Create a vbox item with several child entry widgets to check focus traversal.
-vbox = Gtk::Box.new(:vertical, 4)
-
-entry = Gtk::Entry.new
-entry.show
-vbox.pack_start(entry, :expand => false,
- :fill => false,
- :padding => 0)
-
-entry = Gtk::Entry.new
-entry.show
-vbox.pack_start(entry, :expand => false,
- :fill => false,
- :padding => 0)
-
-entry = Gtk::Entry.new
-entry.show
-vbox.pack_start(entry, :expand => false,
- :fill => false,
- :padding => 0)
-
-witem = Goo::CanvasWidget.new(:parent => root,
- :widget => vbox,
- :x => 50,
- :y => 600,
- :width => -1,
- :height => -1)
-
-# Create a few normal canvas items that take keyboard focus.
-create_focus_box(canvas, 110, 80, 50, 30, 'red')
-create_focus_box(canvas, 300, 160, 50, 30, 'orange')
-create_focus_box(canvas, 500, 50, 50, 30, 'yellow')
-
-canvas.show
-
-# Pass control to the GTK+ main event loop.
-Gtk.main
diff --git a/gstreamer/Rakefile b/gstreamer/Rakefile
index 969d99c..10f9caf 100644
--- a/gstreamer/Rakefile
+++ b/gstreamer/Rakefile
@@ -1,26 +1,26 @@
# -*- ruby -*-
$LOAD_PATH.unshift("./../glib2/lib")
-require 'gnome2-raketask'
+require 'gnome2/rake/package-task'
-package = GNOME2Package.new do |_package|
- _package.summary = "Ruby/GStreamer is a Ruby binding for GStreamer."
- _package.description = "Ruby/GStreamer is a Ruby binding for GStreamer."
- _package.dependency.gem.runtime = ["glib2", "gobject-introspection"]
- _package.win32.packages = []
- _package.win32.dependencies = []
- _package.win32.build_dependencies = [
+package_task = GNOME2::Rake::PackageTask.new do |package|
+ package.summary = "Ruby/GStreamer is a Ruby binding for GStreamer."
+ package.description = "Ruby/GStreamer is a Ruby binding for GStreamer."
+ package.dependency.gem.runtime = ["glib2", "gobject-introspection"]
+ package.windows.packages = []
+ package.windows.dependencies = []
+ package.windows.build_dependencies = [
"glib2", "atk", "pango", "gdk_pixbuf2", "gtk2", "gobject-introspection",
]
xiph_download_url_base = "http://downloads.xiph.org/releases"
freedesktop_download_url_base = "http://gstreamer.freedesktop.org/src"
sf_net_download_url_base = "http://downloads.sourceforge.net/project"
libmad_version = "0.15.1b"
- _package.external_packages = [
+ package.external_packages = [
{
:name => "libjpeg",
- :base_name => "jpeg-9",
- :archive_base_name => "jpegsrc.v9.tar.gz",
+ :base_name => "jpeg-9a",
+ :archive_base_name => "jpegsrc.v9a.tar.gz",
:download_base_url => "http://www.ijg.org/files",
:label => "libjpeg",
:windows => {
@@ -30,9 +30,9 @@ package = GNOME2Package.new do |_package|
},
{
:name => "sqlite-autoconf",
- :download_base_url => "http://www.sqlite.org/2013",
+ :download_base_url => "http://www.sqlite.org/2014",
:label => "SQLite",
- :version => "3080200",
+ :version => "3080600",
:compression_method => "gz",
:windows => {
:configure_args => [],
@@ -43,7 +43,7 @@ package = GNOME2Package.new do |_package|
:name => "libsoup",
:download_site => :gnome,
:label => "libsoup",
- :version => "2.45.3",
+ :version => "2.48.1",
:compression_method => "xz",
:windows => {
:configure_args => [
@@ -51,6 +51,8 @@ package = GNOME2Package.new do |_package|
"--without-apache-httpd",
],
:build_concurrently => false,
+ :patches => [
+ ],
:built_file => "bin/libsoup-2.4-1.dll",
},
},
@@ -126,7 +128,7 @@ package = GNOME2Package.new do |_package|
:name => "gstreamer",
:download_base_url => "#{freedesktop_download_url_base}/gstreamer",
:label => "GStreamer",
- :version => "1.2.3",
+ :version => "1.4.3",
:compression_method => "xz",
:windows => {
:configure_args => [
@@ -141,7 +143,7 @@ package = GNOME2Package.new do |_package|
:name => "gst-plugins-base",
:download_base_url => "#{freedesktop_download_url_base}/gst-plugins-base",
:label => "GStreamer plugins (base)",
- :version => "1.2.3",
+ :version => "1.4.3",
:compression_method => "xz",
:windows => {
:configure_args => [
@@ -155,7 +157,7 @@ package = GNOME2Package.new do |_package|
:name => "gst-plugins-good",
:download_base_url => "#{freedesktop_download_url_base}/gst-plugins-good",
:label => "GStreamer plugins (good)",
- :version => "1.2.3",
+ :version => "1.4.3",
:compression_method => "xz",
:windows => {
:configure_args => [
@@ -168,21 +170,21 @@ package = GNOME2Package.new do |_package|
:name => "gst-plugins-bad",
:download_base_url => "#{freedesktop_download_url_base}/gst-plugins-bad",
:label => "GStreamer plugins (bad)",
- :version => "1.2.3",
+ :version => "1.4.3",
:compression_method => "xz",
:windows => {
:configure_args => ["--disable-librfb"],
:cc_args => [
"-std=c99",
],
- :built_file => "lib/gstreamer-1.0/libgstfaac.dll",
+ :built_file => "lib/gstreamer-1.0/libgstmxf.dll",
},
},
# {
# :name => "gst-plugins-ugly",
# :download_base_url => "#{freedesktop_download_url_base}/gst-plugins-ugly",
# :label => "GStreamer plugins (ugly)",
- # :version => "1.2.3",
+ # :version => "1.4.3",
# :compression_method => "xz",
# :windows => {
# :configure_args => [],
@@ -192,16 +194,17 @@ package = GNOME2Package.new do |_package|
:name => "gst-libav",
:download_base_url => "#{freedesktop_download_url_base}/gst-libav",
:label => "GStreamer libav",
- :version => "1.2.3",
+ :version => "1.4.3",
:compression_method => "xz",
:windows => {
:configure_args => [
"--with-libav-extra-configure=" +
- "--cross-prefix=#{_package.win32.build_host}- " +
+ "--cross-prefix=#{package.windows.build_host}- " +
"--target-os=mingw32 " +
"--arch=i686 " +
"--pkg-config=pkg-config " +
- "--disable-gpl",
+ "--disable-gpl " +
+ "--disable-yasm",
],
:built_file => "lib/gstreamer-1.0/libgstlibav.dll",
},
@@ -221,11 +224,11 @@ package = GNOME2Package.new do |_package|
],
},
]
- _package.cross_compiling do |spec|
+ package.cross_compiling do |spec|
if /mingw|mswin/ =~ spec.platform.to_s
- spec.add_runtime_dependency("pango", ">= #{_package.version}")
- spec.add_runtime_dependency("gdk_pixbuf2", ">= #{_package.version}")
+ spec.add_runtime_dependency("pango", ">= #{package.version}")
+ spec.add_runtime_dependency("gdk_pixbuf2", ">= #{package.version}")
end
end
end
-package.define_tasks
+package_task.define
diff --git a/gstreamer/ext/gstreamer/extconf.rb b/gstreamer/ext/gstreamer/extconf.rb
index 587a8fa..5dd5add 100644
--- a/gstreamer/ext/gstreamer/extconf.rb
+++ b/gstreamer/ext/gstreamer/extconf.rb
@@ -41,7 +41,7 @@ end
:target_build_dir => build_dir)
end
-setup_win32(module_name, base_dir)
+setup_windows(module_name, base_dir)
unless required_pkg_config_package(package_id,
:debian => "libgstreamer1.0-dev",
diff --git a/gstreamer/ext/gstreamer/rbgst-child-proxy.c b/gstreamer/ext/gstreamer/rbgst-child-proxy.c
new file mode 100644
index 0000000..f3ae832
--- /dev/null
+++ b/gstreamer/ext/gstreamer/rbgst-child-proxy.c
@@ -0,0 +1,105 @@
+/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
+/*
+ * Copyright (C) 2014 Ruby-GNOME2 Project Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+
+#include "rbgst.h"
+
+#define RG_TARGET_NAMESPACE cChildProxy
+
+#define SELF(object) (GST_CHILD_PROXY(RVAL2GOBJ(object)))
+
+static void
+rg_raise_no_property_error(VALUE object, const gchar *name)
+{
+ VALUE eNoSuchProperty;
+
+ eNoSuchProperty = rb_const_get(mGLib, rb_intern("NoSuchProperty"));
+ rb_raise(eNoSuchProperty,
+ "%s: No such property: <%s>",
+ rbg_inspect(object),
+ name);
+}
+
+static VALUE
+rg_get_property(VALUE self, VALUE rb_name)
+{
+ GstChildProxy *proxy;
+ const gchar *name;
+ GValue value = G_VALUE_INIT;
+ VALUE rb_value;
+ GObjectClass *g_object_class;
+ GParamSpec *property_spec;
+
+ proxy = SELF(self);
+ name = RVAL2CSTR_ACCEPT_SYMBOL(rb_name);
+
+ g_object_class = G_OBJECT_GET_CLASS(proxy);
+ property_spec = g_object_class_find_property(g_object_class, name);
+ if (!property_spec) {
+ rg_raise_no_property_error(self, name);
+ }
+
+ g_value_init(&value, G_PARAM_SPEC_VALUE_TYPE(property_spec));
+ gst_child_proxy_get_property(proxy, name, &value);
+ rb_value = GVAL2RVAL(&value);
+ g_value_unset(&value);
+
+ return rb_value;
+}
+
+static VALUE
+rg_set_property(VALUE self, VALUE rb_name, VALUE rb_value)
+{
+ GstChildProxy *proxy;
+ const gchar *name;
+ GValue value = G_VALUE_INIT;
+ GObjectClass *g_object_class;
+ GParamSpec *property_spec;
+
+ proxy = SELF(self);
+ name = RVAL2CSTR_ACCEPT_SYMBOL(rb_name);
+
+ g_object_class = G_OBJECT_GET_CLASS(proxy);
+ property_spec = g_object_class_find_property(g_object_class, name);
+ if (!property_spec) {
+ rg_raise_no_property_error(self, name);
+ }
+
+ g_value_init(&value, G_PARAM_SPEC_VALUE_TYPE(property_spec));
+ rbgobj_rvalue_to_gvalue(rb_value, &value);
+ gst_child_proxy_set_property(proxy, name, &value);
+ g_value_unset(&value);
+
+ return self;
+}
+
+void
+rb_gst_init_child_proxy(void)
+{
+ VALUE mGst;
+ VALUE RG_TARGET_NAMESPACE;
+
+ mGst = rb_const_get(rb_cObject, rb_intern("Gst"));
+ RG_TARGET_NAMESPACE = rb_const_get(mGst, rb_intern("ChildProxy"));
+
+ rb_remove_method(RG_TARGET_NAMESPACE, "get_property");
+ RG_DEF_METHOD(get_property, 1);
+ rb_remove_method(RG_TARGET_NAMESPACE, "set_property");
+ RG_DEF_METHOD(set_property, 2);
+}
diff --git a/gstreamer/ext/gstreamer/rbgst.c b/gstreamer/ext/gstreamer/rbgst.c
index 9908a76..ed0297a 100644
--- a/gstreamer/ext/gstreamer/rbgst.c
+++ b/gstreamer/ext/gstreamer/rbgst.c
@@ -1,6 +1,6 @@
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
/*
- * Copyright (C) 2013 Ruby-GNOME2 Project Team
+ * Copyright (C) 2013-2014 Ruby-GNOME2 Project Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -180,5 +180,6 @@ Init_gstreamer (void)
rbgobj_register_r2g_func(GST_TYPE_LIST, rg_gst_value_list_r2g);
rbgobj_register_g2r_func(GST_TYPE_LIST, rg_gst_value_list_g2r);
+ rb_gst_init_child_proxy();
rb_gst_init_element_factory();
}
diff --git a/gstreamer/ext/gstreamer/rbgst.h b/gstreamer/ext/gstreamer/rbgst.h
index 1107e46..93fa657 100644
--- a/gstreamer/ext/gstreamer/rbgst.h
+++ b/gstreamer/ext/gstreamer/rbgst.h
@@ -1,6 +1,6 @@
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
/*
- * Copyright (C) 2013 Ruby-GNOME2 Project Team
+ * Copyright (C) 2013-2014 Ruby-GNOME2 Project Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -23,4 +23,5 @@
#include <rb-gobject-introspection.h>
extern void Init_gstreamer (void);
+G_GNUC_INTERNAL extern void rb_gst_init_child_proxy (void);
G_GNUC_INTERNAL extern void rb_gst_init_element_factory (void);
diff --git a/gstreamer/lib/gst.rb b/gstreamer/lib/gst.rb
index 39b8bf8..2b91699 100644
--- a/gstreamer/lib/gst.rb
+++ b/gstreamer/lib/gst.rb
@@ -103,10 +103,9 @@ module Gst
def call_init_function(repository, namespace)
init_check = repository.find(namespace, "init_check")
arguments = [
- 1 + @init_arguments.size,
[$0] + @init_arguments,
]
- succeeded, argc, argv, error = init_check.invoke(:arguments => arguments)
+ succeeded, argv, error = init_check.invoke(:arguments => arguments)
@init_arguments.replace(argv[1..-1])
raise error unless succeeded
end
diff --git a/gstreamer/lib/gst/caps.rb b/gstreamer/lib/gst/caps.rb
index 9c08649..192a3b3 100644
--- a/gstreamer/lib/gst/caps.rb
+++ b/gstreamer/lib/gst/caps.rb
@@ -16,6 +16,20 @@
module Gst
class Caps
+ class << self
+ def any
+ caps = allocate
+ caps.__send__(:initialize_new_any)
+ caps
+ end
+
+ def empty
+ caps = allocate
+ caps.__send__(:initialize_new_empty)
+ caps
+ end
+ end
+
def structures
size.times.collect do |i|
get_structure(i)
diff --git a/webkit-gtk/test/webkit-gtk-test-utils.rb b/gstreamer/lib/gstreamer.rb
similarity index 85%
copy from webkit-gtk/test/webkit-gtk-test-utils.rb
copy to gstreamer/lib/gstreamer.rb
index 4dd02d7..0bf76ca 100644
--- a/webkit-gtk/test/webkit-gtk-test-utils.rb
+++ b/gstreamer/lib/gstreamer.rb
@@ -1,4 +1,4 @@
-# Copyright (C) 2013 Ruby-GNOME2 Project Team
+# Copyright (C) 2014 Ruby-GNOME2 Project Team
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -14,8 +14,4 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-require "test-unit"
-require "test/unit/notify"
-
-module WebKitGtkTestUtils
-end
+require "gst"
diff --git a/webkit-gtk/test/webkit-gtk-test-utils.rb b/gstreamer/test/gstreamer-test-utils.rb
similarity index 87%
copy from webkit-gtk/test/webkit-gtk-test-utils.rb
copy to gstreamer/test/gstreamer-test-utils.rb
index 4dd02d7..3bd447b 100644
--- a/webkit-gtk/test/webkit-gtk-test-utils.rb
+++ b/gstreamer/test/gstreamer-test-utils.rb
@@ -1,4 +1,4 @@
-# Copyright (C) 2013 Ruby-GNOME2 Project Team
+# Copyright (C) 2014 Ruby-GNOME2 Project Team
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -15,7 +15,3 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
require "test-unit"
-require "test/unit/notify"
-
-module WebKitGtkTestUtils
-end
diff --git a/clutter/test/run-test.rb b/gstreamer/test/run-test.rb
similarity index 69%
copy from clutter/test/run-test.rb
copy to gstreamer/test/run-test.rb
index c1c9a1e..4ed8b9d 100755
--- a/clutter/test/run-test.rb
+++ b/gstreamer/test/run-test.rb
@@ -1,6 +1,6 @@
#!/usr/bin/env ruby
#
-# Copyright (C) 2012-2013 Ruby-GNOME2 Project Team
+# Copyright (C) 2014 Ruby-GNOME2 Project Team
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -20,18 +20,18 @@ ruby_gnome2_base = File.join(File.dirname(__FILE__), "..", "..")
ruby_gnome2_base = File.expand_path(ruby_gnome2_base)
glib_base = File.join(ruby_gnome2_base, "glib2")
-cairo_gobject_base = File.join(ruby_gnome2_base, "cairo-gobject")
gobject_introspection_base = File.join(ruby_gnome2_base, "gobject-introspection")
-clutter_base = File.join(ruby_gnome2_base, "clutter")
+gstreamer_base = File.join(ruby_gnome2_base, "gstreamer")
modules = [
[glib_base, "glib2"],
- [cairo_gobject_base, "cairo-gobject"],
[gobject_introspection_base, "gobject-introspection"],
- [clutter_base, "clutter"],
+ [gstreamer_base, "gstreamer"],
]
+
modules.each do |target, module_name|
- if File.exist?("Makefile") and system("which make > /dev/null")
+ makefile = File.join(target, "Makefile")
+ if File.exist?(makefile) and system("which make > /dev/null")
`make -C #{target.dump} > /dev/null` or exit(false)
end
$LOAD_PATH.unshift(File.join(target, "ext", module_name))
@@ -41,16 +41,11 @@ end
$LOAD_PATH.unshift(File.join(glib_base, "test"))
require "glib-test-init"
-$VERBOSE = false # TODO: remove me
-
-$LOAD_PATH.unshift(File.join(gobject_introspection_base, "test"))
-require "gobject-introspection-test-utils"
-
-$LOAD_PATH.unshift(File.join(clutter_base, "test"))
-require "clutter-test-utils"
+$LOAD_PATH.unshift(File.join(gstreamer_base, "test"))
+require "gstreamer-test-utils"
-require "clutter"
+require "gst"
-Clutter.init([])
+Gst.init
-exit Test::Unit::AutoRunner.run(true, clutter_base)
+exit Test::Unit::AutoRunner.run(true)
diff --git a/gio2/lib/gio2/output-stream.rb b/gstreamer/test/test-caps.rb
similarity index 72%
copy from gio2/lib/gio2/output-stream.rb
copy to gstreamer/test/test-caps.rb
index d686699..2466fdd 100644
--- a/gio2/lib/gio2/output-stream.rb
+++ b/gstreamer/test/test-caps.rb
@@ -14,11 +14,18 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-module Gio
- class OutputStream
- alias_method :write_raw, :write
- def write(data)
- write_raw(data, data.bytesize)
+class TestCaps < Test::Unit::TestCase
+ class TestConstructor < self
+ def test_any
+ assert_equal("ANY", Gst::Caps.any.to_s)
+ end
+
+ def test_empty
+ assert_equal("EMPTY", Gst::Caps.empty.to_s)
+ end
+
+ def test_media_type
+ assert_equal("audio/ogg", Gst::Caps.new("audio/ogg").to_s)
end
end
end
diff --git a/gio2/lib/gio2/output-stream.rb b/gstreamer/test/test-child-proxy.rb
similarity index 77%
copy from gio2/lib/gio2/output-stream.rb
copy to gstreamer/test/test-child-proxy.rb
index d686699..15b392a 100644
--- a/gio2/lib/gio2/output-stream.rb
+++ b/gstreamer/test/test-child-proxy.rb
@@ -14,11 +14,14 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-module Gio
- class OutputStream
- alias_method :write_raw, :write
- def write(data)
- write_raw(data, data.bytesize)
- end
+class TestChildProxy < Test::Unit::TestCase
+ def setup
+ @bin = Gst::ElementFactory.make("decodebin")
+ end
+
+ def test_property
+ any_caps = Gst::Caps.any
+ @bin.caps = any_caps
+ assert_equal(any_caps.to_s, @bin.caps.to_s)
end
end
diff --git a/gio2/lib/gio2/output-stream.rb b/gstreamer/test/test-element-factory.rb
similarity index 82%
copy from gio2/lib/gio2/output-stream.rb
copy to gstreamer/test/test-element-factory.rb
index d686699..88de93e 100644
--- a/gio2/lib/gio2/output-stream.rb
+++ b/gstreamer/test/test-element-factory.rb
@@ -14,11 +14,10 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-module Gio
- class OutputStream
- alias_method :write_raw, :write
- def write(data)
- write_raw(data, data.bytesize)
- end
+class TestElementFactory < Test::Unit::TestCase
+ def test_find
+ name = "playbin"
+ factory = Gst::ElementFactory.find(name)
+ assert_equal(name, factory.name)
end
end
diff --git a/gtk2/Rakefile b/gtk2/Rakefile
index eedb633..9db6f4d 100644
--- a/gtk2/Rakefile
+++ b/gtk2/Rakefile
@@ -1,23 +1,23 @@
# -*- ruby -*-
$LOAD_PATH.unshift("./../glib2/lib")
-require 'gnome2-raketask'
+require 'gnome2/rake/package-task'
-package = GNOME2Package.new do |_package|
- _package.summary = "Ruby/GTK2 is a Ruby binding of GTK+-2.x."
- _package.description = "Ruby/GTK2 is a Ruby binding of GTK+-2.x."
- _package.dependency.gem.runtime = ["atk", "pango", "gdk_pixbuf2"]
- _package.win32.packages = []
- _package.win32.dependencies = []
- _package.win32.build_dependencies = [
+package_task = GNOME2::Rake::PackageTask.new do |package|
+ package.summary = "Ruby/GTK2 is a Ruby binding of GTK+-2.x."
+ package.description = "Ruby/GTK2 is a Ruby binding of GTK+-2.x."
+ package.dependency.gem.runtime = ["atk", "pango", "gdk_pixbuf2"]
+ package.windows.packages = []
+ package.windows.dependencies = []
+ package.windows.build_dependencies = [
"glib2", "atk", "pango", "gdk_pixbuf2",
]
- _package.external_packages = [
+ package.external_packages = [
{
:name => "gtk+",
:download_site => :gnome,
:label => "gtk+",
- :version => "2.24.22",
+ :version => "2.24.25",
:compression_method => "xz",
:windows => {
:configure_args => [
@@ -25,7 +25,8 @@ package = GNOME2Package.new do |_package|
],
:need_autoreconf => true,
:patches => [
- "gtk+-2.24.22-add-missing-exeext-and-fix-directory.diff",
+ "gtk+-2.24.25-add-missing-exeext-and-fix-directory.diff",
+ "gtk+-2.24.22-remove-PRIVATE-from-def.diff",
],
:built_file => "bin/libgtk-win32-2.0-0.dll",
},
@@ -43,9 +44,9 @@ package = GNOME2Package.new do |_package|
},
]
end
-package.define_tasks
+package_task.define
-namespace :win32 do
+namespace :windows do
desc "create default gtkrc"
task :gtkrc do
gtkrc_path = File.join("vendor", "local", "etc", "gtk-2.0", "gtkrc")
@@ -56,6 +57,6 @@ namespace :win32 do
end
namespace :builder do
- task :after => ["win32:gtkrc"]
+ task :after => ["windows:gtkrc"]
end
end
diff --git a/gtk2/ext/gtk2/extconf.rb b/gtk2/ext/gtk2/extconf.rb
index e70cb68..e3f47c6 100644
--- a/gtk2/ext/gtk2/extconf.rb
+++ b/gtk2/ext/gtk2/extconf.rb
@@ -42,24 +42,11 @@ have_func("rb_errinfo")
:target_build_dir => build_dir)
end
-rcairo_options = {}
-rcairo_source_dir_names = ["rcairo"]
-if /mingw|cygwin|mswin/ =~ RUBY_PLATFORM
- rcairo_source_dir_names.unshift("rcairo.win32")
-end
-rcairo_source_dir_names.each do |rcairo_source_dir_name|
- rcairo_source_dir = top_dir.parent.expand_path + rcairo_source_dir_name
- if rcairo_source_dir.exist?
- rcairo_options[:rcairo_source_dir] = rcairo_source_dir.to_s
- break
- end
-end
-
-unless check_cairo(rcairo_options)
+unless check_cairo(:top_dir => top_dir)
exit(false)
end
-setup_win32(module_name, base_dir)
+setup_windows(module_name, base_dir)
unless required_pkg_config_package([package_id, 2, 10, 0],
:debian => "libgtk2.0-dev",
diff --git a/gtk2/ext/gtk2/rbgdkproperty.c b/gtk2/ext/gtk2/rbgdkproperty.c
index dc83bc7..c6b0bcc 100644
--- a/gtk2/ext/gtk2/rbgdkproperty.c
+++ b/gtk2/ext/gtk2/rbgdkproperty.c
@@ -245,12 +245,12 @@ rg_m_get(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
ret = rb_ary_new();
if(rtype != GDK_SELECTION_TYPE_ATOM){
- for(j = 0; j < (rlen/sizeof(unsigned long)); j++){
- rb_ary_push(ret, INT2FIX(((unsigned long*)rdat)[j]));
+ for(j = 0; j < (rlen/sizeof(glong)); j++){
+ rb_ary_push(ret, INT2FIX(((glong*)rdat)[j]));
}
} else {
- for(j = 0; j < (rlen/sizeof(unsigned long)); j++){
- rb_ary_push(ret, BOXED2RVAL((GdkAtom)((unsigned long*)rdat)[j], GDK_TYPE_ATOM));
+ for(j = 0; j < (rlen/sizeof(glong)); j++){
+ rb_ary_push(ret, BOXED2RVAL((GdkAtom)((glong*)rdat)[j], GDK_TYPE_ATOM));
}
}
break;
diff --git a/gtk2/ext/gtk2/rbgtk.c b/gtk2/ext/gtk2/rbgtk.c
index 64424b0..554e3be 100644
--- a/gtk2/ext/gtk2/rbgtk.c
+++ b/gtk2/ext/gtk2/rbgtk.c
@@ -208,10 +208,27 @@ gtk_init()
gtk_exit()
*/
+static gboolean
+quit_loop(G_GNUC_UNUSED gpointer user_data)
+{
+ gtk_main_quit();
+ return G_SOURCE_REMOVE;
+}
+
static VALUE
rg_m_main(G_GNUC_UNUSED VALUE self)
{
+ GSource *interrupt_source;
+
+ interrupt_source = rbg_interrupt_source_new();
+ g_source_set_callback(interrupt_source, quit_loop, NULL, NULL);
+ g_source_attach(interrupt_source, NULL);
gtk_main();
+ g_source_destroy(interrupt_source);
+ g_source_unref(interrupt_source);
+
+ rb_thread_check_ints();
+
return Qnil;
}
diff --git a/gtk2/ext/gtk2/rbgtkaboutdialog.c b/gtk2/ext/gtk2/rbgtkaboutdialog.c
index 091288a..1e28907 100644
--- a/gtk2/ext/gtk2/rbgtkaboutdialog.c
+++ b/gtk2/ext/gtk2/rbgtkaboutdialog.c
@@ -98,7 +98,7 @@ rg_s_show(VALUE self, VALUE parent, VALUE props)
strlen(pd[i].name) == strlen("logo")){
pd[i].value = g_object_ref(RVAL2GOBJ(RARRAY_PTR(RARRAY_PTR(ary)[i])[1]));
} else if (strncmp(pd[i].name, "wrap_license", strlen("wrap_license")) == 0){
- pd[i].value = GINT_TO_POINTER(RVAL2CBOOL(RARRAY_PTR(ary)[i]));
+ pd[i].value = GINT_TO_POINTER(RVAL2CBOOL(RARRAY_PTR(RARRAY_PTR(ary)[i])[1]));
} else {
pd[i].value = g_strdup(RVAL2CSTR(RARRAY_PTR(RARRAY_PTR(ary)[i])[1]));
}
diff --git a/gtk2/ext/gtk2/rbgtkdialog.c b/gtk2/ext/gtk2/rbgtkdialog.c
index 7041308..4802c68 100644
--- a/gtk2/ext/gtk2/rbgtkdialog.c
+++ b/gtk2/ext/gtk2/rbgtkdialog.c
@@ -1,7 +1,6 @@
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
/*
- * Copyright (C) 2011 Ruby-GNOME2 Project Team
- * Copyright (C) 2002-2005 Ruby-GNOME2 Project Team
+ * Copyright (C) 2002-2014 Ruby-GNOME2 Project Team
* Copyright (C) 1998-2000 Yukihiro Matsumoto,
* Daisuke Kanda,
* Hiroshi Igarashi
@@ -126,15 +125,35 @@ rg_initialize(int argc, VALUE *argv, VALUE self)
return Qnil;
}
+static gboolean
+destroy_dialog(gpointer user_data)
+{
+ GtkWidget *dialog = user_data;
+ gtk_widget_destroy(dialog);
+ return G_SOURCE_REMOVE;
+}
+
static VALUE
rg_run(VALUE self)
{
- if (rb_block_given_p()){
- VALUE ret = INT2NUM(gtk_dialog_run(_SELF(self)));
- rb_yield(ret);
- return ret;
+ GtkDialog *dialog;
+ GSource *interrupt_source;
+ VALUE response;
+
+ dialog = _SELF(self);
+ interrupt_source = rbg_interrupt_source_new();
+ g_source_set_callback(interrupt_source, destroy_dialog, dialog, NULL);
+ g_source_attach(interrupt_source, NULL);
+ response = INT2NUM(gtk_dialog_run(dialog));
+ g_source_destroy(interrupt_source);
+ g_source_unref(interrupt_source);
+
+ rb_thread_check_ints();
+
+ if (rb_block_given_p()) {
+ return rb_yield(response);
} else {
- return INT2NUM(gtk_dialog_run(_SELF(self)));
+ return response;
}
}
diff --git a/gtk2/ext/gtk2/rbgtkselectiondata.c b/gtk2/ext/gtk2/rbgtkselectiondata.c
index ad13170..07c4c8f 100644
--- a/gtk2/ext/gtk2/rbgtkselectiondata.c
+++ b/gtk2/ext/gtk2/rbgtkselectiondata.c
@@ -36,20 +36,19 @@ rbgtk_atom2selectiondata(VALUE type, VALUE size, VALUE src, GdkAtom *gtype,
GdkAtom ntype = RVAL2ATOM(type);
if(ntype == GDK_SELECTION_TYPE_INTEGER){
- int *i;
- i = ALLOC(int);
+ glong *i;
+ i = ALLOC(glong);
*i = NUM2INT(src);
dat = i;
- fmt = sizeof(int) * 8;
+ fmt = 32;
len = 1;
} else if(ntype == GDK_SELECTION_TYPE_STRING) {
dat = (void *)RVAL2CSTR(src);
+ fmt = 8;
if (NIL_P(size)) {
- fmt = sizeof(char) * 8;
len = RSTRING_LEN(src);
} else {
len = NUM2UINT(size);
- fmt = (RSTRING_LEN(src) / len) * 8;
}
} else if(ntype == compound_text){
guchar* str = (guchar*)dat;
diff --git a/gtk2/patches/gtk+-2.24.22-remove-PRIVATE-from-def.diff b/gtk2/patches/gtk+-2.24.22-remove-PRIVATE-from-def.diff
new file mode 100644
index 0000000..8282e83
--- /dev/null
+++ b/gtk2/patches/gtk+-2.24.22-remove-PRIVATE-from-def.diff
@@ -0,0 +1,210 @@
+diff -ru gtk+-2.24.22.orig/gtk/gtk.def gtk+-2.24.22/gtk/gtk.def
+--- gtk+-2.24.22.orig/gtk/gtk.def 2013-10-11 19:17:52.000000000 +0900
++++ gtk+-2.24.22/gtk/gtk.def 2014-11-22 23:22:14.712803615 +0900
+@@ -70,13 +70,11 @@
+ gtk_accel_map_foreach_unfiltered
+ gtk_accel_map_get
+ gtk_accel_map_get_type
+- gtk_accel_map_load PRIVATE
+ gtk_accel_map_load_utf8
+ gtk_accel_map_load_fd
+ gtk_accel_map_load_scanner
+ gtk_accel_map_lock_path
+ gtk_accel_map_lookup_entry
+- gtk_accel_map_save PRIVATE
+ gtk_accel_map_save_utf8
+ gtk_accel_map_save_fd
+ gtk_accel_map_unlock_path
+@@ -1143,26 +1141,21 @@
+ gtk_expander_set_use_markup
+ gtk_expander_set_use_underline
+ gtk_file_chooser_add_filter
+- gtk_file_chooser_add_shortcut_folder PRIVATE
+ gtk_file_chooser_add_shortcut_folder_utf8
+ gtk_file_chooser_add_shortcut_folder_uri
+ gtk_file_chooser_error_quark
+ gtk_file_chooser_get_action
+- gtk_file_chooser_get_current_folder PRIVATE
+ gtk_file_chooser_get_current_folder_file
+ gtk_file_chooser_get_current_folder_utf8
+ gtk_file_chooser_get_current_folder_uri
+ gtk_file_chooser_get_extra_widget
+ gtk_file_chooser_get_file
+- gtk_file_chooser_get_filename PRIVATE
+ gtk_file_chooser_get_filename_utf8
+- gtk_file_chooser_get_filenames PRIVATE
+ gtk_file_chooser_get_filenames_utf8
+ gtk_file_chooser_get_files
+ gtk_file_chooser_get_filter
+ gtk_file_chooser_get_local_only
+ gtk_file_chooser_get_preview_file
+- gtk_file_chooser_get_preview_filename PRIVATE
+ gtk_file_chooser_get_preview_filename_utf8
+ gtk_file_chooser_get_preview_uri
+ gtk_file_chooser_get_preview_widget
+@@ -1178,27 +1171,22 @@
+ gtk_file_chooser_get_uris
+ gtk_file_chooser_get_use_preview_label
+ gtk_file_chooser_list_filters
+- gtk_file_chooser_list_shortcut_folders PRIVATE
+ gtk_file_chooser_list_shortcut_folders_utf8
+ gtk_file_chooser_list_shortcut_folder_uris
+ gtk_file_chooser_remove_filter
+- gtk_file_chooser_remove_shortcut_folder PRIVATE
+ gtk_file_chooser_remove_shortcut_folder_utf8
+ gtk_file_chooser_remove_shortcut_folder_uri
+ gtk_file_chooser_select_all
+ gtk_file_chooser_select_file
+- gtk_file_chooser_select_filename PRIVATE
+ gtk_file_chooser_select_filename_utf8
+ gtk_file_chooser_select_uri
+ gtk_file_chooser_set_action
+- gtk_file_chooser_set_current_folder PRIVATE
+ gtk_file_chooser_set_current_folder_file
+ gtk_file_chooser_set_current_folder_utf8
+ gtk_file_chooser_set_current_folder_uri
+ gtk_file_chooser_set_current_name
+ gtk_file_chooser_set_extra_widget
+ gtk_file_chooser_set_file
+- gtk_file_chooser_set_filename PRIVATE
+ gtk_file_chooser_set_filename_utf8
+ gtk_file_chooser_set_filter
+ gtk_file_chooser_set_local_only
+@@ -1210,7 +1198,6 @@
+ gtk_file_chooser_set_use_preview_label
+ gtk_file_chooser_unselect_all
+ gtk_file_chooser_unselect_file
+- gtk_file_chooser_unselect_filename PRIVATE
+ gtk_file_chooser_unselect_filename_utf8
+ gtk_file_chooser_unselect_uri
+ gtk_file_chooser_dialog_get_type
+@@ -1240,15 +1227,12 @@
+ gtk_file_filter_new
+ gtk_file_filter_set_name
+ gtk_file_selection_complete
+- gtk_file_selection_get_filename PRIVATE
+ gtk_file_selection_get_filename_utf8
+- gtk_file_selection_get_selections PRIVATE
+ gtk_file_selection_get_selections_utf8
+ gtk_file_selection_get_select_multiple
+ gtk_file_selection_get_type
+ gtk_file_selection_hide_fileop_buttons
+ gtk_file_selection_new
+- gtk_file_selection_set_filename PRIVATE
+ gtk_file_selection_set_filename_utf8
+ gtk_file_selection_set_select_multiple
+ gtk_file_selection_show_fileop_buttons
+@@ -1376,7 +1360,6 @@
+ gtk_icon_source_free
+ gtk_icon_source_get_direction
+ gtk_icon_source_get_direction_wildcarded
+- gtk_icon_source_get_filename PRIVATE
+ gtk_icon_source_get_filename_utf8
+ gtk_icon_source_get_icon_name
+ gtk_icon_source_get_pixbuf
+@@ -1388,7 +1371,6 @@
+ gtk_icon_source_new
+ gtk_icon_source_set_direction
+ gtk_icon_source_set_direction_wildcarded
+- gtk_icon_source_set_filename PRIVATE
+ gtk_icon_source_set_filename_utf8
+ gtk_icon_source_set_icon_name
+ gtk_icon_source_set_pixbuf
+@@ -1404,20 +1386,17 @@
+ gtk_icon_info_get_builtin_pixbuf
+ gtk_icon_info_get_display_name
+ gtk_icon_info_get_embedded_rect
+- gtk_icon_info_get_filename PRIVATE
+ gtk_icon_info_get_filename_utf8
+ gtk_icon_info_get_type
+ gtk_icon_info_load_icon
+ gtk_icon_info_set_raw_coordinates
+ gtk_icon_theme_add_builtin_icon
+- gtk_icon_theme_append_search_path PRIVATE
+ gtk_icon_theme_append_search_path_utf8
+ gtk_icon_theme_error_quark
+ gtk_icon_theme_get_default
+ gtk_icon_theme_get_example_icon_name
+ gtk_icon_theme_get_for_screen
+ gtk_icon_theme_get_icon_sizes
+- gtk_icon_theme_get_search_path PRIVATE
+ gtk_icon_theme_get_search_path_utf8
+ gtk_icon_theme_get_type
+ gtk_icon_theme_has_icon
+@@ -1428,12 +1407,10 @@
+ gtk_icon_theme_lookup_by_gicon
+ gtk_icon_theme_choose_icon
+ gtk_icon_theme_new
+- gtk_icon_theme_prepend_search_path PRIVATE
+ gtk_icon_theme_prepend_search_path_utf8
+ gtk_icon_theme_rescan_if_needed
+ gtk_icon_theme_set_custom_theme
+ gtk_icon_theme_set_screen
+- gtk_icon_theme_set_search_path PRIVATE
+ gtk_icon_theme_set_search_path_utf8
+ gtk_icon_view_get_column_spacing
+ gtk_icon_view_get_columns
+@@ -1514,7 +1491,6 @@
+ gtk_image_get_type
+ gtk_image_new
+ gtk_image_new_from_animation
+- gtk_image_new_from_file PRIVATE
+ gtk_image_new_from_file_utf8
+ gtk_image_new_from_icon_name
+ gtk_image_new_from_icon_set
+@@ -1524,7 +1500,6 @@
+ gtk_image_new_from_stock
+ gtk_image_new_from_gicon
+ gtk_image_set_from_animation
+- gtk_image_set_from_file PRIVATE
+ gtk_image_set_from_file_utf8
+ gtk_image_set_from_icon_name
+ gtk_image_set_from_icon_set
+@@ -2300,7 +2275,6 @@
+ gtk_rc_add_class_style
+ gtk_rc_add_widget_class_style
+ gtk_rc_add_widget_name_style
+- gtk_rc_add_default_file PRIVATE
+ gtk_rc_add_default_file_utf8
+ gtk_rc_find_module_in_path
+ gtk_rc_find_pixmap_in_path
+@@ -2311,7 +2285,6 @@
+ gtk_rc_get_style
+ gtk_rc_get_style_by_paths
+ gtk_rc_get_theme_dir
+- gtk_rc_parse PRIVATE
+ gtk_rc_parse_utf8
+ gtk_rc_parse_color
+ gtk_rc_parse_color_full
+@@ -2322,7 +2295,6 @@
+ gtk_rc_reparse_all_for_settings
+ gtk_rc_reset_styles
+ gtk_rc_scanner_new
+- gtk_rc_set_default_files PRIVATE
+ gtk_rc_set_default_files_utf8
+ gtk_rc_style_copy
+ gtk_rc_style_get_type
+@@ -3490,7 +3462,6 @@
+ gtk_type_unique
+ gtk_type_class
+ gtk_ui_manager_add_ui
+- gtk_ui_manager_add_ui_from_file PRIVATE
+ gtk_ui_manager_add_ui_from_file_utf8
+ gtk_ui_manager_add_ui_from_string
+ gtk_ui_manager_ensure_update
+@@ -3790,7 +3761,6 @@
+ gtk_window_set_deletable
+ gtk_window_set_default
+ gtk_window_set_default_icon
+- gtk_window_set_default_icon_from_file PRIVATE
+ gtk_window_set_default_icon_from_file_utf8
+ gtk_window_set_default_icon_list
+ gtk_window_set_default_icon_name
+@@ -3806,7 +3776,6 @@
+ gtk_window_get_has_frame
+ gtk_window_set_has_frame
+ gtk_window_set_icon
+- gtk_window_set_icon_from_file PRIVATE
+ gtk_window_set_icon_from_file_utf8
+ gtk_window_set_icon_list
+ gtk_window_set_icon_name
diff --git a/gtk2/patches/gtk+-2.24.22-add-missing-exeext-and-fix-directory.diff b/gtk2/patches/gtk+-2.24.25-add-missing-exeext-and-fix-directory.diff
similarity index 71%
rename from gtk2/patches/gtk+-2.24.22-add-missing-exeext-and-fix-directory.diff
rename to gtk2/patches/gtk+-2.24.25-add-missing-exeext-and-fix-directory.diff
index 5e7215e..280f555 100644
--- a/gtk2/patches/gtk+-2.24.22-add-missing-exeext-and-fix-directory.diff
+++ b/gtk2/patches/gtk+-2.24.25-add-missing-exeext-and-fix-directory.diff
@@ -1,7 +1,7 @@
-diff -ru gtk+-2.24.22.orig/gtk/Makefile.am gtk+-2.24.22/gtk/Makefile.am
---- gtk+-2.24.22.orig/gtk/Makefile.am 2013-10-05 07:02:29.000000000 +0900
-+++ gtk+-2.24.22/gtk/Makefile.am 2013-12-30 21:55:11.866931497 +0900
-@@ -1388,7 +1388,7 @@
+diff -ru gtk+-2.24.25.orig/gtk/Makefile.am gtk+-2.24.25/gtk/Makefile.am
+--- gtk+-2.24.25.orig/gtk/Makefile.am 2014-09-30 05:02:16.000000000 +0900
++++ gtk+-2.24.25/gtk/Makefile.am 2014-12-23 17:04:30.451910604 +0900
+@@ -1394,7 +1394,7 @@
gtk_update_icon_cache_program = $(GTK_UPDATE_ICON_CACHE)
else
gtk_update_icon_cache_program = \
@@ -10,9 +10,9 @@ diff -ru gtk+-2.24.22.orig/gtk/Makefile.am gtk+-2.24.22/gtk/Makefile.am
endif
gtkbuiltincache.h: @REBUILD@ stamp-icons
-diff -ru gtk+-2.24.22.orig/modules/input/Makefile.am gtk+-2.24.22/modules/input/Makefile.am
---- gtk+-2.24.22.orig/modules/input/Makefile.am 2013-10-05 07:02:29.000000000 +0900
-+++ gtk+-2.24.22/modules/input/Makefile.am 2013-12-30 22:47:07.543702598 +0900
+diff -ru gtk+-2.24.25.orig/modules/input/Makefile.am gtk+-2.24.25/modules/input/Makefile.am
+--- gtk+-2.24.25.orig/modules/input/Makefile.am 2014-09-30 05:02:17.000000000 +0900
++++ gtk+-2.24.25/modules/input/Makefile.am 2014-12-23 17:05:40.646189376 +0900
@@ -200,10 +200,10 @@
# after the libraries are installed in their final locations.
install-data-hook:
@@ -20,7 +20,7 @@ diff -ru gtk+-2.24.22.orig/modules/input/Makefile.am gtk+-2.24.22/modules/input/
- echo $(mkinstalldirs) $(DESTDIR)$(sysconfdir)/gtk-2.0 ; \
- $(mkinstalldirs) $(DESTDIR)$(sysconfdir)/gtk-2.0 ; \
- echo "$(DESTDOR)$(bindir)/gtk-query-immodules-2.0 > $(DESTDIR)$(libdir)/gtk-2.0/$(GTK_BINARY_VERSION)/immodules.cache" ; \
-- $(DESTDIR)/$(bindir)/gtk-query-immodules-2.0 > $(DESTDIR)$(libdir)/gtk-2.0/$(GTK_BINARY_VERSION)/immodules.cache ; \
+- $(DESTDIR)$(bindir)/gtk-query-immodules-2.0 > $(DESTDIR)$(libdir)/gtk-2.0/$(GTK_BINARY_VERSION)/immodules.cache ; \
+ echo $(mkinstalldirs) $(DESTDIR)$(libdir)/gtk-2.0/$(GTK_BINARY_VERSION) ; \
+ $(mkinstalldirs) $(DESTDIR)$(libdir)/gtk-2.0/$(GTK_BINARY_VERSION) ; \
+ echo "$(DESTDOR)$(bindir)/gtk-query-immodules-2.0$(EXEEXT) > $(DESTDIR)$(libdir)/gtk-2.0/$(GTK_BINARY_VERSION)/immodules.cache" ; \
diff --git a/gio2/test/test-file.rb b/gtk2/test/test_gdk_pixbuf.rb
similarity index 62%
copy from gio2/test/test-file.rb
copy to gtk2/test/test_gdk_pixbuf.rb
index fa46d3d..3c80a3b 100644
--- a/gio2/test/test-file.rb
+++ b/gtk2/test/test_gdk_pixbuf.rb
@@ -14,15 +14,21 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-class TestFile < Test::Unit::TestCase
- include GioTestUtils::Fixture
+class TestGdkPixbuf < Test::Unit::TestCase
+ def test_from_drawable
+ colormap = nil
+ gdk_window = Gdk::Window.default_root_window
+ src_x = 0
+ src_y = 0
+ width, height = gdk_window.size
- class TestContentType < self
- def test_guess_content_type
- path = fixture_path("content-type", "x-content", "unix-software")
- dir = Gio::File.path(path)
- assert_equal(["x-content/unix-software"],
- dir.guess_content_types.collect(&:to_s))
+ assert_nothing_raised do
+ Gdk::Pixbuf.from_drawable(colormap,
+ gdk_window,
+ src_x,
+ src_y,
+ width,
+ height)
end
end
end
diff --git a/gtk3/ext/gtk3/extconf.rb b/gtk3/ext/gtk3/extconf.rb
index f4f7c8f..1ddea26 100644
--- a/gtk3/ext/gtk3/extconf.rb
+++ b/gtk3/ext/gtk3/extconf.rb
@@ -33,33 +33,21 @@ end
have_func("rb_errinfo")
-["glib2", "atk", "pango", "gdk_pixbuf2", "gdk3"].each do |package|
+["glib2", "cairo-gobject", "atk", "pango", "gdk_pixbuf2", "gdk3"].each do |package|
+ depended_module_name = package.gsub(/-/, "_")
directory = "#{package}#{version_suffix}"
- build_dir = "#{directory}/tmp/#{RUBY_PLATFORM}/#{package}/#{RUBY_VERSION}"
+ build_dir = "#{directory}/tmp/#{RUBY_PLATFORM}/#{depended_module_name}/#{RUBY_VERSION}"
add_depend_package(package, "#{directory}/ext/#{package}",
top_dir.to_s,
:top_build_dir => top_build_dir.to_s,
:target_build_dir => build_dir)
end
-rcairo_options = {}
-rcairo_source_dir_names = ["rcairo"]
-if /mingw|cygwin|mswin/ =~ RUBY_PLATFORM
- rcairo_source_dir_names.unshift("rcairo.win32")
-end
-rcairo_source_dir_names.each do |rcairo_source_dir_name|
- rcairo_source_dir = top_dir.parent.expand_path + rcairo_source_dir_name
- if rcairo_source_dir.exist?
- rcairo_options[:rcairo_source_dir] = rcairo_source_dir.to_s
- break
- end
-end
-
-unless check_cairo(rcairo_options)
+unless check_cairo(:top_dir => top_dir)
exit(false)
end
-setup_win32(module_name, base_dir)
+setup_windows(module_name, base_dir)
unless required_pkg_config_package(package_id,
:debian => "libgtk-3-dev",
diff --git a/gtk3/ext/gtk3/rbgtk-about-dialog.c b/gtk3/ext/gtk3/rbgtk-about-dialog.c
index e032cbe..a6bc90f 100644
--- a/gtk3/ext/gtk3/rbgtk-about-dialog.c
+++ b/gtk3/ext/gtk3/rbgtk-about-dialog.c
@@ -74,7 +74,9 @@ rg_s_show(VALUE self, VALUE parent, VALUE props)
strlen(pd[i].name) == strlen("logo")){
pd[i].value = g_object_ref(RVAL2GOBJ(RARRAY_PTR(RARRAY_PTR(ary)[i])[1]));
} else if (strncmp(pd[i].name, "wrap_license", strlen("wrap_license")) == 0){
- pd[i].value = GINT_TO_POINTER(RVAL2CBOOL(RARRAY_PTR(ary)[i]));
+ pd[i].value = GINT_TO_POINTER(RVAL2CBOOL(RARRAY_PTR(RARRAY_PTR(ary)[i])[1]));
+ } else if (strncmp(pd[i].name, "license_type", strlen("license_type")) == 0){
+ pd[i].value = GINT_TO_POINTER(RVAL2GTKLICENSE(RARRAY_PTR(RARRAY_PTR(ary)[i])[1]));
} else {
pd[i].value = g_strdup(RVAL2CSTR(RARRAY_PTR(RARRAY_PTR(ary)[i])[1]));
}
diff --git a/gtksourceview3/ext/gtksourceview3/rbgtksourcegutterrenderertext.c b/gtk3/ext/gtk3/rbgtk-action-bar.c
similarity index 50%
copy from gtksourceview3/ext/gtksourceview3/rbgtksourcegutterrenderertext.c
copy to gtk3/ext/gtk3/rbgtk-action-bar.c
index b02be76..a40ad1e 100644
--- a/gtksourceview3/ext/gtksourceview3/rbgtksourcegutterrenderertext.c
+++ b/gtk3/ext/gtk3/rbgtk-action-bar.c
@@ -1,6 +1,6 @@
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
/*
- * Copyright (C) 2011 Ruby-GNOME2 Project Team
+ * Copyright (C) 2014 Ruby-GNOME2 Project Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -18,47 +18,56 @@
* MA 02110-1301 USA
*/
-#include "rbgtksourceview3private.h"
+#include "rbgtk3private.h"
-#define RG_TARGET_NAMESPACE cGutterRendererText
-#define _SELF(self) (RVAL2GTKSOURCEGUTTERRENDERERTEXT(self))
+#define RG_TARGET_NAMESPACE cActionBar
+#define _SELF(self) (RVAL2GTKACTIONBAR(self))
+#if GTK_CHECK_VERSION(3, 12, 0)
static VALUE
rg_initialize(VALUE self)
{
- G_INITIALIZE(self, gtk_source_gutter_renderer_text_new());
-
+ RBGTK_INITIALIZE(self, gtk_action_bar_new());
return Qnil;
}
static VALUE
-rg_set_markup(VALUE self, VALUE markup)
+rg_pack_start(VALUE self, VALUE child)
{
- StringValue(markup);
- gtk_source_gutter_renderer_text_set_markup(_SELF(self),
- RSTRING_PTR(markup),
- RSTRING_LEN(markup));
+ gtk_action_bar_pack_start(_SELF(self), RVAL2GOBJ(child));
+ return self;
+}
+static VALUE
+rg_pack_end(VALUE self, VALUE child)
+{
+ gtk_action_bar_pack_end(_SELF(self), RVAL2GOBJ(child));
return self;
}
static VALUE
-rg_set_text(VALUE self, VALUE text)
+rg_center_widget(VALUE self)
{
- StringValue(text);
- gtk_source_gutter_renderer_text_set_text(_SELF(self),
- RSTRING_PTR(text),
- RSTRING_LEN(text));
+ return GOBJ2RVAL(gtk_action_bar_get_center_widget(_SELF(self)));
+}
+static VALUE
+rg_set_center_widget(VALUE self, VALUE child)
+{
+ gtk_action_bar_set_center_widget(_SELF(self), RVAL2GOBJ(child));
return self;
}
void
-Init_gtksource_gutterrenderertext(VALUE mGtkSource)
+Init_gtk_action_bar(VALUE mGtk)
{
- VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_SOURCE_TYPE_GUTTER_RENDERER_TEXT, "GutterRendererText", mGtkSource);
+ VALUE RG_TARGET_NAMESPACE =
+ G_DEF_CLASS(GTK_TYPE_ACTION_BAR, "ActionBar", mGtk);
RG_DEF_METHOD(initialize, 0);
- RG_DEF_METHOD(set_markup, 1);
- RG_DEF_METHOD(set_text, 1);
+ RG_DEF_METHOD(pack_start, 1);
+ RG_DEF_METHOD(pack_end, 1);
+ RG_DEF_METHOD(center_widget, 0);
+ RG_DEF_METHOD(set_center_widget, 1);
}
+#endif
diff --git a/gtk3/ext/gtk3/rbgtk-color-button.c b/gtk3/ext/gtk3/rbgtk-color-button.c
index 1d140fa..9033afb 100644
--- a/gtk3/ext/gtk3/rbgtk-color-button.c
+++ b/gtk3/ext/gtk3/rbgtk-color-button.c
@@ -34,7 +34,13 @@ rg_initialize(int argc, VALUE *argv, VALUE self)
if (NIL_P(color)){
widget = gtk_color_button_new();
} else {
- widget = gtk_color_button_new_with_color(RVAL2GDKCOLOR(color));
+ GType gtype = RVAL2GTYPE(color);
+
+ if (gtype == GDK_TYPE_COLOR) {
+ widget = gtk_color_button_new_with_color(RVAL2GDKCOLOR(color));
+ } else {
+ widget = gtk_color_button_new_with_rgba(RVAL2GDKRGBA(color));
+ }
}
RBGTK_INITIALIZE(self, widget);
diff --git a/gtk3/ext/gtk3/rbgtk-dialog.c b/gtk3/ext/gtk3/rbgtk-dialog.c
index 700ebc4..0af917a 100644
--- a/gtk3/ext/gtk3/rbgtk-dialog.c
+++ b/gtk3/ext/gtk3/rbgtk-dialog.c
@@ -1,6 +1,6 @@
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
/*
- * Copyright (C) 2011 Ruby-GNOME2 Project Team
+ * Copyright (C) 2011-2014 Ruby-GNOME2 Project Team
* Copyright (C) 2002-2005 Ruby-GNOME2 Project Team
* Copyright (C) 1998-2000 Yukihiro Matsumoto,
* Daisuke Kanda,
@@ -74,15 +74,35 @@ rg_initialize(int argc, VALUE *argv, VALUE self)
return Qnil;
}
+static gboolean
+destroy_dialog(gpointer user_data)
+{
+ GtkWidget *dialog = user_data;
+ gtk_widget_destroy(dialog);
+ return G_SOURCE_REMOVE;
+}
+
static VALUE
rg_run(VALUE self)
{
- if (rb_block_given_p()){
- VALUE ret = INT2NUM(gtk_dialog_run(_SELF(self)));
- rb_yield(ret);
- return ret;
+ GtkDialog *dialog;
+ GSource *interrupt_source;
+ VALUE response;
+
+ dialog = _SELF(self);
+ interrupt_source = rbg_interrupt_source_new();
+ g_source_set_callback(interrupt_source, destroy_dialog, dialog, NULL);
+ g_source_attach(interrupt_source, NULL);
+ response = INT2NUM(gtk_dialog_run(dialog));
+ g_source_destroy(interrupt_source);
+ g_source_unref(interrupt_source);
+
+ rb_thread_check_ints();
+
+ if (rb_block_given_p()) {
+ return rb_yield(response);
} else {
- return INT2NUM(gtk_dialog_run(_SELF(self)));
+ return response;
}
}
diff --git a/gtk3/ext/gtk3/rbgtk-image.c b/gtk3/ext/gtk3/rbgtk-image.c
index 71a3ec6..713ce6e 100644
--- a/gtk3/ext/gtk3/rbgtk-image.c
+++ b/gtk3/ext/gtk3/rbgtk-image.c
@@ -72,6 +72,7 @@ rg_initialize(int argc, VALUE *argv, VALUE self)
rb_raise(rb_eArgError, "Invalid arguments.");
RBGTK_INITIALIZE(self, widget);
+ g_object_unref(widget);
return Qnil;
}
diff --git a/gtk3/ext/gtk3/rbgtk-selection-data.c b/gtk3/ext/gtk3/rbgtk-selection-data.c
index d8a6bba..cb2bb4f 100644
--- a/gtk3/ext/gtk3/rbgtk-selection-data.c
+++ b/gtk3/ext/gtk3/rbgtk-selection-data.c
@@ -36,20 +36,19 @@ rbgtk_atom2selectiondata(VALUE type, VALUE size, VALUE src, GdkAtom *gtype,
GdkAtom ntype = RVAL2ATOM(type);
if(ntype == GDK_SELECTION_TYPE_INTEGER){
- int *i;
- i = ALLOC(int);
+ glong *i;
+ i = ALLOC(glong);
*i = NUM2INT(src);
dat = i;
- fmt = sizeof(int) * 8;
+ fmt = 32;
len = 1;
} else if(ntype == GDK_SELECTION_TYPE_STRING) {
dat = (void *)RVAL2CSTR(src);
+ fmt = 8;
if (NIL_P(size)) {
- fmt = sizeof(char) * 8;
len = RSTRING_LEN(src);
} else {
len = NUM2UINT(size);
- fmt = (RSTRING_LEN(src) / len) * 8;
}
/* TODO
} else if(ntype == compound_text){
diff --git a/gdk3/ext/gdk3/rbgdkconst.c b/gtk3/ext/gtk3/rbgtk-stack-switcher.c
similarity index 65%
rename from gdk3/ext/gdk3/rbgdkconst.c
rename to gtk3/ext/gtk3/rbgtk-stack-switcher.c
index 8abfe03..295d06e 100644
--- a/gdk3/ext/gdk3/rbgdkconst.c
+++ b/gtk3/ext/gtk3/rbgtk-stack-switcher.c
@@ -1,10 +1,6 @@
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
/*
- * Copyright (C) 2011 Ruby-GNOME2 Project Team
- * Copyright (C) 2002,2003 Ruby-GNOME2 Project Team
- * Copyright (C) 1998-2000 Yukihiro Matsumoto,
- * Daisuke Kanda,
- * Hiroshi Igarashi
+ * Copyright (C) 2014 Ruby-GNOME2 Project Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -22,12 +18,24 @@
* MA 02110-1301 USA
*/
-#include "rbgdk3private.h"
+#include "rbgtk3private.h"
-void
-Init_gdk_const(VALUE mGdk)
+#if GTK_CHECK_VERSION(3, 10, 0)
+
+#define RG_TARGET_NAMESPACE cStackSwitcher
+
+static VALUE
+rg_initialize(VALUE self)
{
- G_DEF_CLASS(GDK_TYPE_STATUS, "Status", mGdk);
+ RBGTK_INITIALIZE(self, gtk_stack_switcher_new());
+ return Qnil;
}
+void
+Init_gtk_stack_switcher(VALUE mGtk)
+{
+ VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_STACK_SWITCHER, "StackSwitcher", mGtk);
+ RG_DEF_METHOD(initialize, 0);
+}
+#endif
diff --git a/gtk3/ext/gtk3/rbgtk-window.c b/gtk3/ext/gtk3/rbgtk-window.c
index 8bd1542..43b4e40 100644
--- a/gtk3/ext/gtk3/rbgtk-window.c
+++ b/gtk3/ext/gtk3/rbgtk-window.c
@@ -485,6 +485,13 @@ rg_set_default_geometry(VALUE self, VALUE width, VALUE height)
return self;
}
+static VALUE
+rg_set_titlebar(VALUE self, VALUE titlebar)
+{
+ gtk_window_set_titlebar(_SELF(self), RVAL2GTKWIDGET(titlebar));
+ return self;
+}
+
void
Init_gtk_window(VALUE mGtk)
{
@@ -544,6 +551,7 @@ Init_gtk_window(VALUE mGtk)
RG_DEF_METHOD(propagate_key_event, 1);
RG_DEF_METHOD(resize_to_geometry, 2);
RG_DEF_METHOD(set_default_geometry, 2);
+ RG_DEF_METHOD(set_titlebar, 1);
G_DEF_CLASS(GTK_TYPE_WINDOW_POSITION, "Position", RG_TARGET_NAMESPACE);
G_DEF_CLASS(GTK_TYPE_WINDOW_TYPE, "Type", RG_TARGET_NAMESPACE);
diff --git a/gtk3/ext/gtk3/rbgtk.c b/gtk3/ext/gtk3/rbgtk.c
index 2e1f694..3689f2d 100644
--- a/gtk3/ext/gtk3/rbgtk.c
+++ b/gtk3/ext/gtk3/rbgtk.c
@@ -28,6 +28,146 @@
#endif
#include <locale.h>
+/* TODO: REMOVE ME */
+/*
+ * They are temporary. They will be needless after Ruby/GTK3
+ * is based on Ruby/GObjectIntrospection.
+ */
+/* From Ruby/GDK3 - start */
+static GdkGeometry*
+geo_copy(const GdkGeometry* geo)
+{
+ GdkGeometry* new_geo;
+ g_return_val_if_fail (geo != NULL, NULL);
+ new_geo = g_new(GdkGeometry, 1);
+ *new_geo = *geo;
+ return new_geo;
+}
+
+GType
+gdk_geometry_get_type(void)
+{
+ static GType our_type = 0;
+ if (our_type == 0)
+ our_type = g_boxed_type_register_static ("GdkGeometry",
+ (GBoxedCopyFunc)geo_copy,
+ (GBoxedFreeFunc)g_free);
+ return our_type;
+}
+
+static GdkAtomData *
+gdk_atom_copy(const GdkAtom atom)
+{
+ GdkAtomData* data;
+ data = g_new(GdkAtomData, 1);
+ data->atom = atom;
+ return data;
+}
+
+GType
+gdk_atom_get_type(void)
+{
+ static GType our_type = 0;
+ if (our_type == 0)
+ our_type = g_boxed_type_register_static ("GdkAtomData",
+ (GBoxedCopyFunc)gdk_atom_copy,
+ (GBoxedFreeFunc)g_free);
+ return our_type;
+}
+
+struct rbgdk_rval2gdkatoms_args {
+ VALUE ary;
+ long n;
+ GdkAtom *result;
+};
+
+static VALUE
+rbgdk_rval2gdkatoms_body(VALUE value)
+{
+ long i;
+ struct rbgdk_rval2gdkatoms_args *args = (struct rbgdk_rval2gdkatoms_args *)value;
+
+ for (i = 0; i < args->n; i++)
+ args->result[i] = RVAL2ATOM(RARRAY_PTR(args->ary)[i]);
+
+ return Qnil;
+}
+
+static G_GNUC_NORETURN VALUE
+rbgdk_rval2gdkatoms_rescue(VALUE value)
+{
+ g_free(((struct rbgdk_rval2gdkatoms_args *)value)->result);
+
+ rb_exc_raise(rb_errinfo());
+}
+
+GdkAtom *
+rbgdk_rval2gdkatoms(VALUE value, long *n)
+{
+ struct rbgdk_rval2gdkatoms_args args;
+
+ args.ary = rb_ary_to_ary(value);
+ args.n = RARRAY_LEN(args.ary);
+ args.result = g_new(GdkAtom, args.n + 1);
+
+ rb_rescue(rbgdk_rval2gdkatoms_body, (VALUE)&args,
+ rbgdk_rval2gdkatoms_rescue, (VALUE)&args);
+
+ *n = args.n;
+
+ return args.result;
+}
+
+struct rval2gdkpixbufglist_args {
+ VALUE ary;
+ long n;
+ GList *result;
+};
+
+static VALUE
+rbgdk_rval2gdkpixbufglist_body(VALUE value)
+{
+ long i;
+ struct rval2gdkpixbufglist_args *args = (struct rval2gdkpixbufglist_args *)value;
+
+ for (i = 0; i < args->n; i++)
+ args->result = g_list_append(args->result, RVAL2GDKPIXBUF(RARRAY_PTR(args->ary)[i]));
+
+ return Qnil;
+}
+
+static G_GNUC_NORETURN VALUE
+rbgdk_rval2gdkpixbufglist_rescue(VALUE value)
+{
+ g_list_free(((struct rval2gdkpixbufglist_args *)value)->result);
+
+ rb_exc_raise(rb_errinfo());
+}
+
+GList *
+rbgdk_rval2gdkpixbufglist(VALUE value)
+{
+ struct rval2gdkpixbufglist_args args;
+
+ args.ary = rb_ary_to_ary(value);
+ args.n = RARRAY_LEN(args.ary);
+ args.result = NULL;
+
+ rb_rescue(rbgdk_rval2gdkpixbufglist_body, (VALUE)&args,
+ rbgdk_rval2gdkpixbufglist_rescue, (VALUE)&args);
+
+ return args.result;
+}
+
+GdkAtom
+rbgdk_rval2gdkatom(VALUE atom)
+{
+ if (TYPE(atom) == T_STRING)
+ return gdk_atom_intern(RVAL2CSTR(atom), FALSE);
+ return (RVAL2GDKATOM(atom))->atom;
+}
+/* From Ruby/GDK3 - end */
+
#define RG_TARGET_NAMESPACE mGtk
static VALUE RG_TARGET_NAMESPACE;
@@ -179,10 +319,27 @@ rg_s_init(int argc, VALUE *argv, VALUE self)
gtk_init()
*/
+static gboolean
+quit_loop(G_GNUC_UNUSED gpointer user_data)
+{
+ gtk_main_quit();
+ return G_SOURCE_REMOVE;
+}
+
static VALUE
rg_s_main(G_GNUC_UNUSED VALUE self)
{
+ GSource *interrupt_source;
+
+ interrupt_source = rbg_interrupt_source_new();
+ g_source_set_callback(interrupt_source, quit_loop, NULL, NULL);
+ g_source_attach(interrupt_source, NULL);
gtk_main();
+ g_source_destroy(interrupt_source);
+ g_source_unref(interrupt_source);
+
+ rb_thread_check_ints();
+
return Qnil;
}
@@ -407,6 +564,9 @@ Init_gtk(void)
Init_gtk_accel_map(RG_TARGET_NAMESPACE);
Init_gtk_accessible(RG_TARGET_NAMESPACE);
Init_gtk_action(RG_TARGET_NAMESPACE);
+#if GTK_CHECK_VERSION(3, 12, 0)
+ Init_gtk_action_bar(RG_TARGET_NAMESPACE);
+#endif
Init_gtk_actiongroup(RG_TARGET_NAMESPACE);
Init_gtk_activatable(RG_TARGET_NAMESPACE);
Init_gtk_adjustment(RG_TARGET_NAMESPACE);
@@ -569,6 +729,7 @@ Init_gtk(void)
Init_gtk_spinner(RG_TARGET_NAMESPACE);
#if GTK_CHECK_VERSION(3, 10, 0)
Init_gtk_stack(RG_TARGET_NAMESPACE);
+ Init_gtk_stack_switcher(RG_TARGET_NAMESPACE);
#endif
Init_gtk_statusbar(RG_TARGET_NAMESPACE);
Init_gtk_status_icon(RG_TARGET_NAMESPACE);
diff --git a/gtk3/ext/gtk3/rbgtk3.h b/gtk3/ext/gtk3/rbgtk3.h
index cf088a3..9d81716 100644
--- a/gtk3/ext/gtk3/rbgtk3.h
+++ b/gtk3/ext/gtk3/rbgtk3.h
@@ -30,6 +30,39 @@
#include <rbgobject.h>
#include "rbgtk3conversions.h"
+/* TODO: REMOVE ME */
+/*
+ * They are temporary. They will be needless after Ruby/GTK3
+ * is based on Ruby/GObjectIntrospection.
+ */
+/* From rbgdk3.h - start */
+#include <gdk/gdk.h>
+#ifdef GDK_WINDOWING_X11
+# include <gdk/gdkx.h>
+#endif
+#ifdef GDK_WINDOWING_WIN32
+# include <gdk/gdkwin32.h>
+#endif
+
+#define RVAL2GDKPIXBUFGLIST(value) rbgdk_rval2gdkpixbufglist(value)
+#define RVAL2ATOM(atom) rbgdk_rval2gdkatom(atom)
+#define RVAL2GDKATOMS(value, n) rbgdk_rval2gdkatoms(value, n)
+
+#define GDK_TYPE_GEOMETRY (gdk_geometry_get_type())
+#define GDK_TYPE_ATOM (gdk_atom_get_type())
+
+typedef struct {
+ GdkAtom atom;
+} GdkAtomData;
+
+GType gdk_atom_get_type(void);
+GType gdk_geometry_get_type(void);
+
+GList *rbgdk_rval2gdkpixbufglist(VALUE value);
+GdkAtom rbgdk_rval2gdkatom(VALUE atom);
+GdkAtom *rbgdk_rval2gdkatoms(VALUE value, long *n);
+/* From rbgdk3.h - end */
+
#define RBGTK_MAJOR_VERSION RBGLIB_MAJOR_VERSION
#define RBGTK_MINOR_VERSION RBGLIB_MINOR_VERSION
#define RBGTK_MICRO_VERSION RBGLIB_MICRO_VERSION
diff --git a/gtk3/ext/gtk3/rbgtk3conversions.h b/gtk3/ext/gtk3/rbgtk3conversions.h
index 4eed1c7..9b32156 100644
--- a/gtk3/ext/gtk3/rbgtk3conversions.h
+++ b/gtk3/ext/gtk3/rbgtk3conversions.h
@@ -26,6 +26,7 @@
#define RVAL2GTKACCELLABEL(o) (GTK_ACCEL_LABEL(RVAL2GOBJ(o)))
#define RVAL2GTKACCESSIBLE(o) (GTK_ACCESSIBLE(RVAL2GOBJ(o)))
#define RVAL2GTKACTION(o) (GTK_ACTION(RVAL2GOBJ(o)))
+#define RVAL2GTKACTIONBAR(o) (GTK_ACTION_BAR(RVAL2GOBJ(o)))
#define RVAL2GTKACTIONGROUP(o) (GTK_ACTION_GROUP(RVAL2GOBJ(o)))
#define RVAL2GTKADJUSTMENT(o) (GTK_ADJUSTMENT(RVAL2GOBJ(o)))
#define RVAL2GTKALIGNMENT(o) (GTK_ALIGNMENT(RVAL2GOBJ(o)))
@@ -330,6 +331,8 @@
#define GTKWINDOWTYPE2RVAL(o) (GENUM2RVAL(o, GTK_TYPE_WINDOW_TYPE))
#define RVAL2GTKWRAPMODE(o) (RVAL2GENUM(o, GTK_TYPE_WRAP_MODE))
#define GTKWRAPMODE2RVAL(o) (GENUM2RVAL(o, GTK_TYPE_WRAP_MODE))
+#define RVAL2GTKLICENSE(o) (RVAL2GENUM(o, GTK_TYPE_LICENSE))
+#define GTKLICENSE2RVAL(o) (GENUM2RVAL(o, GTK_TYPE_LICENSE))
#define RVAL2GTKACCELFLAGS(o) (RVAL2GFLAGS(o, GTK_TYPE_ACCEL_FLAGS))
#define GTKACCELFLAGS2RVAL(o) (GFLAGS2RVAL(o, GTK_TYPE_ACCEL_FLAGS))
@@ -366,7 +369,7 @@
#define RVAL2GTKUIMANAGERITEMTYPE(o) (RVAL2GFLAGS(o, GTK_TYPE_UI_MANAGER_ITEM_TYPE))
#define GTKUIMANAGERITEMTYPE2RVAL(o) (GFLAGS2RVAL(o, GTK_TYPE_UI_MANAGER_ITEM_TYPE))
-/* For GIO. They are temporary. They will be needless after Ruby/GDK3
+/* For GIO. They are temporary. They will be needless after Ruby/GTK3
* is based on Ruby/GObjectIntrospection.
*/
#define RVAL2GFILE(o) (G_FILE(RVAL2GOBJ(o)))
@@ -374,4 +377,63 @@
#define RVAL2GPERMISSION(o) (G_PERMISSION(RVAL2GOBJ(o)))
#define RVAL2GAPPLICATIONFLAGS(o) (RVAL2GFLAGS(o, G_TYPE_APPLICATION_FLAGS))
+/* For GDK. They are temporary. They will be needless after Ruby/GTK3
+ * is based on Ruby/GObjectIntrospection.
+ */
+#define RVAL2GDKCOLOR(o) ((GdkColor*)RVAL2BOXED(o, GDK_TYPE_COLOR))
+#define GDKCOLOR2RVAL(o) (BOXED2RVAL(o, GDK_TYPE_COLOR))
+
+#define RVAL2GDKRGBA(o) ((GdkRGBA*)RVAL2BOXED(o, GDK_TYPE_RGBA))
+#define GDKRGBA2RVAL(o) (BOXED2RVAL(o, GDK_TYPE_RGBA))
+
+#define RVAL2GDKMODIFIERTYPE(o) (RVAL2GFLAGS(o, GDK_TYPE_MODIFIER_TYPE))
+
+#define RVAL2GDKDRAGCONTEXT(o) (GDK_DRAG_CONTEXT(RVAL2GOBJ(o)))
+
+#define RVAL2GDKSCREEN(o) (GDK_SCREEN(RVAL2GOBJ(o)))
+
+#define RVAL2GDKWINDOW(o) (GDK_WINDOW(RVAL2GOBJ(o)))
+
+#define GDKEVENT2RVAL(o) (BOXED2RVAL(o, GDK_TYPE_EVENT))
+#define RVAL2GDKEVENT(o) ((GdkEvent *)RVAL2BOXED(o, GDK_TYPE_EVENT))
+#define GEV2RVAL(ev) GDKEVENT2RVAL(ev)
+#define RVAL2GEV(ev) RVAL2GDKEVENT(ev)
+
+#define GDKMODIFIERTYPE2RVAL(o) (GFLAGS2RVAL(o, GDK_TYPE_MODIFIER_TYPE))
+
+#define GDKRECTANGLE2RVAL(o) (BOXED2RVAL(o, CAIRO_GOBJECT_TYPE_RECTANGLE_INT))
+#define RVAL2GDKRECTANGLE(o) ((GdkRectangle*)RVAL2BOXED(o, CAIRO_GOBJECT_TYPE_RECTANGLE_INT))
+
+#define RVAL2GDKDISPLAYOBJECT(o) (GDK_DISPLAY_OBJECT(RVAL2GOBJ(o)))
+
+#define GDKATOM2RVAL(o) (BOXED2RVAL(o, GDK_TYPE_ATOM))
+#define RVAL2GDKATOM(o) ((GdkAtomData*)RVAL2BOXED(o, GDK_TYPE_ATOM))
+
+#define RVAL2GDKEVENTKEY(o) ((GdkEventKey*)RVAL2GDKEVENT(o))
+
+#define RVAL2GDKDRAGACTION(o) (RVAL2GFLAGS(o, GDK_TYPE_DRAG_ACTION))
+
+#define RVAL2GDKGEOMETRY(o) ((GdkGeometry*)RVAL2BOXED(o, GDK_TYPE_GEOMETRY))
+
+#define RVAL2GDKWINDOWHINTS(o) (RVAL2GFLAGS(o, GDK_TYPE_WINDOW_HINTS))
+
+#define RVAL2GDKWINDOWEDGE(o) (RVAL2GENUM(o, GDK_TYPE_WINDOW_EDGE))
+
+#define RVAL2GDKDEVICE(o) (GDK_DEVICE(RVAL2GOBJ(o)))
+
+#define RVAL2GDKEVENTMASK(o) (RVAL2GFLAGS(o, GDK_TYPE_EVENT_MASK))
+#define GDKEVENTMASK2RVAL(o) (GFLAGS2RVAL(o, GDK_TYPE_EVENT_MASK))
+
+#define RVAL2GDKVISUAL(o) (GDK_VISUAL(RVAL2GOBJ(o)))
+
+#define RVAL2GDKDRAGPROTOCOL(o) (RVAL2GENUM(o, GDK_TYPE_DRAG_PROTOCOL))
+
#endif /* __RBGTK3CONVERSIONS_H__ */
+
+
+
+
+
+
+
+
diff --git a/gtk3/ext/gtk3/rbgtk3private.h b/gtk3/ext/gtk3/rbgtk3private.h
index b86c332..624724f 100644
--- a/gtk3/ext/gtk3/rbgtk3private.h
+++ b/gtk3/ext/gtk3/rbgtk3private.h
@@ -35,7 +35,6 @@
#include <cairo-gobject.h>
#include <rbpango.h>
#include <rbgdk-pixbuf.h>
-#include <rbgdk3.h>
#include "rbgtk3.h"
#include "rbgtk3util.h"
@@ -80,6 +79,9 @@ G_GNUC_INTERNAL void Init_gtk_accel_label(VALUE mGtk);
G_GNUC_INTERNAL void Init_gtk_accel_map(VALUE mGtk);
G_GNUC_INTERNAL void Init_gtk_accessible(VALUE mGtk);
G_GNUC_INTERNAL void Init_gtk_action(VALUE mGtk);
+#if GTK_CHECK_VERSION(3, 12, 0)
+ G_GNUC_INTERNAL void Init_gtk_action_bar(VALUE mGtk);
+#endif
G_GNUC_INTERNAL void Init_gtk_actiongroup(VALUE mGtk);
G_GNUC_INTERNAL void Init_gtk_activatable(VALUE mGtk);
G_GNUC_INTERNAL void Init_gtk_adjustment(VALUE mGtk);
@@ -242,6 +244,7 @@ G_GNUC_INTERNAL void Init_gtk_spin_button(VALUE mGtk);
G_GNUC_INTERNAL void Init_gtk_spinner(VALUE mGtk);
#if GTK_CHECK_VERSION(3, 10, 0)
G_GNUC_INTERNAL void Init_gtk_stack(VALUE mGtk);
+ G_GNUC_INTERNAL void Init_gtk_stack_switcher(VALUE mGtk);
#endif
G_GNUC_INTERNAL void Init_gtk_statusbar(VALUE mGtk);
G_GNUC_INTERNAL void Init_gtk_status_icon(VALUE mGtk);
diff --git a/gtk3/lib/gtk3.rb b/gtk3/lib/gtk3.rb
old mode 100644
new mode 100755
index 679d042..1514ca8
--- a/gtk3/lib/gtk3.rb
+++ b/gtk3/lib/gtk3.rb
@@ -7,4 +7,5 @@
require 'gtk3/base'
require 'gtk3/deprecated'
+Gdk.init if Gdk.respond_to?(:init)
Gtk.init
diff --git a/gtk3/sample/gtk-demo/cairo-arc-negative.rb b/gtk3/sample/gtk-demo/cairo-arc-negative.rb
index 735dddc..f8e54a2 100644
--- a/gtk3/sample/gtk-demo/cairo-arc-negative.rb
+++ b/gtk3/sample/gtk-demo/cairo-arc-negative.rb
@@ -25,7 +25,7 @@ module Demo
def draw(cr)
cr.arc_negative(CENTER_X, CENTER_Y, RADIUS, ANGLE1, ANGLE2)
cr.stroke
-
+
# draw helping lines
cr.set_source_rgba(1, 0.2, 0.2, 0.6)
cr.arc(CENTER_X, CENTER_Y, 0.05, 0, 2 * Math::PI)
diff --git a/gtk3/sample/gtk-demo/cairo-arc.rb b/gtk3/sample/gtk-demo/cairo-arc.rb
index 6c7cc35..41de3a8 100644
--- a/gtk3/sample/gtk-demo/cairo-arc.rb
+++ b/gtk3/sample/gtk-demo/cairo-arc.rb
@@ -25,7 +25,7 @@ module Demo
def draw(cr)
cr.arc(CENTER_X, CENTER_Y, RADIUS, ANGLE1, ANGLE2)
cr.stroke
-
+
# draw helping lines
cr.set_source_rgba(1, 0.2, 0.2, 0.6)
cr.arc(CENTER_X, CENTER_Y, 0.05, 0, 2 * Math::PI)
diff --git a/gtk3/sample/gtk-demo/cairo-clip-image.rb b/gtk3/sample/gtk-demo/cairo-clip-image.rb
index b949e07..9ab0950 100644
--- a/gtk3/sample/gtk-demo/cairo-clip-image.rb
+++ b/gtk3/sample/gtk-demo/cairo-clip-image.rb
@@ -20,16 +20,16 @@ module Demo
cr.save do
cr.arc(0.5, 0.5, 0.4, 0, 2 * Math::PI)
cr.clip
-
+
cr.new_path
-
+
loader = Gdk::PixbufLoader.new
File.open("background.jpg", "rb") do |f|
loader.last_write(f.read)
end
pixbuf = loader.pixbuf
cr.scale(1.0 / pixbuf.width, 1.0 / pixbuf.height)
-
+
cr.set_source_pixbuf(pixbuf, 0, 0)
cr.paint
end
@@ -37,12 +37,12 @@ module Demo
cr.save do
cr.arc(0.5, 0.5, 0.3, 0, 2 * Math::PI)
cr.clip
-
+
cr.new_path
-
+
image = Cairo::ImageSurface.from_png("ruby-gnome2-logo.png")
cr.scale(1.0 / image.width, 1.0 / image.height)
-
+
cr.set_source(image, 0, 0)
cr.paint
end
diff --git a/gtk3/sample/gtk-demo/cairo-clip-rectangle.rb b/gtk3/sample/gtk-demo/cairo-clip-rectangle.rb
index 75fc8e7..a8ae508 100644
--- a/gtk3/sample/gtk-demo/cairo-clip-rectangle.rb
+++ b/gtk3/sample/gtk-demo/cairo-clip-rectangle.rb
@@ -24,9 +24,9 @@ module Demo
cr.line_to(0.75, 0.25)
cr.line_to(0.25, 0.25)
cr.close_path
-
+
cr.clip
-
+
cr.move_to(0, 0)
cr.line_to(1, 1)
cr.stroke
diff --git a/gtk3/sample/gtk-demo/cairo-curve-rectangle.rb b/gtk3/sample/gtk-demo/cairo-curve-rectangle.rb
index 1a4e780..44db283 100644
--- a/gtk3/sample/gtk-demo/cairo-curve-rectangle.rb
+++ b/gtk3/sample/gtk-demo/cairo-curve-rectangle.rb
@@ -28,7 +28,7 @@ module Demo
def draw(cr)
return if (RECT_WIDTH <= 0 || RECT_HEIGHT <= 0)
-
+
if (RECT_WIDTH / 2 < RADIUS)
if (RECT_HEIGHT / 2 < RADIUS)
cr.move_to(X0, (Y0 + Y1) / 2)
@@ -64,7 +64,7 @@ module Demo
cr.curve_to(X0, Y1, X0, Y1, X0, Y1- RADIUS)
end
end
-
+
cr.close_path
cr.set_source_rgba(0.5,0.5,1)
diff --git a/gtk3/sample/gtk-demo/cairo-curve-to.rb b/gtk3/sample/gtk-demo/cairo-curve-to.rb
index 9032313..72700e1 100644
--- a/gtk3/sample/gtk-demo/cairo-curve-to.rb
+++ b/gtk3/sample/gtk-demo/cairo-curve-to.rb
@@ -28,9 +28,9 @@ module Demo
def draw(cr)
cr.move_to(X, Y)
cr.curve_to(X1, Y1, X2, Y2, X3, Y3)
-
+
cr.stroke
-
+
cr.set_source_rgba(1, 0.2, 0.2, 0.6)
cr.set_line_width(0.03)
cr.move_to(X, Y)
diff --git a/gtk3/sample/gtk-demo/cairo-dash.rb b/gtk3/sample/gtk-demo/cairo-dash.rb
index 720b39b..6a45dcf 100644
--- a/gtk3/sample/gtk-demo/cairo-dash.rb
+++ b/gtk3/sample/gtk-demo/cairo-dash.rb
@@ -32,7 +32,7 @@ module Demo
cr.line_to(0.9, 0.9)
cr.rel_line_to(-0.4, 0.0)
cr.curve_to(0.2, 0.9, 0.2, 0.5, 0.5, 0.5)
-
+
cr.stroke
end
end
diff --git a/gtk3/sample/gtk-demo/cairo-fill-and-stroke.rb b/gtk3/sample/gtk-demo/cairo-fill-and-stroke.rb
index 84e4199..83b9172 100644
--- a/gtk3/sample/gtk-demo/cairo-fill-and-stroke.rb
+++ b/gtk3/sample/gtk-demo/cairo-fill-and-stroke.rb
@@ -22,7 +22,7 @@ module Demo
cr.rel_line_to(-0.4, 0.0)
cr.curve_to(0.2, 0.9, 0.2, 0.5, 0.5, 0.5)
cr.close_path
-
+
cr.set_source_rgba(0, 0, 1)
cr.fill_preserve
cr.set_source_rgba(0, 0, 0)
diff --git a/gtk3/sample/gtk-demo/cairo-fill-and-stroke2.rb b/gtk3/sample/gtk-demo/cairo-fill-and-stroke2.rb
index 011d154..9ef7207 100644
--- a/gtk3/sample/gtk-demo/cairo-fill-and-stroke2.rb
+++ b/gtk3/sample/gtk-demo/cairo-fill-and-stroke2.rb
@@ -22,13 +22,13 @@ module Demo
cr.rel_line_to(-0.4, 0.0)
cr.curve_to(0.2, 0.9, 0.2, 0.5, 0.5, 0.5)
cr.close_path
-
+
cr.move_to(0.25, 0.1)
cr.rel_line_to(0.2, 0.2)
cr.rel_line_to(-0.2, 0.2)
cr.rel_line_to(-0.2, -0.2)
cr.close_path
-
+
cr.set_source_rgba(0, 0, 1)
cr.fill_preserve
cr.set_source_rgba(0, 0, 0)
diff --git a/gtk3/sample/gtk-demo/cairo-gradient.rb b/gtk3/sample/gtk-demo/cairo-gradient.rb
index f947421..c3beb24 100644
--- a/gtk3/sample/gtk-demo/cairo-gradient.rb
+++ b/gtk3/sample/gtk-demo/cairo-gradient.rb
@@ -23,7 +23,7 @@ module Demo
cr.rectangle(0, 0, 1, 1)
cr.set_source(pat)
cr.fill
-
+
pat = Cairo::RadialPattern.new(0.45, 0.4, 0.1, 0.4, 0.4, 0.5)
pat.add_color_stop_rgba(0, 1, 1, 1, 0.8)
pat.add_color_stop_rgba(1, 0, 0, 0)
diff --git a/gtk3/sample/gtk-demo/cairo-image-pattern.rb b/gtk3/sample/gtk-demo/cairo-image-pattern.rb
index c2a72f0..92433b6 100644
--- a/gtk3/sample/gtk-demo/cairo-image-pattern.rb
+++ b/gtk3/sample/gtk-demo/cairo-image-pattern.rb
@@ -18,20 +18,20 @@ module Demo
def draw(cr)
image = Cairo::ImageSurface.from_png("ruby-gnome2-logo.png")
-
+
pattern = Cairo::SurfacePattern.new(image)
pattern.set_extend(Cairo::EXTEND_REPEAT)
-
+
cr.translate(0.5, 0.5)
cr.rotate(Math::PI / 4)
cr.scale(1 / Math.sqrt(2), 1 / Math.sqrt(2))
cr.translate(-0.5, -0.5)
-
+
matrix = Cairo::Matrix.scale(image.width * 5, image.height * 5)
pattern.set_matrix(matrix)
-
+
cr.set_source(pattern)
-
+
cr.rectangle(0, 0, 1.0, 1.0)
cr.fill
end
diff --git a/gtk3/sample/gtk-demo/cairo-image.rb b/gtk3/sample/gtk-demo/cairo-image.rb
index b102989..f108f95 100644
--- a/gtk3/sample/gtk-demo/cairo-image.rb
+++ b/gtk3/sample/gtk-demo/cairo-image.rb
@@ -23,24 +23,24 @@ module Demo
loader.last_write(f.read)
end
pixbuf = loader.pixbuf
-
+
cr.translate(0.5, 0.5)
cr.rotate(45 * Math::PI / 180)
cr.scale(1.0 / pixbuf.width, 1.0 / pixbuf.height)
cr.translate(-0.5 * pixbuf.width, -0.5 * pixbuf.height)
-
+
cr.set_source_pixbuf(pixbuf, 0, 0)
cr.paint
end
cr.save do
image = Cairo::ImageSurface.from_png("ruby-gnome2-logo.png")
-
+
cr.translate(0.5, 0.5)
cr.rotate(60 * Math::PI / 180)
cr.scale(0.8 / image.width, 0.8 / image.height)
cr.translate(-0.5 * image.width, -0.5 * image.height)
-
+
cr.set_source(image, 0, 0)
cr.paint
end
diff --git a/gtk3/sample/gtk-demo/cairo-line-cap.rb b/gtk3/sample/gtk-demo/cairo-line-cap.rb
index cd20cc9..1622d6b 100644
--- a/gtk3/sample/gtk-demo/cairo-line-cap.rb
+++ b/gtk3/sample/gtk-demo/cairo-line-cap.rb
@@ -18,35 +18,35 @@ module Demo
def draw(cr)
cr.set_line_width(0.12)
-
+
cr.set_line_cap(Cairo::LINE_CAP_BUTT) # default
cr.move_to(0.25, 0.2)
cr.line_to(0.25, 0.8)
cr.stroke
-
+
cr.set_line_cap(Cairo::LINE_CAP_ROUND)
cr.move_to(0.5, 0.2)
cr.line_to(0.5, 0.8)
cr.stroke
-
+
cr.set_line_cap(Cairo::LINE_CAP_SQUARE)
cr.move_to(0.75, 0.2)
cr.line_to(0.75, 0.8)
cr.stroke
-
+
# draw helping lines
cr.set_source_rgba(1, 0.2, 0.2)
cr.set_line_width(0.01)
-
+
cr.move_to(0.25, 0.2)
cr.line_to(0.25, 0.8)
-
+
cr.move_to(0.5, 0.2)
cr.line_to(0.5, 0.8)
-
+
cr.move_to(0.75, 0.2)
cr.line_to(0.75, 0.8)
-
+
cr.stroke
end
end
diff --git a/gtk3/sample/gtk-demo/cairo-line-join.rb b/gtk3/sample/gtk-demo/cairo-line-join.rb
index 5b23261..40f2e22 100644
--- a/gtk3/sample/gtk-demo/cairo-line-join.rb
+++ b/gtk3/sample/gtk-demo/cairo-line-join.rb
@@ -18,19 +18,19 @@ module Demo
def draw(cr)
cr.set_line_width(0.16)
-
+
cr.move_to(0.3, 0.33)
cr.rel_line_to(0.2, -0.2)
cr.rel_line_to(0.2, 0.2)
cr.set_line_join(Cairo::LINE_JOIN_MITER) # default
cr.stroke
-
+
cr.move_to(0.3, 0.63)
cr.rel_line_to(0.2, -0.2)
cr.rel_line_to(0.2, 0.2)
cr.set_line_join(Cairo::LINE_JOIN_BEVEL)
cr.stroke
-
+
cr.move_to(0.3, 0.93)
cr.rel_line_to(0.2, -0.2)
cr.rel_line_to(0.2, 0.2)
diff --git a/gtk3/sample/gtk-demo/cairo-long-lines.rb b/gtk3/sample/gtk-demo/cairo-long-lines.rb
index e8c32cc..498b974 100644
--- a/gtk3/sample/gtk-demo/cairo-long-lines.rb
+++ b/gtk3/sample/gtk-demo/cairo-long-lines.rb
@@ -21,17 +21,17 @@ module Demo
cr.line_to(0.1, 50)
cr.set_source_rgba(1, 0, 0)
cr.stroke
-
+
cr.move_to(0.2, -60)
cr.line_to(0.2, 60)
cr.set_source_rgba(1, 1, 0)
cr.stroke
-
+
cr.move_to(0.3, -70)
cr.line_to(0.3, 70)
cr.set_source_rgba(0, 1, 0)
cr.stroke
-
+
cr.move_to(0.4, -80)
cr.line_to(0.4, 80)
cr.set_source_rgba(0, 0, 1)
diff --git a/gtk3/sample/gtk-demo/cairo-pattern-fill.rb b/gtk3/sample/gtk-demo/cairo-pattern-fill.rb
index 0a4e1a9..8847245 100644
--- a/gtk3/sample/gtk-demo/cairo-pattern-fill.rb
+++ b/gtk3/sample/gtk-demo/cairo-pattern-fill.rb
@@ -14,13 +14,13 @@ module Demo
class CairoPatternFill < CairoWindow
X_FUZZ = 0.08
Y_FUZZ = 0.08
-
+
X_INNER_RADIUS = 0.3
Y_INNER_RADIUS = 0.2
-
+
X_OUTER_RADIUS = 0.45
Y_OUTER_RADIUS = 0.35
-
+
SPIKES = 10
TEXT = "Ruby!"
@@ -31,31 +31,31 @@ module Demo
def draw(cr)
srand(45)
-
+
cr.set_line_width(0.01)
x = y = nil
0.step(SPIKES * 2 - 1, 2) do |i|
x = x_position(i, X_INNER_RADIUS)
y = y_position(i, Y_INNER_RADIUS)
-
+
if (i == 0)
cr.move_to(x, y)
else
cr.line_to(x, y)
end
-
+
i += 1
-
+
x = x_position(i, X_OUTER_RADIUS)
y = y_position(i, Y_OUTER_RADIUS)
-
+
cr.line_to(x, y)
end
cr.close_path
cr.stroke
-
+
cr.select_font_face("Sans",
Cairo::FONT_SLANT_NORMAL,
Cairo::FONT_WEIGHT_BOLD)
@@ -65,7 +65,7 @@ module Demo
cr.text_path(TEXT)
cr.set_source_rgba(1, 0, 0.5)
cr.fill
-
+
cr.set_font_size(0.2)
extents = cr.text_extents(TEXT)
x = 0.5 - (extents.width / 2 + extents.x_bearing)
@@ -82,7 +82,7 @@ module Demo
end
def y_position(i, radius)
- 0.5 + Math.sin(Math::PI * i / SPIKES) * radius + rand * Y_FUZZ
+ 0.5 + Math.sin(Math::PI * i / SPIKES) * radius + rand * Y_FUZZ
end
end
end
diff --git a/gtk3/sample/gtk-demo/cairo-self-intersect.rb b/gtk3/sample/gtk-demo/cairo-self-intersect.rb
index 172949d..c8e6566 100644
--- a/gtk3/sample/gtk-demo/cairo-self-intersect.rb
+++ b/gtk3/sample/gtk-demo/cairo-self-intersect.rb
@@ -19,10 +19,10 @@ module Demo
def draw(cr)
cr.move_to(0.3, 0.3)
cr.line_to(0.7, 0.3)
-
+
cr.line_to(0.5, 0.3)
cr.line_to(0.5, 0.7)
-
+
cr.set_line_width(0.22)
cr.set_line_cap(Cairo::LINE_CAP_ROUND)
cr.set_line_join(Cairo::LINE_JOIN_ROUND)
diff --git a/gtk3/sample/gtk-demo/cairo-text-align-center.rb b/gtk3/sample/gtk-demo/cairo-text-align-center.rb
index ead78f1..672d6ab 100644
--- a/gtk3/sample/gtk-demo/cairo-text-align-center.rb
+++ b/gtk3/sample/gtk-demo/cairo-text-align-center.rb
@@ -13,7 +13,7 @@ require 'common'
module Demo
class CairoTextAlignCenter < CairoWindow
TEXT = "Ruby"
-
+
def initialize
super('cairo text align center')
end
@@ -22,15 +22,15 @@ module Demo
cr.select_font_face("Sans",
Cairo::FONT_SLANT_NORMAL,
Cairo::FONT_WEIGHT_NORMAL)
-
+
cr.set_font_size(0.2)
extents = cr.text_extents(TEXT)
x = 0.5 - (extents.width / 2 + extents.x_bearing)
y = 0.5 - (extents.height / 2 + extents.y_bearing)
-
+
cr.move_to(x, y)
cr.show_text(TEXT)
-
+
# draw helping lines
cr.set_source_rgba(1, 0.2, 0.2, 0.6)
cr.arc(x, y, 0.05, 0, 2 * Math::PI)
diff --git a/gtk3/sample/gtk-demo/cairo-text-extents.rb b/gtk3/sample/gtk-demo/cairo-text-extents.rb
index e2a6b4b..648df7b 100644
--- a/gtk3/sample/gtk-demo/cairo-text-extents.rb
+++ b/gtk3/sample/gtk-demo/cairo-text-extents.rb
@@ -13,7 +13,7 @@ require 'common'
module Demo
class CairoTextExtents < CairoWindow
TEXT = "Ruby"
-
+
def initialize
super('cairo text')
end
@@ -22,16 +22,16 @@ module Demo
cr.select_font_face("Sans",
Cairo::FONT_SLANT_NORMAL,
Cairo::FONT_WEIGHT_NORMAL)
-
+
cr.set_font_size(0.3)
extents = cr.text_extents(TEXT)
-
+
x = 0.1
y = 0.6
-
+
cr.move_to(x, y)
cr.show_text(TEXT)
-
+
# draw helping lines
cr.set_source_rgba(1, 0.2, 0.2, 0.6)
cr.arc(x, y, 0.05, 0, 2 * Math::PI)
diff --git a/gtk3/sample/gtk-demo/cairo-text.rb b/gtk3/sample/gtk-demo/cairo-text.rb
index 69e7abe..15d3e62 100644
--- a/gtk3/sample/gtk-demo/cairo-text.rb
+++ b/gtk3/sample/gtk-demo/cairo-text.rb
@@ -21,10 +21,10 @@ module Demo
Cairo::FONT_SLANT_NORMAL,
Cairo::FONT_WEIGHT_BOLD)
cr.set_font_size(0.35)
-
+
cr.move_to(0.04, 0.53)
cr.show_text("Hello")
-
+
cr.move_to(0.27, 0.65)
cr.text_path("void")
cr.set_source_rgba(0.5, 0.5, 1)
@@ -32,7 +32,7 @@ module Demo
cr.set_source_rgba(0, 0, 0)
cr.set_line_width(0.01)
cr.stroke
-
+
# draw helping lines
cr.set_source_rgba(1,0.2,0.2, 0.6)
cr.arc(0.04, 0.53, 0.02, 0, 2 * Math::PI)
diff --git a/gtk3/sample/gtk-demo/common.rb b/gtk3/sample/gtk-demo/common.rb
index d9607d7..94a71b2 100644
--- a/gtk3/sample/gtk-demo/common.rb
+++ b/gtk3/sample/gtk-demo/common.rb
@@ -49,7 +49,6 @@ module Demo
end
class CairoWindow < BasicWindow
-
def initialize(title=nil)
super
diff --git a/gtk3/sample/gtk-demo/dialog.rb b/gtk3/sample/gtk-demo/dialog.rb
index 9c8a526..3abcd76 100644
--- a/gtk3/sample/gtk-demo/dialog.rb
+++ b/gtk3/sample/gtk-demo/dialog.rb
@@ -14,23 +14,23 @@ module Demo
class Dialog < Demo::BasicWindow
def initialize
@count = 1
-
+
super('Dialogs')
set_border_width(8)
-
+
frame = Gtk::Frame.new('Dialogs')
add(frame)
-
+
vbox = Gtk::VBox.new(false, 8)
vbox.set_border_width(8)
frame.add(vbox)
-
+
# Standard message dialog
hbox = Gtk::Box.new(:horizontal, 0)
vbox.pack_start(hbox, :expand => false, :fill => false, :padding => 0)
button = Gtk::Button.new('_Message Dialog', true)
button.signal_connect('clicked') do
- message_dialog_clicked
+ message_dialog_clicked
end
hbox.pack_start(button, :expand => false, :fill => false, :padding => 0)
@@ -43,7 +43,7 @@ module Demo
button = Gtk::Button.new('_Interactive Dialog')
button.signal_connect('clicked') do
- interactive_dialog_clicked
+ interactive_dialog_clicked
end
hbox.pack_start(vbox2, :expand => false, :fill => false, :padding => 0)
vbox2.pack_start(button, :expand => false, :fill => false, :padding => 0)
@@ -71,11 +71,11 @@ module Demo
def message_dialog_clicked
dialog = Gtk::MessageDialog.new(self,
- Gtk::Dialog::MODAL |
- Gtk::Dialog::DESTROY_WITH_PARENT,
- Gtk::MessageDialog::INFO,
- Gtk::MessageDialog::BUTTONS_OK,
- <<EOS)
+ Gtk::Dialog::MODAL |
+ Gtk::Dialog::DESTROY_WITH_PARENT,
+ Gtk::MessageDialog::INFO,
+ Gtk::MessageDialog::BUTTONS_OK,
+ <<EOS)
This message box has been popped up the following
number of times:
@@ -88,12 +88,12 @@ EOS
def interactive_dialog_clicked
dialog = Gtk::Dialog.new('Interactive Dialog',
- self,
- Gtk::Dialog::MODAL |
- Gtk::Dialog::DESTROY_WITH_PARENT,
- [Gtk::Stock::OK, Gtk::Dialog::RESPONSE_OK],
- ["_Non-stock Button", Gtk::Dialog::RESPONSE_CANCEL]
- )
+ self,
+ Gtk::Dialog::MODAL |
+ Gtk::Dialog::DESTROY_WITH_PARENT,
+ [Gtk::Stock::OK, Gtk::Dialog::RESPONSE_OK],
+ ["_Non-stock Button", Gtk::Dialog::RESPONSE_CANCEL]
+ )
hbox = Gtk::Box.new(:horizontal, 0)
hbox.set_border_width(8)
@@ -108,7 +108,7 @@ EOS
hbox.pack_start(table, :expand => true, :fill => true, :padding => 0)
label = Gtk::Label.new('_Entry 1', true)
table.attach_defaults(label,
- 0, 1, 0, 1)
+ 0, 1, 0, 1)
local_entry1 = Gtk::Entry.new
local_entry1.text = @entry1.text
table.attach_defaults(local_entry1, 1, 2, 0, 1)
@@ -116,7 +116,7 @@ EOS
label = Gtk::Label.new('E_ntry 2', true)
table.attach_defaults(label,
- 0, 1, 1, 2)
+ 0, 1, 1, 2)
local_entry2 = Gtk::Entry.new
local_entry2.text = @entry2.text
@@ -125,10 +125,10 @@ EOS
hbox.show_all
response = dialog.run
-
- if response == Gtk::Dialog::RESPONSE_OK
- @entry1.text = local_entry1.text
- @entry2.text = local_entry2.text
+
+ if response == Gtk::Dialog::RESPONSE_OK
+ @entry1.text = local_entry1.text
+ @entry2.text = local_entry2.text
end
dialog.destroy
end
diff --git a/gtk3/sample/gtk-demo/drawingarea.rb b/gtk3/sample/gtk-demo/drawingarea.rb
index 0e70b65..fc021da 100644
--- a/gtk3/sample/gtk-demo/drawingarea.rb
+++ b/gtk3/sample/gtk-demo/drawingarea.rb
@@ -93,7 +93,11 @@ module Demo
# Create a new surface of the appropriate size to store our scribbles
def scribble_configure_event(widget)
- @cairo_context = widget.window.create_cairo_context
+ allocation = widget.allocation
+ surface = widget.window.create_similar_surface(:color,
+ allocation.width,
+ allocation.height)
+ @cairo_context = Cairo::Context.new(surface)
@cairo_context.set_source_rgb(1, 1, 1)
@cairo_context.paint
diff --git a/gtk3/sample/gtk-demo/editable_cells.rb b/gtk3/sample/gtk-demo/editable_cells.rb
index fde199a..3179531 100644
--- a/gtk3/sample/gtk-demo/editable_cells.rb
+++ b/gtk3/sample/gtk-demo/editable_cells.rb
@@ -24,7 +24,7 @@ module Demo
add(vbox)
vbox.pack_start(Gtk::Label.new('Shopping list (you can edit the cells!)'),
- :expand => false, :fill => false, :padding => 0)
+ :expand => false, :fill => false, :padding => 0)
sw = Gtk::ScrolledWindow.new
sw.shadow_type = Gtk::SHADOW_ETCHED_IN
@@ -50,13 +50,13 @@ module Demo
button = Gtk::Button.new('Add item')
button.signal_connect('clicked') do
- add_item(model)
+ add_item(model)
end
hbox.pack_start(button, :expand => true, :fill => true, :padding => 0)
button = Gtk::Button.new('Remove item')
button.signal_connect('clicked') do
- remove_item(treeview)
+ remove_item(treeview)
end
hbox.pack_start(button, :expand => true, :fill => true, :padding => 0)
@@ -74,11 +74,11 @@ module Demo
# add items
@articles.each do |article|
- iter = model.append
+ iter = model.append
- article.each_with_index do |value, index|
- iter.set_value(index, value)
- end
+ article.each_with_index do |value, index|
+ iter.set_value(index, value)
+ end
end
return model
end
@@ -106,30 +106,30 @@ module Demo
# number column
renderer = Gtk::CellRendererText.new
renderer.signal_connect('edited') do |*args|
- cell_edited(*args.push(model))
+ cell_edited(*args.push(model))
end
treeview.insert_column(-1, 'Number', renderer,
- {
- :text => COLUMN_NUMBER,
- :editable => COLUMN_EDITABLE,
- })
+ {
+ :text => COLUMN_NUMBER,
+ :editable => COLUMN_EDITABLE,
+ })
def renderer.column
- COLUMN_NUMBER
+ COLUMN_NUMBER
end
# product column
renderer = Gtk::CellRendererText.new
renderer.signal_connect('edited') do |*args|
- cell_edited(*args.push(model))
+ cell_edited(*args.push(model))
end
def renderer.column
- COLUMN_PRODUCT
+ COLUMN_PRODUCT
end
treeview.insert_column(-1, 'Product', renderer,
- {
- :text => COLUMN_PRODUCT,
- :editable => COLUMN_EDITABLE,
- })
+ {
+ :text => COLUMN_PRODUCT,
+ :editable => COLUMN_EDITABLE,
+ })
end
def cell_edited(cell, path_string, new_text, model)
@@ -140,13 +140,13 @@ module Demo
iter = model.get_iter(path)
case column
when COLUMN_NUMBER
- i = iter.path.indices[0]
- @articles[i].number = new_text.to_i
- iter.set_value(column, @articles[i].number)
+ i = iter.path.indices[0]
+ @articles[i].number = new_text.to_i
+ iter.set_value(column, @articles[i].number)
when COLUMN_PRODUCT
- i = iter.path.indices[0]
- @articles[i].product = new_text
- iter.set_value(column, @articles[i].product)
+ i = iter.path.indices[0]
+ @articles[i].product = new_text
+ iter.set_value(column, @articles[i].product)
end
end
@@ -156,7 +156,7 @@ module Demo
iter = model.append
foo.each_with_index do |value, index|
- iter.set_value(index, value)
+ iter.set_value(index, value)
end
end
@@ -165,8 +165,8 @@ module Demo
selection = treeview.selection
if iter = selection.selected
- @articles.delete_at(iter.path.indices[0])
- model.remove(iter)
+ @articles.delete_at(iter.path.indices[0])
+ model.remove(iter)
end
end
end
diff --git a/gtk3/sample/gtk-demo/entry_completion.rb b/gtk3/sample/gtk-demo/entry_completion.rb
index 66fe4cf..0522664 100644
--- a/gtk3/sample/gtk-demo/entry_completion.rb
+++ b/gtk3/sample/gtk-demo/entry_completion.rb
@@ -14,9 +14,9 @@ module Demo
class EntryCompletion < Gtk::Dialog
def initialize
super('GtkEntryCompletion',
- nil, # parent
- 0,
- [Gtk::Stock::CLOSE, Gtk::Dialog::RESPONSE_NONE])
+ nil, # parent
+ 0,
+ [Gtk::Stock::CLOSE, Gtk::Dialog::RESPONSE_NONE])
self.resizable = false
diff --git a/gtk3/sample/gtk-demo/images.rb b/gtk3/sample/gtk-demo/images.rb
index b5f0ced..6110772 100644
--- a/gtk3/sample/gtk-demo/images.rb
+++ b/gtk3/sample/gtk-demo/images.rb
@@ -27,9 +27,9 @@ module Demo
super('Images')
signal_connect('destroy') do
- cleanup_callback
+ cleanup_callback
end
-
+
self.border_width = 8
vbox = Gtk::VBox.new(false, 8)
@@ -39,10 +39,10 @@ module Demo
label = Gtk::Label.new
label.set_markup('<u>Image loaded from a file</u>')
vbox.pack_start(label, :expand => false, :fill => false, :padding => 0)
-
+
frame = Gtk::Frame.new
frame.shadow_type = :in
-
+
# The alignment keeps the frame from growing when users resize
# the window
align = Gtk::Alignment.new(0.5, 0.5, 0, 0)
@@ -54,26 +54,26 @@ module Demo
# in the location where the file is installed.
pixbuf = nil
begin
- filename = Demo.find_file('gtk-logo-rgb.gif')
- pixbuf = Gdk::Pixbuf.new(filename)
+ filename = Demo.find_file('gtk-logo-rgb.gif')
+ pixbuf = Gdk::Pixbuf.new(filename)
rescue
- # This code shows off error handling. You can just use
- # Gtk::Image.new instead if you don't want to report
- # errors to the user. If the file doesn't load when using
- # Gtk::Image.new, a 'missing image' icon will
- # be displayed instead.
- dialog = Gtk::MessageDialog.new(self,
- Gtk::Dialog::DESTROY_WITH_PARENT,
- Gtk::MessageDialog::ERROR,
- Gtk::MessageDialog::BUTTONS_CLOSE,
- "Unable to open image file 'gtk-logo-rgb.gif': #{$1}")
-
- dialog.signal_connect('response') do |widget, data|
- widget.destroy
- end
- dialog.show
+ # This code shows off error handling. You can just use
+ # Gtk::Image.new instead if you don't want to report
+ # errors to the user. If the file doesn't load when using
+ # Gtk::Image.new, a 'missing image' icon will
+ # be displayed instead.
+ dialog = Gtk::MessageDialog.new(self,
+ Gtk::Dialog::DESTROY_WITH_PARENT,
+ Gtk::MessageDialog::ERROR,
+ Gtk::MessageDialog::BUTTONS_CLOSE,
+ "Unable to open image file 'gtk-logo-rgb.gif': #{$1}")
+
+ dialog.signal_connect('response') do |widget, data|
+ widget.destroy
+ end
+ dialog.show
end
-
+
image = Gtk::Image.new(pixbuf)
frame.add(image)
@@ -82,10 +82,10 @@ module Demo
label = Gtk::Label.new
label.set_markup('<u>Animation loaded from a file</u>')
vbox.pack_start(label, :expand => false, :fill => false, :padding => 0)
-
+
frame = Gtk::Frame.new
frame.shadow_type = :in
-
+
# The alignment keeps the frame from growing when users resize
# the window
align = Gtk::Alignment.new(0.5, 0.5, 0, 0)
@@ -95,16 +95,16 @@ module Demo
filename = Demo.find_file('floppybuddy.gif')
image = Gtk::Image.new(filename)
frame.add(image)
-
+
# Progressive
label = Gtk::Label.new
label.set_markup('<u>Progressive image loading</u>')
vbox.pack_start(label, :expand => false, :fill => false, :padding => 0)
-
+
frame = Gtk::Frame.new(nil)
frame.shadow_type = :in
-
+
# The alignment keeps the frame from growing when users resize
# the window
align = Gtk::Alignment.new(0.5, 0.5, 0, 0)
@@ -123,65 +123,65 @@ module Demo
vbox.pack_start(button, :expand => false, :fill => false, :padding => 0)
button.signal_connect('toggled') do |widget|
- vbox.children.each do |widget|
- if widget != button
- widget.sensitive = ! button.active?
- end
- end
+ vbox.children.each do |widget|
+ if widget != button
+ widget.sensitive = ! button.active?
+ end
+ end
end
end
def start_progressive_loading(image)
@load_timeout = Gtk.timeout_add(150) do
- progressive_timeout(image)
+ progressive_timeout(image)
end
end
def progressive_timeout(image)
if @image_stream
- buf = @image_stream.read(256)
-
- @pixbuf_loader.write(buf)
-
- if @image_stream.eof?
- @image_stream.close
- @image_stream = nil
-
- @pixbuf_loader.close
- @pixbuf_loader = nil
- end
+ buf = @image_stream.read(256)
+
+ @pixbuf_loader.write(buf)
+
+ if @image_stream.eof?
+ @image_stream.close
+ @image_stream = nil
+
+ @pixbuf_loader.close
+ @pixbuf_loader = nil
+ end
else
- filename = Demo.find_file('alphatest.png')
- @image_stream = File.open(filename, 'rb')
-
- if @pixbuf_loader != nil
- @pixbuf_loader.close
- @pixbuf_loader = nil
- end
-
- @pixbuf_loader = Gdk::PixbufLoader.new
-
- @pixbuf_loader.signal_connect('area_prepared') do |loader|
- pixbuf = loader.pixbuf
-
- # Avoid displaying random memory contents, since the pixbuf
- # isn't filled in yet.
- pixbuf.fill!(0xaaaaaaff)
-
- image.pixbuf = pixbuf
- end
-
- @pixbuf_loader.signal_connect('area_updated') do
- # We know the pixbuf inside the Gtk::Image has changed, but the image
- # itself doesn't know this; so queue a redraw. If we wanted to be
- # really efficient, we could use a drawing area or something
- # instead of a Gtk::Image, so we could control the exact position of
- # the pixbuf on the display, then we could queue a draw for only
- # the updated area of the image.
- image.queue_draw
- end
+ filename = Demo.find_file('alphatest.png')
+ @image_stream = File.open(filename, 'rb')
+
+ if @pixbuf_loader != nil
+ @pixbuf_loader.close
+ @pixbuf_loader = nil
+ end
+
+ @pixbuf_loader = Gdk::PixbufLoader.new
+
+ @pixbuf_loader.signal_connect('area_prepared') do |loader|
+ pixbuf = loader.pixbuf
+
+ # Avoid displaying random memory contents, since the pixbuf
+ # isn't filled in yet.
+ pixbuf.fill!(0xaaaaaaff)
+
+ image.pixbuf = pixbuf
+ end
+
+ @pixbuf_loader.signal_connect('area_updated') do
+ # We know the pixbuf inside the Gtk::Image has changed, but the image
+ # itself doesn't know this; so queue a redraw. If we wanted to be
+ # really efficient, we could use a drawing area or something
+ # instead of a Gtk::Image, so we could control the exact position of
+ # the pixbuf on the display, then we could queue a draw for only
+ # the updated area of the image.
+ image.queue_draw
+ end
end
-
+
# leave timeout installed
return true
end
@@ -190,7 +190,7 @@ module Demo
@pixbuf_loader.close if @pixbuf_loader
@pixbuf_loader = nil
if @load_timeout != 0
- Gtk.timeout_remove(@load_timeout)
+ Gtk.timeout_remove(@load_timeout)
end
end
end
diff --git a/gtk3/sample/gtk-demo/item_factory.rb b/gtk3/sample/gtk-demo/item_factory.rb
index cf3a9ed..4802d09 100644
--- a/gtk3/sample/gtk-demo/item_factory.rb
+++ b/gtk3/sample/gtk-demo/item_factory.rb
@@ -14,55 +14,55 @@ module Demo
class ItemFactory < BasicWindow
def initialize
super('Item Factory')
-
+
accel_group = Gtk::AccelGroup.new
item_factory = Gtk::ItemFactory.new(Gtk::ItemFactory::TYPE_MENU_BAR,
- '<main>', accel_group)
-
+ '<main>', accel_group)
+
add_accel_group(accel_group)
set_border_width(0)
ifactory_cb = proc do |data, widget|
- puts "ItemFactory: activated \"#{Gtk::ItemFactory.path_from_widget(widget)}\""
+ puts "ItemFactory: activated \"#{Gtk::ItemFactory.path_from_widget(widget)}\""
end
menu_items = [
- ['/_File'],
- ['/File/tearoff1',
- '<Tearoff>', nil, nil, ifactory_cb],
- ['/File/_New',
- '<Item>', '<control>N', nil, ifactory_cb],
- ['/File/_Open',
- '<Item>', '<control>O', nil, ifactory_cb],
- ['/File/_Save',
- '<Item>', '<control>S', nil, ifactory_cb],
- ['/File/Save _As...',
- '<Item>', nil, nil, ifactory_cb],
- ['/File/sep1', '<Separator>'],
- ['/File/_Quit',
- '<Item>', '<control>Q', nil, ifactory_cb],
-
- ['/_Preferences'],
- ['/_Preferences/_Color'],
- [ '/_Preferences/Color/_Red',
- '<RadioItem>', nil, nil, ifactory_cb],
- ['/_Preferences/Color/_Green',
- '/Preferences/Color/Red', nil, nil, ifactory_cb],
- ['/_Preferences/Color/_Blue',
- '/Preferences/Color/Red', nil, nil, ifactory_cb],
- ['/_Preferences/_Shape'],
- ['/_Preferences/Shape/_Square',
- '<RadioItem>', nil, nil, ifactory_cb],
- [ '/_Preferences/Shape/_Rectangle',
- '/Preferences/Shape/Square', nil, nil, ifactory_cb],
- [ '/_Preferences/Shape/_Oval',
- '/Preferences/Shape/Rectangle', nil, nil, ifactory_cb],
-
- [ '/_Help', '<LastBranch>'],
- [ '/Help/_About', '<Item>', nil, nil, ifactory_cb],
+ ['/_File'],
+ ['/File/tearoff1',
+ '<Tearoff>', nil, nil, ifactory_cb],
+ ['/File/_New',
+ '<Item>', '<control>N', nil, ifactory_cb],
+ ['/File/_Open',
+ '<Item>', '<control>O', nil, ifactory_cb],
+ ['/File/_Save',
+ '<Item>', '<control>S', nil, ifactory_cb],
+ ['/File/Save _As...',
+ '<Item>', nil, nil, ifactory_cb],
+ ['/File/sep1', '<Separator>'],
+ ['/File/_Quit',
+ '<Item>', '<control>Q', nil, ifactory_cb],
+
+ ['/_Preferences'],
+ ['/_Preferences/_Color'],
+ [ '/_Preferences/Color/_Red',
+ '<RadioItem>', nil, nil, ifactory_cb],
+ ['/_Preferences/Color/_Green',
+ '/Preferences/Color/Red', nil, nil, ifactory_cb],
+ ['/_Preferences/Color/_Blue',
+ '/Preferences/Color/Red', nil, nil, ifactory_cb],
+ ['/_Preferences/_Shape'],
+ ['/_Preferences/Shape/_Square',
+ '<RadioItem>', nil, nil, ifactory_cb],
+ [ '/_Preferences/Shape/_Rectangle',
+ '/Preferences/Shape/Square', nil, nil, ifactory_cb],
+ [ '/_Preferences/Shape/_Oval',
+ '/Preferences/Shape/Rectangle', nil, nil, ifactory_cb],
+
+ [ '/_Help', '<LastBranch>'],
+ [ '/Help/_About', '<Item>', nil, nil, ifactory_cb],
]
item_factory.create_items(menu_items)
item_factory.get_item('/Preferences/Shape/Oval').set_active(true)
-
+
box1 = Gtk::VBox.new(false, 0)
add(box1)
@@ -76,7 +76,7 @@ module Demo
separator = Gtk::HSeparator.new
box1.pack_start(separator)
-
+
box2 = Gtk::VBox.new(false, 10)
box2.set_border_width(10)
box1.pack_start(box2, :expand => false, :fill => true, :padding => 0)
@@ -84,7 +84,7 @@ module Demo
button = Gtk::Button.new('close')
# TODO: Need signal_connect_swapped?
button.signal_connect('clicked') do
- quit
+ quit
end
box2.pack_start(button, :expand => true, :fill => true, :padding => 0)
button.set_flags(Gtk::Widget::CAN_DEFAULT)
diff --git a/gtk3/sample/gtk-demo/list_store.rb b/gtk3/sample/gtk-demo/list_store.rb
index 0febc58..cc4b69f 100644
--- a/gtk3/sample/gtk-demo/list_store.rb
+++ b/gtk3/sample/gtk-demo/list_store.rb
@@ -72,10 +72,10 @@ module Demo
# add data to the list store
DATA.each do |bug|
- iter = store.append
- bug.each_with_index do |value, index|
- iter[index] = value
- end
+ iter = store.append
+ bug.each_with_index do |value, index|
+ iter[index] = value
+ end
end
return store
end
@@ -84,12 +84,12 @@ module Demo
# column for fixed toggles
renderer = Gtk::CellRendererToggle.new
renderer.signal_connect('toggled') do |cell, path|
- fixed_toggled(treeview.model, path)
+ fixed_toggled(treeview.model, path)
end
column = Gtk::TreeViewColumn.new('Fixed?',
- renderer,
- 'active' => COLUMN_FIXED)
+ renderer,
+ 'active' => COLUMN_FIXED)
# set this column to a fixed sizing (of 50 pixels)
column.sizing = Gtk::TreeViewColumn::FIXED
@@ -99,24 +99,24 @@ module Demo
# column for bug numbers
renderer = Gtk::CellRendererText.new
column = Gtk::TreeViewColumn.new('Bug number',
- renderer,
- 'text' => COLUMN_NUMBER)
+ renderer,
+ 'text' => COLUMN_NUMBER)
column.set_sort_column_id(COLUMN_NUMBER)
treeview.append_column(column)
# column for severities
renderer = Gtk::CellRendererText.new
column = Gtk::TreeViewColumn.new('Severity',
- renderer,
- 'text' => COLUMN_SEVERITY)
+ renderer,
+ 'text' => COLUMN_SEVERITY)
column.set_sort_column_id(COLUMN_SEVERITY)
treeview.append_column(column)
# column for description
renderer = Gtk::CellRendererText.new
column = Gtk::TreeViewColumn.new('Description',
- renderer,
- 'text' => COLUMN_DESCRIPTION)
+ renderer,
+ 'text' => COLUMN_DESCRIPTION)
column.set_sort_column_id(COLUMN_DESCRIPTION)
treeview.append_column(column)
end
diff --git a/gtk3/sample/gtk-demo/menus.rb b/gtk3/sample/gtk-demo/menus.rb
index 008b047..e6ac53b 100644
--- a/gtk3/sample/gtk-demo/menus.rb
+++ b/gtk3/sample/gtk-demo/menus.rb
@@ -83,31 +83,31 @@ module Demo
menu.append(menuitem)
menuitem.show
menuitem.add_accelerator('activate',
- accel_group,
- Gdk::Keyval::GDK_F1,
- 0,
- Gtk::ACCEL_VISIBLE)
+ accel_group,
+ Gdk::Keyval::GDK_F1,
+ 0,
+ Gtk::ACCEL_VISIBLE)
menuitem = Gtk::CheckMenuItem.new('Accelerator Locked')
menu.append(menuitem)
menuitem.show
menuitem.add_accelerator('activate',
- accel_group,
- Gdk::Keyval::GDK_F2,
- 0,
- Gtk::ACCEL_VISIBLE | Gtk::ACCEL_LOCKED)
+ accel_group,
+ Gdk::Keyval::GDK_F2,
+ 0,
+ Gtk::ACCEL_VISIBLE | Gtk::ACCEL_LOCKED)
menuitem = Gtk::CheckMenuItem.new('Accelerators Frozen')
menu.append(menuitem)
menuitem.show
menuitem.add_accelerator('activate',
- accel_group,
- Gdk::Keyval::GDK_F2,
- 0,
- Gtk::ACCEL_VISIBLE)
+ accel_group,
+ Gdk::Keyval::GDK_F2,
+ 0,
+ Gtk::ACCEL_VISIBLE)
menuitem.add_accelerator('activate',
- accel_group,
- Gdk::Keyval::GDK_F3,
- 0,
- Gtk::ACCEL_VISIBLE)
+ accel_group,
+ Gdk::Keyval::GDK_F3,
+ 0,
+ Gtk::ACCEL_VISIBLE)
optionmenu = Gtk::OptionMenu.new
optionmenu.menu = menu
@@ -126,7 +126,7 @@ module Demo
button = Gtk::Button.new('close')
button.signal_connect('clicked') do
- quit
+ quit
end
box2.pack_start(button, :expand => true, :fill => true, :padding => 0)
button.flags = Gtk::Widget::CAN_DEFAULT
@@ -137,32 +137,32 @@ module Demo
def create_menu (depth, tearoff)
if depth < 1
- return nil
+ return nil
end
menu = Gtk::Menu.new
group = nil
if tearoff
- menuitem = Gtk::TearoffMenuItem.new
- menu.append(menuitem)
- menuitem.show
+ menuitem = Gtk::TearoffMenuItem.new
+ menu.append(menuitem)
+ menuitem.show
end
5.times do |i|
- buf = sprintf('item %2d - %d', depth, i + 1)
- menuitem = Gtk::RadioMenuItem.new(buf)
- group = menuitem.group
-
- menu.append(menuitem)
- menuitem.show
- if i == 3
- menuitem.sensitive = false
- end
-
- if submenu = create_menu(depth - 1, true)
- menuitem.submenu = submenu
- end
+ buf = sprintf('item %2d - %d', depth, i + 1)
+ menuitem = Gtk::RadioMenuItem.new(buf)
+ group = menuitem.group
+
+ menu.append(menuitem)
+ menuitem.show
+ if i == 3
+ menuitem.sensitive = false
+ end
+
+ if submenu = create_menu(depth - 1, true)
+ menuitem.submenu = submenu
+ end
end
menu.show
diff --git a/gtk3/sample/gtk-demo/panes.rb b/gtk3/sample/gtk-demo/panes.rb
index b0c0e74..16f01dd 100644
--- a/gtk3/sample/gtk-demo/panes.rb
+++ b/gtk3/sample/gtk-demo/panes.rb
@@ -54,12 +54,12 @@ module Demo
# Now create toggle buttons to control sizing
vbox.pack_start(create_pane_options(hpaned,
- 'Horizontal', 'Left', 'Right'),
- :expand => false, :fill => false, :padding => 0)
+ 'Horizontal', 'Left', 'Right'),
+ :expand => false, :fill => false, :padding => 0)
vbox.pack_start(create_pane_options(vpaned,
- 'Vertical', 'Top', 'Bottom'),
- :expand => false, :fill => false, :padding => 0)
+ 'Vertical', 'Top', 'Bottom'),
+ :expand => false, :fill => false, :padding => 0)
end
def create_pane_options(paned, frame_label, label1, label2)
@@ -75,14 +75,14 @@ module Demo
check_button = Gtk::CheckButton.new('_Resize', true)
table.attach_defaults(check_button, 0, 1, 1, 2)
check_button.signal_connect('toggled') do
- toggle_resize(paned.child1)
+ toggle_resize(paned.child1)
end
check_button = Gtk::CheckButton.new('_Shrink', true)
table.attach_defaults(check_button, 0, 1, 2, 3)
check_button.active = true
check_button.signal_connect('toggled') do
- toggle_shrink(paned.child1)
+ toggle_shrink(paned.child1)
end
label = Gtk::Label.new(label2)
@@ -92,14 +92,14 @@ module Demo
table.attach_defaults(check_button, 1, 2, 1, 2)
check_button.active = true
check_button.signal_connect('toggled') do
- toggle_resize(paned.child2)
+ toggle_resize(paned.child2)
end
check_button = Gtk::CheckButton.new('_Shrink')
table.attach_defaults(check_button, 1, 2, 2, 3)
check_button.active = true
check_button.signal_connect('toggled') do
- toggle_shrink(paned.child2)
+ toggle_shrink(paned.child2)
end
return frame
@@ -110,22 +110,22 @@ module Demo
is_child1 = (child == paned.child1)
resize = if is_child1
- paned.child1_resize?
- else
- paned.child2_resize?
- end
+ paned.child1_resize?
+ else
+ paned.child2_resize?
+ end
shrink = if is_child1
- paned.child1_shrink?
- else
- paned.child2_shrink?
- end
+ paned.child1_shrink?
+ else
+ paned.child2_shrink?
+ end
child.parent.remove(child)
if is_child1
- paned.pack1(child, !resize, shrink)
+ paned.pack1(child, !resize, shrink)
else
- paned.pack2(child, !resize, shrink)
+ paned.pack2(child, !resize, shrink)
end
end
@@ -134,22 +134,22 @@ module Demo
is_child1 = (child == paned.child1)
resize = if is_child1
- paned.child1_resize?
- else
- paned.child2_resize?
- end
+ paned.child1_resize?
+ else
+ paned.child2_resize?
+ end
shrink = if is_child1
- paned.child1_shrink?
- else
- paned.child2_shrink?
- end
+ paned.child1_shrink?
+ else
+ paned.child2_shrink?
+ end
child.parent.remove(child)
if is_child1
- paned.pack1(child, resize, !shrink)
+ paned.pack1(child, resize, !shrink)
else
- paned.pack2(child, resize, !shrink)
+ paned.pack2(child, resize, !shrink)
end
end
end
diff --git a/gtk3/sample/gtk-demo/rotated_text.rb b/gtk3/sample/gtk-demo/rotated_text.rb
index 64a4d80..01b2d23 100644
--- a/gtk3/sample/gtk-demo/rotated_text.rb
+++ b/gtk3/sample/gtk-demo/rotated_text.rb
@@ -1,17 +1,13 @@
-# Copyright (c) 2005 Ruby-GNOME2 Project Team
+# Copyright (c) 2005-2014 Ruby-GNOME2 Project Team
# This program is licenced under the same licence as Ruby-GNOME2.
#
# $Id: rotated_text.rb,v 1.2 2005/03/05 15:01:16 mutoh Exp $
=begin
= Rotated Text
-This demo shows how to use GDK and Pango to draw rotated and transformed text.
-The use of Gdk::PangoRenderer in this example is a somewhat advanced technique; most applications can simply use Gdk::Drawable#draw_layout.
-We use it here mostly because that allows us to work in user coordinates - that is, coordinates prior to the application of the transformation matrix, rather than device coordinates.
-As of GTK+-2.6, the ability to draw transformed and anti-aliased graphics as shown in this example is only present for text.
-With GTK+-2.8, a new graphics system called "Cairo" will be introduced that provides these capabilities and many more for all types of graphics.
+This demo shows how to use Cairo and Pango to draw rotated and transformed text.
=end
-require 'common'
+require "common"
module Demo
class RotatedText < BasicWindow
@@ -20,64 +16,56 @@ module Demo
FONT = "Sans Bold 27"
def initialize
- super('Rotated Text')
-
- unless Gtk.check_version?(2, 6, 0)
- add(Gtk::Label.new("This sample requires GTK+ 2.6.0 or later"))
- return
- end
+ super("Rotated Text")
drawing_area = Gtk::DrawingArea.new
add(drawing_area)
- drawing_area.modify_bg(Gtk::STATE_NORMAL, Gdk::Color.new(65535, 65535, 65535))
+ drawing_area.override_background_color(:normal, Gdk::RGBA.new(1.0,
+ 1.0,
+ 1.0,
+ 0.0))
- drawing_area.signal_connect("expose_event") do
- matrix = Pango::Matrix.new
+ drawing_area.signal_connect("draw") do |_drawing_area, cairo_context|
+ cairo_context.set_source_rgb(1.0, 1.0, 1.0)
+ cairo_context.paint
+ cairo_context.save do
+ width, height = size
+ cairo_context.scale(width.to_f / (RADIUS * 2),
+ height.to_f / (RADIUS * 2))
+ draw_text(cairo_context)
+ end
+ end
+ end
- # Get the default renderer for the screen, and set it up for drawing
- renderer = Gdk::PangoRenderer.get_default(drawing_area.screen)
- renderer.drawable = drawing_area.window
- renderer.gc = style.black_gc
- width = drawing_area.allocation.width
- height = drawing_area.allocation.height
+ private
+ def draw_text(cairo_context)
+ # Center coordinates on the middle of the region we are drawing
+ cairo_context.translate(RADIUS, RADIUS)
- # Set up a transformation matrix so that the user space coordinates for
- # the centered square where we draw are [-RADIUS, RADIUS], [-RADIUS, RADIUS]
- # We first center, then change the scale
- device_radius = [width, height].min / 2.0
+ # Create a PangoLayout, set the font and text
+ layout = cairo_context.create_pango_layout
- matrix.translate!(device_radius + (width - 2 * device_radius) / 2.0,
- device_radius + (height - 2 * device_radius) / 2.0)
- matrix.scale!(device_radius / RADIUS, device_radius / RADIUS)
+ layout.text = "Text"
+ layout.font_description = Pango::FontDescription.new(FONT)
- # Create a PangoLayout, set the font and text
- context = Gdk::Pango.context
- layout = Pango::Layout.new(context)
- layout.text = "Text"
- layout.font_description = Pango::FontDescription.new(FONT)
+ # Draw the layout N_WORDS times in a circle
+ N_WORDS.times do |i|
+ angle = (360.0 * i) / N_WORDS
- # Draw the layout N_WORDS times in a circle
- (0...N_WORDS).each do |i|
- rotated_matrix = matrix.dup
- angle = 360 * i / N_WORDS.to_f
+ cairo_context.save do
+ # Gradient from red at angle == 60 to blue at angle == 240
+ red = (1 + Math.cos((angle - 60) * Math::PI / 180.0)) / 2
+ cairo_context.set_source_rgb(red, 0.0, 1.0 - red)
- # Gradient from red at angle == 60 to blue at angle == 300
- red = 65535 * (1 + Math.cos((angle - 60) * Math::PI / 180.0)) / 2
- color = Gdk::Color.new(red, 0, 65535 - red)
- renderer.set_override_color(Pango::Renderer::PART_FOREGROUND, color)
+ cairo_context.rotate(angle * Math::PI / 180.0)
- rotated_matrix.rotate!(angle)
- context.matrix = rotated_matrix
+ # Inform Pango to re-layout the text with the new transformation
+ cairo_context.update_pango_layout(layout)
- # Inform Pango to re-layout the text with the new transformation matrix
- layout.context_changed
- width, height = layout.size
- renderer.draw_layout(layout, - width / 2, - RADIUS * Pango::SCALE)
- end
- # Clean up default renderer, since it is shared
- renderer.set_override_color(Gdk::PangoRenderer::PART_FOREGROUND, nil)
- renderer.drawable = nil
- renderer.gc = nil
+ width, height = layout.size
+ cairo_context.move_to(-(width / Pango::SCALE) / 2, -RADIUS)
+ cairo_context.show_pango_layout(layout)
+ end
end
end
end
diff --git a/gtk3/sample/gtk-demo/sizegroup.rb b/gtk3/sample/gtk-demo/sizegroup.rb
index 28cb66f..6f0e6d3 100644
--- a/gtk3/sample/gtk-demo/sizegroup.rb
+++ b/gtk3/sample/gtk-demo/sizegroup.rb
@@ -23,7 +23,7 @@ module Demo
class SizeGroup < Gtk::Dialog
def initialize
super('GtkSizeGroup', nil, 0,
- [Gtk::Stock::CLOSE, Gtk::Dialog::RESPONSE_NONE])
+ [Gtk::Stock::CLOSE, Gtk::Dialog::RESPONSE_NONE])
color_options = %w(Red Green Blue)
dash_options = %w(Solid Dashed Dotted)
@@ -32,7 +32,7 @@ module Demo
set_resizable(false)
signal_connect('response') do
- destroy
+ destroy
end
vbox = Gtk::VBox.new(false, 5)
@@ -73,12 +73,12 @@ module Demo
check_button.set_active(true)
check_button.signal_connect('toggled', size_group) do |check_button, size_group|
- new_mode = if check_button.active?
- Gtk::SizeGroup::HORIZONTAL
- else
- Gtk::SizeGroup::VERTICAL
- end
- size_group.set_mode(new_mode)
+ new_mode = if check_button.active?
+ Gtk::SizeGroup::HORIZONTAL
+ else
+ Gtk::SizeGroup::VERTICAL
+ end
+ size_group.set_mode(new_mode)
end
end
@@ -86,27 +86,27 @@ module Demo
label = Gtk::Label.new(label_text, true)
label.set_alignment(0, 1)
table.attach(label,
- 0, 1, row, row + 1,
- Gtk::EXPAND | Gtk::FILL, 0,
- 0, 0)
+ 0, 1, row, row + 1,
+ Gtk::EXPAND | Gtk::FILL, 0,
+ 0, 0)
option_menu = create_option_menu(options)
label.set_mnemonic_widget(option_menu)
size_group.add_widget(option_menu)
table.attach(option_menu,
- 1, 2, row, row + 1,
- 0, 0,
- 0, 0)
+ 1, 2, row, row + 1,
+ 0, 0,
+ 0, 0)
end
def create_option_menu(strings)
menu = Gtk::Menu.new
strings.each do |str|
- menu_item = Gtk::MenuItem.new(str)
- menu_item.show
+ menu_item = Gtk::MenuItem.new(str)
+ menu_item.show
- menu.append(menu_item)
+ menu.append(menu_item)
end
option_menu = Gtk::OptionMenu.new
diff --git a/gtk3/sample/gtk-demo/spinner.rb b/gtk3/sample/gtk-demo/spinner.rb
index a019c03..1a4452e 100644
--- a/gtk3/sample/gtk-demo/spinner.rb
+++ b/gtk3/sample/gtk-demo/spinner.rb
@@ -20,7 +20,7 @@ module Demo
signal_connect(:destroy) {self.destroy}
self.resizable = false
-
+
vbox = Gtk::Box.new :vertical, 5
self.content_area.pack_start vbox, :expand => true, :fill => true, :padding => 0
diff --git a/gtk3/sample/gtk-demo/textview.rb b/gtk3/sample/gtk-demo/textview.rb
index 13f08d2..07ce061 100644
--- a/gtk3/sample/gtk-demo/textview.rb
+++ b/gtk3/sample/gtk-demo/textview.rb
@@ -6,9 +6,9 @@
=begin
= Text Widget/Multiple Views
-The Gtk::TextView widget displays a Gtk::TextBuffer.
-One Gtk::TextBuffer can be displayed by multiple Gtk::TextViews.
-This demo has two views displaying a single buffer,
+The Gtk::TextView widget displays a Gtk::TextBuffer.
+One Gtk::TextBuffer can be displayed by multiple Gtk::TextViews.
+This demo has two views displaying a single buffer,
and shows off the widget's text formatting features.
=end
require 'common'
@@ -25,11 +25,11 @@ module Demo
super("TextView Window")
set_default_size(450, 450)
-
+
set_title("TextView")
set_border_width(0)
- vpaned = Gtk::VPaned.new
+ vpaned = Gtk::VPaned.new
vpaned.set_border_width(5)
add(vpaned)
##
@@ -37,21 +37,21 @@ module Demo
# the first text view; you could also create the buffer
# by itself with Gtk::TextBuffer.new, then later create
# a view widget.
- #
+ #
view1 = Gtk::TextView.new
buffer = view1.buffer
view2 = Gtk::TextView.new(buffer)
-
+
sw = Gtk::ScrolledWindow.new(nil, nil)
sw.set_policy(:automatic,
- :automatic)
+ :automatic)
vpaned.add1(sw)
sw.add(view1)
sw = Gtk::ScrolledWindow.new(nil, nil)
sw.set_policy(:automatic,
- :automatic)
+ :automatic)
vpaned.add2(sw)
sw.add(view2)
@@ -61,8 +61,8 @@ module Demo
attach_widgets(view1)
attach_widgets(view2)
-
- vpaned.show_all
+
+ vpaned.show_all
self.show
end
@@ -75,108 +75,108 @@ module Demo
# just a convenience function. Also note that you don't have
# to give tags a name; pass NULL for the name to create an
# anonymous tag.
- #
+ #
# In any real app, another useful optimization would be to create
# a Gtk::TextTagTable in advance, and reuse the same tag table for
# all the buffers with the same tag set, instead of creating
# new copies of the same tags for every buffer.
- #
+ #
# Tags are assigned default priorities in order of addition to the
- # tag table. That is, tags created later that affect the same text
+ # tag table. That is, tags created later that affect the same text
# property affected by an earlier tag will override the earlier
# tag. You can modify tag priorities with
# Gtk::TextTag#set_priority.
#
buffer.create_tag('heading',
- 'weight' => Pango::FontDescription::WEIGHT_BOLD,
- 'size' => 15 * Pango::SCALE)
-
+ 'weight' => Pango::FontDescription::WEIGHT_BOLD,
+ 'size' => 15 * Pango::SCALE)
+
buffer.create_tag("italic",
- "style" => Pango::FontDescription::STYLE_ITALIC)
+ "style" => Pango::FontDescription::STYLE_ITALIC)
buffer.create_tag("bold",
- "weight" => Pango::FontDescription::WEIGHT_BOLD)
-
+ "weight" => Pango::FontDescription::WEIGHT_BOLD)
+
buffer.create_tag("big",
- # points times the PANGO_SCALE factor
- "size" => 20 * Pango::SCALE)
+ # points times the PANGO_SCALE factor
+ "size" => 20 * Pango::SCALE)
buffer.create_tag("xx-small",
- "scale" => Pango::AttrScale::XX_SMALL)
+ "scale" => Pango::AttrScale::XX_SMALL)
buffer.create_tag("x-large",
- "scale" => Pango::AttrScale::X_LARGE)
-
+ "scale" => Pango::AttrScale::X_LARGE)
+
buffer.create_tag("monospace", "family" => "monospace")
-
+
buffer.create_tag("blue_foreground", "foreground" => "blue")
buffer.create_tag("red_background", "background" => "red")
stipple = Gdk::Pixmap.create_from_data(nil, GRAY50_BITS, GRAY50_WIDTH,
- GRAY50_HEIGHT)
-
+ GRAY50_HEIGHT)
+
buffer.create_tag("background_stipple",
- "background_stipple" => stipple)
+ "background_stipple" => stipple)
buffer.create_tag("foreground_stipple",
- "foreground_stipple" => stipple)
+ "foreground_stipple" => stipple)
buffer.create_tag("big_gap_before_line",
- "pixels_above_lines" => 30)
+ "pixels_above_lines" => 30)
buffer.create_tag("big_gap_after_line",
- "pixels_below_lines" => 30)
+ "pixels_below_lines" => 30)
buffer.create_tag("double_spaced_line",
- "pixels_inside_wrap" => 10)
+ "pixels_inside_wrap" => 10)
buffer.create_tag("not_editable",
- "editable" => false)
-
+ "editable" => false)
+
buffer.create_tag("word_wrap",
- "wrap_mode" => :word)
+ "wrap_mode" => :word)
buffer.create_tag("char_wrap",
- "wrap_mode" => Gtk::TextTag::WRAP_CHAR)
+ "wrap_mode" => Gtk::TextTag::WRAP_CHAR)
buffer.create_tag("no_wrap",
- "wrap_mode" => :none)
-
+ "wrap_mode" => :none)
+
buffer.create_tag("center",
- "justification" => Gtk::JUSTIFY_CENTER)
+ "justification" => Gtk::JUSTIFY_CENTER)
buffer.create_tag("right_justify",
- "justification" => Gtk::JUSTIFY_RIGHT)
+ "justification" => Gtk::JUSTIFY_RIGHT)
buffer.create_tag("wide_margins",
- "left_margin" => 50,
- "right_margin" => 50)
-
+ "left_margin" => 50,
+ "right_margin" => 50)
+
buffer.create_tag("strikethrough",
- "strikethrough" => true)
-
+ "strikethrough" => true)
+
buffer.create_tag("underline",
- "underline" => Pango::AttrUnderline::SINGLE)
+ "underline" => Pango::AttrUnderline::SINGLE)
buffer.create_tag("double_underline",
- "underline" => Pango::AttrUnderline::DOUBLE)
+ "underline" => Pango::AttrUnderline::DOUBLE)
buffer.create_tag("superscript",
- "rise" => 10 * Pango::SCALE, # 10 pixels
- "size" => 8 * Pango::SCALE) # 8 points
-
+ "rise" => 10 * Pango::SCALE, # 10 pixels
+ "size" => 8 * Pango::SCALE) # 8 points
+
buffer.create_tag("subscript",
- "rise" => -10 * Pango::SCALE, # 10 pixels
- "size" => 8 * Pango::SCALE) # 8 points
+ "rise" => -10 * Pango::SCALE, # 10 pixels
+ "size" => 8 * Pango::SCALE) # 8 points
buffer.create_tag("rtl_quote",
- "wrap_mode" => :word,
- "direction" => Gtk::Widget::TEXT_DIR_RTL,
- "indent" => 30,
- "left_margin" => 20,
- "right_margin" => 20)
+ "wrap_mode" => :word,
+ "direction" => Gtk::Widget::TEXT_DIR_RTL,
+ "indent" => 30,
+ "left_margin" => 20,
+ "right_margin" => 20)
end
def insert_text(buffer)
@@ -185,14 +185,14 @@ module Demo
# Demo.find_file looks in the the current directory first,
# so you can run gtk-demo without installing GTK, then looks
# in the location where the file is installed.
- #
+ #
filename = Demo.find_file("gtk-logo-rgb.gif")
pixbuf = Gdk::Pixbuf.new(filename) if filename
unless pixbuf
- $stderr.print "Failed to load image file gtk-logo-rgb.gif\n"
- exit 1
+ $stderr.print "Failed to load image file gtk-logo-rgb.gif\n"
+ exit 1
end
scaled = pixbuf.scale(32, 32, Gdk::Pixbuf::INTERP_BILINEAR)
@@ -201,14 +201,14 @@ module Demo
##
# get start of buffer; each insertion will revalidate the
# iterator to point to just after the inserted text.
- #
+ #
iter = buffer.get_iter_at(:offset => 0)
buffer.insert(iter, "The text widget can display text with all kinds of nifty attributes. It also supports multiple views of the same buffer; this demo is showing the same buffer in two places.\n\n")
buffer.insert(iter, "Font styles. ", 'heading')
-
+
buffer.insert(iter, "For example, you can have ")
buffer.insert(iter, "italic", "italic")
buffer.insert(iter, ", ")
@@ -223,25 +223,25 @@ module Demo
buffer.insert(iter, " or ")
buffer.insert(iter, "x-large", "x-large")
buffer.insert(iter, " to ensure that your program properly adapts if the user changes the default font size.\n\n")
-
+
buffer.insert(iter, "Colors. ", "heading")
-
+
buffer.insert(iter, "Colors such as ")
buffer.insert(iter, "a blue foreground", "blue_foreground")
buffer.insert(iter, " or ")
buffer.insert(iter, "a red background", "red_background")
buffer.insert(iter, " or even ")
buffer.insert(iter, "a stippled red background",
- "red_background", "background_stipple")
+ "red_background", "background_stipple")
buffer.insert(iter, " or ")
buffer.insert(iter, "a stippled blue foreground on solid red background",
- "blue_foreground", "red_background", "foreground_stipple")
+ "blue_foreground", "red_background", "foreground_stipple")
buffer.insert(iter, "(select that to read it) can be used.\n\n")
buffer.insert(iter, "Underline, strikethrough, and rise. ", "heading")
-
+
buffer.insert(iter, "Strikethrough", "strikethrough")
buffer.insert(iter, ", ")
buffer.insert(iter, "underline", "underline")
@@ -254,7 +254,7 @@ module Demo
buffer.insert(iter, " are all supported.\n\n")
buffer.insert(iter, "Images. ", "heading")
-
+
buffer.insert(iter, "The buffer can have images in it: ")
buffer.insert(iter, pixbuf)
buffer.insert(iter, pixbuf)
@@ -264,46 +264,46 @@ module Demo
buffer.insert(iter, "Spacing. ", "heading")
buffer.insert(iter, "You can adjust the amount of space before each line.\n")
-
+
buffer.insert(iter, "This line has a whole lot of space before it.\n",
- "big_gap_before_line", "wide_margins")
+ "big_gap_before_line", "wide_margins")
buffer.insert(iter, "You can also adjust the amount of space after each line; this line has a whole lot of space after it.\n",
- "big_gap_after_line", "wide_margins")
-
+ "big_gap_after_line", "wide_margins")
+
buffer.insert(iter, "You can also adjust the amount of space between wrapped lines; this line has extra space between each wrapped line in the same paragraph. To show off wrapping, some filler text: the quick brown fox jumped over the lazy dog. Blah blah blah blah blah blah blah blah blah.\n",
- "double_spaced_line", "wide_margins")
+ "double_spaced_line", "wide_margins")
buffer.insert(iter, "Also note that those lines have extra-wide margins.\n\n")
buffer.insert(iter, "Editability. ", "heading")
-
+
buffer.insert(iter, "This line is 'locked down' and can't be edited by the user - just try it! You can't delete this line.\n\n",
- "not_editable")
+ "not_editable")
buffer.insert(iter, "Wrapping. ", "heading")
buffer.insert(iter, "This line(and most of the others in this buffer) is word-wrapped, using the proper Unicode algorithm. Word wrap should work in all scripts and languages that GTK+ supports. Let's make this a long paragraph to demonstrate: blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah\n\n")
-
+
buffer.insert(iter, "This line has character-based wrapping, and can wrap between any two character glyphs. Let's make this a long paragraph to demonstrate: blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah\n\n", "char_wrap")
-
+
buffer.insert(iter, "This line has all wrapping turned off, so it makes the horizontal scrollbar appear.\n\n\n", "no_wrap")
buffer.insert(iter, "Justification. ", "heading")
-
+
buffer.insert(iter, "\nThis line has center justification.\n", "center")
buffer.insert(iter, "This line has right justification.\n",
- "right_justify")
+ "right_justify")
buffer.insert(iter, "\nThis line has big wide margins. Text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text.\n", "wide_margins")
buffer.insert(iter, "Internationalization. ", "heading")
- buffer.insert(iter, "You can put all sorts of Unicode text in the buffer.\n\nGerman(Deutsch Süd) Grüß Gott\nGreek(Ελληνικά) Γειά σας\nHebrew שלום\nJapanese(日本語)\n\nThe widget properly handles bidirectional text, word wrapping, DOS/UNIX/Unicode paragraph separators, grapheme boundaries, and so on using the Pango internationalization framework.\n")
+ buffer.insert(iter, "You can put all sorts of Unicode text in the buffer.\n\nGerman(Deutsch Süd) Grüß Gott\nGreek(Ελληνικά) Γειά σας\nHebrew שלום\nJapanese(日本語)\n\nThe widget properly handles bidirectional text, word wrapping, DOS/UNIX/Unicode paragraph separators, grapheme boundaries, and so on using the Pango internationalization framework.\n")
buffer.insert(iter, "Here's a word-wrapped quote in a right-to-left language:\n")
buffer.insert(iter, "??? ??? ???? ?? ???? ???????? ????? ?? ???? ?????? ??????? ??????? ?? ???? ?????? ?? ????? ?? ??????? ????? ??????? ??? ?????? ????? ?????? ????? ???? ?? ?????? ?????? ?? ???????? ?????? ????? ?? ???? ???? ????????? ???????. ???? ???? ??? ???????? ????? ?? »????????« ?? ???????.\n\n", "rtl_quote")
-
+
buffer.insert(iter, "You can put widgets in the buffer: Here's a button: ")
anchor = buffer.create_child_anchor(iter)
buffer.insert(iter, " and a menu: ")
@@ -315,10 +315,10 @@ module Demo
buffer.insert(iter, " finally a text entry: ")
anchor = buffer.create_child_anchor(iter)
buffer.insert(iter, ".\n")
-
+
buffer.insert(iter, "\n\nThis demo doesn't demonstrate all the Gtk::TextBuffer features; it leaves out, for example: invisible/hidden text(doesn't work in GTK 2, but planned), tab stops, application-drawn areas on the sides of the widget for displaying breakpoints and such...")
- # Apply word_wrap tag to whole buffer
+ # Apply word_wrap tag to whole buffer
buf_start, buf_end = buffer.bounds
buffer.apply_tag("word_wrap", buf_start, buf_end)
@@ -332,47 +332,47 @@ module Demo
end
def attach_widgets(text_view)
-
+
buffer = text_view.buffer;
iter = buffer.start_iter
i = 0;
while find_anchor(iter) do
- anchor = iter.child_anchor
-
- if i == 0
- widget = Gtk::Button.new("Click Me")
- widget.signal_connect('clicked') { |button|
- if @@nest_window and ! @@nest_window.destroyed?
- @@nest_window.present
- break
- end
-
- buffer = Gtk::TextBuffer.new
- iter = buffer.start_iter
-
- buffer.insert(iter, "This buffer is shared by a set of nested text views.\n Nested view:\n")
- anchor = buffer.create_child_anchor(iter)
- buffer.insert(iter, "\nDon't do this in real applications, please.\n")
-
- view = Gtk::TextView.new(buffer)
-
- recursive_attach_view(0, view, anchor)
-
- @@nest_window = Gtk::Window.new(Gtk::Window::TOPLEVEL)
- sw = Gtk::ScrolledWindow.new(nil, nil)
- sw.set_policy(:automatic,
- :automatic)
-
- @@nest_window.add(sw)
- sw.add(view)
-
- @@nest_window.set_default_size(300, 400)
- @@nest_window.show_all
- }
- elsif i == 1
- menu = Gtk::Menu.new
+ anchor = iter.child_anchor
+
+ if i == 0
+ widget = Gtk::Button.new("Click Me")
+ widget.signal_connect('clicked') { |button|
+ if @@nest_window and ! @@nest_window.destroyed?
+ @@nest_window.present
+ break
+ end
+
+ buffer = Gtk::TextBuffer.new
+ iter = buffer.start_iter
+
+ buffer.insert(iter, "This buffer is shared by a set of nested text views.\n Nested view:\n")
+ anchor = buffer.create_child_anchor(iter)
+ buffer.insert(iter, "\nDon't do this in real applications, please.\n")
+
+ view = Gtk::TextView.new(buffer)
+
+ recursive_attach_view(0, view, anchor)
+
+ @@nest_window = Gtk::Window.new(Gtk::Window::TOPLEVEL)
+ sw = Gtk::ScrolledWindow.new(nil, nil)
+ sw.set_policy(:automatic,
+ :automatic)
+
+ @@nest_window.add(sw)
+ sw.add(view)
+
+ @@nest_window.set_default_size(300, 400)
+ @@nest_window.show_all
+ }
+ elsif i == 1
+ menu = Gtk::Menu.new
widget = Gtk::OptionMenu.new
menu_item = Gtk::MenuItem.new("Option 1")
@@ -382,30 +382,30 @@ module Demo
menu_item = Gtk::MenuItem.new("Option 3")
menu.append(menu_item)
- widget.menu = menu
+ widget.menu = menu
- elsif i == 2
- widget = Gtk::HScale.new
+ elsif i == 2
+ widget = Gtk::HScale.new
widget.set_range(0, 100)
widget.set_size_request(70, -1)
- elsif i == 3
- filename = Demo.find_file("floppybuddy.gif")
- widget = Gtk::Image.new(filename)
+ elsif i == 3
+ filename = Demo.find_file("floppybuddy.gif")
+ widget = Gtk::Image.new(filename)
- elsif i == 4
+ elsif i == 4
widget = Gtk::Entry.new
- else
- #widget = nil; avoids a compiler warning
- #g_assert_not_reached ;
- end
+ else
+ #widget = nil; avoids a compiler warning
+ #g_assert_not_reached ;
+ end
- text_view.add_child_at_anchor(widget,
- anchor)
+ text_view.add_child_at_anchor(widget,
+ anchor)
- widget.show_all
- i += 1
+ widget.show_all
+ i += 1
end
end
@@ -415,17 +415,17 @@ module Demo
child_view = Gtk::TextView.new(view.buffer)
- # Event box is to add a black border around each child view
+ # Event box is to add a black border around each child view
event_box = Gtk::EventBox.new
color = Gdk::Color.parse("black")
event_box.modify_bg(Gtk::STATE_NORMAL, color)
align = Gtk::Alignment.new(0.5, 0.5, 1.0, 1.0)
align.set_border_width(1)
-
+
event_box.add(align)
align.add(child_view)
-
+
view.add_child_at_anchor(event_box, anchor)
recursive_attach_view(depth + 1, child_view, anchor)
diff --git a/gtk3/sample/gtk-demo/theming.ui b/gtk3/sample/gtk-demo/theming.ui
new file mode 100644
index 0000000..728b1d1
--- /dev/null
+++ b/gtk3/sample/gtk-demo/theming.ui
@@ -0,0 +1,319 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <object class="GtkGrid" id="grid">
+ <property name="row-spacing">6</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkToolbar" id="toolbar1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="show-arrow">False</property>
+ <style>
+ <class name="primary-toolbar"/>
+ </style>
+ <child>
+ <object class="GtkToggleToolButton" id="toolbutton1">
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="use_action_appearance">False</property>
+ <property name="label" translatable="yes">Normal</property>
+ <property name="use_underline">True</property>
+ <property name="is_important">True</property>
+ <property name="icon_name">edit-find</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="homogeneous">True</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkToggleToolButton" id="toolbutton2">
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="use_action_appearance">False</property>
+ <property name="label" translatable="yes">Active</property>
+ <property name="use_underline">True</property>
+ <property name="is_important">True</property>
+ <property name="icon_name">edit-find</property>
+ <property name="active">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="homogeneous">True</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkToggleToolButton" id="toolbutton3">
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="sensitive">False</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Insensitive</property>
+ <property name="use_underline">True</property>
+ <property name="is_important">True</property>
+ <property name="icon_name">edit-find</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="homogeneous">True</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkToggleToolButton" id="toolbutton5">
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Raised</property>
+ <property name="use_underline">True</property>
+ <property name="is_important">True</property>
+ <property name="icon_name">edit-find-symbolic</property>
+ <style>
+ <class name="raised"/>
+ </style>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="homogeneous">True</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkToggleToolButton" id="toolbutton6">
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Raised Active</property>
+ <property name="use_underline">True</property>
+ <property name="is_important">True</property>
+ <property name="icon_name">edit-find-symbolic</property>
+ <property name="active">True</property>
+ <style>
+ <class name="raised"/>
+ </style>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="homogeneous">True</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkToggleToolButton" id="toolbutton4">
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="sensitive">False</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Insensitive Active</property>
+ <property name="use_underline">True</property>
+ <property name="icon_name">edit-find</property>
+ <property name="is_important">True</property>
+ <property name="active">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="homogeneous">True</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkToolItem" id="toolitementry">
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkEntry" id="entry1">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">•</property>
+ <property name="placeholder-text" translatable="yes">Search...</property>
+ <property name="secondary-icon-name">edit-find-symbolic</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkToolItem" id="toolitemswitch">
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkSwitch" id="switch1">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkBox" id="box1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="orientation">horizontal</property>
+ <property name="valign">center</property>
+ <property name="halign">center</property>
+ <style>
+ <class name="linked"/>
+ </style>
+ <child>
+ <object class="GtkButton" id="button1">
+ <property name="label" translatable="yes">Hi, I am a button</property>
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_action_appearance">False</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button2">
+ <property name="label" translatable="yes">And I'm another button</property>
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_action_appearance">False</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button3">
+ <property name="label" translatable="yes">This is a button party!</property>
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_action_appearance">False</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkToolbar" id="itoolbar1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="icon_size">1</property>
+ <style>
+ <class name="inline-toolbar"/>
+ </style>
+ <child>
+ <object class="GtkToggleToolButton" id="itoolbutton1">
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="use_action_appearance">False</property>
+ <property name="label" translatable="yes">Normal</property>
+ <property name="use_underline">True</property>
+ <property name="icon_name">list-add-symbolic</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="homogeneous">True</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkToggleToolButton" id="itoolbutton2">
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="use_action_appearance">False</property>
+ <property name="label" translatable="yes">Normal</property>
+ <property name="use_underline">True</property>
+ <property name="icon_name">list-add-symbolic</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="homogeneous">True</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkToggleToolButton" id="itoolbutton3">
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="use_action_appearance">False</property>
+ <property name="label" translatable="yes">Active</property>
+ <property name="use_underline">True</property>
+ <property name="icon_name">list-remove-symbolic</property>
+ <property name="active">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="homogeneous">True</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkToggleToolButton" id="itoolbutton4">
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="use_action_appearance">False</property>
+ <property name="label" translatable="yes">Active</property>
+ <property name="use_underline">True</property>
+ <property name="icon_name">list-remove-symbolic</property>
+ <property name="active">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="homogeneous">True</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkToggleToolButton" id="itoolbutton5">
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="sensitive">False</property>
+ <property name="can_focus">False</property>
+ <property name="use_action_appearance">False</property>
+ <property name="label" translatable="yes">Insensitive</property>
+ <property name="use_underline">True</property>
+ <property name="icon_name">edit-find-symbolic</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="homogeneous">True</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkToggleToolButton" id="itoolbutton6">
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="sensitive">False</property>
+ <property name="can_focus">False</property>
+ <property name="use_action_appearance">False</property>
+ <property name="label" translatable="yes">Insensitive Active</property>
+ <property name="use_underline">True</property>
+ <property name="icon_name">go-up-symbolic</property>
+ <property name="active">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="homogeneous">True</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+</interface>
diff --git a/gtk3/sample/gtk-demo/theming_style_classes.rb b/gtk3/sample/gtk-demo/theming_style_classes.rb
new file mode 100644
index 0000000..c955bf4
--- /dev/null
+++ b/gtk3/sample/gtk-demo/theming_style_classes.rb
@@ -0,0 +1,48 @@
+#
+# This sample code is a port of gtk3/demos/gtk-demo/theming_style_classes.c.
+# The UI file used in this sample code is copied from gtk3/demos/gtk-demo.
+# This is licensed under the terms of the GNU Lesser General Public
+# License, version 2.1 or (at your option) later.
+#
+# Copyright (C) 2014 Ruby-GNOME2 Project Team
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+=begin
+= CSS Theming/Style Classes
+
+GTK+ uses CSS for theming. Style classes can be associated
+with widgets to inform the theme about intended rendering.
+
+This demo shows some common examples where theming features
+of GTK+ are used for certain effects: primary toolbars,
+inline toolbars and linked buttons.
+=end
+
+require "common"
+
+module Demo
+ class ThemingStyleClasses < BasicWindow
+ def initialize
+ super("Style Claases")
+ self.border_width = 12
+
+ builder = Gtk::Builder.new
+ builder.add("theming.ui")
+
+ grid = builder.get_object("grid")
+ add(grid)
+ end
+ end
+end
diff --git a/gtk3/sample/gtk-demo/tree_store.rb b/gtk3/sample/gtk-demo/tree_store.rb
index a956eb8..1e2f7d8 100644
--- a/gtk3/sample/gtk-demo/tree_store.rb
+++ b/gtk3/sample/gtk-demo/tree_store.rb
@@ -17,9 +17,9 @@ module Demo
class TreeStore < BasicWindow
# TreeItem structure
TreeItem = Struct.new('TreeItem',
- :label,
- :alex, :havoc, :tim, :owen, :dave,
- :world_holiday) # shared by the European hackers
+ :label,
+ :alex, :havoc, :tim, :owen, :dave,
+ :world_holiday) # shared by the European hackers
# columns
(
@@ -39,98 +39,98 @@ module Demo
# tree data
TOPLEVEL = [
['January',
- [
- ["New Years Day", true, true, true, true, false, true],
- ["Presidential Inauguration", false, true, false, true, false, false],
- ["Martin Luther King Jr. day", false, true, false, true, false, false],
- ]
+ [
+ ["New Years Day", true, true, true, true, false, true],
+ ["Presidential Inauguration", false, true, false, true, false, false],
+ ["Martin Luther King Jr. day", false, true, false, true, false, false],
+ ]
],
['February',
- [
- ["Presidents' Day", false, true, false, true, false, false],
- ["Groundhog Day", false, false, false, false, false, false],
- ["Valentine's Day", false, false, false, false, true, true],
- ]
+ [
+ ["Presidents' Day", false, true, false, true, false, false],
+ ["Groundhog Day", false, false, false, false, false, false],
+ ["Valentine's Day", false, false, false, false, true, true],
+ ]
],
['March',
- [
- ["National Tree Planting Day", false, false, false, false, false, false],
- [ "St Patrick's Day", false, false, false, false, false, true],
- ]
+ [
+ ["National Tree Planting Day", false, false, false, false, false, false],
+ [ "St Patrick's Day", false, false, false, false, false, true],
+ ]
],
['April',
- [
- [ "April Fools' Day", false, false, false, false, false, true ],
- [ "Army Day", false, false, false, false, false, false ],
- [ "Earth Day", false, false, false, false, false, true ],
- [ "Administrative Professionals' Day", false, false, false, false, false, false ],
- ]],
+ [
+ [ "April Fools' Day", false, false, false, false, false, true ],
+ [ "Army Day", false, false, false, false, false, false ],
+ [ "Earth Day", false, false, false, false, false, true ],
+ [ "Administrative Professionals' Day", false, false, false, false, false, false ],
+ ]],
['May',
- [
- [ "Nurses' Day", false, false, false, false, false, false ],
- [ "National Day of Prayer", false, false, false, false, false, false ],
- [ "Mothers' Day", false, false, false, false, false, true ],
- [ "Armed Forces Day", false, false, false, false, false, false ],
- [ "Memorial Day", true, true, true, true, false, true ],
-
- ]
+ [
+ [ "Nurses' Day", false, false, false, false, false, false ],
+ [ "National Day of Prayer", false, false, false, false, false, false ],
+ [ "Mothers' Day", false, false, false, false, false, true ],
+ [ "Armed Forces Day", false, false, false, false, false, false ],
+ [ "Memorial Day", true, true, true, true, false, true ],
+
+ ]
],
['June',
- [
- [ "June Fathers' Day", false, false, false, false, false, true ],
- [ "Juneteenth (Liberation of Slaves)", false, false, false, false, false, false ],
- [ "Flag Day", false, true, false, true, false, false ],
- ]
+ [
+ [ "June Fathers' Day", false, false, false, false, false, true ],
+ [ "Juneteenth (Liberation of Slaves)", false, false, false, false, false, false ],
+ [ "Flag Day", false, true, false, true, false, false ],
+ ]
],
['July',
- [
- [ "Parents' Day", false, false, false, false, false, true ],
- [ "Independence Day", false, true, false, true, false, false ],
- ]
+ [
+ [ "Parents' Day", false, false, false, false, false, true ],
+ [ "Independence Day", false, true, false, true, false, false ],
+ ]
],
['August',
- [
- [ "Air Force Day", false, false, false, false, false, false ],
- [ "Coast Guard Day", false, false, false, false, false, false ],
- [ "Friendship Day", false, false, false, false, false, false ],
- ]
+ [
+ [ "Air Force Day", false, false, false, false, false, false ],
+ [ "Coast Guard Day", false, false, false, false, false, false ],
+ [ "Friendship Day", false, false, false, false, false, false ],
+ ]
],
['September',
- [
- [ "Grandparents' Day", false, false, false, false, false, true ],
- [ "Citizenship Day or Constitution Day", false, false, false, false, false, false ],
- [ "Labor Day", true, true, true, true, false, true ],
- ]
+ [
+ [ "Grandparents' Day", false, false, false, false, false, true ],
+ [ "Citizenship Day or Constitution Day", false, false, false, false, false, false ],
+ [ "Labor Day", true, true, true, true, false, true ],
+ ]
],
['October',
- [
- [ "National Children's Day", false, false, false, false, false, false ],
- [ "Bosses' Day", false, false, false, false, false, false ],
- [ "Sweetest Day", false, false, false, false, false, false ],
- [ "Mother-in-Law's Day", false, false, false, false, false, false ],
- [ "Navy Day", false, false, false, false, false, false ],
- [ "Columbus Day", false, true, false, true, false, false ],
- [ "Halloween", false, false, false, false, false, true ],
- ]
+ [
+ [ "National Children's Day", false, false, false, false, false, false ],
+ [ "Bosses' Day", false, false, false, false, false, false ],
+ [ "Sweetest Day", false, false, false, false, false, false ],
+ [ "Mother-in-Law's Day", false, false, false, false, false, false ],
+ [ "Navy Day", false, false, false, false, false, false ],
+ [ "Columbus Day", false, true, false, true, false, false ],
+ [ "Halloween", false, false, false, false, false, true ],
+ ]
],
['November',
- [
- [ "Marine Corps Day", false, false, false, false, false, false ],
- [ "Veterans' Day", true, true, true, true, false, true ],
- [ "Thanksgiving", false, true, false, true, false, false ],
- ]
+ [
+ [ "Marine Corps Day", false, false, false, false, false, false ],
+ [ "Veterans' Day", true, true, true, true, false, true ],
+ [ "Thanksgiving", false, true, false, true, false, false ],
+ ]
],
['December',
- [
- [ 'Pearl Harbor Remembrance Day', false, false, false, false, false, false ],
- [ 'Christmas', true, true, true, true, false, true ],
- [ 'Kwanzaa', false, false, false, false, false, false ],
- ]
+ [
+ [ 'Pearl Harbor Remembrance Day', false, false, false, false, false, false ],
+ [ 'Christmas', true, true, true, true, false, true ],
+ [ 'Kwanzaa', false, false, false, false, false, false ],
+ ]
],
].collect do |month_name, holidays|
[
- month_name,
- holidays.collect do |args| TreeItem.new(args) end,
+ month_name,
+ holidays.collect do |args| TreeItem.new(args) end,
]
end
@@ -143,12 +143,12 @@ module Demo
add(vbox)
vbox.pack_start(Gtk::Label.new("Jonathan's Holiday Card Planning Sheet"),
- :expand => false, :fill => false, :padding => 0)
+ :expand => false, :fill => false, :padding => 0)
sw = Gtk::ScrolledWindow.new(nil, nil)
sw.shadow_type = Gtk::SHADOW_ETCHED_IN
sw.set_policy(:automatic,
- :automatic)
+ :automatic)
vbox.pack_start(sw, :expand => true, :fill => true, :padding => 0)
# create model
@@ -165,7 +165,7 @@ module Demo
# expand all rows after the treeview widget has been realized
treeview.signal_connect('realize') do
- treeview.expand_all
+ treeview.expand_all
end
set_default_size(650, 400)
end
@@ -173,33 +173,33 @@ module Demo
def create_model
# create tree store
model = Gtk::TreeStore.new(String,
- TrueClass,
- TrueClass,
- TrueClass,
- TrueClass,
- TrueClass,
- TrueClass,
- TrueClass)
+ TrueClass,
+ TrueClass,
+ TrueClass,
+ TrueClass,
+ TrueClass,
+ TrueClass,
+ TrueClass)
# add data to the tree store
TOPLEVEL.each do |month_name, holidays|
- iter = model.append(nil)
-
- iter[HOLIDAY_NAME_COLUMN] = month_name
- (ALEX_COLUMN..DAVE_COLUMN).each do |index|
- iter[index] = false
- end
-
- # add children
- holidays.each do |holiday|
- child_iter = model.append(iter)
- child_iter[HOLIDAY_NAME_COLUMN] = holiday.label[0]
- %w(alex havoc tim owen dave).each_with_index do |person, i|
- child_iter[ALEX_COLUMN + i] = holiday[person]
- end
- child_iter[VISIBLE_COLUMN] = true
- child_iter[WORLD_COLUMN] = holiday.world_holiday
- end
+ iter = model.append(nil)
+
+ iter[HOLIDAY_NAME_COLUMN] = month_name
+ (ALEX_COLUMN..DAVE_COLUMN).each do |index|
+ iter[index] = false
+ end
+
+ # add children
+ holidays.each do |holiday|
+ child_iter = model.append(iter)
+ child_iter[HOLIDAY_NAME_COLUMN] = holiday.label[0]
+ %w(alex havoc tim owen dave).each_with_index do |person, i|
+ child_iter[ALEX_COLUMN + i] = holiday[person]
+ end
+ child_iter[VISIBLE_COLUMN] = true
+ child_iter[WORLD_COLUMN] = holiday.world_holiday
+ end
end
@@ -214,40 +214,40 @@ module Demo
renderer.xalign = 0.0
col_offset = treeview.insert_column(-1, 'Holiday',
- renderer,
- 'text' => HOLIDAY_NAME_COLUMN)
+ renderer,
+ 'text' => HOLIDAY_NAME_COLUMN)
column = treeview.get_column(col_offset - 1)
column.clickable = true
[
- ['Alex', true ],
- ['Havoc', false],
- ['Tim', true ],
- ['Owen', false],
- ['Dave', false],
+ ['Alex', true ],
+ ['Havoc', false],
+ ['Tim', true ],
+ ['Owen', false],
+ ['Dave', false],
].each_with_index do |args, i|
- person, european = *args
- renderer = Gtk::CellRendererToggle.new
- renderer.xalign = 0.0
- eval(%Q[def renderer.column; #{ALEX_COLUMN + i}; end])
-
- renderer.signal_connect('toggled') do |cell, path|
- item_toggled(cell, path, model)
- end
-
- attributes = {
- 'active' => (ALEX_COLUMN + i),
- 'visible' => VISIBLE_COLUMN,
- }
- if european
- attributes['activatable'] = WORLD_COLUMN
- end
- col_offset = treeview.insert_column(-1, person, renderer, attributes)
-
- column = treeview.get_column(col_offset - 1)
- column.sizing = Gtk::TreeViewColumn::FIXED
- column.fixed_width = 50
- column.clickable = true
+ person, european = *args
+ renderer = Gtk::CellRendererToggle.new
+ renderer.xalign = 0.0
+ eval(%Q[def renderer.column; #{ALEX_COLUMN + i}; end])
+
+ renderer.signal_connect('toggled') do |cell, path|
+ item_toggled(cell, path, model)
+ end
+
+ attributes = {
+ 'active' => (ALEX_COLUMN + i),
+ 'visible' => VISIBLE_COLUMN,
+ }
+ if european
+ attributes['activatable'] = WORLD_COLUMN
+ end
+ col_offset = treeview.insert_column(-1, person, renderer, attributes)
+
+ column = treeview.get_column(col_offset - 1)
+ column.sizing = Gtk::TreeViewColumn::FIXED
+ column.fixed_width = 50
+ column.clickable = true
end
end
diff --git a/gtk3/sample/misc/assistant.rb b/gtk3/sample/misc/assistant.rb
index 51f18b7..e0719d8 100755
--- a/gtk3/sample/misc/assistant.rb
+++ b/gtk3/sample/misc/assistant.rb
@@ -18,7 +18,6 @@ class AssistantRunner
@generous_assistant = nil
@selected_branch = "A"
@nonlinear_assistant = nil
- @full_featured_assistant = nil
end
def run_simple_assistant
@@ -36,11 +35,6 @@ class AssistantRunner
:create_nonlinear_assistant)
end
- def run_full_featured_assistant
- @full_featured_assistant = run_assistant(@full_featured_assistant,
- :create_full_featured_assistant)
- end
-
private
def run_assistant(assistant, assistant_create_method)
assistant ||= send(assistant_create_method)
@@ -84,7 +78,7 @@ class AssistantRunner
GLib::Timeout.add(300) do
page = assistant.get_nth_page(assistant.current_page)
progress = page.child
- value = progress.fraction = progress.fraction + 0.1
+ value = progress.fraction = (progress.fraction + 0.1).round(1)
continue = value < 1.0
assistant.set_page_complete(page, true) unless continue
continue
@@ -256,67 +250,13 @@ class AssistantRunner
assistant.set_page_type(page, :confirm)
assistant.set_page_complete(page, true)
end
-
- def create_full_featured_assistant
- assistant = Gtk::Assistant.new
- assistant.set_default_size(400, 300)
- assistant.signal_connect("cancel") do
- puts "cancel"
- assistant.hide
- end
- assistant.signal_connect("close") do
- puts "close"
- assistant.hide
- end
- assistant.signal_connect("apply") do
- puts "apply"
- end
- assistant.signal_connect("prepare") do |_assistant, page|
- prepare_cb(_assistant, page)
- end
-
- button = Gtk::Button.new(:stock_id => Gtk::Stock::STOP)
- button.show
- assistant.add_action_widget(button)
-
- page = create_test_page("Page 1")
- page.show
- assistant.append_page(page)
- assistant.set_page_title(page, "Page 1")
- assistant.set_page_complete(page, true)
-
- #- set a side image
- pixbuf = page.render_icon(Gtk::Stock::DIALOG_WARNING, :dialog)
- assistant.set_page_side_image(page, pixbuf)
-
- #- set a header image
- pixbuf = page.render_icon(Gtk::Stock::DIALOG_INFO, :dialog)
- assistant.set_page_header_image(page, pixbuf)
-
- page = create_test_page("Invisible page")
- assistant.append_page(page)
-
- page = create_test_page("Page 3")
- page.show
- assistant.append_page(page)
- assistant.set_page_title(page, "Page 3")
- assistant.set_page_type(page, :confirm)
- assistant.set_page_complete(page, true)
-
- #- set a header image
- pixbuf = page.render_icon(Gtk::Stock::DIALOG_INFO, :dialog)
- assistant.set_page_header_image(page, pixbuf)
-
- assistant
- end
end
runner = AssistantRunner.new
buttons = [
- [ "simple assistant", proc { runner.run_simple_assistant } ],
- [ "generous assistant", proc { runner.run_generous_assistant } ],
- [ "nonlinear assistant", proc { runner.run_nonlinear_assistant } ],
- [ "full featured assistant", proc { runner.run_full_featured_assistant } ],
+ ["simple assistant", proc {runner.run_simple_assistant}],
+ ["generous assistant", proc {runner.run_generous_assistant}],
+ ["nonlinear assistant", proc {runner.run_nonlinear_assistant}]
]
if ENV["RTL"]
@@ -324,8 +264,8 @@ if ENV["RTL"]
end
window = Gtk::Window.new(:toplevel)
-window.signal_connect("destroy") { Gtk.main_quit }
-window.signal_connect("delete-event") { false }
+window.signal_connect("destroy") {Gtk.main_quit}
+window.signal_connect("delete-event") {false}
box = Gtk::Box.new(:vertical, 6)
window.add(box)
diff --git a/gtk3/sample/misc/bindings.rb b/gtk3/sample/misc/bindings.rb
old mode 100644
new mode 100755
index f73ce16..4c0be18
--- a/gtk3/sample/misc/bindings.rb
+++ b/gtk3/sample/misc/bindings.rb
@@ -25,18 +25,24 @@ Usage:
"back_space" : same as pressing <backspace> in text view area.
"cancel j/k" : disable 'j' and 'k' binding
=end
-require 'gtk3'
+require "gtk3"
class Pager < Gtk::TextView
type_register
# widget's key binding can be defined like this
- binding_set.add_signal(Gdk::Keyval::GDK_space, 0,
+ binding_set.add_signal(Gdk::Keyval::GDK_KEY_space, 0,
"move_cursor",
- Gtk::MOVEMENT_PAGES, 1, false)
- binding_set.add_signal(Gdk::Keyval::GDK_BackSpace, 0,
+ Gtk::MovementStep::PAGES, 1, false)
+ binding_set.add_signal(Gdk::Keyval::GDK_KEY_BackSpace, 0,
"move_cursor",
- Gtk::MOVEMENT_PAGES, -1, false)
+ Gtk::MovementStep::PAGES, -1, false)
+ binding_set.add_signal(Gdk::Keyval::GDK_KEY_j, 0,
+ "move_cursor",
+ Gtk::MovementStep::DISPLAY_LINES, 1, false)
+ binding_set.add_signal(Gdk::Keyval::GDK_KEY_k, 0,
+ "move_cursor",
+ Gtk::MovementStep::DISPLAY_LINES, -1, false)
def initialize(path)
@path = path
@@ -55,42 +61,28 @@ class Pager < Gtk::TextView
end
end
-path = ARGV[0] || __FILE__
+path = ARGV[0] || __FILE__
window = Gtk::Window.new
window.name = "pager_window"
sw = Gtk::ScrolledWindow.new
-vbox = Gtk::VBox.new
-hbox = Gtk::HBox.new
+vbox = Gtk::Box.new(:vertical)
+hbox = Gtk::Box.new(:horizontal)
pager = Pager.new(path)
-hbox.add(button1 = Gtk::Button.new("space"))
-hbox.add(button2 = Gtk::Button.new("back_space"))
-hbox.add(button3 = Gtk::Button.new("cancel j/k"))
+hbox.add(button1 = Gtk::Button.new(:label => "space"))
+hbox.add(button2 = Gtk::Button.new(:label => "back_space"))
+hbox.add(button3 = Gtk::Button.new(:label => "cancel j/k"))
button1.signal_connect("clicked") do
- Pager.binding_set.activate(Gdk::Keyval::GDK_space, 0, pager)
+ Pager.binding_set.activate(Gdk::Keyval::GDK_KEY_space, 0, pager)
end
button2.signal_connect("clicked") do
- pager.bindings_activate(Gdk::Keyval::GDK_BackSpace, 0)
+ pager.bindings_activate(Gdk::Keyval::GDK_KEY_BackSpace, 0)
end
-
-# Key bindings can be attached to any widget by
-# Gtk::BindingSet#add_path
-# see RC Files section of GTK+ documentation for more detail.
-bset = Gtk::BindingSet.new("j_and_k")
-bset.add_signal(Gdk::Keyval::GDK_j, 0,
- "move_cursor",
- Gtk::MOVEMENT_DISPLAY_LINES, 1, false)
-bset.add_signal(Gdk::Keyval::GDK_k, 0,
- "move_cursor",
- Gtk::MOVEMENT_DISPLAY_LINES, -1, false)
-bset.add_path(Gtk::PathType::WIDGET, "pager_window.*.Pager",
- Gtk::PathPriorityType::APPLICATION)
-
button3.signal_connect("clicked") do
- bset.entry_clear(Gdk::Keyval::GDK_j, 0)
- bset.entry_clear(Gdk::Keyval::GDK_k, 0)
+ Pager.binding_set.entry_remove(Gdk::Keyval::GDK_KEY_j, 0)
+ Pager.binding_set.entry_remove(Gdk::Keyval::GDK_KEY_k, 0)
end
sw.add(pager)
@@ -100,8 +92,6 @@ window.show_all
pager.grab_focus
-window.signal_connect("destroy") { Gtk.main_quit }
+window.signal_connect("destroy") {Gtk.main_quit}
Gtk.main
-
-
diff --git a/gtk3/sample/misc/button.rb b/gtk3/sample/misc/button.rb
index c661d6d..531abd5 100644
--- a/gtk3/sample/misc/button.rb
+++ b/gtk3/sample/misc/button.rb
@@ -8,10 +8,13 @@
$Id: button.rb,v 1.10 2006/06/17 13:18:12 mutoh Exp $
=end
-require 'gtk3'
+require "gtk3"
window = Gtk::Window.new("buttons")
window.border_width = 0
+window.signal_connect("delete_event") do
+ Gtk.main_quit
+end
box1 = Gtk::Box.new(:vertical, 0)
window.add(box1)
@@ -20,7 +23,7 @@ table = Gtk::Table.new(3, 3, false)
table.set_row_spacings(5)
table.set_column_spacings(5)
table.set_border_width(10)
-box1.pack_start(table, true, true, 0)
+box1.pack_start(table, :expand => true, :fill => true, :padding => 0)
button = []
0.upto(8) do |i|
@@ -49,18 +52,18 @@ table.attach(button[7], 2, 3, 1, 2, nil, nil, 0, 0)
table.attach(button[8], 0, 1, 1, 2, nil, nil, 0, 0)
separator = Gtk::Separator.new(:vertical)
-box1.pack_start(separator, false, true, 0)
+box1.pack_start(separator, :expand => false, :fill => true, :padding => 0)
box2 = Gtk::Box.new(:vertical, 10)
box2.border_width = 10
-box1.pack_start(box2, false, true, 0)
+box1.pack_start(box2, :expand => false, :fill => true, :padding => 0)
close = Gtk::Button.new(:label => "close")
close.signal_connect("clicked") do
Gtk.main_quit
end
-box2.pack_start(close, true, true, 0)
+box2.pack_start(close, :expand => true, :fill => true, :padding => 0)
close.can_default = true
close.grab_default
diff --git a/gtk3/sample/misc/buttonbox.rb b/gtk3/sample/misc/buttonbox.rb
index 058f484..a692344 100644
--- a/gtk3/sample/misc/buttonbox.rb
+++ b/gtk3/sample/misc/buttonbox.rb
@@ -8,7 +8,7 @@
$Id: buttonbox.rb,v 1.9 2006/06/17 13:18:12 mutoh Exp $
=end
-require 'gtk3'
+require "gtk3"
def create_bbox_window(horizontal, title, pos, spacing, layout)
window = Gtk::Window.new(title)
@@ -32,7 +32,7 @@ def create_bbox_window(horizontal, title, pos, spacing, layout)
bbox.layout_style = layout
bbox.spacing = spacing
box1.border_width = 25
- box1.pack_start(bbox, true, true, 0)
+ box1.pack_start(bbox, :expand => true, :fill => true, :padding => 0)
button = Gtk::Button.new(:label => "OK")
bbox.add(button)
diff --git a/gtk3/sample/misc/checkbutton.rb b/gtk3/sample/misc/checkbutton.rb
index a2cd62e..c538d09 100644
--- a/gtk3/sample/misc/checkbutton.rb
+++ b/gtk3/sample/misc/checkbutton.rb
@@ -8,10 +8,13 @@
$Id: checkbutton.rb,v 1.10 2006/06/17 13:18:12 mutoh Exp $
=end
-require 'gtk3'
+require "gtk3"
window = Gtk::Window.new("check buttons")
window.border_width = 0
+window.signal_connect("delete_event") do
+ Gtk.main_quit
+end
box1 = Gtk::Box.new(:vertical)
window.add(box1)
diff --git a/gtk3/sample/misc/colorselection.rb b/gtk3/sample/misc/colorselection.rb
index 84307f2..6117ea1 100644
--- a/gtk3/sample/misc/colorselection.rb
+++ b/gtk3/sample/misc/colorselection.rb
@@ -7,19 +7,16 @@
$Id: colorselection.rb,v 1.3 2006/06/17 13:18:12 mutoh Exp $
=end
-require 'gtk3'
-
-settings = Gtk::Settings.default
-
-# You can save the palette to use right click on the palette.
-Gtk::ColorSelection.set_change_palette_hook{|screen, colors|
- puts strs = Gtk::ColorSelection.palette_to_string(colors)
- settings.gtk_color_palette = strs
-}
+require "gtk3"
a = Gtk::ColorSelection.new
a.has_palette = true
+a.signal_connect("color_changed") do |w|
+ unless w.adjusting?
+ p w.current_rgba.to_s
+ end
+end
-Gtk::Window.new.add(a).show_all.signal_connect("destroy"){Gtk.main_quit}
+Gtk::Window.new.add(a).show_all.signal_connect("destroy") {Gtk.main_quit}
Gtk.main
diff --git a/gtk3/sample/misc/combo_check.rb b/gtk3/sample/misc/combo_check.rb
index 54134f7..ec85141 100644
--- a/gtk3/sample/misc/combo_check.rb
+++ b/gtk3/sample/misc/combo_check.rb
@@ -8,56 +8,64 @@
$Id: combo_check.rb,v 1.9 2006/06/17 13:18:12 mutoh Exp $
=end
-require 'gtk3'
+require "gtk3"
window = Gtk::Window.new("entry")
window.border_width = 0
+window.signal_connect("destroy") do
+ Gtk.main_quit
+end
-box1 = Gtk::VBox.new
+box1 = Gtk::Box.new(:vertical)
window.add(box1)
-box2 = Gtk::VBox.new(false, 10)
+box2 = Gtk::Box.new(:vertical, 10)
box2.border_width = 10
box1.pack_start(box2)
entry = Gtk::Entry.new
entry.text = "hello world"
+entry.set_editable(false)
entry.select_region(0, -1)
box2.pack_start(entry)
-#
-# Gtk::Combo has been deprecated. Use Gtk::ComboBox instead.
-#
-cb = Gtk::Combo.new
-cb.set_popdown_strings(["item0",
- "item1 item1",
- "item2 item2 item2",
- "item3 item3 item3 item3",
- "item4 item4 item4 item4 item4",
- "item5 item5 item5 item5 item5 item5",
- "item6 item6 item6 item6 item6",
- "item7 item7 item7 item7",
- "item8 item8 item8",
- "item9 item9"])
-cb.entry.set_text("hello world")
-cb.entry.select_region(0, -1)
-box2.pack_start(cb, true, true, 0)
+## Gtk::ComboBoxText is simpler than Gtk::ComboBox, but has less functions.
+## Gtk::Combo has been deprecated.
+cb = Gtk::ComboBoxText.new(:entry => true)
+cb.append_text("item0")
+cb.append_text("item1 item1")
+cb.append_text("item2 item2 item2")
+cb.append_text("item3 item3 item3 item3")
+cb.append_text("item4 item4 item4 item4 item4")
+cb.append_text("item5 item5 item5 item5 item5 item5")
+cb.append_text("item6 item6 item6 item6 item6")
+cb.append_text("item7 item7 item7 item7")
+cb.append_text("item8 item8 item8")
+cb.append_text("item9 item9")
+cb.child.text = "hello world"
+cb.child.select_region(0, -1)
+cb.child.set_editable(false)
+box2.pack_start(cb, :expand => true, :fill => true, :padding => 0)
check = Gtk::CheckButton.new("Editable")
-box2.pack_start(check, false, true, 0)
+box2.pack_start(check, :expand => false, :fill => true, :padding => 0)
check.signal_connect("toggled") do
- cb.entry.set_editable(check.active?)
+ cb.child.set_editable(check.active?)
entry.set_editable(check.active?)
end
-check.state = 0
+check.set_state_flags(Gtk::StateFlags::NORMAL, true)
+## Run this code to see all of GtkStateFlags ##
+# Gtk::StateFlags.constants.each do |i|
+# p i
+# end
-box1.pack_start(Gtk::HSeparator.new)
+box1.pack_start(Gtk::Separator.new(:horizontal))
-box2 = Gtk::VBox.new(false, 10)
+box2 = Gtk::Box.new(:vertical, 10)
box2.border_width = 10
box1.pack_start(box2)
-button = Gtk::Button.new("close")
+button = Gtk::Button.new(:label => "close")
button.signal_connect("clicked") do
Gtk.main_quit
end
diff --git a/gtk3/sample/misc/combobox.rb b/gtk3/sample/misc/combobox.rb
index e4d146e..1016e6d 100644
--- a/gtk3/sample/misc/combobox.rb
+++ b/gtk3/sample/misc/combobox.rb
@@ -8,21 +8,21 @@
$Id: combobox.rb,v 1.3 2006/06/17 13:18:12 mutoh Exp $
=end
-require 'gtk3'
+require "gtk3"
-if str = Gtk.check_version(2, 4, 0)
- puts "This sample requires GTK+ 2.4.0 or later"
+if str = Gtk.check_version(3, 10, 7)
+ puts "This sample requires GTK+ 3.10.7 or later"
puts str
exit
end
window = Gtk::Window.new("Gtk::ComboBox sample")
-window.signal_connect("destroy"){Gtk.main_quit}
+window.signal_connect("destroy") {Gtk.main_quit}
#
# Text only
#
-combo1 = Gtk::ComboBox.new
+combo1 = Gtk::ComboBoxText.new
["foo", "bar", "fuga", "hoge"].each do |val|
combo1.append_text(val)
end
@@ -40,11 +40,11 @@ model = Gtk::ListStore.new(Gdk::Pixbuf, String)
[Gtk::Stock::CANCEL, "cancel"],
[Gtk::Stock::OK, "ok"]].each do |stock, name|
iter = model.append
- iter[0] = window.render_icon(stock, Gtk::IconSize::MENU, "icon")
+ iter[0] = window.render_icon_pixbuf(stock, Gtk::IconSize::IconSize::MENU)
iter[1] = name
end
-combo2 = Gtk::ComboBox.new(model)
+combo2 = Gtk::ComboBox.new(:model => model)
# column 1
renderer = Gtk::CellRendererPixbuf.new
@@ -65,7 +65,7 @@ end
#
# Gtk::ComboBoxEntry
#
-combo3 = Gtk::ComboBoxEntry.new
+combo3 = Gtk::ComboBoxText.new(:entry => true)
["foo", "bar", "fuga", "hoge"].each do |val|
combo3.append_text(val)
end
@@ -76,11 +76,10 @@ combo3.signal_connect("changed") do
p "combo3: #{combo3.active}, #{combo3.active_iter[0]}"
end
end
-
+
# Show main window
-vbox = Gtk::VBox.new
+vbox = Gtk::Box.new(:vertical)
vbox.add(combo1).add(combo2).add(combo3)
window.add(vbox).show_all
Gtk.main
-
diff --git a/gtk3/sample/misc/cursor.rb b/gtk3/sample/misc/cursor.rb
index 2341ebc..b1bacf7 100644
--- a/gtk3/sample/misc/cursor.rb
+++ b/gtk3/sample/misc/cursor.rb
@@ -7,15 +7,17 @@
$Id: cursor.rb,v 1.7 2006/06/17 13:18:12 mutoh Exp $
=end
-require 'gtk3'
+require "gtk3"
window = Gtk::Window.new("Gdk::Cursor sample")
+window.signal_connect('destroy') {Gtk.main_quit}
window.realize
button = Gtk::Button.new(:label => "Click!")
button.use_underline = false
cursors = Gdk::Cursor::Type.values - [Gdk::Cursor::Type::CURSOR_IS_PIXMAP]
+cursors -= [Gdk::Cursor::Type::LAST_CURSOR]
cnt = 0
button.signal_connect('clicked') do
diff --git a/gtk3/sample/misc/dialog.rb b/gtk3/sample/misc/dialog.rb
index 90ad1bc..2139f9d 100644
--- a/gtk3/sample/misc/dialog.rb
+++ b/gtk3/sample/misc/dialog.rb
@@ -8,30 +8,30 @@
$Id: dialog.rb,v 1.6 2006/06/17 13:18:12 mutoh Exp $
=end
-require 'gtk3'
+require "gtk3"
window = Gtk::Window.new("Gtk::Dialog sample")
-button = Gtk::Button.new("Create Dialog")
-button.signal_connect("clicked") do
+button = Gtk::Button.new(:label => "Create Dialog")
+button.signal_connect("clicked") do
dialog = Gtk::Dialog.new
dialog.title = "Gtk::Dialog Sample"
dialog.transient_for = window
dialog.set_default_size(300, 300)
- dialog.vbox.add(Gtk::Label.new("Gtk::Dialog Sample"))
+ dialog.child.add(Gtk::Label.new("Gtk::Dialog Sample"))
- dialog.add_button("OK", Gtk::Dialog::RESPONSE_OK)
- dialog.add_button(Gtk::Stock::CANCEL, Gtk::Dialog::RESPONSE_CANCEL)
- dialog.add_button(Gtk::Stock::CLOSE, Gtk::Dialog::RESPONSE_CLOSE)
- dialog.set_default_response(Gtk::Dialog::RESPONSE_CANCEL)
+ dialog.add_button("OK", Gtk::ResponseType::OK)
+ dialog.add_button(Gtk::Stock::CANCEL, Gtk::ResponseType::CANCEL)
+ dialog.add_button(Gtk::Stock::CLOSE, Gtk::ResponseType::CLOSE)
+ dialog.set_default_response(Gtk::ResponseType::CANCEL)
dialog.signal_connect("response") do |widget, response|
case response
- when Gtk::Dialog::RESPONSE_OK
+ when Gtk::ResponseType::OK
p "OK"
- when Gtk::Dialog::RESPONSE_CANCEL
+ when Gtk::ResponseType::CANCEL
p "Cancel"
- when Gtk::Dialog::RESPONSE_CLOSE
+ when Gtk::ResponseType::CLOSE
p "Close"
dialog.destroy
end
@@ -39,6 +39,6 @@ button.signal_connect("clicked") do
dialog.show_all
end
-window.add(button).show_all.signal_connect("destroy"){Gtk.main_quit}
+window.add(button).show_all.signal_connect("destroy") {Gtk.main_quit}
Gtk.main
diff --git a/gtk3/sample/misc/dialog2.rb b/gtk3/sample/misc/dialog2.rb
index 0d38541..3e7e841 100644
--- a/gtk3/sample/misc/dialog2.rb
+++ b/gtk3/sample/misc/dialog2.rb
@@ -8,32 +8,29 @@
$Id: dialog2.rb,v 1.7 2006/06/17 13:18:12 mutoh Exp $
=end
-require 'gtk3'
+require "gtk3"
window = Gtk::Window.new("Gtk::Dialog sample2")
-button = Gtk::Button.new("Create Dialog")
-button.signal_connect("clicked") do
- dialog = Gtk::Dialog.new("Gtk::Dialog Sample 2", window,
- Gtk::Dialog::MODAL|Gtk::Dialog::NO_SEPARATOR,
- [Gtk::Stock::OK, Gtk::Dialog::RESPONSE_OK],
- [Gtk::Stock::CANCEL, Gtk::Dialog::RESPONSE_CANCEL])
- dialog.vbox.add(Gtk::Label.new("Gtk::Dialog Sample 2"))
+button = Gtk::Button.new(:label => "Create Dialog")
+button.signal_connect("clicked") do
+ dialog = Gtk::Dialog.new(:title =>"Gtk::Dialog Sample 2",
+ :parent => window,
+ :flags => Gtk::Dialog::Flags::MODAL,
+ :buttons => [[Gtk::Stock::OK, Gtk::ResponseType::OK],
+ [Gtk::Stock::CANCEL, Gtk::ResponseType::CANCEL]])
+ dialog.child.add(Gtk::Label.new("Gtk::Dialog Sample 2"))
dialog.set_default_size(300, 300)
- dialog.vbox.show_all
+ dialog.child.show_all
result = dialog.run
case result
- when Gtk::Dialog::RESPONSE_OK
+ when Gtk::ResponseType::OK
p "OK"
- when Gtk::Dialog::RESPONSE_CANCEL
+ when Gtk::ResponseType::CANCEL
p "Cancel"
end
dialog.destroy
end
-window.add(button).show_all.signal_connect("destroy"){Gtk.main_quit}
+window.add(button).show_all.signal_connect("destroy") {Gtk.main_quit}
Gtk.main
-
-
-
-
diff --git a/gtk3/sample/misc/drawing.rb b/gtk3/sample/misc/drawing.rb
index bbc80f6..45efb85 100644
--- a/gtk3/sample/misc/drawing.rb
+++ b/gtk3/sample/misc/drawing.rb
@@ -12,17 +12,24 @@ require 'gtk3'
class Canvas < Gtk::DrawingArea
def initialize
super
- signal_connect("draw") { |w,e| expose_event(w,e) }
- signal_connect("configure_event") { |w, e| configure_event(w,e) }
+ signal_connect("draw") do |w, e|
+ expose_event(w, e)
+ end
+ signal_connect("configure_event") do |w, e|
+ configure_event(w, e)
+ end
@buffer = nil
@bgc = nil
end
- def expose_event(w,e)
+ def expose_event(w, e)
unless @buffer.nil?
rec = e.area
- w.window.draw_drawable(@bgc, @buffer, rec.x, rec.y,
- rec.x, rec.y, rec.width, rec.height)
+ w.window.draw_drawable(@bgc,
+ @buffer,
+ rec.x, rec.y,
+ rec.x, rec.y,
+ rec.width, rec.height)
end
false
end
@@ -33,18 +40,22 @@ class Canvas < Gtk::DrawingArea
g = b.size
@bgc = self.style.bg_gc(self.state) if @bgc.nil?
if (g[0] > 0 && g[1] > 0)
- b.draw_rectangle(@bgc, true, 0,0, g[0], g[1])
+ b.draw_rectangle(@bgc, true, 0, 0, g[0], g[1])
end
end
- def configure_event(w,e)
+ def configure_event(w, e)
g = w.window.geometry
if (g[2] > 0 && g[3] > 0)
b = Gdk::Pixmap::new(w.window, g[2], g[3], -1)
clear(b)
if not @buffer.nil?
- g = @buffer.size
- b.draw_drawable(@bgc, @buffer, 0, 0, 0, 0, g[0], g[1])
+ g = @buffer.size
+ b.draw_drawable(@bgc,
+ @buffer,
+ 0, 0,
+ 0, 0,
+ g[0], g[1])
end
@buffer = b
end
@@ -55,24 +66,30 @@ end
class A < Canvas
def initialize
super
- signal_connect("button_press_event") { |w,e| pressed(w,e) }
+ signal_connect("button_press_event") do |w, e|
+ pressed(w, e)
+ end
set_events(Gdk::Event::BUTTON_PRESS_MASK)
end
def pressed(widget, ev)
if not @last.nil?
@buffer.draw_line(widget.style.fg_gc(widget.state),
- @last.x, @last.y, ev.x, ev.y)
+ @last.x, @last.y,
+ ev.x, ev.y)
- x1,x2 = if (@last.x < ev.x)
- then [@last.x, ev.x]
- else [ev.x, @last.x]
- end
- y1,y2 = if (@last.y < ev.y)
- then [@last.y, ev.y]
- else [ev.y, @last.y]
- end
- widget.queue_draw_area(x1, y1, x2 - x1 + 1, y2 - y1 + 1)
+ x1, x2 = if (@last.x < ev.x)
+ [@last.x, ev.x]
+ else
+ [ev.x, @last.x]
+ end
+ y1, y2 = if (@last.y < ev.y)
+ [@last.y, ev.y]
+ else
+ [ev.y, @last.y]
+ end
+ widget.queue_draw_area(x1, y1,
+ x2 - x1 + 1, y2 - y1 + 1)
end
@last = nil
@last = ev
@@ -81,7 +98,9 @@ class A < Canvas
end
window = Gtk::Window.new("drawing test")
-window.signal_connect("destroy") { Gtk.main_quit }
+window.signal_connect("destroy") do
+ Gtk.main_quit
+end
canvas = A.new
window.add(canvas)
diff --git a/gtk3/sample/misc/statusicon.rb b/gtk3/sample/misc/statusicon.rb
index 5815136..1661407 100644
--- a/gtk3/sample/misc/statusicon.rb
+++ b/gtk3/sample/misc/statusicon.rb
@@ -10,10 +10,10 @@
$Id: statusicon.rb,v 1.1 2006/11/17 18:12:41 mutoh Exp $
=end
-require 'gtk3'
+require "gtk3"
-if str = Gtk.check_version(2, 10, 0)
- puts "This sample requires GTK+ 2.10.0 or later"
+if str = Gtk.check_version(3, 10, 7)
+ puts "This sample requires GTK+ 3.10.7 or later"
puts str
exit
end
@@ -27,44 +27,35 @@ class StatusIconSample < Gtk::StatusIcon
@status = STATUS_INFO
update_icon
- set_blinking(true)
- signal_connect("activate"){
- icon_activated
- }
- signal_connect("popup-menu"){|w, button, activate_time|
+ signal_connect("activate") {icon_activated}
+ signal_connect("popup-menu") do |w, button, activate_time|
menu = Gtk::Menu.new
- checkmenuitem = Gtk::CheckMenuItem.new("Blink")
- checkmenuitem.active = blinking?
- checkmenuitem.signal_connect("activate"){|w|
- set_blinking(w.active?)
- }
- menu.append(checkmenuitem)
menuitem = Gtk::MenuItem.new("Quit")
- menuitem.signal_connect("activate"){
+ menuitem.signal_connect("activate") do
set_visible(false)
Gtk.main_quit
- }
+ end
menu.append(menuitem)
menu.show_all
menu.popup(nil, nil, button, activate_time)
- }
+ end
- timeout_func
+ @timeout = timeout_func
end
def update_icon
if @status == STATUS_INFO
- set_icon_name(Gtk::Stock::DIALOG_INFO)
- set_tooltip("Some Information ...")
+ self.stock = Gtk::Stock::DIALOG_INFO
+ set_tooltip_text("Some Information ...")
else
- set_icon_name(Gtk::Stock::DIALOG_QUESTION)
- set_tooltip("Some Question ...")
+ self.stock = Gtk::Stock::DIALOG_QUESTION
+ set_tooltip_text("Some Question ...")
end
end
def timeout_func
- GLib::Timeout.add(2000) {
+ GLib::Timeout.add(2000) do
if @status == STATUS_INFO
@status = STATUS_QUESTION
else
@@ -72,50 +63,42 @@ class StatusIconSample < Gtk::StatusIcon
end
update_icon
true
- }
+ end
end
def icon_activated
unless @dialog
- @dialog = Gtk::MessageDialog.new(nil, 0,
- Gtk::MessageDialog::QUESTION,
- Gtk::MessageDialog::BUTTONS_CLOSE,
- "You wanna test the status icon?")
- @dialog.window_position = Gtk::Window::POS_CENTER
+ @dialog = Gtk::MessageDialog.new(:parent => nil, :flags => 0,
+ :type => Gtk::MessageType::QUESTION,
+ :buttons_type => Gtk::MessageDialog::ButtonsType::CLOSE,
+ :message => "You wanna test the status icon?")
+ @dialog.window_position = Gtk::Window::Position::CENTER
- @dialog.signal_connect("response"){ @dialog.hide }
- @dialog.signal_connect("delete_event"){ @dialog.hide_on_delete }
+ @dialog.signal_connect("response") {@dialog.hide}
+ @dialog.signal_connect("delete_event") {@dialog.hide_on_delete}
toggle = Gtk::ToggleButton.new("_Show the icon")
- @dialog.vbox.pack_end(toggle, true, true, 6)
+ @dialog.child.pack_end(toggle, :expand => true, :fill => true, :padding => 6)
toggle.active = visible?
- toggle.signal_connect("toggled"){|w|
+ toggle.signal_connect("toggled") do |w|
set_visible(w.active?)
- }
+ end
- toggle = Gtk::ToggleButton.new("_Blink the icon")
- @dialog.vbox.pack_end(toggle, true, true, 6)
- toggle.active = blinking?
- toggle.signal_connect("toggled"){|w|
- set_blinking(w.active?)
- }
-
toggle = Gtk::ToggleButton.new("_Change the icon")
- @dialog.vbox.pack_end(toggle, true, true, 6)
+ @dialog.child.pack_end(toggle, :expand => true, :fill => true, :padding => 6)
toggle.active = (@timeout != 0)
- toggle.signal_connect("toggled"){
+ toggle.signal_connect("toggled") do
if @timeout and @timeout > 0
GLib::Source.remove(@timeout)
@timeout = 0
else
@timeout = timeout_func
end
- }
+ end
end
@dialog.show_all
@dialog.present
end
-
end
StatusIconSample.new
diff --git a/gtk3/sample/misc/threads.rb b/gtk3/sample/misc/threads.rb
index 4b01255..9ebb596 100644
--- a/gtk3/sample/misc/threads.rb
+++ b/gtk3/sample/misc/threads.rb
@@ -8,39 +8,39 @@
$Id: threads.rb,v 1.5 2006/06/17 13:18:12 mutoh Exp $
=end
-require 'gtk3'
-require 'thread'
+require "gtk3"
+require "thread"
label = Gtk::Label.new
-Thread.new {
- (0...1000).each { |cnt|
+Thread.new do
+ (0...1000).each do |cnt|
p "A:" + cnt.to_s
label.label = "A:" + cnt.to_s
sleep(2)
- }
-}
+ end
+end
start_button = Gtk::Button.new("start")
stop_button = Gtk::Button.new("stop")
start_button.signal_connect("clicked") do
- start_button.sensitive=false
- @th = Thread.new {
- (0...10).each { |cnt|
+ start_button.sensitive = false
+ @th = Thread.new do
+ (0...10).each do |cnt|
p "B:" + cnt.to_s
label.label = "B:" + cnt.to_s
sleep(2)
- }
+ end
@th = nil
start_button.sensitive = true
start_button.grab_focus
stop_button.sensitive = false
- }
+ end
stop_button.sensitive = true
stop_button.grab_focus
end
-
+
stop_button.signal_connect("clicked") do
if @th
@th.kill
@@ -54,8 +54,8 @@ end
stop_button.sensitive = false
-box = Gtk::VBox.new.
- set_size_request(100,100)
+box = Gtk::VBox.new
+box.set_size_request(100, 100)
box << label << start_button << stop_button
@@ -63,10 +63,8 @@ win = Gtk::Window.new << box
win.show_all.signal_connect("delete_event") do
p "Exiting..."
- Gtk.main_quit
- Thread.list.each {|t| t.kill }
+ Gtk.main_quit
+ Thread.list.each {|t| t.kill}
end
Gtk.main
-
-
diff --git a/gtk3/sample/misc/tree_progress.rb b/gtk3/sample/misc/tree_progress.rb
index baeaadd..c431cb3 100644
--- a/gtk3/sample/misc/tree_progress.rb
+++ b/gtk3/sample/misc/tree_progress.rb
@@ -9,7 +9,7 @@
=end
-require 'gtk3'
+require "gtk3"
win = Gtk::Window.new("Gtk::CellRendererProgress sample")
win.set_default_size(300, 50)
@@ -36,28 +36,26 @@ prenderer = Gtk::CellRendererProgress.new
pcol = Gtk::TreeViewColumn.new("Progress", prenderer, :value => 1)
view.append_column(pcol)
-win.signal_connect("delete_event"){
+win.signal_connect("delete_event") do
Gtk.main_quit
-}
+end
win.add(view)
win.show_all
dir = 1
thr = Thread.new do
- loop {
- prog2[1] += dir
- if prog2[1] > 100
- prog2[1] = 100
+ loop do
+ value = prog2[1] + dir
+ if value > 100
dir = - dir
end
- if prog2[1] < 0
- prog2[1] = 0
+ if value < 0
dir = - dir
end
- sleep 0.01
- }
+ prog2[1] += dir
+ sleep 0.1
+ end
end
Gtk.main
-
diff --git a/gtk3/test/run-test.rb b/gtk3/test/run-test.rb
index d0b4c14..e142f99 100755
--- a/gtk3/test/run-test.rb
+++ b/gtk3/test/run-test.rb
@@ -21,21 +21,29 @@ ruby_gnome2_base = File.expand_path(ruby_gnome2_base)
glib_base = File.join(ruby_gnome2_base, "glib2")
atk_base = File.join(ruby_gnome2_base, "atk")
+cairo_gobject_base = File.join(ruby_gnome2_base, "cairo-gobject")
pango_base = File.join(ruby_gnome2_base, "pango")
gdk_pixbuf_base = File.join(ruby_gnome2_base, "gdk_pixbuf2")
+gobject_introspection_base = File.join(ruby_gnome2_base, "gobject-introspection")
gdk3_base = File.join(ruby_gnome2_base, "gdk3")
gtk3_base = File.join(ruby_gnome2_base, "gtk3")
-[[glib_base, "glib2"],
- [atk_base, "atk"],
- [pango_base, "pango"],
- [gdk_pixbuf_base, "gdk_pixbuf2"],
- [gdk3_base, "gdk3"],
- [gtk3_base, "gtk3"]].each do |target, module_name|
- if system("which make > /dev/null")
- `make -C #{target.dump} > /dev/null` or exit(false)
+[
+ [glib_base, "glib2"],
+ [atk_base, "atk"],
+ [cairo_gobject_base, "cairo-gobject"],
+ [pango_base, "pango"],
+ [gdk_pixbuf_base, "gdk_pixbuf2"],
+ [gobject_introspection_base, "gobject-introspection"],
+ [gdk3_base, "gdk3"],
+ [gtk3_base, "gtk3"]
+].each do |target, module_name|
+ if File.exist?(File.join(target, "Makefile"))
+ if system("which make > /dev/null")
+ `make -C #{target.dump} > /dev/null` or exit(false)
+ end
+ $LOAD_PATH.unshift(File.join(target, "ext", module_name))
end
- $LOAD_PATH.unshift(File.join(target, "ext", module_name))
$LOAD_PATH.unshift(File.join(target, "lib"))
end
diff --git a/gio2/test/test-content-type.rb b/gtk3/test/test_gtk_action_group.rb
similarity index 53%
copy from gio2/test/test-content-type.rb
copy to gtk3/test/test_gtk_action_group.rb
index dd2585f..7aebe84 100644
--- a/gio2/test/test-content-type.rb
+++ b/gtk3/test/test_gtk_action_group.rb
@@ -14,18 +14,33 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-class TestContentType < Test::Unit::TestCase
+class TestGtkActionBar < Test::Unit::TestCase
+ include GtkTestUtils
+
def setup
- @content_type = Gio::ContentType.new("image/jpeg")
+ @bar = Gtk::ActionBar.new
+ end
+
+ def test_pack_start
+ widget1 = Gtk::Box.new(:horizontal)
+ widget2 = Gtk::Box.new(:horizontal)
+ @bar.pack_start(widget1)
+ @bar.pack_start(widget2)
+ assert_equal([widget1, widget2], @bar.children)
end
- def test_icon
- assert_equal("image-jpeg",
- @content_type.icon.names.first)
+ def test_pack_end
+ widget1 = Gtk::Box.new(:horizontal)
+ widget2 = Gtk::Box.new(:horizontal)
+ @bar.pack_end(widget1)
+ @bar.pack_end(widget2)
+ assert_equal([widget2, widget1], @bar.children)
end
- def test_guess
- assert_equal(["audio/mpeg", false],
- Gio::ContentType.guess("filename.mp3"))
+ def test_center_widget
+ widget = Gtk::Box.new(:horizontal)
+ assert_nil(@bar.center_widget)
+ @bar.center_widget = widget
+ assert_equal(widget, @bar.center_widget)
end
end
diff --git a/gtk3/test/test_gtk_image.rb b/gtk3/test/test_gtk_image.rb
index b42ce26..faf3ed8 100644
--- a/gtk3/test/test_gtk_image.rb
+++ b/gtk3/test/test_gtk_image.rb
@@ -2,7 +2,7 @@ class TestGtkImage < Test::Unit::TestCase
include GtkTestUtils
def test_stock
- image = Gtk::Image.new(Gtk::Stock::GO_FORWARD, :dialog)
+ image = Gtk::Image.new(:stock => Gtk::Stock::GO_FORWARD, :size => :dialog)
assert_equal(Gtk::Stock::GO_FORWARD.to_s, image.stock)
end
end
diff --git a/gtk3/test/test_gtk_search_bar.rb b/gtk3/test/test_gtk_search_bar.rb
index f138c89..2736095 100644
--- a/gtk3/test/test_gtk_search_bar.rb
+++ b/gtk3/test/test_gtk_search_bar.rb
@@ -42,7 +42,7 @@ class TestGtkSearchBar < Test::Unit::TestCase
def test_handle_event
window = Gtk::Window.new
key_press_event = Gdk::EventKey.new(:key_press)
- key_press_event.keyval = Gdk::Keyval::GDK_KEY_a
+ key_press_event.keyval = Gdk::Keyval::KEY_a
entry = Gtk::SearchEntry.new
@search_bar.add(entry)
@search_bar.connect_entry(entry)
diff --git a/gtksourceview3/test/test_mark_attributes.rb b/gtk3/test/test_gtk_stack_switcher.rb
similarity index 73%
copy from gtksourceview3/test/test_mark_attributes.rb
copy to gtk3/test/test_gtk_stack_switcher.rb
index 91d6e3d..23a2dbf 100644
--- a/gtksourceview3/test/test_mark_attributes.rb
+++ b/gtk3/test/test_gtk_stack_switcher.rb
@@ -14,13 +14,17 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-class TestMarkAttributes < Test::Unit::TestCase
+class TestGtkStackSwitcher < Test::Unit::TestCase
+ include GtkTestUtils
+
def setup
- @mark_attributes = GtkSource::MarkAttributes.new
+ only_gtk_version(3, 10, 0)
+ @stack_switcher = Gtk::StackSwitcher.new
end
- def test_background
- @mark_attributes.background = Gdk::RGBA.new(1, 0, 0, 0)
- assert_equal(Gdk::RGBA.new(1, 0, 0, 0), @mark_attributes.background)
+ def test_stack_switcher_accessors
+ stack = Gtk::Stack.new
+ @stack_switcher.stack = stack
+ assert_equal(stack, @stack_switcher.stack)
end
end
diff --git a/gtksourceview2/Rakefile b/gtksourceview2/Rakefile
index 61a03f6..2f41ddb 100644
--- a/gtksourceview2/Rakefile
+++ b/gtksourceview2/Rakefile
@@ -1,14 +1,13 @@
# -*- ruby -*-
$LOAD_PATH.unshift("./../glib2/lib")
-require 'gnome2-raketask'
+require 'gnome2/rake/package-task'
-package = GNOME2Package.new do |_package|
- _package.summary = "Ruby/GtkSourceView2 is a Ruby binding of gtksourceview-2.x."
- _package.description = "Ruby/GtkSourceView2 is a Ruby binding of gtksourceview-2.x."
- _package.dependency.gem.runtime = ["gtk2"]
- _package.win32.packages = ["gtksourceview"]
- _package.win32.dependencies = ["libxml2"]
+package_task = GNOME2::Rake::PackageTask.new do |package|
+ package.summary = "Ruby/GtkSourceView2 is a Ruby binding of gtksourceview-2.x."
+ package.description = "Ruby/GtkSourceView2 is a Ruby binding of gtksourceview-2.x."
+ package.dependency.gem.runtime = ["gtk2"]
+ package.windows.packages = ["gtksourceview"]
+ package.windows.dependencies = ["libxml2"]
end
-package.define_tasks
-
+package_task.define
diff --git a/gtksourceview2/ext/gtksourceview2/extconf.rb b/gtksourceview2/ext/gtksourceview2/extconf.rb
index 4b03718..e1be9e9 100644
--- a/gtksourceview2/ext/gtksourceview2/extconf.rb
+++ b/gtksourceview2/ext/gtksourceview2/extconf.rb
@@ -39,24 +39,11 @@ end
:target_build_dir => build_dir)
end
-rcairo_options = {}
-rcairo_source_dir_names = ["rcairo"]
-if /mingw|cygwin|mswin/ =~ RUBY_PLATFORM
- rcairo_source_dir_names.unshift("rcairo.win32")
-end
-rcairo_source_dir_names.each do |rcairo_source_dir_name|
- rcairo_source_dir = top_dir.parent.expand_path + rcairo_source_dir_name
- if rcairo_source_dir.exist?
- rcairo_options[:rcairo_source_dir] = rcairo_source_dir.to_s
- break
- end
-end
-
-unless check_cairo(rcairo_options)
+unless check_cairo(:top_dir => top_dir)
exit(false)
end
-setup_win32(module_name, base_dir)
+setup_windows(module_name, base_dir)
unless required_pkg_config_package(package_id,
:debian => "libgtksourceview2.0-dev",
diff --git a/gtksourceview3/Rakefile b/gtksourceview3/Rakefile
index a3cc73f..cfa16a7 100644
--- a/gtksourceview3/Rakefile
+++ b/gtksourceview3/Rakefile
@@ -44,7 +44,7 @@ package_task = GNOME2::Rake::PackageTask.new do |package|
:name => "gtksourceview",
:download_site => :gnome,
:label => "GtkSourceView",
- :version => "3.10.2",
+ :version => "3.14.2",
:compression_method => "xz",
:windows => {
:configure_args => [
diff --git a/gtksourceview3/ext/gtksourceview3/extconf.rb b/gtksourceview3/ext/gtksourceview3/extconf.rb
index 0a1bd0d..6103279 100644
--- a/gtksourceview3/ext/gtksourceview3/extconf.rb
+++ b/gtksourceview3/ext/gtksourceview3/extconf.rb
@@ -30,7 +30,7 @@ rescue LoadError
require 'mkmf-gnome2'
end
-["glib2", "atk", "pango", "gdk_pixbuf2", "gdk3", "gtk3"].each do |package|
+["glib2", "atk", "pango", "gdk_pixbuf2", "gtk3"].each do |package|
directory = "#{package}#{version_suffix}"
build_dir = "#{directory}/tmp/#{RUBY_PLATFORM}/#{package}/#{RUBY_VERSION}"
add_depend_package(package, "#{directory}/ext/#{package}",
@@ -39,24 +39,11 @@ end
:target_build_dir => build_dir)
end
-rcairo_options = {}
-rcairo_source_dir_names = ["rcairo"]
-if /mingw|cygwin|mswin/ =~ RUBY_PLATFORM
- rcairo_source_dir_names.unshift("rcairo.win32")
-end
-rcairo_source_dir_names.each do |rcairo_source_dir_name|
- rcairo_source_dir = top_dir.parent.expand_path + rcairo_source_dir_name
- if rcairo_source_dir.exist?
- rcairo_options[:rcairo_source_dir] = rcairo_source_dir.to_s
- break
- end
-end
-
-unless check_cairo(rcairo_options)
+unless check_cairo(:top_dir => top_dir)
exit(false)
end
-setup_win32(module_name, base_dir)
+setup_windows(module_name, base_dir)
unless required_pkg_config_package(package_id,
:debian => "libgtksourceview-3.0-dev",
@@ -78,4 +65,3 @@ if pkg_config_dir.is_a?(String)
makefile.puts("pkgconfigdir=#{pkg_config_dir}")
end
end
-
diff --git a/gtksourceview3/ext/gtksourceview3/rbgtksourcegutterrenderertext.c b/gtksourceview3/ext/gtksourceview3/rbgtksourcegutterrenderertext.c
index b02be76..c1dccba 100644
--- a/gtksourceview3/ext/gtksourceview3/rbgtksourcegutterrenderertext.c
+++ b/gtksourceview3/ext/gtksourceview3/rbgtksourcegutterrenderertext.c
@@ -1,6 +1,6 @@
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
/*
- * Copyright (C) 2011 Ruby-GNOME2 Project Team
+ * Copyright (C) 2011-2014 Ruby-GNOME2 Project Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -31,34 +31,10 @@ rg_initialize(VALUE self)
return Qnil;
}
-static VALUE
-rg_set_markup(VALUE self, VALUE markup)
-{
- StringValue(markup);
- gtk_source_gutter_renderer_text_set_markup(_SELF(self),
- RSTRING_PTR(markup),
- RSTRING_LEN(markup));
-
- return self;
-}
-
-static VALUE
-rg_set_text(VALUE self, VALUE text)
-{
- StringValue(text);
- gtk_source_gutter_renderer_text_set_text(_SELF(self),
- RSTRING_PTR(text),
- RSTRING_LEN(text));
-
- return self;
-}
-
void
Init_gtksource_gutterrenderertext(VALUE mGtkSource)
{
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_SOURCE_TYPE_GUTTER_RENDERER_TEXT, "GutterRendererText", mGtkSource);
RG_DEF_METHOD(initialize, 0);
- RG_DEF_METHOD(set_markup, 1);
- RG_DEF_METHOD(set_text, 1);
}
diff --git a/gtksourceview3/ext/gtksourceview3/rbgtksourceview3conversions.h b/gtksourceview3/ext/gtksourceview3/rbgtksourceview3conversions.h
index 08a83b0..fc03d96 100644
--- a/gtksourceview3/ext/gtksourceview3/rbgtksourceview3conversions.h
+++ b/gtksourceview3/ext/gtksourceview3/rbgtksourceview3conversions.h
@@ -40,4 +40,11 @@
#define RVAL2GTKSOURCEGUTTERRENDERERSTATE(o) (RVAL2GFLAGS(o, GTK_SOURCE_TYPE_GUTTER_RENDERER_STATE))
#define GTKSOURCEGUTTERRENDERERSTATE2RVAL(o) (GFLAGS2RVAL(o, GTK_SOURCE_TYPE_GUTTER_RENDERER_STATE))
+/* For GDK3. They are temporary. They will be needless after Ruby/SourceView3
+ * is based on Ruby/GObjectIntrospection.
+ */
+#define RVAL2GDKRECTANGLE(o) ((GdkRectangle*)RVAL2BOXED(o, GDK_TYPE_RECTANGLE))
+#define RVAL2GDKRGBA(o) ((GdkRGBA*)RVAL2BOXED(o, GDK_TYPE_RGBA))
+#define GDKRGBA2RVAL(o) (BOXED2RVAL(o, GDK_TYPE_RGBA))
+
#endif /* __RBGTKSOURCEVIEW3CONVERSIONS_H__ */
diff --git a/gtksourceview3/ext/gtksourceview3/rbgtksourceview3private.h b/gtksourceview3/ext/gtksourceview3/rbgtksourceview3private.h
index abe413b..346b2a6 100644
--- a/gtksourceview3/ext/gtksourceview3/rbgtksourceview3private.h
+++ b/gtksourceview3/ext/gtksourceview3/rbgtksourceview3private.h
@@ -28,7 +28,6 @@
#include <ruby.h>
#include <rb_cairo.h>
-#include <rbgdk3.h>
#include <rbgtk3.h>
#include "rbgtksourceview3conversions.h"
#include "rbgtksourceview3version.h"
diff --git a/gtksourceview3/test/run-test.rb b/gtksourceview3/test/run-test.rb
index c4bcf3d..93bd484 100755
--- a/gtksourceview3/test/run-test.rb
+++ b/gtksourceview3/test/run-test.rb
@@ -5,8 +5,10 @@ ruby_gnome2_base = File.expand_path(ruby_gnome2_base)
glib_base = File.join(ruby_gnome2_base, "glib2")
atk_base = File.join(ruby_gnome2_base, "atk")
+cairo_gobject_base = File.join(ruby_gnome2_base, "cairo-gobject")
pango_base = File.join(ruby_gnome2_base, "pango")
gdk_pixbuf_base = File.join(ruby_gnome2_base, "gdk_pixbuf2")
+gobject_introspection_base = File.join(ruby_gnome2_base, "gobject-introspection")
gdk3_base = File.join(ruby_gnome2_base, "gdk3")
gtk3_base = File.join(ruby_gnome2_base, "gtk3")
gtk_source_view3_base = File.join(ruby_gnome2_base, "gtksourceview3")
@@ -14,15 +16,23 @@ gtk_source_view3_base = File.join(ruby_gnome2_base, "gtksourceview3")
$LOAD_PATH.unshift(glib_base)
require 'test/glib-test-init'
-[glib_base, atk_base, pango_base, gdk_pixbuf_base, gdk3_base, gtk3_base,
- gtk_source_view3_base].each do |target|
- if system("which make > /dev/null")
- `make -C #{target.dump} > /dev/null` or exit(1)
+dependencies = [
+ glib_base,
+ atk_base,
+ cairo_gobject_base,
+ pango_base,
+ gdk_pixbuf_base,
+ gobject_introspection_base,
+ gdk3_base,
+ gtk3_base,
+ gtk_source_view3_base,
+]
+dependencies.each do |target|
+ makefile = File.join(target, "Makefile")
+ if File.exist?(makefile) and system("which make > /dev/null")
+ `make -C #{target.dump} > /dev/null` or exit(false)
end
$LOAD_PATH.unshift(File.join(target, "ext", File.basename(target)))
- $LOAD_PATH.unshift(File.join(target, "src"))
- $LOAD_PATH.unshift(File.join(target, "src", "lib"))
- $LOAD_PATH.unshift(File.join(target))
$LOAD_PATH.unshift(File.join(target, "lib"))
end
diff --git a/gtksourceview3/test/test_mark_attributes.rb b/gtksourceview3/test/test_mark_attributes.rb
index 91d6e3d..628f8f6 100644
--- a/gtksourceview3/test/test_mark_attributes.rb
+++ b/gtksourceview3/test/test_mark_attributes.rb
@@ -21,6 +21,6 @@ class TestMarkAttributes < Test::Unit::TestCase
def test_background
@mark_attributes.background = Gdk::RGBA.new(1, 0, 0, 0)
- assert_equal(Gdk::RGBA.new(1, 0, 0, 0), @mark_attributes.background)
+ assert_equal("rgba(255,0,0,0)", @mark_attributes.background.to_s)
end
end
diff --git a/gio2/test/test-content-type.rb b/gtksourceview3/test/test_source_gutter_renderer.rb
similarity index 69%
copy from gio2/test/test-content-type.rb
copy to gtksourceview3/test/test_source_gutter_renderer.rb
index dd2585f..f4d38e9 100644
--- a/gio2/test/test-content-type.rb
+++ b/gtksourceview3/test/test_source_gutter_renderer.rb
@@ -14,18 +14,20 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-class TestContentType < Test::Unit::TestCase
+class TestGutterRendererText < Test::Unit::TestCase
def setup
- @content_type = Gio::ContentType.new("image/jpeg")
+ @renderer = GtkSource::GutterRendererText.new
end
- def test_icon
- assert_equal("image-jpeg",
- @content_type.icon.names.first)
+ def test_markup
+ markup_text = "ruby"
+ @renderer.markup = markup_text
+ assert_equal(markup_text, @renderer.markup)
end
- def test_guess
- assert_equal(["audio/mpeg", false],
- Gio::ContentType.guess("filename.mp3"))
+ def test_text
+ render_text = "gtksourceview"
+ @renderer.text = render_text
+ assert_equal(render_text, @renderer.text)
end
end
diff --git a/gio2/test/test-content-type.rb b/gtksourceview3/test/test_source_language_manager.rb
similarity index 52%
copy from gio2/test/test-content-type.rb
copy to gtksourceview3/test/test_source_language_manager.rb
index dd2585f..fb027c2 100644
--- a/gio2/test/test-content-type.rb
+++ b/gtksourceview3/test/test_source_language_manager.rb
@@ -14,18 +14,33 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-class TestContentType < Test::Unit::TestCase
+class TestLanguageManager < Test::Unit::TestCase
def setup
- @content_type = Gio::ContentType.new("image/jpeg")
+ @lang = GtkSource::LanguageManager.new
+ @view = GtkSource::View.new
end
- def test_icon
- assert_equal("image-jpeg",
- @content_type.icon.names.first)
+ def test_language
+ language = @lang.get_language("ruby")
+ @view.buffer.language = language
+ assert_equal(language, @view.buffer.language)
+
+ highlight = true
+ @view.buffer.highlight_syntax = highlight
+ assert_true(@view.buffer.highlight_syntax?)
+
+ @view.buffer.highlight_matching_brackets = highlight
+ assert_true(@view.buffer.highlight_matching_brackets?)
+ end
+
+ def test_language_ids
+ ids = @lang.language_ids
+ assert_include(ids, "ruby")
end
- def test_guess
- assert_equal(["audio/mpeg", false],
- Gio::ContentType.guess("filename.mp3"))
+ def test_search_path
+ custom_path = "/path/to/search"
+ @lang.search_path = custom_path
+ assert_equal([custom_path], @lang.search_path)
end
end
diff --git a/gtksourceview3/test/test_source_view.rb b/gtksourceview3/test/test_source_view.rb
index 1d412ef..651ad5c 100644
--- a/gtksourceview3/test/test_source_view.rb
+++ b/gtksourceview3/test/test_source_view.rb
@@ -20,4 +20,38 @@ class TestSourceView < Test::Unit::TestCase
def setup
@view = GtkSource::View.new
end
+
+ def test_auto_indent
+ @view.auto_indent = true
+ assert_true(@view.auto_indent?)
+ end
+
+ def test_line_number
+ @view.show_line_numbers = true
+ assert_true(@view.show_line_numbers?)
+ end
+
+ def test_indent_width
+ indent = 4
+ @view.indent_width = indent
+ assert_equal(indent, @view.indent_width)
+ end
+
+ def test_insert_spaces_instead_of_tabs
+ insert_spaces = true
+ @view.insert_spaces_instead_of_tabs = insert_spaces
+ assert_true(@view.insert_spaces_instead_of_tabs?)
+ end
+
+ def test_right_margin_position
+ margin = 100
+ @view.right_margin_position = margin
+ assert_equal(margin, @view.right_margin_position)
+ end
+
+ def test_show_right_margin
+ show = true
+ @view.show_right_margin = show
+ assert_true(@view.show_right_margin?)
+ end
end
diff --git a/pango/Rakefile b/pango/Rakefile
index 6dea4ef..d7b05a1 100644
--- a/pango/Rakefile
+++ b/pango/Rakefile
@@ -6,16 +6,35 @@ require "gnome2/rake/package-task"
package_task = GNOME2::Rake::PackageTask.new do |package|
package.summary = "Ruby/Pango is a Ruby binding of pango-1.x."
package.description = "Ruby/Pango is a Ruby binding of pango-1.x."
- package.dependency.gem.runtime = [["cairo", ">= 1.12.5"], "glib2"]
+ package.dependency.gem.runtime = [["cairo", ">= 1.14.0"], "glib2"]
package.windows.packages = []
package.windows.dependencies = []
package.windows.build_dependencies = ["glib2", "gobject-introspection"]
package.external_packages = [
{
+ :name => "icu",
+ :download_base_url => "http://download.icu-project.org/files/icu4c/54.1",
+ :label => "gobject-introspection",
+ :base_name => "icu",
+ :archive_base_name => "icu4c-54_1-src.tgz",
+ :compression_method => "gz",
+ :base_dir_in_package => "source",
+ :windows => {
+ :configure_args => [
+ "--with-cross-build=#{package.package.tmp_dir}/native/icu/icu/source",
+ ],
+ :built_file => "bin/icu-config",
+ },
+ :native => {
+ :build => true,
+ :built_file => "bin/icu-config",
+ },
+ },
+ {
:name => "harfbuzz",
:download_base_url => "http://www.freedesktop.org/software/harfbuzz/release",
:label => "HarfBuzz",
- :version => "0.9.26",
+ :version => "0.9.35",
:compression_method => "bz2",
:windows => {
:configure_args => [
@@ -29,7 +48,7 @@ package_task = GNOME2::Rake::PackageTask.new do |package|
:name => "pango",
:download_site => :gnome,
:label => "pango",
- :version => "1.36.2",
+ :version => "1.36.8",
:compression_method => "xz",
:windows => {
:configure_args => [
@@ -44,20 +63,3 @@ package_task = GNOME2::Rake::PackageTask.new do |package|
]
end
package_task.define
-
-namespace :gcc do
- namespace :dll do
- desc "Bundle GCC related DLLs"
- task(:bundle) do
- dlls = ["libstdc++-6.dll"]
- dlls.each do |dll|
- host = package_task.windows.build_host
- binary_dir = package_task.windows.absolute_binary_dir
- full_path = `#{host}-g++ -print-file-name=#{dll}`.strip
- cp(full_path, (binary_dir + "bin").to_s)
- end
- end
- end
-end
-
-task "win32:builder:build:harfbuzz:after" => "gcc:dll:bundle"
diff --git a/pango/ext/pango/extconf.rb b/pango/ext/pango/extconf.rb
index 391c7df..44e4bd1 100644
--- a/pango/ext/pango/extconf.rb
+++ b/pango/ext/pango/extconf.rb
@@ -42,23 +42,11 @@ have_func("rb_errinfo", ruby_header)
:target_build_dir => build_dir)
end
-rcairo_options = {}
-rcairo_source_dir_names = ["rcairo"]
-if /mingw|cygwin|mswin/ =~ RUBY_PLATFORM
- rcairo_source_dir_names.unshift("rcairo.win32")
-end
-rcairo_source_dir_names.each do |rcairo_source_dir_name|
- rcairo_source_dir = top_dir.parent.expand_path + rcairo_source_dir_name
- if rcairo_source_dir.exist?
- rcairo_options[:rcairo_source_dir] = rcairo_source_dir.to_s
- break
- end
-end
-unless check_cairo(rcairo_options)
+unless check_cairo(:top_dir => top_dir)
exit(false)
end
-setup_win32(module_name, base_dir)
+setup_windows(module_name, base_dir)
unless required_pkg_config_package([package_id, 1, 14, 0],
:debian => "libpango1.0-dev",
diff --git a/poppler/Rakefile b/poppler/Rakefile
index 3561b29..8330487 100644
--- a/poppler/Rakefile
+++ b/poppler/Rakefile
@@ -22,13 +22,12 @@ require 'gnome2-raketask'
package_task = GNOME2::Rake::PackageTask.new do |package|
package.summary = "Ruby/Poppler is a Ruby binding of poppler-glib."
package.description = "Ruby/Poppler is a Ruby binding of poppler-glib."
- package.dependency.gem.runtime = [["cairo", ">= 1.12.8"], "gdk_pixbuf2"]
- package.win32.packages = []
- package.win32.dependencies = []
+ package.dependency.gem.runtime = [["cairo", ">= 1.14.0"], "gdk_pixbuf2"]
+ package.windows.packages = []
+ package.windows.dependencies = []
package.windows.build_dependencies = [
"glib2",
"gobject-introspection",
- "pango",
"gdk_pixbuf2",
]
package.windows.gobject_introspection_dependencies = [
@@ -37,8 +36,8 @@ package_task = GNOME2::Rake::PackageTask.new do |package|
package.external_packages = [
{
:name => "libjpeg",
- :base_name => "jpeg-9",
- :archive_base_name => "jpegsrc.v9.tar.gz",
+ :base_name => "jpeg-9a",
+ :archive_base_name => "jpegsrc.v9a.tar.gz",
:download_base_url => "http://www.ijg.org/files",
:label => "libjpeg",
:windows => {
@@ -48,9 +47,9 @@ package_task = GNOME2::Rake::PackageTask.new do |package|
},
{
:name => "sqlite-autoconf",
- :download_base_url => "http://www.sqlite.org/2013",
+ :download_base_url => "http://www.sqlite.org/2014",
:label => "SQLite",
- :version => "3080200",
+ :version => "3080600",
:compression_method => "gz",
:windows => {
:configure_args => [],
@@ -61,7 +60,7 @@ package_task = GNOME2::Rake::PackageTask.new do |package|
:name => "poppler",
:download_base_url => "http://poppler.freedesktop.org",
:label => "Poppler",
- :version => "0.24.5",
+ :version => "0.29.0",
:compression_method => "xz",
:windows => {
:configure_args => [
diff --git a/poppler/ext/poppler/extconf.rb b/poppler/ext/poppler/extconf.rb
index 5959e60..9308fc3 100644
--- a/poppler/ext/poppler/extconf.rb
+++ b/poppler/ext/poppler/extconf.rb
@@ -30,7 +30,7 @@ rescue LoadError
require 'mkmf-gnome2'
end
-["glib2", "atk", "pango", "gdk_pixbuf2"].each do |package|
+["glib2", "atk", "gdk_pixbuf2"].each do |package|
directory = "#{package}#{version_suffix}"
build_dir = "#{directory}/tmp/#{RUBY_PLATFORM}/#{package}/#{RUBY_VERSION}"
add_depend_package(package, "#{directory}/ext/#{package}",
@@ -39,29 +39,16 @@ end
:target_build_dir => build_dir)
end
-rcairo_options = {}
-rcairo_source_dir_names = ["rcairo"]
-if /mingw|cygwin|mswin/ =~ RUBY_PLATFORM
- rcairo_source_dir_names.unshift("rcairo.win32")
-end
-rcairo_source_dir_names.each do |rcairo_source_dir_name|
- rcairo_source_dir = top_dir.parent.expand_path + rcairo_source_dir_name
- if rcairo_source_dir.exist?
- rcairo_options[:rcairo_source_dir] = rcairo_source_dir.to_s
- break
- end
-end
-
-unless check_cairo(rcairo_options)
+unless check_cairo(:top_dir => top_dir)
exit(false)
end
-setup_win32(module_name, base_dir)
+setup_windows(module_name, base_dir)
unless required_pkg_config_package([package_id, 0, 12, 0],
:debian => "libpoppler-glib-dev",
:redhat => "poppler-glib-devel",
-# :homebrew => "poppler", # need --with-glib option
+ :homebrew => "poppler",
:macports => "poppler")
exit(false)
end
diff --git a/poppler/lib/poppler.rb b/poppler/lib/poppler.rb
index 5c44d8f..ab9f1e1 100644
--- a/poppler/lib/poppler.rb
+++ b/poppler/lib/poppler.rb
@@ -16,10 +16,7 @@ require "tempfile"
require "date"
require "glib2"
require "gdk_pixbuf2"
-begin
- require "cairo"
-rescue LoadError
-end
+require "cairo"
base_dir = Pathname.new(__FILE__).dirname.dirname.expand_path
vendor_dir = base_dir + "vendor" + "local"
diff --git a/poppler/test/test_annotation.rb b/poppler/test/test_annotation.rb
index 9e61dde..f9de429 100644
--- a/poppler/test/test_annotation.rb
+++ b/poppler/test/test_annotation.rb
@@ -79,6 +79,8 @@ class TestAnnotation < Test::Unit::TestCase
end
def assert_method_defined(object, method)
- assert_send([object, :method_defined?, method])
+ assert do
+ object.method_defined?(method)
+ end
end
end
diff --git a/poppler/test/test_page.rb b/poppler/test/test_page.rb
index 2d2fd29..bc187a5 100644
--- a/poppler/test/test_page.rb
+++ b/poppler/test/test_page.rb
@@ -30,24 +30,6 @@ class TestPage < Test::Unit::TestCase
assert_kind_of(Poppler::Annotation, mapping.annotation)
end
- def test_render
- only_poppler_version(0, 20, 0)
- document = Poppler::Document.new(image_pdf)
- page = document[0]
- png = StringIO.new
- png.set_encoding("ASCII-8BIT")
- Cairo::ImageSurface.new(:argb32, *page.size) do |surface|
- Cairo::Context.new(surface) do |context|
- page.render(context)
- end
- surface.write_to_png(png)
- end
- File.open(image_png, "rb") do |image|
- # TODO: support image diff
- assert_equal(image.read, png.string)
- end
- end
-
private
def find_first_image_mapping(document)
document.each do |page|
diff --git a/rsvg2/Rakefile b/rsvg2/Rakefile
index b733d56..bb0cc4f 100644
--- a/rsvg2/Rakefile
+++ b/rsvg2/Rakefile
@@ -52,14 +52,13 @@ package_task = GNOME2::Rake::PackageTask.new do |package|
:name => "librsvg",
:download_site => :gnome,
:label => "librsvg",
- :version => "2.40.1",
+ :version => "2.40.6",
:compression_method => "xz",
:windows => {
:configure_args => [
"--enable-introspection",
],
:patches => [
- "librsvg-2.40.1-replace-canonicalize-file-name.diff",
],
:built_file => "bin/librsvg-2-2.dll",
},
diff --git a/rsvg2/ext/rsvg2/extconf.rb b/rsvg2/ext/rsvg2/extconf.rb
index a698419..0e5b625 100644
--- a/rsvg2/ext/rsvg2/extconf.rb
+++ b/rsvg2/ext/rsvg2/extconf.rb
@@ -39,24 +39,11 @@ end
:target_build_dir => build_dir)
end
-rcairo_options = {}
-rcairo_source_dir_names = ["rcairo"]
-if /mingw|cygwin|mswin/ =~ RUBY_PLATFORM
- rcairo_source_dir_names.unshift("rcairo.win32")
-end
-rcairo_source_dir_names.each do |rcairo_source_dir_name|
- rcairo_source_dir = top_dir.parent.expand_path + rcairo_source_dir_name
- if rcairo_source_dir.exist?
- rcairo_options[:rcairo_source_dir] = rcairo_source_dir.to_s
- break
- end
-end
-
-unless check_cairo(rcairo_options)
+unless check_cairo(:top_dir => top_dir)
exit(false)
end
-setup_win32(module_name, base_dir)
+setup_windows(module_name, base_dir)
unless required_pkg_config_package(package_id,
:debian => "librsvg2-dev",
diff --git a/rsvg2/ext/rsvg2/rbrsvghandle.c b/rsvg2/ext/rsvg2/rbrsvghandle.c
index b0c3811..14ba5ab 100644
--- a/rsvg2/ext/rsvg2/rbrsvghandle.c
+++ b/rsvg2/ext/rsvg2/rbrsvghandle.c
@@ -109,13 +109,44 @@ rg_s_new_from_data(G_GNUC_UNUSED VALUE self, VALUE data)
}
static VALUE
-rg_s_new_from_file(G_GNUC_UNUSED VALUE self, VALUE file)
+rg_s_new_from_file(int argc, VALUE *argv, VALUE self)
{
+ VALUE rb_file_path, rb_options, rb_flags;
GError *error = NULL;
RsvgHandle *handle;
- handle = rsvg_handle_new_from_file((const gchar *)RVAL2CSTR(file),
+ rb_scan_args(argc, argv, "11", &rb_file_path, &rb_options);
+ rbg_scan_options(rb_options,
+ "flags", &rb_flags,
+ NULL);
+
+#if LIBRSVG_CHECK_VERSION(2, 40, 3)
+ {
+ GFile *file;
+ GCancellable *cancellable = NULL;
+ RsvgHandleFlags flags = RSVG_HANDLE_FLAGS_NONE;
+
+ if (!NIL_P(rb_flags)) {
+ flags = RVAL2GFLAGS(rb_flags, RSVG_TYPE_HANDLE_FLAGS);
+ }
+
+ file = g_file_new_for_path((const char *)RVAL2CSTR(rb_file_path));
+ handle = rsvg_handle_new_from_gfile_sync(file, flags,
+ cancellable,
+ &error);
+ g_object_unref(file);
+ }
+#else
+ if (!NIL_P(rb_flags)) {
+ rb_raise(rb_eArgError,
+ "librsvg 2.40.3 or later is required for :flags: <%d.%d.%d>",
+ LIBRSVG_MAJOR_VERSION,
+ LIBRSVG_MINOR_VERSION,
+ LIBRSVG_MICRO_VERSION);
+ }
+ handle = rsvg_handle_new_from_file((const gchar *)RVAL2CSTR(rb_file_path),
&error);
+#endif
if (error)
RAISE_GERROR(error);
@@ -232,21 +263,6 @@ rg_pixbuf(int argc, VALUE *argv, VALUE self)
return rb_pixbuf;
}
-#if LIBRSVG_CHECK_VERSION(2, 9, 0)
-static VALUE
-rg_base_uri(VALUE self)
-{
- return CSTR2RVAL(rsvg_handle_get_base_uri(_SELF(self)));
-}
-
-static VALUE
-rg_set_base_uri(VALUE self, VALUE base_uri)
-{
- rsvg_handle_set_base_uri(_SELF(self), RVAL2CSTR(base_uri));
- return self;
-}
-#endif
-
#ifdef HAVE_TYPE_RSVGDIMENSIONDATA
static VALUE
rg_dimensions(VALUE self)
@@ -266,6 +282,7 @@ rg_dimensions(VALUE self)
}
#endif
+#if !LIBRSVG_CHECK_VERSION(2, 36, 0)
/* Accessibility API */
static VALUE
rg_title(VALUE self)
@@ -279,12 +296,13 @@ rg_desc(VALUE self)
return CSTR2RVAL(rsvg_handle_get_desc(_SELF(self)));
}
-#ifdef HAVE_RSVG_HANDLE_GET_METADATA
+# ifdef HAVE_RSVG_HANDLE_GET_METADATA
static VALUE
rg_metadata(VALUE self)
{
return CSTR2RVAL(rsvg_handle_get_metadata(_SELF(self)));
}
+# endif
#endif
#if !LIBRSVG_CHECK_VERSION(2, 11, 0)
@@ -432,7 +450,7 @@ Init_rsvg_handle(VALUE mRSVG)
#if LIBRSVG_CHECK_VERSION(2, 14, 0)
RG_DEF_SMETHOD(new_from_data, 1);
- RG_DEF_SMETHOD(new_from_file, 1);
+ RG_DEF_SMETHOD(new_from_file, -1);
#endif
RG_DEF_METHOD(initialize, -1);
@@ -444,20 +462,17 @@ Init_rsvg_handle(VALUE mRSVG)
RG_DEF_METHOD_P(closed, 0);
RG_DEF_METHOD(pixbuf, -1);
-#if LIBRSVG_CHECK_VERSION(2, 9, 0)
- RG_DEF_METHOD(base_uri, 0);
- RG_DEF_METHOD(set_base_uri, 1);
-#endif
-
#ifdef HAVE_TYPE_RSVGDIMENSIONDATA
RG_DEF_METHOD(dimensions, 0);
#endif
+#if !LIBRSVG_CHECK_VERSION(2, 36, 0)
/* Accessibility API */
RG_DEF_METHOD(title, 0);
RG_DEF_METHOD(desc, 0);
-#ifdef HAVE_RSVG_HANDLE_GET_METADATA
+# ifdef HAVE_RSVG_HANDLE_GET_METADATA
RG_DEF_METHOD(metadata, 0);
+# endif
#endif
#if !LIBRSVG_CHECK_VERSION(2, 11, 0)
@@ -472,4 +487,10 @@ Init_rsvg_handle(VALUE mRSVG)
#ifdef HAVE_LIBRSVG_RSVG_CAIRO_H
RG_DEF_METHOD(render_cairo, -1);
#endif
+
+#if LIBRSVG_CHECK_VERSION(2, 40, 3)
+ /* RsvgHandleFlags */
+ G_DEF_CLASS(RSVG_TYPE_HANDLE_FLAGS, "Flags", RG_TARGET_NAMESPACE);
+ G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, RSVG_TYPE_HANDLE_FLAGS, "RSVG_HANDLE_");
+#endif
}
diff --git a/rsvg2/ext/rsvg2/rsvg2.h b/rsvg2/ext/rsvg2/rsvg2.h
index 0d70812..e50651e 100644
--- a/rsvg2/ext/rsvg2/rsvg2.h
+++ b/rsvg2/ext/rsvg2/rsvg2.h
@@ -49,14 +49,16 @@ extern "C" {
# include "librsvg-enum-types.h"
#endif
-#include <librsvg/librsvg-features.h>
-
#define LIBRSVG_CHECK_VERSION(major, minor, micro) \
(LIBRSVG_MAJOR_VERSION > (major) || \
(LIBRSVG_MAJOR_VERSION == (major) && LIBRSVG_MINOR_VERSION > (minor)) || \
(LIBRSVG_MAJOR_VERSION == (major) && LIBRSVG_MINOR_VERSION == (minor) && \
LIBRSVG_MICRO_VERSION >= (micro)))
+#if !LIBRSVG_CHECK_VERSION(2, 36, 2)
+# include <librsvg/librsvg-features.h>
+#endif
+
G_GNUC_INTERNAL void Init_rsvg_handle(VALUE mRSVG);
G_GNUC_INTERNAL void Init_rsvg_dimensiondata(VALUE mRSVG);
diff --git a/rsvg2/patches/librsvg-2.40.1-replace-canonicalize-file-name.diff b/rsvg2/patches/librsvg-2.40.1-replace-canonicalize-file-name.diff
deleted file mode 100644
index 11bf6c0..0000000
--- a/rsvg2/patches/librsvg-2.40.1-replace-canonicalize-file-name.diff
+++ /dev/null
@@ -1,75 +0,0 @@
-https://bugzilla.gnome.org/attachment.cgi?id=258810
---- a/rsvg-base.c 2013-05-11 05:19:07.000000000 -0400
-+++ b/rsvg-base.c 2013-11-02 13:01:46.446835464 -0400
-@@ -2151,9 +2151,8 @@
- GError **error)
- {
- RsvgHandlePrivate *priv = handle->priv;
-- GFile *base;
-- char *path, *dir;
-- char *scheme = NULL, *cpath = NULL, *cdir = NULL;
-+ GFile *base = NULL, *urifile = NULL;
-+ char *scheme = NULL;
-
- g_assert (handle->priv->load_policy == RSVG_LOAD_POLICY_STRICT);
-
-@@ -2183,47 +2182,35 @@
- if (!g_str_equal (scheme, "file"))
- goto deny;
-
-+ /* Ensure that uri is under the file's base directory */
- base = g_file_get_parent (priv->base_gfile);
- if (base == NULL)
- goto deny;
-
-- dir = g_file_get_path (base);
-- g_object_unref (base);
--
-- /* FIXME portability */
-- cdir = canonicalize_file_name (dir);
-- g_free (dir);
-- if (cdir == NULL)
-+ urifile = g_file_new_for_uri (uri);
-+ if (urifile == NULL)
- goto deny;
-
-- path = g_filename_from_uri (uri, NULL, NULL);
-- if (path == NULL)
-- goto deny;
--
-- /* FIXME portability */
-- cpath = canonicalize_file_name (path);
-- g_free (path);
--
-- if (cpath == NULL)
-+ if (!g_file_has_prefix (urifile, base))
- goto deny;
-
-- /* Now check that @cpath is below @cdir */
-- if (!g_str_has_prefix (cpath, cdir) ||
-- cpath[strlen (cdir)] != G_DIR_SEPARATOR)
-- goto deny;
-+ g_object_unref (urifile);
-+ g_object_unref (base);
-
- /* Allow load! */
-
- allow:
- g_free (scheme);
-- free (cpath);
-- free (cdir);
- return TRUE;
-
- deny:
- g_free (scheme);
-- free (cpath);
-- free (cdir);
-+
-+ if (urifile)
-+ g_object_unref (urifile);
-+
-+ if (base)
-+ g_object_unref (base);
-
- g_set_error (error, G_IO_ERROR, G_IO_ERROR_PERMISSION_DENIED,
- "File may not link to URI \"%s\"", uri);
diff --git a/webkit-gtk2/test/webkit-gtk-test-utils.rb b/rsvg2/test/rsvg2-test-utils.rb
similarity index 89%
copy from webkit-gtk2/test/webkit-gtk-test-utils.rb
copy to rsvg2/test/rsvg2-test-utils.rb
index 4dd02d7..1126318 100644
--- a/webkit-gtk2/test/webkit-gtk-test-utils.rb
+++ b/rsvg2/test/rsvg2-test-utils.rb
@@ -1,4 +1,4 @@
-# Copyright (C) 2013 Ruby-GNOME2 Project Team
+# Copyright (C) 2014 Ruby-GNOME2 Project Team
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -17,5 +17,7 @@
require "test-unit"
require "test/unit/notify"
-module WebKitGtkTestUtils
+require "fileutils"
+
+module RSVG2TestUtils
end
diff --git a/gdk3/test/run-test.rb b/rsvg2/test/run-test.rb
similarity index 69%
copy from gdk3/test/run-test.rb
copy to rsvg2/test/run-test.rb
index 4ea4d6f..5993bf4 100755
--- a/gdk3/test/run-test.rb
+++ b/rsvg2/test/run-test.rb
@@ -1,6 +1,6 @@
#!/usr/bin/env ruby
#
-# Copyright (C) 2013 Ruby-GNOME2 Project Team
+# Copyright (C) 2014 Ruby-GNOME2 Project Team
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -20,17 +20,18 @@ ruby_gnome2_base = File.join(File.dirname(__FILE__), "..", "..")
ruby_gnome2_base = File.expand_path(ruby_gnome2_base)
glib_base = File.join(ruby_gnome2_base, "glib2")
-atk_base = File.join(ruby_gnome2_base, "atk")
-pango_base = File.join(ruby_gnome2_base, "pango")
-gdk_pixbuf_base = File.join(ruby_gnome2_base, "gdk_pixbuf2")
-gdk3_base = File.join(ruby_gnome2_base, "gdk3")
-
-[[glib_base, "glib2"],
- [atk_base, "atk"],
- [pango_base, "pango"],
- [gdk_pixbuf_base, "gdk_pixbuf2"],
- [gdk3_base, "gdk3"]].each do |target, module_name|
- if system("which make > /dev/null")
+gdk_pixbuf2_base = File.join(ruby_gnome2_base, "gdk_pixbuf2")
+rsvg2_base = File.join(ruby_gnome2_base, "rsvg2")
+
+have_make = system("which make > /dev/null")
+
+modules = [
+ [glib_base, "glib2"],
+ [gdk_pixbuf2_base, "gdk_pixbuf2"],
+ [rsvg2_base, "rsvg2"],
+]
+modules.each do |target, module_name|
+ if File.exist?(File.join(target, "Makefile")) and have_make
`make -C #{target.dump} > /dev/null` or exit(false)
end
$LOAD_PATH.unshift(File.join(target, "ext", module_name))
@@ -40,9 +41,9 @@ end
$LOAD_PATH.unshift(File.join(glib_base, "test"))
require "glib-test-init"
-$LOAD_PATH.unshift(File.join(gdk3_base, "test"))
-require "gdk-test-utils"
+$LOAD_PATH.unshift(File.join(rsvg2_base, "test"))
+require "rsvg2-test-utils"
-require "gdk3"
+require "rsvg2"
exit Test::Unit::AutoRunner.run(true)
diff --git a/rsvg2/test/test-handle.rb b/rsvg2/test/test-handle.rb
new file mode 100644
index 0000000..0609cad
--- /dev/null
+++ b/rsvg2/test/test-handle.rb
@@ -0,0 +1,91 @@
+# Copyright (C) 2014 Ruby-GNOME2 Project Team
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+class TestHandle < Test::Unit::TestCase
+ sub_test_case ".new_from_file" do
+ sub_test_case "options" do
+ def setup
+ setup_svg
+ end
+
+ def setup_svg
+ @svg_path = "tmp/empty.svg"
+ return if File.exist?(@svg_path)
+
+ FileUtils.mkdir_p(File.dirname(@svg_path))
+ File.open(@svg_path, "w") do |svg|
+ svg.puts(<<-SVG)
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg>
+</svg>
+ SVG
+ end
+ end
+
+ def test_empty_options
+ handle = RSVG::Handle.new_from_file(@svg_path, {})
+ assert_equal([0, 0, 0.0, 0.0],
+ handle.dimensions.to_a)
+ end
+ end
+
+ sub_test_case ":flags => :unlimited" do
+ def setup
+ setup_large_svg
+ end
+
+ def setup_large_svg
+ @large_svg_path = "tmp/large-file.svg"
+ return if File.exist?(@large_svg_path)
+
+ FileUtils.mkdir_p(File.dirname(@large_svg_path))
+ large_byte = (10 * 1024 * 1024).to_i
+ File.open(@large_svg_path, "w") do |svg|
+ svg.puts(<<-SVG_HEADER)
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg>
+ SVG_HEADER
+ large_byte.times do
+ svg.puts("\n")
+ end
+ svg.puts(<<-SVG_FOOTER)
+</svg>
+ SVG_FOOTER
+ end
+ end
+
+ def test_no_option
+ assert_raise(RSVG::Error::Failed) do
+ RSVG::Handle.new_from_file(@large_svg_path)
+ end
+ end
+
+ def test_unlimited
+ handle = RSVG::Handle.new_from_file(@large_svg_path,
+ :flags => :flag_unlimited)
+ assert_equal([0, 0, 0.0, 0.0],
+ handle.dimensions.to_a)
+ end
+
+ def test_base_uri
+ handle = RSVG::Handle.new
+ uri_string = "test_base_uri"
+ handle.base_uri = uri_string
+ assert_match(uri_string, handle.base_uri)
+ end
+ end
+ end
+end
diff --git a/run-test.rb b/run-test.rb
index b5fcbbd..2bf664e 100755
--- a/run-test.rb
+++ b/run-test.rb
@@ -28,10 +28,9 @@ Pathname.glob((base_dir + "*").to_s) do |dir|
end
ignored_modules = [
- "gstreamer",
"gstreamer-no-gi",
- "webkit-gtk",
- "webkit-gtk2",
+ "gdk3-no-gi",
+ "gtk3-gi",
]
succeeded = true
diff --git a/vte/Rakefile b/vte/Rakefile
index 1174201..2d13172 100644
--- a/vte/Rakefile
+++ b/vte/Rakefile
@@ -1,14 +1,14 @@
# -*- ruby -*-
$LOAD_PATH.unshift("./../glib2/lib")
-require 'gnome2-raketask'
+require 'gnome2/rake/package-task'
-package = GNOME2Package.new do |_package|
- _package.summary = "Ruby/VTE is a Ruby binding of VTE."
- _package.description = "Ruby/VTE is a Ruby binding of VTE."
- _package.dependency.gem.runtime = ["gtk2"]
- _package.win32.packages = []
- _package.win32.dependencies = []
+package_task = GNOME2::Rake::PackageTask.new do |package|
+ package.summary = "Ruby/VTE is a Ruby binding of VTE."
+ package.description = "Ruby/VTE is a Ruby binding of VTE."
+ package.dependency.gem.runtime = ["gtk2"]
+ package.windows.packages = []
+ package.windows.dependencies = []
end
-package.define_tasks
+package_task.define
diff --git a/vte/ext/vte/extconf.rb b/vte/ext/vte/extconf.rb
index 4bd49f0..e5e3928 100644
--- a/vte/ext/vte/extconf.rb
+++ b/vte/ext/vte/extconf.rb
@@ -30,7 +30,7 @@ rescue LoadError
require 'mkmf-gnome2'
end
-setup_win32(module_name, base_dir)
+setup_windows(module_name, base_dir)
unless required_pkg_config_package(package_id,
:debian => "libvte-dev",
diff --git a/vte3/Rakefile b/vte3/Rakefile
index 585a1b9..09bae50 100644
--- a/vte3/Rakefile
+++ b/vte3/Rakefile
@@ -1,18 +1,18 @@
# -*- ruby -*-
$LOAD_PATH.unshift("./../glib2/lib")
-require 'gnome2-raketask'
+require 'gnome2/rake/package-task'
-package = GNOME2Package.new do |_package|
- _package.summary = "Ruby/VTE is a Ruby binding of VTE."
- _package.description = "Ruby/VTE is a Ruby binding of VTE."
- _package.dependency.gem.runtime = ["gtk3"]
- _package.win32.packages = []
- _package.win32.dependencies = []
- _package.win32.build_dependencies = [
+package_task = GNOME2::Rake::PackageTask.new do |package|
+ package.summary = "Ruby/VTE is a Ruby binding of VTE."
+ package.description = "Ruby/VTE is a Ruby binding of VTE."
+ package.dependency.gem.runtime = ["gtk3"]
+ package.windows.packages = []
+ package.windows.dependencies = []
+ package.windows.build_dependencies = [
"glib2", "atk", "pango", "gdk_pixbuf2", "gdk3",
]
- _package.win32.build_packages = [
+ package.windows.build_packages = [
# {
# :name => "ncurses",
# :download_base_url => "http://ftp.gnu.org/pub/gnu/ncurses",
@@ -40,7 +40,7 @@ package = GNOME2Package.new do |_package|
# :compression_method => "xz",
# }
]
- _package.post_install_message = "This library is experimental."
+ package.post_install_message = "This library is experimental."
end
-package.define_tasks
+package_task.define
diff --git a/vte3/ext/vte3/extconf.rb b/vte3/ext/vte3/extconf.rb
index 1fccf43..dc36171 100644
--- a/vte3/ext/vte3/extconf.rb
+++ b/vte3/ext/vte3/extconf.rb
@@ -34,11 +34,12 @@ setup_win32(module_name, base_dir)
unless required_pkg_config_package([package_id, 0, 26, 0],
:debian => "libvte-2.90-dev",
- :redhat => "vte3-devel")
+ :redhat => "vte3-devel",
+ :homebrew => "vte3")
exit(false)
end
-["glib2", "atk", "pango", "gdk3", "gtk3"].each do |package|
+["glib2", "atk", "pango", "gtk3"].each do |package|
directory = "#{package}#{version_suffix}"
build_dir = "#{directory}/tmp/#{RUBY_PLATFORM}/#{package}/#{RUBY_VERSION}"
add_depend_package(package, "#{directory}/ext/#{package}",
@@ -64,4 +65,3 @@ if pkg_config_dir.is_a?(String)
makefile.puts("pkgconfigdir=#{pkg_config_dir}")
end
end
-
diff --git a/vte3/ext/vte3/rbvte.c b/vte3/ext/vte3/rbvte.c
index 2dd5f05..d56b1d9 100644
--- a/vte3/ext/vte3/rbvte.c
+++ b/vte3/ext/vte3/rbvte.c
@@ -38,6 +38,10 @@ Init_vte3(void)
INT2FIX(VTE_MICRO_VERSION)));
G_DEF_CLASS(VTE_TYPE_TERMINAL_ANTI_ALIAS, "TerminalAntiAlias", RG_TARGET_NAMESPACE);
+ G_DEF_CLASS(VTE_TYPE_TERMINAL_ERASE_BINDING, "TerminalEraseBinding", RG_TARGET_NAMESPACE);
+ G_DEF_CLASS(VTE_TYPE_TERMINAL_CURSOR_BLINK_MODE, "TerminalCursorBlinkMode", RG_TARGET_NAMESPACE);
+ G_DEF_CLASS(VTE_TYPE_TERMINAL_CURSOR_SHAPE, "TerminalCursorShape", RG_TARGET_NAMESPACE);
+ G_DEF_CLASS(VTE_TYPE_TERMINAL_WRITE_FLAGS, "TerminalWriteFlags", RG_TARGET_NAMESPACE);
Init_vte_access(RG_TARGET_NAMESPACE);
Init_vte_reaper(RG_TARGET_NAMESPACE);
diff --git a/vte3/ext/vte3/rbvte3conversions.h b/vte3/ext/vte3/rbvte3conversions.h
index 56641d6..bc3e357 100644
--- a/vte3/ext/vte3/rbvte3conversions.h
+++ b/vte3/ext/vte3/rbvte3conversions.h
@@ -42,4 +42,13 @@
#define RVAL2GCANCELLABLE(o) (G_CANCELLABLE(RVAL2GOBJ(o)))
#define RVAL2GOUTPUTSTREAM(o) (G_OUTPUT_STREAM(RVAL2GOBJ(o)))
+/* For GDK3. They are temporary. They will be needless after Ruby/GDK3
+ * is based on Ruby/GObjectIntrospection.
+ */
+#define RVAL2GDKPIXBUF(o) (GDK_PIXBUF(RVAL2GOBJ(o)))
+#define RVAL2GDKCOLOR(o) ((GdkColor*)RVAL2BOXED(o, GDK_TYPE_COLOR))
+#define GDKCOLOR2RVAL(o) (BOXED2RVAL(o, GDK_TYPE_COLOR))
+#define RVAL2GDKCURSOR(o) ((GdkCursor*)RVAL2BOXED(o, GDK_TYPE_CURSOR))
+#define RVAL2GDKCURSORTYPE(o) (RVAL2GENUM(o, GDK_TYPE_CURSOR_TYPE))
+
#endif /* __RBVTE3CONVERSIONS_H__ */
diff --git a/vte3/ext/vte3/rbvte3private.h b/vte3/ext/vte3/rbvte3private.h
index 8480493..79fde0e 100644
--- a/vte3/ext/vte3/rbvte3private.h
+++ b/vte3/ext/vte3/rbvte3private.h
@@ -7,7 +7,6 @@
#include <ruby.h>
#include <rbpango.h>
-#include <rbgdk3.h>
#include <rbgtk3.h>
#include "rbvte3conversions.h"
#ifndef VTE_CHECK_VERSION
diff --git a/vte3/ext/vte3/rbvteterminal.c b/vte3/ext/vte3/rbvteterminal.c
index fe538db..a723d5d 100644
--- a/vte3/ext/vte3/rbvteterminal.c
+++ b/vte3/ext/vte3/rbvteterminal.c
@@ -280,6 +280,21 @@ rg_set_scroll_on_keystroke(VALUE self, VALUE scroll)
return self;
}
+#if VTE_CHECK_VERSION(0, 36, 0)
+static VALUE
+rg_rewrap_on_resize_p(VALUE self)
+{
+ return CBOOL2RVAL(vte_terminal_get_rewrap_on_resize(_SELF(self)));
+}
+
+static VALUE
+rg_set_rewrap_on_resize(VALUE self, VALUE rewrap)
+{
+ vte_terminal_set_rewrap_on_resize(_SELF(self), RVAL2CBOOL(rewrap));
+ return self;
+}
+#endif
+
static VALUE
rg_set_color_dim(VALUE self, VALUE dim)
{
@@ -894,6 +909,11 @@ Init_vte_terminal(VALUE mVte)
RG_DEF_METHOD(set_scroll_on_output, 1);
RG_DEF_METHOD(set_scroll_on_keystroke, 1);
+#if VTE_CHECK_VERSION(0, 36, 0)
+ RG_DEF_METHOD_P(rewrap_on_resize, 0);
+ RG_REPLACE_SET_PROPERTY(rewrap_on_resize, 1);
+#endif
+
RG_DEF_METHOD(set_color_dim, 1);
RG_DEF_METHOD(set_color_bold, 1);
RG_DEF_METHOD(set_color_foreground, 1);
diff --git a/vte3/lib/vte3/deprecated.rb b/vte3/lib/vte3/deprecated.rb
index 4dd3956..94aca57 100644
--- a/vte3/lib/vte3/deprecated.rb
+++ b/vte3/lib/vte3/deprecated.rb
@@ -1,11 +1,13 @@
module Vte
extend GLib::Deprecatable
- define_deprecated_const :TerminalEraseBinding, 'Vte::Terminal::EraseBinding'
- define_deprecated_const :TerminalCursorBlinkMode, 'Vte::Terminal::CursorBlinkMode'
- define_deprecated_const :TerminalCursorShape, 'Vte::Terminal::CursorShape'
class Terminal
extend GLib::Deprecatable
+ define_deprecated_const :EraseBinding, 'Vte::TerminalEraseBinding'
+ define_deprecated_const :CursorBlinkMode, 'Vte::TerminalCursorBlinkMode'
+ define_deprecated_const :CursorShape, 'Vte::TerminalCursorShape'
+ define_deprecated_const :WriteFlags, 'Vte::TerminalWriteFlags'
+
define_deprecated_method :match_set_cursor_type, :match_set_cursor
define_deprecated_method :fork_pty, :raise => "Use 'Vte::Pty#fork'."
define_deprecated_method :using_xft?, :warn => "Don't use this method." do |_self|
@@ -41,4 +43,3 @@ module Vte
end
end
end
-
diff --git a/webkit-gtk/Rakefile b/webkit-gtk/Rakefile
index d6751a9..635561b 100644
--- a/webkit-gtk/Rakefile
+++ b/webkit-gtk/Rakefile
@@ -1,6 +1,6 @@
# -*- ruby -*-
#
-# Copyright (C) 2013 Ruby-GNOME2 Project Team
+# Copyright (C) 2013-2014 Ruby-GNOME2 Project Team
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -32,7 +32,6 @@ package_task = GNOME2::Rake::PackageTask.new do |package|
"atk",
"pango",
"gdk_pixbuf2",
- "gtk2",
"gdk3",
"gstreamer",
]
@@ -46,8 +45,8 @@ package_task = GNOME2::Rake::PackageTask.new do |package|
package.external_packages = [
# {
# :name => "libjpeg",
- # :base_name => "jpeg-9",
- # :archive_base_name => "jpegsrc.v9.tar.gz",
+ # :base_name => "jpeg-9a",
+ # :archive_base_name => "jpegsrc.v9a.tar.gz",
# :download_base_url => "http://www.ijg.org/files",
# :label => "libjpeg",
# :windows => {
@@ -59,16 +58,16 @@ package_task = GNOME2::Rake::PackageTask.new do |package|
# :name => "libwebp",
# :download_base_url => "https://webp.googlecode.com/files",
# :label => "WebP",
- # :version => "0.3.1",
+ # :version => "0.4.0",
# :windows => {
- # :built_file => "bin/libwebp-4.dll",
+ # :built_file => "bin/libwebp-5.dll",
# },
# },
# {
# :name => "sqlite-autoconf",
- # :download_base_url => "http://www.sqlite.org/2013",
+ # :download_base_url => "http://www.sqlite.org/2014",
# :label => "SQLite",
- # :version => "3080200",
+ # :version => "3080600",
# :compression_method => "gz",
# :windows => {
# :configure_args => [],
@@ -79,7 +78,7 @@ package_task = GNOME2::Rake::PackageTask.new do |package|
# :name => "libsoup",
# :download_site => :gnome,
# :label => "libsoup",
- # :version => "2.45.3",
+ # :version => "2.48.0",
# :compression_method => "xz",
# :windows => {
# :configure_args => [
@@ -87,6 +86,9 @@ package_task = GNOME2::Rake::PackageTask.new do |package|
# "--without-apache-httpd",
# ],
# :build_concurrently => false,
+ # :patches => [
+ # "libsoup-2.48.0-remove-nonexistent-symbol.diff",
+ # ],
# :built_file => "bin/libsoup-2.4-1.dll",
# },
# },
@@ -119,20 +121,19 @@ package_task = GNOME2::Rake::PackageTask.new do |package|
# :name => "webkitgtk",
# :download_base_url => "http://webkitgtk.org/releases",
# :label => "WebKitGTK+",
- # :version => "2.2.3",
+ # :version => "2.6.0",
# :compression_method => "xz",
# :windows => {
- # :configure_args => [
- # "--enable-introspection",
- # "--with-target=win32",
- # "--disable-credential-storage",
- # "--disable-geolocation",
- # "--disable-webkit2",
+ # :cmake_args => [
+ # "-DPORT=GTK",
+ # "-DJPEG_INCLUDE_DIR=#{package.windows.absolute_binary_dir}/include",
+ # "-DJPEG_LIBRARY=#{package.windows.absolute_binary_dir}/lib",
+ # "-DENABLE_PLUGIN_PROCESS_GTK2=OFF",
+ # "-DENABLE_X11_TARGET=OFF",
# ],
# :patches => [
- # "webkitgtk-2.2.3-buildable.diff",
+ # "webkitgtk-2.6.0-buildable.diff",
# ],
- # :need_autoreconf => true,
# },
# },
]
diff --git a/webkit-gtk/patches/libsoup-2.48.0-remove-nonexistent-symbol.diff b/webkit-gtk/patches/libsoup-2.48.0-remove-nonexistent-symbol.diff
new file mode 100644
index 0000000..e2e71fc
--- /dev/null
+++ b/webkit-gtk/patches/libsoup-2.48.0-remove-nonexistent-symbol.diff
@@ -0,0 +1,11 @@
+diff -ru libsoup-2.48.0.orig/libsoup/libsoup-2.4.sym libsoup-2.48.0/libsoup/libsoup-2.4.sym
+--- libsoup-2.48.0.orig/libsoup/libsoup-2.4.sym 2014-06-18 23:42:51.000000000 +0900
++++ libsoup-2.48.0/libsoup/libsoup-2.4.sym 2014-10-06 21:29:02.421366897 +0900
+@@ -348,7 +348,6 @@
+ soup_server_get_async_context
+ soup_server_get_listener
+ soup_server_get_listeners
+-soup_server_get_gsocket
+ soup_server_get_port
+ soup_server_get_type
+ soup_server_get_uris
diff --git a/webkit-gtk/patches/webkitgtk-2.2.3-buildable.diff b/webkit-gtk/patches/webkitgtk-2.2.3-buildable.diff
deleted file mode 100644
index 1f06baa..0000000
--- a/webkit-gtk/patches/webkitgtk-2.2.3-buildable.diff
+++ /dev/null
@@ -1,63 +0,0 @@
-diff -ru webkitgtk-2.2.3.orig/Source/WTF/wtf/Atomics.h webkitgtk-2.2.3/Source/WTF/wtf/Atomics.h
---- webkitgtk-2.2.3.orig/Source/WTF/wtf/Atomics.h 2013-12-02 17:11:56.000000000 +0900
-+++ webkitgtk-2.2.3/Source/WTF/wtf/Atomics.h 2013-12-28 21:57:07.695695396 +0900
-@@ -66,7 +66,7 @@
- #if OS(WINCE)
- #include <cmnintrin.h>
- #else
--extern "C" void _ReadWriteBarrier(void);
-+#include <intrin.h>
- #pragma intrinsic(_ReadWriteBarrier)
- #endif
- #include <windows.h>
-@@ -288,7 +288,7 @@
- : "memory"
- );
- return result;
--#elif OS(WINDOWS) && CPU(X86)
-+#elif OS(WINDOWS) && CPU(X86) && 0
- // FIXME: We need a 64-bit ASM implementation, but this cannot be inline due to
- // Microsoft's decision to exclude it from the compiler.
- bool result = false;
-diff -ru webkitgtk-2.2.3.orig/Source/WTF/wtf/Platform.h webkitgtk-2.2.3/Source/WTF/wtf/Platform.h
---- webkitgtk-2.2.3.orig/Source/WTF/wtf/Platform.h 2013-12-02 17:11:56.000000000 +0900
-+++ webkitgtk-2.2.3/Source/WTF/wtf/Platform.h 2013-12-28 19:43:58.588605855 +0900
-@@ -629,7 +629,7 @@
- #define HAVE_ISDEBUGGERPRESENT 1
-
- #if !PLATFORM(QT)
--#include <WTF/WTFHeaderDetection.h>
-+/* #include <WTF/WTFHeaderDetection.h> */
- #endif
-
- #endif
-diff -ru webkitgtk-2.2.3.orig/Source/WTF/wtf/threads/BinarySemaphore.cpp webkitgtk-2.2.3/Source/WTF/wtf/threads/BinarySemaphore.cpp
---- webkitgtk-2.2.3.orig/Source/WTF/wtf/threads/BinarySemaphore.cpp 2013-08-04 01:10:38.000000000 +0900
-+++ webkitgtk-2.2.3/Source/WTF/wtf/threads/BinarySemaphore.cpp 2013-12-28 21:59:06.784816965 +0900
-@@ -26,7 +26,7 @@
- #include "config.h"
- #include "BinarySemaphore.h"
-
--#if !PLATFORM(WIN)
-+#if !OS(WINDOWS)
-
- namespace WTF {
-
-@@ -65,4 +65,4 @@
-
- } // namespace WTF
-
--#endif // !PLATFORM(WIN)
-+#endif // !OS(WINDOWS)
-diff -ru webkitgtk-2.2.3.orig/Source/autotools/FindDependencies.m4 webkitgtk-2.2.3/Source/autotools/FindDependencies.m4
---- webkitgtk-2.2.3.orig/Source/autotools/FindDependencies.m4 2013-12-02 17:11:58.000000000 +0900
-+++ webkitgtk-2.2.3/Source/autotools/FindDependencies.m4 2013-12-28 22:17:46.537935727 +0900
-@@ -110,7 +110,7 @@
- ;;
- *-*-mingw*)
- UNICODE_CFLAGS=""
-- UNICODE_LIBS="-licui18n -licuuc"
-+ UNICODE_LIBS="-licuuc"
- AC_CHECK_HEADERS([unicode/uchar.h], [], [AC_MSG_ERROR([Could not find ICU headers.])])
- ;;
- *)
diff --git a/webkit-gtk/patches/webkitgtk-2.6.0-buildable.diff b/webkit-gtk/patches/webkitgtk-2.6.0-buildable.diff
new file mode 100644
index 0000000..6376812
--- /dev/null
+++ b/webkit-gtk/patches/webkitgtk-2.6.0-buildable.diff
@@ -0,0 +1,20 @@
+diff -ru webkitgtk-2.6.0.orig/Source/cmake/FindFontconfig.cmake webkitgtk-2.6.0/Source/cmake/FindFontconfig.cmake
+--- webkitgtk-2.6.0.orig/Source/cmake/FindFontconfig.cmake 2013-08-04 01:10:40.000000000 +0900
++++ webkitgtk-2.6.0/Source/cmake/FindFontconfig.cmake 2014-10-07 23:40:10.515822164 +0900
+@@ -39,14 +39,14 @@
+
+ else (FONTCONFIG_LIBRARIES AND FONTCONFIG_INCLUDE_DIR)
+
+- if (NOT WIN32)
++ # if (NOT WIN32)
+ # use pkg-config to get the directories and then use these values
+ # in the find_path() and find_library() calls
+ find_package(PkgConfig)
+ pkg_check_modules(PC_FONTCONFIG fontconfig)
+
+ set(FONTCONFIG_DEFINITIONS ${PC_FONTCONFIG_CFLAGS_OTHER})
+- endif (NOT WIN32)
++ # endif (NOT WIN32)
+
+ find_path(FONTCONFIG_INCLUDE_DIR fontconfig/fontconfig.h
+ PATHS
diff --git a/webkit-gtk/test/run-test.rb b/webkit-gtk/test/run-test.rb
index ea435d4..4ee40c1 100755
--- a/webkit-gtk/test/run-test.rb
+++ b/webkit-gtk/test/run-test.rb
@@ -27,6 +27,7 @@ gdk_pixbuf_base = File.join(ruby_gnome2_base, "gdk_pixbuf2")
gdk3_base = File.join(ruby_gnome2_base, "gdk3")
gtk3_base = File.join(ruby_gnome2_base, "gtk3")
gobject_introspection_base = File.join(ruby_gnome2_base, "gobject-introspection")
+cairo_gobject_base = File.join(ruby_gnome2_base, "cairo-gobject")
webkit_gtk_base = File.join(ruby_gnome2_base, "webkit-gtk")
modules = [
@@ -38,6 +39,7 @@ modules = [
[gdk3_base, "gdk3"],
[gtk3_base, "gtk3"],
[gobject_introspection_base, "gobject-introspection"],
+ [cairo_gobject_base, "cairo-gobject"],
[webkit_gtk_base, "webkit-gtk"],
]
modules.each do |target, module_name|
diff --git a/gio2/lib/gio2/output-stream.rb b/webkit-gtk/test/test_webkit_gtk_webview.rb
similarity index 80%
copy from gio2/lib/gio2/output-stream.rb
copy to webkit-gtk/test/test_webkit_gtk_webview.rb
index d686699..3d99f02 100644
--- a/gio2/lib/gio2/output-stream.rb
+++ b/webkit-gtk/test/test_webkit_gtk_webview.rb
@@ -14,11 +14,13 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-module Gio
- class OutputStream
- alias_method :write_raw, :write
- def write(data)
- write_raw(data, data.bytesize)
+class TestWebKitGtkWebView < Test::Unit::TestCase
+ include WebKitGtkTestUtils::Omissions
+
+ def test_webkit_gtk_webview
+ omit_on_os_x
+ assert_nothing_raised do
+ WebKitGtk::WebView.new
end
end
end
diff --git a/webkit-gtk/test/webkit-gtk-test-utils.rb b/webkit-gtk/test/webkit-gtk-test-utils.rb
index 4dd02d7..fd3649a 100644
--- a/webkit-gtk/test/webkit-gtk-test-utils.rb
+++ b/webkit-gtk/test/webkit-gtk-test-utils.rb
@@ -17,5 +17,23 @@
require "test-unit"
require "test/unit/notify"
+require "webkit-gtk-test-utils/omissions"
+
module WebKitGtkTestUtils
+ def later_version?(major, minor, micro=nil)
+ micro ||= 0
+ webkit_gtk_version = [
+ WebKitGtk::MAJOR_VERSION,
+ WebKitGtk::MINOR_VERSION,
+ WebKitGtk::MICRO_VERSION,
+ ]
+ (webkit_gtk_version <=> [major, minor, micro]) >= 0
+ end
+
+ def only_webkit_gtk_version(major, minor, micro=nil)
+ micro ||= 0
+ unless later_version?(major, minor, micro)
+ omit("Require WebKitGtk >= #{major}.#{minor}.#{micro}")
+ end
+ end
end
diff --git a/gio2/lib/gio2/output-stream.rb b/webkit-gtk/test/webkit-gtk-test-utils/omissions.rb
similarity index 85%
copy from gio2/lib/gio2/output-stream.rb
copy to webkit-gtk/test/webkit-gtk-test-utils/omissions.rb
index d686699..be0c819 100644
--- a/gio2/lib/gio2/output-stream.rb
+++ b/webkit-gtk/test/webkit-gtk-test-utils/omissions.rb
@@ -14,11 +14,10 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-module Gio
- class OutputStream
- alias_method :write_raw, :write
- def write(data)
- write_raw(data, data.bytesize)
+module WebKitGtkTestUtils
+ module Omissions
+ def omit_on_os_x
+ omit("Skip this test on OS X") if RUBY_PLATFORM =~ /darwin/
end
end
end
diff --git a/webkit-gtk2/Rakefile b/webkit-gtk2/Rakefile
index e021bcb..f787ce5 100644
--- a/webkit-gtk2/Rakefile
+++ b/webkit-gtk2/Rakefile
@@ -17,20 +17,19 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
$LOAD_PATH.unshift("./../glib2/lib")
-require "gnome2-raketask"
+require "gnome2/rake/package-task"
-
-package = GNOME2Package.new do |_package|
- _package.summary = "Ruby/WebKitGtk2 is a Ruby binding of WebKitGTK+ for Gtk 2.0 Toolkit"
- _package.description = "Ruby/WebKitGtk2 is a Ruby binding of WebKitGTK+ for Gtk 2.0 Toolkit"
- _package.dependency.gem.runtime = ["gobject-introspection", "gtk2"]
- _package.dependency.gem.development = ["test-unit-notify"]
- _package.win32.packages = []
- _package.win32.dependencies = []
- _package.win32.build_dependencies = ["glib2", "gobject-introspection"]
- _package.win32.build_packages = []
+package_task = GNOME2::Rake::PackageTask.new do |package|
+ package.summary = "Ruby/WebKitGtk2 is a Ruby binding of WebKitGTK+ for Gtk 2.0 Toolkit"
+ package.description = "Ruby/WebKitGtk2 is a Ruby binding of WebKitGTK+ for Gtk 2.0 Toolkit"
+ package.dependency.gem.runtime = ["gobject-introspection", "gtk2"]
+ package.dependency.gem.development = ["test-unit-notify"]
+ package.windows.packages = []
+ package.windows.dependencies = []
+ package.windows.build_dependencies = ["glib2", "gobject-introspection"]
+ package.windows.build_packages = []
end
-package.define_tasks
+package_task.define
namespace :dependency do
diff --git a/gio2/lib/gio2/output-stream.rb b/webkit-gtk2/test/test_webkit_gtk_webview.rb
similarity index 80%
copy from gio2/lib/gio2/output-stream.rb
copy to webkit-gtk2/test/test_webkit_gtk_webview.rb
index d686699..f2764a7 100644
--- a/gio2/lib/gio2/output-stream.rb
+++ b/webkit-gtk2/test/test_webkit_gtk_webview.rb
@@ -14,11 +14,13 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-module Gio
- class OutputStream
- alias_method :write_raw, :write
- def write(data)
- write_raw(data, data.bytesize)
+class TestWebKitGtk2WebView < Test::Unit::TestCase
+ include WebKitGtk2TestUtils::Omissions
+
+ def test_webkit_gtk_webview
+ omit_on_os_x
+ assert_nothing_raised do
+ WebKitGtk2::WebView.new
end
end
end
diff --git a/webkit-gtk2/test/webkit-gtk-test-utils.rb b/webkit-gtk2/test/webkit-gtk-test-utils.rb
index 4dd02d7..4420e91 100644
--- a/webkit-gtk2/test/webkit-gtk-test-utils.rb
+++ b/webkit-gtk2/test/webkit-gtk-test-utils.rb
@@ -1,4 +1,4 @@
-# Copyright (C) 2013 Ruby-GNOME2 Project Team
+# Copyright (C) 2013-2014 Ruby-GNOME2 Project Team
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -17,5 +17,7 @@
require "test-unit"
require "test/unit/notify"
+require "webkit-gtk-test-utils/omissions"
+
module WebKitGtkTestUtils
end
diff --git a/gio2/lib/gio2/output-stream.rb b/webkit-gtk2/test/webkit-gtk-test-utils/omissions.rb
similarity index 85%
rename from gio2/lib/gio2/output-stream.rb
rename to webkit-gtk2/test/webkit-gtk-test-utils/omissions.rb
index d686699..08335cf 100644
--- a/gio2/lib/gio2/output-stream.rb
+++ b/webkit-gtk2/test/webkit-gtk-test-utils/omissions.rb
@@ -14,11 +14,10 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-module Gio
- class OutputStream
- alias_method :write_raw, :write
- def write(data)
- write_raw(data, data.bytesize)
+module WebKitGtk2TestUtils
+ module Omissions
+ def omit_on_os_x
+ omit("Skip this test on OS X") if RUBY_PLATFORM =~ /darwin/
end
end
end
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/ruby-gnome2.git
More information about the Pkg-ruby-extras-commits
mailing list