[eog/f12/master] Use the Page Setup tab in the print dialog instead of a separate option

Siddhesh Poyarekar siddhesh at fedoraproject.org
Wed Sep 15 12:51:26 UTC 2010


commit 94ee9fa91620b6c378adc64131e9b3e8d5b9ebc5
Author: Siddhesh Poyarekar <siddhesh.poyarekar at gmail.com>
Date:   Wed Sep 15 18:21:41 2010 +0530

    Use the Page Setup tab in the print dialog instead of a separate
    option

 eog-2.28.2-embed-page-setup-in-print-dialog.patch |  213 +++++++++++++++++++++
 1 files changed, 213 insertions(+), 0 deletions(-)
---
diff --git a/eog-2.28.2-embed-page-setup-in-print-dialog.patch b/eog-2.28.2-embed-page-setup-in-print-dialog.patch
new file mode 100644
index 0000000..19abc36
--- /dev/null
+++ b/eog-2.28.2-embed-page-setup-in-print-dialog.patch
@@ -0,0 +1,213 @@
+commit cffc41e7b0f255cdaf82052dad83ff1539599fdb
+Author: Marek Kasik <mkasik at redhat.com>
+Date:   Fri Apr 2 15:00:26 2010 +0200
+
+    Embed page setup in the print dialog
+    
+    This patch activates paper size combo and orientation combo in the
+    Page Setup tab in the print dialog. It removes "Page Setup..." from
+    the file menu. It also actualize paper size in Image Settings each
+    time it changes. (bug 614451)
+
+diff --git a/data/eog-ui.xml b/data/eog-ui.xml
+index 2680f28..75cac6e 100644
+--- a/data/eog-ui.xml
++++ b/data/eog-ui.xml
+@@ -9,7 +9,6 @@
+       <menuitem action="FileSave"/>
+       <menuitem action="FileSaveAs"/>
+       <separator/>
+-      <menuitem action="FilePageSetup"/>
+       <menuitem action="FilePrint"/>
+       <separator/>
+       <menuitem action="FileProperties"/>
+diff --git a/src/eog-print-image-setup.c b/src/eog-print-image-setup.c
+index 1f20ebf..b2f6243 100644
+--- a/src/eog-print-image-setup.c
++++ b/src/eog-print-image-setup.c
+@@ -1041,3 +1041,34 @@ eog_print_image_setup_get_options (EogPrintImageSetup *setup,
+ 	*scale = gtk_range_get_value (GTK_RANGE (priv->scaling));
+ 	*unit = priv->current_unit;
+ }
++
++void
++eog_print_image_setup_update (GtkPrintOperation *operation,
++			      GtkWidget         *custom_widget,
++			      GtkPageSetup      *page_setup,
++			      GtkPrintSettings  *print_settings,
++			      gpointer           user_data)
++{
++	GtkWidget *preview;
++	gdouble    pos_x;
++	gdouble    pos_y;
++	EogPrintImageSetup *setup;
++
++	setup = EOG_PRINT_IMAGE_SETUP (custom_widget);
++
++	setup->priv->page_setup = gtk_page_setup_copy (page_setup);
++
++	set_initial_values (EOG_PRINT_IMAGE_SETUP (setup));
++
++	preview = EOG_PRINT_IMAGE_SETUP (setup)->priv->preview;
++	eog_print_preview_set_from_page_setup (EOG_PRINT_PREVIEW (preview),
++					       setup->priv->page_setup);
++
++	pos_x = gtk_spin_button_get_value (GTK_SPIN_BUTTON (setup->priv->left));
++	pos_y = gtk_spin_button_get_value (GTK_SPIN_BUTTON (setup->priv->top));
++	if (setup->priv->current_unit == GTK_UNIT_MM) {
++		pos_x *= FACTOR_MM_TO_INCH;
++		pos_y *= FACTOR_MM_TO_INCH;
++	}
++	eog_print_preview_set_image_position (EOG_PRINT_PREVIEW (setup->priv->preview), pos_x, pos_y);
++}
+diff --git a/src/eog-print-image-setup.h b/src/eog-print-image-setup.h
+index 0a6b49e..d495a96 100644
+--- a/src/eog-print-image-setup.h
++++ b/src/eog-print-image-setup.h
+@@ -60,6 +60,11 @@ void              eog_print_image_setup_get_options (EogPrintImageSetup *setup,
+ 						     gdouble            *top,
+ 						     gdouble            *scale,
+ 						     GtkUnit            *unit);
++void              eog_print_image_setup_update      (GtkPrintOperation *operation,
++						     GtkWidget         *custom_widget,
++						     GtkPageSetup      *page_setup,
++						     GtkPrintSettings  *print_settings,
++						     gpointer           user_data);
+ 
+ G_END_DECLS
+ 
+diff --git a/src/eog-print.c b/src/eog-print.c
+index 8e2402d..681ce36 100644
+--- a/src/eog-print.c
++++ b/src/eog-print.c
+@@ -113,7 +113,8 @@ eog_print_create_custom_widget (GtkPrintOperation *operation,
+ 
+ 	page_setup = gtk_print_operation_get_default_page_setup (operation);
+ 
+-	g_assert (page_setup != NULL);
++	if (page_setup == NULL)
++		page_setup = gtk_page_setup_new ();
+ 
+ 	return G_OBJECT (eog_print_image_setup_new (data->image, page_setup));
+ }
+@@ -180,6 +181,7 @@ eog_print_operation_new (EogImage *image,
+ 	gtk_print_operation_set_n_pages (print, 1);
+ 	gtk_print_operation_set_job_name (print,
+ 					  eog_image_get_caption (image));
++	gtk_print_operation_set_embed_page_setup (print, TRUE);
+ 
+ 	g_signal_connect (print, "draw_page",
+ 			  G_CALLBACK (eog_print_draw_page),
+@@ -193,6 +195,9 @@ eog_print_operation_new (EogImage *image,
+ 	g_signal_connect (print, "end-print",
+ 			  G_CALLBACK (eog_print_end_print),
+ 			  data);
++	g_signal_connect (print, "update-custom-widget",
++			  G_CALLBACK (eog_print_image_setup_update),
++			  data);
+ 
+ 	gtk_print_operation_set_custom_tab_label (print, _("Image Settings"));
+ 
+diff --git a/src/eog-window.c b/src/eog-window.c
+index dfd4636..044c28e 100644
+--- a/src/eog-window.c
++++ b/src/eog-window.c
+@@ -822,7 +822,6 @@ update_action_groups_state (EogWindow *window)
+ 	GtkAction *action_fscreen;
+ 	GtkAction *action_sshow;
+ 	GtkAction *action_print;
+-	GtkAction *action_page_setup;
+ 	gboolean print_disabled = FALSE;
+ 	gboolean page_setup_disabled = FALSE;
+ 	gboolean show_image_collection = FALSE;
+@@ -854,16 +853,11 @@ update_action_groups_state (EogWindow *window)
+ 		gtk_action_group_get_action (priv->actions_image,
+ 					     "FilePrint");
+ 
+-	action_page_setup =
+-		gtk_action_group_get_action (priv->actions_image,
+-					     "FilePageSetup");
+-
+ 	g_assert (action_collection != NULL);
+ 	g_assert (action_sidebar != NULL);
+ 	g_assert (action_fscreen != NULL);
+ 	g_assert (action_sshow != NULL);
+ 	g_assert (action_print != NULL);
+-	g_assert (action_page_setup != NULL);
+ 
+ 	if (priv->store != NULL) {
+ 		n_images = eog_list_store_length (EOG_LIST_STORE (priv->store));
+@@ -943,10 +937,6 @@ update_action_groups_state (EogWindow *window)
+ 						     EOG_CONF_DESKTOP_CAN_SETUP_PAGE,
+ 						     NULL);
+ 
+-	if (page_setup_disabled) {
+-		gtk_action_set_sensitive (action_page_setup, FALSE);
+-	}
+-
+ 	if (eog_sidebar_is_empty (EOG_SIDEBAR (priv->sidebar))) {
+ 		gtk_action_set_sensitive (action_sidebar, FALSE);
+ 		gtk_widget_hide (priv->sidebar);
+@@ -2321,28 +2311,6 @@ eog_window_stop_fullscreen (EogWindow *window, gboolean slideshow)
+ }
+ 
+ static void
+-eog_window_page_setup (EogWindow *window)
+-{
+-	GtkPageSetup *new_page_setup;
+-	GtkPageSetup *page_setup;
+-	GtkPrintSettings *print_settings;
+-
+-	eog_debug (DEBUG_PRINTING);
+-
+-	print_settings = eog_print_get_print_settings ();
+-	page_setup = eog_print_get_page_setup ();
+-
+-	new_page_setup = gtk_print_run_page_setup_dialog (GTK_WINDOW (window),
+-							  page_setup,
+-							  print_settings);
+-	eog_print_set_page_setup (new_page_setup);
+-
+-	g_object_unref (page_setup);
+-	g_object_unref (new_page_setup);
+-	g_object_unref (print_settings);
+-}
+-
+-static void
+ eog_window_print (EogWindow *window)
+ {
+ 	GtkWidget *dialog;
+@@ -2381,6 +2349,7 @@ eog_window_print (EogWindow *window)
+ 		g_error_free (error);
+ 	} else if (res == GTK_PRINT_OPERATION_RESULT_APPLY) {
+ 		eog_print_set_print_settings (gtk_print_operation_get_print_settings (print));
++		eog_print_set_page_setup (gtk_print_operation_get_default_page_setup (print));
+ 	}
+ 
+ 	g_object_unref (page_setup);
+@@ -2935,14 +2904,6 @@ eog_window_cmd_save_as (GtkAction *action, gpointer user_data)
+ }
+ 
+ static void
+-eog_window_cmd_page_setup (GtkAction *action, gpointer user_data)
+-{
+-	EogWindow *window = EOG_WINDOW (user_data);
+-
+-	eog_window_page_setup (window);
+-}
+-
+-static void
+ eog_window_cmd_print (GtkAction *action, gpointer user_data)
+ {
+ 	EogWindow *window = EOG_WINDOW (user_data);
+@@ -3584,9 +3545,6 @@ static const GtkActionEntry action_entries_image[] = {
+ 	{ "FileSaveAs", GTK_STOCK_SAVE_AS, N_("Save _As..."), "<control><shift>s",
+ 	  N_("Save the selected images with a different name"),
+ 	  G_CALLBACK (eog_window_cmd_save_as) },
+-	{ "FilePageSetup", GTK_STOCK_PAGE_SETUP, NULL, NULL,
+-	  N_("Setup the page properties for printing"),
+-	  G_CALLBACK (eog_window_cmd_page_setup) },
+ 	{ "FilePrint", GTK_STOCK_PRINT, N_("_Print..."), "<control>p",
+ 	  N_("Print the selected image"),
+ 	  G_CALLBACK (eog_window_cmd_print) },
+ 	{ "FileProperties", GTK_STOCK_PROPERTIES, N_("Prope_rties"), "<alt>Return",


More information about the scm-commits mailing list