comparison src/gtkaccount.c @ 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 2216abc2d421
children bbe66a970662
comparison
equal deleted inserted replaced
5655:8fa4a0d756a0 5656:160dfd3b0679
20 * along with this program; if not, write to the Free Software 20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 */ 22 */
23 #include "gtkaccount.h" 23 #include "gtkaccount.h"
24 #include "account.h" 24 #include "account.h"
25 #include "accountopt.h"
25 #include "event.h" 26 #include "event.h"
26 #include "prefs.h" 27 #include "prefs.h"
27 #include "stock.h" 28 #include "stock.h"
28 #include "gtkblist.h" 29 #include "gtkblist.h"
29 30
135 GaimPlugin *plugin = NULL; 136 GaimPlugin *plugin = NULL;
136 GaimProtocol protocol; 137 GaimProtocol protocol;
137 GList *user_splits; 138 GList *user_splits;
138 GList *split_entries = NULL; 139 GList *split_entries = NULL;
139 GList *l, *l2; 140 GList *l, *l2;
140 char *username; 141 char *username = NULL;
141 142
142 if (dialog->login_frame != NULL) 143 if (dialog->login_frame != NULL)
143 gtk_widget_destroy(dialog->login_frame); 144 gtk_widget_destroy(dialog->login_frame);
144 145
145 if (dialog->account == NULL) 146 if (dialog->account == NULL)
169 170
170 __add_pref_box(dialog, vbox, _("Protocol:"), dialog->protocol_menu); 171 __add_pref_box(dialog, vbox, _("Protocol:"), dialog->protocol_menu);
171 172
172 /* Screen Name */ 173 /* Screen Name */
173 dialog->screenname_entry = gtk_entry_new(); 174 dialog->screenname_entry = gtk_entry_new();
174
175 if (dialog->account != NULL)
176 gtk_entry_set_text(GTK_ENTRY(dialog->screenname_entry),
177 gaim_account_get_username(dialog->account));
178 175
179 __add_pref_box(dialog, vbox, _("Screenname:"), dialog->screenname_entry); 176 __add_pref_box(dialog, vbox, _("Screenname:"), dialog->screenname_entry);
180 177
181 /* Do the user split thang */ 178 /* Do the user split thang */
182 if (plugin == NULL) /* Yeah right. */ 179 if (plugin == NULL) /* Yeah right. */
186 183
187 if (dialog->account != NULL) 184 if (dialog->account != NULL)
188 username = g_strdup(gaim_account_get_username(dialog->account)); 185 username = g_strdup(gaim_account_get_username(dialog->account));
189 186
190 for (l = user_splits; l != NULL; l = l->next) { 187 for (l = user_splits; l != NULL; l = l->next) {
188 GaimAccountUserSplit *split = l->data;
191 char *buf; 189 char *buf;
192 190
193 buf = g_strdup_printf("%s:", gaim_account_user_split_get_text(buf)); 191 buf = g_strdup_printf("%s:", gaim_account_user_split_get_text(split));
194 192
195 entry = gtk_entry_new(); 193 entry = gtk_entry_new();
196 194
197 __add_pref_box(dialog, vbox, buf, entry); 195 __add_pref_box(dialog, vbox, buf, entry);
198 196
205 l != NULL && l2 != NULL; 203 l != NULL && l2 != NULL;
206 l = l->prev, l2 = l2->prev) { 204 l = l->prev, l2 = l2->prev) {
207 205
208 GaimAccountUserSplit *split = l2->data; 206 GaimAccountUserSplit *split = l2->data;
209 GtkWidget *entry = l->data; 207 GtkWidget *entry = l->data;
210 char *value; 208 const char *value = NULL;
211 char *c; 209 char *c;
212 210
213 if (dialog->account == NULL) 211 if (dialog->account != NULL) {
214 value = gaim_account_user_split_get_default_value(split); 212 c = strrchr(username,
215 else { 213 gaim_account_user_split_get_separator(split));
216 c = strrchr(username, gaim_account_user_split_get_sep(split));
217 214
218 if (c != NULL) { 215 if (c != NULL) {
219 *c = '\0'; 216 *c = '\0';
220 c++; 217 c++;
221 218
222 value = c; 219 value = c;
223 } 220 }
224 } 221 }
225 222
223 if (value == NULL)
224 value = gaim_account_user_split_get_default_value(split);
225
226 gtk_entry_set_text(GTK_ENTRY(entry), value); 226 gtk_entry_set_text(GTK_ENTRY(entry), value);
227 } 227 }
228
229 if (username != NULL)
230 gtk_entry_set_text(GTK_ENTRY(dialog->screenname_entry), username);
231
232 g_free(username);
228 233
229 g_list_free(split_entries); 234 g_list_free(split_entries);
230 } 235 }
231 236
232 static void 237 static void