diff options
author | JP Rosevear <jpr@ximian.com> | 2004-04-19 22:41:32 +0800 |
---|---|---|
committer | JP Rosevear <jpr@src.gnome.org> | 2004-04-19 22:41:32 +0800 |
commit | e901dd254faf0f505bf2a9d11c8e615a45e6cd64 (patch) | |
tree | ab5a4416d719a43f20500177e548fb1dd96aedf8 /calendar/gui | |
parent | 17bf8fb52df2e0da31d24019bc668c32b347caae (diff) | |
download | gsoc2013-evolution-e901dd254faf0f505bf2a9d11c8e615a45e6cd64.tar.gz gsoc2013-evolution-e901dd254faf0f505bf2a9d11c8e615a45e6cd64.tar.zst gsoc2013-evolution-e901dd254faf0f505bf2a9d11c8e615a45e6cd64.zip |
take a range_selected boolean for internal use (gnome_calendar_set_view):
2004-04-19 JP Rosevear <jpr@ximian.com>
* gui/gnome-cal.c (set_view): take a range_selected boolean for
internal use
(gnome_calendar_set_view): use above
(display_view): use priv->range_selected, we'll set it correctly
before this
(display_view_cb): only pass focus boolean
(gnome_calendar_on_date_navigator_selection_changed): set the view
so the view menu is accurate
svn path=/trunk/; revision=25510
Diffstat (limited to 'calendar/gui')
-rw-r--r-- | calendar/gui/gnome-cal.c | 46 |
1 files changed, 27 insertions, 19 deletions
diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c index 32d07898a3..561dfd6594 100644 --- a/calendar/gui/gnome-cal.c +++ b/calendar/gui/gnome-cal.c @@ -1421,18 +1421,8 @@ gnome_calendar_get_view (GnomeCalendar *gcal) return priv->current_view_type; } - -/** - * gnome_calendar_set_view: - * @gcal: A calendar. - * @view_type: Type of view to show. - * - * Sets the view that should be shown in a calendar. If @reset_range is true, - * this function will automatically set the number of days or weeks shown in - * the view; otherwise the last configuration will be kept. - **/ -void -gnome_calendar_set_view (GnomeCalendar *gcal, GnomeCalendarViewType view_type) +static void +set_view (GnomeCalendar *gcal, GnomeCalendarViewType view_type, gboolean range_selected) { GnomeCalendarPrivate *priv; const char *view_id; @@ -1468,17 +1458,36 @@ gnome_calendar_set_view (GnomeCalendar *gcal, GnomeCalendarViewType view_type) return; } + priv->range_selected = range_selected; gal_view_instance_set_current_view_id (priv->view_instance, view_id); } + +/** + * gnome_calendar_set_view: + * @gcal: A calendar. + * @view_type: Type of view to show. + * + * Sets the view that should be shown in a calendar. If @reset_range is true, + * this function will automatically set the number of days or weeks shown in + * the view; otherwise the last configuration will be kept. + **/ +void +gnome_calendar_set_view (GnomeCalendar *gcal, GnomeCalendarViewType view_type) +{ + g_return_if_fail (gcal != NULL); + g_return_if_fail (GNOME_IS_CALENDAR (gcal)); + + set_view (gcal, view_type, FALSE); +} + /* Sets the view without changing the selection or updating the date * navigator. If a range of dates isn't selected it will also reset the number * of days/weeks shown to the default (i.e. 1 day for the day view or 5 weeks * for the month view). */ static void -display_view (GnomeCalendar *gcal, GnomeCalendarViewType view_type, - gboolean range_selected, gboolean grab_focus) +display_view (GnomeCalendar *gcal, GnomeCalendarViewType view_type, gboolean grab_focus) { GnomeCalendarPrivate *priv; gboolean preserve_day; @@ -1489,7 +1498,7 @@ display_view (GnomeCalendar *gcal, GnomeCalendarViewType view_type, switch (view_type) { case GNOME_CAL_DAY_VIEW: - if (!range_selected) + if (!priv->range_selected) e_day_view_set_days_shown (E_DAY_VIEW (priv->day_view), 1); break; @@ -1503,7 +1512,7 @@ display_view (GnomeCalendar *gcal, GnomeCalendarViewType view_type, break; case GNOME_CAL_MONTH_VIEW: - if (!range_selected) + if (!priv->range_selected) e_week_view_set_weeks_shown (E_WEEK_VIEW (priv->month_view), 5); preserve_day = TRUE; @@ -1518,7 +1527,6 @@ display_view (GnomeCalendar *gcal, GnomeCalendarViewType view_type, } priv->current_view_type = view_type; - priv->range_selected = range_selected; gtk_notebook_set_page (GTK_NOTEBOOK (priv->notebook), (int) view_type); @@ -1564,7 +1572,7 @@ display_view_cb (GalViewInstance *view_instance, GalView *view, gpointer data) } - display_view (gcal, view_type, FALSE, TRUE); + display_view (gcal, view_type, TRUE); gnome_calendar_update_date_navigator (gcal); gnome_calendar_notify_dates_shown_changed (gcal); } @@ -2474,7 +2482,7 @@ gnome_calendar_on_date_navigator_selection_changed (ECalendarItem *calitem, Gnom /* Make the views display things properly */ update_view_times (gcal, new_time); - display_view (gcal, view_type, TRUE, TRUE); + set_view (gcal, view_type, TRUE); gnome_calendar_notify_dates_shown_changed (gcal); } |