diff options
author | Matthias Clasen <mclasen@redhat.com> | 2006-06-16 16:39:09 +0000 |
---|---|---|
committer | Matthias Clasen <matthiasc@src.gnome.org> | 2006-06-16 16:39:09 +0000 |
commit | d9d210ad2384f858d8866143c88517aaa6f845ec (patch) | |
tree | 19f17e266532f07caa1e13bf8e8d008fdc6103c9 | |
parent | 44f85d4769167e0e30f3015356f446a4f3278227 (diff) | |
download | gtk+-d9d210ad2384f858d8866143c88517aaa6f845ec.tar.gz |
Add a "Preview" menu item.
2006-06-16 Matthias Clasen <mclasen@redhat.com>
* tests/print-editor.c: Add a "Preview" menu item.
-rw-r--r-- | ChangeLog | 2 | ||||
-rw-r--r-- | ChangeLog.pre-2-10 | 2 | ||||
-rw-r--r-- | tests/print-editor.c | 27 |
3 files changed, 26 insertions, 5 deletions
@@ -1,5 +1,7 @@ 2006-06-16 Matthias Clasen <mclasen@redhat.com> + * tests/print-editor.c: Add a "Preview" menu item. + * gtk/gtkprintoperation-unix.c (handle_print_response): When starting a preview from the print dialog, set the action to PREVIEW. diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index b619635eaa..0e16361522 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,5 +1,7 @@ 2006-06-16 Matthias Clasen <mclasen@redhat.com> + * tests/print-editor.c: Add a "Preview" menu item. + * gtk/gtkprintoperation-unix.c (handle_print_response): When starting a preview from the print dialog, set the action to PREVIEW. diff --git a/tests/print-editor.c b/tests/print-editor.c index 0d4990513c..3a539f8651 100644 --- a/tests/print-editor.c +++ b/tests/print-editor.c @@ -531,7 +531,7 @@ preview_destroy (GtkWindow *window, } static gboolean -do_preview (GtkPrintOperation *op, +preview_cb (GtkPrintOperation *op, GtkPrintOperationPreview *preview, GtkPrintContext *context, GtkWindow *parent, @@ -650,7 +650,7 @@ print_done (GtkPrintOperation *op, } static void -do_print (GtkAction *action) +do_print_or_preview (GtkAction *action, GtkPrintOperationAction print_action) { GtkPrintOperation *print; PrintData *print_data; @@ -674,7 +674,7 @@ do_print (GtkAction *action) g_signal_connect (print, "draw_page", G_CALLBACK (draw_page), print_data); g_signal_connect (print, "create_custom_widget", G_CALLBACK (create_custom_widget), print_data); g_signal_connect (print, "custom_widget_apply", G_CALLBACK (custom_widget_apply), print_data); - g_signal_connect (print, "preview", G_CALLBACK (do_preview), print_data); + g_signal_connect (print, "preview", G_CALLBACK (preview_cb), print_data); g_signal_connect (print, "done", G_CALLBACK (print_done), print_data); @@ -683,12 +683,24 @@ do_print (GtkAction *action) #if 0 gtk_print_operation_set_allow_async (print, TRUE); #endif - gtk_print_operation_run (print, GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG, GTK_WINDOW (main_window), NULL); + gtk_print_operation_run (print, print_action, GTK_WINDOW (main_window), NULL); g_object_unref (print); } static void +do_print (GtkAction *action) +{ + do_print_or_preview (action, GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG); +} + +static void +do_preview (GtkAction *action) +{ + do_print_or_preview (action, GTK_PRINT_OPERATION_ACTION_PREVIEW); +} + +static void do_about (GtkAction *action) { const gchar *authors[] = { @@ -741,10 +753,14 @@ static GtkActionEntry entries[] = { "Page _Setup", NULL, /* label, accelerator */ "Set up the page", /* tooltip */ G_CALLBACK (do_page_setup) }, + { "Preview", NULL, /* name, stock id */ + "Print Preview", NULL, /* label, accelerator */ + "Preview the printed document", /* tooltip */ + G_CALLBACK (do_preview) }, { "Print", GTK_STOCK_PRINT, /* name, stock id */ NULL, NULL, /* label, accelerator */ "Print the document", /* tooltip */ - G_CALLBACK (do_print) }, + G_CALLBACK (do_print) } }; static guint n_entries = G_N_ELEMENTS (entries); @@ -757,6 +773,7 @@ static const gchar *ui_info = " <menuitem action='Save'/>" " <menuitem action='SaveAs'/>" " <menuitem action='PageSetup'/>" +" <menuitem action='Preview'/>" " <menuitem action='Print'/>" " <separator/>" " <menuitem action='Quit'/>" |