[poppler] poppler/test: gtk-cairo-test.cc,1.9,1.10

Kristian Høgsberg krh at kemper.freedesktop.org
Tue May 30 14:46:08 PDT 2006


Update of /cvs/poppler/poppler/test
In directory kemper:/tmp/cvs-serv32351/test

Modified Files:
	gtk-cairo-test.cc 
Log Message:
2006-05-30  Kristian Høgsberg  <krh at redhat.com>

	* test/gtk-cairo-test.cc: Add --page option to gtk-cairo-test.


Index: gtk-cairo-test.cc
===================================================================
RCS file: /cvs/poppler/poppler/test/gtk-cairo-test.cc,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- gtk-cairo-test.cc	12 Apr 2006 02:07:07 -0000	1.9
+++ gtk-cairo-test.cc	30 May 2006 21:46:06 -0000	1.10
@@ -26,6 +26,7 @@
   GtkWidget *window;
   GtkWidget *sw;
   GtkWidget *drawing_area;
+  GtkWidget *spin_button;
   PopplerPage *page;
   PopplerDocument *document;
   cairo_surface_t *surface;
@@ -69,6 +70,7 @@
   cairo_destroy (cr);
   gtk_widget_set_size_request (v->drawing_area, w, h);
   gtk_widget_queue_draw (v->drawing_area);
+  gtk_spin_button_set_value (GTK_SPIN_BUTTON (v->spin_button), page);
 }
 
 static void
@@ -140,6 +142,7 @@
   v->drawing_area = drawing_area;
   v->sw = sw;
   v->window_count = window_count;
+  v->spin_button = spin_button;
 
   g_signal_connect (drawing_area,
                     "expose_event",
@@ -154,17 +157,29 @@
   return v;
 }
 
+static int option_page = 0;
+static GOptionEntry demo_options[] = {
+  { "page", 0, 0, G_OPTION_ARG_INT, &option_page, "Page number", "PAGE" },
+  { NULL }
+};
+    
 int
 main (int argc, char *argv [])
 {
   View *v;
   int i, window_count;
+  GOptionContext *ctx;
+
+  ctx = g_option_context_new("FILENAME ...");
+  g_option_context_add_main_entries(ctx, demo_options, "main");
+  g_option_context_parse(ctx, &argc, &argv, NULL);
+  g_option_context_free(ctx);
 
   gtk_init (&argc, &argv);
-  
+   
   if (argc == 1)
     {
-      fprintf (stderr, "usage: %s PDF-FILES...\n", argv[0]);
+      fprintf (stderr, "usage: %s PDF-FILES...\n", g_basename (argv[0]));
       return -1;
     }
       
@@ -176,7 +191,7 @@
 	  continue;
       }
       
-      view_set_page (v, 0);
+      view_set_page (v, option_page);
       window_count++;
   }
   



More information about the poppler mailing list