finch/gntaccount.c

Tue, 04 Oct 2022 02:23:44 -0500

author
Gary Kramlich <grim@reaperworld.com>
date
Tue, 04 Oct 2022 02:23:44 -0500
changeset 41778
ef805454a45a
parent 41517
5bafe75d3907
child 41797
3bc9948e9f3c
permissions
-rw-r--r--

Add a require password option to the finch account editor

Testing Done:
Toggled the option in the editor saved and verified that `accounts.xml` showed the change and that the editor opened with the current setting.

Bugs closed: PIDGIN-17690

Reviewed at https://reviews.imfreedom.org/r/1879/

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
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
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;
41778
ef805454a45a Add a require password option to the finch account editor
Gary Kramlich <grim@reaperworld.com>
parents: 41517
diff changeset
51 GntWidget *require_password;
14005
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
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
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
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
72 purple_account_get_username(account),
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
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,
41392
b5c84f55d5d2 Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
76 purple_account_get_enabled(account));
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
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
91 PurpleAccount *account;
36544
1bf8b6ef5aea Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents: 36384
diff changeset
92 PurpleProtocol *protocol;
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
93 const char *value;
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
94 GString *username;
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
95
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
96 /* XXX: Do some error checking first. */
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
97
36544
1bf8b6ef5aea Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents: 36384
diff changeset
98 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
99
25889
26d9ca30335c Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents: 24861
diff changeset
100 /* 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
101 value = gnt_entry_get_text(GNT_ENTRY(dialog->username));
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
102
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
103 if (value == NULL || *value == '\0')
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
104 {
30496
2f0380d2a282 Some updates to the account window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 29106
diff changeset
105 purple_notify_error(NULL, _("Error"),
34449
bbcb198650b7 Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34331
diff changeset
106 dialog->account ? _("Account was not modified") :
bbcb198650b7 Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34331
diff changeset
107 _("Account was not added"),
bbcb198650b7 Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34331
diff changeset
108 _("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
109 purple_request_cpar_from_account(dialog->account));
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
110 return;
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
111 }
23250
f02a5d93cf17 Allow account registration in a new account dialog.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
112
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
113 username = g_string_new(value);
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
114
36544
1bf8b6ef5aea Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents: 36384
diff changeset
115 if (protocol != NULL)
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
116 {
40813
71305a7d7423 Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents: 40806
diff changeset
117 GList *iter, *entries, *splits;
71305a7d7423 Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents: 40806
diff changeset
118 splits = purple_protocol_get_user_splits(protocol);
71305a7d7423 Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents: 40806
diff changeset
119 for (iter = splits, entries = dialog->split_entries;
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
120 iter && entries; iter = iter->next, entries = entries->next)
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
121 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
122 PurpleAccountUserSplit *split = iter->data;
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
123 GntWidget *entry = entries->data;
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
124
36020
47474e8b92dd Implement purple_account_user_split_(is|set)_constant, remove unsupported Facebook XMPP features
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35475
diff changeset
125 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
126 if (value == NULL || *value == '\0')
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
127 value = purple_account_user_split_get_default_value(split);
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
128 g_string_append_printf(username, "%c%s",
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
129 purple_account_user_split_get_separator(split),
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
130 value);
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
131 }
40813
71305a7d7423 Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents: 40806
diff changeset
132 g_list_free_full(splits,
71305a7d7423 Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents: 40806
diff changeset
133 (GDestroyNotify)purple_account_user_split_destroy);
14041
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
41202
5c41b36cb13e port finch to the new AccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
136 if(dialog->account == NULL) {
5c41b36cb13e port finch to the new AccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
137 PurpleAccountManager *manager = purple_account_manager_get_default();
5c41b36cb13e port finch to the new AccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
138
36607
7ad7681dcfd8 Use purple_protocol_get_* API instead of protocol->member
Ankit Vani <a@nevitus.org>
parents: 36574
diff changeset
139 account = purple_account_new(username->str, purple_protocol_get_id(protocol));
41202
5c41b36cb13e port finch to the new AccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
140 purple_account_manager_add(manager, account);
5c41b36cb13e port finch to the new AccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
141 } else {
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
142 account = dialog->account;
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
143
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
144 /* Protocol */
30496
2f0380d2a282 Some updates to the account window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 29106
diff changeset
145 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
146 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
147 purple_account_set_username(account, username->str);
2f0380d2a282 Some updates to the account window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 29106
diff changeset
148 } else {
2f0380d2a282 Some updates to the account window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 29106
diff changeset
149 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
150 char *oldproto;
38358
30ba44276e74 Merge release-2.x.y into default
dx <dx@dxzone.com.ar>
parents: 37426 38259
diff changeset
151 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
152 purple_notify_error(NULL, _("Error"),
bbcb198650b7 Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34331
diff changeset
153 _("Account was not modified"),
bbcb198650b7 Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34331
diff changeset
154 _("The account's protocol cannot be "
bbcb198650b7 Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34331
diff changeset
155 "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
156 "server."),
bbcb198650b7 Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34331
diff changeset
157 purple_request_cpar_from_account(
bbcb198650b7 Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34331
diff changeset
158 account));
39903
05d2cd3d93df finch: Fix possible leaks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39901
diff changeset
159 g_string_free(username, TRUE);
30496
2f0380d2a282 Some updates to the account window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 29106
diff changeset
160 return;
2f0380d2a282 Some updates to the account window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 29106
diff changeset
161 }
2f0380d2a282 Some updates to the account window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 29106
diff changeset
162
36637
9b0109ae118d Renamed some prpl stuff to protocol stuff.
Ankit Vani <a@nevitus.org>
parents: 36632
diff changeset
163 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
164 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
165 purple_notify_error(NULL, _("Error"),
bbcb198650b7 Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34331
diff changeset
166 _("Account was not modified"),
bbcb198650b7 Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34331
diff changeset
167 _("The account's username cannot be "
bbcb198650b7 Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34331
diff changeset
168 "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
169 "server."),
bbcb198650b7 Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34331
diff changeset
170 purple_request_cpar_from_account(
bbcb198650b7 Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34331
diff changeset
171 account));
36637
9b0109ae118d Renamed some prpl stuff to protocol stuff.
Ankit Vani <a@nevitus.org>
parents: 36632
diff changeset
172 g_free(oldproto);
39918
1c8e11f9274f Fix several memory leaks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39903
diff changeset
173 g_string_free(username, TRUE);
30496
2f0380d2a282 Some updates to the account window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 29106
diff changeset
174 return;
2f0380d2a282 Some updates to the account window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 29106
diff changeset
175 }
36637
9b0109ae118d Renamed some prpl stuff to protocol stuff.
Ankit Vani <a@nevitus.org>
parents: 36632
diff changeset
176 g_free(oldproto);
30496
2f0380d2a282 Some updates to the account window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 29106
diff changeset
177 purple_account_set_username(account, username->str);
2f0380d2a282 Some updates to the account window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 29106
diff changeset
178 }
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
179 }
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
180 g_string_free(username, TRUE);
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
181
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
182 /* Alias */
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
183 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
184 purple_account_set_private_alias(account, value);
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
185
41778
ef805454a45a Add a require password option to the finch account editor
Gary Kramlich <grim@reaperworld.com>
parents: 41517
diff changeset
186 /* Remember password and require password */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
187 purple_account_set_remember_password(account,
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
188 gnt_check_box_get_checked(GNT_CHECK_BOX(dialog->remember)));
41778
ef805454a45a Add a require password option to the finch account editor
Gary Kramlich <grim@reaperworld.com>
parents: 41517
diff changeset
189 purple_account_set_require_password(account,
ef805454a45a Add a require password option to the finch account editor
Gary Kramlich <grim@reaperworld.com>
parents: 41517
diff changeset
190 gnt_check_box_get_checked(GNT_CHECK_BOX(dialog->require_password)));
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
191
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
192 /* Protocol options */
36544
1bf8b6ef5aea Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents: 36384
diff changeset
193 if (protocol)
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
194 {
40813
71305a7d7423 Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents: 40806
diff changeset
195 GList *iter, *entries, *opts;
23250
f02a5d93cf17 Allow account registration in a new account dialog.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
196
40813
71305a7d7423 Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents: 40806
diff changeset
197 opts = purple_protocol_get_account_options(protocol);
71305a7d7423 Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents: 40806
diff changeset
198 for (iter = opts, entries = dialog->protocol_entries;
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
199 iter && entries; iter = iter->next, entries = entries->next)
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
200 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
201 PurpleAccountOption *option = iter->data;
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
202 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
203 PurplePrefType type = purple_account_option_get_pref_type(option);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
204 const char *setting = purple_account_option_get_setting(option);
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
205
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
206 if (type == PURPLE_PREF_STRING)
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
207 {
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
208 const char *value = gnt_entry_get_text(GNT_ENTRY(entry));
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
209 purple_account_set_string(account, setting, value);
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
210 }
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
211 else if (type == PURPLE_PREF_INT)
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
212 {
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
213 const char *str = gnt_entry_get_text(GNT_ENTRY(entry));
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
214 int value = 0;
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
215 if (str)
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
216 value = atoi(str);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
217 purple_account_set_int(account, setting, value);
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
218 }
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
219 else if (type == PURPLE_PREF_BOOLEAN)
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
220 {
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
221 gboolean value = gnt_check_box_get_checked(GNT_CHECK_BOX(entry));
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
222 purple_account_set_bool(account, setting, value);
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
223 }
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
224 else if (type == PURPLE_PREF_STRING_LIST)
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
225 {
30725
4aa8ed98e52a finch: Add support for string lists as account options
Paul Aurich <darkrain42@pidgin.im>
parents: 30496
diff changeset
226 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
227 purple_account_set_string(account, setting, value);
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
228 }
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
229 else
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
230 {
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
231 g_assert_not_reached();
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
232 }
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
233 }
40813
71305a7d7423 Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents: 40806
diff changeset
234 g_list_free_full(opts, (GDestroyNotify)purple_account_option_destroy);
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
235 }
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 /* XXX: Proxy options */
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
238
19572
52e2313b38f8 Focus the modified/created account in the accounts window after modifying/
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19125
diff changeset
239 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
240 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
241 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
242 }
52e2313b38f8 Focus the modified/created account in the accounts window after modifying/
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19125
diff changeset
243
39759
ea1401483849 Rename *_GET_*_IFACE to more standard *_GET_IFACE.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39626
diff changeset
244 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
245 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
246 purple_account_register(account);
f02a5d93cf17 Allow account registration in a new account dialog.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
247 } else if (dialog->account == NULL) {
f02a5d93cf17 Allow account registration in a new account dialog.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
248 /* 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
249 /* Xerox from gtkaccount.c :D */
f02a5d93cf17 Allow account registration in a new account dialog.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
250 const PurpleSavedStatus *saved_status;
f02a5d93cf17 Allow account registration in a new account dialog.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
251 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
252 if (saved_status != NULL) {
f02a5d93cf17 Allow account registration in a new account dialog.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
253 purple_savedstatus_activate_for_account(saved_status, account);
41392
b5c84f55d5d2 Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
254 purple_account_set_enabled(account, TRUE);
23250
f02a5d93cf17 Allow account registration in a new account dialog.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
255 }
f02a5d93cf17 Allow account registration in a new account dialog.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
256 }
f02a5d93cf17 Allow account registration in a new account dialog.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
257
30496
2f0380d2a282 Some updates to the account window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 29106
diff changeset
258 /* 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
259 * 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
260 * here.
2f0380d2a282 Some updates to the account window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 29106
diff changeset
261 */
2f0380d2a282 Some updates to the account window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 29106
diff changeset
262 if (dialog->account != NULL && accounts.window) {
2f0380d2a282 Some updates to the account window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 29106
diff changeset
263 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
264 0, purple_account_get_username(dialog->account));
2f0380d2a282 Some updates to the account window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 29106
diff changeset
265 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
266 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
267 }
2f0380d2a282 Some updates to the account window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 29106
diff changeset
268
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
269 gnt_widget_destroy(dialog->window);
14005
198d1658b390 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13996
diff changeset
270 }
198d1658b390 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13996
diff changeset
271
198d1658b390 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13996
diff changeset
272 static void
198d1658b390 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13996
diff changeset
273 update_user_splits(AccountEditDialog *dialog)
198d1658b390 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13996
diff changeset
274 {
198d1658b390 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13996
diff changeset
275 GntWidget *hbox;
36544
1bf8b6ef5aea Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents: 36384
diff changeset
276 PurpleProtocol *protocol;
40813
71305a7d7423 Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents: 40806
diff changeset
277 GList *iter, *entries, *splits;
14005
198d1658b390 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13996
diff changeset
278 char *username = NULL;
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 if (dialog->splits)
198d1658b390 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13996
diff changeset
281 {
198d1658b390 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13996
diff changeset
282 gnt_box_remove_all(GNT_BOX(dialog->splits));
198d1658b390 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13996
diff changeset
283 g_list_free(dialog->split_entries);
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 else
198d1658b390 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13996
diff changeset
286 {
14121
3d8804b82150 [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14103
diff changeset
287 dialog->splits = gnt_vbox_new(FALSE);
14005
198d1658b390 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13996
diff changeset
288 gnt_box_set_pad(GNT_BOX(dialog->splits), 0);
14121
3d8804b82150 [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14103
diff changeset
289 gnt_box_set_fill(GNT_BOX(dialog->splits), TRUE);
14005
198d1658b390 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13996
diff changeset
290 }
198d1658b390 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13996
diff changeset
291
198d1658b390 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13996
diff changeset
292 dialog->split_entries = NULL;
198d1658b390 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13996
diff changeset
293
36544
1bf8b6ef5aea Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents: 36384
diff changeset
294 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
295 if (!protocol)
14005
198d1658b390 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13996
diff changeset
296 return;
31294
73607ab89c6f Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents: 30725
diff changeset
297
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
298 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
299
40813
71305a7d7423 Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents: 40806
diff changeset
300 splits = purple_protocol_get_user_splits(protocol);
71305a7d7423 Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents: 40806
diff changeset
301 for (iter = splits; iter; iter = iter->next)
14005
198d1658b390 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13996
diff changeset
302 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
303 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
304 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
305 char *buf = NULL;
14005
198d1658b390 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13996
diff changeset
306
36020
47474e8b92dd Implement purple_account_user_split_(is|set)_constant, remove unsupported Facebook XMPP features
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35475
diff changeset
307 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
308 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
309 gnt_box_add_widget(GNT_BOX(dialog->splits), hbox);
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 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
312 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
313
36020
47474e8b92dd Implement purple_account_user_split_(is|set)_constant, remove unsupported Facebook XMPP features
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35475
diff changeset
314 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
315 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
316 }
14005
198d1658b390 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13996
diff changeset
317
198d1658b390 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13996
diff changeset
318 dialog->split_entries = g_list_append(dialog->split_entries, entry);
198d1658b390 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13996
diff changeset
319 g_free(buf);
198d1658b390 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13996
diff changeset
320 }
198d1658b390 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13996
diff changeset
321
40813
71305a7d7423 Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents: 40806
diff changeset
322 for (iter = g_list_last(splits), entries = g_list_last(dialog->split_entries);
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
323 iter && entries; iter = iter->prev, entries = entries->prev)
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
324 {
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
325 GntWidget *entry = entries->data;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
326 PurpleAccountUserSplit *split = iter->data;
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
327 const char *value = NULL;
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
328 char *s;
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
329
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
330 if (dialog->account)
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
331 {
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
332 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
333 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
334 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
335 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
336
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
337 if (s != NULL)
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
338 {
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
339 *s = '\0';
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
340 s++;
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
341 value = s;
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 }
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
344 if (value == NULL)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
345 value = purple_account_user_split_get_default_value(split);
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
346
36020
47474e8b92dd Implement purple_account_user_split_(is|set)_constant, remove unsupported Facebook XMPP features
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35475
diff changeset
347 if (value != NULL && entry != NULL)
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
348 gnt_entry_set_text(GNT_ENTRY(entry), value);
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
349 }
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
350
40813
71305a7d7423 Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents: 40806
diff changeset
351 g_list_free_full(splits, (GDestroyNotify)purple_account_user_split_destroy);
71305a7d7423 Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents: 40806
diff changeset
352
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
353 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
354 gnt_entry_set_text(GNT_ENTRY(dialog->username), username);
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
355
14005
198d1658b390 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13996
diff changeset
356 g_free(username);
198d1658b390 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13996
diff changeset
357 }
198d1658b390 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13996
diff changeset
358
198d1658b390 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13996
diff changeset
359 static void
37038
8832d14d7d0c Rename 'protocol_options' field of PurpleProtocol to more appropriate 'account_options'
Ankit Vani <a@nevitus.org>
parents: 36782
diff changeset
360 add_account_options(AccountEditDialog *dialog)
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
361 {
36544
1bf8b6ef5aea Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents: 36384
diff changeset
362 PurpleProtocol *protocol;
40813
71305a7d7423 Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents: 40806
diff changeset
363 GList *iter, *opts;
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
364 GntWidget *vbox, *box;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
365 PurpleAccount *account;
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
366
36637
9b0109ae118d Renamed some prpl stuff to protocol stuff.
Ankit Vani <a@nevitus.org>
parents: 36632
diff changeset
367 if (dialog->protocols)
9b0109ae118d Renamed some prpl stuff to protocol stuff.
Ankit Vani <a@nevitus.org>
parents: 36632
diff changeset
368 gnt_box_remove_all(GNT_BOX(dialog->protocols));
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
369 else
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
370 {
36637
9b0109ae118d Renamed some prpl stuff to protocol stuff.
Ankit Vani <a@nevitus.org>
parents: 36632
diff changeset
371 dialog->protocols = vbox = gnt_vbox_new(FALSE);
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
372 gnt_box_set_pad(GNT_BOX(vbox), 0);
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
373 gnt_box_set_alignment(GNT_BOX(vbox), GNT_ALIGN_LEFT);
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
374 gnt_box_set_fill(GNT_BOX(vbox), TRUE);
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
375 }
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
376
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
377 if (dialog->protocol_entries)
14041
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 g_list_free(dialog->protocol_entries);
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
380 dialog->protocol_entries = NULL;
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
381 }
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
382
36637
9b0109ae118d Renamed some prpl stuff to protocol stuff.
Ankit Vani <a@nevitus.org>
parents: 36632
diff changeset
383 vbox = dialog->protocols;
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
384
36544
1bf8b6ef5aea Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents: 36384
diff changeset
385 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
386 if (!protocol)
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
387 return;
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
388
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
389 account = dialog->account;
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
390
40813
71305a7d7423 Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents: 40806
diff changeset
391 opts = purple_protocol_get_account_options(protocol);
71305a7d7423 Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents: 40806
diff changeset
392 for (iter = opts; iter; iter = iter->next)
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
393 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
394 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
395 PurplePrefType type = purple_account_option_get_pref_type(option);
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
396
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
397 box = gnt_hbox_new(TRUE);
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
398 gnt_box_set_pad(GNT_BOX(box), 0);
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
399 gnt_box_add_widget(GNT_BOX(vbox), box);
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
400
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
401 if (type == PURPLE_PREF_BOOLEAN)
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
402 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
403 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
404 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
405 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
406
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
407 if (account)
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
408 gnt_check_box_set_checked(GNT_CHECK_BOX(widget),
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
409 purple_account_get_bool(account,
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
410 purple_account_option_get_setting(option),
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
411 purple_account_option_get_default_bool(option)));
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
412 else
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
413 gnt_check_box_set_checked(GNT_CHECK_BOX(widget),
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
414 purple_account_option_get_default_bool(option));
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
415 }
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
416 else
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
417 {
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
418 gnt_box_add_widget(GNT_BOX(box),
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
419 gnt_label_new(purple_account_option_get_text(option)));
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
420
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
421 if (type == PURPLE_PREF_STRING_LIST)
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
422 {
30725
4aa8ed98e52a finch: Add support for string lists as account options
Paul Aurich <darkrain42@pidgin.im>
parents: 30496
diff changeset
423 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
424 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
425 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
426 const char *active = dv;
4aa8ed98e52a finch: Add support for string lists as account options
Paul Aurich <darkrain42@pidgin.im>
parents: 30496
diff changeset
427
4aa8ed98e52a finch: Add support for string lists as account options
Paul Aurich <darkrain42@pidgin.im>
parents: 30496
diff changeset
428 if (account)
4aa8ed98e52a finch: Add support for string lists as account options
Paul Aurich <darkrain42@pidgin.im>
parents: 30496
diff changeset
429 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
430 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
431
4aa8ed98e52a finch: Add support for string lists as account options
Paul Aurich <darkrain42@pidgin.im>
parents: 30496
diff changeset
432 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
433 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
434
4aa8ed98e52a finch: Add support for string lists as account options
Paul Aurich <darkrain42@pidgin.im>
parents: 30496
diff changeset
435 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
436 {
4aa8ed98e52a finch: Add support for string lists as account options
Paul Aurich <darkrain42@pidgin.im>
parents: 30496
diff changeset
437 PurpleKeyValuePair *kvp = opt_iter->data;
4aa8ed98e52a finch: Add support for string lists as account options
Paul Aurich <darkrain42@pidgin.im>
parents: 30496
diff changeset
438 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
439
38256
035f00c4fd87 Replace misused g_str_equal() with purple_strequal()
qarkai <qarkai@gmail.com>
parents: 31294
diff changeset
440 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
441 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
442 }
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
443 }
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
444 else
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
445 {
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
446 GntWidget *entry = gnt_entry_new(NULL);
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
447 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
448 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
449
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
450 if (type == PURPLE_PREF_STRING)
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
451 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
452 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
453
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
454 if (account)
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
455 gnt_entry_set_text(GNT_ENTRY(entry),
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
456 purple_account_get_string(account,
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
457 purple_account_option_get_setting(option), dv));
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
458 else
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
459 gnt_entry_set_text(GNT_ENTRY(entry), dv);
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
460 }
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
461 else if (type == PURPLE_PREF_INT)
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
462 {
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
463 char str[32];
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
464 int value = purple_account_option_get_default_int(option);
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
465 if (account)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
466 value = purple_account_get_int(account,
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
467 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
468 g_snprintf(str, sizeof(str), "%d", value);
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
469 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
470 gnt_entry_set_text(GNT_ENTRY(entry), str);
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
471 }
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
472 else
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
473 {
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
474 g_assert_not_reached();
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
475 }
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 }
40813
71305a7d7423 Modernize PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents: 40806
diff changeset
479 g_list_free_full(opts, (GDestroyNotify)purple_account_option_destroy);
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 {
41778
ef805454a45a Add a require password option to the finch account editor
Gary Kramlich <grim@reaperworld.com>
parents: 41517
diff changeset
490 PurpleProtocol *protocol = NULL;
ef805454a45a Add a require password option to the finch account editor
Gary Kramlich <grim@reaperworld.com>
parents: 41517
diff changeset
491 PurpleProtocolOptions options;
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
492
36544
1bf8b6ef5aea Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents: 36384
diff changeset
493 protocol = gnt_combo_box_get_selected_data(GNT_COMBO_BOX(dialog->protocol));
41778
ef805454a45a Add a require password option to the finch account editor
Gary Kramlich <grim@reaperworld.com>
parents: 41517
diff changeset
494 if(!protocol) {
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
495 return;
41778
ef805454a45a Add a require password option to the finch account editor
Gary Kramlich <grim@reaperworld.com>
parents: 41517
diff changeset
496 }
ef805454a45a Add a require password option to the finch account editor
Gary Kramlich <grim@reaperworld.com>
parents: 41517
diff changeset
497
ef805454a45a Add a require password option to the finch account editor
Gary Kramlich <grim@reaperworld.com>
parents: 41517
diff changeset
498 options = purple_protocol_get_options(protocol);
ef805454a45a Add a require password option to the finch account editor
Gary Kramlich <grim@reaperworld.com>
parents: 41517
diff changeset
499
ef805454a45a Add a require password option to the finch account editor
Gary Kramlich <grim@reaperworld.com>
parents: 41517
diff changeset
500 if(dialog->remember == NULL) {
ef805454a45a Add a require password option to the finch account editor
Gary Kramlich <grim@reaperworld.com>
parents: 41517
diff changeset
501 dialog->remember = gnt_check_box_new(_("Remember password"));
ef805454a45a Add a require password option to the finch account editor
Gary Kramlich <grim@reaperworld.com>
parents: 41517
diff changeset
502 }
ef805454a45a Add a require password option to the finch account editor
Gary Kramlich <grim@reaperworld.com>
parents: 41517
diff changeset
503
ef805454a45a Add a require password option to the finch account editor
Gary Kramlich <grim@reaperworld.com>
parents: 41517
diff changeset
504 if(dialog->require_password == NULL) {
ef805454a45a Add a require password option to the finch account editor
Gary Kramlich <grim@reaperworld.com>
parents: 41517
diff changeset
505 dialog->require_password = gnt_check_box_new(_("Require a password "
ef805454a45a Add a require password option to the finch account editor
Gary Kramlich <grim@reaperworld.com>
parents: 41517
diff changeset
506 "for this account"));
ef805454a45a Add a require password option to the finch account editor
Gary Kramlich <grim@reaperworld.com>
parents: 41517
diff changeset
507 }
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
508
41778
ef805454a45a Add a require password option to the finch account editor
Gary Kramlich <grim@reaperworld.com>
parents: 41517
diff changeset
509 gnt_widget_set_visible(dialog->require_password,
ef805454a45a Add a require password option to the finch account editor
Gary Kramlich <grim@reaperworld.com>
parents: 41517
diff changeset
510 options & OPT_PROTO_PASSWORD_OPTIONAL);
ef805454a45a Add a require password option to the finch account editor
Gary Kramlich <grim@reaperworld.com>
parents: 41517
diff changeset
511
ef805454a45a Add a require password option to the finch account editor
Gary Kramlich <grim@reaperworld.com>
parents: 41517
diff changeset
512 if (dialog->account) {
ef805454a45a Add a require password option to the finch account editor
Gary Kramlich <grim@reaperworld.com>
parents: 41517
diff changeset
513 gboolean remember_password = FALSE;
ef805454a45a Add a require password option to the finch account editor
Gary Kramlich <grim@reaperworld.com>
parents: 41517
diff changeset
514 gboolean require_password = FALSE;
ef805454a45a Add a require password option to the finch account editor
Gary Kramlich <grim@reaperworld.com>
parents: 41517
diff changeset
515
ef805454a45a Add a require password option to the finch account editor
Gary Kramlich <grim@reaperworld.com>
parents: 41517
diff changeset
516 remember_password =
ef805454a45a Add a require password option to the finch account editor
Gary Kramlich <grim@reaperworld.com>
parents: 41517
diff changeset
517 purple_account_get_remember_password(dialog->account);
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
518 gnt_check_box_set_checked(GNT_CHECK_BOX(dialog->remember),
41778
ef805454a45a Add a require password option to the finch account editor
Gary Kramlich <grim@reaperworld.com>
parents: 41517
diff changeset
519 remember_password);
ef805454a45a Add a require password option to the finch account editor
Gary Kramlich <grim@reaperworld.com>
parents: 41517
diff changeset
520
ef805454a45a Add a require password option to the finch account editor
Gary Kramlich <grim@reaperworld.com>
parents: 41517
diff changeset
521 require_password = purple_account_get_require_password(dialog->account);
ef805454a45a Add a require password option to the finch account editor
Gary Kramlich <grim@reaperworld.com>
parents: 41517
diff changeset
522 gnt_check_box_set_checked(GNT_CHECK_BOX(dialog->require_password),
ef805454a45a Add a require password option to the finch account editor
Gary Kramlich <grim@reaperworld.com>
parents: 41517
diff changeset
523 require_password);
ef805454a45a Add a require password option to the finch account editor
Gary Kramlich <grim@reaperworld.com>
parents: 41517
diff changeset
524 }
ef805454a45a Add a require password option to the finch account editor
Gary Kramlich <grim@reaperworld.com>
parents: 41517
diff changeset
525
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
526 }
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
527
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
528 static void
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
529 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
530 {
198d1658b390 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13996
diff changeset
531 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
532 add_account_options(dialog);
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
533 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
534 gnt_box_readjust(GNT_BOX(dialog->window));
198d1658b390 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13996
diff changeset
535 gnt_widget_draw(dialog->window);
198d1658b390 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13996
diff changeset
536 }
198d1658b390 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13996
diff changeset
537
198d1658b390 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13996
diff changeset
538 static void
41498
ea40c778bf9d Fix the add account button in Finch by removing passwords from it.
Gary Kramlich <grim@reaperworld.com>
parents: 41446
diff changeset
539 edit_account(PurpleAccount *account)
14005
198d1658b390 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13996
diff changeset
540 {
198d1658b390 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13996
diff changeset
541 GntWidget *window, *hbox;
198d1658b390 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13996
diff changeset
542 GntWidget *combo, *button, *entry;
198d1658b390 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13996
diff changeset
543 GList *list, *iter;
198d1658b390 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13996
diff changeset
544 AccountEditDialog *dialog;
36544
1bf8b6ef5aea Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents: 36384
diff changeset
545 PurpleProtocol *protocol;
40806
51a4fc3b947a Port finch from the purple_protocols api to the purple_protocol_manager api
Gary Kramlich <grim@reaperworld.com>
parents: 40707
diff changeset
546 PurpleProtocolManager *protocol_manager = NULL;
14005
198d1658b390 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13996
diff changeset
547
14103
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
548 if (account)
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
549 {
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
550 GList *iter;
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
551 for (iter = accountdialogs; iter; iter = iter->next)
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
552 {
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
553 AccountEditDialog *dlg = iter->data;
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
554 if (dlg->account == account)
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
555 return;
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
556 }
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
557 }
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
558
40806
51a4fc3b947a Port finch from the purple_protocols api to the purple_protocol_manager api
Gary Kramlich <grim@reaperworld.com>
parents: 40707
diff changeset
559 protocol_manager = purple_protocol_manager_get_default();
51a4fc3b947a Port finch from the purple_protocols api to the purple_protocol_manager api
Gary Kramlich <grim@reaperworld.com>
parents: 40707
diff changeset
560 list = purple_protocol_manager_get_all(protocol_manager);
18611
03e6a4f7514b Do not crash when people run finch without 'make install'ing first.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18400
diff changeset
561 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
562 purple_notify_error(NULL, _("Error"),
36782
64936dae41a3 Merged soc.2013.gobjectification branch
Ankit Vani <a@nevitus.org>
parents: 36724 34955
diff changeset
563 _("There are no protocols installed."),
34449
bbcb198650b7 Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34331
diff changeset
564 _("(You probably forgot to 'make install'.)"),
bbcb198650b7 Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34331
diff changeset
565 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
566 return;
03e6a4f7514b Do not crash when people run finch without 'make install'ing first.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18400
diff changeset
567 }
03e6a4f7514b Do not crash when people run finch without 'make install'ing first.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18400
diff changeset
568
14005
198d1658b390 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13996
diff changeset
569 dialog = g_new0(AccountEditDialog, 1);
14103
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
570 accountdialogs = g_list_prepend(accountdialogs, dialog);
14005
198d1658b390 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13996
diff changeset
571
14121
3d8804b82150 [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14103
diff changeset
572 dialog->window = window = gnt_vbox_new(FALSE);
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
573 dialog->account = account;
14005
198d1658b390 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13996
diff changeset
574 gnt_box_set_toplevel(GNT_BOX(window), TRUE);
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
575 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
576 gnt_box_set_alignment(GNT_BOX(window), GNT_ALIGN_MID);
198d1658b390 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13996
diff changeset
577 gnt_box_set_pad(GNT_BOX(window), 0);
14121
3d8804b82150 [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14103
diff changeset
578 gnt_widget_set_name(window, "edit-account");
3d8804b82150 [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14103
diff changeset
579 gnt_box_set_fill(GNT_BOX(window), TRUE);
14005
198d1658b390 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13996
diff changeset
580
14121
3d8804b82150 [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14103
diff changeset
581 hbox = gnt_hbox_new(TRUE);
3d8804b82150 [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14103
diff changeset
582 gnt_box_set_pad(GNT_BOX(hbox), 0);
14005
198d1658b390 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13996
diff changeset
583 gnt_box_add_widget(GNT_BOX(window), hbox);
198d1658b390 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13996
diff changeset
584
198d1658b390 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13996
diff changeset
585 dialog->protocol = combo = gnt_combo_box_new();
198d1658b390 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13996
diff changeset
586 for (iter = list; iter; iter = iter->next)
198d1658b390 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13996
diff changeset
587 {
198d1658b390 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13996
diff changeset
588 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
589 purple_protocol_get_name(PURPLE_PROTOCOL(iter->data)));
14005
198d1658b390 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13996
diff changeset
590 }
14121
3d8804b82150 [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14103
diff changeset
591
40806
51a4fc3b947a Port finch from the purple_protocols api to the purple_protocol_manager api
Gary Kramlich <grim@reaperworld.com>
parents: 40707
diff changeset
592 protocol = purple_account_get_protocol(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
593
36544
1bf8b6ef5aea Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents: 36384
diff changeset
594 if (account && protocol)
1bf8b6ef5aea Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents: 36384
diff changeset
595 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
596 else
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
597 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
598
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
599 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
600
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(_("Protocol:")));
198d1658b390 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13996
diff changeset
602 gnt_box_add_widget(GNT_BOX(hbox), combo);
198d1658b390 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13996
diff changeset
603
14121
3d8804b82150 [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14103
diff changeset
604 hbox = gnt_hbox_new(TRUE);
3d8804b82150 [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14103
diff changeset
605 gnt_box_set_pad(GNT_BOX(hbox), 0);
14005
198d1658b390 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13996
diff changeset
606 gnt_box_add_widget(GNT_BOX(window), hbox);
198d1658b390 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13996
diff changeset
607
25889
26d9ca30335c Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents: 24861
diff changeset
608 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
609 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
610 gnt_box_add_widget(GNT_BOX(hbox), entry);
198d1658b390 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13996
diff changeset
611
198d1658b390 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13996
diff changeset
612 /* User splits */
198d1658b390 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13996
diff changeset
613 update_user_splits(dialog);
198d1658b390 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13996
diff changeset
614 gnt_box_add_widget(GNT_BOX(window), dialog->splits);
198d1658b390 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13996
diff changeset
615
14121
3d8804b82150 [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14103
diff changeset
616 hbox = gnt_hbox_new(TRUE);
3d8804b82150 [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14103
diff changeset
617 gnt_box_set_pad(GNT_BOX(hbox), 0);
14005
198d1658b390 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13996
diff changeset
618 gnt_box_add_widget(GNT_BOX(window), hbox);
198d1658b390 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13996
diff changeset
619
198d1658b390 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13996
diff changeset
620 dialog->alias = entry = gnt_entry_new(NULL);
198d1658b390 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13996
diff changeset
621 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
622 gnt_box_add_widget(GNT_BOX(hbox), entry);
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
623 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
624 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
625
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
626 /* User options */
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
627 update_user_options(dialog);
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
628 gnt_box_add_widget(GNT_BOX(window), dialog->remember);
41778
ef805454a45a Add a require password option to the finch account editor
Gary Kramlich <grim@reaperworld.com>
parents: 41517
diff changeset
629 gnt_box_add_widget(GNT_BOX(window), dialog->require_password);
14005
198d1658b390 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13996
diff changeset
630
23250
f02a5d93cf17 Allow account registration in a new account dialog.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
631 /* Register checkbox */
f02a5d93cf17 Allow account registration in a new account dialog.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22942
diff changeset
632 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
633 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
634
14005
198d1658b390 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13996
diff changeset
635 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
636
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
637 /* 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
638 add_account_options(dialog);
36637
9b0109ae118d Renamed some prpl stuff to protocol stuff.
Ankit Vani <a@nevitus.org>
parents: 36632
diff changeset
639 gnt_box_add_widget(GNT_BOX(window), dialog->protocols);
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
640
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
641 /* TODO: Add proxy options */
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
642
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
643 /* The button box */
14121
3d8804b82150 [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14103
diff changeset
644 hbox = gnt_hbox_new(FALSE);
14005
198d1658b390 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13996
diff changeset
645 gnt_box_add_widget(GNT_BOX(window), hbox);
14121
3d8804b82150 [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14103
diff changeset
646 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
647
198d1658b390 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13996
diff changeset
648 button = gnt_button_new(_("Cancel"));
198d1658b390 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13996
diff changeset
649 gnt_box_add_widget(GNT_BOX(hbox), button);
198d1658b390 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13996
diff changeset
650 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
651
14005
198d1658b390 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13996
diff changeset
652 button = gnt_button_new(_("Save"));
198d1658b390 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13996
diff changeset
653 gnt_box_add_widget(GNT_BOX(hbox), button);
198d1658b390 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13996
diff changeset
654 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
655
198d1658b390 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13996
diff changeset
656 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
657
198d1658b390 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13996
diff changeset
658 gnt_widget_show(window);
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
659 gnt_box_readjust(GNT_BOX(window));
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
660 gnt_widget_draw(window);
36659
fbaa6f248ebc Free the list returned by purple_protocols_get_all()
Ankit Vani <a@nevitus.org>
parents: 36637
diff changeset
661
fbaa6f248ebc Free the list returned by purple_protocols_get_all()
Ankit Vani <a@nevitus.org>
parents: 36637
diff changeset
662 g_list_free(list);
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
663 }
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
664
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
665 static void
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
666 add_account_cb(GntWidget *widget, gpointer null)
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
667 {
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
668 edit_account(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
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
671 static void
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
672 modify_account_cb(GntWidget *widget, GntTree *tree)
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
673 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
674 PurpleAccount *account = gnt_tree_get_selection_data(tree);
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
675 if (!account)
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
676 return;
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
677 edit_account(account);
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
678 }
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
679
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
680 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
681 really_delete_account(PurpleAccount *account)
14103
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
682 {
41514
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41498
diff changeset
683 PurpleNotificationManager *manager = NULL;
14103
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
684 GList *iter;
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
685 for (iter = accountdialogs; iter; iter = iter->next)
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
686 {
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
687 AccountEditDialog *dlg = iter->data;
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
688 if (dlg->account == account)
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
689 {
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
690 gnt_widget_destroy(dlg->window);
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
691 break;
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
692 }
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
693 }
41514
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41498
diff changeset
694
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41498
diff changeset
695 manager = purple_notification_manager_get_default();
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41498
diff changeset
696 purple_notification_manager_remove_with_account(manager, account);
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41498
diff changeset
697
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
698 purple_accounts_delete(account);
14103
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
699 }
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
700
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
701 static void
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
702 delete_account_cb(GntWidget *widget, GntTree *tree)
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
703 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
704 PurpleAccount *account;
14103
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
705 char *prompt;
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
706
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
707 account = gnt_tree_get_selection_data(tree);
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
708 if (!account)
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
709 return;
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
710
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
711 prompt = g_strdup_printf(_("Are you sure you want to delete %s?"),
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
712 purple_account_get_username(account));
14103
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
713
22385
d14ac3ae2007 The Gnome Human Interface Guidelines say, "if pressing this button by
Mark Doliner <markdoliner@pidgin.im>
parents: 22335
diff changeset
714 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
715 PURPLE_DEFAULT_ACTION_NONE,
c8486462bb63 Request API refactoring: switch purple_request_action to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34304
diff changeset
716 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
717 _("Delete"), really_delete_account, _("Cancel"), NULL);
14103
bcac61d40461 [gaim-migrate @ 16647]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14086
diff changeset
718 g_free(prompt);
14005
198d1658b390 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13996
diff changeset
719 }
198d1658b390 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13996
diff changeset
720
13969
0541f389442e [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
721 static void
0541f389442e [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
722 account_toggled(GntWidget *widget, void *key, gpointer null)
0541f389442e [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
723 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
724 PurpleAccount *account = key;
26719
314682a2c762 Activate the current status for an account being enabled
Richard Nelson <wabz@pidgin.im>
parents: 26477
diff changeset
725 gboolean enabled = gnt_tree_get_choice(GNT_TREE(widget), key);
13969
0541f389442e [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
726
26719
314682a2c762 Activate the current status for an account being enabled
Richard Nelson <wabz@pidgin.im>
parents: 26477
diff changeset
727 if (enabled)
314682a2c762 Activate the current status for an account being enabled
Richard Nelson <wabz@pidgin.im>
parents: 26477
diff changeset
728 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
729 account);
314682a2c762 Activate the current status for an account being enabled
Richard Nelson <wabz@pidgin.im>
parents: 26477
diff changeset
730
41392
b5c84f55d5d2 Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
731 purple_account_set_enabled(account, enabled);
13969
0541f389442e [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
732 }
0541f389442e [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
733
24227
bd2641bf0dec Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23250
diff changeset
734 static gboolean
bd2641bf0dec Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23250
diff changeset
735 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
736 {
bd2641bf0dec Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23250
diff changeset
737 GntTree *tree = GNT_TREE(widget);
41202
5c41b36cb13e port finch to the new AccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
738 PurpleAccountManager *manager = NULL;
24227
bd2641bf0dec Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23250
diff changeset
739 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
740 int move, pos, count;
bd2641bf0dec Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23250
diff changeset
741 GList *accounts;
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 if (!account)
bd2641bf0dec Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23250
diff changeset
744 return FALSE;
bd2641bf0dec Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23250
diff changeset
745
bd2641bf0dec Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23250
diff changeset
746 switch (text[0]) {
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 = -1;
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 case '=':
bd2641bf0dec Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23250
diff changeset
751 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
752 break;
bd2641bf0dec Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23250
diff changeset
753 default:
bd2641bf0dec Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23250
diff changeset
754 return FALSE;
bd2641bf0dec Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23250
diff changeset
755 }
bd2641bf0dec Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23250
diff changeset
756
41202
5c41b36cb13e port finch to the new AccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
757 manager = purple_account_manager_get_default();
5c41b36cb13e port finch to the new AccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
758 accounts = purple_account_manager_get_all(manager);
24227
bd2641bf0dec Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23250
diff changeset
759 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
760 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
761 pos = (move + pos + count + 1) % (count + 1);
41202
5c41b36cb13e port finch to the new AccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
762 if(pos >= 0) {
5c41b36cb13e port finch to the new AccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
763 purple_account_manager_reorder(manager, account, pos);
5c41b36cb13e port finch to the new AccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
764 }
24227
bd2641bf0dec Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23250
diff changeset
765
bd2641bf0dec Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23250
diff changeset
766 /* 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
767 * 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
768 gnt_tree_remove_all(tree);
41202
5c41b36cb13e port finch to the new AccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
769 accounts = purple_account_manager_get_all(manager);
24227
bd2641bf0dec Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23250
diff changeset
770 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
771 account_add(accounts->data);
bd2641bf0dec Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23250
diff changeset
772 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
773
bd2641bf0dec Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23250
diff changeset
774 return TRUE;
bd2641bf0dec Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23250
diff changeset
775 }
bd2641bf0dec Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23250
diff changeset
776
14086
732c14687955 [gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14047
diff changeset
777 static void
732c14687955 [gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14047
diff changeset
778 reset_accounts_win(GntWidget *widget, gpointer null)
732c14687955 [gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14047
diff changeset
779 {
732c14687955 [gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14047
diff changeset
780 accounts.window = NULL;
732c14687955 [gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14047
diff changeset
781 accounts.tree = NULL;
732c14687955 [gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14047
diff changeset
782 }
732c14687955 [gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14047
diff changeset
783
15878
f52832b611fe renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents: 15829
diff changeset
784 void finch_accounts_show_all()
13969
0541f389442e [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
785 {
41202
5c41b36cb13e port finch to the new AccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
786 PurpleAccountManager *manager = NULL;
18122
9bf9970c1b6a disapproval of revision '2d8ea56b90971e7851442d96b7d74ecb4f052126'
Richard Laager <rlaager@pidgin.im>
parents: 18121
diff changeset
787 GList *iter;
13969
0541f389442e [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
788 GntWidget *box, *button;
0541f389442e [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
789
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
790 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
791 gnt_window_present(accounts.window);
14388
15a44e361ac4 [gaim-migrate @ 17021]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14121
diff changeset
792 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
793 }
14388
15a44e361ac4 [gaim-migrate @ 17021]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14121
diff changeset
794
14121
3d8804b82150 [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14103
diff changeset
795 accounts.window = gnt_vbox_new(FALSE);
13969
0541f389442e [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
796 gnt_box_set_toplevel(GNT_BOX(accounts.window), TRUE);
0541f389442e [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
797 gnt_box_set_title(GNT_BOX(accounts.window), _("Accounts"));
13996
fa46d71780ff [gaim-migrate @ 16462]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13978
diff changeset
798 gnt_box_set_pad(GNT_BOX(accounts.window), 0);
14005
198d1658b390 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13996
diff changeset
799 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
800 gnt_widget_set_name(accounts.window, "accounts");
0541f389442e [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
801
0541f389442e [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
802 gnt_box_add_widget(GNT_BOX(accounts.window),
13978
70d7030b7f26 [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13969
diff changeset
803 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
804
14005
198d1658b390 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13996
diff changeset
805 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
806
14026
ad91ce0effe2 [gaim-migrate @ 16520]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14005
diff changeset
807 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
808 gnt_widget_set_has_border(accounts.tree, FALSE);
13969
0541f389442e [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
809
41202
5c41b36cb13e port finch to the new AccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
810 manager = purple_account_manager_get_default();
5c41b36cb13e port finch to the new AccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
811 iter = purple_account_manager_get_all(manager);
5c41b36cb13e port finch to the new AccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
812
5c41b36cb13e port finch to the new AccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
813 for(; iter; iter = iter->next) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
814 PurpleAccount *account = iter->data;
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
815 account_add(account);
13969
0541f389442e [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
816 }
0541f389442e [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
817
0541f389442e [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
818 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
819 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
820
14026
ad91ce0effe2 [gaim-migrate @ 16520]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14005
diff changeset
821 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
822 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
823 gnt_box_add_widget(GNT_BOX(accounts.window), accounts.tree);
0541f389442e [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
824
14005
198d1658b390 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13996
diff changeset
825 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
826
14121
3d8804b82150 [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14103
diff changeset
827 box = gnt_hbox_new(FALSE);
13969
0541f389442e [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
828
0541f389442e [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
829 button = gnt_button_new(_("Add"));
0541f389442e [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
830 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
831 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
832 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
833
0541f389442e [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
834 button = gnt_button_new(_("Modify"));
0541f389442e [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
835 gnt_box_add_widget(GNT_BOX(box), button);
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
836 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
837
0541f389442e [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
838 button = gnt_button_new(_("Delete"));
0541f389442e [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
839 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
840 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
841 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
842
13969
0541f389442e [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
843 gnt_box_add_widget(GNT_BOX(accounts.window), box);
14086
732c14687955 [gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14047
diff changeset
844
732c14687955 [gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14047
diff changeset
845 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
846
13969
0541f389442e [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
847 gnt_widget_show(accounts.window);
0541f389442e [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
848 }
0541f389442e [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
849
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
850 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
851 {
53aca1037b2c Instead of just notifying the user about a connection error, give him options
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19935
diff changeset
852 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
853 }
53aca1037b2c Instead of just notifying the user about a connection error, give him options
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19935
diff changeset
854
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
855 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
856 finch_accounts_get_handle(void)
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 static int handle;
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
859
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
860 return &handle;
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
861 }
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 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
864 account_added_callback(PurpleAccount *account)
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
865 {
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
866 if (accounts.window == NULL)
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
867 return;
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
868 account_add(account);
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
869 gnt_widget_draw(accounts.tree);
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
870 }
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 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
873 account_removed_callback(PurpleAccount *account)
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
874 {
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
875 if (accounts.window == NULL)
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
876 return;
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
877
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
878 gnt_tree_remove(GNT_TREE(accounts.tree), account);
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
879 }
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
880
17401
4db9d9d3e928 Finch autoreconnecting (largely copy/paste from pidgin)
Richard Nelson <wabz@pidgin.im>
parents: 17164
diff changeset
881 static void
4db9d9d3e928 Finch autoreconnecting (largely copy/paste from pidgin)
Richard Nelson <wabz@pidgin.im>
parents: 17164
diff changeset
882 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
883 {
4db9d9d3e928 Finch autoreconnecting (largely copy/paste from pidgin)
Richard Nelson <wabz@pidgin.im>
parents: 17164
diff changeset
884 if (accounts.window == NULL)
4db9d9d3e928 Finch autoreconnecting (largely copy/paste from pidgin)
Richard Nelson <wabz@pidgin.im>
parents: 17164
diff changeset
885 return;
4db9d9d3e928 Finch autoreconnecting (largely copy/paste from pidgin)
Richard Nelson <wabz@pidgin.im>
parents: 17164
diff changeset
886 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
887 GPOINTER_TO_INT(user_data));
4db9d9d3e928 Finch autoreconnecting (largely copy/paste from pidgin)
Richard Nelson <wabz@pidgin.im>
parents: 17164
diff changeset
888 }
4db9d9d3e928 Finch autoreconnecting (largely copy/paste from pidgin)
Richard Nelson <wabz@pidgin.im>
parents: 17164
diff changeset
889
15878
f52832b611fe renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents: 15829
diff changeset
890 void finch_accounts_init()
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
891 {
41202
5c41b36cb13e port finch to the new AccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
892 PurpleAccountManager *manager = NULL;
18122
9bf9970c1b6a disapproval of revision '2d8ea56b90971e7851442d96b7d74ecb4f052126'
Richard Laager <rlaager@pidgin.im>
parents: 18121
diff changeset
893 GList *iter;
14484
68626467b639 [gaim-migrate @ 17130]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14388
diff changeset
894
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
895 purple_signal_connect(purple_accounts_get_handle(), "account-added",
41314
0dc72eacd8bf Replace PURPLE_CALLBACK by G_CALLBACK
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41202
diff changeset
896 finch_accounts_get_handle(), G_CALLBACK(account_added_callback),
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
897 NULL);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
898 purple_signal_connect(purple_accounts_get_handle(), "account-removed",
41314
0dc72eacd8bf Replace PURPLE_CALLBACK by G_CALLBACK
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41202
diff changeset
899 finch_accounts_get_handle(), G_CALLBACK(account_removed_callback),
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
900 NULL);
17401
4db9d9d3e928 Finch autoreconnecting (largely copy/paste from pidgin)
Richard Nelson <wabz@pidgin.im>
parents: 17164
diff changeset
901 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
902 finch_accounts_get_handle(),
41314
0dc72eacd8bf Replace PURPLE_CALLBACK by G_CALLBACK
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41202
diff changeset
903 G_CALLBACK(account_abled_cb), GINT_TO_POINTER(FALSE));
17401
4db9d9d3e928 Finch autoreconnecting (largely copy/paste from pidgin)
Richard Nelson <wabz@pidgin.im>
parents: 17164
diff changeset
904 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
905 finch_accounts_get_handle(),
41314
0dc72eacd8bf Replace PURPLE_CALLBACK by G_CALLBACK
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41202
diff changeset
906 G_CALLBACK(account_abled_cb), GINT_TO_POINTER(TRUE));
17401
4db9d9d3e928 Finch autoreconnecting (largely copy/paste from pidgin)
Richard Nelson <wabz@pidgin.im>
parents: 17164
diff changeset
907
41202
5c41b36cb13e port finch to the new AccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
908 manager = purple_account_manager_get_default();
5c41b36cb13e port finch to the new AccountManager API
Gary Kramlich <grim@reaperworld.com>
parents: 40813
diff changeset
909 iter = purple_account_manager_get_all(manager);
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
910 if (iter) {
40044
2b679acefffa Revert one g_list_find_custom
qarkai <qarkai@gmail.com>
parents: 40043
diff changeset
911 for (; iter; iter = iter->next) {
41392
b5c84f55d5d2 Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
912 if (purple_account_get_enabled(iter->data))
40044
2b679acefffa Revert one g_list_find_custom
qarkai <qarkai@gmail.com>
parents: 40043
diff changeset
913 break;
2b679acefffa Revert one g_list_find_custom
qarkai <qarkai@gmail.com>
parents: 40043
diff changeset
914 }
2b679acefffa Revert one g_list_find_custom
qarkai <qarkai@gmail.com>
parents: 40043
diff changeset
915 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
916 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
917 } 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
918 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
919 finch_accounts_show_all();
14484
68626467b639 [gaim-migrate @ 17130]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14388
diff changeset
920 }
14041
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
921 }
6afba85cfc30 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14026
diff changeset
922
15878
f52832b611fe renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents: 15829
diff changeset
923 void finch_accounts_uninit()
13969
0541f389442e [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
924 {
14086
732c14687955 [gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14047
diff changeset
925 if (accounts.window)
732c14687955 [gaim-migrate @ 16622]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14047
diff changeset
926 gnt_widget_destroy(accounts.window);
13969
0541f389442e [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
927 }

mercurial