2007-05-08 Murray Cumming <murrayc@murrayc.com>
+ * src/modest-tny-account-store.c: (get_password):
+ * src/modest-ui-actions.c:
+ (modest_ui_actions_on_password_requested):
+ Allow the username to be changed too, though there is more work to
+ be done on exactly how this behaves.
+
+2007-05-08 Murray Cumming <murrayc@murrayc.com>
+
* src/modest-account-mgr-helpers.h:
* src/modest-account-mgr-helpers.c:
Added modest_account_mgr_get_display_name(),
self = MODEST_TNY_ACCOUNT_STORE (account_store);
priv = MODEST_TNY_ACCOUNT_STORE_GET_PRIVATE(self);
+ /* TODO: What is this hash for? */
/* is it in the hash? if it's already there, it must be wrong... */
pwd_ptr = (gpointer)&pwd; /* pwd_ptr so the compiler does not complained about
* type-punned ptrs...*/
gboolean remember = FALSE;
pwd = NULL;
+ /* Note that we ignore the returned username here,
+ * because it is enough that it will be stored in gconf
+ * by the signal handler. */
g_signal_emit (G_OBJECT(self), signals[PASSWORD_REQUESTED_SIGNAL], 0,
account_id, /* server_account_name */
&username, &pwd, cancel, &remember);
GtkWidget *entry_username = gtk_entry_new ();
if (initial_username)
gtk_entry_set_text (GTK_ENTRY (entry_username), initial_username);
- /* TODO: Allow the username to be changed here. */
- gtk_widget_set_sensitive (entry_username, FALSE);
+ /* TODO: Dim this if a connection has ever succeeded with this username,
+ * as per the UI spec: */
+ /* gtk_widget_set_sensitive (entry_username, FALSE); */
#ifdef MODEST_PLATFORM_MAEMO
/* Auto-capitalization is the default, so let's turn it off: */
gtk_widget_show_all (GTK_WIDGET(GTK_DIALOG(dialog)->vbox));
if (gtk_dialog_run (GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) {
- if (username)
+ if (username) {
*username = g_strdup (gtk_entry_get_text (GTK_ENTRY(entry_username)));
+ modest_server_account_set_username (
+ modest_runtime_get_account_mgr(), server_account_name,
+ *username);
+
+ const gboolean username_was_changed =
+ (strcmp (*username, initial_username) != 0);
+ if (username_was_changed) {
+ /* To actually use a changed username,
+ * we must reset the connection, according to pvanhoof.
+ * This _might_ be a sensible way to do that: */
+ TnyDevice *device = modest_runtime_get_device();
+ tny_device_force_offline (device);
+ tny_device_force_online (device);
+ }
+ }
+
if (password) {
*password = g_strdup (gtk_entry_get_text (GTK_ENTRY(entry_password)));
if (cancel)
*cancel = FALSE;
+
} else {
if (username)
*username = NULL;