Re: [evolution-patches] patch for #58824 (calendar)



On Tue, 2004-08-17 at 10:49 -0400, JP Rosevear wrote:
> Maybe we should only call e_cal_open_async if the calendar is not loaded
> like elsewhere in the code?
> 
updated patch that includes your suggestion and a change to make it
always use the same view for status messages, which seems to be indeed
the real cause of the problem
-- 
Rodrigo Moya <rodrigo novell com>
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/calendar/ChangeLog,v
retrieving revision 1.2489
diff -u -p -r1.2489 ChangeLog
--- ChangeLog	17 Aug 2004 13:35:28 -0000	1.2489
+++ ChangeLog	17 Aug 2004 15:49:22 -0000
@@ -1,3 +1,12 @@
+2004-08-17  Rodrigo Moya <rodrigo novell com>
+
+	Fixes #58824
+
+	* gui/gnome-cal.c (open_ecal): Only try to open the calendar if not
+	loaded yet.
+	(update_query, client_cal_opened_cb, default_client_cal_opened_cb,
+	backend_died_cb): use always the same view for status messages.
+
 2004-08-16  JP Rosevear  <jpr ximian com>
 
 	Fixes #62706
Index: gui/gnome-cal.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/gnome-cal.c,v
retrieving revision 1.349
diff -u -p -r1.349 gnome-cal.c
--- gui/gnome-cal.c	5 Aug 2004 13:28:03 -0000	1.349
+++ gui/gnome-cal.c	17 Aug 2004 15:49:23 -0000
@@ -702,7 +702,7 @@ update_query (GnomeCalendar *gcal)
 
 	priv = gcal->priv;
 
-	e_calendar_view_set_status_message (priv->views[priv->current_view_type], _("Updating query"));
+	e_calendar_view_set_status_message (priv->week_view, _("Updating query"));
 	e_calendar_item_clear_marks (priv->date_navigator->calitem);
 
 	/* free the previous queries */
@@ -723,7 +723,7 @@ update_query (GnomeCalendar *gcal)
 
 	real_sexp = adjust_e_cal_view_sexp (gcal, priv->sexp);
 	if (!real_sexp) {
-		e_calendar_view_set_status_message (priv->views[priv->current_view_type], NULL);
+		e_calendar_view_set_status_message (priv->week_view, NULL);
 		return; /* No time range is set, so don't start a query */
 	}
 
@@ -755,7 +755,7 @@ update_query (GnomeCalendar *gcal)
 	}
 
 	g_free (real_sexp);
-	e_calendar_view_set_status_message (priv->views[priv->current_view_type], NULL);
+	e_calendar_view_set_status_message (priv->week_view, NULL);
 	update_todo_view (gcal);
 }
 
@@ -2011,7 +2011,7 @@ client_cal_opened_cb (ECal *ecal, ECalen
 	source = e_cal_get_source (ecal);
 
 	if (source_type == E_CAL_SOURCE_TYPE_EVENT)
-		e_calendar_view_set_status_message (priv->views[priv->current_view_type], NULL);
+		e_calendar_view_set_status_message (priv->week_view, NULL);
 	else
 		e_calendar_table_set_status_message (E_CALENDAR_TABLE (priv->todo), NULL);
 
@@ -2038,7 +2038,7 @@ client_cal_opened_cb (ECal *ecal, ECalen
 	switch (source_type) {
 	case E_CAL_SOURCE_TYPE_EVENT :
 		msg = g_strdup_printf (_("Loading appointments at %s"), e_cal_get_uri (ecal));
-		e_calendar_view_set_status_message (priv->views[priv->current_view_type], msg);
+		e_calendar_view_set_status_message (priv->week_view, msg);
 		g_free (msg);
 
 		/* add client to the views */
@@ -2052,7 +2052,7 @@ client_cal_opened_cb (ECal *ecal, ECalen
 		/* update date navigator query */
 		update_query (gcal);
 
-		e_calendar_view_set_status_message (priv->views[priv->current_view_type], NULL);
+		e_calendar_view_set_status_message (priv->week_view, NULL);
 		break;
 		
 	case E_CAL_SOURCE_TYPE_TODO :
@@ -2086,7 +2086,7 @@ default_client_cal_opened_cb (ECal *ecal
 
 	switch (source_type) {
 	case E_CAL_SOURCE_TYPE_EVENT:
-		e_calendar_view_set_status_message (priv->views[priv->current_view_type], NULL);
+		e_calendar_view_set_status_message (priv->week_view, NULL);
 		break;		
 	case E_CAL_SOURCE_TYPE_TODO:
 		e_calendar_table_set_status_message (E_CALENDAR_TABLE (priv->todo), NULL);
@@ -2148,24 +2148,26 @@ open_ecal (GnomeCalendar *gcal, ECal *ca
 	char *msg;
 
 	priv = gcal->priv;
-	
-	msg = g_strdup_printf (_("Opening %s"), e_cal_get_uri (cal));
-	switch (e_cal_get_source_type (cal)) {
-	case E_CAL_SOURCE_TYPE_EVENT :
-		e_calendar_view_set_status_message (priv->views[priv->current_view_type], msg);
-		break;
-	case E_CAL_SOURCE_TYPE_TODO :
-		e_calendar_table_set_status_message (E_CALENDAR_TABLE (priv->todo), msg);
-		break;
-	default:
-		g_assert_not_reached ();
-		break;
-	}
 
-	g_free (msg);
+	if (e_cal_get_load_state (cal) == E_CAL_LOAD_NOT_LOADED) {
+		msg = g_strdup_printf (_("Opening %s"), e_cal_get_uri (cal));
+		switch (e_cal_get_source_type (cal)) {
+		case E_CAL_SOURCE_TYPE_EVENT :
+			e_calendar_view_set_status_message (priv->week_view, msg);
+			break;
+		case E_CAL_SOURCE_TYPE_TODO :
+			e_calendar_table_set_status_message (E_CALENDAR_TABLE (priv->todo), msg);
+			break;
+		default:
+			g_assert_not_reached ();
+			break;
+		}
 
-	g_signal_connect (G_OBJECT (cal), "cal_opened", G_CALLBACK (of), gcal);
-	e_cal_open_async (cal, only_if_exists);
+		g_free (msg);
+
+		g_signal_connect (G_OBJECT (cal), "cal_opened", G_CALLBACK (of), gcal);
+		e_cal_open_async (cal, only_if_exists);
+	}
 
 	return TRUE;
 }
@@ -2293,8 +2295,7 @@ backend_died_cb (ECal *ecal, gpointer da
 	case E_CAL_SOURCE_TYPE_EVENT:		
 		id = "calendar:calendar-crashed";
 		
-		for (i = 0; i < GNOME_CAL_LAST_VIEW; i++)
-			e_calendar_view_set_status_message (priv->views[i], NULL);
+		e_calendar_view_set_status_message (priv->week_view, NULL);
 
 		gtk_signal_emit (GTK_OBJECT (gcal), gnome_calendar_signals[SOURCE_REMOVED], source_type, source);
 		break;


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