aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/printing
diff options
context:
space:
mode:
authorEvan Yan <evan.yan@sun.com>2005-11-11 17:11:29 +0800
committerHarry Lu <haip@src.gnome.org>2005-11-11 17:11:29 +0800
commitf891e4617e6a4930fca627ed1fd8b9c3256f9548 (patch)
treef8fefe313391f7de41ec798bb22ae73020fdc8a6 /addressbook/printing
parent77af664dad6dd3fc30a99c74636404be4531b8ef (diff)
downloadgsoc2013-evolution-f891e4617e6a4930fca627ed1fd8b9c3256f9548.tar
gsoc2013-evolution-f891e4617e6a4930fca627ed1fd8b9c3256f9548.tar.gz
gsoc2013-evolution-f891e4617e6a4930fca627ed1fd8b9c3256f9548.tar.bz2
gsoc2013-evolution-f891e4617e6a4930fca627ed1fd8b9c3256f9548.tar.lz
gsoc2013-evolution-f891e4617e6a4930fca627ed1fd8b9c3256f9548.tar.xz
gsoc2013-evolution-f891e4617e6a4930fca627ed1fd8b9c3256f9548.tar.zst
gsoc2013-evolution-f891e4617e6a4930fca627ed1fd8b9c3256f9548.zip
Add a config argument to get the actual page size and set it to style.
2005-11-11 Evan Yan <evan.yan@sun.com> * pinting/e-contact-print.c (e_contact_build_style): Add a config argument to get the actual page size and set it to style. (e_contact_print_response): modify the call to e_contact_build_style accordingly. e_contact_print_preview): modify the call to e_contact_build_style accordingly. Fixes # 316280 svn path=/trunk/; revision=30597
Diffstat (limited to 'addressbook/printing')
-rw-r--r--addressbook/printing/e-contact-print.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/addressbook/printing/e-contact-print.c b/addressbook/printing/e-contact-print.c
index a877d7f06a..4546d9b2a4 100644
--- a/addressbook/printing/e-contact-print.c
+++ b/addressbook/printing/e-contact-print.c
@@ -34,6 +34,8 @@
#include <libgnome/gnome-i18n.h>
#include <libgnomeui/gnome-dialog.h>
#include <libgnomeprint/gnome-print.h>
+#include <libgnomeprint/gnome-print-unit.h>
+#include <libgnomeprint/gnome-print-config.h>
#include <libgnomeprint/gnome-font.h>
#include <libgnomeprint/gnome-print-job.h>
#include <libgnomeprintui/gnome-print-dialog.h>
@@ -714,10 +716,11 @@ static void get_font( char *data, GnomeFont **variable )
static void
-e_contact_build_style(EContactPrintStyle *style)
+e_contact_build_style(EContactPrintStyle *style, GnomePrintConfig *config)
{
xmlDocPtr styledoc;
gchar *filename;
+ gdouble page_height, page_width;
style->title = g_strdup("");
style->type = E_CONTACT_PRINT_TYPE_CARDS;
@@ -845,6 +848,15 @@ e_contact_build_style(EContactPrintStyle *style)
}
xmlFreeDoc(styledoc);
}
+
+ /*
+ * get paper size and set it to the print style
+ */
+ gnome_print_config_get_page_size(config, &page_width, &page_height);
+ gnome_print_convert_distance(&page_width, gnome_print_unit_get_default(), gnome_print_unit_get_by_name("Inches"));
+ gnome_print_convert_distance(&page_height, gnome_print_unit_get_default(), gnome_print_unit_get_by_name("Inches"));
+ style->page_height = page_height;
+ style->page_width = page_width;
}
static gint
@@ -896,7 +908,7 @@ e_contact_print_response(GtkWidget *dialog, gint response_id, gpointer data)
config = gnome_print_dialog_get_config (GNOME_PRINT_DIALOG(dialog));
master = gnome_print_job_new( config );
pc = gnome_print_job_get_context( master );
- e_contact_build_style(style);
+ e_contact_build_style(style, config);
ctxt->x = 0;
ctxt->y = 0;
@@ -942,7 +954,7 @@ e_contact_print_response(GtkWidget *dialog, gint response_id, gpointer data)
config = gnome_print_dialog_get_config (GNOME_PRINT_DIALOG(dialog));
master = gnome_print_job_new( config );
pc = gnome_print_job_get_context( master );
- e_contact_build_style(style);
+ e_contact_build_style(style, config);
ctxt->x = 0;
ctxt->y = 0;
@@ -1048,7 +1060,7 @@ e_contact_print_preview(EBook *book, char *query, GList *list)
config = e_print_load_config ();
master = gnome_print_job_new (config);
pc = gnome_print_job_get_context (master);
- e_contact_build_style (style);
+ e_contact_build_style (style, config);
if (list == NULL) {
uses_book = TRUE;