[evolution-patches] Summary printing patch



This makes the print dialog work properly.

-- Ettore
? GNOME_Evolution_Summary.oaf.in
? e-summary.c.mine
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/my-evolution/ChangeLog,v
retrieving revision 1.281
diff -u -p -r1.281 ChangeLog
--- ChangeLog	14 May 2003 18:40:00 -0000	1.281
+++ ChangeLog	15 May 2003 18:54:55 -0000
@@ -1,3 +1,9 @@
+2003-05-15  Ettore Perazzoli  <ettore ximian com>
+
+	* e-summary.c (do_summary_print): Remove preview arg.  Also, make
+	it destroy the dialog after a button has been clicked.
+	(e_summary_set_control): Add casts to avoid compiler warnings.
+
 2003-05-14  JP Rosevear  <jpr ximian com>
 
 	* e-summary.h: fix up protos
Index: e-summary.c
===================================================================
RCS file: /cvs/gnome/evolution/my-evolution/e-summary.c,v
retrieving revision 1.61
diff -u -p -r1.61 e-summary.c
--- e-summary.c	14 May 2003 18:40:01 -0000	1.61
+++ e-summary.c	15 May 2003 18:54:55 -0000
@@ -593,60 +593,60 @@ e_summary_set_control (ESummary *summary
 	g_return_if_fail (IS_E_SUMMARY (summary));
 
 	if (summary->priv->control)
-		g_object_remove_weak_pointer (G_OBJECT (summary->priv->control), &summary->priv->control);
+		g_object_remove_weak_pointer (G_OBJECT (summary->priv->control), (void **) &summary->priv->control);
 	
 	summary->priv->control = control;
 
 	if (summary->priv->control)
-		g_object_add_weak_pointer (G_OBJECT (summary->priv->control), &summary->priv->control);
+		g_object_add_weak_pointer (G_OBJECT (summary->priv->control), (void **) &summary->priv->control);
 }
 
 static void
-do_summary_print (ESummary *summary,
-		  gboolean preview)
+do_summary_print (ESummary *summary)
 {
 	GnomePrintContext *print_context;
 	GnomePrintJob *print_master;
 	GtkWidget *gpd;
 	GnomePrintConfig *config = NULL;
+	GtkWidget *preview_widget;
+	gboolean preview = FALSE;
 
-	if (! preview) {
-		gpd = gnome_print_dialog_new (NULL, _("Print Summary"), GNOME_PRINT_DIALOG_COPIES);
+	gpd = gnome_print_dialog_new (NULL, _("Print Summary"), GNOME_PRINT_DIALOG_COPIES);
 
-		switch (gtk_dialog_run (GTK_DIALOG (gpd))) {
-		case GNOME_PRINT_DIALOG_RESPONSE_PRINT:
-			break;
-
-		case GNOME_PRINT_DIALOG_RESPONSE_PREVIEW:
-			preview = TRUE;
-			break;
-
-		default:
-			gtk_widget_destroy (gpd);
-			return;
-		}
-
-		config = gnome_print_dialog_get_config (GNOME_PRINT_DIALOG (gpd));
+	switch (gtk_dialog_run (GTK_DIALOG (gpd))) {
+	case GNOME_PRINT_DIALOG_RESPONSE_PRINT:
+		preview = FALSE;
+		break;
+
+	case GNOME_PRINT_DIALOG_RESPONSE_PREVIEW:
+		preview = TRUE;
+		break;
+
+	default:
+		if (preview_widget != NULL)
+			gtk_widget_destroy (preview_widget);
+		gtk_widget_destroy (gpd);
+		return;
 	}
 
+	config = gnome_print_dialog_get_config (GNOME_PRINT_DIALOG (gpd));
+
 	print_master = gnome_print_job_new (config);
 	
 	print_context = gnome_print_job_get_context (print_master);
 	gtk_html_print (GTK_HTML (summary->priv->html), print_context);
 	gnome_print_job_close (print_master);
 
-	if (preview) {
-		GtkWidget *preview;
+	gtk_widget_destroy (gpd);
 
-		preview = gnome_print_job_preview_new (print_master, _("Print Preview"));
-		gtk_widget_show (preview);
+	if (preview) {
+		preview_widget = gnome_print_job_preview_new (print_master, _("Print Preview"));
+		gtk_widget_show (preview_widget);
 	} else {
 		int result = gnome_print_job_print (print_master);
 
-		if (result == -1) {
-			e_notice (summary, GTK_MESSAGE_ERROR,
-				  _("Printing of Summary failed"));
-		}
+		if (result == -1)
+			e_notice (gpd, GTK_MESSAGE_ERROR, _("Printing of Summary failed"));
 	}
 
 	g_object_unref (print_master);
@@ -659,7 +659,7 @@ e_summary_print (BonoboUIComponent *comp
 {
 	ESummary *summary = userdata;
 
-	do_summary_print (summary, FALSE);
+	do_summary_print (summary);
 }
 
 void


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