aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/e-week-view.c
diff options
context:
space:
mode:
authorJP Rosevear <jpr@ximian.com>2004-04-08 00:12:22 +0800
committerJP Rosevear <jpr@src.gnome.org>2004-04-08 00:12:22 +0800
commit3d47eb28221963adcef3a9c8502d6815353af1d9 (patch)
treeb2615874c61ebdbc0964a6f53f99a1918ddca4c8 /calendar/gui/e-week-view.c
parent5861eb8e7b1ae59b5e5cf600b36c6bf947b806bc (diff)
downloadgsoc2013-evolution-3d47eb28221963adcef3a9c8502d6815353af1d9.tar
gsoc2013-evolution-3d47eb28221963adcef3a9c8502d6815353af1d9.tar.gz
gsoc2013-evolution-3d47eb28221963adcef3a9c8502d6815353af1d9.tar.bz2
gsoc2013-evolution-3d47eb28221963adcef3a9c8502d6815353af1d9.tar.lz
gsoc2013-evolution-3d47eb28221963adcef3a9c8502d6815353af1d9.tar.xz
gsoc2013-evolution-3d47eb28221963adcef3a9c8502d6815353af1d9.tar.zst
gsoc2013-evolution-3d47eb28221963adcef3a9c8502d6815353af1d9.zip
remove extra set view params (gnome_calendar_set_view): simplify, just set
2004-04-07 JP Rosevear <jpr@ximian.com> * gui/gnome-cal.c (gnome_calendar_dayjump): remove extra set view params (gnome_calendar_set_view): simplify, just set the current view id and let the gal view stuff do the rest (display_view): modify from set_view, don't set the view id here or update the default view config setting (display_view_cb): update the date navigator (gnome_calendar_construct): kill the default view stuff, gal view handles that (gnome_calendar_on_date_navigator_selection_changed): use display_view * gui/e-week-view.c (time_range_changed_cb): ditto (e_week_view_set_selected_time_range): just set the selection, don't fool with the base date (e_week_view_on_button_press): do a full day event if double clicked on * gui/e-day-view.c (time_range_changed_cb): only set the selection if we can't preserve an existing selection * gui/control-factory.c (set_prop): * gui/calendar-config.h: remove protos * gui/calendar-config.c: remove default view calls * gui/calendar-commands.c (show_day_view_clicked): remove extra params to gnome_calendar_set_view (show_work_week_view_clicked): ditto (show_week_view_clicked): ditto (show_month_view_clicked): ditto (show_list_view_clicked): ditto * gui/apps_evolution_calendar.schemas.in.in: remove default view setting, gal view remembers this for us svn path=/trunk/; revision=25353
Diffstat (limited to 'calendar/gui/e-week-view.c')
-rw-r--r--calendar/gui/e-week-view.c74
1 files changed, 12 insertions, 62 deletions
diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c
index e9cd2d284e..bc61ff6bb8 100644
--- a/calendar/gui/e-week-view.c
+++ b/calendar/gui/e-week-view.c
@@ -27,7 +27,9 @@
* EWeekView - displays the Week & Month views of the calendar.
*/
+#ifdef HAVE_CONFIG_H
#include <config.h>
+#endif
#include "e-week-view.h"
#include "ea-calendar.h"
@@ -253,8 +255,8 @@ static void
time_range_changed_cb (ECalModel *model, time_t start_time, time_t end_time, gpointer user_data)
{
EWeekView *week_view = E_WEEK_VIEW (user_data);
- GDate date, base_date, end_date;
- gint day_offset, weekday, week_start_offset, num_days;
+ GDate date, base_date;
+ gint day_offset, weekday, week_start_offset;
gboolean update_adjustment_value = FALSE;
g_return_if_fail (E_IS_WEEK_VIEW (week_view));
@@ -323,7 +325,9 @@ time_range_changed_cb (ECalModel *model, time_t start_time, time_t end_time, gpo
gtk_widget_queue_draw (week_view->main_canvas);
/* FIXME Preserve selection if possible */
- e_week_view_set_selected_time_range (E_CALENDAR_VIEW (week_view), start_time, start_time);
+ if (week_view->selection_start_day == -1 ||
+ (week_view->multi_week_view ? week_view->weeks_shown * 7 : 7) <= week_view->selection_start_day)
+ e_week_view_set_selected_time_range (E_CALENDAR_VIEW (week_view), start_time, start_time);
}
@@ -1424,8 +1428,8 @@ e_week_view_set_selected_time_range (ECalendarView *cal_view,
time_t start_time,
time_t end_time)
{
- GDate date, base_date, end_date;
- gint day_offset, weekday, week_start_offset, num_days;
+ GDate date, end_date;
+ gint num_days;
gboolean update_adjustment_value = FALSE;
EWeekView *week_view = E_WEEK_VIEW (cal_view);
@@ -1433,63 +1437,9 @@ e_week_view_set_selected_time_range (ECalendarView *cal_view,
time_to_gdate_with_zone (&date, start_time, e_calendar_view_get_timezone (E_CALENDAR_VIEW (week_view)));
- if (week_view->multi_week_view) {
- /* Find the number of days since the start of the month. */
- day_offset = g_date_day (&date) - 1;
-
- /* Find the 1st week which starts at or before the start of
- the month. */
- base_date = date;
- g_date_set_day (&base_date, 1);
-
- /* Calculate the weekday of the 1st of the month, 0 = Mon. */
- weekday = g_date_weekday (&base_date) - 1;
-
- /* Convert it to an offset from the start of the display. */
- week_start_offset = (weekday + 7 - week_view->display_start_day) % 7;
-
- /* Add it to the day offset so we go back to the 1st week at
- or before the start of the month. */
- day_offset += week_start_offset;
- } else {
- /* Calculate the weekday of the given date, 0 = Mon. */
- weekday = g_date_weekday (&date) - 1;
-
- /* Convert it to an offset from the start of the display. */
- week_start_offset = (weekday + 7 - week_view->display_start_day) % 7;
-
- /* Set the day_offset to the result, so we move back to the
- start of the week. */
- day_offset = week_start_offset;
- }
-
- /* Calculate the base date, i.e. the first day shown when the
- scrollbar adjustment value is 0. */
- base_date = date;
- g_date_subtract_days (&base_date, day_offset);
-
- /* See if we need to update the base date. */
- if (!g_date_valid (&week_view->base_date)
- || g_date_compare (&week_view->base_date, &base_date)) {
- week_view->base_date = base_date;
- update_adjustment_value = TRUE;
- }
-
- /* See if we need to update the first day shown. */
- if (!g_date_valid (&week_view->first_day_shown)
- || g_date_compare (&week_view->first_day_shown, &base_date)) {
- week_view->first_day_shown = base_date;
- start_time = time_add_day_with_zone (start_time, -day_offset,
- e_calendar_view_get_timezone (E_CALENDAR_VIEW (week_view)));
- start_time = time_day_begin_with_zone (start_time,
- e_calendar_view_get_timezone (E_CALENDAR_VIEW (week_view)));
- e_week_view_recalc_day_starts (week_view, start_time);
- e_week_view_update_query (week_view);
- }
-
/* Set the selection to the given days. */
week_view->selection_start_day = g_date_julian (&date)
- - g_date_julian (&base_date);
+ - g_date_julian (&week_view->base_date);
if (end_time == start_time
|| end_time <= time_add_day_with_zone (start_time, 1,
e_calendar_view_get_timezone (E_CALENDAR_VIEW (week_view))))
@@ -1497,7 +1447,7 @@ e_week_view_set_selected_time_range (ECalendarView *cal_view,
else {
time_to_gdate_with_zone (&end_date, end_time - 60, e_calendar_view_get_timezone (E_CALENDAR_VIEW (week_view)));
week_view->selection_end_day = g_date_julian (&end_date)
- - g_date_julian (&base_date);
+ - g_date_julian (&week_view->base_date);
}
/* Make sure the selection is valid. */
@@ -2181,7 +2131,7 @@ e_week_view_on_button_press (GtkWidget *widget,
return FALSE;
if (event->button == 1 && event->type == GDK_2BUTTON_PRESS) {
- e_calendar_view_new_appointment (E_CALENDAR_VIEW (week_view));
+ e_calendar_view_new_appointment_full (E_CALENDAR_VIEW (week_view), TRUE, FALSE);
return TRUE;
}