Mercurial > pidgin
annotate finch/gntaccount.c @ 32806:0dd2cbee5b80
Add API for getting default conversation theme.
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Mon, 28 May 2012 22:33:46 +0000 |
parents | a8cc50c2279f |
children |
rev | line source |
---|---|
15817 | 1 /** |
2 * @file gntaccount.c GNT Account API | |
16194
0f0832c13fcb
Rename the Doxygen group from gntui to finch and define the finch group
Richard Laager <rlaager@wiktel.com>
parents:
15870
diff
changeset
|
3 * @ingroup finch |
20074
6bf32c9e15a7
remove gpl boilerplate from doxygen docs
Sean Egan <seanegan@gmail.com>
parents:
19768
diff
changeset
|
4 */ |
6bf32c9e15a7
remove gpl boilerplate from doxygen docs
Sean Egan <seanegan@gmail.com>
parents:
19768
diff
changeset
|
5 |
6bf32c9e15a7
remove gpl boilerplate from doxygen docs
Sean Egan <seanegan@gmail.com>
parents:
19768
diff
changeset
|
6 /* finch |
15817 | 7 * |
15870
66dff3dfdea6
Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@wiktel.com>
parents:
15822
diff
changeset
|
8 * Finch is the legal property of its developers, whose names are too numerous |
15817 | 9 * to list here. Please refer to the COPYRIGHT file distributed with this |
10 * source distribution. | |
11 * | |
12 * This program is free software; you can redistribute it and/or modify | |
13 * it under the terms of the GNU General Public License as published by | |
14 * the Free Software Foundation; either version 2 of the License, or | |
15 * (at your option) any later version. | |
16 * | |
17 * This program is distributed in the hope that it will be useful, | |
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 * GNU General Public License for more details. | |
21 * | |
22 * You should have received a copy of the GNU General Public License | |
23 * along with this program; if not, write to the Free Software | |
19681
44b4e8bd759b
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19392
diff
changeset
|
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
15817 | 25 */ |
28770
259bbfb423d4
Fix all the remaining files for which internal.h doesn't end up being the first include.
Paul Aurich <paul@darkrain42.org>
parents:
28296
diff
changeset
|
26 #include <internal.h> |
259bbfb423d4
Fix all the remaining files for which internal.h doesn't end up being the first include.
Paul Aurich <paul@darkrain42.org>
parents:
28296
diff
changeset
|
27 |
15817 | 28 #include <gnt.h> |
29 #include <gntbox.h> | |
30 #include <gntbutton.h> | |
31 #include <gntcheckbox.h> | |
32 #include <gntcombobox.h> | |
33 #include <gntentry.h> | |
34 #include <gntlabel.h> | |
35 #include <gntline.h> | |
36 #include <gnttree.h> | |
18511
7ee0e0597a26
Add utility function to trigger some button when some key is pressed with
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18432
diff
changeset
|
37 #include <gntutils.h> |
17804
464840043c66
Show information about the user requesting authorization.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17091
diff
changeset
|
38 #include <gntwindow.h> |
15817 | 39 |
18210
b8572b937c09
#include reorganizations to allow compiling with glib < 2.8 using the
Stu Tomlinson <stu@nosnilmot.com>
parents:
18063
diff
changeset
|
40 #include "finch.h" |
b8572b937c09
#include reorganizations to allow compiling with glib < 2.8 using the
Stu Tomlinson <stu@nosnilmot.com>
parents:
18063
diff
changeset
|
41 |
15817 | 42 #include <account.h> |
43 #include <accountopt.h> | |
44 #include <connection.h> | |
45 #include <notify.h> | |
46 #include <plugin.h> | |
47 #include <request.h> | |
23083
02ef6c5c6650
Allow account registration in a new account dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22794
diff
changeset
|
48 #include <savedstatuses.h> |
15817 | 49 |
50 #include "gntaccount.h" | |
17804
464840043c66
Show information about the user requesting authorization.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17091
diff
changeset
|
51 #include "gntblist.h" |
15817 | 52 |
53 #include <string.h> | |
54 | |
55 typedef struct | |
56 { | |
57 GntWidget *window; | |
58 GntWidget *tree; | |
59 } FinchAccountList; | |
60 | |
61 static FinchAccountList accounts; | |
62 | |
63 typedef struct | |
64 { | |
15822 | 65 PurpleAccount *account; /* NULL for a new account */ |
15817 | 66 |
67 GntWidget *window; | |
68 | |
69 GntWidget *protocol; | |
25925
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
24595
diff
changeset
|
70 GntWidget *username; |
15817 | 71 GntWidget *password; |
72 GntWidget *alias; | |
23083
02ef6c5c6650
Allow account registration in a new account dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22794
diff
changeset
|
73 |
15817 | 74 GntWidget *splits; |
75 GList *split_entries; | |
76 | |
77 GList *prpl_entries; | |
78 GntWidget *prpls; | |
79 | |
80 GntWidget *newmail; | |
81 GntWidget *remember; | |
23083
02ef6c5c6650
Allow account registration in a new account dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22794
diff
changeset
|
82 GntWidget *regserver; |
15817 | 83 } AccountEditDialog; |
84 | |
85 /* This is necessary to close an edit-dialog when an account is deleted */ | |
86 static GList *accountdialogs; | |
87 | |
88 static void | |
15822 | 89 account_add(PurpleAccount *account) |
15817 | 90 { |
91 gnt_tree_add_choice(GNT_TREE(accounts.tree), account, | |
92 gnt_tree_create_row(GNT_TREE(accounts.tree), | |
15822 | 93 purple_account_get_username(account), |
94 purple_account_get_protocol_name(account)), | |
15817 | 95 NULL, NULL); |
96 gnt_tree_set_choice(GNT_TREE(accounts.tree), account, | |
15822 | 97 purple_account_get_enabled(account, FINCH_UI)); |
15817 | 98 } |
99 | |
100 static void | |
101 edit_dialog_destroy(AccountEditDialog *dialog) | |
102 { | |
103 accountdialogs = g_list_remove(accountdialogs, dialog); | |
104 g_list_free(dialog->prpl_entries); | |
105 g_list_free(dialog->split_entries); | |
106 g_free(dialog); | |
107 } | |
108 | |
109 static void | |
110 save_account_cb(AccountEditDialog *dialog) | |
111 { | |
15822 | 112 PurpleAccount *account; |
113 PurplePlugin *plugin; | |
114 PurplePluginProtocolInfo *prplinfo; | |
15817 | 115 const char *value; |
116 GString *username; | |
117 | |
118 /* XXX: Do some error checking first. */ | |
119 | |
120 plugin = gnt_combo_box_get_selected_data(GNT_COMBO_BOX(dialog->protocol)); | |
15822 | 121 prplinfo = PURPLE_PLUGIN_PROTOCOL_INFO(plugin); |
15817 | 122 |
25925
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
24595
diff
changeset
|
123 /* Username && user-splits */ |
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
24595
diff
changeset
|
124 value = gnt_entry_get_text(GNT_ENTRY(dialog->username)); |
15817 | 125 |
126 if (value == NULL || *value == '\0') | |
127 { | |
30242
cfdd4d3ba550
Some updates to the account window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28770
diff
changeset
|
128 purple_notify_error(NULL, _("Error"), |
cfdd4d3ba550
Some updates to the account window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28770
diff
changeset
|
129 dialog->account ? _("Account was not modified") : _("Account was not added"), |
22794
cc8903c59d6b
Change the string "screen name" to "username" everywhere. I think most
Mark Doliner <mark@kingant.net>
parents:
22257
diff
changeset
|
130 _("Username of an account must be non-empty.")); |
15817 | 131 return; |
132 } | |
23083
02ef6c5c6650
Allow account registration in a new account dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22794
diff
changeset
|
133 |
15817 | 134 username = g_string_new(value); |
135 | |
136 if (prplinfo != NULL) | |
137 { | |
138 GList *iter, *entries; | |
139 for (iter = prplinfo->user_splits, entries = dialog->split_entries; | |
140 iter && entries; iter = iter->next, entries = entries->next) | |
141 { | |
15822 | 142 PurpleAccountUserSplit *split = iter->data; |
15817 | 143 GntWidget *entry = entries->data; |
144 | |
145 value = gnt_entry_get_text(GNT_ENTRY(entry)); | |
146 if (value == NULL || *value == '\0') | |
15822 | 147 value = purple_account_user_split_get_default_value(split); |
15817 | 148 g_string_append_printf(username, "%c%s", |
15822 | 149 purple_account_user_split_get_separator(split), |
15817 | 150 value); |
151 } | |
152 } | |
153 | |
154 if (dialog->account == NULL) | |
155 { | |
15822 | 156 account = purple_account_new(username->str, purple_plugin_get_id(plugin)); |
157 purple_accounts_add(account); | |
15817 | 158 } |
159 else | |
160 { | |
161 account = dialog->account; | |
162 | |
163 /* Protocol */ | |
30242
cfdd4d3ba550
Some updates to the account window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28770
diff
changeset
|
164 if (purple_account_is_disconnected(account)) { |
cfdd4d3ba550
Some updates to the account window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28770
diff
changeset
|
165 purple_account_set_protocol_id(account, purple_plugin_get_id(plugin)); |
cfdd4d3ba550
Some updates to the account window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28770
diff
changeset
|
166 purple_account_set_username(account, username->str); |
cfdd4d3ba550
Some updates to the account window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28770
diff
changeset
|
167 } else { |
cfdd4d3ba550
Some updates to the account window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28770
diff
changeset
|
168 const char *old = purple_account_get_protocol_id(account); |
cfdd4d3ba550
Some updates to the account window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28770
diff
changeset
|
169 char *oldprpl; |
cfdd4d3ba550
Some updates to the account window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28770
diff
changeset
|
170 if (strcmp(old, purple_plugin_get_id(plugin))) { |
cfdd4d3ba550
Some updates to the account window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28770
diff
changeset
|
171 purple_notify_error(NULL, _("Error"), _("Account was not modified"), |
cfdd4d3ba550
Some updates to the account window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28770
diff
changeset
|
172 _("The account's protocol cannot be changed while it is connected to the server.")); |
cfdd4d3ba550
Some updates to the account window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28770
diff
changeset
|
173 return; |
cfdd4d3ba550
Some updates to the account window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28770
diff
changeset
|
174 } |
cfdd4d3ba550
Some updates to the account window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28770
diff
changeset
|
175 |
cfdd4d3ba550
Some updates to the account window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28770
diff
changeset
|
176 oldprpl = g_strdup(purple_normalize(account, purple_account_get_username(account))); |
cfdd4d3ba550
Some updates to the account window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28770
diff
changeset
|
177 if (g_utf8_collate(oldprpl, purple_normalize(account, username->str))) { |
cfdd4d3ba550
Some updates to the account window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28770
diff
changeset
|
178 purple_notify_error(NULL, _("Error"), _("Account was not modified"), |
cfdd4d3ba550
Some updates to the account window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28770
diff
changeset
|
179 _("The account's username cannot be changed while it is connected to the server.")); |
cfdd4d3ba550
Some updates to the account window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28770
diff
changeset
|
180 g_free(oldprpl); |
cfdd4d3ba550
Some updates to the account window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28770
diff
changeset
|
181 return; |
cfdd4d3ba550
Some updates to the account window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28770
diff
changeset
|
182 } |
cfdd4d3ba550
Some updates to the account window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28770
diff
changeset
|
183 g_free(oldprpl); |
cfdd4d3ba550
Some updates to the account window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28770
diff
changeset
|
184 purple_account_set_username(account, username->str); |
cfdd4d3ba550
Some updates to the account window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28770
diff
changeset
|
185 } |
15817 | 186 } |
187 g_string_free(username, TRUE); | |
188 | |
189 /* Alias */ | |
190 value = gnt_entry_get_text(GNT_ENTRY(dialog->alias)); | |
28296
a07e46f20644
Allow unsetting account alias in finch.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27838
diff
changeset
|
191 purple_account_set_alias(account, value); |
15817 | 192 |
193 /* Remember password and password */ | |
15822 | 194 purple_account_set_remember_password(account, |
15817 | 195 gnt_check_box_get_checked(GNT_CHECK_BOX(dialog->remember))); |
196 value = gnt_entry_get_text(GNT_ENTRY(dialog->password)); | |
19762
656506d8935e
Don't prompt for the password again if the user entered it once in the account window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19681
diff
changeset
|
197 if (value && *value) |
15822 | 198 purple_account_set_password(account, value); |
15817 | 199 else |
15822 | 200 purple_account_set_password(account, NULL); |
15817 | 201 |
202 /* Mail notification */ | |
15822 | 203 purple_account_set_check_mail(account, |
15817 | 204 gnt_check_box_get_checked(GNT_CHECK_BOX(dialog->newmail))); |
205 | |
206 /* Protocol options */ | |
207 if (prplinfo) | |
208 { | |
209 GList *iter, *entries; | |
23083
02ef6c5c6650
Allow account registration in a new account dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22794
diff
changeset
|
210 |
15817 | 211 for (iter = prplinfo->protocol_options, entries = dialog->prpl_entries; |
212 iter && entries; iter = iter->next, entries = entries->next) | |
213 { | |
15822 | 214 PurpleAccountOption *option = iter->data; |
15817 | 215 GntWidget *entry = entries->data; |
15822 | 216 PurplePrefType type = purple_account_option_get_type(option); |
217 const char *setting = purple_account_option_get_setting(option); | |
15817 | 218 |
15822 | 219 if (type == PURPLE_PREF_STRING) |
15817 | 220 { |
221 const char *value = gnt_entry_get_text(GNT_ENTRY(entry)); | |
15822 | 222 purple_account_set_string(account, setting, value); |
15817 | 223 } |
15822 | 224 else if (type == PURPLE_PREF_INT) |
15817 | 225 { |
226 const char *str = gnt_entry_get_text(GNT_ENTRY(entry)); | |
227 int value = 0; | |
228 if (str) | |
229 value = atoi(str); | |
15822 | 230 purple_account_set_int(account, setting, value); |
15817 | 231 } |
15822 | 232 else if (type == PURPLE_PREF_BOOLEAN) |
15817 | 233 { |
234 gboolean value = gnt_check_box_get_checked(GNT_CHECK_BOX(entry)); | |
15822 | 235 purple_account_set_bool(account, setting, value); |
15817 | 236 } |
15822 | 237 else if (type == PURPLE_PREF_STRING_LIST) |
15817 | 238 { |
30450
014dbe36b722
finch: Add support for string lists as account options
Paul Aurich <paul@darkrain42.org>
parents:
30242
diff
changeset
|
239 gchar *value = gnt_combo_box_get_selected_data(GNT_COMBO_BOX(entry)); |
014dbe36b722
finch: Add support for string lists as account options
Paul Aurich <paul@darkrain42.org>
parents:
30242
diff
changeset
|
240 purple_account_set_string(account, setting, value); |
15817 | 241 } |
242 else | |
243 { | |
244 g_assert_not_reached(); | |
245 } | |
246 } | |
247 } | |
248 | |
249 /* XXX: Proxy options */ | |
250 | |
19392
74f7d5e4a605
Focus the modified/created account in the accounts window after modifying/
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18829
diff
changeset
|
251 if (accounts.window && accounts.tree) { |
74f7d5e4a605
Focus the modified/created account in the accounts window after modifying/
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18829
diff
changeset
|
252 gnt_tree_set_selected(GNT_TREE(accounts.tree), account); |
74f7d5e4a605
Focus the modified/created account in the accounts window after modifying/
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18829
diff
changeset
|
253 gnt_box_give_focus_to_child(GNT_BOX(accounts.window), accounts.tree); |
74f7d5e4a605
Focus the modified/created account in the accounts window after modifying/
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18829
diff
changeset
|
254 } |
74f7d5e4a605
Focus the modified/created account in the accounts window after modifying/
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18829
diff
changeset
|
255 |
23083
02ef6c5c6650
Allow account registration in a new account dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22794
diff
changeset
|
256 if (prplinfo && prplinfo->register_user && |
02ef6c5c6650
Allow account registration in a new account dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22794
diff
changeset
|
257 gnt_check_box_get_checked(GNT_CHECK_BOX(dialog->regserver))) { |
02ef6c5c6650
Allow account registration in a new account dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22794
diff
changeset
|
258 purple_account_register(account); |
02ef6c5c6650
Allow account registration in a new account dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22794
diff
changeset
|
259 } else if (dialog->account == NULL) { |
02ef6c5c6650
Allow account registration in a new account dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22794
diff
changeset
|
260 /* This is a new account. Set it to the current status. */ |
02ef6c5c6650
Allow account registration in a new account dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22794
diff
changeset
|
261 /* Xerox from gtkaccount.c :D */ |
02ef6c5c6650
Allow account registration in a new account dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22794
diff
changeset
|
262 const PurpleSavedStatus *saved_status; |
02ef6c5c6650
Allow account registration in a new account dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22794
diff
changeset
|
263 saved_status = purple_savedstatus_get_current(); |
02ef6c5c6650
Allow account registration in a new account dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22794
diff
changeset
|
264 if (saved_status != NULL) { |
02ef6c5c6650
Allow account registration in a new account dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22794
diff
changeset
|
265 purple_savedstatus_activate_for_account(saved_status, account); |
02ef6c5c6650
Allow account registration in a new account dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22794
diff
changeset
|
266 purple_account_set_enabled(account, FINCH_UI, TRUE); |
02ef6c5c6650
Allow account registration in a new account dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22794
diff
changeset
|
267 } |
02ef6c5c6650
Allow account registration in a new account dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22794
diff
changeset
|
268 } |
02ef6c5c6650
Allow account registration in a new account dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22794
diff
changeset
|
269 |
30242
cfdd4d3ba550
Some updates to the account window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28770
diff
changeset
|
270 /* In case of a new account, the 'Accounts' window is updated from the account-added |
cfdd4d3ba550
Some updates to the account window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28770
diff
changeset
|
271 * callback. In case of changes in an existing account, we need to explicitly do it |
cfdd4d3ba550
Some updates to the account window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28770
diff
changeset
|
272 * here. |
cfdd4d3ba550
Some updates to the account window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28770
diff
changeset
|
273 */ |
cfdd4d3ba550
Some updates to the account window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28770
diff
changeset
|
274 if (dialog->account != NULL && accounts.window) { |
cfdd4d3ba550
Some updates to the account window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28770
diff
changeset
|
275 gnt_tree_change_text(GNT_TREE(accounts.tree), dialog->account, |
cfdd4d3ba550
Some updates to the account window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28770
diff
changeset
|
276 0, purple_account_get_username(dialog->account)); |
cfdd4d3ba550
Some updates to the account window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28770
diff
changeset
|
277 gnt_tree_change_text(GNT_TREE(accounts.tree), dialog->account, |
cfdd4d3ba550
Some updates to the account window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28770
diff
changeset
|
278 1, purple_account_get_protocol_name(dialog->account)); |
cfdd4d3ba550
Some updates to the account window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28770
diff
changeset
|
279 } |
cfdd4d3ba550
Some updates to the account window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28770
diff
changeset
|
280 |
15817 | 281 gnt_widget_destroy(dialog->window); |
282 } | |
283 | |
284 static void | |
285 update_user_splits(AccountEditDialog *dialog) | |
286 { | |
287 GntWidget *hbox; | |
15822 | 288 PurplePlugin *plugin; |
289 PurplePluginProtocolInfo *prplinfo; | |
15817 | 290 GList *iter, *entries; |
291 char *username = NULL; | |
292 | |
293 if (dialog->splits) | |
294 { | |
295 gnt_box_remove_all(GNT_BOX(dialog->splits)); | |
296 g_list_free(dialog->split_entries); | |
297 } | |
298 else | |
299 { | |
300 dialog->splits = gnt_vbox_new(FALSE); | |
301 gnt_box_set_pad(GNT_BOX(dialog->splits), 0); | |
302 gnt_box_set_fill(GNT_BOX(dialog->splits), TRUE); | |
303 } | |
304 | |
305 dialog->split_entries = NULL; | |
306 | |
307 plugin = gnt_combo_box_get_selected_data(GNT_COMBO_BOX(dialog->protocol)); | |
308 if (!plugin) | |
309 return; | |
15822 | 310 prplinfo = PURPLE_PLUGIN_PROTOCOL_INFO(plugin); |
31086
a8cc50c2279f
Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents:
30450
diff
changeset
|
311 |
15822 | 312 username = dialog->account ? g_strdup(purple_account_get_username(dialog->account)) : NULL; |
15817 | 313 |
314 for (iter = prplinfo->user_splits; iter; iter = iter->next) | |
315 { | |
15822 | 316 PurpleAccountUserSplit *split = iter->data; |
15817 | 317 GntWidget *entry; |
318 char *buf; | |
319 | |
320 hbox = gnt_hbox_new(TRUE); | |
321 gnt_box_add_widget(GNT_BOX(dialog->splits), hbox); | |
322 | |
15822 | 323 buf = g_strdup_printf("%s:", purple_account_user_split_get_text(split)); |
15817 | 324 gnt_box_add_widget(GNT_BOX(hbox), gnt_label_new(buf)); |
325 | |
326 entry = gnt_entry_new(NULL); | |
327 gnt_box_add_widget(GNT_BOX(hbox), entry); | |
328 | |
329 dialog->split_entries = g_list_append(dialog->split_entries, entry); | |
330 g_free(buf); | |
331 } | |
332 | |
333 for (iter = g_list_last(prplinfo->user_splits), entries = g_list_last(dialog->split_entries); | |
334 iter && entries; iter = iter->prev, entries = entries->prev) | |
335 { | |
336 GntWidget *entry = entries->data; | |
15822 | 337 PurpleAccountUserSplit *split = iter->data; |
15817 | 338 const char *value = NULL; |
339 char *s; | |
340 | |
341 if (dialog->account) | |
342 { | |
18037
e3e42a99070e
jabber can contain @ symbols and / in the resource, so we have to look for
Nathan Walp <nwalp@pidgin.im>
parents:
17346
diff
changeset
|
343 if(purple_account_user_split_get_reverse(split)) |
e3e42a99070e
jabber can contain @ symbols and / in the resource, so we have to look for
Nathan Walp <nwalp@pidgin.im>
parents:
17346
diff
changeset
|
344 s = strrchr(username, purple_account_user_split_get_separator(split)); |
e3e42a99070e
jabber can contain @ symbols and / in the resource, so we have to look for
Nathan Walp <nwalp@pidgin.im>
parents:
17346
diff
changeset
|
345 else |
e3e42a99070e
jabber can contain @ symbols and / in the resource, so we have to look for
Nathan Walp <nwalp@pidgin.im>
parents:
17346
diff
changeset
|
346 s = strchr(username, purple_account_user_split_get_separator(split)); |
e3e42a99070e
jabber can contain @ symbols and / in the resource, so we have to look for
Nathan Walp <nwalp@pidgin.im>
parents:
17346
diff
changeset
|
347 |
15817 | 348 if (s != NULL) |
349 { | |
350 *s = '\0'; | |
351 s++; | |
352 value = s; | |
353 } | |
354 } | |
355 if (value == NULL) | |
15822 | 356 value = purple_account_user_split_get_default_value(split); |
15817 | 357 |
358 if (value != NULL) | |
359 gnt_entry_set_text(GNT_ENTRY(entry), value); | |
360 } | |
361 | |
362 if (username != NULL) | |
25925
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
24595
diff
changeset
|
363 gnt_entry_set_text(GNT_ENTRY(dialog->username), username); |
15817 | 364 |
365 g_free(username); | |
366 } | |
367 | |
368 static void | |
369 add_protocol_options(AccountEditDialog *dialog) | |
370 { | |
15822 | 371 PurplePlugin *plugin; |
372 PurplePluginProtocolInfo *prplinfo; | |
15817 | 373 GList *iter; |
374 GntWidget *vbox, *box; | |
15822 | 375 PurpleAccount *account; |
15817 | 376 |
377 if (dialog->prpls) | |
378 gnt_box_remove_all(GNT_BOX(dialog->prpls)); | |
379 else | |
380 { | |
381 dialog->prpls = vbox = gnt_vbox_new(FALSE); | |
382 gnt_box_set_pad(GNT_BOX(vbox), 0); | |
383 gnt_box_set_alignment(GNT_BOX(vbox), GNT_ALIGN_LEFT); | |
384 gnt_box_set_fill(GNT_BOX(vbox), TRUE); | |
385 } | |
386 | |
387 if (dialog->prpl_entries) | |
388 { | |
389 g_list_free(dialog->prpl_entries); | |
390 dialog->prpl_entries = NULL; | |
391 } | |
392 | |
393 vbox = dialog->prpls; | |
394 | |
395 plugin = gnt_combo_box_get_selected_data(GNT_COMBO_BOX(dialog->protocol)); | |
396 if (!plugin) | |
397 return; | |
398 | |
15822 | 399 prplinfo = PURPLE_PLUGIN_PROTOCOL_INFO(plugin); |
15817 | 400 |
401 account = dialog->account; | |
402 | |
403 for (iter = prplinfo->protocol_options; iter; iter = iter->next) | |
404 { | |
15822 | 405 PurpleAccountOption *option = iter->data; |
406 PurplePrefType type = purple_account_option_get_type(option); | |
15817 | 407 |
408 box = gnt_hbox_new(TRUE); | |
409 gnt_box_set_pad(GNT_BOX(box), 0); | |
410 gnt_box_add_widget(GNT_BOX(vbox), box); | |
411 | |
15822 | 412 if (type == PURPLE_PREF_BOOLEAN) |
15817 | 413 { |
15822 | 414 GntWidget *widget = gnt_check_box_new(purple_account_option_get_text(option)); |
15817 | 415 gnt_box_add_widget(GNT_BOX(box), widget); |
416 dialog->prpl_entries = g_list_append(dialog->prpl_entries, widget); | |
417 | |
418 if (account) | |
419 gnt_check_box_set_checked(GNT_CHECK_BOX(widget), | |
15822 | 420 purple_account_get_bool(account, |
421 purple_account_option_get_setting(option), | |
422 purple_account_option_get_default_bool(option))); | |
15817 | 423 else |
424 gnt_check_box_set_checked(GNT_CHECK_BOX(widget), | |
15822 | 425 purple_account_option_get_default_bool(option)); |
15817 | 426 } |
427 else | |
428 { | |
429 gnt_box_add_widget(GNT_BOX(box), | |
15822 | 430 gnt_label_new(purple_account_option_get_text(option))); |
15817 | 431 |
15822 | 432 if (type == PURPLE_PREF_STRING_LIST) |
15817 | 433 { |
30450
014dbe36b722
finch: Add support for string lists as account options
Paul Aurich <paul@darkrain42.org>
parents:
30242
diff
changeset
|
434 GntWidget *combo = gnt_combo_box_new(); |
014dbe36b722
finch: Add support for string lists as account options
Paul Aurich <paul@darkrain42.org>
parents:
30242
diff
changeset
|
435 GList *opt_iter = purple_account_option_get_list(option); |
014dbe36b722
finch: Add support for string lists as account options
Paul Aurich <paul@darkrain42.org>
parents:
30242
diff
changeset
|
436 const char *dv = purple_account_option_get_default_list_value(option); |
014dbe36b722
finch: Add support for string lists as account options
Paul Aurich <paul@darkrain42.org>
parents:
30242
diff
changeset
|
437 const char *active = dv; |
014dbe36b722
finch: Add support for string lists as account options
Paul Aurich <paul@darkrain42.org>
parents:
30242
diff
changeset
|
438 |
014dbe36b722
finch: Add support for string lists as account options
Paul Aurich <paul@darkrain42.org>
parents:
30242
diff
changeset
|
439 if (account) |
014dbe36b722
finch: Add support for string lists as account options
Paul Aurich <paul@darkrain42.org>
parents:
30242
diff
changeset
|
440 active = purple_account_get_string(account, |
014dbe36b722
finch: Add support for string lists as account options
Paul Aurich <paul@darkrain42.org>
parents:
30242
diff
changeset
|
441 purple_account_option_get_setting(option), dv); |
014dbe36b722
finch: Add support for string lists as account options
Paul Aurich <paul@darkrain42.org>
parents:
30242
diff
changeset
|
442 |
014dbe36b722
finch: Add support for string lists as account options
Paul Aurich <paul@darkrain42.org>
parents:
30242
diff
changeset
|
443 gnt_box_add_widget(GNT_BOX(box), combo); |
014dbe36b722
finch: Add support for string lists as account options
Paul Aurich <paul@darkrain42.org>
parents:
30242
diff
changeset
|
444 dialog->prpl_entries = g_list_append(dialog->prpl_entries, combo); |
014dbe36b722
finch: Add support for string lists as account options
Paul Aurich <paul@darkrain42.org>
parents:
30242
diff
changeset
|
445 |
014dbe36b722
finch: Add support for string lists as account options
Paul Aurich <paul@darkrain42.org>
parents:
30242
diff
changeset
|
446 for ( ; opt_iter; opt_iter = opt_iter->next) |
014dbe36b722
finch: Add support for string lists as account options
Paul Aurich <paul@darkrain42.org>
parents:
30242
diff
changeset
|
447 { |
014dbe36b722
finch: Add support for string lists as account options
Paul Aurich <paul@darkrain42.org>
parents:
30242
diff
changeset
|
448 PurpleKeyValuePair *kvp = opt_iter->data; |
014dbe36b722
finch: Add support for string lists as account options
Paul Aurich <paul@darkrain42.org>
parents:
30242
diff
changeset
|
449 gnt_combo_box_add_data(GNT_COMBO_BOX(combo), kvp->value, kvp->key); |
014dbe36b722
finch: Add support for string lists as account options
Paul Aurich <paul@darkrain42.org>
parents:
30242
diff
changeset
|
450 |
014dbe36b722
finch: Add support for string lists as account options
Paul Aurich <paul@darkrain42.org>
parents:
30242
diff
changeset
|
451 if (g_str_equal(kvp->value, active)) |
014dbe36b722
finch: Add support for string lists as account options
Paul Aurich <paul@darkrain42.org>
parents:
30242
diff
changeset
|
452 gnt_combo_box_set_selected(GNT_COMBO_BOX(combo), kvp->value); |
014dbe36b722
finch: Add support for string lists as account options
Paul Aurich <paul@darkrain42.org>
parents:
30242
diff
changeset
|
453 } |
15817 | 454 } |
455 else | |
456 { | |
457 GntWidget *entry = gnt_entry_new(NULL); | |
458 gnt_box_add_widget(GNT_BOX(box), entry); | |
459 dialog->prpl_entries = g_list_append(dialog->prpl_entries, entry); | |
460 | |
15822 | 461 if (type == PURPLE_PREF_STRING) |
15817 | 462 { |
15822 | 463 const char *dv = purple_account_option_get_default_string(option); |
15817 | 464 |
465 if (account) | |
466 gnt_entry_set_text(GNT_ENTRY(entry), | |
15822 | 467 purple_account_get_string(account, |
468 purple_account_option_get_setting(option), dv)); | |
15817 | 469 else |
470 gnt_entry_set_text(GNT_ENTRY(entry), dv); | |
471 } | |
15822 | 472 else if (type == PURPLE_PREF_INT) |
15817 | 473 { |
474 char str[32]; | |
15822 | 475 int value = purple_account_option_get_default_int(option); |
15817 | 476 if (account) |
15822 | 477 value = purple_account_get_int(account, |
478 purple_account_option_get_setting(option), value); | |
15817 | 479 snprintf(str, sizeof(str), "%d", value); |
480 gnt_entry_set_flag(GNT_ENTRY(entry), GNT_ENTRY_FLAG_INT); | |
481 gnt_entry_set_text(GNT_ENTRY(entry), str); | |
482 } | |
483 else | |
484 { | |
485 g_assert_not_reached(); | |
486 } | |
487 } | |
488 } | |
489 } | |
23083
02ef6c5c6650
Allow account registration in a new account dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22794
diff
changeset
|
490 |
02ef6c5c6650
Allow account registration in a new account dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22794
diff
changeset
|
491 /* Show the registration checkbox only in a new account dialog, |
02ef6c5c6650
Allow account registration in a new account dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22794
diff
changeset
|
492 * and when the selected prpl has the support for it. */ |
02ef6c5c6650
Allow account registration in a new account dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22794
diff
changeset
|
493 gnt_widget_set_visible(dialog->regserver, account == NULL && |
02ef6c5c6650
Allow account registration in a new account dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22794
diff
changeset
|
494 prplinfo->register_user != NULL); |
15817 | 495 } |
496 | |
497 static void | |
498 update_user_options(AccountEditDialog *dialog) | |
499 { | |
15822 | 500 PurplePlugin *plugin; |
501 PurplePluginProtocolInfo *prplinfo; | |
15817 | 502 |
503 plugin = gnt_combo_box_get_selected_data(GNT_COMBO_BOX(dialog->protocol)); | |
504 if (!plugin) | |
505 return; | |
506 | |
15822 | 507 prplinfo = PURPLE_PLUGIN_PROTOCOL_INFO(plugin); |
15817 | 508 |
509 if (dialog->newmail == NULL) | |
510 dialog->newmail = gnt_check_box_new(_("New mail notifications")); | |
511 if (dialog->account) | |
512 gnt_check_box_set_checked(GNT_CHECK_BOX(dialog->newmail), | |
15822 | 513 purple_account_get_check_mail(dialog->account)); |
15817 | 514 if (!prplinfo || !(prplinfo->options & OPT_PROTO_MAIL_CHECK)) |
515 gnt_widget_set_visible(dialog->newmail, FALSE); | |
516 else | |
517 gnt_widget_set_visible(dialog->newmail, TRUE); | |
518 | |
519 if (dialog->remember == NULL) | |
520 dialog->remember = gnt_check_box_new(_("Remember password")); | |
521 if (dialog->account) | |
522 gnt_check_box_set_checked(GNT_CHECK_BOX(dialog->remember), | |
15822 | 523 purple_account_get_remember_password(dialog->account)); |
15817 | 524 } |
525 | |
526 static void | |
15822 | 527 prpl_changed_cb(GntWidget *combo, PurplePlugin *old, PurplePlugin *new, AccountEditDialog *dialog) |
15817 | 528 { |
529 update_user_splits(dialog); | |
530 add_protocol_options(dialog); | |
531 update_user_options(dialog); /* This may not be necessary here */ | |
532 gnt_box_readjust(GNT_BOX(dialog->window)); | |
533 gnt_widget_draw(dialog->window); | |
534 } | |
535 | |
536 static void | |
15822 | 537 edit_account(PurpleAccount *account) |
15817 | 538 { |
539 GntWidget *window, *hbox; | |
540 GntWidget *combo, *button, *entry; | |
541 GList *list, *iter; | |
542 AccountEditDialog *dialog; | |
27838
3316e5c79a53
Don't crash trying to modify the settings for an account where the prpl is
Stu Tomlinson <stu@nosnilmot.com>
parents:
27587
diff
changeset
|
543 PurplePlugin *plugin; |
15817 | 544 |
545 if (account) | |
546 { | |
547 GList *iter; | |
548 for (iter = accountdialogs; iter; iter = iter->next) | |
549 { | |
550 AccountEditDialog *dlg = iter->data; | |
551 if (dlg->account == account) | |
552 return; | |
553 } | |
554 } | |
555 | |
18432
f5a17e7e4bfa
Do not crash when people run finch without 'make install'ing first.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18345
diff
changeset
|
556 list = purple_plugins_get_protocols(); |
f5a17e7e4bfa
Do not crash when people run finch without 'make install'ing first.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18345
diff
changeset
|
557 if (list == NULL) { |
f5a17e7e4bfa
Do not crash when people run finch without 'make install'ing first.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18345
diff
changeset
|
558 purple_notify_error(NULL, _("Error"), |
24053
81169f04ab1c
datallah reminds me that my strings suck
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24030
diff
changeset
|
559 _("There are no protocol plugins installed."), |
18432
f5a17e7e4bfa
Do not crash when people run finch without 'make install'ing first.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18345
diff
changeset
|
560 _("(You probably forgot to 'make install'.)")); |
f5a17e7e4bfa
Do not crash when people run finch without 'make install'ing first.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18345
diff
changeset
|
561 return; |
f5a17e7e4bfa
Do not crash when people run finch without 'make install'ing first.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18345
diff
changeset
|
562 } |
f5a17e7e4bfa
Do not crash when people run finch without 'make install'ing first.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18345
diff
changeset
|
563 |
15817 | 564 dialog = g_new0(AccountEditDialog, 1); |
565 accountdialogs = g_list_prepend(accountdialogs, dialog); | |
566 | |
567 dialog->window = window = gnt_vbox_new(FALSE); | |
568 dialog->account = account; | |
569 gnt_box_set_toplevel(GNT_BOX(window), TRUE); | |
570 gnt_box_set_title(GNT_BOX(window), account ? _("Modify Account") : _("New Account")); | |
571 gnt_box_set_alignment(GNT_BOX(window), GNT_ALIGN_MID); | |
572 gnt_box_set_pad(GNT_BOX(window), 0); | |
573 gnt_widget_set_name(window, "edit-account"); | |
574 gnt_box_set_fill(GNT_BOX(window), TRUE); | |
575 | |
576 hbox = gnt_hbox_new(TRUE); | |
577 gnt_box_set_pad(GNT_BOX(hbox), 0); | |
578 gnt_box_add_widget(GNT_BOX(window), hbox); | |
579 | |
580 dialog->protocol = combo = gnt_combo_box_new(); | |
581 for (iter = list; iter; iter = iter->next) | |
582 { | |
583 gnt_combo_box_add_data(GNT_COMBO_BOX(combo), iter->data, | |
15822 | 584 ((PurplePlugin*)iter->data)->info->name); |
15817 | 585 } |
586 | |
27838
3316e5c79a53
Don't crash trying to modify the settings for an account where the prpl is
Stu Tomlinson <stu@nosnilmot.com>
parents:
27587
diff
changeset
|
587 plugin = purple_plugins_find_with_id(purple_account_get_protocol_id(account)); |
3316e5c79a53
Don't crash trying to modify the settings for an account where the prpl is
Stu Tomlinson <stu@nosnilmot.com>
parents:
27587
diff
changeset
|
588 |
3316e5c79a53
Don't crash trying to modify the settings for an account where the prpl is
Stu Tomlinson <stu@nosnilmot.com>
parents:
27587
diff
changeset
|
589 if (account && plugin) |
3316e5c79a53
Don't crash trying to modify the settings for an account where the prpl is
Stu Tomlinson <stu@nosnilmot.com>
parents:
27587
diff
changeset
|
590 gnt_combo_box_set_selected(GNT_COMBO_BOX(combo), plugin); |
15817 | 591 else |
592 gnt_combo_box_set_selected(GNT_COMBO_BOX(combo), list->data); | |
593 | |
594 g_signal_connect(G_OBJECT(combo), "selection-changed", G_CALLBACK(prpl_changed_cb), dialog); | |
595 | |
596 gnt_box_add_widget(GNT_BOX(hbox), gnt_label_new(_("Protocol:"))); | |
597 gnt_box_add_widget(GNT_BOX(hbox), combo); | |
598 | |
599 hbox = gnt_hbox_new(TRUE); | |
600 gnt_box_set_pad(GNT_BOX(hbox), 0); | |
601 gnt_box_add_widget(GNT_BOX(window), hbox); | |
602 | |
25925
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
24595
diff
changeset
|
603 dialog->username = entry = gnt_entry_new(NULL); |
22794
cc8903c59d6b
Change the string "screen name" to "username" everywhere. I think most
Mark Doliner <mark@kingant.net>
parents:
22257
diff
changeset
|
604 gnt_box_add_widget(GNT_BOX(hbox), gnt_label_new(_("Username:"))); |
15817 | 605 gnt_box_add_widget(GNT_BOX(hbox), entry); |
606 | |
607 /* User splits */ | |
608 update_user_splits(dialog); | |
609 gnt_box_add_widget(GNT_BOX(window), dialog->splits); | |
610 | |
611 hbox = gnt_hbox_new(TRUE); | |
612 gnt_box_set_pad(GNT_BOX(hbox), 0); | |
613 gnt_box_add_widget(GNT_BOX(window), hbox); | |
614 | |
615 dialog->password = entry = gnt_entry_new(NULL); | |
616 gnt_entry_set_masked(GNT_ENTRY(entry), TRUE); | |
617 gnt_box_add_widget(GNT_BOX(hbox), gnt_label_new(_("Password:"))); | |
618 gnt_box_add_widget(GNT_BOX(hbox), entry); | |
619 if (account) | |
15822 | 620 gnt_entry_set_text(GNT_ENTRY(entry), purple_account_get_password(account)); |
15817 | 621 |
622 hbox = gnt_hbox_new(TRUE); | |
623 gnt_box_set_pad(GNT_BOX(hbox), 0); | |
624 gnt_box_add_widget(GNT_BOX(window), hbox); | |
625 | |
626 dialog->alias = entry = gnt_entry_new(NULL); | |
627 gnt_box_add_widget(GNT_BOX(hbox), gnt_label_new(_("Alias:"))); | |
628 gnt_box_add_widget(GNT_BOX(hbox), entry); | |
629 if (account) | |
15822 | 630 gnt_entry_set_text(GNT_ENTRY(entry), purple_account_get_alias(account)); |
15817 | 631 |
632 /* User options */ | |
633 update_user_options(dialog); | |
634 gnt_box_add_widget(GNT_BOX(window), dialog->remember); | |
635 gnt_box_add_widget(GNT_BOX(window), dialog->newmail); | |
636 | |
23083
02ef6c5c6650
Allow account registration in a new account dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22794
diff
changeset
|
637 /* Register checkbox */ |
02ef6c5c6650
Allow account registration in a new account dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22794
diff
changeset
|
638 dialog->regserver = gnt_check_box_new(_("Create this account on the server")); |
02ef6c5c6650
Allow account registration in a new account dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22794
diff
changeset
|
639 gnt_box_add_widget(GNT_BOX(window), dialog->regserver); |
02ef6c5c6650
Allow account registration in a new account dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22794
diff
changeset
|
640 |
15817 | 641 gnt_box_add_widget(GNT_BOX(window), gnt_line_new(FALSE)); |
642 | |
643 /* The advanced box */ | |
644 add_protocol_options(dialog); | |
645 gnt_box_add_widget(GNT_BOX(window), dialog->prpls); | |
646 | |
647 /* TODO: Add proxy options */ | |
648 | |
649 /* The button box */ | |
650 hbox = gnt_hbox_new(FALSE); | |
651 gnt_box_add_widget(GNT_BOX(window), hbox); | |
652 gnt_box_set_alignment(GNT_BOX(hbox), GNT_ALIGN_MID); | |
653 | |
654 button = gnt_button_new(_("Cancel")); | |
655 gnt_box_add_widget(GNT_BOX(hbox), button); | |
656 g_signal_connect_swapped(G_OBJECT(button), "activate", G_CALLBACK(gnt_widget_destroy), window); | |
30242
cfdd4d3ba550
Some updates to the account window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28770
diff
changeset
|
657 |
15817 | 658 button = gnt_button_new(_("Save")); |
659 gnt_box_add_widget(GNT_BOX(hbox), button); | |
660 g_signal_connect_swapped(G_OBJECT(button), "activate", G_CALLBACK(save_account_cb), dialog); | |
661 | |
662 g_signal_connect_swapped(G_OBJECT(window), "destroy", G_CALLBACK(edit_dialog_destroy), dialog); | |
663 | |
664 gnt_widget_show(window); | |
665 gnt_box_readjust(GNT_BOX(window)); | |
666 gnt_widget_draw(window); | |
667 } | |
668 | |
669 static void | |
670 add_account_cb(GntWidget *widget, gpointer null) | |
671 { | |
672 edit_account(NULL); | |
673 } | |
674 | |
675 static void | |
676 modify_account_cb(GntWidget *widget, GntTree *tree) | |
677 { | |
15822 | 678 PurpleAccount *account = gnt_tree_get_selection_data(tree); |
15817 | 679 if (!account) |
680 return; | |
681 edit_account(account); | |
682 } | |
683 | |
684 static void | |
15822 | 685 really_delete_account(PurpleAccount *account) |
15817 | 686 { |
687 GList *iter; | |
688 for (iter = accountdialogs; iter; iter = iter->next) | |
689 { | |
690 AccountEditDialog *dlg = iter->data; | |
691 if (dlg->account == account) | |
692 { | |
693 gnt_widget_destroy(dlg->window); | |
694 break; | |
695 } | |
696 } | |
15822 | 697 purple_request_close_with_handle(account); /* Close any other opened delete window */ |
698 purple_accounts_delete(account); | |
15817 | 699 } |
700 | |
701 static void | |
702 delete_account_cb(GntWidget *widget, GntTree *tree) | |
703 { | |
15822 | 704 PurpleAccount *account; |
15817 | 705 char *prompt; |
706 | |
707 account = gnt_tree_get_selection_data(tree); | |
708 if (!account) | |
709 return; | |
710 | |
711 prompt = g_strdup_printf(_("Are you sure you want to delete %s?"), | |
15822 | 712 purple_account_get_username(account)); |
15817 | 713 |
22257
8233bbcf3e86
The Gnome Human Interface Guidelines say, "if pressing this button by
Mark Doliner <mark@kingant.net>
parents:
22213
diff
changeset
|
714 purple_request_action(account, _("Delete Account"), prompt, NULL, |
8233bbcf3e86
The Gnome Human Interface Guidelines say, "if pressing this button by
Mark Doliner <mark@kingant.net>
parents:
22213
diff
changeset
|
715 PURPLE_DEFAULT_ACTION_NONE, |
21570
dccfd999ffe7
merge of '76c07fcb434a2a7aa289734bb221c171a376d73b'
Evan Schoenberg <evan.s@dreskin.net>
parents:
21244
diff
changeset
|
716 account, NULL, NULL, account, 2, |
16462
4b6d81d26b56
Fix a warning introduced with the request api changes.
Gary Kramlich <grim@reaperworld.com>
parents:
16439
diff
changeset
|
717 _("Delete"), really_delete_account, |
4b6d81d26b56
Fix a warning introduced with the request api changes.
Gary Kramlich <grim@reaperworld.com>
parents:
16439
diff
changeset
|
718 _("Cancel"), NULL); |
15817 | 719 g_free(prompt); |
720 } | |
721 | |
722 static void | |
723 account_toggled(GntWidget *widget, void *key, gpointer null) | |
724 { | |
15822 | 725 PurpleAccount *account = key; |
26498
246081d2d990
Activate the current status for an account being enabled
Richard Nelson <wabz@pidgin.im>
parents:
26347
diff
changeset
|
726 gboolean enabled = gnt_tree_get_choice(GNT_TREE(widget), key); |
15817 | 727 |
26498
246081d2d990
Activate the current status for an account being enabled
Richard Nelson <wabz@pidgin.im>
parents:
26347
diff
changeset
|
728 if (enabled) |
246081d2d990
Activate the current status for an account being enabled
Richard Nelson <wabz@pidgin.im>
parents:
26347
diff
changeset
|
729 purple_savedstatus_activate_for_account(purple_savedstatus_get_current(), |
246081d2d990
Activate the current status for an account being enabled
Richard Nelson <wabz@pidgin.im>
parents:
26347
diff
changeset
|
730 account); |
246081d2d990
Activate the current status for an account being enabled
Richard Nelson <wabz@pidgin.im>
parents:
26347
diff
changeset
|
731 |
246081d2d990
Activate the current status for an account being enabled
Richard Nelson <wabz@pidgin.im>
parents:
26347
diff
changeset
|
732 purple_account_set_enabled(account, FINCH_UI, enabled); |
15817 | 733 } |
734 | |
24030
84deb53a0a06
Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23083
diff
changeset
|
735 static gboolean |
84deb53a0a06
Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23083
diff
changeset
|
736 account_list_key_pressed_cb(GntWidget *widget, const char *text, gpointer null) |
84deb53a0a06
Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23083
diff
changeset
|
737 { |
84deb53a0a06
Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23083
diff
changeset
|
738 GntTree *tree = GNT_TREE(widget); |
84deb53a0a06
Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23083
diff
changeset
|
739 PurpleAccount *account = gnt_tree_get_selection_data(tree); |
84deb53a0a06
Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23083
diff
changeset
|
740 int move, pos, count; |
84deb53a0a06
Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23083
diff
changeset
|
741 GList *accounts; |
84deb53a0a06
Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23083
diff
changeset
|
742 |
84deb53a0a06
Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23083
diff
changeset
|
743 if (!account) |
84deb53a0a06
Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23083
diff
changeset
|
744 return FALSE; |
84deb53a0a06
Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23083
diff
changeset
|
745 |
84deb53a0a06
Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23083
diff
changeset
|
746 switch (text[0]) { |
84deb53a0a06
Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23083
diff
changeset
|
747 case '-': |
84deb53a0a06
Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23083
diff
changeset
|
748 move = -1; |
84deb53a0a06
Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23083
diff
changeset
|
749 break; |
84deb53a0a06
Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23083
diff
changeset
|
750 case '=': |
84deb53a0a06
Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23083
diff
changeset
|
751 move = 2; /* XXX: This seems to be a bug in libpurple */ |
84deb53a0a06
Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23083
diff
changeset
|
752 break; |
84deb53a0a06
Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23083
diff
changeset
|
753 default: |
84deb53a0a06
Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23083
diff
changeset
|
754 return FALSE; |
84deb53a0a06
Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23083
diff
changeset
|
755 } |
84deb53a0a06
Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23083
diff
changeset
|
756 |
84deb53a0a06
Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23083
diff
changeset
|
757 accounts = purple_accounts_get_all(); |
84deb53a0a06
Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23083
diff
changeset
|
758 count = g_list_length(accounts); |
84deb53a0a06
Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23083
diff
changeset
|
759 pos = g_list_index(accounts, account); |
84deb53a0a06
Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23083
diff
changeset
|
760 pos = (move + pos + count + 1) % (count + 1); |
84deb53a0a06
Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23083
diff
changeset
|
761 purple_accounts_reorder(account, pos); |
84deb53a0a06
Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23083
diff
changeset
|
762 |
84deb53a0a06
Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23083
diff
changeset
|
763 /* I don't like this, but recreating the entire list seems to be |
84deb53a0a06
Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23083
diff
changeset
|
764 * the easiest way of doing it */ |
84deb53a0a06
Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23083
diff
changeset
|
765 gnt_tree_remove_all(tree); |
84deb53a0a06
Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23083
diff
changeset
|
766 accounts = purple_accounts_get_all(); |
84deb53a0a06
Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23083
diff
changeset
|
767 for (; accounts; accounts = accounts->next) |
84deb53a0a06
Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23083
diff
changeset
|
768 account_add(accounts->data); |
84deb53a0a06
Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23083
diff
changeset
|
769 gnt_tree_set_selected(tree, account); |
84deb53a0a06
Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23083
diff
changeset
|
770 |
84deb53a0a06
Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23083
diff
changeset
|
771 return TRUE; |
84deb53a0a06
Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23083
diff
changeset
|
772 } |
84deb53a0a06
Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23083
diff
changeset
|
773 |
15817 | 774 static void |
775 reset_accounts_win(GntWidget *widget, gpointer null) | |
776 { | |
777 accounts.window = NULL; | |
778 accounts.tree = NULL; | |
779 } | |
780 | |
781 void finch_accounts_show_all() | |
782 { | |
18063
926ccb104da0
disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents:
18058
diff
changeset
|
783 GList *iter; |
15817 | 784 GntWidget *box, *button; |
785 | |
18345
2d4df5ef0090
If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18210
diff
changeset
|
786 if (accounts.window) { |
2d4df5ef0090
If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18210
diff
changeset
|
787 gnt_window_present(accounts.window); |
15817 | 788 return; |
18345
2d4df5ef0090
If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18210
diff
changeset
|
789 } |
15817 | 790 |
791 accounts.window = gnt_vbox_new(FALSE); | |
792 gnt_box_set_toplevel(GNT_BOX(accounts.window), TRUE); | |
793 gnt_box_set_title(GNT_BOX(accounts.window), _("Accounts")); | |
794 gnt_box_set_pad(GNT_BOX(accounts.window), 0); | |
795 gnt_box_set_alignment(GNT_BOX(accounts.window), GNT_ALIGN_MID); | |
796 gnt_widget_set_name(accounts.window, "accounts"); | |
797 | |
798 gnt_box_add_widget(GNT_BOX(accounts.window), | |
799 gnt_label_new(_("You can enable/disable accounts from the following list."))); | |
800 | |
801 gnt_box_add_widget(GNT_BOX(accounts.window), gnt_line_new(FALSE)); | |
802 | |
803 accounts.tree = gnt_tree_new_with_columns(2); | |
804 GNT_WIDGET_SET_FLAGS(accounts.tree, GNT_WIDGET_NO_BORDER); | |
805 | |
15822 | 806 for (iter = purple_accounts_get_all(); iter; iter = iter->next) |
15817 | 807 { |
15822 | 808 PurpleAccount *account = iter->data; |
15817 | 809 account_add(account); |
810 } | |
811 | |
812 g_signal_connect(G_OBJECT(accounts.tree), "toggled", G_CALLBACK(account_toggled), NULL); | |
24030
84deb53a0a06
Press - or = in the accounts list to reorder accounts.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23083
diff
changeset
|
813 g_signal_connect(G_OBJECT(accounts.tree), "key_pressed", G_CALLBACK(account_list_key_pressed_cb), NULL); |
22213
16ff37f64e29
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 <imadil@gmail.com>
parents:
22007
diff
changeset
|
814 |
15817 | 815 gnt_tree_set_col_width(GNT_TREE(accounts.tree), 0, 40); |
816 gnt_tree_set_col_width(GNT_TREE(accounts.tree), 1, 10); | |
817 gnt_box_add_widget(GNT_BOX(accounts.window), accounts.tree); | |
818 | |
819 gnt_box_add_widget(GNT_BOX(accounts.window), gnt_line_new(FALSE)); | |
820 | |
821 box = gnt_hbox_new(FALSE); | |
822 | |
823 button = gnt_button_new(_("Add")); | |
824 gnt_box_add_widget(GNT_BOX(box), button); | |
18511
7ee0e0597a26
Add utility function to trigger some button when some key is pressed with
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18432
diff
changeset
|
825 gnt_util_set_trigger_widget(GNT_WIDGET(accounts.tree), GNT_KEY_INS, button); |
15817 | 826 g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(add_account_cb), NULL); |
827 | |
828 button = gnt_button_new(_("Modify")); | |
829 gnt_box_add_widget(GNT_BOX(box), button); | |
830 g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(modify_account_cb), accounts.tree); | |
831 | |
832 button = gnt_button_new(_("Delete")); | |
833 gnt_box_add_widget(GNT_BOX(box), button); | |
18511
7ee0e0597a26
Add utility function to trigger some button when some key is pressed with
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18432
diff
changeset
|
834 gnt_util_set_trigger_widget(GNT_WIDGET(accounts.tree), GNT_KEY_DEL, button); |
15817 | 835 g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(delete_account_cb), accounts.tree); |
22213
16ff37f64e29
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 <imadil@gmail.com>
parents:
22007
diff
changeset
|
836 |
15817 | 837 gnt_box_add_widget(GNT_BOX(accounts.window), box); |
838 | |
839 g_signal_connect(G_OBJECT(accounts.window), "destroy", G_CALLBACK(reset_accounts_win), NULL); | |
22213
16ff37f64e29
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 <imadil@gmail.com>
parents:
22007
diff
changeset
|
840 |
15817 | 841 gnt_widget_show(accounts.window); |
842 } | |
843 | |
19768
41cad24fd6df
Instead of just notifying the user about a connection error, give him options
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19762
diff
changeset
|
844 void finch_account_dialog_show(PurpleAccount *account) |
41cad24fd6df
Instead of just notifying the user about a connection error, give him options
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19762
diff
changeset
|
845 { |
41cad24fd6df
Instead of just notifying the user about a connection error, give him options
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19762
diff
changeset
|
846 edit_account(account); |
41cad24fd6df
Instead of just notifying the user about a connection error, give him options
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19762
diff
changeset
|
847 } |
41cad24fd6df
Instead of just notifying the user about a connection error, give him options
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19762
diff
changeset
|
848 |
15817 | 849 static gpointer |
22007
c38d72677c8a
Probe for -Wstrict-prototypes to get some more warnings. I then cleaned up
Richard Laager <rlaager@wiktel.com>
parents:
21570
diff
changeset
|
850 finch_accounts_get_handle(void) |
15817 | 851 { |
852 static int handle; | |
853 | |
854 return &handle; | |
855 } | |
856 | |
857 static void | |
15822 | 858 account_added_callback(PurpleAccount *account) |
15817 | 859 { |
860 if (accounts.window == NULL) | |
861 return; | |
862 account_add(account); | |
863 gnt_widget_draw(accounts.tree); | |
864 } | |
865 | |
866 static void | |
15822 | 867 account_removed_callback(PurpleAccount *account) |
15817 | 868 { |
869 if (accounts.window == NULL) | |
870 return; | |
871 | |
872 gnt_tree_remove(GNT_TREE(accounts.tree), account); | |
873 } | |
874 | |
17346
8c3a3407af58
Finch autoreconnecting (largely copy/paste from pidgin)
Richard Nelson <wabz@pidgin.im>
parents:
17091
diff
changeset
|
875 static void |
8c3a3407af58
Finch autoreconnecting (largely copy/paste from pidgin)
Richard Nelson <wabz@pidgin.im>
parents:
17091
diff
changeset
|
876 account_abled_cb(PurpleAccount *account, gpointer user_data) |
8c3a3407af58
Finch autoreconnecting (largely copy/paste from pidgin)
Richard Nelson <wabz@pidgin.im>
parents:
17091
diff
changeset
|
877 { |
8c3a3407af58
Finch autoreconnecting (largely copy/paste from pidgin)
Richard Nelson <wabz@pidgin.im>
parents:
17091
diff
changeset
|
878 if (accounts.window == NULL) |
8c3a3407af58
Finch autoreconnecting (largely copy/paste from pidgin)
Richard Nelson <wabz@pidgin.im>
parents:
17091
diff
changeset
|
879 return; |
8c3a3407af58
Finch autoreconnecting (largely copy/paste from pidgin)
Richard Nelson <wabz@pidgin.im>
parents:
17091
diff
changeset
|
880 gnt_tree_set_choice(GNT_TREE(accounts.tree), account, |
8c3a3407af58
Finch autoreconnecting (largely copy/paste from pidgin)
Richard Nelson <wabz@pidgin.im>
parents:
17091
diff
changeset
|
881 GPOINTER_TO_INT(user_data)); |
8c3a3407af58
Finch autoreconnecting (largely copy/paste from pidgin)
Richard Nelson <wabz@pidgin.im>
parents:
17091
diff
changeset
|
882 } |
8c3a3407af58
Finch autoreconnecting (largely copy/paste from pidgin)
Richard Nelson <wabz@pidgin.im>
parents:
17091
diff
changeset
|
883 |
15817 | 884 void finch_accounts_init() |
885 { | |
18063
926ccb104da0
disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents:
18058
diff
changeset
|
886 GList *iter; |
15817 | 887 |
15822 | 888 purple_signal_connect(purple_accounts_get_handle(), "account-added", |
889 finch_accounts_get_handle(), PURPLE_CALLBACK(account_added_callback), | |
15817 | 890 NULL); |
15822 | 891 purple_signal_connect(purple_accounts_get_handle(), "account-removed", |
892 finch_accounts_get_handle(), PURPLE_CALLBACK(account_removed_callback), | |
15817 | 893 NULL); |
17346
8c3a3407af58
Finch autoreconnecting (largely copy/paste from pidgin)
Richard Nelson <wabz@pidgin.im>
parents:
17091
diff
changeset
|
894 purple_signal_connect(purple_accounts_get_handle(), "account-disabled", |
8c3a3407af58
Finch autoreconnecting (largely copy/paste from pidgin)
Richard Nelson <wabz@pidgin.im>
parents:
17091
diff
changeset
|
895 finch_accounts_get_handle(), |
8c3a3407af58
Finch autoreconnecting (largely copy/paste from pidgin)
Richard Nelson <wabz@pidgin.im>
parents:
17091
diff
changeset
|
896 PURPLE_CALLBACK(account_abled_cb), GINT_TO_POINTER(FALSE)); |
8c3a3407af58
Finch autoreconnecting (largely copy/paste from pidgin)
Richard Nelson <wabz@pidgin.im>
parents:
17091
diff
changeset
|
897 purple_signal_connect(purple_accounts_get_handle(), "account-enabled", |
8c3a3407af58
Finch autoreconnecting (largely copy/paste from pidgin)
Richard Nelson <wabz@pidgin.im>
parents:
17091
diff
changeset
|
898 finch_accounts_get_handle(), |
8c3a3407af58
Finch autoreconnecting (largely copy/paste from pidgin)
Richard Nelson <wabz@pidgin.im>
parents:
17091
diff
changeset
|
899 PURPLE_CALLBACK(account_abled_cb), GINT_TO_POINTER(TRUE)); |
8c3a3407af58
Finch autoreconnecting (largely copy/paste from pidgin)
Richard Nelson <wabz@pidgin.im>
parents:
17091
diff
changeset
|
900 |
17816
e2e709e5446b
If there's no account at startup, sohw the 'New Account' dialog too.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17807
diff
changeset
|
901 iter = purple_accounts_get_all(); |
e2e709e5446b
If there's no account at startup, sohw the 'New Account' dialog too.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17807
diff
changeset
|
902 if (iter) { |
e2e709e5446b
If there's no account at startup, sohw the 'New Account' dialog too.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17807
diff
changeset
|
903 for (; iter; iter = iter->next) { |
e2e709e5446b
If there's no account at startup, sohw the 'New Account' dialog too.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17807
diff
changeset
|
904 if (purple_account_get_enabled(iter->data, FINCH_UI)) |
e2e709e5446b
If there's no account at startup, sohw the 'New Account' dialog too.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17807
diff
changeset
|
905 break; |
e2e709e5446b
If there's no account at startup, sohw the 'New Account' dialog too.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17807
diff
changeset
|
906 } |
e2e709e5446b
If there's no account at startup, sohw the 'New Account' dialog too.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17807
diff
changeset
|
907 if (!iter) |
e2e709e5446b
If there's no account at startup, sohw the 'New Account' dialog too.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17807
diff
changeset
|
908 finch_accounts_show_all(); |
e2e709e5446b
If there's no account at startup, sohw the 'New Account' dialog too.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17807
diff
changeset
|
909 } else { |
e2e709e5446b
If there's no account at startup, sohw the 'New Account' dialog too.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17807
diff
changeset
|
910 edit_account(NULL); |
e2e709e5446b
If there's no account at startup, sohw the 'New Account' dialog too.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17807
diff
changeset
|
911 finch_accounts_show_all(); |
15817 | 912 } |
913 } | |
914 | |
915 void finch_accounts_uninit() | |
916 { | |
917 if (accounts.window) | |
918 gnt_widget_destroy(accounts.window); | |
919 } | |
920 | |
921 /* The following uiops stuff are copied from gtkaccount.c */ | |
922 typedef struct | |
923 { | |
15822 | 924 PurpleAccount *account; |
15817 | 925 char *username; |
926 char *alias; | |
927 } AddUserData; | |
928 | |
929 static char * | |
15822 | 930 make_info(PurpleAccount *account, PurpleConnection *gc, const char *remote_user, |
15817 | 931 const char *id, const char *alias, const char *msg) |
932 { | |
933 if (msg != NULL && *msg == '\0') | |
934 msg = NULL; | |
935 | |
936 return g_strdup_printf(_("%s%s%s%s has made %s his or her buddy%s%s"), | |
937 remote_user, | |
938 (alias != NULL ? " (" : ""), | |
939 (alias != NULL ? alias : ""), | |
940 (alias != NULL ? ")" : ""), | |
941 (id != NULL | |
942 ? id | |
15822 | 943 : (purple_connection_get_display_name(gc) != NULL |
944 ? purple_connection_get_display_name(gc) | |
945 : purple_account_get_username(account))), | |
15817 | 946 (msg != NULL ? ": " : "."), |
947 (msg != NULL ? msg : "")); | |
948 } | |
949 | |
950 static void | |
15822 | 951 notify_added(PurpleAccount *account, const char *remote_user, |
15817 | 952 const char *id, const char *alias, |
953 const char *msg) | |
954 { | |
955 char *buffer; | |
15822 | 956 PurpleConnection *gc; |
15817 | 957 |
15822 | 958 gc = purple_account_get_connection(account); |
15817 | 959 |
960 buffer = make_info(account, gc, remote_user, id, alias, msg); | |
961 | |
15822 | 962 purple_notify_info(NULL, NULL, buffer, NULL); |
15817 | 963 |
964 g_free(buffer); | |
965 } | |
966 | |
967 static void | |
968 free_add_user_data(AddUserData *data) | |
969 { | |
970 g_free(data->username); | |
971 | |
972 if (data->alias != NULL) | |
973 g_free(data->alias); | |
974 | |
975 g_free(data); | |
976 } | |
977 | |
978 static void | |
979 add_user_cb(AddUserData *data) | |
980 { | |
15822 | 981 PurpleConnection *gc = purple_account_get_connection(data->account); |
15817 | 982 |
18063
926ccb104da0
disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents:
18058
diff
changeset
|
983 if (g_list_find(purple_connections_get_all(), gc)) |
15817 | 984 { |
15822 | 985 purple_blist_request_add_buddy(data->account, data->username, |
15817 | 986 NULL, data->alias); |
987 } | |
988 | |
989 free_add_user_data(data); | |
990 } | |
991 | |
992 static void | |
15822 | 993 request_add(PurpleAccount *account, const char *remote_user, |
15817 | 994 const char *id, const char *alias, |
995 const char *msg) | |
996 { | |
997 char *buffer; | |
15822 | 998 PurpleConnection *gc; |
15817 | 999 AddUserData *data; |
1000 | |
15822 | 1001 gc = purple_account_get_connection(account); |
15817 | 1002 |
1003 data = g_new0(AddUserData, 1); | |
1004 data->account = account; | |
1005 data->username = g_strdup(remote_user); | |
1006 data->alias = (alias != NULL ? g_strdup(alias) : NULL); | |
1007 | |
1008 buffer = make_info(account, gc, remote_user, id, alias, msg); | |
21570
dccfd999ffe7
merge of '76c07fcb434a2a7aa289734bb221c171a376d73b'
Evan Schoenberg <evan.s@dreskin.net>
parents:
21244
diff
changeset
|
1009 purple_request_action(NULL, NULL, _("Add buddy to your list?"), |
16439
08db93bbd798
Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evan.s@dreskin.net>
parents:
16194
diff
changeset
|
1010 buffer, PURPLE_DEFAULT_ACTION_NONE, |
08db93bbd798
Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evan.s@dreskin.net>
parents:
16194
diff
changeset
|
1011 account, remote_user, NULL, |
21570
dccfd999ffe7
merge of '76c07fcb434a2a7aa289734bb221c171a376d73b'
Evan Schoenberg <evan.s@dreskin.net>
parents:
21244
diff
changeset
|
1012 data, 2, |
15817 | 1013 _("Add"), G_CALLBACK(add_user_cb), |
1014 _("Cancel"), G_CALLBACK(free_add_user_data)); | |
1015 g_free(buffer); | |
1016 } | |
1017 | |
1018 /* Copied from gtkaccount.c */ | |
1019 typedef struct { | |
15822 | 1020 PurpleAccountRequestAuthorizationCb auth_cb; |
1021 PurpleAccountRequestAuthorizationCb deny_cb; | |
15817 | 1022 void *data; |
1023 char *username; | |
1024 char *alias; | |
15822 | 1025 PurpleAccount *account; |
15817 | 1026 } auth_and_add; |
1027 | |
1028 static void | |
17804
464840043c66
Show information about the user requesting authorization.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17091
diff
changeset
|
1029 free_auth_and_add(auth_and_add *aa) |
15817 | 1030 { |
1031 g_free(aa->username); | |
1032 g_free(aa->alias); | |
1033 g_free(aa); | |
1034 } | |
1035 | |
1036 static void | |
17804
464840043c66
Show information about the user requesting authorization.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17091
diff
changeset
|
1037 authorize_and_add_cb(auth_and_add *aa) |
464840043c66
Show information about the user requesting authorization.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17091
diff
changeset
|
1038 { |
464840043c66
Show information about the user requesting authorization.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17091
diff
changeset
|
1039 aa->auth_cb(aa->data); |
464840043c66
Show information about the user requesting authorization.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17091
diff
changeset
|
1040 purple_blist_request_add_buddy(aa->account, aa->username, |
464840043c66
Show information about the user requesting authorization.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17091
diff
changeset
|
1041 NULL, aa->alias); |
464840043c66
Show information about the user requesting authorization.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17091
diff
changeset
|
1042 } |
464840043c66
Show information about the user requesting authorization.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17091
diff
changeset
|
1043 |
464840043c66
Show information about the user requesting authorization.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17091
diff
changeset
|
1044 static void |
15817 | 1045 deny_no_add_cb(auth_and_add *aa) |
1046 { | |
1047 aa->deny_cb(aa->data); | |
1048 } | |
1049 | |
1050 static void * | |
18829
7a594763c229
Correct the types of the authorize_cb and deny_cb parameters of
Will Thompson <will.thompson@collabora.co.uk>
parents:
18516
diff
changeset
|
1051 finch_request_authorize(PurpleAccount *account, |
7a594763c229
Correct the types of the authorize_cb and deny_cb parameters of
Will Thompson <will.thompson@collabora.co.uk>
parents:
18516
diff
changeset
|
1052 const char *remote_user, |
7a594763c229
Correct the types of the authorize_cb and deny_cb parameters of
Will Thompson <will.thompson@collabora.co.uk>
parents:
18516
diff
changeset
|
1053 const char *id, |
7a594763c229
Correct the types of the authorize_cb and deny_cb parameters of
Will Thompson <will.thompson@collabora.co.uk>
parents:
18516
diff
changeset
|
1054 const char *alias, |
7a594763c229
Correct the types of the authorize_cb and deny_cb parameters of
Will Thompson <will.thompson@collabora.co.uk>
parents:
18516
diff
changeset
|
1055 const char *message, |
7a594763c229
Correct the types of the authorize_cb and deny_cb parameters of
Will Thompson <will.thompson@collabora.co.uk>
parents:
18516
diff
changeset
|
1056 gboolean on_list, |
7a594763c229
Correct the types of the authorize_cb and deny_cb parameters of
Will Thompson <will.thompson@collabora.co.uk>
parents:
18516
diff
changeset
|
1057 PurpleAccountRequestAuthorizationCb auth_cb, |
7a594763c229
Correct the types of the authorize_cb and deny_cb parameters of
Will Thompson <will.thompson@collabora.co.uk>
parents:
18516
diff
changeset
|
1058 PurpleAccountRequestAuthorizationCb deny_cb, |
7a594763c229
Correct the types of the authorize_cb and deny_cb parameters of
Will Thompson <will.thompson@collabora.co.uk>
parents:
18516
diff
changeset
|
1059 void *user_data) |
15817 | 1060 { |
1061 char *buffer; | |
15822 | 1062 PurpleConnection *gc; |
15817 | 1063 void *uihandle; |
1064 | |
15822 | 1065 gc = purple_account_get_connection(account); |
15817 | 1066 if (message != NULL && *message == '\0') |
1067 message = NULL; | |
1068 | |
18516
15f0c935e699
I changed a string during a string freeze\! Sorry\!
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18511
diff
changeset
|
1069 buffer = g_strdup_printf(_("%s%s%s%s wants to add %s to his or her buddy list%s%s"), |
15817 | 1070 remote_user, |
1071 (alias != NULL ? " (" : ""), | |
1072 (alias != NULL ? alias : ""), | |
1073 (alias != NULL ? ")" : ""), | |
1074 (id != NULL | |
1075 ? id | |
15822 | 1076 : (purple_connection_get_display_name(gc) != NULL |
1077 ? purple_connection_get_display_name(gc) | |
1078 : purple_account_get_username(account))), | |
18516
15f0c935e699
I changed a string during a string freeze\! Sorry\!
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18511
diff
changeset
|
1079 (message != NULL ? ": " : "."), |
15817 | 1080 (message != NULL ? message : "")); |
1081 if (!on_list) { | |
17805
7f652ef12ed6
Remove the confusing 'OK' button from the auth dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17804
diff
changeset
|
1082 GntWidget *widget; |
7f652ef12ed6
Remove the confusing 'OK' button from the auth dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17804
diff
changeset
|
1083 GList *iter; |
15817 | 1084 auth_and_add *aa = g_new(auth_and_add, 1); |
17805
7f652ef12ed6
Remove the confusing 'OK' button from the auth dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17804
diff
changeset
|
1085 |
18829
7a594763c229
Correct the types of the authorize_cb and deny_cb parameters of
Will Thompson <will.thompson@collabora.co.uk>
parents:
18516
diff
changeset
|
1086 aa->auth_cb = auth_cb; |
7a594763c229
Correct the types of the authorize_cb and deny_cb parameters of
Will Thompson <will.thompson@collabora.co.uk>
parents:
18516
diff
changeset
|
1087 aa->deny_cb = deny_cb; |
15817 | 1088 aa->data = user_data; |
1089 aa->username = g_strdup(remote_user); | |
1090 aa->alias = g_strdup(alias); | |
1091 aa->account = account; | |
17804
464840043c66
Show information about the user requesting authorization.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17091
diff
changeset
|
1092 |
464840043c66
Show information about the user requesting authorization.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17091
diff
changeset
|
1093 uihandle = gnt_vwindow_new(FALSE); |
464840043c66
Show information about the user requesting authorization.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17091
diff
changeset
|
1094 gnt_box_set_title(GNT_BOX(uihandle), _("Authorize buddy?")); |
464840043c66
Show information about the user requesting authorization.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17091
diff
changeset
|
1095 gnt_box_set_pad(GNT_BOX(uihandle), 0); |
464840043c66
Show information about the user requesting authorization.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17091
diff
changeset
|
1096 |
21570
dccfd999ffe7
merge of '76c07fcb434a2a7aa289734bb221c171a376d73b'
Evan Schoenberg <evan.s@dreskin.net>
parents:
21244
diff
changeset
|
1097 widget = purple_request_action(NULL, _("Authorize buddy?"), buffer, NULL, |
16439
08db93bbd798
Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evan.s@dreskin.net>
parents:
16194
diff
changeset
|
1098 PURPLE_DEFAULT_ACTION_NONE, |
08db93bbd798
Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evan.s@dreskin.net>
parents:
16194
diff
changeset
|
1099 account, remote_user, NULL, |
21570
dccfd999ffe7
merge of '76c07fcb434a2a7aa289734bb221c171a376d73b'
Evan Schoenberg <evan.s@dreskin.net>
parents:
21244
diff
changeset
|
1100 aa, 2, |
15817 | 1101 _("Authorize"), authorize_and_add_cb, |
1102 _("Deny"), deny_no_add_cb); | |
17804
464840043c66
Show information about the user requesting authorization.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17091
diff
changeset
|
1103 gnt_screen_release(widget); |
464840043c66
Show information about the user requesting authorization.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17091
diff
changeset
|
1104 gnt_box_set_toplevel(GNT_BOX(widget), FALSE); |
464840043c66
Show information about the user requesting authorization.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17091
diff
changeset
|
1105 gnt_box_add_widget(GNT_BOX(uihandle), widget); |
464840043c66
Show information about the user requesting authorization.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17091
diff
changeset
|
1106 |
464840043c66
Show information about the user requesting authorization.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17091
diff
changeset
|
1107 gnt_box_add_widget(GNT_BOX(uihandle), gnt_hline_new()); |
464840043c66
Show information about the user requesting authorization.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17091
diff
changeset
|
1108 |
22213
16ff37f64e29
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 <imadil@gmail.com>
parents:
22007
diff
changeset
|
1109 widget = finch_retrieve_user_info(purple_account_get_connection(account), remote_user); |
17805
7f652ef12ed6
Remove the confusing 'OK' button from the auth dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17804
diff
changeset
|
1110 for (iter = GNT_BOX(widget)->list; iter; iter = iter->next) { |
7f652ef12ed6
Remove the confusing 'OK' button from the auth dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17804
diff
changeset
|
1111 if (GNT_IS_BUTTON(iter->data)) { |
7f652ef12ed6
Remove the confusing 'OK' button from the auth dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17804
diff
changeset
|
1112 gnt_widget_destroy(iter->data); |
7f652ef12ed6
Remove the confusing 'OK' button from the auth dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17804
diff
changeset
|
1113 gnt_box_remove(GNT_BOX(widget), iter->data); |
7f652ef12ed6
Remove the confusing 'OK' button from the auth dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17804
diff
changeset
|
1114 break; |
7f652ef12ed6
Remove the confusing 'OK' button from the auth dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17804
diff
changeset
|
1115 } |
7f652ef12ed6
Remove the confusing 'OK' button from the auth dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17804
diff
changeset
|
1116 } |
17804
464840043c66
Show information about the user requesting authorization.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17091
diff
changeset
|
1117 gnt_box_set_toplevel(GNT_BOX(widget), FALSE); |
464840043c66
Show information about the user requesting authorization.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17091
diff
changeset
|
1118 gnt_screen_release(widget); |
464840043c66
Show information about the user requesting authorization.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17091
diff
changeset
|
1119 gnt_box_add_widget(GNT_BOX(uihandle), widget); |
464840043c66
Show information about the user requesting authorization.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17091
diff
changeset
|
1120 gnt_widget_show(uihandle); |
464840043c66
Show information about the user requesting authorization.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17091
diff
changeset
|
1121 |
464840043c66
Show information about the user requesting authorization.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17091
diff
changeset
|
1122 g_signal_connect_swapped(G_OBJECT(uihandle), "destroy", G_CALLBACK(free_auth_and_add), aa); |
15817 | 1123 } else { |
21570
dccfd999ffe7
merge of '76c07fcb434a2a7aa289734bb221c171a376d73b'
Evan Schoenberg <evan.s@dreskin.net>
parents:
21244
diff
changeset
|
1124 uihandle = purple_request_action(NULL, _("Authorize buddy?"), buffer, NULL, |
16439
08db93bbd798
Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evan.s@dreskin.net>
parents:
16194
diff
changeset
|
1125 PURPLE_DEFAULT_ACTION_NONE, |
08db93bbd798
Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evan.s@dreskin.net>
parents:
16194
diff
changeset
|
1126 account, remote_user, NULL, |
21570
dccfd999ffe7
merge of '76c07fcb434a2a7aa289734bb221c171a376d73b'
Evan Schoenberg <evan.s@dreskin.net>
parents:
21244
diff
changeset
|
1127 user_data, 2, |
15817 | 1128 _("Authorize"), auth_cb, |
1129 _("Deny"), deny_cb); | |
1130 } | |
24595
024818afb013
A patch to clean up authorization request related stuff. Fixes #7695.
Paul Aurich <paul@darkrain42.org>
parents:
24053
diff
changeset
|
1131 g_signal_connect(G_OBJECT(uihandle), "destroy", |
024818afb013
A patch to clean up authorization request related stuff. Fixes #7695.
Paul Aurich <paul@darkrain42.org>
parents:
24053
diff
changeset
|
1132 G_CALLBACK(purple_account_request_close), NULL); |
15817 | 1133 g_free(buffer); |
1134 return uihandle; | |
1135 } | |
1136 | |
1137 static void | |
1138 finch_request_close(void *uihandle) | |
1139 { | |
15822 | 1140 purple_request_close(PURPLE_REQUEST_ACTION, uihandle); |
15817 | 1141 } |
1142 | |
15822 | 1143 static PurpleAccountUiOps ui_ops = |
15817 | 1144 { |
17091
46f2f86e08e4
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents:
16462
diff
changeset
|
1145 notify_added, |
46f2f86e08e4
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents:
16462
diff
changeset
|
1146 NULL, |
46f2f86e08e4
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents:
16462
diff
changeset
|
1147 request_add, |
46f2f86e08e4
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents:
16462
diff
changeset
|
1148 finch_request_authorize, |
46f2f86e08e4
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents:
16462
diff
changeset
|
1149 finch_request_close, |
46f2f86e08e4
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents:
16462
diff
changeset
|
1150 NULL, |
46f2f86e08e4
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents:
16462
diff
changeset
|
1151 NULL, |
46f2f86e08e4
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents:
16462
diff
changeset
|
1152 NULL, |
46f2f86e08e4
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents:
16462
diff
changeset
|
1153 NULL |
15817 | 1154 }; |
1155 | |
15822 | 1156 PurpleAccountUiOps *finch_accounts_get_ui_ops() |
15817 | 1157 { |
1158 return &ui_ops; | |
1159 } | |
1160 |