# HG changeset patch # User Christian Hammond # Date 1054640533 0 # Node ID dbac958d89371821f8a380cf1aca642dd876ed01 # Parent 2c4e7df0a68881077c368b66166e7b508f96a873 [gaim-migrate @ 6131] Accounts are no longer automatically added or removed from the list when creating or destroying them. They must now be added/removed with gaim_accounts_add() and gaim_accounts_removed(). Also fixed a bug where garbage would appear on the screenname. committer: Tailor Script diff -r 2c4e7df0a688 -r dbac958d8937 src/account.c --- a/src/account.c Tue Jun 03 11:24:34 2003 +0000 +++ b/src/account.c Tue Jun 03 11:42:13 2003 +0000 @@ -129,8 +129,6 @@ account->settings = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, __delete_setting); - accounts = g_list_append(accounts, account); - return account; } @@ -150,8 +148,6 @@ g_hash_table_destroy(account->settings); - accounts = g_list_remove(accounts, account); - g_free(account); } @@ -637,6 +633,8 @@ data->account = gaim_account_new(buffer, data->protocol); data->account->protocol_id = data->protocol_id; + gaim_accounts_add(data->account); + data->protocol_id = NULL; } } @@ -960,6 +958,26 @@ } void +gaim_accounts_add(GaimAccount *account) +{ + g_return_if_fail(account != NULL); + + accounts = g_list_append(accounts, account); + + schedule_accounts_save(); +} + +void +gaim_accounts_remove(GaimAccount *account) +{ + g_return_if_fail(account != NULL); + + accounts = g_list_remove(accounts, account); + + schedule_accounts_save(); +} + +void gaim_accounts_reorder(GaimAccount *account, size_t new_index) { size_t index; diff -r 2c4e7df0a688 -r dbac958d8937 src/account.h --- a/src/account.h Tue Jun 03 11:24:34 2003 +0000 +++ b/src/account.h Tue Jun 03 11:42:13 2003 +0000 @@ -352,6 +352,20 @@ void gaim_accounts_sync(); /** + * Adds an account to the list of accounts. + * + * @param account The account. + */ +void gaim_accounts_add(GaimAccount *account); + +/** + * Removes an account from the list of accounts. + * + * @param account The account. + */ +void gaim_accounts_remove(GaimAccount *account); + +/** * Reorders an account. * * @param account The account to reorder. diff -r 2c4e7df0a688 -r dbac958d8937 src/gaimrc.c --- a/src/gaimrc.c Tue Jun 03 11:24:34 2003 +0000 +++ b/src/gaimrc.c Tue Jun 03 11:42:13 2003 +0000 @@ -523,6 +523,8 @@ gaim_account_set_password(account, p->value[1]); gaim_account_set_remember_password(account, TRUE); + gaim_accounts_add(account); + if (!fgets(buf, sizeof(buf), f)) return account; diff -r 2c4e7df0a688 -r dbac958d8937 src/gtkaccount.c --- a/src/gtkaccount.c Tue Jun 03 11:24:34 2003 +0000 +++ b/src/gtkaccount.c Tue Jun 03 11:42:13 2003 +0000 @@ -855,7 +855,8 @@ tmp = g_strconcat(username, sep, (*value ? value : - gaim_account_user_split_get_default_value(split))); + gaim_account_user_split_get_default_value(split)), + NULL); g_free(username); username = tmp; @@ -948,8 +949,10 @@ __set_account(dialog->accounts_dialog->model, &iter, dialog->account); } - else + else { __add_account(dialog->accounts_dialog, dialog->account); + gaim_accounts_add(dialog->account); + } /* See if we want to register with a server now. */ if (dialog->prpl_info->register_user != NULL && @@ -1304,6 +1307,7 @@ gtk_list_store_remove(accounts_dialog->model, &iter); } + gaim_accounts_remove(account); gaim_account_destroy(account); }