comparison src/gtkaccount.c @ 12521:e9c143acd765

[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 <tailor@pidgin.im>
author Richard Laager <rlaager@wiktel.com>
date Sat, 17 Dec 2005 06:15:15 +0000
parents ee1944ebda45
children 8427ef2b4138
comparison
equal deleted inserted replaced
12520:d85c2bfb2ea2 12521:e9c143acd765
707 return NULL; 707 return NULL;
708 #endif 708 #endif
709 } 709 }
710 710
711 static void 711 static void
712 update_editable(GaimConnection *gc, AccountPrefsDialog *dialog)
713 {
714 gboolean set;
715 GList *l;
716
717 if (gc != NULL && dialog->account != gaim_connection_get_account(gc))
718 return;
719
720 set = !gaim_account_is_connected(dialog->account);
721 gtk_widget_set_sensitive(dialog->protocol_menu, set);
722 gtk_widget_set_sensitive(dialog->screenname_entry, set);
723
724 for (l = dialog->user_split_entries ; l != NULL ; l = l->next)
725 gtk_widget_set_sensitive((GtkWidget *)l->data, set);
726 }
727
728 static void
712 add_login_options(AccountPrefsDialog *dialog, GtkWidget *parent) 729 add_login_options(AccountPrefsDialog *dialog, GtkWidget *parent)
713 { 730 {
714 GtkWidget *frame; 731 GtkWidget *frame;
715 GtkWidget *vbox; 732 GtkWidget *vbox;
716 GtkWidget *entry; 733 GtkWidget *entry;
746 763
747 add_pref_box(dialog, vbox, _("Screen name:"), dialog->screenname_entry); 764 add_pref_box(dialog, vbox, _("Screen name:"), dialog->screenname_entry);
748 765
749 g_signal_connect(G_OBJECT(dialog->screenname_entry), "changed", 766 g_signal_connect(G_OBJECT(dialog->screenname_entry), "changed",
750 G_CALLBACK(screenname_changed_cb), dialog); 767 G_CALLBACK(screenname_changed_cb), dialog);
768
769 /* Do not let the user change the protocol/screenname while connected. */
770 update_editable(NULL, dialog);
751 771
752 /* Do the user split thang */ 772 /* Do the user split thang */
753 if (dialog->plugin == NULL) /* Yeah right. */ 773 if (dialog->plugin == NULL) /* Yeah right. */
754 user_splits = NULL; 774 user_splits = NULL;
755 else 775 else
853 (dialog->prpl_info->options & OPT_PROTO_NO_PASSWORD)) { 873 (dialog->prpl_info->options & OPT_PROTO_NO_PASSWORD)) {
854 874
855 gtk_widget_hide(dialog->password_box); 875 gtk_widget_hide(dialog->password_box);
856 gtk_widget_hide(dialog->remember_pass_check); 876 gtk_widget_hide(dialog->remember_pass_check);
857 } 877 }
878
879 gaim_signal_connect(gaim_connections_get_handle(), "signing-on", dialog,
880 G_CALLBACK(update_editable), dialog);
881 gaim_signal_connect(gaim_connections_get_handle(), "signed-off", dialog,
882 G_CALLBACK(update_editable), dialog);
858 } 883 }
859 884
860 static void 885 static void
861 add_user_options(AccountPrefsDialog *dialog, GtkWidget *parent) 886 add_user_options(AccountPrefsDialog *dialog, GtkWidget *parent)
862 { 887 {
1395 } 1420 }
1396 1421
1397 if (dialog->icon_filesel) 1422 if (dialog->icon_filesel)
1398 gtk_widget_destroy(dialog->icon_filesel); 1423 gtk_widget_destroy(dialog->icon_filesel);
1399 1424
1425 gaim_signals_disconnect_by_handle(dialog);
1426
1400 g_free(dialog); 1427 g_free(dialog);
1401 } 1428 }
1402 1429
1403 static void 1430 static void
1404 cancel_account_prefs_cb(GtkWidget *w, AccountPrefsDialog *dialog) 1431 cancel_account_prefs_cb(GtkWidget *w, AccountPrefsDialog *dialog)
2392 G_CALLBACK(drag_data_get_cb), dialog); 2419 G_CALLBACK(drag_data_get_cb), dialog);
2393 2420
2394 return sw; 2421 return sw;
2395 } 2422 }
2396 2423
2424 static void
2425 account_modified_cb(GaimAccount *account, AccountsWindow *window)
2426 {
2427 GtkTreeIter iter;
2428
2429 if (!accounts_window_find_account_in_treemodel(&iter, account))
2430 return;
2431
2432 set_account(window->model, &iter, account);
2433 }
2434
2397 void 2435 void
2398 gaim_gtk_accounts_window_show(void) 2436 gaim_gtk_accounts_window_show(void)
2399 { 2437 {
2400 AccountsWindow *dialog; 2438 AccountsWindow *dialog;
2401 GtkWidget *win; 2439 GtkWidget *win;
2477 gtk_widget_show(button); 2515 gtk_widget_show(button);
2478 2516
2479 g_signal_connect(G_OBJECT(button), "clicked", 2517 g_signal_connect(G_OBJECT(button), "clicked",
2480 G_CALLBACK(close_accounts_cb), dialog); 2518 G_CALLBACK(close_accounts_cb), dialog);
2481 2519
2520 gaim_signal_connect(gaim_gtk_account_get_handle(), "account-modified",
2521 accounts_window,
2522 GAIM_CALLBACK(account_modified_cb), accounts_window);
2482 2523
2483 gtk_widget_show(win); 2524 gtk_widget_show(win);
2484 } 2525 }
2485 2526
2486 void 2527 void