[annum] Make sure we always show three days when in the day view.



commit 5306953f248eebbbf42f7b7fb2437676903ed46c
Author: Gustavo Noronha Silva <gustavo noronha collabora co uk>
Date:   Mon Jan 25 19:41:18 2010 -0200

    Make sure we always show three days when in the day view.

 src/annum-shell-view.c |   27 +++++++++++++++++++++++----
 1 files changed, 23 insertions(+), 4 deletions(-)
---
diff --git a/src/annum-shell-view.c b/src/annum-shell-view.c
index 9f831a0..5b0f02e 100644
--- a/src/annum-shell-view.c
+++ b/src/annum-shell-view.c
@@ -103,10 +103,11 @@ annum_shell_view_date_navigator_selection_changed_cb (AnnumShellView * self,
 
 	e_calendar_item_get_selection (calitem, &new_start_date, &new_end_date);
 
-	/* If the selection hasn't changed, just return. */
-	if (g_date_compare (&start_date, &new_start_date) == 0 &&
-	    g_date_compare (&end_date, &new_end_date) == 0)
-		return;
+	/* There used to be a check here to make sure the rest of the
+	 * code only ran when the date actually changed. We do not
+	 * this to simplify always having three columns for the day
+	 * view.
+	 */
 
 	new_days_shown =
 	    g_date_get_julian (&new_end_date) -
@@ -148,6 +149,11 @@ annum_shell_view_date_navigator_selection_changed_cb (AnnumShellView * self,
 		calendar_view =
 		    gnome_calendar_get_calendar_view (calendar,
 						      GNOME_CAL_DAY_VIEW);
+
+		/* We always show three days */
+		if (new_days_shown == 1)
+		    new_days_shown = 3;
+
 		e_day_view_set_days_shown (E_DAY_VIEW (calendar_view),
 					   new_days_shown);
 
@@ -311,9 +317,12 @@ gnome_cal_view_type_from_view_id (const char *view_id)
 static void annum_shell_view_notify_view_id_cb (AnnumShellView * self)
 {
 	AnnumShellContent *shell_content;
+	ECalendar *date_navigator;
 	GnomeCalendar *calendar;
 	const gchar *view_id;
 	GnomeCalendarViewType view_type;
+	GDate gdate_start;
+	GDate gdate_end;
 
 	view_id = e_shell_view_get_view_id (E_SHELL_VIEW (self));
 
@@ -331,6 +340,16 @@ static void annum_shell_view_notify_view_id_cb (AnnumShellView * self)
 	calendar = annum_shell_content_get_calendar (shell_content);
 
 	gnome_calendar_display_view (calendar, view_type);
+
+	if (view_type != GNOME_CAL_DAY_VIEW)
+		return;
+
+	/* Make sure just the day is selected, for this case */
+	date_navigator = annum_shell_sidebar_get_date_navigator (self->priv->prox_shell_sidebar);
+	e_calendar_item_get_selection (date_navigator->calitem,
+				       &gdate_start, &gdate_end);
+	e_calendar_item_set_selection (date_navigator->calitem,
+				       &gdate_start, &gdate_start);
 }
 
 void constructed (GObject * object)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]