aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui
diff options
context:
space:
mode:
authorHans Petter Jansson <hpj@ximian.com>2003-02-12 10:41:05 +0800
committerHans Petter <hansp@src.gnome.org>2003-02-12 10:41:05 +0800
commit7b01b20f70bacd7d9fca0d65a3ca88b8cb88934f (patch)
tree842e8df2fa4ed84a894a72bf5862493324392d96 /calendar/gui
parent2b010a5021938a9962653dfe541e43e54c4b5c8c (diff)
downloadgsoc2013-evolution-7b01b20f70bacd7d9fca0d65a3ca88b8cb88934f.tar
gsoc2013-evolution-7b01b20f70bacd7d9fca0d65a3ca88b8cb88934f.tar.gz
gsoc2013-evolution-7b01b20f70bacd7d9fca0d65a3ca88b8cb88934f.tar.bz2
gsoc2013-evolution-7b01b20f70bacd7d9fca0d65a3ca88b8cb88934f.tar.lz
gsoc2013-evolution-7b01b20f70bacd7d9fca0d65a3ca88b8cb88934f.tar.xz
gsoc2013-evolution-7b01b20f70bacd7d9fca0d65a3ca88b8cb88934f.tar.zst
gsoc2013-evolution-7b01b20f70bacd7d9fca0d65a3ca88b8cb88934f.zip
Enable printing for calendar and tasks.
2003-02-11 Hans Petter Jansson <hpj@ximian.com> Enable printing for calendar and tasks. * gui/print.c: Set default font to be "Sans". Store the PrintConfig globally instead of PaperInfo (which doesn't exist anymore). (get_font_for_size): Don't use gnome_font_face_find_closest_from_weight_slant() anymore, since it's broken. Instead, use gnome_font_face_find() and put bold- and italicness in the name to look for. Descenders can now be negative, so have to take the absolute value to get font height. (print_comp): Use global, persistent print configuration. GnomePrintDialog is now a GtkDialog. Remove manual configuration parameter shuffling. Set up page using new methods. (print_calendar): Like print_comp(). For month view, force landscape mode by temporarily setting it in the config, and remove the old hack. (print_setup): Port. I'm not sure this works, but at least it compiles now. How do I test this code path? (print_day_view): Pass NULL for page denominator. (print_week_view): Ditto. (print_month_view): Ditto. (print_year_view): Ditto. (print_comp_item): Add missing gnome_print_beginpage(). How did this work before? * gui/tasks-control.c: Store the PrintConfig globally instead of passing individual parameters every time. Persistent too. (print_title): Look for "Sans Bold" instead of "Times" with GNOME_FONT_BOLD property. Don't use find_closest_from_weight_slant(). (print_tasks): Set up page using new methods. GnomePrintMaster -> GnomePrintJob. Get params from global config instead of args. (tasks_control_print_cmd): Use global, persistent print configuration. Remove manual portrait/landscape hack. GnomePrintDialog is now a GtkDialog. Set params in global config instead of passing them to print_tasks(). (tasks_control_print_preview_cmd): print_tasks() now takes fewer args. svn path=/trunk/; revision=19889
Diffstat (limited to 'calendar/gui')
-rw-r--r--calendar/gui/print.c224
-rw-r--r--calendar/gui/tasks-control.c144
2 files changed, 151 insertions, 217 deletions
diff --git a/calendar/gui/print.c b/calendar/gui/print.c
index b299d60df9..472c447b10 100644
--- a/calendar/gui/print.c
+++ b/calendar/gui/print.c
@@ -61,8 +61,9 @@
* what gnome-print uses.
*/
-/* The font to use */
-#define DEFAULT_FONT "Times"
+/* The fonts to use */
+#define REGULAR_FONT "Sans Regular"
+#define BOLD_FONT "Sans Bold"
/* The font size to use for normal text. */
#define DAY_NORMAL_FONT_SIZE 12
@@ -164,7 +165,7 @@ struct einfo
int count;
};
-static const GnomePrintPaper *paper_info = NULL;
+static GnomePrintConfig *print_config = NULL;
/* Convenience function to help the transition to timezone functions.
@@ -257,17 +258,33 @@ get_font_for_size (double h, GnomeFontWeight weight, gboolean italic)
GnomeFontFace *face;
GnomeFont *font;
double asc, desc, size;
-
- face = gnome_font_face_find_closest_from_weight_slant (DEFAULT_FONT, weight, italic);
+ gchar *font_name;
+
+ if (weight <= GNOME_FONT_BOOK)
+ font_name = REGULAR_FONT;
+ else
+ font_name = BOLD_FONT;
+
+ if (italic)
+ font_name = g_strconcat (font_name, " Italic", NULL);
+
+ /* This function is broken in gnome-print (it doesn't find a suitable face).
+ * face = gnome_font_face_find_closest_from_weight_slant (DEFAULT_FONT, weight, italic); */
+ face = gnome_font_face_find (font_name);
+
asc = gnome_font_face_get_ascender (face);
- desc = gnome_font_face_get_descender (face);
+ desc = abs (gnome_font_face_get_descender (face));
size = h * 1000 / (asc + desc);
+
g_print ("Print Info: %f, %f, %f\n", asc, desc, size);
-
- font = gnome_font_find_closest_from_weight_slant (DEFAULT_FONT, weight, italic, size);
+
+ /* This function is broken in gnome-print (it doesn't find a suitable font).
+ * font = gnome_font_find_closest_from_weight_slant (DEFAULT_FONT, weight, italic, size); */
+ font = gnome_font_find_closest (font_name, size);
g_object_unref (face);
-
+ if (italic)
+ g_free (font_name);
return font;
}
@@ -1938,8 +1955,7 @@ print_day_view (GnomePrintContext *pc, GnomeCalendar *gcal, time_t date,
todo = (right - left) * 0.75 + left;
header = top - HEADER_HEIGHT;
- /* FIXME: What is the name supposed to be for? */
- gnome_print_beginpage (pc, "Calendar Day View");
+ gnome_print_beginpage (pc, NULL);
/* Print the main view with all the events in. */
print_day_details (pc, gcal, date,
@@ -1997,8 +2013,7 @@ print_week_view (GnomePrintContext *pc, GnomeCalendar *gcal, time_t date,
header = top - HEADER_HEIGHT;
- /* FIXME: What is the name supposed to be for? */
- gnome_print_beginpage (pc, "Calendar Week View");
+ gnome_print_beginpage (pc, NULL);
tm = *convert_timet_to_struct_tm (date, zone);
week_start_day = calendar_config_get_week_start_day ();
@@ -2065,8 +2080,7 @@ print_month_view (GnomePrintContext *pc, GnomeCalendar *gcal, time_t date,
header = top - HEADER_HEIGHT;
- /* FIXME: What is the name supposed to be for? */
- gnome_print_beginpage (pc, "Calendar Month View");
+ gnome_print_beginpage (pc, NULL);
/* Print the main month view. */
print_month_summary (pc, gcal, date, left, right, header, bottom);
@@ -2101,8 +2115,7 @@ print_year_view (GnomePrintContext *pc, GnomeCalendar *gcal, time_t date,
{
char buf[100];
- /* FIXME: What is the name supposed to be for? */
- gnome_print_beginpage (pc, "Calendar Year View");
+ gnome_print_beginpage (pc, NULL);
print_year_summary (pc, gcal, date, left, right, top - 50, bottom,
TRUE);
@@ -2249,6 +2262,8 @@ print_comp_item (GnomePrintContext *pc, CalComponent *comp, CalClient *client,
else
return;
+ gnome_print_beginpage (pc, NULL);
+
/* Print the title in a box at the top of the page. */
font = get_font_for_size (18, GNOME_FONT_BOLD, FALSE);
header_size = 50;
@@ -2408,44 +2423,44 @@ void
print_calendar (GnomeCalendar *gcal, gboolean preview, time_t date,
PrintView default_view)
{
-#warning "Re-implement printing."
-#if 0
- GnomePrintConfig *config;
GnomePrintJob *gpm;
GnomePrintContext *pc;
int copies, collate;
- double l, r, t, b;
+ double l, r, t, b, temp_d;
+ gchar *old_orientation;
g_return_if_fail (gcal != NULL);
g_return_if_fail (GNOME_IS_CALENDAR (gcal));
- config = NULL;
+ if (!print_config)
+ print_config = gnome_print_config_default ();
+
copies = 1;
collate = FALSE;
+ gpm = gnome_print_job_new (print_config);
+
if (!preview) {
GtkWidget *gpd;
GtkWidget *range;
int view;
- gpd = gnome_print_dialog_new (NULL, _("Print"), 0);
-
- /* FIXME: THe rest of this func needs to be converted */
+ gpd = gnome_print_dialog_new (gpm, _("Print"), 0);
view = (int) default_view;
range = range_selector_new (gpd, date, &view);
gnome_print_dialog_construct_range_custom (GNOME_PRINT_DIALOG (gpd), range);
- gnome_dialog_set_default (GNOME_DIALOG (gpd),
- GNOME_PRINT_PRINT);
+ gtk_dialog_set_default_response (GTK_DIALOG (gpd),
+ GNOME_PRINT_DIALOG_RESPONSE_PRINT);
/* Run dialog */
- switch (gnome_dialog_run (GNOME_DIALOG (gpd))) {
- case GNOME_PRINT_PRINT:
+ switch (gtk_dialog_run (GTK_DIALOG (gpd))) {
+ case GNOME_PRINT_DIALOG_RESPONSE_PRINT:
break;
- case GNOME_PRINT_PREVIEW:
+ case GNOME_PRINT_DIALOG_RESPONSE_PREVIEW:
preview = TRUE;
break;
@@ -2453,41 +2468,30 @@ print_calendar (GnomeCalendar *gcal, gboolean preview, time_t date,
return;
default:
- gnome_dialog_close (GNOME_DIALOG (gpd));
+ gtk_widget_destroy (gpd);
return;
}
e_dialog_get_values (gpd);
default_view = (PrintView) view;
- gnome_print_dialog_get_copies (GNOME_PRINT_DIALOG (gpd),
- &copies, &collate);
- printer = gnome_print_dialog_get_printer (GNOME_PRINT_DIALOG (gpd));
-
- gnome_dialog_close (GNOME_DIALOG (gpd));
+ gtk_widget_destroy (gpd);
}
- /* FIXME: allow configuration of paper size */
-
- gpm = gnome_print_job_new ();
-
- if (paper_info == NULL)
- paper_info = gnome_paper_with_name (gnome_paper_name_default ());
- gnome_print_job_set_paper (gpm, paper_info);
-
- if (printer)
- gnome_print_job_set_printer (gpm, printer);
+ old_orientation = gnome_print_config_get (print_config, GNOME_PRINT_KEY_PAGE_ORIENTATION);
- gnome_print_job_set_copies (gpm, copies, collate);
+ if (default_view == PRINT_VIEW_MONTH)
+ gnome_print_config_set (print_config, GNOME_PRINT_KEY_PAGE_ORIENTATION, "R90");
pc = gnome_print_job_get_context (gpm);
+ gnome_print_config_get_page_size (print_config, &r, &t);
- l = gnome_paper_lmargin (paper_info);
- r = gnome_paper_pswidth (paper_info)
- - gnome_paper_rmargin (paper_info);
- t = gnome_paper_psheight (paper_info)
- - gnome_paper_tmargin (paper_info);
- b = gnome_paper_bmargin (paper_info);
+ gnome_print_config_get_double (print_config, GNOME_PRINT_KEY_PAGE_MARGIN_TOP, &temp_d);
+ t -= temp_d;
+ gnome_print_config_get_double (print_config, GNOME_PRINT_KEY_PAGE_MARGIN_RIGHT, &temp_d);
+ r -= temp_d;
+ gnome_print_config_get_double (print_config, GNOME_PRINT_KEY_PAGE_MARGIN_BOTTOM, &b);
+ gnome_print_config_get_double (print_config, GNOME_PRINT_KEY_PAGE_MARGIN_LEFT, &l);
/* depending on the view, do a different output */
switch (default_view) {
@@ -2498,10 +2502,7 @@ print_calendar (GnomeCalendar *gcal, gboolean preview, time_t date,
print_week_view (pc, gcal, date, l, r, t, b);
break;
case PRINT_VIEW_MONTH:
- gnome_print_rotate (pc, 90);
- gnome_print_translate (pc, 0,
- -gnome_paper_pswidth (paper_info));
- print_month_view (pc, gcal, date, b, t, r, l);
+ print_month_view (pc, gcal, date, l, r, t, b);
break;
case PRINT_VIEW_YEAR:
print_year_view (pc, gcal, date, l, r, t, b);
@@ -2513,56 +2514,55 @@ print_calendar (GnomeCalendar *gcal, gboolean preview, time_t date,
gnome_print_job_close (gpm);
if (preview) {
- GnomePrintJobPreview *gpmp;
- gboolean landscape = FALSE;
+ GtkWidget *gpmp;
- if (default_view == PRINT_VIEW_MONTH)
- landscape = TRUE;
-
- gpmp = gnome_print_job_preview_new_with_orientation (gpm, _("Print Preview"), landscape);
- gtk_widget_show (GTK_WIDGET (gpmp));
+ gpmp = gnome_print_job_preview_new (gpm, _("Print Preview"));
+ gtk_widget_show (gpmp);
} else {
gnome_print_job_print (gpm);
}
+ gnome_print_config_set (print_config, GNOME_PRINT_KEY_PAGE_ORIENTATION, old_orientation);
+ g_free (old_orientation);
g_object_unref (gpm);
-#endif
}
void
print_comp (CalComponent *comp, CalClient *client, gboolean preview)
{
-#if 0
- GnomePrinter *printer;
GnomePrintJob *gpm;
GnomePrintContext *pc;
int copies, collate;
- double l, r, t, b;
+ double l, r, t, b, temp_d;
g_return_if_fail (comp != NULL);
g_return_if_fail (IS_CAL_COMPONENT (comp));
- printer = NULL;
+ if (!print_config)
+ print_config = gnome_print_config_default ();
+
copies = 1;
collate = FALSE;
+ gpm = gnome_print_job_new (print_config);
+
if (!preview) {
GtkWidget *gpd;
- gpd = gnome_print_dialog_new (_("Print Item"),
+ gpd = gnome_print_dialog_new (gpm, _("Print Item"),
GNOME_PRINT_DIALOG_COPIES);
- gnome_dialog_set_default (GNOME_DIALOG (gpd),
- GNOME_PRINT_PRINT);
+ gtk_dialog_set_default_response (GTK_DIALOG (gpd),
+ GNOME_PRINT_DIALOG_RESPONSE_PRINT);
/* Run dialog */
- switch (gnome_dialog_run (GNOME_DIALOG (gpd))) {
- case GNOME_PRINT_PRINT:
+ switch (gtk_dialog_run (GTK_DIALOG (gpd))) {
+ case GNOME_PRINT_DIALOG_RESPONSE_PRINT:
break;
- case GNOME_PRINT_PREVIEW:
+ case GNOME_PRINT_DIALOG_RESPONSE_PREVIEW:
preview = TRUE;
break;
@@ -2570,83 +2570,69 @@ print_comp (CalComponent *comp, CalClient *client, gboolean preview)
return;
default:
- gnome_dialog_close (GNOME_DIALOG (gpd));
+ gtk_widget_destroy (gpd);
return;
}
e_dialog_get_values (gpd);
-
- gnome_print_dialog_get_copies (GNOME_PRINT_DIALOG (gpd),
- &copies, &collate);
- printer = gnome_print_dialog_get_printer (GNOME_PRINT_DIALOG (gpd));
-
- gnome_dialog_close (GNOME_DIALOG (gpd));
+ gtk_widget_destroy (gpd);
}
- /* FIXME: allow configuration of paper size */
-
- gpm = gnome_print_job_new ();
-
- if (paper_info == NULL)
- paper_info = gnome_paper_with_name (gnome_paper_name_default ());
- gnome_print_job_set_paper (gpm, paper_info);
-
- if (printer)
- gnome_print_job_set_printer (gpm, printer);
-
- gnome_print_job_set_copies (gpm, copies, collate);
-
pc = gnome_print_job_get_context (gpm);
+ gnome_print_config_get_page_size (print_config, &r, &t);
- l = gnome_paper_lmargin (paper_info);
- r = gnome_paper_pswidth (paper_info)
- - gnome_paper_rmargin (paper_info);
- t = gnome_paper_psheight (paper_info)
- - gnome_paper_tmargin (paper_info);
- b = gnome_paper_bmargin (paper_info);
+ gnome_print_config_get_double (print_config, GNOME_PRINT_KEY_PAGE_MARGIN_TOP, &temp_d);
+ t -= temp_d;
+ gnome_print_config_get_double (print_config, GNOME_PRINT_KEY_PAGE_MARGIN_RIGHT, &temp_d);
+ r -= temp_d;
+ gnome_print_config_get_double (print_config, GNOME_PRINT_KEY_PAGE_MARGIN_BOTTOM, &b);
+ gnome_print_config_get_double (print_config, GNOME_PRINT_KEY_PAGE_MARGIN_LEFT, &l);
print_comp_item (pc, comp, client, l, r, t, b);
-
gnome_print_job_close (gpm);
if (preview) {
- GnomePrintJobPreview *gpmp;
+ GtkWidget *gpmp;
- gpmp = gnome_print_job_preview_new (gpm,
- _("Print Preview"));
- gtk_widget_show (GTK_WIDGET (gpmp));
+ gpmp = gnome_print_job_preview_new (gpm, _("Print Preview"));
+ gtk_widget_show (gpmp);
} else {
gnome_print_job_print (gpm);
}
g_object_unref (gpm);
-#endif
}
void
print_setup (void)
{
-#if 0
- GtkWidget *dlg, *ps;
- gint btn;
+ GtkWidget *ps;
- ps = gnome_paper_selector_new ();
- gtk_widget_show (ps);
+ if (!print_config)
+ print_config = gnome_print_config_default ();
- dlg = gnome_dialog_new (_("Print Setup"),
- GNOME_STOCK_BUTTON_OK,
- GNOME_STOCK_BUTTON_CANCEL,
- NULL);
- gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dlg)->vbox), ps, TRUE, TRUE, 2);
+ ps = gnome_paper_selector_new (print_config);
+ gtk_widget_show (ps);
- btn = gnome_dialog_run (GNOME_DIALOG (dlg));
+#if 0
+ dlg = gtk_dialog_new_with_buttons (_("Print Setup"),
+ NULL, /* FIXME: Set a sensible parent */
+ 0,
+ GNOME_STOCK_BUTTON_OK,
+ GNOME_STOCK_BUTTON_CANCEL,
+ NULL);
+ gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), ps, TRUE, TRUE, 2);
+
+ btn = gtk_dialog_run (GTK_DIALOG (dlg));
if (btn == 0) {
gchar *name;
+ print_config = gnome_paper_selector_get_config (ps);
+
name = gnome_paper_selector_get_name (GNOME_PAPER_SELECTOR (ps));
paper_info = gnome_paper_with_name (name);
}
- gnome_dialog_close (GNOME_DIALOG (dlg));
+ gtk_widget_destroy (dlg);
#endif
}
diff --git a/calendar/gui/tasks-control.c b/calendar/gui/tasks-control.c
index 2cb45c180c..31d1e2b984 100644
--- a/calendar/gui/tasks-control.c
+++ b/calendar/gui/tasks-control.c
@@ -102,6 +102,9 @@ static void tasks_control_print_preview_cmd (BonoboUIComponent *uic,
const char *path);
+static GnomePrintConfig *print_config = NULL;
+
+
BonoboControl *
tasks_control_new (void)
{
@@ -503,7 +506,7 @@ print_title (GnomePrintContext *pc,
char *text;
double w, x, y;
- font = gnome_font_find_closest_from_weight_slant ("Times", GNOME_FONT_BOLD, 0, 18);
+ font = gnome_font_find_closest ("Sans Bold", 18);
text = _("Tasks");
w = gnome_font_get_width_utf8 (font, text);
@@ -519,60 +522,44 @@ print_title (GnomePrintContext *pc,
g_object_unref (font);
}
-
static void
-print_tasks (ETasks *tasks, gboolean preview, gboolean landscape,
- int copies, gboolean collate)
+print_tasks (ETasks *tasks, gboolean preview)
{
-#warning "Re-implement printing."
-#if 0
ECalendarTable *cal_table;
EPrintable *printable;
ETable *etable;
- GnomePrintMaster *master;
GnomePrintContext *pc;
- const GnomePrintPaper *paper_info;
- double l, r, t, b, page_width, page_height, left_margin, bottom_margin;
+ GnomePrintJob *gpm;
+ double l, r, t, b, page_width, page_height, left_margin, bottom_margin, temp_d;
+
+ if (!print_config)
+ print_config = gnome_print_config_default ();
cal_table = e_tasks_get_calendar_table (tasks);
etable = e_calendar_table_get_table (E_CALENDAR_TABLE (cal_table));
printable = e_table_get_printable (etable);
+ e_printable_reset (printable);
- master = gnome_print_master_new ();
+ gpm = gnome_print_job_new (print_config);
+ pc = gnome_print_job_get_context (gpm);
- paper_info = gnome_print_paper_with_name (gnome_paper_name_default ());
- gnome_print_master_set_paper (master, paper_info);
+ gnome_print_config_get_page_size (print_config, &r, &t);
- gnome_print_master_set_copies (master, copies, collate);
- pc = gnome_print_master_get_context (master);
- e_printable_reset (printable);
+ gnome_print_config_get_double (print_config, GNOME_PRINT_KEY_PAGE_MARGIN_TOP, &temp_d);
+ t -= temp_d;
+ gnome_print_config_get_double (print_config, GNOME_PRINT_KEY_PAGE_MARGIN_RIGHT, &temp_d);
+ r -= temp_d;
+ gnome_print_config_get_double (print_config, GNOME_PRINT_KEY_PAGE_MARGIN_BOTTOM, &b);
+ gnome_print_config_get_double (print_config, GNOME_PRINT_KEY_PAGE_MARGIN_LEFT, &l);
- l = gnome_paper_lmargin (paper_info);
- r = gnome_paper_pswidth (paper_info)
- - gnome_paper_rmargin (paper_info);
- t = gnome_paper_psheight (paper_info)
- - gnome_paper_tmargin (paper_info);
- b = gnome_paper_bmargin (paper_info);
-
- if (landscape) {
- page_width = t - b;
- page_height = r - l;
- left_margin = b;
- bottom_margin = gnome_paper_rmargin (paper_info);
- } else {
- page_width = r - l;
- page_height = t - b;
- left_margin = l;
- bottom_margin = b;
- }
+ page_width = r - l;
+ page_height = t - b;
+ left_margin = l;
+ bottom_margin = b;
while (e_printable_data_left (printable)) {
gnome_print_beginpage (pc, "Tasks");
gnome_print_gsave (pc);
- if (landscape) {
- gnome_print_rotate (pc, 90);
- gnome_print_translate (pc, 0, -gnome_paper_pswidth (paper_info));
- }
gnome_print_translate (pc, left_margin, bottom_margin);
@@ -584,19 +571,19 @@ print_tasks (ETasks *tasks, gboolean preview, gboolean landscape,
gnome_print_grestore (pc);
gnome_print_showpage (pc);
}
- gnome_print_master_close (master);
+
+ gnome_print_job_close (gpm);
if (preview) {
- GnomePrintMasterPreview *gpmp;
- gpmp = gnome_print_master_preview_new_with_orientation (master, _("Print Preview"), landscape);
- gtk_widget_show (GTK_WIDGET (gpmp));
+ GtkWidget *gpmp;
+ gpmp = gnome_print_job_preview_new (gpm, _("Print Preview"));
+ gtk_widget_show (gpmp);
} else {
- gnome_print_master_print (master);
+ gnome_print_job_print (gpm);
}
- g_object_unref (master);
+ g_object_unref (gpm);
g_object_unref (printable);
-#endif
}
@@ -606,57 +593,27 @@ tasks_control_print_cmd (BonoboUIComponent *uic,
gpointer data,
const char *path)
{
-#if 0
ETasks *tasks;
- GtkWidget *gpd, *mode_box, *portrait_radio, *landscape_radio;
- GtkWidget *dialog_vbox, *dialog_hbox, *mode_frame;
- GList *children;
- GSList *group;
- gboolean preview = FALSE, landscape = FALSE;
- GnomePrinter *printer;
- int copies;
- gboolean collate;
+ GtkWidget *gpd;
+ gboolean preview = FALSE;
+ GnomePrintJob *gpm;
tasks = E_TASKS (data);
- gpd = gnome_print_dialog_new (_("Print Tasks"),
- GNOME_PRINT_DIALOG_COPIES);
-
- mode_frame = gtk_frame_new (_("Orientation"));
-
- mode_box = gtk_vbox_new (FALSE, 4);
- gtk_container_add (GTK_CONTAINER (mode_frame), mode_box);
-
- /* Portrait */
- portrait_radio = gtk_radio_button_new_with_label (NULL, _("Portrait"));
- group = gtk_radio_button_group (GTK_RADIO_BUTTON (portrait_radio));
- gtk_box_pack_start (GTK_BOX (mode_box), portrait_radio,
- FALSE, FALSE, 0);
-
- /* Landscape */
- landscape_radio = gtk_radio_button_new_with_label (group,
- _("Landscape"));
- gtk_box_pack_start (GTK_BOX (mode_box), landscape_radio,
- FALSE, FALSE, 0);
+ if (!print_config)
+ print_config = gnome_print_config_default ();
- gtk_widget_show_all (mode_frame);
+ gpm = gnome_print_job_new (print_config);
- /* A bit of a hack to insert our own Orientation option. */
- dialog_vbox = GNOME_DIALOG (gpd)->vbox;
- children = gtk_container_children (GTK_CONTAINER (dialog_vbox));
- dialog_hbox = children->next->data;
- g_list_free (children);
- gtk_box_pack_start (GTK_BOX (dialog_hbox), mode_frame,
- FALSE, FALSE, 3);
-
- gnome_dialog_set_default (GNOME_DIALOG (gpd), GNOME_PRINT_PRINT);
+ gpd = gnome_print_dialog_new (gpm, _("Print Tasks"), GNOME_PRINT_DIALOG_COPIES);
+ gtk_dialog_set_default_response (GTK_DIALOG (gpd), GNOME_PRINT_DIALOG_RESPONSE_PRINT);
/* Run dialog */
- switch (gnome_dialog_run (GNOME_DIALOG (gpd))) {
- case GNOME_PRINT_PRINT:
+ switch (gtk_dialog_run (GTK_DIALOG (gpd))) {
+ case GNOME_PRINT_DIALOG_RESPONSE_PRINT:
break;
- case GNOME_PRINT_PREVIEW:
+ case GNOME_PRINT_DIALOG_RESPONSE_PREVIEW:
preview = TRUE;
break;
@@ -664,21 +621,12 @@ tasks_control_print_cmd (BonoboUIComponent *uic,
return;
default:
- gnome_dialog_close (GNOME_DIALOG (gpd));
+ gtk_widget_destroy (gpd);
return;
}
- gnome_print_dialog_get_copies (GNOME_PRINT_DIALOG (gpd),
- &copies, &collate);
- if (GTK_TOGGLE_BUTTON (landscape_radio)->active)
- landscape = TRUE;
-
- printer = gnome_print_dialog_get_printer (GNOME_PRINT_DIALOG (gpd));
-
- gnome_dialog_close (GNOME_DIALOG (gpd));
-
- print_tasks (tasks, preview, landscape, copies, collate);
-#endif
+ gtk_widget_destroy (gpd);
+ print_tasks (tasks, preview);
}
static void
@@ -690,6 +638,6 @@ tasks_control_print_preview_cmd (BonoboUIComponent *uic,
tasks = E_TASKS (data);
- print_tasks (tasks, TRUE, FALSE, 1, FALSE);
+ print_tasks (tasks, TRUE);
}