From f4b4da4fcb6a59f56c1fff88ba08a6c9995b807c Mon Sep 17 00:00:00 2001 From: Miguel de Icaza Date: Sun, 18 Mar 2001 08:16:40 +0000 Subject: Added ShowWeekView, ShowMonthView, ShowDay, ShowWorkWeek to the View menu. 2001-03-17 Miguel de Icaza * evolution-calendar.xml: Added ShowWeekView, ShowMonthView, ShowDay, ShowWorkWeek to the View menu. * evolution.xml, evolution-mail.xml: Provide "Actions" in the toplevel evolution. Fill in Actions/Component in Evolution-mail (no visual changes, just internal changes). * evolution-calendar.xml: Added Actions menu. Added New Verb EditNewEvent. 2001-03-17 Miguel de Icaza * gui/e-day-view.c (e_day_view_on_new_event, e_day_view_on_new_appointment): Simplifed this function to use the shared code. * gui/e-week-view.c (e_week_view_on_new_event, e_week_view_on_new_appointment): ditto. * gui/gnome-cal.c (gnome_calendar_new_appointment_for): New function used to launch editor components with a time range. A bunch of functions use this code now instead of duplicating code all over the place svn path=/trunk/; revision=8794 --- calendar/ChangeLog | 12 +++++++++ calendar/gui/calendar-commands.c | 21 +++++++++++++++ calendar/gui/e-day-view.c | 53 ++++++++------------------------------ calendar/gui/e-week-view.c | 55 ++++++++++------------------------------ calendar/gui/gnome-cal.c | 48 +++++++++++++++++++++++++++-------- calendar/gui/gnome-cal.h | 3 +++ mail/folder-browser-factory.c | 6 ++--- ui/ChangeLog | 12 +++++++++ ui/evolution-calendar.xml | 31 +++++++++++++++++++++- ui/evolution-mail.xml | 8 +++--- ui/evolution.xml | 6 ++++- 11 files changed, 151 insertions(+), 104 deletions(-) diff --git a/calendar/ChangeLog b/calendar/ChangeLog index fb33b08758..ccff1dc13f 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,5 +1,17 @@ 2001-03-17 Miguel de Icaza + * gui/e-day-view.c (e_day_view_on_new_event, + e_day_view_on_new_appointment): Simplifed this function to use the + shared code. + + * gui/e-week-view.c (e_week_view_on_new_event, + e_week_view_on_new_appointment): ditto. + + * gui/gnome-cal.c (gnome_calendar_new_appointment_for): New + function used to launch editor components with a time range. A + bunch of functions use this code now instead of duplicating code + all over the place + * gui/e-week-view.c (e_week_view_new_event): Moved functionality here from e_day_view_on_new_appointment. Allows setting for "full day" event. diff --git a/calendar/gui/calendar-commands.c b/calendar/gui/calendar-commands.c index dfffed9b63..a35dfcd21e 100644 --- a/calendar/gui/calendar-commands.c +++ b/calendar/gui/calendar-commands.c @@ -62,6 +62,17 @@ new_appointment_cb (BonoboUIComponent *uic, gpointer data, const char *path) gnome_calendar_new_appointment (gcal); } +static void +new_event_cb (BonoboUIComponent *uic, gpointer data, const char *path) +{ + GnomeCalendar *gcal; + time_t dtstart, dtend; + + gcal = GNOME_CALENDAR (data); + gnome_calendar_get_current_time_range (gcal, &dtstart, &dtend); + gnome_calendar_new_appointment_for (gcal, dtstart, dtend, TRUE); +} + /* Prints the calendar at its current view and time range */ static void print (GnomeCalendar *gcal, gboolean preview) @@ -97,6 +108,14 @@ file_print_cb (BonoboUIComponent *uic, gpointer data, const char *path) print (gcal, FALSE); } +static void +file_print_preview_cb (BonoboUIComponent *uic, gpointer data, const char *path) +{ + GnomeCalendar *gcal; + + gcal = GNOME_CALENDAR (data); + print (gcal, TRUE); +} /* This iterates over each calendar telling them to update their config settings. */ @@ -335,7 +354,9 @@ static BonoboUIVerb verbs [] = { BONOBO_UI_VERB ("CalendarOpen", open_calendar_cmd), BONOBO_UI_VERB ("CalendarSaveAs", save_as_calendar_cmd), BONOBO_UI_VERB ("CalendarPrint", file_print_cb), + BONOBO_UI_VERB ("CalendarPrintPreview", file_print_preview_cb), BONOBO_UI_VERB ("EditNewAppointment", new_appointment_cb), + BONOBO_UI_VERB ("EditNewEvent", new_event_cb), BONOBO_UI_VERB ("CalendarPreferences", properties_cmd), BONOBO_UI_VERB ("CalendarPrev", previous_clicked), diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c index c5051f82df..510572d152 100644 --- a/calendar/gui/e-day-view.c +++ b/calendar/gui/e-day-view.c @@ -321,7 +321,7 @@ static gboolean e_day_view_auto_scroll_handler (gpointer data); static void e_day_view_on_new_appointment (GtkWidget *widget, gpointer data); -static void e_day_view_on_new_full_day (GtkWidget *widget, +static void e_day_view_on_new_event (GtkWidget *widget, gpointer data); static void e_day_view_on_goto_today (GtkWidget *widget, gpointer data); @@ -3027,7 +3027,7 @@ static EPopupMenu main_items [] = { { N_("New Appointment"), NULL, e_day_view_on_new_appointment, NULL, 0 }, { N_("New All Day Event"), NULL, - e_day_view_on_new_full_day, NULL, 0 }, + e_day_view_on_new_event, NULL, 0 }, { "", NULL, NULL, NULL, 0 }, @@ -3115,57 +3115,26 @@ e_day_view_on_event_right_click (EDayView *day_view, e_popup_menu_run (context_menu, (GdkEvent *) bevent, disable_mask, hide_mask, day_view); } -static void -e_day_view_new_event (EDayView *day_view, gboolean all_day) -{ - CalComponent *comp; - CalComponentDateTime date; - time_t dtstart, dtend; - struct icaltimetype itt; - - comp = cal_component_new (); - cal_component_set_new_vtype (comp, CAL_COMPONENT_EVENT); - e_day_view_get_selected_time_range (day_view, &dtstart, &dtend); - - if (all_day){ - dtstart = time_day_begin (dtstart); - dtend = time_day_end (dtend); - } - - date.value = &itt; - date.tzid = NULL; - - *date.value = icaltime_from_timet (dtstart, FALSE); - cal_component_set_dtstart (comp, &date); - - *date.value = icaltime_from_timet (dtend, FALSE); - cal_component_set_dtend (comp, &date); - - cal_component_commit_sequence (comp); - - if (day_view->calendar) - gnome_calendar_edit_object (day_view->calendar, comp); - else - g_warning ("Calendar not set"); - - gtk_object_unref (GTK_OBJECT (comp)); -} - - static void e_day_view_on_new_appointment (GtkWidget *widget, gpointer data) { EDayView *day_view = E_DAY_VIEW (data); + time_t dtstart, dtend; - e_day_view_new_event (day_view, FALSE); + e_day_view_get_selected_time_range (day_view, &dtstart, &dtend); + gnome_calendar_new_appointment_for ( + day_view->calendar, dtstart, dtend, FALSE); } static void -e_day_view_on_new_full_day (GtkWidget *widget, gpointer data) +e_day_view_on_new_event (GtkWidget *widget, gpointer data) { EDayView *day_view = E_DAY_VIEW (data); + time_t dtstart, dtend; - e_day_view_new_event (day_view, TRUE); + e_day_view_get_selected_time_range (day_view, &dtstart, &dtend); + gnome_calendar_new_appointment_for ( + day_view->calendar, dtstart, dtend, TRUE); } static void diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c index 8b05b113c8..b2d5001ab0 100644 --- a/calendar/gui/e-week-view.c +++ b/calendar/gui/e-week-view.c @@ -162,7 +162,7 @@ static gboolean e_week_view_on_jump_button_event (GnomeCanvasItem *item, static gint e_week_view_key_press (GtkWidget *widget, GdkEventKey *event); static void e_week_view_on_new_appointment (GtkWidget *widget, gpointer data); -static void e_week_view_on_new_full_day (GtkWidget *widget, +static void e_week_view_on_new_event (GtkWidget *widget, gpointer data); static void e_week_view_on_goto_today (GtkWidget *widget, gpointer data); @@ -3235,7 +3235,7 @@ static EPopupMenu main_items [] = { { N_("New Appointment..."), NULL, e_week_view_on_new_appointment, NULL, 0 }, { N_("New All Day Event"), NULL, - e_week_view_on_new_full_day, NULL, 0 }, + e_week_view_on_new_event, NULL, 0 }, { "", NULL, NULL, NULL, 0 }, @@ -3314,57 +3314,28 @@ e_week_view_show_popup_menu (EWeekView *week_view, e_popup_menu_run (context_menu, (GdkEvent *) bevent, disable_mask, hide_mask, week_view); } - -static void -e_week_view_new_event (EWeekView *week_view, gboolean all_day) -{ - CalComponent *comp; - CalComponentDateTime date; - struct icaltimetype itt; - time_t dt; - - comp = cal_component_new (); - cal_component_set_new_vtype (comp, CAL_COMPONENT_EVENT); - - date.value = &itt; - date.tzid = NULL; - - dt = week_view->day_starts[week_view->selection_start_day]; - if (all_day) - dt = time_day_begin (dt); - *date.value = icaltime_from_timet (dt, TRUE); - cal_component_set_dtstart (comp, &date); - - dt = week_view->day_starts[week_view->selection_end_day + 1]; - if (all_day) - dt = time_day_end (dt); - *date.value = icaltime_from_timet (dt, TRUE); - cal_component_set_dtend (comp, &date); - - cal_component_commit_sequence (comp); - - if (week_view->calendar) - gnome_calendar_edit_object (week_view->calendar, comp); - else - g_warning ("Calendar not set"); - - gtk_object_unref (GTK_OBJECT (comp)); -} - static void e_week_view_on_new_appointment (GtkWidget *widget, gpointer data) { EWeekView *week_view = E_WEEK_VIEW (data); + time_t dtstart, dtend; - e_week_view_new_event (week_view, FALSE); + dtstart = week_view->day_starts[week_view->selection_start_day]; + dtend = week_view->day_starts[week_view->selection_end_day + 1]; + gnome_calendar_new_appointment_for ( + week_view->calendar, dtstart, dtend, FALSE); } static void -e_week_view_on_new_full_day (GtkWidget *widget, gpointer data) +e_week_view_on_new_event (GtkWidget *widget, gpointer data) { EWeekView *week_view = E_WEEK_VIEW (data); + time_t dtstart, dtend; - e_week_view_new_event (week_view, TRUE); + dtstart = week_view->day_starts[week_view->selection_start_day]; + dtend = week_view->day_starts[week_view->selection_end_day + 1]; + gnome_calendar_new_appointment_for ( + week_view->calendar, dtstart, dtend, TRUE); } static void diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c index 588a7a6687..e5ae424f3e 100644 --- a/calendar/gui/gnome-cal.c +++ b/calendar/gui/gnome-cal.c @@ -1151,23 +1151,30 @@ gnome_calendar_edit_object (GnomeCalendar *gcal, CalComponent *comp) /** * gnome_calendar_new_appointment: * @gcal: An Evolution calendar. + * @dtstart: a Unix time_t that marks the beginning of the appointment. + * @dtend: a Unix time_t that marks the end of the appointment. + * @all_day: if true, the dtstart and dtend are expanded to cover the entire day. + * + * Opens an event editor dialog for a new appointment. * - * Opens an event editor dialog for a new appointment. The appointment's start - * and end times are set to the currently selected time range in the calendar - * views. **/ void -gnome_calendar_new_appointment (GnomeCalendar *gcal) +gnome_calendar_new_appointment_for (GnomeCalendar *cal, + time_t dtstart, time_t dtend, + gboolean all_day) { - CalComponent *comp; - time_t dtstart, dtend; - CalComponentDateTime dt; struct icaltimetype itt; + CalComponentDateTime dt; + CalComponent *comp; - g_return_if_fail (gcal != NULL); - g_return_if_fail (GNOME_IS_CALENDAR (gcal)); + g_return_if_fail (cal != NULL); + g_return_if_fail (GNOME_IS_CALENDAR (cal)); - gnome_calendar_get_current_time_range (gcal, &dtstart, &dtend); + if (all_day){ + dtstart = time_day_begin (dtstart); + dtend = time_day_end (dtend); + } + dt.value = &itt; dt.tzid = NULL; @@ -1182,9 +1189,28 @@ gnome_calendar_new_appointment (GnomeCalendar *gcal) cal_component_commit_sequence (comp); - gnome_calendar_edit_object (gcal, comp); + gnome_calendar_edit_object (cal, comp); gtk_object_unref (GTK_OBJECT (comp)); +} + +/** + * gnome_calendar_new_appointment: + * @gcal: An Evolution calendar. + * + * Opens an event editor dialog for a new appointment. The appointment's start + * and end times are set to the currently selected time range in the calendar + * views. + **/ +void +gnome_calendar_new_appointment (GnomeCalendar *gcal) +{ + time_t dtstart, dtend; + g_return_if_fail (gcal != NULL); + g_return_if_fail (GNOME_IS_CALENDAR (gcal)); + + gnome_calendar_get_current_time_range (gcal, &dtstart, &dtend); + gnome_calendar_new_appointment_for (gcal, dtstart, dtend, FALSE); } /* Returns the selected time range for the current view. Note that this may be diff --git a/calendar/gui/gnome-cal.h b/calendar/gui/gnome-cal.h index 5b4f2623b6..0f06f0c13e 100644 --- a/calendar/gui/gnome-cal.h +++ b/calendar/gui/gnome-cal.h @@ -102,6 +102,9 @@ void gnome_calendar_edit_object (GnomeCalendar *gcal, CalComponent *comp); void gnome_calendar_new_appointment (GnomeCalendar *gcal); +void gnome_calendar_new_appointment_for (GnomeCalendar *cal, + time_t dtstart, time_t dtend, + gboolean all_day); /* Returns the selected time range for the current view. Note that this may be different from the fields in the GnomeCalendar, since the view may clip diff --git a/mail/folder-browser-factory.c b/mail/folder-browser-factory.c index dc125680a2..fabc658438 100644 --- a/mail/folder-browser-factory.c +++ b/mail/folder-browser-factory.c @@ -114,9 +114,9 @@ static struct { char *pixbuf; } pixcache [] = { { "/menu/File/Print/Print Preview", "16_print.xpm", NULL }, - { "/menu/Component/Actions/MessageMove", "16_move_message.xpm", NULL }, - { "/menu/Component/Actions/MessageReplyAll", "16_reply_to_all.xpm", NULL }, - { "/menu/Component/Actions/MessageReplySndr", "16_reply.xpm", NULL }, + { "/menu/Actions/Component/MessageMove", "16_move_message.xpm", NULL }, + { "/menu/Actions/Component/MessageReplyAll", "16_reply_to_all.xpm", NULL }, + { "/menu/Actions/Component/MessageReplySndr", "16_reply.xpm", NULL }, { "/menu/File/Folder/FolderConfig", "16_configure_folder.xpm", NULL }, { "/menu/Tools/Component/SetMailConfig", "16_configure_mail.xpm", NULL }, { "/Toolbar/MailGet", "buttons/fetch-mail.png", NULL }, diff --git a/ui/ChangeLog b/ui/ChangeLog index a82b480191..da70413b31 100644 --- a/ui/ChangeLog +++ b/ui/ChangeLog @@ -1,3 +1,15 @@ +2001-03-17 Miguel de Icaza + + * evolution-calendar.xml: Added ShowWeekView, ShowMonthView, + ShowDay, ShowWorkWeek to the View menu. + + * evolution.xml, evolution-mail.xml: Provide "Actions" in the + toplevel evolution. Fill in Actions/Component in Evolution-mail + (no visual changes, just internal changes). + + * evolution-calendar.xml: Added Actions menu. Added New Verb + EditNewEvent. + 2001-03-16 Miguel de Icaza * evolution-mail.xml: Added accelerator to elements missing diff --git a/ui/evolution-calendar.xml b/ui/evolution-calendar.xml index 3c5cc500d5..adf8b3cf9d 100644 --- a/ui/evolution-calendar.xml +++ b/ui/evolution-calendar.xml @@ -8,6 +8,8 @@ + - @@ -61,12 +63,39 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ui/evolution-mail.xml b/ui/evolution-mail.xml index 1570c7a59b..5620640dae 100644 --- a/ui/evolution-mail.xml +++ b/ui/evolution-mail.xml @@ -127,8 +127,8 @@ - - + + @@ -189,8 +189,8 @@ - - + + diff --git a/ui/evolution.xml b/ui/evolution.xml index a0176241bb..cdc8fd0b8e 100644 --- a/ui/evolution.xml +++ b/ui/evolution.xml @@ -106,10 +106,10 @@ + - @@ -118,6 +118,10 @@ _label="Customi_ze Toolbars..." pos="bottom"/> + + + +