evolution r37080 - in trunk/calendar: . common gui



Author: mcrha
Date: Thu Jan 15 15:07:46 2009
New Revision: 37080
URL: http://svn.gnome.org/viewvc/evolution?rev=37080&view=rev

Log:
2009-01-15  Milan Crha  <mcrha redhat com>

	** Fix for bug #303738

	* gui/gnome-cal.c: (client_cal_opened_cb),
	(default_client_cal_opened_cb):
	* gui/e-memos.c: (client_cal_opened_cb),
	(default_client_cal_opened_cb):
	* gui/e-tasks.c: (client_cal_opened_cb),
	(default_client_cal_opened_cb):
	Forget password on AuthFailed or AuthRequired and try to reopen
	on AuthFailed status, which will ask for a password again.

	* gui/comp-editor-factory.c: (cal_opened_cb):
	Show "Authentication Required" on such status returned.

	* common/authentication.c: (auth_cal_forget_password):
	Do not free memory which hold ECal. Also always forget password
	for calendar with the URL key.



Modified:
   trunk/calendar/ChangeLog
   trunk/calendar/common/authentication.c
   trunk/calendar/gui/comp-editor-factory.c
   trunk/calendar/gui/e-memos.c
   trunk/calendar/gui/e-tasks.c
   trunk/calendar/gui/gnome-cal.c

Modified: trunk/calendar/common/authentication.c
==============================================================================
--- trunk/calendar/common/authentication.c	(original)
+++ trunk/calendar/common/authentication.c	Thu Jan 15 15:07:46 2009
@@ -77,21 +77,21 @@
 {
 	ESource *source = NULL;
 	const char *auth_domain = NULL, *component_name = NULL,  *auth_type = NULL;
-	char *key = NULL;
 
 	source = e_cal_get_source (ecal);
 	auth_domain = e_source_get_property (source, "auth-domain");
 	component_name = auth_domain ? auth_domain : "Calendar";
 
 	auth_type = e_source_get_property (source, "auth-type");
-	if (auth_type)
-		key = build_pass_key (ecal);
-	else
-		key = e_source_get_uri (source);
+	if (auth_type) {
+		char *key = NULL;
 
-	e_passwords_forget_password (component_name, key);
+		key = build_pass_key (ecal);
+		e_passwords_forget_password (component_name, key);
+		g_free (key);
+	}
 
-	g_free (key);
+	e_passwords_forget_password (component_name, e_source_get_uri (source));
 }
 
 ECal *

Modified: trunk/calendar/gui/comp-editor-factory.c
==============================================================================
--- trunk/calendar/gui/comp-editor-factory.c	(original)
+++ trunk/calendar/gui/comp-editor-factory.c	Thu Jan 15 15:07:46 2009
@@ -421,6 +421,12 @@
 						 "%s", _("Permission denied to open the calendar"));
 		break;
 
+	case E_CALENDAR_STATUS_AUTHENTICATION_REQUIRED:
+		dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL,
+						 GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
+						 "%s", _("Authentication Required"));
+		break;
+
 	case E_CALENDAR_STATUS_AUTHENTICATION_FAILED :
 		dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL,
 						 GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,

Modified: trunk/calendar/gui/e-memos.c
==============================================================================
--- trunk/calendar/gui/e-memos.c	(original)
+++ trunk/calendar/gui/e-memos.c	Thu Jan 15 15:07:46 2009
@@ -802,6 +802,9 @@
 
 	source = e_cal_get_source (ecal);
 
+	if (status == E_CALENDAR_STATUS_AUTHENTICATION_FAILED || status == E_CALENDAR_STATUS_AUTHENTICATION_REQUIRED)
+		auth_cal_forget_password (ecal);
+
 	switch (status) {
 	case E_CALENDAR_STATUS_OK :
 		g_signal_handlers_disconnect_matched (ecal, G_SIGNAL_MATCH_FUNC, 0, 0, NULL, client_cal_opened_cb, NULL);
@@ -813,11 +816,14 @@
 		set_timezone (memos);
 		set_status_message (memos, NULL);
 		break;
+	case E_CALENDAR_STATUS_AUTHENTICATION_FAILED:
+		/* try to reopen calendar - it'll ask for a password once again */
+		e_cal_open_async (ecal, FALSE);
+		return;
 	case E_CALENDAR_STATUS_BUSY :
 		break;
 	case E_CALENDAR_STATUS_REPOSITORY_OFFLINE:
 		e_error_run (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (memos))), "calendar:prompt-no-contents-offline-memos", NULL);
-		break;
 	default :
 		/* Make sure the source doesn't disappear on us */
 		g_object_ref (source);
@@ -849,6 +855,9 @@
 
 	source = e_cal_get_source (ecal);
 
+	if (status == E_CALENDAR_STATUS_AUTHENTICATION_FAILED || status == E_CALENDAR_STATUS_AUTHENTICATION_REQUIRED)
+		auth_cal_forget_password (ecal);
+
 	switch (status) {
 	case E_CALENDAR_STATUS_OK :
 		g_signal_handlers_disconnect_matched (ecal, G_SIGNAL_MATCH_FUNC, 0, 0, NULL, default_client_cal_opened_cb, NULL);
@@ -858,6 +867,10 @@
 		e_cal_model_set_default_client (model, ecal);
 		set_status_message (memos, NULL);
 		break;
+	case E_CALENDAR_STATUS_AUTHENTICATION_FAILED:
+		/* try to reopen calendar - it'll ask for a password once again */
+		e_cal_open_async (ecal, FALSE);
+		return;
 	case E_CALENDAR_STATUS_BUSY:
 		break;
 	default :

Modified: trunk/calendar/gui/e-tasks.c
==============================================================================
--- trunk/calendar/gui/e-tasks.c	(original)
+++ trunk/calendar/gui/e-tasks.c	Thu Jan 15 15:07:46 2009
@@ -953,7 +953,7 @@
 
 	source = e_cal_get_source (ecal);
 	
-	if (status == E_CALENDAR_STATUS_AUTHENTICATION_FAILED)
+	if (status == E_CALENDAR_STATUS_AUTHENTICATION_FAILED || status == E_CALENDAR_STATUS_AUTHENTICATION_REQUIRED)
 		auth_cal_forget_password (ecal);
 
 	switch (status) {
@@ -966,6 +966,10 @@
 
 		set_status_message (tasks, NULL);
 		break;
+	case E_CALENDAR_STATUS_AUTHENTICATION_FAILED:
+		/* try to reopen calendar - it'll ask for a password once again */
+		e_cal_open_async (ecal, FALSE);
+		return;
 	case E_CALENDAR_STATUS_BUSY :
 		break;
 	case E_CALENDAR_STATUS_REPOSITORY_OFFLINE:
@@ -1001,7 +1005,7 @@
 
 	source = e_cal_get_source (ecal);
 
-	if (status == E_CALENDAR_STATUS_AUTHENTICATION_FAILED)
+	if (status == E_CALENDAR_STATUS_AUTHENTICATION_FAILED || status == E_CALENDAR_STATUS_AUTHENTICATION_REQUIRED)
 		auth_cal_forget_password (ecal);
 
 	switch (status) {
@@ -1012,6 +1016,10 @@
 		e_cal_model_set_default_client (model, ecal);
 		set_status_message (tasks, NULL);
 		break;
+	case E_CALENDAR_STATUS_AUTHENTICATION_FAILED:
+		/* try to reopen calendar - it'll ask for a password once again */
+		e_cal_open_async (ecal, FALSE);
+		return;
 	case E_CALENDAR_STATUS_BUSY:
 		break;
 	default :

Modified: trunk/calendar/gui/gnome-cal.c
==============================================================================
--- trunk/calendar/gui/gnome-cal.c	(original)
+++ trunk/calendar/gui/gnome-cal.c	Thu Jan 15 15:07:46 2009
@@ -2793,7 +2793,7 @@
 		break;
 	}
 
-	if (status == E_CALENDAR_STATUS_AUTHENTICATION_FAILED && source_type == E_CAL_SOURCE_TYPE_EVENT)
+	if (status == E_CALENDAR_STATUS_AUTHENTICATION_FAILED || status == E_CALENDAR_STATUS_AUTHENTICATION_REQUIRED)
 		auth_cal_forget_password (ecal);
 
 	switch (status) {
@@ -2819,17 +2819,10 @@
 
 		status = E_CALENDAR_STATUS_OK;
 		break;
-	case E_CALENDAR_STATUS_AUTHENTICATION_FAILED: 
-		{
-			const gchar *auth_domain = e_source_get_property (source, "auth-domain");
-			const gchar *component_name;
-			
-			component_name = auth_domain ? auth_domain : "Calendar";
-
-			/* Warn the user password is wrong */
-			e_passwords_forget_password (component_name, e_cal_get_uri(ecal));
-			return;
-		}
+	case E_CALENDAR_STATUS_AUTHENTICATION_FAILED:
+		/* try to reopen calendar - it'll ask for a password once again */
+		e_cal_open_async (ecal, FALSE);
+		return;
 	case E_CALENDAR_STATUS_REPOSITORY_OFFLINE:
 		if (source_type == E_CAL_SOURCE_TYPE_EVENT)
 		{
@@ -2851,6 +2844,8 @@
 		/* Make sure the source doesn't disappear on us */
 		g_object_ref (source);
 
+		g_signal_handlers_disconnect_matched (ecal, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, gcal);
+
 		priv->clients_list[source_type] = g_list_remove (priv->clients_list[source_type], ecal);
 		g_hash_table_remove (priv->clients[source_type], e_source_peek_uid (source));
 
@@ -2915,6 +2910,9 @@
 	source = e_cal_get_source (ecal);
 	state = e_cal_get_load_state (ecal);
 
+	if (status == E_CALENDAR_STATUS_AUTHENTICATION_FAILED || status == E_CALENDAR_STATUS_AUTHENTICATION_REQUIRED)
+		auth_cal_forget_password (ecal);
+
 	switch (source_type) {
 	case E_CAL_SOURCE_TYPE_EVENT:
 		e_calendar_view_set_status_message (E_CALENDAR_VIEW (priv->week_view), NULL, -1);
@@ -2936,13 +2934,18 @@
 		if (state == E_CAL_LOAD_NOT_LOADED)
 			e_cal_open_async (ecal, FALSE);
 		return;
-	case E_CALENDAR_STATUS_INVALID_SERVER_VERSION :
+	case E_CALENDAR_STATUS_AUTHENTICATION_FAILED:
+		/* try to reopen calendar - it'll ask for a password once again */
+		e_cal_open_async (ecal, FALSE);
+		return;
+	case E_CALENDAR_STATUS_INVALID_SERVER_VERSION:
 		e_error_run (NULL, "calendar:server-version", NULL);
-		status = E_CALENDAR_STATUS_OK;
 	default:
 		/* Make sure the source doesn't disappear on us */
 		g_object_ref (source);
 
+		g_signal_handlers_disconnect_matched (ecal, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, gcal);
+
 		/* FIXME should we do this to prevent multiple error dialogs? */
 		priv->clients_list[source_type] = g_list_remove (priv->clients_list[source_type], ecal);
 		g_hash_table_remove (priv->clients[source_type], e_source_peek_uid (source));
@@ -2962,7 +2965,6 @@
 
 	g_signal_handlers_disconnect_matched (ecal, G_SIGNAL_MATCH_FUNC, 0, 0, NULL, default_client_cal_opened_cb, NULL);
 
-
 	switch (source_type) {
 	case E_CAL_SOURCE_TYPE_EVENT:
 			e_cal_model_set_default_client (



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