evolution r35035 - in trunk/calendar: . common gui



Author: sragavan
Date: Sun Feb 17 20:29:58 2008
New Revision: 35035
URL: http://svn.gnome.org/viewvc/evolution?rev=35035&view=rev

Log:
2008-02-18  Srinivasa Ragavan  <sragavan novell com>

	** Fix for bnc #160049. Patch from OpenSUSE.

	* common/authentication.c: (build_pass_key),
	(auth_cal_forget_password):
	* common/authentication.h:
	* gui/e-tasks.c: (client_cal_opened_cb),
	(default_client_cal_opened_cb):
	* gui/gnome-cal.c: (client_cal_opened_cb):




Modified:
   trunk/calendar/ChangeLog
   trunk/calendar/common/authentication.c
   trunk/calendar/common/authentication.h
   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	Sun Feb 17 20:29:58 2008
@@ -30,6 +30,7 @@
 #include <libedataserver/e-source.h>
 #include <libedataserverui/e-passwords.h>
 #include "authentication.h"
+#include <libedataserver/e-url.h>
 
 static GHashTable *source_lists_hash = NULL;
 
@@ -55,6 +56,44 @@
 	return password;
 }
 
+static char *
+build_pass_key (ECal *ecal)
+{
+	char *euri_str;
+	const char *uri;
+	EUri *euri;
+
+	uri = e_cal_get_uri (ecal);
+
+	euri = e_uri_new (uri);
+	euri_str = e_uri_to_string (euri, FALSE);
+
+	e_uri_free (euri);
+	return euri_str;
+}
+
+void 
+auth_cal_forget_password (ECal *ecal)
+{
+	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);
+
+	e_passwords_forget_password (component_name, key);
+
+	g_free (key);
+}
+
 ECal *
 auth_new_cal_from_default (ECalSourceType type)
 {

Modified: trunk/calendar/common/authentication.h
==============================================================================
--- trunk/calendar/common/authentication.h	(original)
+++ trunk/calendar/common/authentication.h	Sun Feb 17 20:29:58 2008
@@ -30,5 +30,6 @@
 ECal *auth_new_cal_from_default (ECalSourceType type);
 ECal *auth_new_cal_from_source (ESource *source, ECalSourceType type);
 ECal *auth_new_cal_from_uri (const char *uri, ECalSourceType type);
+void auth_cal_forget_password (ECal *ecal);
 
 #endif

Modified: trunk/calendar/gui/e-tasks.c
==============================================================================
--- trunk/calendar/gui/e-tasks.c	(original)
+++ trunk/calendar/gui/e-tasks.c	Sun Feb 17 20:29:58 2008
@@ -964,6 +964,9 @@
 	priv = tasks->priv;
 
 	source = e_cal_get_source (ecal);
+	
+	if (status == E_CALENDAR_STATUS_AUTHENTICATION_FAILED)
+		auth_cal_forget_password (ecal);
 
 	switch (status) {
 	case E_CALENDAR_STATUS_OK :
@@ -1010,6 +1013,9 @@
 
 	source = e_cal_get_source (ecal);
 
+	if (status == E_CALENDAR_STATUS_AUTHENTICATION_FAILED)
+		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);

Modified: trunk/calendar/gui/gnome-cal.c
==============================================================================
--- trunk/calendar/gui/gnome-cal.c	(original)
+++ trunk/calendar/gui/gnome-cal.c	Sun Feb 17 20:29:58 2008
@@ -2642,6 +2642,10 @@
 	default:
 		break;
 	}
+
+	if (status == E_CALENDAR_STATUS_AUTHENTICATION_FAILED && source_type == E_CAL_SOURCE_TYPE_EVENT)
+		auth_cal_forget_password (ecal);
+
 	switch (status) {
 	case E_CALENDAR_STATUS_OK:
 		break;



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