diff options
author | Gary Ekker <gekker@novell.com> | 2004-04-11 05:31:37 +0800 |
---|---|---|
committer | Gary Ekker <gekker@src.gnome.org> | 2004-04-11 05:31:37 +0800 |
commit | f657306b6d8416fa2709b671cacace3c894bb621 (patch) | |
tree | 4e749ab7e6dc6e8f7ab61bc9bba497bae4bb8340 /calendar | |
parent | 203132df9b3d99d88cef1b8a6cb397d32d6ff55b (diff) | |
download | gsoc2013-evolution-f657306b6d8416fa2709b671cacace3c894bb621.tar.gz gsoc2013-evolution-f657306b6d8416fa2709b671cacace3c894bb621.tar.zst gsoc2013-evolution-f657306b6d8416fa2709b671cacace3c894bb621.zip |
Fixed to use e-passwords.
2004-04-09 Gary Ekker <gekker@novell.com>
* gui/dialogs/url-editor-dialog.c: Fixed to use e-passwords.
* gui/dialogs/cal-prefs-dialog.c: Fixed crash and bugs created by
changes made for instant apply.
* gui/itip-utils.c: Fixed to use e-passwords.
* gui/e-pub-utils.c: Fixed to use e-passwords.
(just_published): Fixed error in logic.
(e_pub_publish): Fixed crash if ESource is NULL.
svn path=/trunk/; revision=25410
Diffstat (limited to 'calendar')
-rw-r--r-- | calendar/ChangeLog | 14 | ||||
-rw-r--r-- | calendar/gui/dialogs/cal-prefs-dialog.c | 43 | ||||
-rw-r--r-- | calendar/gui/dialogs/url-editor-dialog.c | 55 | ||||
-rw-r--r-- | calendar/gui/e-pub-utils.c | 56 | ||||
-rw-r--r-- | calendar/gui/itip-utils.c | 12 |
5 files changed, 119 insertions, 61 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 5b2a98bbbd..d5f0b23121 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,17 @@ +2004-04-09 Gary Ekker <gekker@novell.com> + + * gui/dialogs/url-editor-dialog.c: Fixed to use e-passwords. + + * gui/dialogs/cal-prefs-dialog.c: Fixed crash and bugs created by + changes made for instant apply. + + * gui/itip-utils.c: Fixed to use e-passwords. + + * gui/e-pub-utils.c: Fixed to use e-passwords. + (just_published): Fixed error in logic. + (e_pub_publish): Fixed crash if ESource is NULL. + + 2004-04-09 Chris Toshok <toshok@ximian.com> * gui/dialogs/e-delegate-dialog.c (e_delegate_dialog_construct): diff --git a/calendar/gui/dialogs/cal-prefs-dialog.c b/calendar/gui/dialogs/cal-prefs-dialog.c index 3f32522118..0a6d703cd4 100644 --- a/calendar/gui/dialogs/cal-prefs-dialog.c +++ b/calendar/gui/dialogs/cal-prefs-dialog.c @@ -641,6 +641,7 @@ cal_prefs_dialog_url_add_clicked (GtkWidget *button, DialogData *dialog_data) -1); url_list_changed (dialog_data); + show_fb_config (dialog_data); if (!GTK_WIDGET_SENSITIVE ((GtkWidget *) dialog_data->url_remove)) { selection = gtk_tree_view_get_selection ((GtkTreeView *) dialog_data->url_list); @@ -686,6 +687,7 @@ cal_prefs_dialog_url_edit_clicked (GtkWidget *button, DialogData *dialog_data) -1); url_list_changed (dialog_data); + show_fb_config (dialog_data); if (!GTK_WIDGET_SENSITIVE ((GtkWidget *) dialog_data->url_remove)) { selection = gtk_tree_view_get_selection ((GtkTreeView *) dialog_data->url_list); @@ -757,8 +759,8 @@ cal_prefs_dialog_url_remove_clicked (GtkWidget *button, DialogData *dialog_data) gtk_widget_set_sensitive (GTK_WIDGET (dialog_data->url_enable), FALSE); } g_free (url); - url_list_changed (dialog_data); + show_fb_config (dialog_data); } } @@ -776,6 +778,9 @@ cal_prefs_dialog_url_enable_clicked (GtkWidget *button, DialogData *dialog_data) URL_LIST_FREE_BUSY_URL_COLUMN, &url, -1); url->enabled = !url->enabled; + + gtk_tree_selection_select_iter (selection, &iter); + gtk_list_store_set ((GtkListStore *) model, &iter, URL_LIST_ENABLED_COLUMN, url->enabled, -1); @@ -784,6 +789,7 @@ cal_prefs_dialog_url_enable_clicked (GtkWidget *button, DialogData *dialog_data) url->enabled ? _("Disable") : _("Enable")); url_list_changed (dialog_data); + show_fb_config (dialog_data); } } @@ -817,6 +823,7 @@ cal_prefs_dialog_url_list_enable_toggled (GtkCellRendererToggle *renderer, url->enabled ? _("Disable") : _("Enable")); url_list_changed (dialog_data); + show_fb_config (dialog_data); } gtk_tree_path_free (path); @@ -863,7 +870,7 @@ cal_prefs_dialog_url_list_change (GtkTreeSelection *selection, static void show_fb_config (DialogData *dialog_data) { - GSList *url_config_list; + GSList *url_config_list = NULL; GtkListStore *model; GtkTreeIter iter; @@ -872,6 +879,27 @@ show_fb_config (DialogData *dialog_data) /* restore urls from gconf */ url_config_list = calendar_config_get_free_busy(); + + if (!url_config_list) { + /* list is empty-disable edit, remove, and enable buttons */ + gtk_widget_set_sensitive (GTK_WIDGET (dialog_data->url_edit), + FALSE); + + gtk_widget_set_sensitive (GTK_WIDGET (dialog_data->url_remove), + FALSE); + + gtk_widget_set_sensitive (GTK_WIDGET (dialog_data->url_enable), + FALSE); + } else { + gtk_widget_set_sensitive (GTK_WIDGET (dialog_data->url_edit), + TRUE); + + gtk_widget_set_sensitive (GTK_WIDGET (dialog_data->url_remove), + TRUE); + + gtk_widget_set_sensitive (GTK_WIDGET (dialog_data->url_enable), + TRUE); + } while (url_config_list) { gchar *xml = (gchar *)url_config_list->data; @@ -896,17 +924,6 @@ show_fb_config (DialogData *dialog_data) g_slist_foreach (url_config_list, (GFunc) g_free, NULL); g_slist_free (url_config_list); - if (!gtk_tree_model_get_iter_first ((GtkTreeModel *) model, &iter)) { - /* list is empty-disable edit, remove, and enable buttons */ - gtk_widget_set_sensitive (GTK_WIDGET (dialog_data->url_edit), - FALSE); - - gtk_widget_set_sensitive (GTK_WIDGET (dialog_data->url_remove), - FALSE); - - gtk_widget_set_sensitive (GTK_WIDGET (dialog_data->url_enable), - FALSE); - } } /* Shows the current task list settings in the dialog */ diff --git a/calendar/gui/dialogs/url-editor-dialog.c b/calendar/gui/dialogs/url-editor-dialog.c index ec1e493402..5b87c58289 100644 --- a/calendar/gui/dialogs/url-editor-dialog.c +++ b/calendar/gui/dialogs/url-editor-dialog.c @@ -34,6 +34,7 @@ #include "cal-prefs-dialog.h" #include "url-editor-dialog.h" +#include "e-util/e-passwords.h" #include <gtk/gtk.h> #include <gtk/gtksignal.h> #include <gtk/gtkoptionmenu.h> @@ -82,7 +83,8 @@ url_editor_dialog_new (DialogData *dialog_data, EPublishUri *uri) url_dlg_data->url_data = uri; init_widgets (url_dlg_data); - if (uri->location && uri->username && uri->password) { + + if (uri->location && uri->username) { if (strlen(uri->location) != 0) { gtk_entry_set_text (url_dlg_data->url_entry, uri->location); @@ -91,6 +93,11 @@ url_editor_dialog_new (DialogData *dialog_data, EPublishUri *uri) gtk_entry_set_text (url_dlg_data->username_entry, uri->username); } + } + + uri->password = e_passwords_get_password ("Calendar", url_dlg_data->url_data->location); + + if (uri->password) { if (strlen(uri->password) != 0) { gtk_entry_set_text (url_dlg_data->password_entry, uri->password); @@ -99,25 +106,26 @@ url_editor_dialog_new (DialogData *dialog_data, EPublishUri *uri) } else { e_dialog_toggle_set (url_dlg_data->remember_pw, FALSE); } - - switch (uri->publish_freq) { - case URI_PUBLISH_DAILY: - e_dialog_radio_set (url_dlg_data->daily, - URI_PUBLISH_DAILY, - pub_frequency_type_map); - break; - case URI_PUBLISH_WEEKLY: - e_dialog_radio_set (url_dlg_data->daily, - URI_PUBLISH_WEEKLY, - pub_frequency_type_map); - break; - case URI_PUBLISH_USER: - default: - e_dialog_radio_set (url_dlg_data->daily, - URI_PUBLISH_USER, - pub_frequency_type_map); - } } + + switch (uri->publish_freq) { + case URI_PUBLISH_DAILY: + e_dialog_radio_set (url_dlg_data->daily, + URI_PUBLISH_DAILY, + pub_frequency_type_map); + break; + case URI_PUBLISH_WEEKLY: + e_dialog_radio_set (url_dlg_data->daily, + URI_PUBLISH_WEEKLY, + pub_frequency_type_map); + break; + case URI_PUBLISH_USER: + default: + e_dialog_radio_set (url_dlg_data->daily, + URI_PUBLISH_USER, + pub_frequency_type_map); + } + dialog_data->url_editor=TRUE; dialog_data->url_editor_dlg = (GtkWidget *) url_dlg_data; gtk_widget_set_sensitive ((GtkWidget *) url_dlg_data->ok, FALSE); @@ -128,8 +136,13 @@ url_editor_dialog_new (DialogData *dialog_data, EPublishUri *uri) if ((GtkEntry *) url_dlg_data->url_entry) { url_editor_dialog_fb_url_activated (url_dlg_data->url_entry, url_dlg_data); url_dlg_data->url_data->username = g_strdup (gtk_entry_get_text ((GtkEntry *) url_dlg_data->username_entry)); - if (e_dialog_toggle_get (url_dlg_data->remember_pw)) - url_dlg_data->url_data->password = g_strdup (gtk_entry_get_text ((GtkEntry *) url_dlg_data->password_entry)); + url_dlg_data->url_data->password = g_strdup (gtk_entry_get_text ((GtkEntry *) url_dlg_data->password_entry)); + if (e_dialog_toggle_get (url_dlg_data->remember_pw)) { + e_passwords_add_password (url_dlg_data->url_data->location, url_dlg_data->url_data->password); + e_passwords_remember_password ("Calendar", url_dlg_data->url_data->location); + } else { + e_passwords_forget_password ("Calendar", url_dlg_data->url_data->location); + } } } diff --git a/calendar/gui/e-pub-utils.c b/calendar/gui/e-pub-utils.c index f7191c0708..a206d43706 100644 --- a/calendar/gui/e-pub-utils.c +++ b/calendar/gui/e-pub-utils.c @@ -27,6 +27,8 @@ #include <libedataserver/e-source.h> #include <libedataserver/e-source-list.h> #include <libecal/e-cal-time-util.h> +#include <libgnome/gnome-i18n.h> +#include "e-util/e-passwords.h" #include "calendar-config.h" #include "common/authentication.h" #include "itip-utils.h" @@ -38,7 +40,7 @@ e_pub_uri_from_xml (EPublishUri *uri, const gchar *xml) xmlDocPtr doc; xmlNodePtr root, p; xmlChar *location, *enabled, *frequency; - xmlChar *username, *password, *publish_time; + xmlChar *username, *publish_time; GSList *l = NULL; uri->location = NULL; @@ -56,7 +58,6 @@ e_pub_uri_from_xml (EPublishUri *uri, const gchar *xml) enabled = xmlGetProp (root, "enabled"); frequency = xmlGetProp (root, "frequency"); username = xmlGetProp (root, "username"); - password = xmlGetProp (root, "password"); publish_time = xmlGetProp (root, "publish_time"); if (location != NULL) @@ -67,11 +68,11 @@ e_pub_uri_from_xml (EPublishUri *uri, const gchar *xml) uri->publish_freq = atoi (frequency); if (username != NULL) uri->username = g_strdup (username); - if (password != NULL) - uri->password = g_strdup (password); if (publish_time != NULL) uri->last_pub_time = g_strdup (publish_time); + uri->password = g_strdup (""); + for (p = root->children; p != NULL; p = p->next) { xmlChar *uid = xmlGetProp (p, "uid"); @@ -108,7 +109,6 @@ e_pub_uri_to_xml (EPublishUri *uri) xmlSetProp (root, "enabled", enabled); xmlSetProp (root, "frequency", frequency); xmlSetProp (root, "username", uri->username); - xmlSetProp (root, "password", uri->password); xmlSetProp (root, "publish_time", uri->last_pub_time); for (cals = uri->calendars; cals != NULL; cals = cals->next) { @@ -176,19 +176,21 @@ is_publish_time (EPublishUri *uri) { static gboolean just_published (gchar *last_pub_time) { icaltimezone *utc; - struct icaltimetype pubtime_itt, adjust_itt; + struct icaltimetype current_itt, adjust_itt; if (strlen (last_pub_time) != 0) { utc = icaltimezone_get_utc_timezone (); - pubtime_itt = icaltime_from_string (last_pub_time); - adjust_itt = icaltime_current_time_with_zone (utc); + adjust_itt = icaltime_from_string (last_pub_time); + current_itt = icaltime_current_time_with_zone (utc); icaltime_adjust (&adjust_itt, 0, 0, 0, 3); - if (icaltime_compare_date_only (pubtime_itt, adjust_itt) < 0) + if (icaltime_compare (adjust_itt, current_itt) < 0) return TRUE; + else + return FALSE; } - return FALSE; + return TRUE; } void @@ -215,13 +217,17 @@ e_pub_publish (gboolean publish) { ECalComponent *clone = NULL; gboolean cloned = FALSE; ECal *client = NULL; - gchar *xml = (gchar *)uri_config_list->data; + char *prompt; + gboolean remember = FALSE; + gchar *password; + + gchar *xml = (gchar *)l->data; uri = g_new0 (EPublishUri, 1); e_pub_uri_from_xml (uri, xml); /* kludge to safeguard against loop from gconf update */ - if (just_published (uri->last_pub_time)) + if (!just_published (uri->last_pub_time)) return; /* TODO: make sure we're online */ @@ -256,8 +262,8 @@ e_pub_publish (gboolean publish) { source_uid = g_strdup (p->data); source = e_source_list_peek_source_by_uid (source_list, source_uid); - - client = auth_new_cal_from_uri (e_source_get_uri (source), E_CAL_SOURCE_TYPE_EVENT); + if (source) + client = auth_new_cal_from_uri (e_source_get_uri (source), E_CAL_SOURCE_TYPE_EVENT); if (!client) { g_warning (G_STRLOC ": Could not publish Free/Busy: Calendar backend no longer exists"); @@ -285,12 +291,32 @@ e_pub_publish (gboolean publish) { g_free (source_uid); } + + /* add password to the uri */ + password = e_passwords_get_password ("Calendar", + (gchar *)uri->location); + if (!password) { + prompt = g_strdup_printf (_("Enter the password for %s"), (gchar *)uri->location); + password = e_passwords_ask_password (_("Enter password"), + "Calendar", (gchar *)uri->location, + prompt, TRUE, + E_PASSWORDS_REMEMBER_FOREVER, + &remember, NULL); + + g_free (prompt); + + if (!password) { + g_slist_free (p); + continue; + } + } + if (cloned && clone) published = itip_publish_comp ((ECal *) client, uri->location, uri->username, - uri->password, &clone); + password, &clone); g_slist_free (p); } diff --git a/calendar/gui/itip-utils.c b/calendar/gui/itip-utils.c index 383d7df0cf..156dd08026 100644 --- a/calendar/gui/itip-utils.c +++ b/calendar/gui/itip-utils.c @@ -1152,18 +1152,6 @@ itip_publish_comp (ECal *client, gchar *uri, gchar *username, /* Publish the component */ session = soup_session_async_new (); - /* add username and password to the uri */ - if (strlen (password) == 0) { - prompt = g_strdup_printf (_("Enter the password for %s"), uri); - password = e_passwords_ask_password (_("Enter password"), - "Calendar", NULL, - prompt, TRUE, - E_PASSWORDS_DO_NOT_REMEMBER, - &remember, NULL); - - g_free (prompt); - } - real_uri = soup_uri_new (uri); if (!real_uri) { g_warning (G_STRLOC ": Invalid URL: %s", uri); |