perl-Gtk2 r2113 - in trunk: . t xs
- From: tsch svn gnome org
- To: svn-commits-list gnome org
- Subject: perl-Gtk2 r2113 - in trunk: . t xs
- Date: Sun, 18 Jan 2009 16:33:12 +0000 (UTC)
Author: tsch
Date: Sun Jan 18 16:33:12 2009
New Revision: 2113
URL: http://svn.gnome.org/viewvc/perl-Gtk2?rev=2113&view=rev
Log:
Wrap new API. Patch by Emmanuel Rodriguez.
Modified:
trunk/ChangeLog
trunk/t/GtkPrintOperation.t
trunk/xs/GtkPrintOperation.xs
Modified: trunk/t/GtkPrintOperation.t
==============================================================================
--- trunk/t/GtkPrintOperation.t (original)
+++ trunk/t/GtkPrintOperation.t Sun Jan 18 16:33:12 2009
@@ -1,7 +1,7 @@
#!/usr/bin/perl -w
use strict;
use Gtk2::TestHelper
- tests => 10,
+ tests => 13,
at_least_version => [2, 10, 0, "GtkPrintOperation is new in 2.10"];
# $Id$
@@ -51,6 +51,36 @@
# FIXME: Don't know how to trigger an actual error.
# warn $op -> get_error();
+
+SKIP: {
+ skip 'draw page finish (2.16)', 3
+ unless Gtk2->CHECK_VERSION(2, 15, 0);
+
+ # NOTE draw_page_finish() has to be called under the right conditions
+ # otherwise the print context doesn't seem to be setup properly causing
+ # the program to crash with a segmentation fault.
+ #
+ # This is tricky as draw_page_finish() must be called if
+ # set_defer_drawing() is called and the latter can be called only from
+ # the 'draw-page' callback.
+
+ # 'draw-page' is called twice because there are 2 pages, see get_op()
+ $op = get_op();
+ $op -> signal_connect('draw-page' => sub {
+ # Pretend that the drawing is asynchronous.
+ $op -> set_defer_drawing();
+
+ # Finish the drawing latter
+ Glib::Idle->add(sub {
+ ok(TRUE, "Draw page finish called"); # Called 2 times
+ $op -> draw_page_finish();
+ });
+ });
+
+ ok(defined $op -> run("export", Gtk2::Window -> new()));
+}
+
+
unlink "test.pdf";
=comment
Modified: trunk/xs/GtkPrintOperation.xs
==============================================================================
--- trunk/xs/GtkPrintOperation.xs (original)
+++ trunk/xs/GtkPrintOperation.xs Sun Jan 18 16:33:12 2009
@@ -94,6 +94,33 @@
void gtk_print_operation_cancel (GtkPrintOperation *op);
+#if GTK_CHECK_VERSION (2, 15, 0) /* FIXME: 2.16 */
+
+=for apidoc
+
+=for signature $op->draw_page_finish ()
+
+The method draw_page_finish() can only be called if the method
+set_defer_drawing() has been called previously otherwise a segmentation fault
+will occur. This means that the application will crash and even an eval will not
+be able to recover from that error.
+
+=cut
+void gtk_print_operation_draw_page_finish (GtkPrintOperation *op);
+
+
+=for apidoc
+
+=for signature $op->set_defer_drawing ()
+
+The method set_defer_drawing() can only be called from the callback
+C<'draw-page'>.
+
+=cut
+void gtk_print_operation_set_defer_drawing (GtkPrintOperation *op);
+
+#endif /* 2.16 */
+
MODULE = Gtk2::PrintOperation PACKAGE = Gtk2::Print PREFIX = gtk_print_
# GtkPageSetup * gtk_print_run_page_setup_dialog (GtkWindow *parent, GtkPageSetup *page_setup, GtkPrintSettings *settings);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]