Mercurial > pidgin
comparison src/gtkaccount.c @ 5658:060fb5fd081d
[gaim-migrate @ 6072]
The User Options part of the Modify Account dialog is back, but it doesn't
do anything yet.
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Mon, 02 Jun 2003 08:24:04 +0000 |
parents | bbe66a970662 |
children | 1709a545a7bd |
comparison
equal
deleted
inserted
replaced
5657:bbe66a970662 | 5658:060fb5fd081d |
---|---|
25 #include "accountopt.h" | 25 #include "accountopt.h" |
26 #include "event.h" | 26 #include "event.h" |
27 #include "prefs.h" | 27 #include "prefs.h" |
28 #include "stock.h" | 28 #include "stock.h" |
29 #include "gtkblist.h" | 29 #include "gtkblist.h" |
30 #include "gaim-disclosure.h" | |
30 | 31 |
31 #ifdef _WIN32 | 32 #ifdef _WIN32 |
32 # include <gdk/gdkwin32.h> | 33 # include <gdk/gdkwin32.h> |
33 #else | 34 #else |
34 # include <unistd.h> | 35 # include <unistd.h> |
71 typedef struct | 72 typedef struct |
72 { | 73 { |
73 AccountPrefsDialogType type; | 74 AccountPrefsDialogType type; |
74 | 75 |
75 GaimAccount *account; | 76 GaimAccount *account; |
77 GaimProtocol protocol; | |
78 GaimPlugin *plugin; | |
79 GaimPluginProtocolInfo *prpl_info; | |
76 | 80 |
77 GtkWidget *window; | 81 GtkWidget *window; |
82 | |
83 /* Login Options */ | |
78 GtkWidget *login_frame; | 84 GtkWidget *login_frame; |
79 GtkWidget *protocol_menu; | 85 GtkWidget *protocol_menu; |
80 | |
81 GtkWidget *screenname_entry; | 86 GtkWidget *screenname_entry; |
82 GtkWidget *password_entry; | 87 GtkWidget *password_entry; |
83 GtkWidget *alias_entry; | 88 GtkWidget *alias_entry; |
84 | |
85 GtkWidget *remember_pass_check; | 89 GtkWidget *remember_pass_check; |
86 GtkWidget *auto_login_check; | 90 GtkWidget *auto_login_check; |
91 | |
92 /* User Options */ | |
93 GtkWidget *user_frame; | |
94 GtkWidget *new_mail_check; | |
95 GtkWidget *buddy_icon_hbox; | |
96 GtkWidget *buddy_icon_entry; | |
87 | 97 |
88 GtkSizeGroup *sg; | 98 GtkSizeGroup *sg; |
89 | 99 |
90 } AccountPrefsDialog; | 100 } AccountPrefsDialog; |
91 | 101 |
139 GtkWidget *frame; | 149 GtkWidget *frame; |
140 GtkWidget *vbox; | 150 GtkWidget *vbox; |
141 GtkWidget *entry; | 151 GtkWidget *entry; |
142 GaimPlugin *plugin = NULL; | 152 GaimPlugin *plugin = NULL; |
143 GaimPluginProtocolInfo *prpl_info = NULL; | 153 GaimPluginProtocolInfo *prpl_info = NULL; |
144 GaimProtocol protocol; | |
145 GList *user_splits; | 154 GList *user_splits; |
146 GList *split_entries = NULL; | 155 GList *split_entries = NULL; |
147 GList *l, *l2; | 156 GList *l, *l2; |
148 char *username = NULL; | 157 char *username = NULL; |
149 | 158 |
150 if (dialog->login_frame != NULL) | 159 if (dialog->login_frame != NULL) |
151 gtk_widget_destroy(dialog->login_frame); | 160 gtk_widget_destroy(dialog->login_frame); |
152 | 161 |
153 if (dialog->account == NULL) | |
154 protocol = GAIM_PROTO_OSCAR; | |
155 else | |
156 protocol = gaim_account_get_protocol(dialog->account); | |
157 | |
158 if ((plugin = gaim_find_prpl(protocol)) != NULL) | |
159 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(plugin); | |
160 | |
161 | |
162 /* Build the login options frame. */ | 162 /* Build the login options frame. */ |
163 frame = gaim_gtk_make_frame(parent, _("Login Options")); | 163 frame = gaim_gtk_make_frame(parent, _("Login Options")); |
164 | 164 |
165 /* cringe */ | 165 /* cringe */ |
166 dialog->login_frame = gtk_widget_get_parent(gtk_widget_get_parent(frame)); | 166 dialog->login_frame = gtk_widget_get_parent(gtk_widget_get_parent(frame)); |
167 | 167 |
168 gtk_box_reorder_child(GTK_BOX(parent), dialog->login_frame, 0); | 168 gtk_box_reorder_child(GTK_BOX(parent), dialog->login_frame, 0); |
169 gtk_widget_show(dialog->login_frame); | 169 gtk_widget_show(dialog->login_frame); |
170 | 170 |
171 /* Main vbox */ | |
171 vbox = gtk_vbox_new(FALSE, 6); | 172 vbox = gtk_vbox_new(FALSE, 6); |
172 gtk_container_add(GTK_CONTAINER(frame), vbox); | 173 gtk_container_add(GTK_CONTAINER(frame), vbox); |
173 gtk_widget_show(vbox); | 174 gtk_widget_show(vbox); |
174 | 175 |
175 /* Protocol */ | 176 /* Protocol */ |
176 dialog->protocol_menu = gaim_gtk_protocol_option_menu_new( | 177 dialog->protocol_menu = gaim_gtk_protocol_option_menu_new( |
177 protocol, G_CALLBACK(__set_account_protocol), dialog); | 178 dialog->protocol, G_CALLBACK(__set_account_protocol), dialog); |
178 | 179 |
179 __add_pref_box(dialog, vbox, _("Protocol:"), dialog->protocol_menu); | 180 __add_pref_box(dialog, vbox, _("Protocol:"), dialog->protocol_menu); |
180 | 181 |
181 /* Screen Name */ | 182 /* Screen Name */ |
182 dialog->screenname_entry = gtk_entry_new(); | 183 dialog->screenname_entry = gtk_entry_new(); |
284 } | 285 } |
285 | 286 |
286 if (prpl_info != NULL && (prpl_info->options & OPT_PROTO_NO_PASSWORD)) { | 287 if (prpl_info != NULL && (prpl_info->options & OPT_PROTO_NO_PASSWORD)) { |
287 gtk_widget_hide(dialog->password_entry); | 288 gtk_widget_hide(dialog->password_entry); |
288 gtk_widget_hide(dialog->remember_pass_check); | 289 gtk_widget_hide(dialog->remember_pass_check); |
290 } | |
291 } | |
292 | |
293 static void | |
294 __add_user_options(AccountPrefsDialog *dialog, GtkWidget *parent) | |
295 { | |
296 GtkWidget *frame; | |
297 GtkWidget *vbox; | |
298 GtkWidget *hbox; | |
299 GtkWidget *button; | |
300 GtkWidget *label; | |
301 | |
302 if (dialog->user_frame != NULL) | |
303 gtk_widget_destroy(dialog->user_frame); | |
304 | |
305 /* Build the user options frame. */ | |
306 frame = gaim_gtk_make_frame(parent, _("User Options")); | |
307 dialog->user_frame = gtk_widget_get_parent(gtk_widget_get_parent(frame)); | |
308 | |
309 gtk_box_reorder_child(GTK_BOX(parent), dialog->user_frame, 1); | |
310 gtk_widget_show(dialog->user_frame); | |
311 | |
312 /* Main vbox */ | |
313 vbox = gtk_vbox_new(FALSE, 6); | |
314 gtk_container_add(GTK_CONTAINER(frame), vbox); | |
315 gtk_widget_show(vbox); | |
316 | |
317 /* New mail notifications */ | |
318 dialog->new_mail_check = | |
319 gtk_check_button_new_with_label(_("New mail notifications")); | |
320 gtk_box_pack_start(GTK_BOX(vbox), dialog->new_mail_check, FALSE, FALSE, 0); | |
321 gtk_widget_show(dialog->new_mail_check); | |
322 | |
323 /* Buddy icon */ | |
324 dialog->buddy_icon_hbox = hbox = gtk_hbox_new(FALSE, 6); | |
325 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
326 gtk_widget_show(hbox); | |
327 | |
328 label = gtk_label_new(_("Buddy icon file:")); | |
329 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
330 gtk_widget_show(label); | |
331 | |
332 dialog->buddy_icon_entry = gtk_entry_new(); | |
333 gtk_box_pack_start(GTK_BOX(hbox), dialog->buddy_icon_entry, TRUE, TRUE, 0); | |
334 gtk_widget_show(dialog->buddy_icon_entry); | |
335 | |
336 button = gtk_button_new_with_label(_("Browse")); | |
337 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
338 gtk_widget_show(button); | |
339 | |
340 button = gtk_button_new_with_label(_("Reset")); | |
341 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
342 gtk_widget_show(button); | |
343 | |
344 if (dialog->prpl_info != NULL) { | |
345 if (!(dialog->prpl_info->options & OPT_PROTO_MAIL_CHECK)) | |
346 gtk_widget_hide(dialog->new_mail_check); | |
347 | |
348 if (!(dialog->prpl_info->options & OPT_PROTO_BUDDY_ICON)) | |
349 gtk_widget_hide(dialog->buddy_icon_hbox); | |
350 } | |
351 | |
352 if (dialog->account != NULL) { | |
353 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->new_mail_check), | |
354 gaim_account_get_check_mail(dialog->account)); | |
355 | |
356 if (gaim_account_get_buddy_icon(dialog->account) != NULL) | |
357 gtk_entry_set_text(GTK_ENTRY(dialog->buddy_icon_entry), | |
358 gaim_account_get_buddy_icon(dialog->account)); | |
359 } | |
360 | |
361 if (!(dialog->prpl_info->options & OPT_PROTO_MAIL_CHECK) && | |
362 !(dialog->prpl_info->options & OPT_PROTO_BUDDY_ICON)) { | |
363 | |
364 /* Nothing to see :( aww. */ | |
365 gtk_widget_hide(dialog->user_frame); | |
289 } | 366 } |
290 } | 367 } |
291 | 368 |
292 static void | 369 static void |
293 __show_account_prefs(AccountPrefsDialogType type, GaimAccount *account) | 370 __show_account_prefs(AccountPrefsDialogType type, GaimAccount *account) |
304 | 381 |
305 dialog->account = account; | 382 dialog->account = account; |
306 dialog->type = type; | 383 dialog->type = type; |
307 dialog->sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); | 384 dialog->sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); |
308 | 385 |
386 if (dialog->account == NULL) | |
387 dialog->protocol = GAIM_PROTO_OSCAR; | |
388 else | |
389 dialog->protocol = gaim_account_get_protocol(dialog->account); | |
390 | |
391 if ((dialog->plugin = gaim_find_prpl(dialog->protocol)) != NULL) | |
392 dialog->prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(dialog->plugin); | |
393 | |
394 | |
309 GAIM_DIALOG(win); | 395 GAIM_DIALOG(win); |
310 dialog->window = win; | 396 dialog->window = win; |
311 | 397 |
312 gtk_window_set_role(GTK_WINDOW(win), "account"); | 398 gtk_window_set_role(GTK_WINDOW(win), "account"); |
313 | 399 |
328 gtk_container_add(GTK_CONTAINER(win), vbox); | 414 gtk_container_add(GTK_CONTAINER(win), vbox); |
329 gtk_widget_show(vbox); | 415 gtk_widget_show(vbox); |
330 | 416 |
331 /* Setup the top frames. */ | 417 /* Setup the top frames. */ |
332 __add_login_options(dialog, vbox); | 418 __add_login_options(dialog, vbox); |
333 #if 0 | |
334 __add_user_options(dialog, vbox); | 419 __add_user_options(dialog, vbox); |
335 #endif | 420 |
421 /* Add the disclosure */ | |
422 disclosure = gaim_disclosure_new(_("Show more options"), | |
423 _("Show fewer options")); | |
424 gtk_box_pack_start(GTK_BOX(vbox), disclosure, FALSE, FALSE, 0); | |
425 gtk_widget_show(disclosure); | |
336 | 426 |
337 /* Separator... */ | 427 /* Separator... */ |
338 sep = gtk_hseparator_new(); | 428 sep = gtk_hseparator_new(); |
339 gtk_box_pack_start(GTK_BOX(vbox), sep, FALSE, FALSE, 0); | 429 gtk_box_pack_start(GTK_BOX(vbox), sep, FALSE, FALSE, 0); |
340 gtk_widget_show(sep); | 430 gtk_widget_show(sep); |