changeset 5656:160dfd3b0679

[gaim-migrate @ 6070] The user split fields in the account editor now work again. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Mon, 02 Jun 2003 06:44:47 +0000
parents 8fa4a0d756a0
children bbe66a970662
files src/gtkaccount.c
diffstat 1 files changed, 16 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/src/gtkaccount.c	Mon Jun 02 06:42:56 2003 +0000
+++ b/src/gtkaccount.c	Mon Jun 02 06:44:47 2003 +0000
@@ -22,6 +22,7 @@
  */
 #include "gtkaccount.h"
 #include "account.h"
+#include "accountopt.h"
 #include "event.h"
 #include "prefs.h"
 #include "stock.h"
@@ -137,7 +138,7 @@
 	GList *user_splits;
 	GList *split_entries = NULL;
 	GList *l, *l2;
-	char *username;
+	char *username = NULL;
 
 	if (dialog->login_frame != NULL)
 		gtk_widget_destroy(dialog->login_frame);
@@ -172,10 +173,6 @@
 	/* Screen Name */
 	dialog->screenname_entry = gtk_entry_new();
 
-	if (dialog->account != NULL)
-		gtk_entry_set_text(GTK_ENTRY(dialog->screenname_entry),
-						   gaim_account_get_username(dialog->account));
-
 	__add_pref_box(dialog, vbox, _("Screenname:"), dialog->screenname_entry);
 
 	/* Do the user split thang */
@@ -188,9 +185,10 @@
 		username = g_strdup(gaim_account_get_username(dialog->account));
 
 	for (l = user_splits; l != NULL; l = l->next) {
+		GaimAccountUserSplit *split = l->data;
 		char *buf;
 
-		buf = g_strdup_printf("%s:", gaim_account_user_split_get_text(buf));
+		buf = g_strdup_printf("%s:", gaim_account_user_split_get_text(split));
 
 		entry = gtk_entry_new();
 
@@ -207,13 +205,12 @@
 
 		GaimAccountUserSplit *split = l2->data;
 		GtkWidget *entry = l->data;
-		char *value;
+		const char *value = NULL;
 		char *c;
 
-		if (dialog->account == NULL)
-			value = gaim_account_user_split_get_default_value(split);
-		else {
-			c = strrchr(username, gaim_account_user_split_get_sep(split));
+		if (dialog->account != NULL) {
+			c = strrchr(username,
+						gaim_account_user_split_get_separator(split));
 
 			if (c != NULL) {
 				*c = '\0';
@@ -223,9 +220,17 @@
 			}
 		}
 
+		if (value == NULL)
+			value = gaim_account_user_split_get_default_value(split);
+
 		gtk_entry_set_text(GTK_ENTRY(entry), value);
 	}
 
+	if (username != NULL)
+		gtk_entry_set_text(GTK_ENTRY(dialog->screenname_entry), username);
+
+	g_free(username);
+
 	g_list_free(split_entries);
 }