From 94a486a7b4207e617da30b172aa9873e0fbb0215 Mon Sep 17 00:00:00 2001 From: Damon Chaplin Date: Mon, 24 Apr 2000 14:01:46 +0000 Subject: added new source files and pixmaps, and removed old source files, which 2000-04-24 Damon Chaplin * gui/Makefile.am: added new source files and pixmaps, and removed old source files, which can be deleted. * gui/e-week-view-titles-item.[hc]: * gui/e-week-view-main-item.[hc]: * gui/e-week-view-event-item.[hc]: * gui/e-week-view.[hc]: new files implementing the week/month views. * gui/yearview.xpm: * gui/monthview.xpm: * gui/weekview.xpm: * gui/workweekview.xpm: * gui/dayview.xpm: new pixmaps for the toolbar buttons. These aren't intended to be the final pixmaps. * gui/calendar-commands.c: added radio buttons to the toolbar to switch between the calendar views, and moved the am_pm_flag here so we can get rid of view-utils.c. * gui/gnome-cal.[hc]: made it a subclass of GtkVBox, rearranged the widgets into 2 notebooks, and added the selection_start_time and selection_end_time fields. * gui/goto.c: updated to use new selection time range. * gui/quick-view.c: added '#include ' so it compiles. * gui/e-day-view.[hc]: changed the interface to support the new selection time range, got rid of a few debugging messages and changed a few bits. svn path=/trunk/; revision=2583 --- calendar/gui/calendar-commands.c | 78 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 74 insertions(+), 4 deletions(-) (limited to 'calendar/gui/calendar-commands.c') diff --git a/calendar/gui/calendar-commands.c b/calendar/gui/calendar-commands.c index d6e10f214b..4820c2892e 100644 --- a/calendar/gui/calendar-commands.c +++ b/calendar/gui/calendar-commands.c @@ -25,6 +25,11 @@ #include "gnome-cal.h" #include "calendar-commands.h" +#include "dayview.xpm" +#include "workweekview.xpm" +#include "weekview.xpm" +#include "monthview.xpm" +#include "yearview.xpm" /* The username, used to set the `owner' field of the event */ char *user_name; @@ -44,6 +49,9 @@ int week_starts_on_monday; /* If true, enable debug output for alarms */ int debug_alarms = 0; +/* If AM/PM indicators should be used. This may not be supported by the new + views. */ +int am_pm_flag = 0; /* The array of color properties -- keep in sync with the enumeration defined in main.h. The color * values specified here are the defaults for the program. @@ -181,11 +189,12 @@ display_objedit (BonoboUIHandler *uih, void *user_data, const char *path) iCalObject *ico; GnomeCalendar *gcal = GNOME_CALENDAR (user_data); - /* Default to the day the user is looking at */ + /* FIXME: Should get the selection time from the view, since they + may not be using the gcal's times. */ ico = ical_new ("", user_name, ""); ico->new = 1; - ico->dtstart = time_add_minutes (gcal->current_display, day_begin * 60); - ico->dtend = time_add_minutes (ico->dtstart, day_begin * 60 + 30 ); + ico->dtstart = gcal->selection_start_time; + ico->dtend = gcal->selection_end_time; ee = event_editor_new (gcal, ico); gtk_widget_show (ee); @@ -282,6 +291,41 @@ goto_clicked (BonoboUIHandler *uih, void *user_data, const char *path) goto_dialog (gcal); } +static void +show_day_view_clicked (BonoboUIHandler *uih, void *user_data, const char *path) +{ + GnomeCalendar *gcal = GNOME_CALENDAR (user_data); + gnome_calendar_set_view (gcal, "dayview"); +} + +static void +show_work_week_view_clicked (BonoboUIHandler *uih, void *user_data, const char *path) +{ + GnomeCalendar *gcal = GNOME_CALENDAR (user_data); + gnome_calendar_set_view (gcal, "workweekview"); +} + +static void +show_week_view_clicked (BonoboUIHandler *uih, void *user_data, const char *path) +{ + GnomeCalendar *gcal = GNOME_CALENDAR (user_data); + gnome_calendar_set_view (gcal, "weekview"); +} + +static void +show_month_view_clicked (BonoboUIHandler *uih, void *user_data, const char *path) +{ + GnomeCalendar *gcal = GNOME_CALENDAR (user_data); + gnome_calendar_set_view (gcal, "monthview"); +} + +static void +show_year_view_clicked (BonoboUIHandler *uih, void *user_data, const char *path) +{ + GnomeCalendar *gcal = GNOME_CALENDAR (user_data); + gnome_calendar_set_view (gcal, "yearview"); +} + static void new_calendar_cmd (BonoboUIHandler *uih, void *user_data, const char *path) { @@ -417,6 +461,28 @@ properties_cmd (BonoboUIHandler *uih, void *user_data, const char *path) } +static GnomeUIInfo gnome_toolbar_view_buttons [] = { + GNOMEUIINFO_RADIOITEM (N_("Day"), N_("Show 1 day"), + show_day_view_clicked, + dayview_xpm), + GNOMEUIINFO_RADIOITEM (N_("5 Days"), N_("Show 5 days"), + show_work_week_view_clicked, + workweekview_xpm), + GNOMEUIINFO_RADIOITEM (N_("Week"), N_("Show 1 week"), + show_week_view_clicked, + weekview_xpm), + GNOMEUIINFO_RADIOITEM (N_("Month"), N_("Show 1 month"), + show_month_view_clicked, + monthview_xpm), +#if 0 + GNOMEUIINFO_RADIOITEM (N_("Year"), N_("Show 1 year"), + show_year_view_clicked, + yearview_xpm), +#endif + GNOMEUIINFO_END +}; + + static GnomeUIInfo gnome_toolbar [] = { GNOMEUIINFO_ITEM_STOCK (N_("New"), N_("Create a new appointment"), display_objedit, GNOME_STOCK_PIXMAP_NEW), @@ -430,6 +496,10 @@ static GnomeUIInfo gnome_toolbar [] = { GNOMEUIINFO_ITEM_STOCK (N_("Go to"), N_("Go to a specific date"), goto_clicked, GNOME_STOCK_PIXMAP_JUMP_TO), + GNOMEUIINFO_SEPARATOR, + + GNOMEUIINFO_RADIOLIST (gnome_toolbar_view_buttons), + GNOMEUIINFO_END }; @@ -479,7 +549,7 @@ calendar_control_activate (BonoboControl *control, gnome_toolbar, &uibdata, /*app->accel_group*/ NULL); - gtk_toolbar_append_space (GTK_TOOLBAR (toolbar)); + /*gtk_toolbar_append_space (GTK_TOOLBAR (toolbar));*/ gtk_widget_show_all (toolbar); -- cgit