[evolution-patches] Problems creating tasks from calendar views



First we weren't updating the default task source properly and second we
were unable to track it.  This should fix both problems and prevent a
crash when right clicking for New Task in the calendar views.

-JP
-- 
JP Rosevear <jpr novell com>
Novell, Inc.
? 61451.patch
? 62363.patch
? cal-conduits.patch
? cal-name.patch
? nav-scroll-2.patch
? nav-scroll-3.patch
? nav-scroll.patch
? task-default.patch
? task-warning.patch
? gui/Helgdagar_2004.ics
? gui/cal-comp.patch
? gui/month.patch
? gui/monthview.patch
? gui/nav-scroll.patch
? gui/navigator.patch
? gui/new-editor-2.patch
? gui/new-editor.patch
? gui/old-e-cal-model.h
? gui/old.c
? gui/scroll.patch
? gui/sel.patch
? gui/summary.patch
? gui/temp2.c
? gui/alarm-notify/alarm.patch
? gui/dialogs/alarm-dialog.gladep
? gui/dialogs/alarm-list-dialog.gladep
? gui/dialogs/calendar-setup.gladep
? gui/dialogs/event-page.gladep
? gui/dialogs/meeting-page.gladep
? gui/dialogs/recurrence-page.gladep
? gui/dialogs/temp.c
? gui/dialogs/temp2.c
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/calendar/ChangeLog,v
retrieving revision 1.2471
diff -u -r1.2471 ChangeLog
--- ChangeLog	2 Aug 2004 18:33:39 -0000	1.2471
+++ ChangeLog	3 Aug 2004 18:02:38 -0000
@@ -1,3 +1,25 @@
+2004-08-03  JP Rosevear  <jpr novell com>
+
+	* gui/gnome-cal.c (gnome_calendar_destroy): clean up all the
+	default clients
+	(default_client_cal_opened_cb): change the if statement to a
+	switch to be consistent with the other code bits and set the
+	default client for the source type
+	(gnome_calendar_add_source): look at the default based on the
+	source type
+	(gnome_calendar_set_default_source): set the default for the
+	source type
+	(gnome_calendar_new_task): bail out if we have no ecal
+
+	* gui/gnome-cal.c (set_timezone): set the timezone for all the
+	default clients
+
+	* gui/calendar-component.c (update_primary_task_selection): look
+	in the task source list, not the plain source list
+
+2004-08-03  JP Rosevear  <jpr novell com>
+
+	
 2004-08-01  JP Rosevear  <jpr novell com>
  
  	* conduits/todo/todo-conduit.c (todoconduit_load_configuration):
Index: gui/calendar-component.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/calendar-component.c,v
retrieving revision 1.179
diff -u -r1.179 calendar-component.c
--- gui/calendar-component.c	26 Jul 2004 15:35:35 -0000	1.179
+++ gui/calendar-component.c	3 Aug 2004 18:02:38 -0000
@@ -297,7 +297,7 @@
 
 	uid = calendar_config_get_primary_tasks ();
 	if (uid) {
-		source = e_source_list_peek_source_by_uid (component_view->source_list, uid);
+		source = e_source_list_peek_source_by_uid (component_view->task_source_list, uid);
 
 		g_free (uid);
 	}
Index: gui/gnome-cal.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/gnome-cal.c,v
retrieving revision 1.348
diff -u -r1.348 gnome-cal.c
--- gui/gnome-cal.c	30 Jul 2004 12:43:21 -0000	1.348
+++ gui/gnome-cal.c	3 Aug 2004 18:02:39 -0000
@@ -91,7 +91,7 @@
 	
 	GHashTable *clients[E_CAL_SOURCE_TYPE_LAST];
 	GList *clients_list[E_CAL_SOURCE_TYPE_LAST];
-	ECal *default_client;
+	ECal *default_client[E_CAL_SOURCE_TYPE_LAST];
 	
 	/* Categories from the calendar clients */
 	/* FIXME are we getting all the categories? */
@@ -982,11 +982,12 @@
 				/* FIXME Error checking */
 				e_cal_set_default_timezone (client, priv->zone, NULL);
 		}
-	}
 
-	if (priv->default_client && e_cal_get_load_state (priv->default_client) == E_CAL_LOAD_LOADED)
-		/* FIXME Error checking */
-		e_cal_set_default_timezone (priv->default_client, priv->zone, NULL);
+		if (priv->default_client[i] 
+		    && e_cal_get_load_state (priv->default_client[i]) == E_CAL_LOAD_LOADED)
+			/* FIXME Error checking */
+			e_cal_set_default_timezone (priv->default_client[i], priv->zone, NULL);
+	}
 }
 
 static void
@@ -1373,14 +1374,15 @@
 
 			priv->clients[i] = NULL;
 			priv->clients_list[i] = NULL;
-		}
 
-		if (priv->default_client) {
-			g_signal_handlers_disconnect_matched (priv->default_client, G_SIGNAL_MATCH_DATA,
-							      0, 0, NULL, NULL, gcal);
-			g_object_unref (priv->default_client);
-		}		
-		priv->default_client = NULL;
+			if (priv->default_client[i]) {
+				g_signal_handlers_disconnect_matched (priv->default_client[i], 
+								      G_SIGNAL_MATCH_DATA,
+								      0, 0, NULL, NULL, gcal);
+				g_object_unref (priv->default_client[i]);
+			}		
+			priv->default_client[i] = NULL;
+		}
 		
 		for (i = 0; i < E_CAL_SOURCE_TYPE_LAST; i++) {
 			free_categories (priv->categories[i]);
@@ -2082,11 +2084,17 @@
 	source_type = e_cal_get_source_type (ecal);
 	source = e_cal_get_source (ecal);
 
-	if (source_type == E_CAL_SOURCE_TYPE_EVENT)
+	switch (source_type) {
+	case E_CAL_SOURCE_TYPE_EVENT:
 		e_calendar_view_set_status_message (priv->views[priv->current_view_type], NULL);
-	else
+		break;		
+	case E_CAL_SOURCE_TYPE_TODO:
 		e_calendar_table_set_status_message (E_CALENDAR_TABLE (priv->todo), NULL);
-
+		break;
+	default:
+		break;
+	}
+	
 	if (status == E_CALENDAR_STATUS_BUSY)
 		return;
 
@@ -2099,8 +2107,8 @@
 		g_hash_table_remove (priv->clients[source_type], e_source_peek_uid (source));
 
 		/* FIXME Is there a better way to handle this? */
-		g_object_unref (priv->default_client);
-		priv->default_client = NULL;
+		g_object_unref (priv->default_client[source_type]);
+		priv->default_client[source_type] = NULL;
 		
 		gtk_signal_emit (GTK_OBJECT (gcal), gnome_calendar_signals[SOURCE_REMOVED], source_type, source);
 		
@@ -2127,7 +2135,7 @@
 		break;
 
 	default:
-		return;
+		break;
         }
 }
 
@@ -2433,13 +2441,13 @@
 	} else {
 		ESource *default_source;
 		
-		if (priv->default_client) {
-			default_source = e_cal_get_source (priv->default_client);
+		if (priv->default_client[source_type]) {
+			default_source = e_cal_get_source (priv->default_client[source_type]);
 
 			g_message ("Check if default client matches (%s %s)", e_source_peek_uid (default_source), e_source_peek_uid (source));
 			/* We don't have it but the default client is it */
 			if (!strcmp (e_source_peek_uid (default_source), e_source_peek_uid (source)))
-				client = g_object_ref (priv->default_client);
+				client = g_object_ref (priv->default_client[source_type]);
 		}
 
 		/* Create a new one */		
@@ -2579,18 +2587,18 @@
 
 	client = g_hash_table_lookup (priv->clients[source_type], e_source_peek_uid (source));
 
-	if (priv->default_client)
-		g_object_unref (priv->default_client);
+	if (priv->default_client[source_type])
+		g_object_unref (priv->default_client[source_type]);
 
 	if (client) {
-		priv->default_client = g_object_ref (client);
+		priv->default_client[source_type] = g_object_ref (client);
 	} else {
-		priv->default_client = auth_new_cal_from_source (source, source_type);
-		if (!priv->default_client)
+		priv->default_client[source_type] = auth_new_cal_from_source (source, source_type);
+		if (!priv->default_client[source_type])
 			return FALSE;
 	}
 
-	open_ecal (gcal, priv->default_client, FALSE, default_client_cal_opened_cb);
+	open_ecal (gcal, priv->default_client[source_type], FALSE, default_client_cal_opened_cb);
 
 	return TRUE;
 }
@@ -2658,6 +2666,9 @@
 
 	model = e_calendar_table_get_model (E_CALENDAR_TABLE (priv->todo));
 	ecal = e_cal_model_get_default_client (model);
+	if (!ecal)
+		return;
+	
 	tedit = task_editor_new (ecal);
 
 	icalcomp = e_cal_model_create_component_with_defaults (model);


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