aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/e-cal-view.c
diff options
context:
space:
mode:
authorRodrigo Moya <rodrigo@ximian.com>2003-07-23 20:14:57 +0800
committerRodrigo Moya <rodrigo@src.gnome.org>2003-07-23 20:14:57 +0800
commit3be35526b66418c9ccd664523620c8c7cde550b5 (patch)
tree559eb54a4569725787a3a21440e4506f5fbdcb8e /calendar/gui/e-cal-view.c
parentc1a24b93ef371ae2d2aca8b905b9d3ed72b16083 (diff)
downloadgsoc2013-evolution-3be35526b66418c9ccd664523620c8c7cde550b5.tar.gz
gsoc2013-evolution-3be35526b66418c9ccd664523620c8c7cde550b5.tar.zst
gsoc2013-evolution-3be35526b66418c9ccd664523620c8c7cde550b5.zip
removed unneeded prototypes.
2003-07-23 Rodrigo Moya <rodrigo@ximian.com> * gui/e-day-view.h: * gui/e-week-view.h: removed unneeded prototypes. * gui/e-cal-view.[ch] (e_cal_view_get_visible_time_range): new function. (selection_received): deal correctly with the selected time range. * gui/e-week-view.c (e_week_view_get_visible_time_range): made it private as the implementation of the 'get_visible_time_range' virtual method. * gui/e-day-view.c (e_day_view_get_visible_time_range): ditto. * gui/gnome-cal.c (gnome_calendar_direction): merged redundant 'case'. (focus_current_view): removed redundant code. svn path=/trunk/; revision=21897
Diffstat (limited to 'calendar/gui/e-cal-view.c')
-rw-r--r--calendar/gui/e-cal-view.c92
1 files changed, 42 insertions, 50 deletions
diff --git a/calendar/gui/e-cal-view.c b/calendar/gui/e-cal-view.c
index 1b4676beb8..f5c64c049b 100644
--- a/calendar/gui/e-cal-view.c
+++ b/calendar/gui/e-cal-view.c
@@ -95,6 +95,7 @@ e_cal_view_class_init (ECalViewClass *klass)
klass->get_selected_events = NULL;
klass->get_selected_time_range = NULL;
klass->set_selected_time_range = NULL;
+ klass->get_visible_time_range = NULL;
klass->update_query = NULL;
/* clipboard atom */
@@ -141,11 +142,9 @@ selection_received (GtkWidget *invisible,
CalComponent *comp;
time_t selected_time_start, selected_time_end;
struct icaltimetype itime;
- struct icaltimetype tmp_itime;
time_t tt_start, tt_end;
struct icaldurationtype ic_dur;
char *uid;
- CalComponentDateTime ccdt;
icaltimezone *default_zone;
g_return_if_fail (E_IS_CAL_VIEW (cal_view));
@@ -185,40 +184,31 @@ selection_received (GtkWidget *invisible,
if (child_kind == ICAL_VEVENT_COMPONENT ||
child_kind == ICAL_VTODO_COMPONENT ||
child_kind == ICAL_VJOURNAL_COMPONENT) {
- icalcomponent *new_icalcomp;
-
- new_icalcomp = icalcomponent_new_clone (subcomp);
- comp = cal_component_new ();
-
- /* change the day for the event */
- tt_start = icaltime_as_timet (
- icalcomponent_get_dtstart (new_icalcomp));
- tt_end = icaltime_as_timet (
- icalcomponent_get_dtend (new_icalcomp));
+ tt_start = icaltime_as_timet (icalcomponent_get_dtstart (subcomp));
+ tt_end = icaltime_as_timet (icalcomponent_get_dtend (subcomp));
ic_dur = icaldurationtype_from_int (tt_end - tt_start);
+ itime = icaltime_from_timet_with_zone (selected_time_start,
+ FALSE, default_zone);
- tmp_itime = icaltime_from_timet_with_zone (
- selected_time_start, FALSE, default_zone);
- itime = icalcomponent_get_dtstart (new_icalcomp);
- itime.year = tmp_itime.year;
- itime.month = tmp_itime.month;
- itime.day = tmp_itime.day;
-
- cal_component_set_icalcomponent (comp, new_icalcomp);
- ccdt.value = &itime;
- ccdt.tzid = icaltimezone_get_tzid (default_zone);
- cal_component_set_dtstart (comp, &ccdt);
-
+ icalcomponent_set_dtstart (subcomp, itime);
itime = icaltime_add (itime, ic_dur);
- ccdt.value = &itime;
- cal_component_set_dtend (comp, &ccdt);
+ icalcomponent_set_dtend (subcomp, itime);
uid = cal_component_gen_uid ();
+ comp = cal_component_new ();
+ cal_component_set_icalcomponent (
+ comp, icalcomponent_new_clone (subcomp));
cal_component_set_uid (comp, uid);
cal_client_update_object (cal_view->priv->client, comp);
-
- g_free (uid);
+ if (itip_organizer_is_user (comp, cal_view->priv->client) &&
+ send_component_dialog (gtk_widget_get_toplevel (cal_view),
+ cal_view->priv->client, comp, TRUE)) {
+ itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp,
+ cal_view->priv->client, NULL);
+ }
+
+ free (uid);
g_object_unref (comp);
}
subcomp = icalcomponent_get_next_component (
@@ -229,39 +219,30 @@ selection_received (GtkWidget *invisible,
}
else {
- comp = cal_component_new ();
-
- /* change the day for the event */
tt_start = icaltime_as_timet (icalcomponent_get_dtstart (icalcomp));
tt_end = icaltime_as_timet (icalcomponent_get_dtend (icalcomp));
ic_dur = icaldurationtype_from_int (tt_end - tt_start);
+ itime = icaltime_from_timet_with_zone (selected_time_start, FALSE, default_zone);
- tmp_itime = icaltime_from_timet_with_zone (
- selected_time_start, FALSE, default_zone);
- itime = icalcomponent_get_dtstart (icalcomp);
- itime.year = tmp_itime.year;
- itime.month = tmp_itime.month;
- itime.day = tmp_itime.day;
-
- cal_component_set_icalcomponent (comp, icalcomp);
- ccdt.value = &itime;
- ccdt.tzid = icaltimezone_get_tzid (default_zone);
- cal_component_set_dtstart (comp, &ccdt);
-
+ icalcomponent_set_dtstart (icalcomp, itime);
itime = icaltime_add (itime, ic_dur);
- ccdt.value = &itime;
- cal_component_set_dtend (comp, &ccdt);
+ icalcomponent_set_dtend (icalcomp, itime);
uid = cal_component_gen_uid ();
- cal_component_set_uid (comp, (const char *) uid);
+ comp = cal_component_new ();
+ cal_component_set_icalcomponent (
+ comp, icalcomponent_new_clone (icalcomp));
+ cal_component_set_uid (comp, uid);
cal_client_update_object (cal_view->priv->client, comp);
-
if (itip_organizer_is_user (comp, cal_view->priv->client) &&
- send_component_dialog (gtk_widget_get_toplevel (cal_view), cal_view->priv->client, comp, TRUE))
- itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp, cal_view->priv->client, NULL);
+ send_component_dialog (gtk_widget_get_toplevel (cal_view),
+ cal_view->priv->client, comp, TRUE)) {
+ itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp,
+ cal_view->priv->client, NULL);
+ }
- g_free (uid);
+ free (uid);
g_object_unref (comp);
}
@@ -477,6 +458,17 @@ e_cal_view_set_selected_time_range (ECalView *cal_view, time_t start_time, time_
}
}
+gboolean
+e_cal_view_get_visible_time_range (ECalView *cal_view, time_t *start_time, time_t *end_time)
+{
+ g_return_if_fail (E_IS_CAL_VIEW (cal_view));
+
+ if (E_CAL_VIEW_CLASS (G_OBJECT_GET_CLASS (cal_view))->get_visible_time_range) {
+ E_CAL_VIEW_CLASS (G_OBJECT_GET_CLASS (cal_view))->get_visible_time_range (
+ cal_view, start_time, end_time);
+ }
+}
+
void
e_cal_view_update_query (ECalView *cal_view)
{