# HG changeset patch # User Richard Laager # Date 1134800115 0 # Node ID e9c143acd765a627cd7a8ed968c5138546a8a63a # Parent d85c2bfb2ea2997d1b60d98a7d62e0be16b311e1 [gaim-migrate @ 14833] SF Patch #1374838 from Sadrul "This patch (1) updates the account-dialog if an account's protocol/name is changed from the modify dialog. (2) disables the protocol and username entries in the account-modify dialog when the account is connected (allowing to change the protocol while an account is connected can cause random crashes). -- Adil" committer: Tailor Script diff -r d85c2bfb2ea2 -r e9c143acd765 src/gtkaccount.c --- a/src/gtkaccount.c Sat Dec 17 05:25:03 2005 +0000 +++ b/src/gtkaccount.c Sat Dec 17 06:15:15 2005 +0000 @@ -709,6 +709,23 @@ } static void +update_editable(GaimConnection *gc, AccountPrefsDialog *dialog) +{ + gboolean set; + GList *l; + + if (gc != NULL && dialog->account != gaim_connection_get_account(gc)) + return; + + set = !gaim_account_is_connected(dialog->account); + gtk_widget_set_sensitive(dialog->protocol_menu, set); + gtk_widget_set_sensitive(dialog->screenname_entry, set); + + for (l = dialog->user_split_entries ; l != NULL ; l = l->next) + gtk_widget_set_sensitive((GtkWidget *)l->data, set); +} + +static void add_login_options(AccountPrefsDialog *dialog, GtkWidget *parent) { GtkWidget *frame; @@ -749,6 +766,9 @@ g_signal_connect(G_OBJECT(dialog->screenname_entry), "changed", G_CALLBACK(screenname_changed_cb), dialog); + /* Do not let the user change the protocol/screenname while connected. */ + update_editable(NULL, dialog); + /* Do the user split thang */ if (dialog->plugin == NULL) /* Yeah right. */ user_splits = NULL; @@ -855,6 +875,11 @@ gtk_widget_hide(dialog->password_box); gtk_widget_hide(dialog->remember_pass_check); } + + gaim_signal_connect(gaim_connections_get_handle(), "signing-on", dialog, + G_CALLBACK(update_editable), dialog); + gaim_signal_connect(gaim_connections_get_handle(), "signed-off", dialog, + G_CALLBACK(update_editable), dialog); } static void @@ -1397,6 +1422,8 @@ if (dialog->icon_filesel) gtk_widget_destroy(dialog->icon_filesel); + gaim_signals_disconnect_by_handle(dialog); + g_free(dialog); } @@ -2394,6 +2421,17 @@ return sw; } +static void +account_modified_cb(GaimAccount *account, AccountsWindow *window) +{ + GtkTreeIter iter; + + if (!accounts_window_find_account_in_treemodel(&iter, account)) + return; + + set_account(window->model, &iter, account); +} + void gaim_gtk_accounts_window_show(void) { @@ -2479,6 +2517,9 @@ g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(close_accounts_cb), dialog); + gaim_signal_connect(gaim_gtk_account_get_handle(), "account-modified", + accounts_window, + GAIM_CALLBACK(account_modified_cb), accounts_window); gtk_widget_show(win); }