| 146 if (dialog->account == NULL) |
153 if (dialog->account == NULL) |
| 147 protocol = GAIM_PROTO_OSCAR; |
154 protocol = GAIM_PROTO_OSCAR; |
| 148 else |
155 else |
| 149 protocol = gaim_account_get_protocol(dialog->account); |
156 protocol = gaim_account_get_protocol(dialog->account); |
| 150 |
157 |
| 151 plugin = gaim_find_prpl(protocol); |
158 if ((plugin = gaim_find_prpl(protocol)) != NULL) |
| |
159 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(plugin); |
| 152 |
160 |
| 153 |
161 |
| 154 /* Build the login options frame. */ |
162 /* Build the login options frame. */ |
| 155 frame = gaim_gtk_make_frame(parent, _("Login Options")); |
163 frame = gaim_gtk_make_frame(parent, _("Login Options")); |
| 156 |
164 |
| 177 |
185 |
| 178 /* Do the user split thang */ |
186 /* Do the user split thang */ |
| 179 if (plugin == NULL) /* Yeah right. */ |
187 if (plugin == NULL) /* Yeah right. */ |
| 180 user_splits = NULL; |
188 user_splits = NULL; |
| 181 else |
189 else |
| 182 user_splits = GAIM_PLUGIN_PROTOCOL_INFO(plugin)->user_splits; |
190 user_splits = prpl_info->user_splits; |
| 183 |
191 |
| 184 if (dialog->account != NULL) |
192 if (dialog->account != NULL) |
| 185 username = g_strdup(gaim_account_get_username(dialog->account)); |
193 username = g_strdup(gaim_account_get_username(dialog->account)); |
| 186 |
194 |
| 187 for (l = user_splits; l != NULL; l = l->next) { |
195 for (l = user_splits; l != NULL; l = l->next) { |
| 221 } |
229 } |
| 222 |
230 |
| 223 if (value == NULL) |
231 if (value == NULL) |
| 224 value = gaim_account_user_split_get_default_value(split); |
232 value = gaim_account_user_split_get_default_value(split); |
| 225 |
233 |
| 226 gtk_entry_set_text(GTK_ENTRY(entry), value); |
234 if (value != NULL) |
| |
235 gtk_entry_set_text(GTK_ENTRY(entry), value); |
| 227 } |
236 } |
| 228 |
237 |
| 229 if (username != NULL) |
238 if (username != NULL) |
| 230 gtk_entry_set_text(GTK_ENTRY(dialog->screenname_entry), username); |
239 gtk_entry_set_text(GTK_ENTRY(dialog->screenname_entry), username); |
| 231 |
240 |
| 232 g_free(username); |
241 g_free(username); |
| 233 |
242 |
| 234 g_list_free(split_entries); |
243 g_list_free(split_entries); |
| |
244 |
| |
245 /* Password */ |
| |
246 dialog->password_entry = gtk_entry_new(); |
| |
247 gtk_entry_set_visibility(GTK_ENTRY(dialog->password_entry), FALSE); |
| |
248 __add_pref_box(dialog, vbox, _("Password:"), dialog->password_entry); |
| |
249 |
| |
250 /* Alias */ |
| |
251 dialog->alias_entry = gtk_entry_new(); |
| |
252 __add_pref_box(dialog, vbox, _("Alias:"), dialog->alias_entry); |
| |
253 |
| |
254 /* Remember Password */ |
| |
255 dialog->remember_pass_check = |
| |
256 gtk_check_button_new_with_label(_("Remember password")); |
| |
257 gtk_box_pack_start(GTK_BOX(vbox), dialog->remember_pass_check, |
| |
258 FALSE, FALSE, 0); |
| |
259 gtk_widget_show(dialog->remember_pass_check); |
| |
260 |
| |
261 /* Auto-Login */ |
| |
262 dialog->auto_login_check = |
| |
263 gtk_check_button_new_with_label(_("Auto-login")); |
| |
264 gtk_box_pack_start(GTK_BOX(vbox), dialog->auto_login_check, |
| |
265 FALSE, FALSE, 0); |
| |
266 gtk_widget_show(dialog->auto_login_check); |
| |
267 |
| |
268 /* Set the fields. */ |
| |
269 if (dialog->account != NULL) { |
| |
270 if (gaim_account_get_password(dialog->account)) |
| |
271 gtk_entry_set_text(GTK_ENTRY(dialog->password_entry), |
| |
272 gaim_account_get_password(dialog->account)); |
| |
273 |
| |
274 if (gaim_account_get_alias(dialog->account)) |
| |
275 gtk_entry_set_text(GTK_ENTRY(dialog->alias_entry), |
| |
276 gaim_account_get_alias(dialog->account)); |
| |
277 |
| |
278 gtk_toggle_button_set_active( |
| |
279 GTK_TOGGLE_BUTTON(dialog->remember_pass_check), |
| |
280 gaim_account_get_remember_password(dialog->account)); |
| |
281 |
| |
282 gtk_toggle_button_set_active( |
| |
283 GTK_TOGGLE_BUTTON(dialog->auto_login_check), FALSE); |
| |
284 } |
| |
285 |
| |
286 if (prpl_info != NULL && (prpl_info->options & OPT_PROTO_NO_PASSWORD)) { |
| |
287 gtk_widget_hide(dialog->password_entry); |
| |
288 gtk_widget_hide(dialog->remember_pass_check); |
| |
289 } |
| 235 } |
290 } |
| 236 |
291 |
| 237 static void |
292 static void |
| 238 __show_account_prefs(AccountPrefsDialogType type, GaimAccount *account) |
293 __show_account_prefs(AccountPrefsDialogType type, GaimAccount *account) |
| 239 { |
294 { |
| 240 AccountPrefsDialog *dialog; |
295 AccountPrefsDialog *dialog; |
| 241 GtkWidget *win; |
296 GtkWidget *win; |
| 242 GtkWidget *vbox; |
297 GtkWidget *vbox; |
| 243 GtkWidget *bbox; |
298 GtkWidget *bbox; |
| |
299 GtkWidget *disclosure; |
| 244 GtkWidget *sep; |
300 GtkWidget *sep; |
| 245 GtkWidget *disclosure; |
301 GtkWidget *button; |
| 246 |
302 |
| 247 dialog = g_new0(AccountPrefsDialog, 1); |
303 dialog = g_new0(AccountPrefsDialog, 1); |
| 248 |
304 |
| 249 dialog->account = account; |
305 dialog->account = account; |
| 250 dialog->type = type; |
306 dialog->type = type; |
| 276 __add_login_options(dialog, vbox); |
332 __add_login_options(dialog, vbox); |
| 277 #if 0 |
333 #if 0 |
| 278 __add_user_options(dialog, vbox); |
334 __add_user_options(dialog, vbox); |
| 279 #endif |
335 #endif |
| 280 |
336 |
| |
337 /* Separator... */ |
| |
338 sep = gtk_hseparator_new(); |
| |
339 gtk_box_pack_start(GTK_BOX(vbox), sep, FALSE, FALSE, 0); |
| |
340 gtk_widget_show(sep); |
| |
341 |
| |
342 /* Setup the button box */ |
| |
343 bbox = gtk_hbutton_box_new(); |
| |
344 gtk_box_set_spacing(GTK_BOX(bbox), 6); |
| |
345 gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END); |
| |
346 gtk_box_pack_end(GTK_BOX(vbox), bbox, FALSE, TRUE, 0); |
| |
347 gtk_widget_show(bbox); |
| |
348 |
| |
349 /* Cancel button */ |
| |
350 button = gtk_button_new_from_stock(GTK_STOCK_CANCEL); |
| |
351 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); |
| |
352 gtk_widget_show(button); |
| |
353 |
| |
354 /* OK button */ |
| |
355 button = gtk_button_new_from_stock(GTK_STOCK_OK); |
| |
356 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); |
| |
357 gtk_widget_show(button); |
| |
358 |
| |
359 /* Show the window. */ |
| 281 gtk_widget_show(win); |
360 gtk_widget_show(win); |
| 282 } |
361 } |
| 283 |
362 |
| 284 /************************************************************************** |
363 /************************************************************************** |
| 285 * Accounts Dialog |
364 * Accounts Dialog |