diff options
Diffstat (limited to 'calendar/gui/e-week-view.c')
-rw-r--r-- | calendar/gui/e-week-view.c | 56 |
1 files changed, 52 insertions, 4 deletions
diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c index 28b62ae824..8b05b113c8 100644 --- a/calendar/gui/e-week-view.c +++ b/calendar/gui/e-week-view.c @@ -45,6 +45,7 @@ #include <gal/widgets/e-gui-utils.h> #include <gal/widgets/e-canvas-utils.h> #include "e-meeting-edit.h" +#include "goto.h" /* Images */ #include "art/bell.xpm" @@ -161,6 +162,12 @@ 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, + gpointer data); +static void e_week_view_on_goto_today (GtkWidget *widget, + gpointer data); +static void e_week_view_on_goto_date (GtkWidget *widget, + gpointer data); static void e_week_view_on_edit_appointment (GtkWidget *widget, gpointer data); static void e_week_view_on_delete_occurrence (GtkWidget *widget, @@ -3227,6 +3234,15 @@ enum { 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 }, + + { "", NULL, NULL, NULL, 0 }, + + { N_("Go to Today"), NULL, + e_week_view_on_goto_today, NULL, 0 }, + { N_("Go to Date..."), NULL, + e_week_view_on_goto_date, NULL, 0 }, { NULL, NULL, NULL, NULL, 0 } }; @@ -3300,16 +3316,13 @@ e_week_view_show_popup_menu (EWeekView *week_view, static void -e_week_view_on_new_appointment (GtkWidget *widget, gpointer data) +e_week_view_new_event (EWeekView *week_view, gboolean all_day) { - EWeekView *week_view; CalComponent *comp; CalComponentDateTime date; struct icaltimetype itt; time_t dt; - week_view = E_WEEK_VIEW (data); - comp = cal_component_new (); cal_component_set_new_vtype (comp, CAL_COMPONENT_EVENT); @@ -3317,10 +3330,14 @@ e_week_view_on_new_appointment (GtkWidget *widget, gpointer data) 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); @@ -3334,6 +3351,37 @@ e_week_view_on_new_appointment (GtkWidget *widget, gpointer data) 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); + + e_week_view_new_event (week_view, FALSE); +} + +static void +e_week_view_on_new_full_day (GtkWidget *widget, gpointer data) +{ + EWeekView *week_view = E_WEEK_VIEW (data); + + e_week_view_new_event (week_view, TRUE); +} + +static void +e_week_view_on_goto_date (GtkWidget *widget, gpointer data) +{ + EWeekView *week_view = E_WEEK_VIEW (data); + + goto_dialog (week_view->calendar); +} + +static void +e_week_view_on_goto_today (GtkWidget *widget, gpointer data) +{ + EWeekView *week_view = E_WEEK_VIEW (data); + + calendar_goto_today (week_view->calendar); +} static void e_week_view_on_edit_appointment (GtkWidget *widget, gpointer data) |