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



On Tue, 2004-08-17 at 17:50 +0200, Rodrigo Moya wrote:
> 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
>
hopefully final patch now.
-- 
Rodrigo Moya <rodrigo novell com>
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/calendar/ChangeLog,v
retrieving revision 1.2490
diff -u -p -r1.2490 ChangeLog
--- ChangeLog	18 Aug 2004 14:42:19 -0000	1.2490
+++ ChangeLog	20 Aug 2004 15:32:32 -0000
@@ -1,3 +1,35 @@
+2004-08-19  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.
+	(gnome_calendar_set_activity_handler): set the activity handlers on
+	all views, not just the current one.
+	(display_view): no need to set the activity handler here.
+
 2004-08-18  Sivaiah Nallagatla <snallagatla novell com>
 
 	* gui/alarm-notify/alarm-notify.c (alarm-notify_init) :
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	20 Aug 2004 15:32:33 -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);
 }
 
@@ -1778,7 +1778,6 @@ display_view (GnomeCalendar *gcal, Gnome
 	if (grab_focus)
 		focus_current_view (gcal);
 
-	gnome_calendar_set_activity_handler (gcal, priv->activity_handler);
 	gnome_calendar_set_pane_positions (gcal);
 
 	/* For the week & month views we want the selection in the date
@@ -2011,7 +2010,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 +2037,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 +2051,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 +2085,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 +2147,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 +2294,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;
@@ -2360,7 +2360,7 @@ gnome_calendar_set_activity_handler (Gno
 	priv->activity_handler = activity_handler;
 	
 	for (i = 0; i < GNOME_CAL_LAST_VIEW; i++)
-		e_calendar_view_set_activity_handler (priv->views[i], i == priv->current_view_type ? activity_handler : NULL);		
+		e_calendar_view_set_activity_handler (priv->views[i], activity_handler);
 	
 	e_calendar_table_set_activity_handler (E_CALENDAR_TABLE (priv->todo), activity_handler);
 }


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