aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui
diff options
context:
space:
mode:
authorMiguel de Icaza <miguel@ximian.com>2001-03-18 16:16:40 +0800
committerMiguel de Icaza <miguel@src.gnome.org>2001-03-18 16:16:40 +0800
commitf4b4da4fcb6a59f56c1fff88ba08a6c9995b807c (patch)
tree174273901eb0b57d53848dc3993e7fd7aa1ed9d5 /calendar/gui
parent3370188296f555ac67b0f859ce2209c2eeba34af (diff)
downloadgsoc2013-evolution-f4b4da4fcb6a59f56c1fff88ba08a6c9995b807c.tar
gsoc2013-evolution-f4b4da4fcb6a59f56c1fff88ba08a6c9995b807c.tar.gz
gsoc2013-evolution-f4b4da4fcb6a59f56c1fff88ba08a6c9995b807c.tar.bz2
gsoc2013-evolution-f4b4da4fcb6a59f56c1fff88ba08a6c9995b807c.tar.lz
gsoc2013-evolution-f4b4da4fcb6a59f56c1fff88ba08a6c9995b807c.tar.xz
gsoc2013-evolution-f4b4da4fcb6a59f56c1fff88ba08a6c9995b807c.tar.zst
gsoc2013-evolution-f4b4da4fcb6a59f56c1fff88ba08a6c9995b807c.zip
Added ShowWeekView, ShowMonthView, ShowDay, ShowWorkWeek to the View menu.
2001-03-17 Miguel de Icaza <miguel@ximian.com> * 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 <miguel@ximian.com> * 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
Diffstat (limited to 'calendar/gui')
-rw-r--r--calendar/gui/calendar-commands.c21
-rw-r--r--calendar/gui/e-day-view.c53
-rw-r--r--calendar/gui/e-week-view.c55
-rw-r--r--calendar/gui/gnome-cal.c48
-rw-r--r--calendar/gui/gnome-cal.h3
5 files changed, 85 insertions, 95 deletions
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 },
@@ -3116,56 +3116,25 @@ e_day_view_on_event_right_click (EDayView *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