]> Pileus Git - ~andy/gtk/blobdiff - tests/testprint.c
stylecontext: Do invalidation on first resize container
[~andy/gtk] / tests / testprint.c
index 4326a8062d6599567602a77f2c373b418efb5eb9..5a6e1da650dceae3ea6888098cf65ef702255823 100644 (file)
  * 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <config.h>
+#include "config.h"
 #include <math.h>
 #include <pango/pangocairo.h>
 #include <gtk/gtk.h>
-#include <gtk/gtkprintoperation.h>
 #include "testprintfileoperation.h"
 
 static void
@@ -51,7 +48,7 @@ draw_page (GtkPrintOperation *operation,
   PangoLayout *layout;
   PangoFontDescription *desc;
   
-  cr = gtk_print_context_get_cairo (context);
+  cr = gtk_print_context_get_cairo_context (context);
 
   /* Draw a red rectangle, as wide as the paper (inside the margins) */
   cairo_set_source_rgb (cr, 1.0, 0, 0);
@@ -62,7 +59,7 @@ draw_page (GtkPrintOperation *operation,
   /* Draw some lines */
   cairo_move_to (cr, 20, 10);
   cairo_line_to (cr, 40, 20);
-  cairo_arc (cr, 60, 60, 20, 0, M_PI);
+  cairo_arc (cr, 60, 60, 20, 0, G_PI);
   cairo_line_to (cr, 80, 20);
   
   cairo_set_source_rgb (cr, 0, 0, 0);
@@ -74,7 +71,7 @@ draw_page (GtkPrintOperation *operation,
 
   /* Draw some text */
   
-  layout = gtk_print_context_create_layout (context);
+  layout = gtk_print_context_create_pango_layout (context);
   pango_layout_set_text (layout, "Hello World! Printing is easy", -1);
   desc = pango_font_description_from_string ("sans 28");
   pango_layout_set_font_description (layout, desc);
@@ -99,7 +96,6 @@ int
 main (int argc, char **argv)
 {
   GtkPrintOperation *print;
-  GtkPrintOperationResult res;
   TestPrintFileOperation *print_file;
 
   gtk_init (&argc, &argv);
@@ -108,16 +104,16 @@ main (int argc, char **argv)
   print = gtk_print_operation_new ();
   gtk_print_operation_set_n_pages (print, 2);
   gtk_print_operation_set_unit (print, GTK_UNIT_MM);
-  gtk_print_operation_set_pdf_target (print, "test.pdf");
+  gtk_print_operation_set_export_filename (print, "test.pdf");
   g_signal_connect (print, "draw_page", G_CALLBACK (draw_page), NULL);
   g_signal_connect (print, "request_page_setup", G_CALLBACK (request_page_setup), NULL);
-  res = gtk_print_operation_run (print, NULL, NULL);
+  gtk_print_operation_run (print, GTK_PRINT_OPERATION_ACTION_EXPORT, NULL, NULL);
 
   /* Test subclassing of GtkPrintOperation */
   print_file = test_print_file_operation_new ("testprint.c");
   test_print_file_operation_set_font_size (print_file, 12.0);
-  gtk_print_operation_set_pdf_target (GTK_PRINT_OPERATION (print_file), "test2.pdf");
-  res = gtk_print_operation_run (GTK_PRINT_OPERATION (print_file), NULL, NULL);
+  gtk_print_operation_set_export_filename (GTK_PRINT_OPERATION (print_file), "test2.pdf");
+  gtk_print_operation_run (GTK_PRINT_OPERATION (print_file), GTK_PRINT_OPERATION_ACTION_EXPORT, NULL, NULL);
   
   return 0;
 }