diff options
author | karl-qdh <karl@qdh.org.uk> | 2011-02-17 15:52:01 +0000 |
---|---|---|
committer | karl-qdh <karl@qdh.org.uk> | 2011-02-17 15:52:01 +0000 |
commit | 7a70d5723bafdee6460f5080fa94449667eba8f4 (patch) | |
tree | 5aa0c8fe2223dfd2670db09da2943fe5d0a752a6 | |
parent | 7d4571cce214fb4324bd3c8759c92feffe0b25c8 (diff) | |
download | ayatana-indicator-datetime-7a70d5723bafdee6460f5080fa94449667eba8f4.tar.gz ayatana-indicator-datetime-7a70d5723bafdee6460f5080fa94449667eba8f4.tar.bz2 ayatana-indicator-datetime-7a70d5723bafdee6460f5080fa94449667eba8f4.zip |
Rewrote auth_func at tedg's request.
-rw-r--r-- | src/datetime-service.c | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/src/datetime-service.c b/src/datetime-service.c index c910770..347fecb 100644 --- a/src/datetime-service.c +++ b/src/datetime-service.c @@ -414,24 +414,19 @@ update_timezone_menu_items(gpointer user_data) { return FALSE; } -// Authentication function taken from http://git.gnome.org/browse/evolution/tree/calendar/common/authentication.c +// Authentication function static gchar * -auth_func_cb (ECal *ecal, - const gchar *prompt, - const gchar *key, - gpointer user_data) -{ - gboolean remember; - gchar *password, *auth_domain; - ESource *source; - const gchar *component_name; +auth_func (ECal *ecal, const gchar *prompt, const gchar *key, gpointer user_data) { + ESource *source = e_cal_get_source (ecal); + gchar *auth_domain = e_source_get_duped_property (source, "auth-domain"); - source = e_cal_get_source (ecal); - auth_domain = e_source_get_duped_property (source, "auth-domain"); - component_name = auth_domain ? auth_domain : "Calendar"; - password = e_passwords_get_password (component_name, key); + const gchar *component_name; + if (auth_domain) component_name = auth_domain; + else component_name = "Calendar"; + + gchar *password = e_passwords_get_password (component_name, key); - if (!password) + if (password == NULL) { password = e_passwords_ask_password ( _("Enter password"), component_name, key, prompt, @@ -439,7 +434,8 @@ auth_func_cb (ECal *ecal, E_PASSWORDS_SECRET | E_PASSWORDS_ONLINE, &remember, NULL); - + } + g_free (auth_domain); return password; @@ -548,7 +544,7 @@ update_appointment_menu_items (gpointer user_data) { ESource *source = E_SOURCE (s->data); g_signal_connect (G_OBJECT(source), "changed", G_CALLBACK (update_appointment_menu_items), NULL); ECal *ecal = e_cal_new(source, E_CAL_SOURCE_TYPE_EVENT); - e_cal_set_auth_func (ecal, (ECalAuthFunc) auth_func_cb, NULL); + e_cal_set_auth_func (ecal, (ECalAuthFunc) auth_func, NULL); //icaltimezone * tzone; if (!e_cal_open(ecal, FALSE, &gerror)) { |