aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--calendar/ChangeLog20
-rw-r--r--calendar/common/authentication.c14
-rw-r--r--calendar/gui/comp-editor-factory.c6
-rw-r--r--calendar/gui/e-memos.c15
-rw-r--r--calendar/gui/e-tasks.c12
-rw-r--r--calendar/gui/gnome-cal.c32
6 files changed, 74 insertions, 25 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index d6a8b3910b..f0eb2a8a79 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,5 +1,25 @@
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.
+
+2009-01-15 Milan Crha <mcrha@redhat.com>
+
** Fix for bug #245156
* gui/e-day-view.c: (e_day_view_finish_long_event_resize),
diff --git a/calendar/common/authentication.c b/calendar/common/authentication.c
index 7925a36b65..85bde3d6fd 100644
--- a/calendar/common/authentication.c
+++ b/calendar/common/authentication.c
@@ -77,21 +77,21 @@ 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);
+ 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 *
diff --git a/calendar/gui/comp-editor-factory.c b/calendar/gui/comp-editor-factory.c
index f90649760a..908293a151 100644
--- a/calendar/gui/comp-editor-factory.c
+++ b/calendar/gui/comp-editor-factory.c
@@ -421,6 +421,12 @@ cal_opened_cb (ECal *client, ECalendarStatus status, gpointer data)
"%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,
diff --git a/calendar/gui/e-memos.c b/calendar/gui/e-memos.c
index a8c5b41b2b..89c9c8ad1e 100644
--- a/calendar/gui/e-memos.c
+++ b/calendar/gui/e-memos.c
@@ -802,6 +802,9 @@ client_cal_opened_cb (ECal *ecal, ECalendarStatus status, EMemos *memos)
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 @@ client_cal_opened_cb (ECal *ecal, ECalendarStatus status, EMemos *memos)
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 @@ default_client_cal_opened_cb (ECal *ecal, ECalendarStatus status, EMemos *memos)
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 @@ default_client_cal_opened_cb (ECal *ecal, ECalendarStatus status, EMemos *memos)
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 :
diff --git a/calendar/gui/e-tasks.c b/calendar/gui/e-tasks.c
index b866439413..fad9d6d300 100644
--- a/calendar/gui/e-tasks.c
+++ b/calendar/gui/e-tasks.c
@@ -953,7 +953,7 @@ client_cal_opened_cb (ECal *ecal, ECalendarStatus status, ETasks *tasks)
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 @@ client_cal_opened_cb (ECal *ecal, ECalendarStatus status, ETasks *tasks)
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 @@ default_client_cal_opened_cb (ECal *ecal, ECalendarStatus status, ETasks *tasks)
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 @@ default_client_cal_opened_cb (ECal *ecal, ECalendarStatus status, ETasks *tasks)
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 :
diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c
index dcec360953..c2b1cb3d6c 100644
--- a/calendar/gui/gnome-cal.c
+++ b/calendar/gui/gnome-cal.c
@@ -2793,7 +2793,7 @@ client_cal_opened_cb (ECal *ecal, ECalendarStatus status, GnomeCalendar *gcal)
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 @@ client_cal_opened_cb (ECal *ecal, ECalendarStatus status, GnomeCalendar *gcal)
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 @@ client_cal_opened_cb (ECal *ecal, ECalendarStatus status, GnomeCalendar *gcal)
/* 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 @@ default_client_cal_opened_cb (ECal *ecal, ECalendarStatus status, GnomeCalendar
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 @@ default_client_cal_opened_cb (ECal *ecal, ECalendarStatus status, GnomeCalendar
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 @@ default_client_cal_opened_cb (ECal *ecal, ECalendarStatus status, GnomeCalendar
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 (