diff options
author | Federico Mena Quintero <federico@helixcode.com> | 2000-06-03 10:28:34 +0800 |
---|---|---|
committer | Federico Mena Quintero <federico@src.gnome.org> | 2000-06-03 10:28:34 +0800 |
commit | 6ec291cbc6660e1732543bcfc20885c7020cb8ed (patch) | |
tree | ae96a9e80e9f2f1e24ca0adaa55be3fc95c45c3f /calendar/gui/calendar-commands.c | |
parent | 31642359471574aad4a8427a18692d2558c91c5c (diff) | |
download | gsoc2013-evolution-6ec291cbc6660e1732543bcfc20885c7020cb8ed.tar gsoc2013-evolution-6ec291cbc6660e1732543bcfc20885c7020cb8ed.tar.gz gsoc2013-evolution-6ec291cbc6660e1732543bcfc20885c7020cb8ed.tar.bz2 gsoc2013-evolution-6ec291cbc6660e1732543bcfc20885c7020cb8ed.tar.lz gsoc2013-evolution-6ec291cbc6660e1732543bcfc20885c7020cb8ed.tar.xz gsoc2013-evolution-6ec291cbc6660e1732543bcfc20885c7020cb8ed.tar.zst gsoc2013-evolution-6ec291cbc6660e1732543bcfc20885c7020cb8ed.zip |
New function to call the print engine. (calendar_toolbar): Added the Print
2000-06-02 Federico Mena Quintero <federico@helixcode.com>
* gui/calendar-commands.c (print): New function to call the print
engine.
(calendar_toolbar): Added the Print button.
(calendar_control_activate): Added the File/Print item.
* gui/e-day-view.c (e_day_view_get_selected_time_range): Allow
start_time and end_time to be NULL.
* gui/e-week-view.c (e_week_view_get_selected_time_range):
Likewise.
* gui/print.c (range_selector_new): Show the range selector
widgets. Use the correct radio group for all of them!
(print_calendar): Do the dialog box here. We may want to split
this function later into smaller chunks.
svn path=/trunk/; revision=3409
Diffstat (limited to 'calendar/gui/calendar-commands.c')
-rw-r--r-- | calendar/gui/calendar-commands.c | 60 |
1 files changed, 58 insertions, 2 deletions
diff --git a/calendar/gui/calendar-commands.c b/calendar/gui/calendar-commands.c index 96896810e6..49bb023875 100644 --- a/calendar/gui/calendar-commands.c +++ b/calendar/gui/calendar-commands.c @@ -22,6 +22,7 @@ #include <cal-util/timeutil.h> #include "gnome-cal.h" #include "calendar-commands.h" +#include "print.h" #include "dayview.xpm" #include "workweekview.xpm" @@ -224,6 +225,51 @@ display_objedit_today (BonoboUIHandler *uih, void *user_data, const char *path) ical_object_unref (ico); } +/* Prints the calendar at its current view and time range */ +static void +print (GnomeCalendar *gcal, gboolean preview) +{ + time_t start; + const char *view; + PrintView print_view; + + gnome_calendar_get_current_time_range (gcal, &start, NULL); + view = gnome_calendar_get_current_view_name (gcal); + + if (strcmp (view, "dayview") == 0) + print_view = PRINT_VIEW_DAY; + else if (strcmp (view, "workweekview") == 0 || strcmp (view, "weekview") == 0) + print_view = PRINT_VIEW_WEEK; + else if (strcmp (view, "monthview") == 0) + print_view = PRINT_VIEW_MONTH; + else { + g_assert_not_reached (); + print_view = PRINT_VIEW_DAY; + } + + print_calendar (gcal, preview, start, print_view); +} + +/* Toolbar/Print callback */ +static void +tb_print_cb (GtkWidget *widget, gpointer data) +{ + GnomeCalendar *gcal; + + gcal = GNOME_CALENDAR (data); + print (gcal, FALSE); +} + +/* File/Print callback */ +static void +file_print_cb (BonoboUIHandler *uih, void *data, const char *path) +{ + GnomeCalendar *gcal; + + gcal = GNOME_CALENDAR (data); + print (gcal, FALSE); +} + void time_format_changed (void) { @@ -494,11 +540,15 @@ static GnomeUIInfo gnome_toolbar_view_buttons [] = { }; -static GnomeUIInfo gnome_toolbar [] = { +static GnomeUIInfo calendar_toolbar [] = { GNOMEUIINFO_ITEM_STOCK (N_("New"), N_("Create a new appointment"), display_objedit, GNOME_STOCK_PIXMAP_NEW), GNOMEUIINFO_SEPARATOR, + GNOMEUIINFO_ITEM_STOCK (N_("Print"), N_("Print this calendar"), tb_print_cb, GNOME_STOCK_PIXMAP_PRINT), + + GNOMEUIINFO_SEPARATOR, + GNOMEUIINFO_ITEM_STOCK (N_("Prev"), N_("Go back in time"), previous_clicked, GNOME_STOCK_PIXMAP_BACK), GNOMEUIINFO_ITEM_STOCK (N_("Today"), N_("Go to present time"), today_clicked, GNOME_STOCK_PIXMAP_HOME), GNOMEUIINFO_ITEM_STOCK (N_("Next"), N_("Go forward in time"), next_clicked, GNOME_STOCK_PIXMAP_FORWARD), @@ -561,7 +611,7 @@ calendar_control_activate (BonoboControl *control, toolbar = gtk_toolbar_new (GTK_ORIENTATION_HORIZONTAL, GTK_TOOLBAR_BOTH); gnome_app_fill_toolbar_custom (GTK_TOOLBAR (toolbar), - gnome_toolbar, &uibdata, + calendar_toolbar, &uibdata, /*app->accel_group*/ NULL); /*gtk_toolbar_append_space (GTK_TOOLBAR (toolbar));*/ @@ -617,6 +667,12 @@ calendar_control_activate (BonoboControl *control, -1, BONOBO_UI_HANDLER_PIXMAP_NONE, NULL, 0, 0, save_as_calendar_cmd, cal); + bonobo_ui_handler_menu_new_item (uih, "/File/Print", N_("Print..."), + N_("Print this calendar"), -1, + BONOBO_UI_HANDLER_PIXMAP_STOCK, + GNOME_STOCK_PIXMAP_PRINT, + 'p', GDK_CONTROL_MASK, + file_print_cb, cal); bonobo_ui_handler_menu_new_item (uih, "/File/Close", N_("_Close Calendar"), N_("Close current calendar"), -1, BONOBO_UI_HANDLER_PIXMAP_NONE, NULL, |