Mon, 11 Jan 2021 00:06:00 -0600
Remove the account check email option.
It was only used by google talk and that's supposed to be fully shutdown in june
Testing Done:
Compiled and ran locally.
Reviewed at https://reviews.imfreedom.org/r/412/
|
39887
9c8f874c74a0
Clean up all of the license headers
Gary Kramlich <grim@reaperworld.com>
parents:
39759
diff
changeset
|
1 | /* |
|
9c8f874c74a0
Clean up all of the license headers
Gary Kramlich <grim@reaperworld.com>
parents:
39759
diff
changeset
|
2 | * finch |
|
14620
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14484
diff
changeset
|
3 | * |
|
15931
716b5fac1895
Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@pidgin.im>
parents:
15906
diff
changeset
|
4 | * Finch is the legal property of its developers, whose names are too numerous |
|
14620
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14484
diff
changeset
|
5 | * to list here. Please refer to the COPYRIGHT file distributed with this |
|
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14484
diff
changeset
|
6 | * source distribution. |
|
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14484
diff
changeset
|
7 | * |
|
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14484
diff
changeset
|
8 | * This program is free software; you can redistribute it and/or modify |
|
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14484
diff
changeset
|
9 | * it under the terms of the GNU General Public License as published by |
|
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14484
diff
changeset
|
10 | * the Free Software Foundation; either version 2 of the License, or |
|
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14484
diff
changeset
|
11 | * (at your option) any later version. |
|
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14484
diff
changeset
|
12 | * |
|
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14484
diff
changeset
|
13 | * This program is distributed in the hope that it will be useful, |
|
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14484
diff
changeset
|
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14484
diff
changeset
|
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14484
diff
changeset
|
16 | * GNU General Public License for more details. |
|
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14484
diff
changeset
|
17 | * |
|
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14484
diff
changeset
|
18 | * You should have received a copy of the GNU General Public License |
|
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14484
diff
changeset
|
19 | * along with this program; if not, write to the Free Software |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19572
diff
changeset
|
20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
|
14620
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14484
diff
changeset
|
21 | */ |
|
39887
9c8f874c74a0
Clean up all of the license headers
Gary Kramlich <grim@reaperworld.com>
parents:
39759
diff
changeset
|
22 | |
|
40441
f23c7e772667
Make sure we're not including the gettext macros in header files and deal with the repercussions of that.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
23 | #include <glib/gi18n-lib.h> |
|
f23c7e772667
Make sure we're not including the gettext macros in header files and deal with the repercussions of that.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
24 | |
|
40439
e9838d634d5e
Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents:
40350
diff
changeset
|
25 | #include <purple.h> |
|
29106
51c7b2177e42
Fix all the remaining files for which internal.h doesn't end up being the first include.
Paul Aurich <darkrain42@pidgin.im>
parents:
28587
diff
changeset
|
26 | |
|
13969
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
27 | #include <gnt.h> |
|
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
28 | |
|
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
29 | #include "gntaccount.h" |
|
17845
8ac5337e8f6d
Show information about the user requesting authorization.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17164
diff
changeset
|
30 | #include "gntblist.h" |
|
40616
064ff9f4150a
Don't allow libraries to include their own global header files.
Gary Kramlich <grim@reaperworld.com>
parents:
40511
diff
changeset
|
31 | #include "libfinch.h" |
|
13969
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
32 | |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
33 | #include <string.h> |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
34 | |
|
13969
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
35 | typedef struct |
|
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
36 | { |
|
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
37 | GntWidget *window; |
|
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
38 | GntWidget *tree; |
|
15878
f52832b611fe
renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents:
15829
diff
changeset
|
39 | } FinchAccountList; |
|
13969
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
40 | |
|
15878
f52832b611fe
renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents:
15829
diff
changeset
|
41 | static FinchAccountList accounts; |
|
13969
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
42 | |
|
14005
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
43 | typedef struct |
|
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
44 | { |
| 15884 | 45 | PurpleAccount *account; /* NULL for a new account */ |
|
14005
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
46 | |
|
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
47 | GntWidget *window; |
|
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
48 | |
|
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
49 | GntWidget *protocol; |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
24861
diff
changeset
|
50 | GntWidget *username; |
|
14005
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
51 | GntWidget *password; |
|
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
52 | GntWidget *alias; |
|
23250
f02a5d93cf17
Allow account registration in a new account dialog.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
53 | |
|
14005
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
54 | GntWidget *splits; |
|
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
55 | GList *split_entries; |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
56 | |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
57 | GList *protocol_entries; |
|
36637
9b0109ae118d
Renamed some prpl stuff to protocol stuff.
Ankit Vani <a@nevitus.org>
parents:
36632
diff
changeset
|
58 | GntWidget *protocols; |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
59 | |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
60 | GntWidget *remember; |
|
23250
f02a5d93cf17
Allow account registration in a new account dialog.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
61 | GntWidget *regserver; |
|
14005
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
62 | } AccountEditDialog; |
|
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
63 | |
|
14103
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
64 | /* This is necessary to close an edit-dialog when an account is deleted */ |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
65 | static GList *accountdialogs; |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
66 | |
|
14005
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
67 | static void |
| 15884 | 68 | account_add(PurpleAccount *account) |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
69 | { |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
70 | gnt_tree_add_choice(GNT_TREE(accounts.tree), account, |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
71 | gnt_tree_create_row(GNT_TREE(accounts.tree), |
| 15884 | 72 | purple_account_get_username(account), |
| 73 | purple_account_get_protocol_name(account)), | |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
74 | NULL, NULL); |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
75 | gnt_tree_set_choice(GNT_TREE(accounts.tree), account, |
| 15884 | 76 | purple_account_get_enabled(account, FINCH_UI)); |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
77 | } |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
78 | |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
79 | static void |
|
14005
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
80 | edit_dialog_destroy(AccountEditDialog *dialog) |
|
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
81 | { |
|
14103
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
82 | accountdialogs = g_list_remove(accountdialogs, dialog); |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
83 | g_list_free(dialog->protocol_entries); |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
84 | g_list_free(dialog->split_entries); |
|
14005
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
85 | g_free(dialog); |
|
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
86 | } |
|
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
87 | |
|
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
88 | static void |
|
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
89 | save_account_cb(AccountEditDialog *dialog) |
|
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
90 | { |
| 15884 | 91 | PurpleAccount *account; |
|
40680
f9ea6d5e8992
Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
40616
diff
changeset
|
92 | PurpleCredentialManager *manager = NULL; |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36384
diff
changeset
|
93 | PurpleProtocol *protocol; |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
94 | const char *value; |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
95 | GString *username; |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
96 | |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
97 | /* XXX: Do some error checking first. */ |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
98 | |
|
40680
f9ea6d5e8992
Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
40616
diff
changeset
|
99 | manager = purple_credential_manager_get_default(); |
|
f9ea6d5e8992
Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
40616
diff
changeset
|
100 | |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36384
diff
changeset
|
101 | protocol = gnt_combo_box_get_selected_data(GNT_COMBO_BOX(dialog->protocol)); |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
102 | |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
24861
diff
changeset
|
103 | /* Username && user-splits */ |
|
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
24861
diff
changeset
|
104 | value = gnt_entry_get_text(GNT_ENTRY(dialog->username)); |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
105 | |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
106 | if (value == NULL || *value == '\0') |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
107 | { |
|
30496
2f0380d2a282
Some updates to the account window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
29106
diff
changeset
|
108 | purple_notify_error(NULL, _("Error"), |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34331
diff
changeset
|
109 | dialog->account ? _("Account was not modified") : |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34331
diff
changeset
|
110 | _("Account was not added"), |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34331
diff
changeset
|
111 | _("Username of an account must be non-empty."), |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34331
diff
changeset
|
112 | purple_request_cpar_from_account(dialog->account)); |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
113 | return; |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
114 | } |
|
23250
f02a5d93cf17
Allow account registration in a new account dialog.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
115 | |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
116 | username = g_string_new(value); |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
117 | |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36384
diff
changeset
|
118 | if (protocol != NULL) |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
119 | { |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
120 | GList *iter, *entries; |
|
36607
7ad7681dcfd8
Use purple_protocol_get_* API instead of protocol->member
Ankit Vani <a@nevitus.org>
parents:
36574
diff
changeset
|
121 | for (iter = purple_protocol_get_user_splits(protocol), entries = dialog->split_entries; |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
122 | iter && entries; iter = iter->next, entries = entries->next) |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
123 | { |
| 15884 | 124 | PurpleAccountUserSplit *split = iter->data; |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
125 | GntWidget *entry = entries->data; |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
126 | |
|
36020
47474e8b92dd
Implement purple_account_user_split_(is|set)_constant, remove unsupported Facebook XMPP features
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35475
diff
changeset
|
127 | value = entry ? gnt_entry_get_text(GNT_ENTRY(entry)) : NULL; |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
128 | if (value == NULL || *value == '\0') |
| 15884 | 129 | value = purple_account_user_split_get_default_value(split); |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
130 | g_string_append_printf(username, "%c%s", |
| 15884 | 131 | purple_account_user_split_get_separator(split), |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
132 | value); |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
133 | } |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
134 | } |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
135 | |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
136 | if (dialog->account == NULL) |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
137 | { |
|
36607
7ad7681dcfd8
Use purple_protocol_get_* API instead of protocol->member
Ankit Vani <a@nevitus.org>
parents:
36574
diff
changeset
|
138 | account = purple_account_new(username->str, purple_protocol_get_id(protocol)); |
| 15884 | 139 | purple_accounts_add(account); |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
140 | } |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
141 | else |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
142 | { |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
143 | account = dialog->account; |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
144 | |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
145 | /* Protocol */ |
|
30496
2f0380d2a282
Some updates to the account window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
29106
diff
changeset
|
146 | if (purple_account_is_disconnected(account)) { |
|
36607
7ad7681dcfd8
Use purple_protocol_get_* API instead of protocol->member
Ankit Vani <a@nevitus.org>
parents:
36574
diff
changeset
|
147 | purple_account_set_protocol_id(account, purple_protocol_get_id(protocol)); |
|
30496
2f0380d2a282
Some updates to the account window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
29106
diff
changeset
|
148 | purple_account_set_username(account, username->str); |
|
2f0380d2a282
Some updates to the account window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
29106
diff
changeset
|
149 | } else { |
|
2f0380d2a282
Some updates to the account window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
29106
diff
changeset
|
150 | const char *old = purple_account_get_protocol_id(account); |
|
36637
9b0109ae118d
Renamed some prpl stuff to protocol stuff.
Ankit Vani <a@nevitus.org>
parents:
36632
diff
changeset
|
151 | char *oldproto; |
| 38358 | 152 | if (!purple_strequal(old, purple_protocol_get_id(protocol))) { |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34331
diff
changeset
|
153 | purple_notify_error(NULL, _("Error"), |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34331
diff
changeset
|
154 | _("Account was not modified"), |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34331
diff
changeset
|
155 | _("The account's protocol cannot be " |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34331
diff
changeset
|
156 | "changed while it is connected to the " |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34331
diff
changeset
|
157 | "server."), |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34331
diff
changeset
|
158 | purple_request_cpar_from_account( |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34331
diff
changeset
|
159 | account)); |
|
39903
05d2cd3d93df
finch: Fix possible leaks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39901
diff
changeset
|
160 | g_string_free(username, TRUE); |
|
30496
2f0380d2a282
Some updates to the account window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
29106
diff
changeset
|
161 | return; |
|
2f0380d2a282
Some updates to the account window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
29106
diff
changeset
|
162 | } |
|
2f0380d2a282
Some updates to the account window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
29106
diff
changeset
|
163 | |
|
36637
9b0109ae118d
Renamed some prpl stuff to protocol stuff.
Ankit Vani <a@nevitus.org>
parents:
36632
diff
changeset
|
164 | oldproto = g_strdup(purple_normalize(account, purple_account_get_username(account))); |
|
9b0109ae118d
Renamed some prpl stuff to protocol stuff.
Ankit Vani <a@nevitus.org>
parents:
36632
diff
changeset
|
165 | if (g_utf8_collate(oldproto, purple_normalize(account, username->str))) { |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34331
diff
changeset
|
166 | purple_notify_error(NULL, _("Error"), |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34331
diff
changeset
|
167 | _("Account was not modified"), |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34331
diff
changeset
|
168 | _("The account's username cannot be " |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34331
diff
changeset
|
169 | "changed while it is connected to the " |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34331
diff
changeset
|
170 | "server."), |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34331
diff
changeset
|
171 | purple_request_cpar_from_account( |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34331
diff
changeset
|
172 | account)); |
|
36637
9b0109ae118d
Renamed some prpl stuff to protocol stuff.
Ankit Vani <a@nevitus.org>
parents:
36632
diff
changeset
|
173 | g_free(oldproto); |
|
39918
1c8e11f9274f
Fix several memory leaks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39903
diff
changeset
|
174 | g_string_free(username, TRUE); |
|
30496
2f0380d2a282
Some updates to the account window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
29106
diff
changeset
|
175 | return; |
|
2f0380d2a282
Some updates to the account window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
29106
diff
changeset
|
176 | } |
|
36637
9b0109ae118d
Renamed some prpl stuff to protocol stuff.
Ankit Vani <a@nevitus.org>
parents:
36632
diff
changeset
|
177 | g_free(oldproto); |
|
30496
2f0380d2a282
Some updates to the account window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
29106
diff
changeset
|
178 | purple_account_set_username(account, username->str); |
|
2f0380d2a282
Some updates to the account window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
29106
diff
changeset
|
179 | } |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
180 | } |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
181 | g_string_free(username, TRUE); |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
182 | |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
183 | /* Alias */ |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
184 | value = gnt_entry_get_text(GNT_ENTRY(dialog->alias)); |
|
34589
428e92c79631
Renamed purple_account_[get,set]_alias to purple_account[get,set]_private_alias.
Ankit Vani <a@nevitus.org>
parents:
34111
diff
changeset
|
185 | purple_account_set_private_alias(account, value); |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
186 | |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
187 | /* Remember password and password */ |
| 15884 | 188 | purple_account_set_remember_password(account, |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
189 | gnt_check_box_get_checked(GNT_CHECK_BOX(dialog->remember))); |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
190 | value = gnt_entry_get_text(GNT_ENTRY(dialog->password)); |
|
40680
f9ea6d5e8992
Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
40616
diff
changeset
|
191 | if (value && *value) { |
|
f9ea6d5e8992
Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
40616
diff
changeset
|
192 | purple_credential_manager_write_password_async(manager, account, value, |
|
f9ea6d5e8992
Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
40616
diff
changeset
|
193 | NULL, NULL, NULL); |
|
f9ea6d5e8992
Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
40616
diff
changeset
|
194 | } else { |
|
f9ea6d5e8992
Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
40616
diff
changeset
|
195 | purple_credential_manager_clear_password_async(manager, account, NULL, |
|
f9ea6d5e8992
Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
40616
diff
changeset
|
196 | NULL, NULL); |
|
f9ea6d5e8992
Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
40616
diff
changeset
|
197 | } |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
198 | |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
199 | /* Protocol options */ |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36384
diff
changeset
|
200 | if (protocol) |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
201 | { |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
202 | GList *iter, *entries; |
|
23250
f02a5d93cf17
Allow account registration in a new account dialog.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
203 | |
|
37038
8832d14d7d0c
Rename 'protocol_options' field of PurpleProtocol to more appropriate 'account_options'
Ankit Vani <a@nevitus.org>
parents:
36782
diff
changeset
|
204 | for (iter = purple_protocol_get_account_options(protocol), entries = dialog->protocol_entries; |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
205 | iter && entries; iter = iter->next, entries = entries->next) |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
206 | { |
| 15884 | 207 | PurpleAccountOption *option = iter->data; |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
208 | GntWidget *entry = entries->data; |
|
35378
5d9e2581005b
gtk-doc prep: *_get_type() functions are hidden as standard GType-returning funcs, so rename them.
Ankit Vani <a@nevitus.org>
parents:
34955
diff
changeset
|
209 | PurplePrefType type = purple_account_option_get_pref_type(option); |
| 15884 | 210 | const char *setting = purple_account_option_get_setting(option); |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
211 | |
| 15884 | 212 | if (type == PURPLE_PREF_STRING) |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
213 | { |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
214 | const char *value = gnt_entry_get_text(GNT_ENTRY(entry)); |
| 15884 | 215 | purple_account_set_string(account, setting, value); |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
216 | } |
| 15884 | 217 | else if (type == PURPLE_PREF_INT) |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
218 | { |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
219 | const char *str = gnt_entry_get_text(GNT_ENTRY(entry)); |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
220 | int value = 0; |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
221 | if (str) |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
222 | value = atoi(str); |
| 15884 | 223 | purple_account_set_int(account, setting, value); |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
224 | } |
| 15884 | 225 | else if (type == PURPLE_PREF_BOOLEAN) |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
226 | { |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
227 | gboolean value = gnt_check_box_get_checked(GNT_CHECK_BOX(entry)); |
| 15884 | 228 | purple_account_set_bool(account, setting, value); |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
229 | } |
| 15884 | 230 | else if (type == PURPLE_PREF_STRING_LIST) |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
231 | { |
|
30725
4aa8ed98e52a
finch: Add support for string lists as account options
Paul Aurich <darkrain42@pidgin.im>
parents:
30496
diff
changeset
|
232 | gchar *value = gnt_combo_box_get_selected_data(GNT_COMBO_BOX(entry)); |
|
4aa8ed98e52a
finch: Add support for string lists as account options
Paul Aurich <darkrain42@pidgin.im>
parents:
30496
diff
changeset
|
233 | purple_account_set_string(account, setting, value); |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
234 | } |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
235 | else |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
236 | { |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
237 | g_assert_not_reached(); |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
238 | } |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
239 | } |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
240 | } |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
241 | |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
242 | /* XXX: Proxy options */ |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
243 | |
|
19572
52e2313b38f8
Focus the modified/created account in the accounts window after modifying/
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19125
diff
changeset
|
244 | if (accounts.window && accounts.tree) { |
|
52e2313b38f8
Focus the modified/created account in the accounts window after modifying/
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19125
diff
changeset
|
245 | gnt_tree_set_selected(GNT_TREE(accounts.tree), account); |
|
52e2313b38f8
Focus the modified/created account in the accounts window after modifying/
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19125
diff
changeset
|
246 | gnt_box_give_focus_to_child(GNT_BOX(accounts.window), accounts.tree); |
|
52e2313b38f8
Focus the modified/created account in the accounts window after modifying/
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19125
diff
changeset
|
247 | } |
|
52e2313b38f8
Focus the modified/created account in the accounts window after modifying/
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19125
diff
changeset
|
248 | |
|
39759
ea1401483849
Rename *_GET_*_IFACE to more standard *_GET_IFACE.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39626
diff
changeset
|
249 | if (protocol && PURPLE_PROTOCOL_IMPLEMENTS(protocol, SERVER, register_user) && |
|
23250
f02a5d93cf17
Allow account registration in a new account dialog.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
250 | gnt_check_box_get_checked(GNT_CHECK_BOX(dialog->regserver))) { |
|
f02a5d93cf17
Allow account registration in a new account dialog.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
251 | purple_account_register(account); |
|
f02a5d93cf17
Allow account registration in a new account dialog.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
252 | } else if (dialog->account == NULL) { |
|
f02a5d93cf17
Allow account registration in a new account dialog.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
253 | /* This is a new account. Set it to the current status. */ |
|
f02a5d93cf17
Allow account registration in a new account dialog.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
254 | /* Xerox from gtkaccount.c :D */ |
|
f02a5d93cf17
Allow account registration in a new account dialog.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
255 | const PurpleSavedStatus *saved_status; |
|
f02a5d93cf17
Allow account registration in a new account dialog.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
256 | saved_status = purple_savedstatus_get_current(); |
|
f02a5d93cf17
Allow account registration in a new account dialog.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
257 | if (saved_status != NULL) { |
|
f02a5d93cf17
Allow account registration in a new account dialog.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
258 | purple_savedstatus_activate_for_account(saved_status, account); |
|
f02a5d93cf17
Allow account registration in a new account dialog.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
259 | purple_account_set_enabled(account, FINCH_UI, TRUE); |
|
f02a5d93cf17
Allow account registration in a new account dialog.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
260 | } |
|
f02a5d93cf17
Allow account registration in a new account dialog.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
261 | } |
|
f02a5d93cf17
Allow account registration in a new account dialog.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
262 | |
|
30496
2f0380d2a282
Some updates to the account window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
29106
diff
changeset
|
263 | /* In case of a new account, the 'Accounts' window is updated from the account-added |
|
2f0380d2a282
Some updates to the account window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
29106
diff
changeset
|
264 | * callback. In case of changes in an existing account, we need to explicitly do it |
|
2f0380d2a282
Some updates to the account window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
29106
diff
changeset
|
265 | * here. |
|
2f0380d2a282
Some updates to the account window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
29106
diff
changeset
|
266 | */ |
|
2f0380d2a282
Some updates to the account window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
29106
diff
changeset
|
267 | if (dialog->account != NULL && accounts.window) { |
|
2f0380d2a282
Some updates to the account window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
29106
diff
changeset
|
268 | gnt_tree_change_text(GNT_TREE(accounts.tree), dialog->account, |
|
2f0380d2a282
Some updates to the account window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
29106
diff
changeset
|
269 | 0, purple_account_get_username(dialog->account)); |
|
2f0380d2a282
Some updates to the account window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
29106
diff
changeset
|
270 | gnt_tree_change_text(GNT_TREE(accounts.tree), dialog->account, |
|
2f0380d2a282
Some updates to the account window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
29106
diff
changeset
|
271 | 1, purple_account_get_protocol_name(dialog->account)); |
|
2f0380d2a282
Some updates to the account window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
29106
diff
changeset
|
272 | } |
|
2f0380d2a282
Some updates to the account window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
29106
diff
changeset
|
273 | |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
274 | gnt_widget_destroy(dialog->window); |
|
14005
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
275 | } |
|
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
276 | |
|
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
277 | static void |
|
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
278 | update_user_splits(AccountEditDialog *dialog) |
|
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
279 | { |
|
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
280 | GntWidget *hbox; |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36384
diff
changeset
|
281 | PurpleProtocol *protocol; |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
282 | GList *iter, *entries; |
|
14005
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
283 | char *username = NULL; |
|
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
284 | |
|
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
285 | if (dialog->splits) |
|
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
286 | { |
|
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
287 | gnt_box_remove_all(GNT_BOX(dialog->splits)); |
|
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
288 | g_list_free(dialog->split_entries); |
|
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
289 | } |
|
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
290 | else |
|
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
291 | { |
|
14121
3d8804b82150
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14103
diff
changeset
|
292 | dialog->splits = gnt_vbox_new(FALSE); |
|
14005
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
293 | gnt_box_set_pad(GNT_BOX(dialog->splits), 0); |
|
14121
3d8804b82150
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14103
diff
changeset
|
294 | gnt_box_set_fill(GNT_BOX(dialog->splits), TRUE); |
|
14005
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
295 | } |
|
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
296 | |
|
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
297 | dialog->split_entries = NULL; |
|
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
298 | |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36384
diff
changeset
|
299 | protocol = gnt_combo_box_get_selected_data(GNT_COMBO_BOX(dialog->protocol)); |
|
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36384
diff
changeset
|
300 | if (!protocol) |
|
14005
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
301 | return; |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
30725
diff
changeset
|
302 | |
| 15884 | 303 | username = dialog->account ? g_strdup(purple_account_get_username(dialog->account)) : NULL; |
|
14005
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
304 | |
|
36607
7ad7681dcfd8
Use purple_protocol_get_* API instead of protocol->member
Ankit Vani <a@nevitus.org>
parents:
36574
diff
changeset
|
305 | for (iter = purple_protocol_get_user_splits(protocol); iter; iter = iter->next) |
|
14005
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
306 | { |
| 15884 | 307 | PurpleAccountUserSplit *split = iter->data; |
|
36020
47474e8b92dd
Implement purple_account_user_split_(is|set)_constant, remove unsupported Facebook XMPP features
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35475
diff
changeset
|
308 | GntWidget *entry = NULL; |
|
47474e8b92dd
Implement purple_account_user_split_(is|set)_constant, remove unsupported Facebook XMPP features
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35475
diff
changeset
|
309 | char *buf = NULL; |
|
14005
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
310 | |
|
36020
47474e8b92dd
Implement purple_account_user_split_(is|set)_constant, remove unsupported Facebook XMPP features
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35475
diff
changeset
|
311 | if (!purple_account_user_split_is_constant(split)) { |
|
47474e8b92dd
Implement purple_account_user_split_(is|set)_constant, remove unsupported Facebook XMPP features
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35475
diff
changeset
|
312 | hbox = gnt_hbox_new(TRUE); |
|
47474e8b92dd
Implement purple_account_user_split_(is|set)_constant, remove unsupported Facebook XMPP features
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35475
diff
changeset
|
313 | gnt_box_add_widget(GNT_BOX(dialog->splits), hbox); |
|
14005
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
314 | |
|
36020
47474e8b92dd
Implement purple_account_user_split_(is|set)_constant, remove unsupported Facebook XMPP features
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35475
diff
changeset
|
315 | buf = g_strdup_printf("%s:", purple_account_user_split_get_text(split)); |
|
47474e8b92dd
Implement purple_account_user_split_(is|set)_constant, remove unsupported Facebook XMPP features
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35475
diff
changeset
|
316 | gnt_box_add_widget(GNT_BOX(hbox), gnt_label_new(buf)); |
|
14005
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
317 | |
|
36020
47474e8b92dd
Implement purple_account_user_split_(is|set)_constant, remove unsupported Facebook XMPP features
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35475
diff
changeset
|
318 | entry = gnt_entry_new(NULL); |
|
47474e8b92dd
Implement purple_account_user_split_(is|set)_constant, remove unsupported Facebook XMPP features
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35475
diff
changeset
|
319 | gnt_box_add_widget(GNT_BOX(hbox), entry); |
|
47474e8b92dd
Implement purple_account_user_split_(is|set)_constant, remove unsupported Facebook XMPP features
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35475
diff
changeset
|
320 | } |
|
14005
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
321 | |
|
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
322 | dialog->split_entries = g_list_append(dialog->split_entries, entry); |
|
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
323 | g_free(buf); |
|
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
324 | } |
|
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
325 | |
|
36607
7ad7681dcfd8
Use purple_protocol_get_* API instead of protocol->member
Ankit Vani <a@nevitus.org>
parents:
36574
diff
changeset
|
326 | for (iter = g_list_last(purple_protocol_get_user_splits(protocol)), entries = g_list_last(dialog->split_entries); |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
327 | iter && entries; iter = iter->prev, entries = entries->prev) |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
328 | { |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
329 | GntWidget *entry = entries->data; |
| 15884 | 330 | PurpleAccountUserSplit *split = iter->data; |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
331 | const char *value = NULL; |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
332 | char *s; |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
333 | |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
334 | if (dialog->account) |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
335 | { |
|
18099
f38988d232f7
jabber can contain @ symbols and / in the resource, so we have to look for
Nathan Walp <nwalp@pidgin.im>
parents:
17401
diff
changeset
|
336 | if(purple_account_user_split_get_reverse(split)) |
|
f38988d232f7
jabber can contain @ symbols and / in the resource, so we have to look for
Nathan Walp <nwalp@pidgin.im>
parents:
17401
diff
changeset
|
337 | s = strrchr(username, purple_account_user_split_get_separator(split)); |
|
f38988d232f7
jabber can contain @ symbols and / in the resource, so we have to look for
Nathan Walp <nwalp@pidgin.im>
parents:
17401
diff
changeset
|
338 | else |
|
f38988d232f7
jabber can contain @ symbols and / in the resource, so we have to look for
Nathan Walp <nwalp@pidgin.im>
parents:
17401
diff
changeset
|
339 | s = strchr(username, purple_account_user_split_get_separator(split)); |
|
f38988d232f7
jabber can contain @ symbols and / in the resource, so we have to look for
Nathan Walp <nwalp@pidgin.im>
parents:
17401
diff
changeset
|
340 | |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
341 | if (s != NULL) |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
342 | { |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
343 | *s = '\0'; |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
344 | s++; |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
345 | value = s; |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
346 | } |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
347 | } |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
348 | if (value == NULL) |
| 15884 | 349 | value = purple_account_user_split_get_default_value(split); |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
350 | |
|
36020
47474e8b92dd
Implement purple_account_user_split_(is|set)_constant, remove unsupported Facebook XMPP features
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35475
diff
changeset
|
351 | if (value != NULL && entry != NULL) |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
352 | gnt_entry_set_text(GNT_ENTRY(entry), value); |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
353 | } |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
354 | |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
355 | if (username != NULL) |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
24861
diff
changeset
|
356 | gnt_entry_set_text(GNT_ENTRY(dialog->username), username); |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
357 | |
|
14005
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
358 | g_free(username); |
|
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
359 | } |
|
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
360 | |
|
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
361 | static void |
|
37038
8832d14d7d0c
Rename 'protocol_options' field of PurpleProtocol to more appropriate 'account_options'
Ankit Vani <a@nevitus.org>
parents:
36782
diff
changeset
|
362 | add_account_options(AccountEditDialog *dialog) |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
363 | { |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36384
diff
changeset
|
364 | PurpleProtocol *protocol; |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
365 | GList *iter; |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
366 | GntWidget *vbox, *box; |
| 15884 | 367 | PurpleAccount *account; |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
368 | |
|
36637
9b0109ae118d
Renamed some prpl stuff to protocol stuff.
Ankit Vani <a@nevitus.org>
parents:
36632
diff
changeset
|
369 | if (dialog->protocols) |
|
9b0109ae118d
Renamed some prpl stuff to protocol stuff.
Ankit Vani <a@nevitus.org>
parents:
36632
diff
changeset
|
370 | gnt_box_remove_all(GNT_BOX(dialog->protocols)); |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
371 | else |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
372 | { |
|
36637
9b0109ae118d
Renamed some prpl stuff to protocol stuff.
Ankit Vani <a@nevitus.org>
parents:
36632
diff
changeset
|
373 | dialog->protocols = vbox = gnt_vbox_new(FALSE); |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
374 | gnt_box_set_pad(GNT_BOX(vbox), 0); |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
375 | gnt_box_set_alignment(GNT_BOX(vbox), GNT_ALIGN_LEFT); |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
376 | gnt_box_set_fill(GNT_BOX(vbox), TRUE); |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
377 | } |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
378 | |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
379 | if (dialog->protocol_entries) |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
380 | { |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
381 | g_list_free(dialog->protocol_entries); |
|
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
382 | dialog->protocol_entries = NULL; |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
383 | } |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
384 | |
|
36637
9b0109ae118d
Renamed some prpl stuff to protocol stuff.
Ankit Vani <a@nevitus.org>
parents:
36632
diff
changeset
|
385 | vbox = dialog->protocols; |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
386 | |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36384
diff
changeset
|
387 | protocol = gnt_combo_box_get_selected_data(GNT_COMBO_BOX(dialog->protocol)); |
|
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36384
diff
changeset
|
388 | if (!protocol) |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
389 | return; |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
390 | |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
391 | account = dialog->account; |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
392 | |
|
37038
8832d14d7d0c
Rename 'protocol_options' field of PurpleProtocol to more appropriate 'account_options'
Ankit Vani <a@nevitus.org>
parents:
36782
diff
changeset
|
393 | for (iter = purple_protocol_get_account_options(protocol); iter; iter = iter->next) |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
394 | { |
| 15884 | 395 | PurpleAccountOption *option = iter->data; |
|
35378
5d9e2581005b
gtk-doc prep: *_get_type() functions are hidden as standard GType-returning funcs, so rename them.
Ankit Vani <a@nevitus.org>
parents:
34955
diff
changeset
|
396 | PurplePrefType type = purple_account_option_get_pref_type(option); |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
397 | |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
398 | box = gnt_hbox_new(TRUE); |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
399 | gnt_box_set_pad(GNT_BOX(box), 0); |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
400 | gnt_box_add_widget(GNT_BOX(vbox), box); |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
401 | |
| 15884 | 402 | if (type == PURPLE_PREF_BOOLEAN) |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
403 | { |
| 15884 | 404 | GntWidget *widget = gnt_check_box_new(purple_account_option_get_text(option)); |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
405 | gnt_box_add_widget(GNT_BOX(box), widget); |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
406 | dialog->protocol_entries = g_list_append(dialog->protocol_entries, widget); |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
407 | |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
408 | if (account) |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
409 | gnt_check_box_set_checked(GNT_CHECK_BOX(widget), |
| 15884 | 410 | purple_account_get_bool(account, |
| 411 | purple_account_option_get_setting(option), | |
| 412 | purple_account_option_get_default_bool(option))); | |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
413 | else |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
414 | gnt_check_box_set_checked(GNT_CHECK_BOX(widget), |
| 15884 | 415 | purple_account_option_get_default_bool(option)); |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
416 | } |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
417 | else |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
418 | { |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
419 | gnt_box_add_widget(GNT_BOX(box), |
| 15884 | 420 | gnt_label_new(purple_account_option_get_text(option))); |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
421 | |
| 15884 | 422 | if (type == PURPLE_PREF_STRING_LIST) |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
423 | { |
|
30725
4aa8ed98e52a
finch: Add support for string lists as account options
Paul Aurich <darkrain42@pidgin.im>
parents:
30496
diff
changeset
|
424 | GntWidget *combo = gnt_combo_box_new(); |
|
4aa8ed98e52a
finch: Add support for string lists as account options
Paul Aurich <darkrain42@pidgin.im>
parents:
30496
diff
changeset
|
425 | GList *opt_iter = purple_account_option_get_list(option); |
|
4aa8ed98e52a
finch: Add support for string lists as account options
Paul Aurich <darkrain42@pidgin.im>
parents:
30496
diff
changeset
|
426 | const char *dv = purple_account_option_get_default_list_value(option); |
|
4aa8ed98e52a
finch: Add support for string lists as account options
Paul Aurich <darkrain42@pidgin.im>
parents:
30496
diff
changeset
|
427 | const char *active = dv; |
|
4aa8ed98e52a
finch: Add support for string lists as account options
Paul Aurich <darkrain42@pidgin.im>
parents:
30496
diff
changeset
|
428 | |
|
4aa8ed98e52a
finch: Add support for string lists as account options
Paul Aurich <darkrain42@pidgin.im>
parents:
30496
diff
changeset
|
429 | if (account) |
|
4aa8ed98e52a
finch: Add support for string lists as account options
Paul Aurich <darkrain42@pidgin.im>
parents:
30496
diff
changeset
|
430 | active = purple_account_get_string(account, |
|
4aa8ed98e52a
finch: Add support for string lists as account options
Paul Aurich <darkrain42@pidgin.im>
parents:
30496
diff
changeset
|
431 | purple_account_option_get_setting(option), dv); |
|
4aa8ed98e52a
finch: Add support for string lists as account options
Paul Aurich <darkrain42@pidgin.im>
parents:
30496
diff
changeset
|
432 | |
|
4aa8ed98e52a
finch: Add support for string lists as account options
Paul Aurich <darkrain42@pidgin.im>
parents:
30496
diff
changeset
|
433 | gnt_box_add_widget(GNT_BOX(box), combo); |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
434 | dialog->protocol_entries = g_list_append(dialog->protocol_entries, combo); |
|
30725
4aa8ed98e52a
finch: Add support for string lists as account options
Paul Aurich <darkrain42@pidgin.im>
parents:
30496
diff
changeset
|
435 | |
|
4aa8ed98e52a
finch: Add support for string lists as account options
Paul Aurich <darkrain42@pidgin.im>
parents:
30496
diff
changeset
|
436 | for ( ; opt_iter; opt_iter = opt_iter->next) |
|
4aa8ed98e52a
finch: Add support for string lists as account options
Paul Aurich <darkrain42@pidgin.im>
parents:
30496
diff
changeset
|
437 | { |
|
4aa8ed98e52a
finch: Add support for string lists as account options
Paul Aurich <darkrain42@pidgin.im>
parents:
30496
diff
changeset
|
438 | PurpleKeyValuePair *kvp = opt_iter->data; |
|
4aa8ed98e52a
finch: Add support for string lists as account options
Paul Aurich <darkrain42@pidgin.im>
parents:
30496
diff
changeset
|
439 | gnt_combo_box_add_data(GNT_COMBO_BOX(combo), kvp->value, kvp->key); |
|
4aa8ed98e52a
finch: Add support for string lists as account options
Paul Aurich <darkrain42@pidgin.im>
parents:
30496
diff
changeset
|
440 | |
|
38256
035f00c4fd87
Replace misused g_str_equal() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
31294
diff
changeset
|
441 | if (purple_strequal(kvp->value, active)) |
|
30725
4aa8ed98e52a
finch: Add support for string lists as account options
Paul Aurich <darkrain42@pidgin.im>
parents:
30496
diff
changeset
|
442 | gnt_combo_box_set_selected(GNT_COMBO_BOX(combo), kvp->value); |
|
4aa8ed98e52a
finch: Add support for string lists as account options
Paul Aurich <darkrain42@pidgin.im>
parents:
30496
diff
changeset
|
443 | } |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
444 | } |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
445 | else |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
446 | { |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
447 | GntWidget *entry = gnt_entry_new(NULL); |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
448 | gnt_box_add_widget(GNT_BOX(box), entry); |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
449 | dialog->protocol_entries = g_list_append(dialog->protocol_entries, entry); |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
450 | |
| 15884 | 451 | if (type == PURPLE_PREF_STRING) |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
452 | { |
| 15884 | 453 | const char *dv = purple_account_option_get_default_string(option); |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
454 | |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
455 | if (account) |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
456 | gnt_entry_set_text(GNT_ENTRY(entry), |
| 15884 | 457 | purple_account_get_string(account, |
| 458 | purple_account_option_get_setting(option), dv)); | |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
459 | else |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
460 | gnt_entry_set_text(GNT_ENTRY(entry), dv); |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
461 | } |
| 15884 | 462 | else if (type == PURPLE_PREF_INT) |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
463 | { |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
464 | char str[32]; |
| 15884 | 465 | int value = purple_account_option_get_default_int(option); |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
466 | if (account) |
| 15884 | 467 | value = purple_account_get_int(account, |
| 468 | purple_account_option_get_setting(option), value); | |
|
40094
8e6d91e4dd8f
Use g_(v)snprintf so we need less wrappers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40044
diff
changeset
|
469 | g_snprintf(str, sizeof(str), "%d", value); |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
470 | gnt_entry_set_flag(GNT_ENTRY(entry), GNT_ENTRY_FLAG_INT); |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
471 | gnt_entry_set_text(GNT_ENTRY(entry), str); |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
472 | } |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
473 | else |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
474 | { |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
475 | g_assert_not_reached(); |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
476 | } |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
477 | } |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
478 | } |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
479 | } |
|
23250
f02a5d93cf17
Allow account registration in a new account dialog.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
480 | |
|
f02a5d93cf17
Allow account registration in a new account dialog.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
481 | /* Show the registration checkbox only in a new account dialog, |
|
36637
9b0109ae118d
Renamed some prpl stuff to protocol stuff.
Ankit Vani <a@nevitus.org>
parents:
36632
diff
changeset
|
482 | * and when the selected protocol has the support for it. */ |
|
23250
f02a5d93cf17
Allow account registration in a new account dialog.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
483 | gnt_widget_set_visible(dialog->regserver, account == NULL && |
|
39759
ea1401483849
Rename *_GET_*_IFACE to more standard *_GET_IFACE.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39626
diff
changeset
|
484 | PURPLE_PROTOCOL_IMPLEMENTS(protocol, SERVER, register_user)); |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
485 | } |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
486 | |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
487 | static void |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
488 | update_user_options(AccountEditDialog *dialog) |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
489 | { |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36384
diff
changeset
|
490 | PurpleProtocol *protocol; |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
491 | |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36384
diff
changeset
|
492 | protocol = gnt_combo_box_get_selected_data(GNT_COMBO_BOX(dialog->protocol)); |
|
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36384
diff
changeset
|
493 | if (!protocol) |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
494 | return; |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
495 | |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
496 | if (dialog->remember == NULL) |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
497 | dialog->remember = gnt_check_box_new(_("Remember password")); |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
498 | if (dialog->account) |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
499 | gnt_check_box_set_checked(GNT_CHECK_BOX(dialog->remember), |
| 15884 | 500 | purple_account_get_remember_password(dialog->account)); |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
501 | } |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
502 | |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
503 | static void |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
504 | protocol_changed_cb(GntWidget *combo, PurpleProtocol *old, PurpleProtocol *new, AccountEditDialog *dialog) |
|
14005
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
505 | { |
|
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
506 | update_user_splits(dialog); |
|
37038
8832d14d7d0c
Rename 'protocol_options' field of PurpleProtocol to more appropriate 'account_options'
Ankit Vani <a@nevitus.org>
parents:
36782
diff
changeset
|
507 | add_account_options(dialog); |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
508 | update_user_options(dialog); /* This may not be necessary here */ |
|
14005
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
509 | gnt_box_readjust(GNT_BOX(dialog->window)); |
|
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
510 | gnt_widget_draw(dialog->window); |
|
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
511 | } |
|
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
512 | |
|
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
513 | static void |
|
40680
f9ea6d5e8992
Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
40616
diff
changeset
|
514 | edit_account_continue(GObject *obj, GAsyncResult *res, gpointer data) |
|
14005
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
515 | { |
|
40680
f9ea6d5e8992
Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
40616
diff
changeset
|
516 | PurpleAccount *account = PURPLE_ACCOUNT(data); |
|
f9ea6d5e8992
Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
40616
diff
changeset
|
517 | PurpleCredentialManager *manager = PURPLE_CREDENTIAL_MANAGER(obj); |
|
14005
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
518 | GntWidget *window, *hbox; |
|
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
519 | GntWidget *combo, *button, *entry; |
|
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
520 | GList *list, *iter; |
|
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
521 | AccountEditDialog *dialog; |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36384
diff
changeset
|
522 | PurpleProtocol *protocol; |
|
40680
f9ea6d5e8992
Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
40616
diff
changeset
|
523 | gchar *password = NULL; |
|
f9ea6d5e8992
Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
40616
diff
changeset
|
524 | |
|
f9ea6d5e8992
Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
40616
diff
changeset
|
525 | password = purple_credential_manager_read_password_finish(manager, res, |
|
f9ea6d5e8992
Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
40616
diff
changeset
|
526 | NULL); |
|
14005
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
527 | |
|
14103
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
528 | if (account) |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
529 | { |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
530 | GList *iter; |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
531 | for (iter = accountdialogs; iter; iter = iter->next) |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
532 | { |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
533 | AccountEditDialog *dlg = iter->data; |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
534 | if (dlg->account == account) |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
535 | return; |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
536 | } |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
537 | } |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
538 | |
|
36384
1302c612fb65
Refactored gntaccount to use the initial GObject plugin API
Ankit Vani <a@nevitus.org>
parents:
36382
diff
changeset
|
539 | list = purple_protocols_get_all(); |
|
18611
03e6a4f7514b
Do not crash when people run finch without 'make install'ing first.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18400
diff
changeset
|
540 | if (list == NULL) { |
|
03e6a4f7514b
Do not crash when people run finch without 'make install'ing first.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18400
diff
changeset
|
541 | purple_notify_error(NULL, _("Error"), |
| 36782 | 542 | _("There are no protocols installed."), |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34331
diff
changeset
|
543 | _("(You probably forgot to 'make install'.)"), |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34331
diff
changeset
|
544 | purple_request_cpar_from_account(account)); |
|
18611
03e6a4f7514b
Do not crash when people run finch without 'make install'ing first.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18400
diff
changeset
|
545 | return; |
|
03e6a4f7514b
Do not crash when people run finch without 'make install'ing first.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18400
diff
changeset
|
546 | } |
|
03e6a4f7514b
Do not crash when people run finch without 'make install'ing first.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18400
diff
changeset
|
547 | |
|
14005
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
548 | dialog = g_new0(AccountEditDialog, 1); |
|
14103
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
549 | accountdialogs = g_list_prepend(accountdialogs, dialog); |
|
14005
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
550 | |
|
14121
3d8804b82150
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14103
diff
changeset
|
551 | dialog->window = window = gnt_vbox_new(FALSE); |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
552 | dialog->account = account; |
|
14005
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
553 | gnt_box_set_toplevel(GNT_BOX(window), TRUE); |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
554 | gnt_box_set_title(GNT_BOX(window), account ? _("Modify Account") : _("New Account")); |
|
14005
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
555 | gnt_box_set_alignment(GNT_BOX(window), GNT_ALIGN_MID); |
|
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
556 | gnt_box_set_pad(GNT_BOX(window), 0); |
|
14121
3d8804b82150
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14103
diff
changeset
|
557 | gnt_widget_set_name(window, "edit-account"); |
|
3d8804b82150
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14103
diff
changeset
|
558 | gnt_box_set_fill(GNT_BOX(window), TRUE); |
|
14005
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
559 | |
|
14121
3d8804b82150
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14103
diff
changeset
|
560 | hbox = gnt_hbox_new(TRUE); |
|
3d8804b82150
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14103
diff
changeset
|
561 | gnt_box_set_pad(GNT_BOX(hbox), 0); |
|
14005
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
562 | gnt_box_add_widget(GNT_BOX(window), hbox); |
|
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
563 | |
|
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
564 | dialog->protocol = combo = gnt_combo_box_new(); |
|
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
565 | for (iter = list; iter; iter = iter->next) |
|
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
566 | { |
|
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
567 | gnt_combo_box_add_data(GNT_COMBO_BOX(combo), iter->data, |
|
36632
1f0650e7b1b5
Refactored finch and a bit of libpurple plugins to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36626
diff
changeset
|
568 | purple_protocol_get_name(PURPLE_PROTOCOL(iter->data))); |
|
14005
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
569 | } |
|
14121
3d8804b82150
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14103
diff
changeset
|
570 | |
|
36626
18fc361b3704
Renamed purple_find_protocol_info to purple_protocols_find
Ankit Vani <a@nevitus.org>
parents:
36607
diff
changeset
|
571 | protocol = purple_protocols_find(purple_account_get_protocol_id(account)); |
|
28115
da3d8cf3f2ab
Don't crash trying to modify the settings for an account where the prpl is
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
27829
diff
changeset
|
572 | |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36384
diff
changeset
|
573 | if (account && protocol) |
|
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36384
diff
changeset
|
574 | gnt_combo_box_set_selected(GNT_COMBO_BOX(combo), protocol); |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
575 | else |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
576 | gnt_combo_box_set_selected(GNT_COMBO_BOX(combo), list->data); |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
577 | |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
578 | g_signal_connect(G_OBJECT(combo), "selection-changed", G_CALLBACK(protocol_changed_cb), dialog); |
|
14121
3d8804b82150
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14103
diff
changeset
|
579 | |
|
14005
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
580 | gnt_box_add_widget(GNT_BOX(hbox), gnt_label_new(_("Protocol:"))); |
|
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
581 | gnt_box_add_widget(GNT_BOX(hbox), combo); |
|
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
582 | |
|
14121
3d8804b82150
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14103
diff
changeset
|
583 | hbox = gnt_hbox_new(TRUE); |
|
3d8804b82150
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14103
diff
changeset
|
584 | gnt_box_set_pad(GNT_BOX(hbox), 0); |
|
14005
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
585 | gnt_box_add_widget(GNT_BOX(window), hbox); |
|
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
586 | |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
24861
diff
changeset
|
587 | dialog->username = entry = gnt_entry_new(NULL); |
|
22942
2bf494f8e2a4
Change the string "screen name" to "username" everywhere. I think most
Mark Doliner <markdoliner@pidgin.im>
parents:
22385
diff
changeset
|
588 | gnt_box_add_widget(GNT_BOX(hbox), gnt_label_new(_("Username:"))); |
|
14005
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
589 | gnt_box_add_widget(GNT_BOX(hbox), entry); |
|
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
590 | |
|
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
591 | /* User splits */ |
|
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
592 | update_user_splits(dialog); |
|
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
593 | gnt_box_add_widget(GNT_BOX(window), dialog->splits); |
|
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
594 | |
|
14121
3d8804b82150
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14103
diff
changeset
|
595 | hbox = gnt_hbox_new(TRUE); |
|
3d8804b82150
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14103
diff
changeset
|
596 | gnt_box_set_pad(GNT_BOX(hbox), 0); |
|
14005
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
597 | gnt_box_add_widget(GNT_BOX(window), hbox); |
|
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
598 | |
|
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
599 | dialog->password = entry = gnt_entry_new(NULL); |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
600 | gnt_entry_set_masked(GNT_ENTRY(entry), TRUE); |
|
14005
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
601 | gnt_box_add_widget(GNT_BOX(hbox), gnt_label_new(_("Password:"))); |
|
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
602 | gnt_box_add_widget(GNT_BOX(hbox), entry); |
|
40680
f9ea6d5e8992
Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
40616
diff
changeset
|
603 | if (account) { |
|
33991
0eb45874d73a
Made more calls asynch, enhanced error checking and reporting.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
23250
diff
changeset
|
604 | gnt_entry_set_text(GNT_ENTRY(entry), password); |
|
40680
f9ea6d5e8992
Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
40616
diff
changeset
|
605 | } |
|
14005
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
606 | |
|
14121
3d8804b82150
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14103
diff
changeset
|
607 | hbox = gnt_hbox_new(TRUE); |
|
3d8804b82150
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14103
diff
changeset
|
608 | gnt_box_set_pad(GNT_BOX(hbox), 0); |
|
14005
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
609 | gnt_box_add_widget(GNT_BOX(window), hbox); |
|
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
610 | |
|
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
611 | dialog->alias = entry = gnt_entry_new(NULL); |
|
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
612 | gnt_box_add_widget(GNT_BOX(hbox), gnt_label_new(_("Alias:"))); |
|
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
613 | gnt_box_add_widget(GNT_BOX(hbox), entry); |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
614 | if (account) |
|
34589
428e92c79631
Renamed purple_account_[get,set]_alias to purple_account[get,set]_private_alias.
Ankit Vani <a@nevitus.org>
parents:
34111
diff
changeset
|
615 | gnt_entry_set_text(GNT_ENTRY(entry), purple_account_get_private_alias(account)); |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
616 | |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
617 | /* User options */ |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
618 | update_user_options(dialog); |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
619 | gnt_box_add_widget(GNT_BOX(window), dialog->remember); |
|
14005
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
620 | |
|
23250
f02a5d93cf17
Allow account registration in a new account dialog.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
621 | /* Register checkbox */ |
|
f02a5d93cf17
Allow account registration in a new account dialog.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
622 | dialog->regserver = gnt_check_box_new(_("Create this account on the server")); |
|
f02a5d93cf17
Allow account registration in a new account dialog.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
623 | gnt_box_add_widget(GNT_BOX(window), dialog->regserver); |
|
f02a5d93cf17
Allow account registration in a new account dialog.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
624 | |
|
14005
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
625 | gnt_box_add_widget(GNT_BOX(window), gnt_line_new(FALSE)); |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
626 | |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
627 | /* The advanced box */ |
|
37038
8832d14d7d0c
Rename 'protocol_options' field of PurpleProtocol to more appropriate 'account_options'
Ankit Vani <a@nevitus.org>
parents:
36782
diff
changeset
|
628 | add_account_options(dialog); |
|
36637
9b0109ae118d
Renamed some prpl stuff to protocol stuff.
Ankit Vani <a@nevitus.org>
parents:
36632
diff
changeset
|
629 | gnt_box_add_widget(GNT_BOX(window), dialog->protocols); |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
630 | |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
631 | /* TODO: Add proxy options */ |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
632 | |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
633 | /* The button box */ |
|
14121
3d8804b82150
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14103
diff
changeset
|
634 | hbox = gnt_hbox_new(FALSE); |
|
14005
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
635 | gnt_box_add_widget(GNT_BOX(window), hbox); |
|
14121
3d8804b82150
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14103
diff
changeset
|
636 | gnt_box_set_alignment(GNT_BOX(hbox), GNT_ALIGN_MID); |
|
14005
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
637 | |
|
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
638 | button = gnt_button_new(_("Cancel")); |
|
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
639 | gnt_box_add_widget(GNT_BOX(hbox), button); |
|
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
640 | g_signal_connect_swapped(G_OBJECT(button), "activate", G_CALLBACK(gnt_widget_destroy), window); |
|
30496
2f0380d2a282
Some updates to the account window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
29106
diff
changeset
|
641 | |
|
14005
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
642 | button = gnt_button_new(_("Save")); |
|
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
643 | gnt_box_add_widget(GNT_BOX(hbox), button); |
|
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
644 | g_signal_connect_swapped(G_OBJECT(button), "activate", G_CALLBACK(save_account_cb), dialog); |
|
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
645 | |
|
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
646 | g_signal_connect_swapped(G_OBJECT(window), "destroy", G_CALLBACK(edit_dialog_destroy), dialog); |
|
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
647 | |
|
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
648 | gnt_widget_show(window); |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
649 | gnt_box_readjust(GNT_BOX(window)); |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
650 | gnt_widget_draw(window); |
|
36659
fbaa6f248ebc
Free the list returned by purple_protocols_get_all()
Ankit Vani <a@nevitus.org>
parents:
36637
diff
changeset
|
651 | |
|
40680
f9ea6d5e8992
Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
40616
diff
changeset
|
652 | g_free(password); |
|
36659
fbaa6f248ebc
Free the list returned by purple_protocols_get_all()
Ankit Vani <a@nevitus.org>
parents:
36637
diff
changeset
|
653 | g_list_free(list); |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
654 | } |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
655 | |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
656 | static void |
|
34065
ad2935f796b4
Clean up Finch account changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34029
diff
changeset
|
657 | edit_account(PurpleAccount *account) |
|
ad2935f796b4
Clean up Finch account changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34029
diff
changeset
|
658 | { |
|
40680
f9ea6d5e8992
Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
40616
diff
changeset
|
659 | PurpleCredentialManager *manager = NULL; |
|
f9ea6d5e8992
Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
40616
diff
changeset
|
660 | |
|
f9ea6d5e8992
Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
40616
diff
changeset
|
661 | manager = purple_credential_manager_get_default(); |
|
f9ea6d5e8992
Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
40616
diff
changeset
|
662 | purple_credential_manager_read_password_async(manager, account, NULL, |
|
f9ea6d5e8992
Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
40616
diff
changeset
|
663 | edit_account_continue, |
|
f9ea6d5e8992
Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
40616
diff
changeset
|
664 | account); |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
665 | } |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
666 | |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
667 | static void |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
668 | add_account_cb(GntWidget *widget, gpointer null) |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
669 | { |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
670 | edit_account(NULL); |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
671 | } |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
672 | |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
673 | static void |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
674 | modify_account_cb(GntWidget *widget, GntTree *tree) |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
675 | { |
| 15884 | 676 | PurpleAccount *account = gnt_tree_get_selection_data(tree); |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
677 | if (!account) |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
678 | return; |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
679 | edit_account(account); |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
680 | } |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
681 | |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
682 | static void |
| 15884 | 683 | really_delete_account(PurpleAccount *account) |
|
14103
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
684 | { |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
685 | GList *iter; |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
686 | for (iter = accountdialogs; iter; iter = iter->next) |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
687 | { |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
688 | AccountEditDialog *dlg = iter->data; |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
689 | if (dlg->account == account) |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
690 | { |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
691 | gnt_widget_destroy(dlg->window); |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
692 | break; |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
693 | } |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
694 | } |
| 15884 | 695 | purple_request_close_with_handle(account); /* Close any other opened delete window */ |
| 696 | purple_accounts_delete(account); | |
|
14103
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
697 | } |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
698 | |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
699 | static void |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
700 | delete_account_cb(GntWidget *widget, GntTree *tree) |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
701 | { |
| 15884 | 702 | PurpleAccount *account; |
|
14103
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
703 | char *prompt; |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
704 | |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
705 | account = gnt_tree_get_selection_data(tree); |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
706 | if (!account) |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
707 | return; |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
708 | |
|
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
709 | prompt = g_strdup_printf(_("Are you sure you want to delete %s?"), |
| 15884 | 710 | purple_account_get_username(account)); |
|
14103
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
711 | |
|
22385
d14ac3ae2007
The Gnome Human Interface Guidelines say, "if pressing this button by
Mark Doliner <markdoliner@pidgin.im>
parents:
22335
diff
changeset
|
712 | purple_request_action(account, _("Delete Account"), prompt, NULL, |
|
34331
c8486462bb63
Request API refactoring: switch purple_request_action to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34304
diff
changeset
|
713 | PURPLE_DEFAULT_ACTION_NONE, |
|
c8486462bb63
Request API refactoring: switch purple_request_action to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34304
diff
changeset
|
714 | purple_request_cpar_from_account(account), account, 2, |
|
c8486462bb63
Request API refactoring: switch purple_request_action to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34304
diff
changeset
|
715 | _("Delete"), really_delete_account, _("Cancel"), NULL); |
|
14103
bcac61d40461
[gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14086
diff
changeset
|
716 | g_free(prompt); |
|
14005
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
717 | } |
|
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
718 | |
|
13969
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
719 | static void |
|
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
720 | account_toggled(GntWidget *widget, void *key, gpointer null) |
|
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
721 | { |
| 15884 | 722 | PurpleAccount *account = key; |
|
26719
314682a2c762
Activate the current status for an account being enabled
Richard Nelson <wabz@pidgin.im>
parents:
26477
diff
changeset
|
723 | gboolean enabled = gnt_tree_get_choice(GNT_TREE(widget), key); |
|
13969
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
724 | |
|
26719
314682a2c762
Activate the current status for an account being enabled
Richard Nelson <wabz@pidgin.im>
parents:
26477
diff
changeset
|
725 | if (enabled) |
|
314682a2c762
Activate the current status for an account being enabled
Richard Nelson <wabz@pidgin.im>
parents:
26477
diff
changeset
|
726 | purple_savedstatus_activate_for_account(purple_savedstatus_get_current(), |
|
314682a2c762
Activate the current status for an account being enabled
Richard Nelson <wabz@pidgin.im>
parents:
26477
diff
changeset
|
727 | account); |
|
314682a2c762
Activate the current status for an account being enabled
Richard Nelson <wabz@pidgin.im>
parents:
26477
diff
changeset
|
728 | |
|
314682a2c762
Activate the current status for an account being enabled
Richard Nelson <wabz@pidgin.im>
parents:
26477
diff
changeset
|
729 | purple_account_set_enabled(account, FINCH_UI, enabled); |
|
13969
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
730 | } |
|
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
731 | |
|
24227
bd2641bf0dec
Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23250
diff
changeset
|
732 | static gboolean |
|
bd2641bf0dec
Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23250
diff
changeset
|
733 | account_list_key_pressed_cb(GntWidget *widget, const char *text, gpointer null) |
|
bd2641bf0dec
Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23250
diff
changeset
|
734 | { |
|
bd2641bf0dec
Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23250
diff
changeset
|
735 | GntTree *tree = GNT_TREE(widget); |
|
bd2641bf0dec
Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23250
diff
changeset
|
736 | PurpleAccount *account = gnt_tree_get_selection_data(tree); |
|
bd2641bf0dec
Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23250
diff
changeset
|
737 | int move, pos, count; |
|
bd2641bf0dec
Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23250
diff
changeset
|
738 | GList *accounts; |
|
bd2641bf0dec
Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23250
diff
changeset
|
739 | |
|
bd2641bf0dec
Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23250
diff
changeset
|
740 | if (!account) |
|
bd2641bf0dec
Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23250
diff
changeset
|
741 | return FALSE; |
|
bd2641bf0dec
Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23250
diff
changeset
|
742 | |
|
bd2641bf0dec
Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23250
diff
changeset
|
743 | switch (text[0]) { |
|
bd2641bf0dec
Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23250
diff
changeset
|
744 | case '-': |
|
bd2641bf0dec
Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23250
diff
changeset
|
745 | move = -1; |
|
bd2641bf0dec
Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23250
diff
changeset
|
746 | break; |
|
bd2641bf0dec
Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23250
diff
changeset
|
747 | case '=': |
|
bd2641bf0dec
Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23250
diff
changeset
|
748 | move = 2; /* XXX: This seems to be a bug in libpurple */ |
|
bd2641bf0dec
Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23250
diff
changeset
|
749 | break; |
|
bd2641bf0dec
Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23250
diff
changeset
|
750 | default: |
|
bd2641bf0dec
Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23250
diff
changeset
|
751 | return FALSE; |
|
bd2641bf0dec
Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23250
diff
changeset
|
752 | } |
|
bd2641bf0dec
Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23250
diff
changeset
|
753 | |
|
bd2641bf0dec
Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23250
diff
changeset
|
754 | accounts = purple_accounts_get_all(); |
|
bd2641bf0dec
Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23250
diff
changeset
|
755 | count = g_list_length(accounts); |
|
bd2641bf0dec
Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23250
diff
changeset
|
756 | pos = g_list_index(accounts, account); |
|
bd2641bf0dec
Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23250
diff
changeset
|
757 | pos = (move + pos + count + 1) % (count + 1); |
|
34304
faf0414a8b51
Fix most of libpurple warnings about -Wsign-compare
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34111
diff
changeset
|
758 | if (pos >= 0) |
|
faf0414a8b51
Fix most of libpurple warnings about -Wsign-compare
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34111
diff
changeset
|
759 | purple_accounts_reorder(account, pos); |
|
24227
bd2641bf0dec
Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23250
diff
changeset
|
760 | |
|
bd2641bf0dec
Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23250
diff
changeset
|
761 | /* I don't like this, but recreating the entire list seems to be |
|
bd2641bf0dec
Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23250
diff
changeset
|
762 | * the easiest way of doing it */ |
|
bd2641bf0dec
Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23250
diff
changeset
|
763 | gnt_tree_remove_all(tree); |
|
bd2641bf0dec
Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23250
diff
changeset
|
764 | accounts = purple_accounts_get_all(); |
|
bd2641bf0dec
Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23250
diff
changeset
|
765 | for (; accounts; accounts = accounts->next) |
|
bd2641bf0dec
Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23250
diff
changeset
|
766 | account_add(accounts->data); |
|
bd2641bf0dec
Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23250
diff
changeset
|
767 | gnt_tree_set_selected(tree, account); |
|
bd2641bf0dec
Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23250
diff
changeset
|
768 | |
|
bd2641bf0dec
Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23250
diff
changeset
|
769 | return TRUE; |
|
bd2641bf0dec
Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23250
diff
changeset
|
770 | } |
|
bd2641bf0dec
Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23250
diff
changeset
|
771 | |
|
14086
732c14687955
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14047
diff
changeset
|
772 | static void |
|
732c14687955
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14047
diff
changeset
|
773 | reset_accounts_win(GntWidget *widget, gpointer null) |
|
732c14687955
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14047
diff
changeset
|
774 | { |
|
732c14687955
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14047
diff
changeset
|
775 | accounts.window = NULL; |
|
732c14687955
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14047
diff
changeset
|
776 | accounts.tree = NULL; |
|
732c14687955
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14047
diff
changeset
|
777 | } |
|
732c14687955
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14047
diff
changeset
|
778 | |
|
15878
f52832b611fe
renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents:
15829
diff
changeset
|
779 | void finch_accounts_show_all() |
|
13969
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
780 | { |
|
18122
9bf9970c1b6a
disapproval of revision '2d8ea56b90971e7851442d96b7d74ecb4f052126'
Richard Laager <rlaager@pidgin.im>
parents:
18121
diff
changeset
|
781 | GList *iter; |
|
13969
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
782 | GntWidget *box, *button; |
|
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
783 | |
|
18400
549820f4725c
If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18273
diff
changeset
|
784 | if (accounts.window) { |
|
549820f4725c
If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18273
diff
changeset
|
785 | gnt_window_present(accounts.window); |
|
14388
15a44e361ac4
[gaim-migrate @ 17021]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
786 | return; |
|
18400
549820f4725c
If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18273
diff
changeset
|
787 | } |
|
14388
15a44e361ac4
[gaim-migrate @ 17021]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
788 | |
|
14121
3d8804b82150
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14103
diff
changeset
|
789 | accounts.window = gnt_vbox_new(FALSE); |
|
13969
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
790 | gnt_box_set_toplevel(GNT_BOX(accounts.window), TRUE); |
|
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
791 | gnt_box_set_title(GNT_BOX(accounts.window), _("Accounts")); |
|
13996
fa46d71780ff
[gaim-migrate @ 16462]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13978
diff
changeset
|
792 | gnt_box_set_pad(GNT_BOX(accounts.window), 0); |
|
14005
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
793 | gnt_box_set_alignment(GNT_BOX(accounts.window), GNT_ALIGN_MID); |
|
13969
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
794 | gnt_widget_set_name(accounts.window, "accounts"); |
|
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
795 | |
|
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
796 | gnt_box_add_widget(GNT_BOX(accounts.window), |
|
13978
70d7030b7f26
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13969
diff
changeset
|
797 | gnt_label_new(_("You can enable/disable accounts from the following list."))); |
|
13969
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
798 | |
|
14005
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
799 | gnt_box_add_widget(GNT_BOX(accounts.window), gnt_line_new(FALSE)); |
|
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
800 | |
|
14026
ad91ce0effe2
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14005
diff
changeset
|
801 | accounts.tree = gnt_tree_new_with_columns(2); |
|
39617
1d0453799f73
Use GntWidget flag accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38358
diff
changeset
|
802 | gnt_widget_set_has_border(accounts.tree, FALSE); |
|
13969
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
803 | |
| 15884 | 804 | for (iter = purple_accounts_get_all(); iter; iter = iter->next) |
|
13969
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
805 | { |
| 15884 | 806 | PurpleAccount *account = iter->data; |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
807 | account_add(account); |
|
13969
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
808 | } |
|
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
809 | |
|
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
810 | g_signal_connect(G_OBJECT(accounts.tree), "toggled", G_CALLBACK(account_toggled), NULL); |
|
24227
bd2641bf0dec
Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23250
diff
changeset
|
811 | g_signal_connect(G_OBJECT(accounts.tree), "key_pressed", G_CALLBACK(account_list_key_pressed_cb), NULL); |
|
22335
f6715418a9a8
Update finch to not touch the internals of PurpleAccount. This also includes a change I made to reduce the Cyclomatic Complexity of one of the functions.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22104
diff
changeset
|
812 | |
|
14026
ad91ce0effe2
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14005
diff
changeset
|
813 | gnt_tree_set_col_width(GNT_TREE(accounts.tree), 0, 40); |
|
ad91ce0effe2
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14005
diff
changeset
|
814 | gnt_tree_set_col_width(GNT_TREE(accounts.tree), 1, 10); |
|
13969
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
815 | gnt_box_add_widget(GNT_BOX(accounts.window), accounts.tree); |
|
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
816 | |
|
14005
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
817 | gnt_box_add_widget(GNT_BOX(accounts.window), gnt_line_new(FALSE)); |
|
198d1658b390
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13996
diff
changeset
|
818 | |
|
14121
3d8804b82150
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14103
diff
changeset
|
819 | box = gnt_hbox_new(FALSE); |
|
13969
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
820 | |
|
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
821 | button = gnt_button_new(_("Add")); |
|
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
822 | gnt_box_add_widget(GNT_BOX(box), button); |
|
18763
7731e1028071
Add utility function to trigger some button when some key is pressed with
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18611
diff
changeset
|
823 | gnt_util_set_trigger_widget(GNT_WIDGET(accounts.tree), GNT_KEY_INS, button); |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
824 | g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(add_account_cb), NULL); |
|
13969
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
825 | |
|
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
826 | button = gnt_button_new(_("Modify")); |
|
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
827 | gnt_box_add_widget(GNT_BOX(box), button); |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
828 | g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(modify_account_cb), accounts.tree); |
|
13969
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
829 | |
|
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
830 | button = gnt_button_new(_("Delete")); |
|
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
831 | gnt_box_add_widget(GNT_BOX(box), button); |
|
18763
7731e1028071
Add utility function to trigger some button when some key is pressed with
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18611
diff
changeset
|
832 | gnt_util_set_trigger_widget(GNT_WIDGET(accounts.tree), GNT_KEY_DEL, button); |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
833 | g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(delete_account_cb), accounts.tree); |
|
22335
f6715418a9a8
Update finch to not touch the internals of PurpleAccount. This also includes a change I made to reduce the Cyclomatic Complexity of one of the functions.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22104
diff
changeset
|
834 | |
|
13969
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
835 | gnt_box_add_widget(GNT_BOX(accounts.window), box); |
|
14086
732c14687955
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14047
diff
changeset
|
836 | |
|
732c14687955
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14047
diff
changeset
|
837 | g_signal_connect(G_OBJECT(accounts.window), "destroy", G_CALLBACK(reset_accounts_win), NULL); |
|
22335
f6715418a9a8
Update finch to not touch the internals of PurpleAccount. This also includes a change I made to reduce the Cyclomatic Complexity of one of the functions.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22104
diff
changeset
|
838 | |
|
13969
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
839 | gnt_widget_show(accounts.window); |
|
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
840 | } |
|
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
841 | |
|
19969
53aca1037b2c
Instead of just notifying the user about a connection error, give him options
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19935
diff
changeset
|
842 | void finch_account_dialog_show(PurpleAccount *account) |
|
53aca1037b2c
Instead of just notifying the user about a connection error, give him options
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19935
diff
changeset
|
843 | { |
|
53aca1037b2c
Instead of just notifying the user about a connection error, give him options
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19935
diff
changeset
|
844 | edit_account(account); |
|
53aca1037b2c
Instead of just notifying the user about a connection error, give him options
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19935
diff
changeset
|
845 | } |
|
53aca1037b2c
Instead of just notifying the user about a connection error, give him options
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19935
diff
changeset
|
846 | |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
847 | static gpointer |
|
22104
56970903b8e9
Probe for -Wstrict-prototypes to get some more warnings. I then cleaned up
Richard Laager <rlaager@pidgin.im>
parents:
21653
diff
changeset
|
848 | finch_accounts_get_handle(void) |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
849 | { |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
850 | static int handle; |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
851 | |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
852 | return &handle; |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
853 | } |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
854 | |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
855 | static void |
| 15884 | 856 | account_added_callback(PurpleAccount *account) |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
857 | { |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
858 | if (accounts.window == NULL) |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
859 | return; |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
860 | account_add(account); |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
861 | gnt_widget_draw(accounts.tree); |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
862 | } |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
863 | |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
864 | static void |
| 15884 | 865 | account_removed_callback(PurpleAccount *account) |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
866 | { |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
867 | if (accounts.window == NULL) |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
868 | return; |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
869 | |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
870 | gnt_tree_remove(GNT_TREE(accounts.tree), account); |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
871 | } |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
872 | |
|
17401
4db9d9d3e928
Finch autoreconnecting (largely copy/paste from pidgin)
Richard Nelson <wabz@pidgin.im>
parents:
17164
diff
changeset
|
873 | static void |
|
4db9d9d3e928
Finch autoreconnecting (largely copy/paste from pidgin)
Richard Nelson <wabz@pidgin.im>
parents:
17164
diff
changeset
|
874 | account_abled_cb(PurpleAccount *account, gpointer user_data) |
|
4db9d9d3e928
Finch autoreconnecting (largely copy/paste from pidgin)
Richard Nelson <wabz@pidgin.im>
parents:
17164
diff
changeset
|
875 | { |
|
4db9d9d3e928
Finch autoreconnecting (largely copy/paste from pidgin)
Richard Nelson <wabz@pidgin.im>
parents:
17164
diff
changeset
|
876 | if (accounts.window == NULL) |
|
4db9d9d3e928
Finch autoreconnecting (largely copy/paste from pidgin)
Richard Nelson <wabz@pidgin.im>
parents:
17164
diff
changeset
|
877 | return; |
|
4db9d9d3e928
Finch autoreconnecting (largely copy/paste from pidgin)
Richard Nelson <wabz@pidgin.im>
parents:
17164
diff
changeset
|
878 | gnt_tree_set_choice(GNT_TREE(accounts.tree), account, |
|
4db9d9d3e928
Finch autoreconnecting (largely copy/paste from pidgin)
Richard Nelson <wabz@pidgin.im>
parents:
17164
diff
changeset
|
879 | GPOINTER_TO_INT(user_data)); |
|
4db9d9d3e928
Finch autoreconnecting (largely copy/paste from pidgin)
Richard Nelson <wabz@pidgin.im>
parents:
17164
diff
changeset
|
880 | } |
|
4db9d9d3e928
Finch autoreconnecting (largely copy/paste from pidgin)
Richard Nelson <wabz@pidgin.im>
parents:
17164
diff
changeset
|
881 | |
|
15878
f52832b611fe
renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents:
15829
diff
changeset
|
882 | void finch_accounts_init() |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
883 | { |
|
18122
9bf9970c1b6a
disapproval of revision '2d8ea56b90971e7851442d96b7d74ecb4f052126'
Richard Laager <rlaager@pidgin.im>
parents:
18121
diff
changeset
|
884 | GList *iter; |
|
14484
68626467b639
[gaim-migrate @ 17130]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14388
diff
changeset
|
885 | |
| 15884 | 886 | purple_signal_connect(purple_accounts_get_handle(), "account-added", |
| 887 | finch_accounts_get_handle(), PURPLE_CALLBACK(account_added_callback), | |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
888 | NULL); |
| 15884 | 889 | purple_signal_connect(purple_accounts_get_handle(), "account-removed", |
| 890 | finch_accounts_get_handle(), PURPLE_CALLBACK(account_removed_callback), | |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
891 | NULL); |
|
17401
4db9d9d3e928
Finch autoreconnecting (largely copy/paste from pidgin)
Richard Nelson <wabz@pidgin.im>
parents:
17164
diff
changeset
|
892 | purple_signal_connect(purple_accounts_get_handle(), "account-disabled", |
|
4db9d9d3e928
Finch autoreconnecting (largely copy/paste from pidgin)
Richard Nelson <wabz@pidgin.im>
parents:
17164
diff
changeset
|
893 | finch_accounts_get_handle(), |
|
4db9d9d3e928
Finch autoreconnecting (largely copy/paste from pidgin)
Richard Nelson <wabz@pidgin.im>
parents:
17164
diff
changeset
|
894 | PURPLE_CALLBACK(account_abled_cb), GINT_TO_POINTER(FALSE)); |
|
4db9d9d3e928
Finch autoreconnecting (largely copy/paste from pidgin)
Richard Nelson <wabz@pidgin.im>
parents:
17164
diff
changeset
|
895 | purple_signal_connect(purple_accounts_get_handle(), "account-enabled", |
|
4db9d9d3e928
Finch autoreconnecting (largely copy/paste from pidgin)
Richard Nelson <wabz@pidgin.im>
parents:
17164
diff
changeset
|
896 | finch_accounts_get_handle(), |
|
4db9d9d3e928
Finch autoreconnecting (largely copy/paste from pidgin)
Richard Nelson <wabz@pidgin.im>
parents:
17164
diff
changeset
|
897 | PURPLE_CALLBACK(account_abled_cb), GINT_TO_POINTER(TRUE)); |
|
4db9d9d3e928
Finch autoreconnecting (largely copy/paste from pidgin)
Richard Nelson <wabz@pidgin.im>
parents:
17164
diff
changeset
|
898 | |
|
17857
bc85241727f8
If there's no account at startup, sohw the 'New Account' dialog too.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17848
diff
changeset
|
899 | iter = purple_accounts_get_all(); |
|
bc85241727f8
If there's no account at startup, sohw the 'New Account' dialog too.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17848
diff
changeset
|
900 | if (iter) { |
| 40044 | 901 | for (; iter; iter = iter->next) { |
| 902 | if (purple_account_get_enabled(iter->data, FINCH_UI)) | |
| 903 | break; | |
| 904 | } | |
| 905 | if (!iter) | |
|
17857
bc85241727f8
If there's no account at startup, sohw the 'New Account' dialog too.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17848
diff
changeset
|
906 | finch_accounts_show_all(); |
|
bc85241727f8
If there's no account at startup, sohw the 'New Account' dialog too.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17848
diff
changeset
|
907 | } else { |
|
bc85241727f8
If there's no account at startup, sohw the 'New Account' dialog too.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17848
diff
changeset
|
908 | edit_account(NULL); |
|
bc85241727f8
If there's no account at startup, sohw the 'New Account' dialog too.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17848
diff
changeset
|
909 | finch_accounts_show_all(); |
|
14484
68626467b639
[gaim-migrate @ 17130]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14388
diff
changeset
|
910 | } |
|
14041
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
911 | } |
|
6afba85cfc30
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14026
diff
changeset
|
912 | |
|
15878
f52832b611fe
renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents:
15829
diff
changeset
|
913 | void finch_accounts_uninit() |
|
13969
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
914 | { |
|
14086
732c14687955
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14047
diff
changeset
|
915 | if (accounts.window) |
|
732c14687955
[gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14047
diff
changeset
|
916 | gnt_widget_destroy(accounts.window); |
|
13969
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
917 | } |
|
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
918 | |
|
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
919 | /* The following uiops stuff are copied from gtkaccount.c */ |
|
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
920 | typedef struct |
|
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
921 | { |
| 15884 | 922 | PurpleAccount *account; |
|
13969
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
923 | char *username; |
|
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
924 | char *alias; |
|
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
925 | } AddUserData; |
|
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
926 | |
|
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
927 | static char * |
| 15884 | 928 | make_info(PurpleAccount *account, PurpleConnection *gc, const char *remote_user, |
|
13969
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
929 | const char *id, const char *alias, const char *msg) |
|
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
930 | { |
|
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
931 | if (msg != NULL && *msg == '\0') |
|
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
932 | msg = NULL; |
|
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
933 | |
|
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
934 | return g_strdup_printf(_("%s%s%s%s has made %s his or her buddy%s%s"), |
|
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
935 | remote_user, |
|
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
936 | (alias != NULL ? " (" : ""), |
|
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
937 | (alias != NULL ? alias : ""), |
|
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
938 | (alias != NULL ? ")" : ""), |
|
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
939 | (id != NULL |
|
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
940 | ? id |
| 15884 | 941 | : (purple_connection_get_display_name(gc) != NULL |
| 942 | ? purple_connection_get_display_name(gc) | |
| 943 | : purple_account_get_username(account))), | |
|
13969
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
944 | (msg != NULL ? ": " : "."), |
|
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
945 | (msg != NULL ? msg : "")); |
|
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
946 | } |
|
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
947 | |
|
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
948 | static void |
| 15884 | 949 | notify_added(PurpleAccount *account, const char *remote_user, |
|
13969
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
950 | const char *id, const char *alias, |
|
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
951 | const char *msg) |
|
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
952 | { |
|
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
953 | char *buffer; |
| 15884 | 954 | PurpleConnection *gc; |
|
13969
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
955 | |
| 15884 | 956 | gc = purple_account_get_connection(account); |
|
13969
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
957 | |
|
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
958 | buffer = make_info(account, gc, remote_user, id, alias, msg); |
|
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
959 | |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34331
diff
changeset
|
960 | purple_notify_info(NULL, NULL, buffer, NULL, |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34331
diff
changeset
|
961 | purple_request_cpar_from_connection(gc)); |
|
13969
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
962 | |
|
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
963 | g_free(buffer); |
|
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
964 | } |
|
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
965 | |
|
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
966 | static void |
|
14047
764a70ebfdc5
[gaim-migrate @ 16555]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14042
diff
changeset
|
967 | free_add_user_data(AddUserData *data) |
|
764a70ebfdc5
[gaim-migrate @ 16555]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14042
diff
changeset
|
968 | { |
|
764a70ebfdc5
[gaim-migrate @ 16555]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14042
diff
changeset
|
969 | g_free(data->username); |
|
764a70ebfdc5
[gaim-migrate @ 16555]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14042
diff
changeset
|
970 | |
|
37426
6fd4989b77e4
The last of the NULL-checks before free()
Michael McConville <mmcco@mykolab.com>
parents:
37144
diff
changeset
|
971 | g_free(data->alias); |
|
14047
764a70ebfdc5
[gaim-migrate @ 16555]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14042
diff
changeset
|
972 | |
|
764a70ebfdc5
[gaim-migrate @ 16555]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14042
diff
changeset
|
973 | g_free(data); |
|
764a70ebfdc5
[gaim-migrate @ 16555]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14042
diff
changeset
|
974 | } |
|
764a70ebfdc5
[gaim-migrate @ 16555]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14042
diff
changeset
|
975 | |
|
764a70ebfdc5
[gaim-migrate @ 16555]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14042
diff
changeset
|
976 | static void |
|
764a70ebfdc5
[gaim-migrate @ 16555]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14042
diff
changeset
|
977 | add_user_cb(AddUserData *data) |
|
764a70ebfdc5
[gaim-migrate @ 16555]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14042
diff
changeset
|
978 | { |
| 15884 | 979 | PurpleConnection *gc = purple_account_get_connection(data->account); |
|
14047
764a70ebfdc5
[gaim-migrate @ 16555]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14042
diff
changeset
|
980 | |
|
18122
9bf9970c1b6a
disapproval of revision '2d8ea56b90971e7851442d96b7d74ecb4f052126'
Richard Laager <rlaager@pidgin.im>
parents:
18121
diff
changeset
|
981 | if (g_list_find(purple_connections_get_all(), gc)) |
|
14047
764a70ebfdc5
[gaim-migrate @ 16555]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14042
diff
changeset
|
982 | { |
| 15884 | 983 | purple_blist_request_add_buddy(data->account, data->username, |
|
14047
764a70ebfdc5
[gaim-migrate @ 16555]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14042
diff
changeset
|
984 | NULL, data->alias); |
|
764a70ebfdc5
[gaim-migrate @ 16555]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14042
diff
changeset
|
985 | } |
|
764a70ebfdc5
[gaim-migrate @ 16555]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14042
diff
changeset
|
986 | |
|
764a70ebfdc5
[gaim-migrate @ 16555]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14042
diff
changeset
|
987 | free_add_user_data(data); |
|
764a70ebfdc5
[gaim-migrate @ 16555]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14042
diff
changeset
|
988 | } |
|
764a70ebfdc5
[gaim-migrate @ 16555]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14042
diff
changeset
|
989 | |
|
764a70ebfdc5
[gaim-migrate @ 16555]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14042
diff
changeset
|
990 | static void |
| 15884 | 991 | request_add(PurpleAccount *account, const char *remote_user, |
|
13969
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
992 | const char *id, const char *alias, |
|
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
993 | const char *msg) |
|
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
994 | { |
|
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
995 | char *buffer; |
| 15884 | 996 | PurpleConnection *gc; |
|
13969
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
997 | AddUserData *data; |
|
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
998 | |
| 15884 | 999 | gc = purple_account_get_connection(account); |
|
13969
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1000 | |
|
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1001 | data = g_new0(AddUserData, 1); |
|
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1002 | data->account = account; |
|
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1003 | data->username = g_strdup(remote_user); |
|
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1004 | data->alias = (alias != NULL ? g_strdup(alias) : NULL); |
|
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1005 | |
|
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1006 | buffer = make_info(account, gc, remote_user, id, alias, msg); |
|
34331
c8486462bb63
Request API refactoring: switch purple_request_action to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34304
diff
changeset
|
1007 | purple_request_action(NULL, NULL, _("Add buddy to your list?"), buffer, |
|
c8486462bb63
Request API refactoring: switch purple_request_action to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34304
diff
changeset
|
1008 | PURPLE_DEFAULT_ACTION_NONE, |
|
c8486462bb63
Request API refactoring: switch purple_request_action to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34304
diff
changeset
|
1009 | purple_request_cpar_from_account(account), data, 2, |
|
c8486462bb63
Request API refactoring: switch purple_request_action to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34304
diff
changeset
|
1010 | _("Add"), G_CALLBACK(add_user_cb), |
|
c8486462bb63
Request API refactoring: switch purple_request_action to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34304
diff
changeset
|
1011 | _("Cancel"), G_CALLBACK(free_add_user_data)); |
|
13969
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1012 | g_free(buffer); |
|
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1013 | } |
|
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1014 | |
|
15829
ee5af14dc815
Add request_authorize to gaim-text's account ui ops
Richard Nelson <wabz@pidgin.im>
parents:
15781
diff
changeset
|
1015 | /* Copied from gtkaccount.c */ |
|
ee5af14dc815
Add request_authorize to gaim-text's account ui ops
Richard Nelson <wabz@pidgin.im>
parents:
15781
diff
changeset
|
1016 | typedef struct { |
| 15884 | 1017 | PurpleAccountRequestAuthorizationCb auth_cb; |
| 1018 | PurpleAccountRequestAuthorizationCb deny_cb; | |
|
15829
ee5af14dc815
Add request_authorize to gaim-text's account ui ops
Richard Nelson <wabz@pidgin.im>
parents:
15781
diff
changeset
|
1019 | void *data; |
|
ee5af14dc815
Add request_authorize to gaim-text's account ui ops
Richard Nelson <wabz@pidgin.im>
parents:
15781
diff
changeset
|
1020 | char *username; |
|
ee5af14dc815
Add request_authorize to gaim-text's account ui ops
Richard Nelson <wabz@pidgin.im>
parents:
15781
diff
changeset
|
1021 | char *alias; |
| 15884 | 1022 | PurpleAccount *account; |
|
15829
ee5af14dc815
Add request_authorize to gaim-text's account ui ops
Richard Nelson <wabz@pidgin.im>
parents:
15781
diff
changeset
|
1023 | } auth_and_add; |
|
ee5af14dc815
Add request_authorize to gaim-text's account ui ops
Richard Nelson <wabz@pidgin.im>
parents:
15781
diff
changeset
|
1024 | |
|
ee5af14dc815
Add request_authorize to gaim-text's account ui ops
Richard Nelson <wabz@pidgin.im>
parents:
15781
diff
changeset
|
1025 | static void |
|
17845
8ac5337e8f6d
Show information about the user requesting authorization.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17164
diff
changeset
|
1026 | free_auth_and_add(auth_and_add *aa) |
|
15829
ee5af14dc815
Add request_authorize to gaim-text's account ui ops
Richard Nelson <wabz@pidgin.im>
parents:
15781
diff
changeset
|
1027 | { |
|
ee5af14dc815
Add request_authorize to gaim-text's account ui ops
Richard Nelson <wabz@pidgin.im>
parents:
15781
diff
changeset
|
1028 | g_free(aa->username); |
|
ee5af14dc815
Add request_authorize to gaim-text's account ui ops
Richard Nelson <wabz@pidgin.im>
parents:
15781
diff
changeset
|
1029 | g_free(aa->alias); |
|
ee5af14dc815
Add request_authorize to gaim-text's account ui ops
Richard Nelson <wabz@pidgin.im>
parents:
15781
diff
changeset
|
1030 | g_free(aa); |
|
ee5af14dc815
Add request_authorize to gaim-text's account ui ops
Richard Nelson <wabz@pidgin.im>
parents:
15781
diff
changeset
|
1031 | } |
|
ee5af14dc815
Add request_authorize to gaim-text's account ui ops
Richard Nelson <wabz@pidgin.im>
parents:
15781
diff
changeset
|
1032 | |
|
ee5af14dc815
Add request_authorize to gaim-text's account ui ops
Richard Nelson <wabz@pidgin.im>
parents:
15781
diff
changeset
|
1033 | static void |
|
17845
8ac5337e8f6d
Show information about the user requesting authorization.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17164
diff
changeset
|
1034 | authorize_and_add_cb(auth_and_add *aa) |
|
8ac5337e8f6d
Show information about the user requesting authorization.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17164
diff
changeset
|
1035 | { |
|
33687
0819d40769c8
Add a message to the authorization callbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31294
diff
changeset
|
1036 | aa->auth_cb(NULL, aa->data); |
|
17845
8ac5337e8f6d
Show information about the user requesting authorization.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17164
diff
changeset
|
1037 | purple_blist_request_add_buddy(aa->account, aa->username, |
|
8ac5337e8f6d
Show information about the user requesting authorization.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17164
diff
changeset
|
1038 | NULL, aa->alias); |
|
8ac5337e8f6d
Show information about the user requesting authorization.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17164
diff
changeset
|
1039 | } |
|
8ac5337e8f6d
Show information about the user requesting authorization.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17164
diff
changeset
|
1040 | |
|
8ac5337e8f6d
Show information about the user requesting authorization.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17164
diff
changeset
|
1041 | static void |
|
15829
ee5af14dc815
Add request_authorize to gaim-text's account ui ops
Richard Nelson <wabz@pidgin.im>
parents:
15781
diff
changeset
|
1042 | deny_no_add_cb(auth_and_add *aa) |
|
ee5af14dc815
Add request_authorize to gaim-text's account ui ops
Richard Nelson <wabz@pidgin.im>
parents:
15781
diff
changeset
|
1043 | { |
|
33687
0819d40769c8
Add a message to the authorization callbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31294
diff
changeset
|
1044 | aa->deny_cb(NULL, aa->data); |
|
15829
ee5af14dc815
Add request_authorize to gaim-text's account ui ops
Richard Nelson <wabz@pidgin.im>
parents:
15781
diff
changeset
|
1045 | } |
|
ee5af14dc815
Add request_authorize to gaim-text's account ui ops
Richard Nelson <wabz@pidgin.im>
parents:
15781
diff
changeset
|
1046 | |
|
ee5af14dc815
Add request_authorize to gaim-text's account ui ops
Richard Nelson <wabz@pidgin.im>
parents:
15781
diff
changeset
|
1047 | static void * |
|
19125
d92cd58cc6ba
Correct the types of the authorize_cb and deny_cb parameters of
Will Thompson <resiak@pidgin.im>
parents:
18768
diff
changeset
|
1048 | finch_request_authorize(PurpleAccount *account, |
|
d92cd58cc6ba
Correct the types of the authorize_cb and deny_cb parameters of
Will Thompson <resiak@pidgin.im>
parents:
18768
diff
changeset
|
1049 | const char *remote_user, |
|
d92cd58cc6ba
Correct the types of the authorize_cb and deny_cb parameters of
Will Thompson <resiak@pidgin.im>
parents:
18768
diff
changeset
|
1050 | const char *id, |
|
d92cd58cc6ba
Correct the types of the authorize_cb and deny_cb parameters of
Will Thompson <resiak@pidgin.im>
parents:
18768
diff
changeset
|
1051 | const char *alias, |
|
d92cd58cc6ba
Correct the types of the authorize_cb and deny_cb parameters of
Will Thompson <resiak@pidgin.im>
parents:
18768
diff
changeset
|
1052 | const char *message, |
|
d92cd58cc6ba
Correct the types of the authorize_cb and deny_cb parameters of
Will Thompson <resiak@pidgin.im>
parents:
18768
diff
changeset
|
1053 | gboolean on_list, |
|
d92cd58cc6ba
Correct the types of the authorize_cb and deny_cb parameters of
Will Thompson <resiak@pidgin.im>
parents:
18768
diff
changeset
|
1054 | PurpleAccountRequestAuthorizationCb auth_cb, |
|
d92cd58cc6ba
Correct the types of the authorize_cb and deny_cb parameters of
Will Thompson <resiak@pidgin.im>
parents:
18768
diff
changeset
|
1055 | PurpleAccountRequestAuthorizationCb deny_cb, |
|
d92cd58cc6ba
Correct the types of the authorize_cb and deny_cb parameters of
Will Thompson <resiak@pidgin.im>
parents:
18768
diff
changeset
|
1056 | void *user_data) |
|
15829
ee5af14dc815
Add request_authorize to gaim-text's account ui ops
Richard Nelson <wabz@pidgin.im>
parents:
15781
diff
changeset
|
1057 | { |
|
ee5af14dc815
Add request_authorize to gaim-text's account ui ops
Richard Nelson <wabz@pidgin.im>
parents:
15781
diff
changeset
|
1058 | char *buffer; |
| 15884 | 1059 | PurpleConnection *gc; |
|
15829
ee5af14dc815
Add request_authorize to gaim-text's account ui ops
Richard Nelson <wabz@pidgin.im>
parents:
15781
diff
changeset
|
1060 | void *uihandle; |
|
ee5af14dc815
Add request_authorize to gaim-text's account ui ops
Richard Nelson <wabz@pidgin.im>
parents:
15781
diff
changeset
|
1061 | |
| 15884 | 1062 | gc = purple_account_get_connection(account); |
|
15829
ee5af14dc815
Add request_authorize to gaim-text's account ui ops
Richard Nelson <wabz@pidgin.im>
parents:
15781
diff
changeset
|
1063 | if (message != NULL && *message == '\0') |
|
ee5af14dc815
Add request_authorize to gaim-text's account ui ops
Richard Nelson <wabz@pidgin.im>
parents:
15781
diff
changeset
|
1064 | message = NULL; |
|
ee5af14dc815
Add request_authorize to gaim-text's account ui ops
Richard Nelson <wabz@pidgin.im>
parents:
15781
diff
changeset
|
1065 | |
|
18768
c8ae7c5d1ad0
I changed a string during a string freeze\! Sorry\!
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18763
diff
changeset
|
1066 | buffer = g_strdup_printf(_("%s%s%s%s wants to add %s to his or her buddy list%s%s"), |
|
15829
ee5af14dc815
Add request_authorize to gaim-text's account ui ops
Richard Nelson <wabz@pidgin.im>
parents:
15781
diff
changeset
|
1067 | remote_user, |
|
ee5af14dc815
Add request_authorize to gaim-text's account ui ops
Richard Nelson <wabz@pidgin.im>
parents:
15781
diff
changeset
|
1068 | (alias != NULL ? " (" : ""), |
|
ee5af14dc815
Add request_authorize to gaim-text's account ui ops
Richard Nelson <wabz@pidgin.im>
parents:
15781
diff
changeset
|
1069 | (alias != NULL ? alias : ""), |
|
ee5af14dc815
Add request_authorize to gaim-text's account ui ops
Richard Nelson <wabz@pidgin.im>
parents:
15781
diff
changeset
|
1070 | (alias != NULL ? ")" : ""), |
|
ee5af14dc815
Add request_authorize to gaim-text's account ui ops
Richard Nelson <wabz@pidgin.im>
parents:
15781
diff
changeset
|
1071 | (id != NULL |
|
ee5af14dc815
Add request_authorize to gaim-text's account ui ops
Richard Nelson <wabz@pidgin.im>
parents:
15781
diff
changeset
|
1072 | ? id |
| 15884 | 1073 | : (purple_connection_get_display_name(gc) != NULL |
| 1074 | ? purple_connection_get_display_name(gc) | |
| 1075 | : purple_account_get_username(account))), | |
|
18768
c8ae7c5d1ad0
I changed a string during a string freeze\! Sorry\!
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18763
diff
changeset
|
1076 | (message != NULL ? ": " : "."), |
|
15829
ee5af14dc815
Add request_authorize to gaim-text's account ui ops
Richard Nelson <wabz@pidgin.im>
parents:
15781
diff
changeset
|
1077 | (message != NULL ? message : "")); |
|
ee5af14dc815
Add request_authorize to gaim-text's account ui ops
Richard Nelson <wabz@pidgin.im>
parents:
15781
diff
changeset
|
1078 | if (!on_list) { |
|
17846
e8ee63f71029
Remove the confusing 'OK' button from the auth dialog.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17845
diff
changeset
|
1079 | GntWidget *widget; |
|
e8ee63f71029
Remove the confusing 'OK' button from the auth dialog.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17845
diff
changeset
|
1080 | GList *iter; |
|
15829
ee5af14dc815
Add request_authorize to gaim-text's account ui ops
Richard Nelson <wabz@pidgin.im>
parents:
15781
diff
changeset
|
1081 | auth_and_add *aa = g_new(auth_and_add, 1); |
|
17846
e8ee63f71029
Remove the confusing 'OK' button from the auth dialog.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17845
diff
changeset
|
1082 | |
|
19125
d92cd58cc6ba
Correct the types of the authorize_cb and deny_cb parameters of
Will Thompson <resiak@pidgin.im>
parents:
18768
diff
changeset
|
1083 | aa->auth_cb = auth_cb; |
|
d92cd58cc6ba
Correct the types of the authorize_cb and deny_cb parameters of
Will Thompson <resiak@pidgin.im>
parents:
18768
diff
changeset
|
1084 | aa->deny_cb = deny_cb; |
|
15829
ee5af14dc815
Add request_authorize to gaim-text's account ui ops
Richard Nelson <wabz@pidgin.im>
parents:
15781
diff
changeset
|
1085 | aa->data = user_data; |
|
ee5af14dc815
Add request_authorize to gaim-text's account ui ops
Richard Nelson <wabz@pidgin.im>
parents:
15781
diff
changeset
|
1086 | aa->username = g_strdup(remote_user); |
|
ee5af14dc815
Add request_authorize to gaim-text's account ui ops
Richard Nelson <wabz@pidgin.im>
parents:
15781
diff
changeset
|
1087 | aa->alias = g_strdup(alias); |
|
ee5af14dc815
Add request_authorize to gaim-text's account ui ops
Richard Nelson <wabz@pidgin.im>
parents:
15781
diff
changeset
|
1088 | aa->account = account; |
|
17845
8ac5337e8f6d
Show information about the user requesting authorization.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17164
diff
changeset
|
1089 | |
|
8ac5337e8f6d
Show information about the user requesting authorization.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17164
diff
changeset
|
1090 | uihandle = gnt_vwindow_new(FALSE); |
|
8ac5337e8f6d
Show information about the user requesting authorization.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17164
diff
changeset
|
1091 | gnt_box_set_title(GNT_BOX(uihandle), _("Authorize buddy?")); |
|
8ac5337e8f6d
Show information about the user requesting authorization.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17164
diff
changeset
|
1092 | gnt_box_set_pad(GNT_BOX(uihandle), 0); |
|
8ac5337e8f6d
Show information about the user requesting authorization.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17164
diff
changeset
|
1093 | |
|
21653
621c47778132
merge of '73ae9aeda3c58fbf8437421da68d19d06f93e686'
Evan Schoenberg <evands@pidgin.im>
parents:
21233
diff
changeset
|
1094 | widget = purple_request_action(NULL, _("Authorize buddy?"), buffer, NULL, |
|
16490
68c22924d66b
Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evands@pidgin.im>
parents:
16255
diff
changeset
|
1095 | PURPLE_DEFAULT_ACTION_NONE, |
|
34331
c8486462bb63
Request API refactoring: switch purple_request_action to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34304
diff
changeset
|
1096 | purple_request_cpar_from_account(account), |
|
21653
621c47778132
merge of '73ae9aeda3c58fbf8437421da68d19d06f93e686'
Evan Schoenberg <evands@pidgin.im>
parents:
21233
diff
changeset
|
1097 | aa, 2, |
|
15829
ee5af14dc815
Add request_authorize to gaim-text's account ui ops
Richard Nelson <wabz@pidgin.im>
parents:
15781
diff
changeset
|
1098 | _("Authorize"), authorize_and_add_cb, |
|
ee5af14dc815
Add request_authorize to gaim-text's account ui ops
Richard Nelson <wabz@pidgin.im>
parents:
15781
diff
changeset
|
1099 | _("Deny"), deny_no_add_cb); |
|
39626
2125ea5c434f
Avoid using internal gnt_screen_release.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39624
diff
changeset
|
1100 | /* Since GntWindow is a GntBox, hide it so it's unmapped, then |
|
2125ea5c434f
Avoid using internal gnt_screen_release.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39624
diff
changeset
|
1101 | * add it to the outer window, and make it visible again. */ |
|
2125ea5c434f
Avoid using internal gnt_screen_release.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39624
diff
changeset
|
1102 | gnt_widget_hide(widget); |
|
17845
8ac5337e8f6d
Show information about the user requesting authorization.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17164
diff
changeset
|
1103 | gnt_box_set_toplevel(GNT_BOX(widget), FALSE); |
|
8ac5337e8f6d
Show information about the user requesting authorization.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17164
diff
changeset
|
1104 | gnt_box_add_widget(GNT_BOX(uihandle), widget); |
|
39626
2125ea5c434f
Avoid using internal gnt_screen_release.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39624
diff
changeset
|
1105 | gnt_widget_set_visible(widget, TRUE); |
|
17845
8ac5337e8f6d
Show information about the user requesting authorization.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17164
diff
changeset
|
1106 | |
|
8ac5337e8f6d
Show information about the user requesting authorization.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17164
diff
changeset
|
1107 | gnt_box_add_widget(GNT_BOX(uihandle), gnt_hline_new()); |
|
8ac5337e8f6d
Show information about the user requesting authorization.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17164
diff
changeset
|
1108 | |
|
22335
f6715418a9a8
Update finch to not touch the internals of PurpleAccount. This also includes a change I made to reduce the Cyclomatic Complexity of one of the functions.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22104
diff
changeset
|
1109 | widget = finch_retrieve_user_info(purple_account_get_connection(account), remote_user); |
|
39624
bf90c71a9893
Use new gnt_box_get_children.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39617
diff
changeset
|
1110 | for (iter = gnt_box_get_children(GNT_BOX(widget)); iter; |
|
bf90c71a9893
Use new gnt_box_get_children.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39617
diff
changeset
|
1111 | iter = g_list_delete_link(iter, iter)) { |
|
17846
e8ee63f71029
Remove the confusing 'OK' button from the auth dialog.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17845
diff
changeset
|
1112 | if (GNT_IS_BUTTON(iter->data)) { |
|
e8ee63f71029
Remove the confusing 'OK' button from the auth dialog.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17845
diff
changeset
|
1113 | gnt_widget_destroy(iter->data); |
|
e8ee63f71029
Remove the confusing 'OK' button from the auth dialog.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17845
diff
changeset
|
1114 | gnt_box_remove(GNT_BOX(widget), iter->data); |
|
39624
bf90c71a9893
Use new gnt_box_get_children.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39617
diff
changeset
|
1115 | g_list_free(iter); |
|
17846
e8ee63f71029
Remove the confusing 'OK' button from the auth dialog.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17845
diff
changeset
|
1116 | break; |
|
e8ee63f71029
Remove the confusing 'OK' button from the auth dialog.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17845
diff
changeset
|
1117 | } |
|
e8ee63f71029
Remove the confusing 'OK' button from the auth dialog.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17845
diff
changeset
|
1118 | } |
|
39626
2125ea5c434f
Avoid using internal gnt_screen_release.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39624
diff
changeset
|
1119 | /* Since GntWindow is a GntBox, hide it so it's unmapped, then |
|
2125ea5c434f
Avoid using internal gnt_screen_release.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39624
diff
changeset
|
1120 | * add it to the outer window, and make it visible again. */ |
|
2125ea5c434f
Avoid using internal gnt_screen_release.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39624
diff
changeset
|
1121 | gnt_widget_hide(widget); |
|
17845
8ac5337e8f6d
Show information about the user requesting authorization.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17164
diff
changeset
|
1122 | gnt_box_set_toplevel(GNT_BOX(widget), FALSE); |
|
8ac5337e8f6d
Show information about the user requesting authorization.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17164
diff
changeset
|
1123 | gnt_box_add_widget(GNT_BOX(uihandle), widget); |
|
39626
2125ea5c434f
Avoid using internal gnt_screen_release.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39624
diff
changeset
|
1124 | gnt_widget_set_visible(widget, TRUE); |
|
2125ea5c434f
Avoid using internal gnt_screen_release.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39624
diff
changeset
|
1125 | |
|
17845
8ac5337e8f6d
Show information about the user requesting authorization.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17164
diff
changeset
|
1126 | gnt_widget_show(uihandle); |
|
8ac5337e8f6d
Show information about the user requesting authorization.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17164
diff
changeset
|
1127 | |
|
8ac5337e8f6d
Show information about the user requesting authorization.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17164
diff
changeset
|
1128 | g_signal_connect_swapped(G_OBJECT(uihandle), "destroy", G_CALLBACK(free_auth_and_add), aa); |
|
15829
ee5af14dc815
Add request_authorize to gaim-text's account ui ops
Richard Nelson <wabz@pidgin.im>
parents:
15781
diff
changeset
|
1129 | } else { |
|
21653
621c47778132
merge of '73ae9aeda3c58fbf8437421da68d19d06f93e686'
Evan Schoenberg <evands@pidgin.im>
parents:
21233
diff
changeset
|
1130 | uihandle = purple_request_action(NULL, _("Authorize buddy?"), buffer, NULL, |
|
16490
68c22924d66b
Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evands@pidgin.im>
parents:
16255
diff
changeset
|
1131 | PURPLE_DEFAULT_ACTION_NONE, |
|
34331
c8486462bb63
Request API refactoring: switch purple_request_action to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34304
diff
changeset
|
1132 | purple_request_cpar_from_account(account), |
|
21653
621c47778132
merge of '73ae9aeda3c58fbf8437421da68d19d06f93e686'
Evan Schoenberg <evands@pidgin.im>
parents:
21233
diff
changeset
|
1133 | user_data, 2, |
|
15829
ee5af14dc815
Add request_authorize to gaim-text's account ui ops
Richard Nelson <wabz@pidgin.im>
parents:
15781
diff
changeset
|
1134 | _("Authorize"), auth_cb, |
|
ee5af14dc815
Add request_authorize to gaim-text's account ui ops
Richard Nelson <wabz@pidgin.im>
parents:
15781
diff
changeset
|
1135 | _("Deny"), deny_cb); |
|
ee5af14dc815
Add request_authorize to gaim-text's account ui ops
Richard Nelson <wabz@pidgin.im>
parents:
15781
diff
changeset
|
1136 | } |
|
24861
482524bb3e81
A patch to clean up authorization request related stuff. Fixes #7695.
Paul Aurich <darkrain42@pidgin.im>
parents:
24250
diff
changeset
|
1137 | g_signal_connect(G_OBJECT(uihandle), "destroy", |
|
482524bb3e81
A patch to clean up authorization request related stuff. Fixes #7695.
Paul Aurich <darkrain42@pidgin.im>
parents:
24250
diff
changeset
|
1138 | G_CALLBACK(purple_account_request_close), NULL); |
|
15829
ee5af14dc815
Add request_authorize to gaim-text's account ui ops
Richard Nelson <wabz@pidgin.im>
parents:
15781
diff
changeset
|
1139 | g_free(buffer); |
|
ee5af14dc815
Add request_authorize to gaim-text's account ui ops
Richard Nelson <wabz@pidgin.im>
parents:
15781
diff
changeset
|
1140 | return uihandle; |
|
ee5af14dc815
Add request_authorize to gaim-text's account ui ops
Richard Nelson <wabz@pidgin.im>
parents:
15781
diff
changeset
|
1141 | } |
|
ee5af14dc815
Add request_authorize to gaim-text's account ui ops
Richard Nelson <wabz@pidgin.im>
parents:
15781
diff
changeset
|
1142 | |
|
ee5af14dc815
Add request_authorize to gaim-text's account ui ops
Richard Nelson <wabz@pidgin.im>
parents:
15781
diff
changeset
|
1143 | static void |
|
15878
f52832b611fe
renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents:
15829
diff
changeset
|
1144 | finch_request_close(void *uihandle) |
|
15829
ee5af14dc815
Add request_authorize to gaim-text's account ui ops
Richard Nelson <wabz@pidgin.im>
parents:
15781
diff
changeset
|
1145 | { |
| 15884 | 1146 | purple_request_close(PURPLE_REQUEST_ACTION, uihandle); |
|
15829
ee5af14dc815
Add request_authorize to gaim-text's account ui ops
Richard Nelson <wabz@pidgin.im>
parents:
15781
diff
changeset
|
1147 | } |
|
ee5af14dc815
Add request_authorize to gaim-text's account ui ops
Richard Nelson <wabz@pidgin.im>
parents:
15781
diff
changeset
|
1148 | |
| 15884 | 1149 | static PurpleAccountUiOps ui_ops = |
|
13969
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1150 | { |
|
17164
3a005b9e8f28
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@pidgin.im>
parents:
16509
diff
changeset
|
1151 | notify_added, |
|
3a005b9e8f28
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@pidgin.im>
parents:
16509
diff
changeset
|
1152 | NULL, |
|
3a005b9e8f28
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@pidgin.im>
parents:
16509
diff
changeset
|
1153 | request_add, |
|
3a005b9e8f28
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@pidgin.im>
parents:
16509
diff
changeset
|
1154 | finch_request_authorize, |
|
3a005b9e8f28
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@pidgin.im>
parents:
16509
diff
changeset
|
1155 | finch_request_close, |
|
3a005b9e8f28
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@pidgin.im>
parents:
16509
diff
changeset
|
1156 | NULL, |
|
3a005b9e8f28
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@pidgin.im>
parents:
16509
diff
changeset
|
1157 | NULL, |
|
3a005b9e8f28
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@pidgin.im>
parents:
16509
diff
changeset
|
1158 | NULL, |
|
34592
ad74ae1c924c
Added NULL account UI ops for privacy functions in finch
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1159 | NULL, |
|
ad74ae1c924c
Added NULL account UI ops for privacy functions in finch
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1160 | NULL, NULL, NULL, NULL |
|
13969
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1161 | }; |
|
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1162 | |
| 15884 | 1163 | PurpleAccountUiOps *finch_accounts_get_ui_ops() |
|
13969
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1164 | { |
|
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1165 | return &ui_ops; |
|
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1166 | } |
|
0541f389442e
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1167 |