aboutsummaryrefslogtreecommitdiffstats
path: root/calendar
diff options
context:
space:
mode:
Diffstat (limited to 'calendar')
-rw-r--r--calendar/ChangeLog20
-rw-r--r--calendar/gui/calendar-commands.c12
-rw-r--r--calendar/gui/calendar-commands.h2
-rw-r--r--calendar/gui/e-day-view.c66
-rw-r--r--calendar/gui/e-week-view.c56
5 files changed, 139 insertions, 17 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 3afb72d381..fb33b08758 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,23 @@
+2001-03-17 Miguel de Icaza <miguel@ximian.com>
+
+ * 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.
+ (e_week_view_on_new_full_day): New function for making a full day
+ event.
+ (e_week_view_on_goto_date): Go To support.
+ (e_week_view_on_goto_today): Goto today support.
+
+ * gui/e-day-view.c (e_day_view_new_event): Moved functionality
+ here from e_day_view_on_new_appointment. Allows setting for "full
+ day" event.
+ (e_day_view_on_new_full_day): New function for making a full day
+ event.
+ (e_day_view_on_goto_date): Go To support.
+ (e_day_view_on_goto_today): Goto today support.
+
+ * main_items: Add New All Day Event; Go to Today; Go to Date.
+
2001-03-07 Miguel de Icaza <miguel@ximian.com>
* gui/control-factory.c (calendar_persist_init): New function:
diff --git a/calendar/gui/calendar-commands.c b/calendar/gui/calendar-commands.c
index 4b6078df99..dfffed9b63 100644
--- a/calendar/gui/calendar-commands.c
+++ b/calendar/gui/calendar-commands.c
@@ -154,6 +154,14 @@ next_clicked (BonoboUIComponent *uic, gpointer data, const char *path)
set_normal_cursor (gcal);
}
+void
+calendar_goto_today (GnomeCalendar *gcal)
+{
+ set_clock_cursor (gcal);
+ gnome_calendar_goto_today (gcal);
+ set_normal_cursor (gcal);
+}
+
static void
today_clicked (BonoboUIComponent *uic, gpointer data, const char *path)
{
@@ -161,9 +169,7 @@ today_clicked (BonoboUIComponent *uic, gpointer data, const char *path)
gcal = GNOME_CALENDAR (data);
- set_clock_cursor (gcal);
- gnome_calendar_goto_today (gcal);
- set_normal_cursor (gcal);
+ calendar_goto_today (gcal);
}
static void
diff --git a/calendar/gui/calendar-commands.h b/calendar/gui/calendar-commands.h
index 364051e3a3..7c69850fb3 100644
--- a/calendar/gui/calendar-commands.h
+++ b/calendar/gui/calendar-commands.h
@@ -40,4 +40,6 @@ void calendar_control_activate (BonoboControl *control,
GnomeCalendar *cal);
void calendar_control_deactivate (BonoboControl *control);
+void calendar_goto_today (GnomeCalendar *gcal);
+
#endif /* CALENDAR_COMMANDS_H */
diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c
index 36ad251822..c5051f82df 100644
--- a/calendar/gui/e-day-view.c
+++ b/calendar/gui/e-day-view.c
@@ -44,6 +44,7 @@
#include <gal/widgets/e-gui-utils.h>
#include <gal/widgets/e-popup-menu.h>
#include "e-meeting-edit.h"
+#include "goto.h"
/* Images */
#include "art/bell.xpm"
@@ -320,6 +321,12 @@ 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,
+ gpointer data);
+static void e_day_view_on_goto_today (GtkWidget *widget,
+ gpointer data);
+static void e_day_view_on_goto_date (GtkWidget *widget,
+ gpointer data);
static void e_day_view_on_edit_appointment (GtkWidget *widget,
gpointer data);
static void e_day_view_on_delete_occurrence (GtkWidget *widget,
@@ -3017,8 +3024,18 @@ enum {
};
static EPopupMenu main_items [] = {
- { N_("New Appointment..."), NULL,
+ { 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 },
+
+ { "", NULL, NULL, NULL, 0 },
+
+ { N_("Go to Today"), NULL,
+ e_day_view_on_goto_today, NULL, 0 },
+ { N_("Go to Date..."), NULL,
+ e_day_view_on_goto_date, NULL, 0 },
+
{ NULL, NULL, NULL, NULL, 0 }
};
@@ -3029,10 +3046,6 @@ static EPopupMenu child_items [] = {
e_day_view_on_delete_appointment, NULL, MASK_EDITABLE | MASK_SINGLE | MASK_EDITING },
{ N_("Schedule Meeting"), NULL,
e_day_view_on_schedule_meet, NULL, MASK_EDITING },
- { "", NULL, NULL, NULL, 0},
-
- { N_("New Appointment..."), NULL,
- e_day_view_on_new_appointment, NULL, 0 },
{ "", NULL, NULL, NULL, MASK_SINGLE},
@@ -3102,22 +3115,23 @@ 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_on_new_appointment (GtkWidget *widget, gpointer data)
+e_day_view_new_event (EDayView *day_view, gboolean all_day)
{
- EDayView *day_view;
CalComponent *comp;
CalComponentDateTime date;
time_t dtstart, dtend;
struct icaltimetype itt;
- day_view = E_DAY_VIEW (data);
-
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;
@@ -3139,6 +3153,38 @@ e_day_view_on_new_appointment (GtkWidget *widget, gpointer data)
static void
+e_day_view_on_new_appointment (GtkWidget *widget, gpointer data)
+{
+ EDayView *day_view = E_DAY_VIEW (data);
+
+ e_day_view_new_event (day_view, FALSE);
+}
+
+static void
+e_day_view_on_new_full_day (GtkWidget *widget, gpointer data)
+{
+ EDayView *day_view = E_DAY_VIEW (data);
+
+ e_day_view_new_event (day_view, TRUE);
+}
+
+static void
+e_day_view_on_goto_date (GtkWidget *widget, gpointer data)
+{
+ EDayView *day_view = E_DAY_VIEW (data);
+
+ goto_dialog (day_view->calendar);
+}
+
+static void
+e_day_view_on_goto_today (GtkWidget *widget, gpointer data)
+{
+ EDayView *day_view = E_DAY_VIEW (data);
+
+ calendar_goto_today (day_view->calendar);
+}
+
+static void
e_day_view_on_edit_appointment (GtkWidget *widget, gpointer data)
{
EDayView *day_view;
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)