Mercurial > pidgin
comparison finch/gntaccount.c @ 23392:eac0561dfd55
propagate from branch 'im.pidgin.pidgin.2.4.3' (head 260d5ee6ca276e761c5b0bd1b612edc5743eaf67)
to branch 'im.pidgin.pidgin' (head dba36543cdde6db127857b0edfdc3ad1969bbd39)
author | Stu Tomlinson <stu@nosnilmot.com> |
---|---|
date | Thu, 26 Jun 2008 19:08:55 +0000 |
parents | 02ef6c5c6650 |
children | ff29208e03ef 84deb53a0a06 |
comparison
equal
deleted
inserted
replaced
23058:00b442421563 | 23392:eac0561dfd55 |
---|---|
41 #include <accountopt.h> | 41 #include <accountopt.h> |
42 #include <connection.h> | 42 #include <connection.h> |
43 #include <notify.h> | 43 #include <notify.h> |
44 #include <plugin.h> | 44 #include <plugin.h> |
45 #include <request.h> | 45 #include <request.h> |
46 #include <savedstatuses.h> | |
46 | 47 |
47 #include "gntaccount.h" | 48 #include "gntaccount.h" |
48 #include "gntblist.h" | 49 #include "gntblist.h" |
49 | 50 |
50 #include <string.h> | 51 #include <string.h> |
65 | 66 |
66 GntWidget *protocol; | 67 GntWidget *protocol; |
67 GntWidget *screenname; | 68 GntWidget *screenname; |
68 GntWidget *password; | 69 GntWidget *password; |
69 GntWidget *alias; | 70 GntWidget *alias; |
70 | 71 |
71 GntWidget *splits; | 72 GntWidget *splits; |
72 GList *split_entries; | 73 GList *split_entries; |
73 | 74 |
74 GList *prpl_entries; | 75 GList *prpl_entries; |
75 GntWidget *prpls; | 76 GntWidget *prpls; |
76 | 77 |
77 GntWidget *newmail; | 78 GntWidget *newmail; |
78 GntWidget *remember; | 79 GntWidget *remember; |
80 GntWidget *regserver; | |
79 } AccountEditDialog; | 81 } AccountEditDialog; |
80 | 82 |
81 /* This is necessary to close an edit-dialog when an account is deleted */ | 83 /* This is necessary to close an edit-dialog when an account is deleted */ |
82 static GList *accountdialogs; | 84 static GList *accountdialogs; |
83 | 85 |
123 { | 125 { |
124 purple_notify_error(NULL, _("Error"), _("Account was not added"), | 126 purple_notify_error(NULL, _("Error"), _("Account was not added"), |
125 _("Username of an account must be non-empty.")); | 127 _("Username of an account must be non-empty.")); |
126 return; | 128 return; |
127 } | 129 } |
128 | 130 |
129 username = g_string_new(value); | 131 username = g_string_new(value); |
130 | 132 |
131 if (prplinfo != NULL) | 133 if (prplinfo != NULL) |
132 { | 134 { |
133 GList *iter, *entries; | 135 GList *iter, *entries; |
181 | 183 |
182 /* Protocol options */ | 184 /* Protocol options */ |
183 if (prplinfo) | 185 if (prplinfo) |
184 { | 186 { |
185 GList *iter, *entries; | 187 GList *iter, *entries; |
186 | 188 |
187 for (iter = prplinfo->protocol_options, entries = dialog->prpl_entries; | 189 for (iter = prplinfo->protocol_options, entries = dialog->prpl_entries; |
188 iter && entries; iter = iter->next, entries = entries->next) | 190 iter && entries; iter = iter->next, entries = entries->next) |
189 { | 191 { |
190 PurpleAccountOption *option = iter->data; | 192 PurpleAccountOption *option = iter->data; |
191 GntWidget *entry = entries->data; | 193 GntWidget *entry = entries->data; |
226 if (accounts.window && accounts.tree) { | 228 if (accounts.window && accounts.tree) { |
227 gnt_tree_set_selected(GNT_TREE(accounts.tree), account); | 229 gnt_tree_set_selected(GNT_TREE(accounts.tree), account); |
228 gnt_box_give_focus_to_child(GNT_BOX(accounts.window), accounts.tree); | 230 gnt_box_give_focus_to_child(GNT_BOX(accounts.window), accounts.tree); |
229 } | 231 } |
230 | 232 |
233 if (prplinfo && prplinfo->register_user && | |
234 gnt_check_box_get_checked(GNT_CHECK_BOX(dialog->regserver))) { | |
235 purple_account_register(account); | |
236 } else if (dialog->account == NULL) { | |
237 /* This is a new account. Set it to the current status. */ | |
238 /* Xerox from gtkaccount.c :D */ | |
239 const PurpleSavedStatus *saved_status; | |
240 saved_status = purple_savedstatus_get_current(); | |
241 if (saved_status != NULL) { | |
242 purple_savedstatus_activate_for_account(saved_status, account); | |
243 purple_account_set_enabled(account, FINCH_UI, TRUE); | |
244 } | |
245 } | |
246 | |
231 gnt_widget_destroy(dialog->window); | 247 gnt_widget_destroy(dialog->window); |
232 } | 248 } |
233 | 249 |
234 static void | 250 static void |
235 update_user_splits(AccountEditDialog *dialog) | 251 update_user_splits(AccountEditDialog *dialog) |
417 g_assert_not_reached(); | 433 g_assert_not_reached(); |
418 } | 434 } |
419 } | 435 } |
420 } | 436 } |
421 } | 437 } |
438 | |
439 /* Show the registration checkbox only in a new account dialog, | |
440 * and when the selected prpl has the support for it. */ | |
441 gnt_widget_set_visible(dialog->regserver, account == NULL && | |
442 prplinfo->register_user != NULL); | |
422 } | 443 } |
423 | 444 |
424 static void | 445 static void |
425 update_user_options(AccountEditDialog *dialog) | 446 update_user_options(AccountEditDialog *dialog) |
426 { | 447 { |
556 | 577 |
557 /* User options */ | 578 /* User options */ |
558 update_user_options(dialog); | 579 update_user_options(dialog); |
559 gnt_box_add_widget(GNT_BOX(window), dialog->remember); | 580 gnt_box_add_widget(GNT_BOX(window), dialog->remember); |
560 gnt_box_add_widget(GNT_BOX(window), dialog->newmail); | 581 gnt_box_add_widget(GNT_BOX(window), dialog->newmail); |
582 | |
583 /* Register checkbox */ | |
584 dialog->regserver = gnt_check_box_new(_("Create this account on the server")); | |
585 gnt_box_add_widget(GNT_BOX(window), dialog->regserver); | |
561 | 586 |
562 gnt_box_add_widget(GNT_BOX(window), gnt_line_new(FALSE)); | 587 gnt_box_add_widget(GNT_BOX(window), gnt_line_new(FALSE)); |
563 | 588 |
564 /* The advanced box */ | 589 /* The advanced box */ |
565 add_protocol_options(dialog); | 590 add_protocol_options(dialog); |