changeset 5710:dbac958d8937

[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 <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Tue, 03 Jun 2003 11:42:13 +0000
parents 2c4e7df0a688
children e33778b9d395
files src/account.c src/account.h src/gaimrc.c src/gtkaccount.c
diffstat 4 files changed, 44 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- 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;
--- 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.
--- 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;
 
--- 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);
 }