gedit r6094 - branches/printing/gedit



Author: pborelli
Date: Tue Jan 15 14:59:48 2008
New Revision: 6094
URL: http://svn.gnome.org/viewvc/gedit?rev=6094&view=rev

Log:
propagate the page setup from the dialog down to the print job


Modified:
   branches/printing/gedit/gedit-commands-file-print.c
   branches/printing/gedit/gedit-print-job.c
   branches/printing/gedit/gedit-print-job.h
   branches/printing/gedit/gedit-tab.c
   branches/printing/gedit/gedit-tab.h

Modified: branches/printing/gedit/gedit-commands-file-print.c
==============================================================================
--- branches/printing/gedit/gedit-commands-file-print.c	(original)
+++ branches/printing/gedit/gedit-commands-file-print.c	Tue Jan 15 14:59:48 2008
@@ -52,6 +52,11 @@
 	if (setup != NULL)
 	{
 		g_print ("Page setup done\n");
+
+		if (page_setup)
+			g_object_unref (page_setup);
+
+		page_setup = setup;
 	}
 	else
 	{
@@ -90,7 +95,7 @@
 	if (tab == NULL)
 		return;
 
-	_gedit_tab_print_preview (tab);
+	_gedit_tab_print_preview (tab, page_setup);
 }
 
 void
@@ -105,6 +110,6 @@
 	if (tab == NULL)
 		return;
 
-	_gedit_tab_print (tab);
+	_gedit_tab_print (tab, page_setup);
 }
 

Modified: branches/printing/gedit/gedit-print-job.c
==============================================================================
--- branches/printing/gedit/gedit-print-job.c	(original)
+++ branches/printing/gedit/gedit-print-job.c	Tue Jan 15 14:59:48 2008
@@ -517,24 +517,16 @@
 	g_object_unref (job);
 }
 
-static GtkPageSetup *
-get_page_setup (GeditPrintJob  *job,
-		GError        **error)
-{
-	/* TODO */
-	return NULL;
-}
-
 /* Note that gedit_print_job_print can can only be called once on a given GeditPrintJob */
 GtkPrintOperationResult	 
 gedit_print_job_print (GeditPrintJob            *job,
 		       GtkPrintOperationAction   action,
+		       GtkPageSetup             *page_setup,
 		       GtkWindow                *parent,
 		       GError                  **error)
 {
 	GeditPrintJobPrivate *priv;
 	gchar *job_name;
-	GtkPageSetup *page_setup;
 
 	g_return_val_if_fail (job->priv->compositor == NULL, GTK_PRINT_OPERATION_RESULT_ERROR);
 
@@ -543,9 +535,6 @@
 	/* Check if we are previewing */
 	priv->is_preview = (action == GTK_PRINT_OPERATION_ACTION_PREVIEW);
 
-	/* Get print setting and page_setup */
-	page_setup = get_page_setup (job, error);
-
 	/* Creare print operation */
 	job->priv->operation = gtk_print_operation_new ();
 
@@ -557,9 +546,7 @@
 							    page_setup);
 
 	job_name = gedit_document_get_short_name_for_display (priv->doc);
-
 	gtk_print_operation_set_job_name (priv->operation, job_name);
-
 	g_free (job_name);
 
 	gtk_print_operation_set_allow_async (priv->operation, TRUE);

Modified: branches/printing/gedit/gedit-print-job.h
==============================================================================
--- branches/printing/gedit/gedit-print-job.h	(original)
+++ branches/printing/gedit/gedit-print-job.h	Tue Jan 15 14:59:48 2008
@@ -113,6 +113,7 @@
 								 
 GtkPrintOperationResult	 gedit_print_job_print			(GeditPrintJob            *job,
 								 GtkPrintOperationAction   action,
+								 GtkPageSetup             *page_setup,
 								 GtkWindow                *parent,
 								 GError                  **error);
 

Modified: branches/printing/gedit/gedit-tab.c
==============================================================================
--- branches/printing/gedit/gedit-tab.c	(original)
+++ branches/printing/gedit/gedit-tab.c	Tue Jan 15 14:59:48 2008
@@ -2343,7 +2343,8 @@
 
 static void
 gedit_tab_print_or_print_preview (GeditTab                *tab,
-				  GtkPrintOperationAction  print_action)
+				  GtkPrintOperationAction  print_action,
+				  GtkPageSetup            *page_setup)
 {
 	GeditView *view;
 	gboolean is_preview;
@@ -2383,6 +2384,7 @@
 
 	res = gedit_print_job_print (tab->priv->print_job,
 				     print_action,
+				     page_setup,
 				     GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (tab))),
 				     &error);
 
@@ -2398,19 +2400,25 @@
 }
 
 void 
-_gedit_tab_print (GeditTab *tab)
+_gedit_tab_print (GeditTab     *tab,
+		  GtkPageSetup *page_setup)
 {
 	g_return_if_fail (GEDIT_IS_TAB (tab));
 
-	gedit_tab_print_or_print_preview (tab, GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG);
+	gedit_tab_print_or_print_preview (tab,
+					  GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG,
+					  page_setup);
 }
 
 void
-_gedit_tab_print_preview (GeditTab *tab)
+_gedit_tab_print_preview (GeditTab     *tab,
+			  GtkPageSetup *page_setup)
 {
 	g_return_if_fail (GEDIT_IS_TAB (tab));
 
-	gedit_tab_print_or_print_preview (tab, GTK_PRINT_OPERATION_ACTION_PREVIEW);
+	gedit_tab_print_or_print_preview (tab,
+					  GTK_PRINT_OPERATION_ACTION_PREVIEW,
+					  page_setup);
 }
 
 void 

Modified: branches/printing/gedit/gedit-tab.h
==============================================================================
--- branches/printing/gedit/gedit-tab.h	(original)
+++ branches/printing/gedit/gedit-tab.h	Tue Jan 15 14:59:48 2008
@@ -146,8 +146,10 @@
 						 const gchar         *uri,
 						 const GeditEncoding *encoding);
 
-void		 _gedit_tab_print		(GeditTab            *tab);
-void		 _gedit_tab_print_preview	(GeditTab            *tab);
+void		 _gedit_tab_print		(GeditTab            *tab,
+						 GtkPageSetup        *page_setup);
+void		 _gedit_tab_print_preview	(GeditTab            *tab,
+						 GtkPageSetup        *page_setup);
 
 void		 _gedit_tab_mark_for_closing	(GeditTab	     *tab);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]