Mercurial > pidgin.yaz
comparison src/gtkaccount.c @ 5657:bbe66a970662
[gaim-migrate @ 6071]
The modify account dialog is starting to look closer to how it used to.
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Mon, 02 Jun 2003 07:56:56 +0000 |
parents | 160dfd3b0679 |
children | 060fb5fd081d |
comparison
equal
deleted
inserted
replaced
5656:160dfd3b0679 | 5657:bbe66a970662 |
---|---|
75 GaimAccount *account; | 75 GaimAccount *account; |
76 | 76 |
77 GtkWidget *window; | 77 GtkWidget *window; |
78 GtkWidget *login_frame; | 78 GtkWidget *login_frame; |
79 GtkWidget *protocol_menu; | 79 GtkWidget *protocol_menu; |
80 | |
80 GtkWidget *screenname_entry; | 81 GtkWidget *screenname_entry; |
82 GtkWidget *password_entry; | |
83 GtkWidget *alias_entry; | |
84 | |
85 GtkWidget *remember_pass_check; | |
86 GtkWidget *auto_login_check; | |
81 | 87 |
82 GtkSizeGroup *sg; | 88 GtkSizeGroup *sg; |
83 | 89 |
84 } AccountPrefsDialog; | 90 } AccountPrefsDialog; |
85 | 91 |
132 { | 138 { |
133 GtkWidget *frame; | 139 GtkWidget *frame; |
134 GtkWidget *vbox; | 140 GtkWidget *vbox; |
135 GtkWidget *entry; | 141 GtkWidget *entry; |
136 GaimPlugin *plugin = NULL; | 142 GaimPlugin *plugin = NULL; |
143 GaimPluginProtocolInfo *prpl_info = NULL; | |
137 GaimProtocol protocol; | 144 GaimProtocol protocol; |
138 GList *user_splits; | 145 GList *user_splits; |
139 GList *split_entries = NULL; | 146 GList *split_entries = NULL; |
140 GList *l, *l2; | 147 GList *l, *l2; |
141 char *username = NULL; | 148 char *username = NULL; |
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 |