[evolution-patches] Re: 46404 Calendar, Addressbook, Mailer Remembering Printer Settings



On Tue, 2005-01-18 at 14:28 -0500, JP Rosevear wrote: 
> Looked at gedit and libgnomeprintui examples for this.  Using gconf key
> for the setting though, so presumably admins can set sane defaults.
> 
> I could put the key in the shell schema if it belongs there, or is there
> another more appropriate path to the key?

I ended up putting it in /apps/evolution/shell/print_config because its
for all components.  If at some point we want separate, it can go
to /apps/evolution/mail etc.

I've attached the mailer and addressbook bits for review (forgot last
time).

-JP
-- 
JP Rosevear <jpr novell com>
Novell, Inc.
? mail-subject-thread.loT
? print-mail.patch
? default/zh_CN/Makefile
? default/zh_CN/Makefile.in
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/mail/ChangeLog,v
retrieving revision 1.3534
diff -u -r1.3534 ChangeLog
--- ChangeLog	18 Jan 2005 13:19:23 -0000	1.3534
+++ ChangeLog	18 Jan 2005 19:20:11 -0000
@@ -1,3 +1,12 @@
+2005-01-18  JP Rosevear  <jpr novell com>
+
+	Fixes #46404
+	
+	* em-folder-view.c (emfv_print_response): use the config in the
+	print data and free it
+	(em_folder_view_print): load the config from e_print and use the
+	dialog from e_print
+
 2005-01-18  Rodrigo Moya <rodrigo novell com>
 
 	* em-filter-source-element.c:
Index: em-folder-view.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/em-folder-view.c,v
retrieving revision 1.99
diff -u -r1.99 em-folder-view.c
--- em-folder-view.c	7 Jan 2005 06:33:26 -0000	1.99
+++ em-folder-view.c	18 Jan 2005 19:20:12 -0000
@@ -66,6 +66,7 @@
 
 #include <e-util/e-dialog-utils.h>
 #include <e-util/e-icon-factory.h>
+#include <e-util/e-print.h>
 
 #include "em-format-html-display.h"
 #include "em-format-html-print.h"
@@ -1836,6 +1837,7 @@
 struct _print_data {
 	EMFolderView *emfv;
 
+	GnomePrintConfig *config;
 	int preview;
 	CamelFolder *folder;
 	char *uid;
@@ -1845,20 +1847,15 @@
 emfv_print_response(GtkWidget *w, int resp, struct _print_data *data)
 {
 	EMFormatHTMLPrint *print;
-	GnomePrintConfig *config = NULL;
 
 	switch (resp) {
 	case GNOME_PRINT_DIALOG_RESPONSE_PREVIEW:
 		data->preview = TRUE;
 	case GNOME_PRINT_DIALOG_RESPONSE_PRINT:
-		if (w)
-			config = gnome_print_dialog_get_config((GnomePrintDialog *)w);
 		print = em_format_html_print_new();
 		em_format_set_session((EMFormat *)print, ((EMFormat *)data->emfv->preview)->session);
-		em_format_html_print_message(print, (EMFormatHTML *)data->emfv->preview, config, data->folder, data->uid, data->preview);
+		em_format_html_print_message(print, (EMFormatHTML *)data->emfv->preview, data->config, data->folder, data->uid, data->preview);
 		g_object_unref(print);
-		if (config)
-			g_object_unref(config);
 		break;
 	}
 
@@ -1866,6 +1863,8 @@
 		gtk_widget_destroy(w);
 
 	g_object_unref(data->emfv);
+	e_print_save_config (data->config);
+	g_object_unref(data->config);
 	camel_object_unref(data->folder);
 	g_free(data->uid);
 	g_free(data);
@@ -1888,6 +1887,7 @@
 	data = g_malloc0(sizeof(*data));
 	data->emfv = emfv;
 	g_object_ref(emfv);
+	data->config = e_print_load_config ();
 	data->preview = preview;
 	data->folder = emfv->folder;
 	camel_object_ref(data->folder);
@@ -1897,8 +1897,8 @@
 	if (preview) {
 		emfv_print_response(NULL, GNOME_PRINT_DIALOG_RESPONSE_PREVIEW, data);
 	} else {
-		GtkDialog *dialog = (GtkDialog *)gnome_print_dialog_new(NULL, _("Print Message"), GNOME_PRINT_DIALOG_COPIES);
-
+		GtkDialog *dialog = (GtkDialog *)e_print_get_dialog_with_config (_("Print Message"), GNOME_PRINT_DIALOG_COPIES, data->config);
+		
 		gtk_dialog_set_default_response(dialog, GNOME_PRINT_DIALOG_RESPONSE_PRINT);
 		e_dialog_set_transient_for ((GtkWindow *) dialog, (GtkWidget *) emfv);
 		g_signal_connect(dialog, "response", G_CALLBACK(emfv_print_response), data);
? print-ab.patch
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/ChangeLog,v
retrieving revision 1.1894
diff -u -r1.1894 ChangeLog
--- ChangeLog	18 Jan 2005 10:47:57 -0000	1.1894
+++ ChangeLog	18 Jan 2005 19:09:34 -0000
@@ -1,3 +1,21 @@
+2005-01-18  JP Rosevear  <jpr novell com>
+
+	Fixes #46404	
+	
+	* gui/widgets/e-addressbook-view.c (eab_view_print): just show the
+	dialog, not show all (margin settings aren't supposed to be used);
+	use e_print to get the dialog
+	(eab_view_print_preview): use e_print config for previewing
+
+	* printing/e-contact-print.c (e_contact_print_preview): get the
+	e_print config for previewing
+	(e_contact_print_contact_dialog_new): use e_print to get the
+	print dialog
+
+	* printing/e-contact-print-envelope.c
+	(e_contact_print_envelope_dialog_new): use e_print to get the
+	print dialog
+
 2005-01-18  Hao Sheng <hao sheng sun com>
 
 	* gui/component/addressbook-view.c:
Index: gui/widgets/e-addressbook-view.c
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/widgets/e-addressbook-view.c,v
retrieving revision 1.156
diff -u -r1.156 e-addressbook-view.c
--- gui/widgets/e-addressbook-view.c	22 Dec 2004 07:37:03 -0000	1.156
+++ gui/widgets/e-addressbook-view.c	18 Jan 2005 19:09:34 -0000
@@ -47,6 +47,7 @@
 #include "addressbook/gui/widgets/eab-menu.h"
 
 #include "e-util/e-categories-master-list-wombat.h"
+#include "e-util/e-print.h"
 #include "libedataserver/e-sexp.h"
 
 #ifdef WITH_ADDRESSBOOK_VIEW_TREEVIEW
@@ -1728,7 +1729,7 @@
 			      NULL);
 		print = e_contact_print_dialog_new(book, query);
 		g_free(query);
-		gtk_widget_show_all(print);
+		gtk_widget_show(print);
 	}
 	else if (view->view_type == EAB_VIEW_TABLE) {
 		GtkWidget *dialog;
@@ -1736,7 +1737,7 @@
 		ETable *etable;
 		EContactPrintDialogWeakData *weak_data;
 
-		dialog = gnome_print_dialog_new(NULL, "Print cards", GNOME_PRINT_DIALOG_RANGE | GNOME_PRINT_DIALOG_COPIES);
+		dialog = e_print_get_dialog (_("Print cards"), GNOME_PRINT_DIALOG_RANGE | GNOME_PRINT_DIALOG_COPIES);
 		gnome_print_dialog_construct_range_any(GNOME_PRINT_DIALOG(dialog), GNOME_PRINT_RANGE_ALL | GNOME_PRINT_RANGE_SELECTION,
 						       NULL, NULL, NULL);
 
@@ -1796,9 +1797,8 @@
 		g_object_ref (printable);
 		gtk_object_sink (GTK_OBJECT (printable));
 
-		master = gnome_print_job_new(NULL);
-		config = gnome_print_job_get_config (master);
-		gnome_print_config_set_int (config, GNOME_PRINT_KEY_NUM_COPIES, 1);
+		config = e_print_load_config ();
+		master = gnome_print_job_new (config);
 		pc = gnome_print_job_get_context( master );
 		e_printable_reset(printable);
 		while (e_printable_data_left(printable)) {
Index: printing/e-contact-print-envelope.c
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/printing/e-contact-print-envelope.c,v
retrieving revision 1.17
diff -u -r1.17 e-contact-print-envelope.c
--- printing/e-contact-print-envelope.c	21 Oct 2003 18:49:02 -0000	1.17
+++ printing/e-contact-print-envelope.c	18 Jan 2005 19:09:34 -0000
@@ -29,6 +29,7 @@
 #include <libgnomeprint/gnome-print.h>
 #include <libgnomeprint/gnome-print-job.h>
 #include <libgnomeprintui/gnome-print-job-preview.h>
+#include <e-util/e-print.h>
 
 #define ENVELOPE_HEIGHT (72.0 * 4.0)
 #define ENVELOPE_WIDTH (72.0 * 9.5)
@@ -209,7 +210,7 @@
 {
 	GtkWidget *dialog;
 	
-	dialog = gnome_print_dialog_new(NULL, _("Print envelope"), GNOME_PRINT_DIALOG_COPIES);
+	dialog = e_print_get_dialog (_("Print envelope"), GNOME_PRINT_DIALOG_COPIES);
 
 	contact = e_contact_duplicate(contact);
 	g_object_set_data(G_OBJECT(dialog), "contact", contact);
@@ -230,7 +231,7 @@
 	if (list == NULL)
 		return NULL;
 
-	dialog = gnome_print_dialog_new(NULL, _("Print envelope"), GNOME_PRINT_DIALOG_COPIES);
+	dialog = e_print_get_dialog(_("Print envelope"), GNOME_PRINT_DIALOG_COPIES);
 
 	contact = e_contact_duplicate(list->data);
 	g_object_set_data(G_OBJECT(dialog), "contact", contact);
Index: printing/e-contact-print.c
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/printing/e-contact-print.c,v
retrieving revision 1.48
diff -u -r1.48 e-contact-print.c
--- printing/e-contact-print.c	17 Jun 2004 21:59:36 -0000	1.48
+++ printing/e-contact-print.c	18 Jan 2005 19:09:34 -0000
@@ -41,6 +41,7 @@
 #include <libebook/e-book.h>
 #include <libebook/e-contact.h>
 #include <gal/util/e-util.h>
+#include <e-util/e-print.h>
 
 #define SCALE 5
 #define HYPHEN_PIXELS 20
@@ -997,7 +998,7 @@
 	GtkWidget *dialog;
 	
 	
-	dialog = gnome_print_dialog_new(NULL, _("Print contacts"), GNOME_PRINT_DIALOG_RANGE | GNOME_PRINT_DIALOG_COPIES);
+	dialog = e_print_get_dialog(_("Print contacts"), GNOME_PRINT_DIALOG_RANGE | GNOME_PRINT_DIALOG_COPIES);
 	gnome_print_dialog_construct_range_any(GNOME_PRINT_DIALOG(dialog), GNOME_PRINT_RANGE_ALL | GNOME_PRINT_RANGE_SELECTION,
 					       NULL, NULL, NULL);
 
@@ -1023,9 +1024,8 @@
 	GnomePrintConfig *config;
 	gdouble font_size;
 
-	master = gnome_print_job_new(NULL);
-	config = gnome_print_job_get_config (master);
-	gnome_print_config_set_int (config, GNOME_PRINT_KEY_NUM_COPIES, 1);
+	config = e_print_load_config ();
+	master = gnome_print_job_new (config);
 	pc = gnome_print_job_get_context (master);
 	e_contact_build_style (style);
 
@@ -1063,7 +1063,7 @@
 {
 	GtkWidget *dialog;
 	
-	dialog = gnome_print_dialog_new(NULL, _("Print contact"), GNOME_PRINT_DIALOG_COPIES);
+	dialog = e_print_get_dialog(_("Print contact"), GNOME_PRINT_DIALOG_COPIES);
 
 	contact = e_contact_duplicate(contact);
 	g_object_set_data(G_OBJECT(dialog), "contact", contact);
@@ -1090,7 +1090,7 @@
 	for (l = copied_list; l; l = l->next)
 		l->data = e_contact_duplicate (E_CONTACT (l->data));
 
-	dialog = gnome_print_dialog_new(NULL, _("Print contact"), GNOME_PRINT_DIALOG_COPIES);
+	dialog = e_print_get_dialog(_("Print contact"), GNOME_PRINT_DIALOG_COPIES);
 
 	g_object_set_data(G_OBJECT(dialog), "contact_list", copied_list);
 	g_object_set_data(G_OBJECT(dialog), "uses_list", GINT_TO_POINTER (TRUE));


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