Mercurial > pidgin
annotate src/multi.c @ 4772:6fe8008d6560
[gaim-migrate @ 5091]
Chip, sorry if this conflicts with your buddy pounce stuff.
Also, uh, I dunno, there wasn't a reason that some of these
windows didn't have titles, was there? I figured "Gaim"
is better than nothing.
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Fri, 14 Mar 2003 15:45:38 +0000 |
parents | c4c28874ecd3 |
children | 85c6c3a60503 |
rev | line source |
---|---|
960 | 1 /* |
2 * gaim | |
3 * | |
4 * Copyright (C) 1998-1999, Mark Spencer <markster@marko.net> | |
5 * | |
6 * This program is free software; you can redistribute it and/or modify | |
7 * it under the terms of the GNU General Public License as published by | |
8 * the Free Software Foundation; either version 2 of the License, or | |
9 * (at your option) any later version. | |
10 * | |
11 * This program is distributed in the hope that it will be useful, | |
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 * GNU General Public License for more details. | |
15 * | |
16 * You should have received a copy of the GNU General Public License | |
17 * along with this program; if not, write to the Free Software | |
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
19 * | |
20 */ | |
21 | |
4634 | 22 #include <stdlib.h> |
2100
a93aeb6f813d
[gaim-migrate @ 2110]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
23 #include <string.h> |
3067 | 24 #include <ctype.h> |
960 | 25 #include <gtk/gtk.h> |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
26 #include "prpl.h" |
960 | 27 #include "multi.h" |
28 #include "gaim.h" | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
29 #include "conversation.h" |
4687 | 30 #include "gtklist.h" |
960 | 31 |
4493
61ba567f9c64
[gaim-migrate @ 4768]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4491
diff
changeset
|
32 #ifdef _WIN32 |
61ba567f9c64
[gaim-migrate @ 4768]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4491
diff
changeset
|
33 #include "win32dep.h" |
61ba567f9c64
[gaim-migrate @ 4768]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4491
diff
changeset
|
34 #endif |
61ba567f9c64
[gaim-migrate @ 4768]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4491
diff
changeset
|
35 |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1089
diff
changeset
|
36 #define LOGIN_STEPS 5 |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1089
diff
changeset
|
37 |
960 | 38 GSList *connections; |
3517 | 39 int connecting_count = 0; |
960 | 40 |
41 static GtkWidget *acctedit = NULL; | |
3754 | 42 static GtkWidget *treeview = NULL; /* the treeview of names in the accteditor */ |
43 static GtkListStore *model = NULL; | |
2442
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
44 |
4491 | 45 static GSList *mod_accounts = NULL; |
960 | 46 |
3754 | 47 enum |
48 { | |
49 COLUMN_SCREENNAME, | |
50 COLUMN_ONLINE, | |
51 COLUMN_AUTOLOGIN, | |
52 COLUMN_PROTOCOL, | |
53 COLUMN_DATA, | |
54 NUM_COLUMNS | |
55 }; | |
56 | |
4491 | 57 struct mod_account { |
58 struct gaim_account *account; | |
59 | |
60 /* these are temporary */ | |
61 int options; | |
62 int protocol; | |
63 char proto_opt[7][256]; | |
64 | |
65 /* stuff for modify window */ | |
66 GtkWidget *mod; | |
67 GtkWidget *main; | |
68 GtkWidget *name; | |
69 GtkWidget *alias; | |
70 GtkWidget *pwdbox; | |
71 GtkWidget *pass; | |
72 GtkWidget *rempass; | |
73 GtkWidget *user_frame; | |
74 GtkWidget *proto_frame; | |
75 GtkSizeGroup *sg; | |
76 GList *opt_entries; | |
77 | |
78 /* stuff for icon selection */ | |
79 char iconfile[256]; | |
80 GtkWidget *iconsel; | |
81 GtkWidget *iconentry; | |
82 GtkWidget *icondlg; | |
83 | |
84 /* stuff for mail check prompt */ | |
85 GtkWidget *checkmail; | |
86 | |
87 /* stuff for register with server */ | |
88 GtkWidget *register_user; | |
4634 | 89 |
90 /* stuff for proxy options */ | |
91 GtkWidget *proxy_frame; | |
92 GtkWidget *proxy_host_box; | |
93 GtkWidget *proxytype_menu; | |
94 GtkWidget *proxyhost_entry; | |
95 GtkWidget *proxyport_entry; | |
96 GtkWidget *proxyuser_entry; | |
97 GtkWidget *proxypass_entry; | |
4491 | 98 }; |
99 | |
100 | |
101 struct mod_account_opt { | |
102 struct mod_account *ma; | |
103 int opt; | |
104 }; | |
105 | |
3754 | 106 static void acct_signin(GtkCellRendererToggle *cell, gchar *path_str, |
107 gpointer d); | |
108 static void acct_autologin(GtkCellRendererToggle *cell, gchar *path_str, | |
109 gpointer d); | |
110 | |
4491 | 111 static struct mod_account *mod_account_find(struct gaim_account *a) |
2442
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
112 { |
4491 | 113 GSList *m = mod_accounts; |
2442
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
114 while (m) { |
4491 | 115 struct mod_account *ma = m->data; |
116 if (ma->account == a) | |
117 return ma; | |
2442
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
118 m = m->next; |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
119 } |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
120 return NULL; |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
121 } |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
122 |
4491 | 123 static void generate_protocol_options(struct mod_account *, GtkWidget *); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1172
diff
changeset
|
124 |
960 | 125 |
4491 | 126 struct gaim_connection *new_gaim_conn(struct gaim_account *account) |
960 | 127 { |
128 struct gaim_connection *gc = g_new0(struct gaim_connection, 1); | |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1355
diff
changeset
|
129 gc->edittype = EDIT_GC; |
4491 | 130 gc->protocol = account->protocol; |
131 gc->prpl = find_prpl(account->protocol); | |
132 g_snprintf(gc->username, sizeof(gc->username), "%s", account->username); | |
133 g_snprintf(gc->password, sizeof(gc->password), "%s", account->password); | |
1153
3063e6743913
[gaim-migrate @ 1163]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1124
diff
changeset
|
134 gc->keepalive = 0; |
2382
569ae9f2bb89
[gaim-migrate @ 2395]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2380
diff
changeset
|
135 gc->inpa = 0; |
998
70c685de2be5
[gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
993
diff
changeset
|
136 gc->buddy_chats = NULL; |
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4082
diff
changeset
|
137 gc->away = NULL; |
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4082
diff
changeset
|
138 gc->away_state = NULL; |
960 | 139 |
140 connections = g_slist_append(connections, gc); | |
141 | |
4491 | 142 account->gc = gc; |
143 gc->account = account; | |
1089
f0f5c10cce63
[gaim-migrate @ 1099]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1086
diff
changeset
|
144 |
960 | 145 return gc; |
146 } | |
147 | |
3060 | 148 struct meter_window { |
149 GtkWidget *window; | |
150 GtkTable *table; | |
151 gint rows; | |
152 gint active_count; | |
153 } *meter_win = NULL; | |
154 | |
960 | 155 void destroy_gaim_conn(struct gaim_connection *gc) |
156 { | |
4770 | 157 GSList *g = gaim_blist_groups(), *g1 = g; |
158 GSList *h, *h1; | |
1063
e1408fb04c36
[gaim-migrate @ 1073]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1058
diff
changeset
|
159 struct group *m; |
e1408fb04c36
[gaim-migrate @ 1073]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1058
diff
changeset
|
160 struct buddy *n; |
4770 | 161 while (g1) { |
162 m = (struct group *)g1->data; | |
163 g1 = g_slist_next(g1); | |
164 h1 = h = gaim_blist_members(m); | |
165 while (h1) { | |
166 n = (struct buddy *)h1->data; | |
167 h1 = g_slist_next(h1); | |
4491 | 168 if(n->account == gc->account) { |
4349 | 169 n->present = 0; |
170 } | |
1063
e1408fb04c36
[gaim-migrate @ 1073]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1058
diff
changeset
|
171 } |
4770 | 172 g_slist_free(h); |
2597
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2568
diff
changeset
|
173 } |
4770 | 174 g_slist_free(g); |
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4082
diff
changeset
|
175 g_free(gc->away); |
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4082
diff
changeset
|
176 g_free(gc->away_state); |
960 | 177 g_free(gc); |
3510 | 178 |
988
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
179 if (!connections && mainwindow) |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
180 gtk_widget_show(mainwindow); |
960 | 181 } |
182 | |
4275 | 183 static void quit_acctedit(gpointer d) |
960 | 184 { |
185 if (acctedit) { | |
186 save_prefs(); | |
187 gtk_widget_destroy(acctedit); | |
4275 | 188 acctedit = NULL; |
960 | 189 } |
4695
4bdd9a5fd026
[gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
190 |
3754 | 191 treeview = NULL; |
4695
4bdd9a5fd026
[gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
192 |
4bdd9a5fd026
[gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
193 if (!d && !GAIM_GTK_BLIST(gaim_get_blist())->window && |
4bdd9a5fd026
[gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
194 !mainwindow && !connections) { |
4bdd9a5fd026
[gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
195 |
4082 | 196 do_quit(); |
4695
4bdd9a5fd026
[gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
197 } |
960 | 198 } |
199 | |
4275 | 200 static void on_delete_acctedit(GtkWidget *w, GdkEvent *ev, gpointer d) |
960 | 201 { |
4275 | 202 quit_acctedit(d); |
203 } | |
204 | |
205 static void on_close_acctedit(GtkButton *button, gpointer d) | |
206 { | |
207 quit_acctedit(d); | |
960 | 208 } |
209 | |
210 static char *proto_name(int proto) | |
211 { | |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
212 struct prpl *p = find_prpl(proto); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
213 if (p && p->name) |
3572 | 214 return p->name; |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
215 else |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
216 return "Unknown"; |
960 | 217 } |
218 | |
2204
5014b802eb41
[gaim-migrate @ 2214]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2203
diff
changeset
|
219 void regenerate_user_list() |
5014b802eb41
[gaim-migrate @ 2214]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2203
diff
changeset
|
220 { |
4491 | 221 GSList *accounts = gaim_accounts; |
222 struct gaim_account *a; | |
3754 | 223 GtkTreeIter iter; |
2204
5014b802eb41
[gaim-migrate @ 2214]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2203
diff
changeset
|
224 |
5014b802eb41
[gaim-migrate @ 2214]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2203
diff
changeset
|
225 if (!acctedit) |
5014b802eb41
[gaim-migrate @ 2214]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2203
diff
changeset
|
226 return; |
5014b802eb41
[gaim-migrate @ 2214]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2203
diff
changeset
|
227 |
3754 | 228 gtk_list_store_clear(model); |
2204
5014b802eb41
[gaim-migrate @ 2214]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2203
diff
changeset
|
229 |
4491 | 230 while (accounts) { |
231 a = (struct gaim_account *)accounts->data; | |
3754 | 232 |
233 gtk_list_store_append(model, &iter); | |
234 gtk_list_store_set(model, &iter, | |
235 COLUMN_SCREENNAME, a->username, | |
236 COLUMN_ONLINE, (a->gc ? TRUE : FALSE), | |
4491 | 237 COLUMN_AUTOLOGIN, (a->options & OPT_ACCT_AUTO), |
3754 | 238 COLUMN_PROTOCOL, proto_name(a->protocol), |
239 COLUMN_DATA, a, | |
240 -1); | |
4491 | 241 accounts = accounts->next; |
2204
5014b802eb41
[gaim-migrate @ 2214]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2203
diff
changeset
|
242 } |
5014b802eb41
[gaim-migrate @ 2214]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2203
diff
changeset
|
243 } |
5014b802eb41
[gaim-migrate @ 2214]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2203
diff
changeset
|
244 |
3754 | 245 static gboolean get_iter_from_data(GtkTreeView *treeview, |
4491 | 246 struct gaim_account *a, GtkTreeIter *iter) |
3754 | 247 { |
248 return gtk_tree_model_iter_nth_child(gtk_tree_view_get_model(treeview), | |
249 iter, NULL, | |
4491 | 250 g_slist_index(gaim_accounts, a)); |
3754 | 251 } |
252 | |
253 static void add_columns(GtkWidget *treeview) | |
254 { | |
255 GtkCellRenderer *renderer; | |
4635 | 256 /* GtkTreeViewColumn *column; */ |
3754 | 257 |
258 /* Screennames */ | |
259 renderer = gtk_cell_renderer_text_new(); | |
260 gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(treeview), | |
261 -1, _("Screenname"), | |
262 renderer, | |
263 "text", COLUMN_SCREENNAME, | |
264 NULL); | |
265 | |
266 /* Online? */ | |
267 renderer = gtk_cell_renderer_toggle_new(); | |
268 g_signal_connect(G_OBJECT(renderer), "toggled", | |
269 G_CALLBACK(acct_signin), model); | |
270 gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(treeview), | |
271 -1, _("Online"), | |
272 renderer, | |
273 "active", COLUMN_ONLINE, | |
274 NULL); | |
275 | |
276 /* Auto-login? */ | |
277 renderer = gtk_cell_renderer_toggle_new(); | |
278 g_signal_connect(G_OBJECT(renderer), "toggled", | |
279 G_CALLBACK(acct_autologin), model); | |
280 gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(treeview), | |
281 -1, _("Auto-login"), | |
282 renderer, | |
283 "active", COLUMN_AUTOLOGIN, | |
284 NULL); | |
285 | |
286 /* Protocol */ | |
287 renderer = gtk_cell_renderer_text_new(); | |
288 gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(treeview), | |
289 -1, _("Protocol"), | |
290 renderer, | |
291 "text", COLUMN_PROTOCOL, | |
292 NULL); | |
293 | |
294 /* Data */ | |
4630 | 295 /* |
3754 | 296 column = gtk_tree_view_column_new(); |
4630 | 297 gtk_tree_view_insert_column(GTK_TREE_VIEW(treeview), column, -1); |
3754 | 298 gtk_tree_view_column_set_visible(column, FALSE); |
4630 | 299 */ |
3754 | 300 } |
301 | |
960 | 302 static GtkWidget *generate_list() |
303 { | |
304 GtkWidget *win; | |
305 | |
306 win = gtk_scrolled_window_new(0, 0); | |
3754 | 307 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(win), |
308 GTK_POLICY_AUTOMATIC, | |
309 GTK_POLICY_ALWAYS); | |
4550
972af41f277c
[gaim-migrate @ 4830]
Christian Hammond <chipx86@chipx86.com>
parents:
4493
diff
changeset
|
310 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(win), |
972af41f277c
[gaim-migrate @ 4830]
Christian Hammond <chipx86@chipx86.com>
parents:
4493
diff
changeset
|
311 GTK_SHADOW_IN); |
3754 | 312 |
313 /* Create the list model. */ | |
314 model = gtk_list_store_new(NUM_COLUMNS, G_TYPE_STRING, G_TYPE_BOOLEAN, | |
315 G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_POINTER); | |
960 | 316 |
3754 | 317 treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(model)); |
318 gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(treeview), TRUE); | |
319 gtk_tree_selection_set_mode( | |
320 gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview)), | |
321 GTK_SELECTION_MULTIPLE); | |
322 | |
323 add_columns(treeview); | |
324 | |
325 gtk_container_add(GTK_CONTAINER(win), treeview); | |
326 gtk_widget_show(treeview); | |
960 | 327 |
2204
5014b802eb41
[gaim-migrate @ 2214]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2203
diff
changeset
|
328 regenerate_user_list(); |
3754 | 329 gtk_tree_view_set_reorderable (GTK_TREE_VIEW(treeview), TRUE); |
960 | 330 gtk_widget_show(win); |
331 return win; | |
332 } | |
333 | |
4491 | 334 static void delmod(GtkWidget *w, struct mod_account *ma) |
960 | 335 { |
4491 | 336 mod_accounts = g_slist_remove(mod_accounts, ma); |
337 g_free(ma); | |
960 | 338 } |
339 | |
4491 | 340 static void mod_opt(GtkWidget *b, struct mod_account_opt *mao) |
960 | 341 { |
4491 | 342 mao->ma->options = mao->ma->options ^ mao->opt; |
960 | 343 } |
344 | |
4491 | 345 static void free_mao(GtkWidget *b, struct mod_account_opt *mao) |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1172
diff
changeset
|
346 { |
4491 | 347 g_free(mao); |
1051
713b0e14e0a9
[gaim-migrate @ 1061]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
348 } |
713b0e14e0a9
[gaim-migrate @ 1061]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
349 |
4491 | 350 static GtkWidget *acct_button(const char *text, struct mod_account *ma, int option, GtkWidget *box) |
960 | 351 { |
352 GtkWidget *button; | |
4491 | 353 struct mod_account_opt *mao = g_new0(struct mod_account_opt, 1); |
960 | 354 button = gtk_check_button_new_with_label(text); |
4635 | 355 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), (ma->options & option)); |
960 | 356 gtk_box_pack_start(GTK_BOX(box), button, FALSE, FALSE, 0); |
4491 | 357 mao->ma = ma; |
358 mao->opt = option; | |
359 g_signal_connect(GTK_OBJECT(button), "clicked", G_CALLBACK(mod_opt), mao); | |
360 g_signal_connect(GTK_OBJECT(button), "destroy", G_CALLBACK(free_mao), mao); | |
960 | 361 gtk_widget_show(button); |
362 return button; | |
363 } | |
364 | |
4491 | 365 static void ok_mod(GtkWidget *w, struct mod_account *ma) |
960 | 366 { |
2154
cff133e0ec0c
[gaim-migrate @ 2164]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2153
diff
changeset
|
367 GList *tmp; |
1954
c15c3a3f6cd4
[gaim-migrate @ 1964]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1942
diff
changeset
|
368 const char *txt; |
4491 | 369 struct gaim_account *a; |
2956 | 370 struct prpl *p; |
3754 | 371 GtkTreeIter iter; |
4634 | 372 int proxytype; |
1355
04874e92af24
[gaim-migrate @ 1365]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1261
diff
changeset
|
373 |
4491 | 374 if (!ma->account) { |
375 txt = gtk_entry_get_text(GTK_ENTRY(ma->name)); | |
376 ma->account = gaim_account_new(txt, ma->protocol, ma->options); | |
2442
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
377 } |
4491 | 378 a = ma->account; |
2154
cff133e0ec0c
[gaim-migrate @ 2164]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2153
diff
changeset
|
379 |
4491 | 380 a->options = ma->options; |
381 a->protocol = ma->protocol; | |
382 txt = gtk_entry_get_text(GTK_ENTRY(ma->name)); | |
2628
4054a0849461
[gaim-migrate @ 2641]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2627
diff
changeset
|
383 g_snprintf(a->username, sizeof(a->username), "%s", txt); |
4491 | 384 txt = gtk_entry_get_text(GTK_ENTRY(ma->alias)); |
3205 | 385 g_snprintf(a->alias, sizeof(a->alias), "%s", txt); |
4491 | 386 txt = gtk_entry_get_text(GTK_ENTRY(ma->pass)); |
387 if (a->options & OPT_ACCT_REM_PASS) | |
2442
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
388 g_snprintf(a->password, sizeof(a->password), "%s", txt); |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
389 else |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
390 a->password[0] = '\0'; |
2190
24d947eff811
[gaim-migrate @ 2200]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2165
diff
changeset
|
391 |
3754 | 392 if (get_iter_from_data(GTK_TREE_VIEW(treeview), a, &iter)) { |
393 gtk_list_store_set(model, &iter, | |
394 COLUMN_SCREENNAME, a->username, | |
4491 | 395 COLUMN_AUTOLOGIN, (a->options & OPT_ACCT_AUTO), |
3754 | 396 COLUMN_PROTOCOL, proto_name(a->protocol), |
397 -1); | |
398 } | |
399 | |
400 #if 0 | |
2442
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
401 i = gtk_clist_find_row_from_data(GTK_CLIST(list), a); |
2628
4054a0849461
[gaim-migrate @ 2641]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2627
diff
changeset
|
402 gtk_clist_set_text(GTK_CLIST(list), i, 0, a->username); |
2442
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
403 gtk_clist_set_text(GTK_CLIST(list), i, 2, |
4491 | 404 (a->options & OPT_ACCT_AUTO) ? "True" : "False"); |
2442
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
405 gtk_clist_set_text(GTK_CLIST(list), i, 3, proto_name(a->protocol)); |
3754 | 406 #endif |
1355
04874e92af24
[gaim-migrate @ 1365]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1261
diff
changeset
|
407 |
4491 | 408 tmp = ma->opt_entries; |
2442
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
409 while (tmp) { |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
410 GtkEntry *entry = tmp->data; |
4635 | 411 int pos = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(entry), "position")); |
2442
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
412 g_snprintf(a->proto_opt[pos], sizeof(a->proto_opt[pos]), "%s", |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2364
diff
changeset
|
413 gtk_entry_get_text(entry)); |
2442
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
414 tmp = tmp->next; |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
415 } |
4491 | 416 if (ma->opt_entries) |
417 g_list_free(ma->opt_entries); | |
418 ma->opt_entries = NULL; | |
1355
04874e92af24
[gaim-migrate @ 1365]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1261
diff
changeset
|
419 |
4491 | 420 g_snprintf(a->iconfile, sizeof(a->iconfile), "%s", ma->iconfile); |
421 if (ma->icondlg) | |
422 gtk_widget_destroy(ma->icondlg); | |
423 ma->icondlg = NULL; | |
2411
123aaa84109a
[gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2403
diff
changeset
|
424 |
4634 | 425 if(ma->account->gpi) |
426 g_free(ma->account->gpi); | |
427 ma->account->gpi = NULL; | |
428 | |
4635 | 429 proxytype = GPOINTER_TO_INT(g_object_get_data( |
430 G_OBJECT(gtk_menu_get_active(GTK_MENU(ma->proxytype_menu))), | |
431 "proxytype")); | |
4634 | 432 |
433 if(proxytype != PROXY_USE_GLOBAL) { | |
434 struct gaim_proxy_info *gpi = g_new0(struct gaim_proxy_info, 1); | |
435 gpi->proxytype = proxytype; | |
436 g_snprintf(gpi->proxyhost, sizeof(gpi->proxyhost), "%s", gtk_entry_get_text(GTK_ENTRY(ma->proxyhost_entry))); | |
437 gpi->proxyport = atoi(gtk_entry_get_text(GTK_ENTRY(ma->proxyport_entry))); | |
438 g_snprintf(gpi->proxyuser, sizeof(gpi->proxyuser), "%s", gtk_entry_get_text(GTK_ENTRY(ma->proxyuser_entry))); | |
439 g_snprintf(gpi->proxypass, sizeof(gpi->proxypass), "%s", gtk_entry_get_text(GTK_ENTRY(ma->proxypass_entry))); | |
440 | |
441 ma->account->gpi = gpi; | |
442 } | |
443 | |
2956 | 444 /* |
445 * See if user registration is supported/required | |
446 */ | |
4491 | 447 if((p = find_prpl(ma->protocol)) == NULL) { |
2956 | 448 /* TBD: error dialog here! (This should never happen, you know...) */ |
4491 | 449 fprintf(stderr, "dbg: couldn't find protocol for protocol number %d!\n", ma->protocol); |
2956 | 450 fflush(stderr); |
451 } else { | |
452 if(p->register_user != NULL && | |
4491 | 453 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ma->register_user)) == TRUE) { |
4040 | 454 ref_protocol(p); |
2956 | 455 p->register_user(a); |
4040 | 456 /* we don't unref the protocol because register user has callbacks |
457 * that need to get called first, then they will unref the protocol | |
458 * appropriately */ | |
2956 | 459 } |
460 } | |
2442
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
461 |
960 | 462 save_prefs(); |
2956 | 463 |
4491 | 464 gtk_widget_destroy(ma->mod); |
960 | 465 } |
466 | |
4491 | 467 static void cancel_mod(GtkWidget *w, struct mod_account *ma) |
960 | 468 { |
4491 | 469 if (ma->opt_entries) |
470 g_list_free(ma->opt_entries); | |
471 ma->opt_entries = NULL; | |
472 if (ma->icondlg) | |
473 gtk_widget_destroy(ma->icondlg); | |
474 ma->icondlg = NULL; | |
475 gtk_widget_destroy(ma->mod); | |
960 | 476 } |
477 | |
478 static void set_prot(GtkWidget *opt, int proto) | |
479 { | |
4635 | 480 struct mod_account *ma = g_object_get_data(G_OBJECT(opt), "mod_account"); |
2100
a93aeb6f813d
[gaim-migrate @ 2110]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
481 struct prpl *p, *q; |
a93aeb6f813d
[gaim-migrate @ 2110]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
482 q = find_prpl(proto); |
4491 | 483 if (ma->protocol != proto) { |
1086
ce201056e7a6
[gaim-migrate @ 1096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1075
diff
changeset
|
484 int i; |
1878
75643b9f4261
[gaim-migrate @ 1888]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1817
diff
changeset
|
485 for (i = 0; i < 7; i++) |
4491 | 486 ma->proto_opt[i][0] = '\0'; |
487 p = find_prpl(ma->protocol); | |
2442
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
488 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2364
diff
changeset
|
489 if (!(p->options & OPT_PROTO_NO_PASSWORD) && (q->options & OPT_PROTO_NO_PASSWORD)) { |
4491 | 490 gtk_widget_hide(ma->pwdbox); |
491 gtk_widget_hide(ma->rempass); | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2364
diff
changeset
|
492 } else if ((p->options & OPT_PROTO_NO_PASSWORD) && !(q->options & OPT_PROTO_NO_PASSWORD)) { |
4491 | 493 gtk_widget_show(ma->pwdbox); |
494 gtk_widget_show(ma->rempass); | |
2100
a93aeb6f813d
[gaim-migrate @ 2110]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
495 } |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2364
diff
changeset
|
496 if (!(p->options & OPT_PROTO_MAIL_CHECK) && (q->options & OPT_PROTO_MAIL_CHECK)) { |
4491 | 497 gtk_widget_show(ma->checkmail); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2364
diff
changeset
|
498 } else if ((p->options & OPT_PROTO_MAIL_CHECK) && !(q->options & OPT_PROTO_MAIL_CHECK)) { |
4491 | 499 gtk_widget_hide(ma->checkmail); |
2153
0befa2d2e540
[gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2118
diff
changeset
|
500 } |
2442
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
501 |
2411
123aaa84109a
[gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2403
diff
changeset
|
502 if (!(p->options & OPT_PROTO_BUDDY_ICON) && (q->options & OPT_PROTO_BUDDY_ICON)) { |
4491 | 503 gtk_widget_show(ma->iconsel); |
2411
123aaa84109a
[gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2403
diff
changeset
|
504 } else if ((p->options & OPT_PROTO_BUDDY_ICON) && !(q->options & OPT_PROTO_BUDDY_ICON)) { |
4491 | 505 gtk_widget_hide(ma->iconsel); |
2411
123aaa84109a
[gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2403
diff
changeset
|
506 } |
2442
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
507 |
2522
108b3eab22aa
[gaim-migrate @ 2535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2458
diff
changeset
|
508 if ((q->options & OPT_PROTO_BUDDY_ICON) || (q->options & OPT_PROTO_MAIL_CHECK)) |
4491 | 509 gtk_widget_show(ma->user_frame); |
2522
108b3eab22aa
[gaim-migrate @ 2535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2458
diff
changeset
|
510 else |
4491 | 511 gtk_widget_hide(ma->user_frame); |
2522
108b3eab22aa
[gaim-migrate @ 2535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2458
diff
changeset
|
512 |
4491 | 513 ma->protocol = proto; |
514 generate_protocol_options(ma, ma->main); | |
960 | 515 } |
516 } | |
517 | |
4491 | 518 static GtkWidget *make_protocol_menu(GtkWidget *box, struct mod_account *ma) |
960 | 519 { |
520 GtkWidget *optmenu; | |
521 GtkWidget *menu; | |
522 GtkWidget *opt; | |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
523 GSList *p = protocols; |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
524 struct prpl *e; |
1075
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
525 int count = 0; |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
526 gboolean found = FALSE; |
960 | 527 |
528 optmenu = gtk_option_menu_new(); | |
529 gtk_box_pack_start(GTK_BOX(box), optmenu, FALSE, FALSE, 5); | |
530 gtk_widget_show(optmenu); | |
531 | |
532 menu = gtk_menu_new(); | |
533 | |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
534 while (p) { |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
535 e = (struct prpl *)p->data; |
4491 | 536 if (e->protocol == ma->protocol) |
2442
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
537 found = TRUE; |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
538 if (!found) |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
539 count++; |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
540 if (e->name) |
3572 | 541 opt = gtk_menu_item_new_with_label(e->name); |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
542 else |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
543 opt = gtk_menu_item_new_with_label("Unknown"); |
4635 | 544 g_object_set_data(G_OBJECT(opt), "mod_account", ma); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4114
diff
changeset
|
545 g_signal_connect(GTK_OBJECT(opt), "activate", |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4114
diff
changeset
|
546 G_CALLBACK(set_prot), (void *)e->protocol); |
4635 | 547 gtk_menu_shell_append(GTK_MENU_SHELL(menu), opt); |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
548 gtk_widget_show(opt); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
549 p = p->next; |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
550 } |
960 | 551 |
552 gtk_option_menu_set_menu(GTK_OPTION_MENU(optmenu), menu); | |
1075
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
553 gtk_option_menu_set_history(GTK_OPTION_MENU(optmenu), count); |
960 | 554 |
555 return optmenu; | |
556 } | |
557 | |
4491 | 558 static void des_icon_sel(GtkWidget *w, struct mod_account *ma) |
2411
123aaa84109a
[gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2403
diff
changeset
|
559 { |
4491 | 560 w = ma->icondlg; |
561 if (ma->icondlg) | |
562 ma->icondlg = NULL; | |
2411
123aaa84109a
[gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2403
diff
changeset
|
563 if (w) |
123aaa84109a
[gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2403
diff
changeset
|
564 gtk_widget_destroy(w); |
123aaa84109a
[gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2403
diff
changeset
|
565 } |
123aaa84109a
[gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2403
diff
changeset
|
566 |
4491 | 567 static void set_icon(GtkWidget *w, struct mod_account *ma) |
2411
123aaa84109a
[gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2403
diff
changeset
|
568 { |
4491 | 569 GtkWidget *sel = ma->icondlg; |
3466 | 570 const char *file = gtk_file_selection_get_filename(GTK_FILE_SELECTION(sel)); |
2411
123aaa84109a
[gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2403
diff
changeset
|
571 |
123aaa84109a
[gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2403
diff
changeset
|
572 if (file_is_dir(file, sel)) |
123aaa84109a
[gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2403
diff
changeset
|
573 return; |
123aaa84109a
[gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2403
diff
changeset
|
574 |
4491 | 575 gtk_entry_set_text(GTK_ENTRY(ma->iconentry), file); |
576 g_snprintf(ma->iconfile, sizeof(ma->iconfile), "%s", file); | |
577 ma->icondlg = NULL; | |
2411
123aaa84109a
[gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2403
diff
changeset
|
578 |
123aaa84109a
[gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2403
diff
changeset
|
579 gtk_widget_destroy(sel); |
123aaa84109a
[gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2403
diff
changeset
|
580 } |
123aaa84109a
[gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2403
diff
changeset
|
581 |
4491 | 582 static void sel_icon_dlg(GtkWidget *w, struct mod_account *ma) |
2411
123aaa84109a
[gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2403
diff
changeset
|
583 { |
123aaa84109a
[gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2403
diff
changeset
|
584 GtkWidget *dlg; |
123aaa84109a
[gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2403
diff
changeset
|
585 char buf[256]; |
123aaa84109a
[gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2403
diff
changeset
|
586 |
4491 | 587 if (ma->icondlg) { |
588 gtk_widget_show(ma->icondlg); | |
2411
123aaa84109a
[gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2403
diff
changeset
|
589 return; |
123aaa84109a
[gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2403
diff
changeset
|
590 } |
123aaa84109a
[gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2403
diff
changeset
|
591 |
4703 | 592 dlg = gtk_file_selection_new(_("Load Buddy Icon")); |
2411
123aaa84109a
[gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2403
diff
changeset
|
593 gtk_file_selection_hide_fileop_buttons(GTK_FILE_SELECTION(dlg)); |
4491 | 594 if (ma->iconfile) { |
4738 | 595 char *tmp = g_path_get_dirname(ma->iconfile); |
596 g_snprintf(buf, sizeof(buf), "%s" G_DIR_SEPARATOR_S, tmp); | |
2442
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
597 g_free(tmp); |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
598 } else { |
3630 | 599 g_snprintf(buf, sizeof(buf), "%s" G_DIR_SEPARATOR_S, gaim_home_dir()); |
2442
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
600 } |
4738 | 601 gtk_file_selection_set_filename(GTK_FILE_SELECTION(dlg), buf); |
2411
123aaa84109a
[gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2403
diff
changeset
|
602 |
4491 | 603 g_signal_connect(GTK_OBJECT(dlg), "destroy", G_CALLBACK(des_icon_sel), ma); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4114
diff
changeset
|
604 g_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(dlg)->cancel_button), "clicked", |
4491 | 605 G_CALLBACK(des_icon_sel), ma); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4114
diff
changeset
|
606 g_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(dlg)->ok_button), "clicked", |
4491 | 607 G_CALLBACK(set_icon), ma); |
2411
123aaa84109a
[gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2403
diff
changeset
|
608 |
4491 | 609 ma->icondlg = dlg; |
2411
123aaa84109a
[gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2403
diff
changeset
|
610 |
123aaa84109a
[gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2403
diff
changeset
|
611 gtk_widget_show(dlg); |
123aaa84109a
[gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2403
diff
changeset
|
612 } |
123aaa84109a
[gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2403
diff
changeset
|
613 |
4491 | 614 static void reset_icon(GtkWidget *w, struct mod_account *ma) |
2411
123aaa84109a
[gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2403
diff
changeset
|
615 { |
4491 | 616 ma->iconfile[0] = 0; |
617 gtk_entry_set_text(GTK_ENTRY(ma->iconentry), ""); | |
2411
123aaa84109a
[gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2403
diff
changeset
|
618 } |
123aaa84109a
[gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2403
diff
changeset
|
619 |
4491 | 620 static GtkWidget *build_icon_selection(struct mod_account *ma, GtkWidget *box) |
2411
123aaa84109a
[gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2403
diff
changeset
|
621 { |
123aaa84109a
[gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2403
diff
changeset
|
622 GtkWidget *hbox; |
123aaa84109a
[gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2403
diff
changeset
|
623 GtkWidget *label; |
123aaa84109a
[gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2403
diff
changeset
|
624 GtkWidget *name; |
123aaa84109a
[gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2403
diff
changeset
|
625 GtkWidget *browse; |
123aaa84109a
[gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2403
diff
changeset
|
626 GtkWidget *reset; |
123aaa84109a
[gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2403
diff
changeset
|
627 |
4491 | 628 if (ma->account) |
629 g_snprintf(ma->iconfile, sizeof(ma->iconfile), "%s", ma->account->iconfile); | |
2431
5948060f486c
[gaim-migrate @ 2444]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
630 |
2411
123aaa84109a
[gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2403
diff
changeset
|
631 hbox = gtk_hbox_new(FALSE, 0); |
123aaa84109a
[gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2403
diff
changeset
|
632 gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, FALSE, 5); |
123aaa84109a
[gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2403
diff
changeset
|
633 gtk_widget_show(hbox); |
123aaa84109a
[gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2403
diff
changeset
|
634 |
123aaa84109a
[gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2403
diff
changeset
|
635 label = gtk_label_new(_("Buddy Icon File:")); |
4491 | 636 gtk_size_group_add_widget(ma->sg, label); |
3754 | 637 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); |
2411
123aaa84109a
[gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2403
diff
changeset
|
638 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
123aaa84109a
[gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2403
diff
changeset
|
639 gtk_widget_show(label); |
123aaa84109a
[gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2403
diff
changeset
|
640 |
123aaa84109a
[gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2403
diff
changeset
|
641 name = gtk_entry_new(); |
4491 | 642 gtk_entry_set_text(GTK_ENTRY(name), ma->iconfile); |
4635 | 643 gtk_editable_set_editable(GTK_EDITABLE(name), FALSE); |
2411
123aaa84109a
[gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2403
diff
changeset
|
644 gtk_box_pack_start(GTK_BOX(hbox), name, TRUE, TRUE, 5); |
123aaa84109a
[gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2403
diff
changeset
|
645 gtk_widget_show(name); |
4491 | 646 ma->iconentry = name; |
2411
123aaa84109a
[gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2403
diff
changeset
|
647 |
123aaa84109a
[gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2403
diff
changeset
|
648 browse = gtk_button_new_with_label(_("Browse")); |
4491 | 649 g_signal_connect(GTK_OBJECT(browse), "clicked", G_CALLBACK(sel_icon_dlg), ma); |
2411
123aaa84109a
[gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2403
diff
changeset
|
650 gtk_box_pack_start(GTK_BOX(hbox), browse, FALSE, FALSE, 0); |
123aaa84109a
[gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2403
diff
changeset
|
651 gtk_widget_show(browse); |
123aaa84109a
[gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2403
diff
changeset
|
652 |
123aaa84109a
[gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2403
diff
changeset
|
653 reset = gtk_button_new_with_label(_("Reset")); |
4491 | 654 g_signal_connect(GTK_OBJECT(reset), "clicked", G_CALLBACK(reset_icon), ma); |
2411
123aaa84109a
[gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2403
diff
changeset
|
655 gtk_box_pack_start(GTK_BOX(hbox), reset, FALSE, FALSE, 0); |
123aaa84109a
[gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2403
diff
changeset
|
656 gtk_widget_show(reset); |
123aaa84109a
[gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2403
diff
changeset
|
657 |
123aaa84109a
[gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2403
diff
changeset
|
658 return hbox; |
123aaa84109a
[gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2403
diff
changeset
|
659 } |
123aaa84109a
[gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2403
diff
changeset
|
660 |
4491 | 661 static void generate_login_options(struct mod_account *ma, GtkWidget *box) |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1172
diff
changeset
|
662 { |
3756
08742bf8a7be
[gaim-migrate @ 3895]
Christian Hammond <chipx86@chipx86.com>
parents:
3755
diff
changeset
|
663 GtkWidget *frame, *frame_parent; |
960 | 664 GtkWidget *vbox; |
665 GtkWidget *hbox; | |
666 GtkWidget *label; | |
2522
108b3eab22aa
[gaim-migrate @ 2535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2458
diff
changeset
|
667 |
108b3eab22aa
[gaim-migrate @ 2535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2458
diff
changeset
|
668 struct prpl *p; |
108b3eab22aa
[gaim-migrate @ 2535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2458
diff
changeset
|
669 |
3754 | 670 frame = make_frame(box, _("Login Options")); |
3756
08742bf8a7be
[gaim-migrate @ 3895]
Christian Hammond <chipx86@chipx86.com>
parents:
3755
diff
changeset
|
671 frame_parent = gtk_widget_get_parent(gtk_widget_get_parent(frame)); |
1075
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
672 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1172
diff
changeset
|
673 vbox = gtk_vbox_new(FALSE, 5); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1172
diff
changeset
|
674 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); |
2522
108b3eab22aa
[gaim-migrate @ 2535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2458
diff
changeset
|
675 gtk_container_add(GTK_CONTAINER(frame), vbox); |
960 | 676 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1172
diff
changeset
|
677 hbox = gtk_hbox_new(FALSE, 5); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1172
diff
changeset
|
678 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
1075
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
679 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1172
diff
changeset
|
680 label = gtk_label_new(_("Screenname:")); |
4491 | 681 gtk_size_group_add_widget(ma->sg, label); |
3754 | 682 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1172
diff
changeset
|
683 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
960 | 684 |
4491 | 685 ma->name = gtk_entry_new(); |
686 gtk_box_pack_start(GTK_BOX(hbox), ma->name, TRUE, TRUE, 0); | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1172
diff
changeset
|
687 |
4491 | 688 ma->pwdbox = gtk_hbox_new(FALSE, 5); |
689 gtk_box_pack_start(GTK_BOX(vbox), ma->pwdbox, FALSE, FALSE, 0); | |
960 | 690 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1172
diff
changeset
|
691 label = gtk_label_new(_("Password:")); |
4491 | 692 gtk_size_group_add_widget(ma->sg, label); |
3754 | 693 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); |
4491 | 694 gtk_box_pack_start(GTK_BOX(ma->pwdbox), label, FALSE, FALSE, 0); |
960 | 695 |
4491 | 696 ma->pass = gtk_entry_new(); |
697 gtk_box_pack_start(GTK_BOX(ma->pwdbox), ma->pass, TRUE, TRUE, 0); | |
698 gtk_entry_set_visibility(GTK_ENTRY(ma->pass), FALSE); | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1172
diff
changeset
|
699 |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1172
diff
changeset
|
700 hbox = gtk_hbox_new(FALSE, 5); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1172
diff
changeset
|
701 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
3205 | 702 |
703 label = gtk_label_new(_("Alias:")); | |
4491 | 704 gtk_size_group_add_widget(ma->sg, label); |
3754 | 705 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); |
3205 | 706 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
707 | |
4491 | 708 ma->alias = gtk_entry_new(); |
709 gtk_box_pack_start(GTK_BOX(hbox), ma->alias, TRUE, TRUE, 0); | |
3205 | 710 |
711 hbox = gtk_hbox_new(FALSE, 5); | |
712 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
960 | 713 gtk_widget_show(hbox); |
714 | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1172
diff
changeset
|
715 label = gtk_label_new(_("Protocol:")); |
4491 | 716 gtk_size_group_add_widget(ma->sg, label); |
3754 | 717 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1172
diff
changeset
|
718 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
960 | 719 |
4491 | 720 make_protocol_menu(hbox, ma); |
960 | 721 |
4491 | 722 ma->rempass = acct_button(_("Remember Password"), ma, OPT_ACCT_REM_PASS, vbox); |
723 acct_button(_("Auto-Login"), ma, OPT_ACCT_AUTO, vbox); | |
960 | 724 |
3756
08742bf8a7be
[gaim-migrate @ 3895]
Christian Hammond <chipx86@chipx86.com>
parents:
3755
diff
changeset
|
725 gtk_widget_show_all(frame_parent); |
2100
a93aeb6f813d
[gaim-migrate @ 2110]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
726 |
4491 | 727 if (ma->account) { |
728 gtk_entry_set_text(GTK_ENTRY(ma->name), ma->account->username); | |
729 gtk_entry_set_text(GTK_ENTRY(ma->alias), ma->account->alias); | |
730 gtk_entry_set_text(GTK_ENTRY(ma->pass), ma->account->password); | |
2522
108b3eab22aa
[gaim-migrate @ 2535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2458
diff
changeset
|
731 } |
108b3eab22aa
[gaim-migrate @ 2535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2458
diff
changeset
|
732 |
4491 | 733 p = find_prpl(ma->protocol); |
2522
108b3eab22aa
[gaim-migrate @ 2535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2458
diff
changeset
|
734 if (p && (p->options & OPT_PROTO_NO_PASSWORD)) { |
4491 | 735 gtk_widget_hide(ma->pwdbox); |
736 gtk_widget_hide(ma->rempass); | |
2444
13ce96daf30f
[gaim-migrate @ 2457]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2442
diff
changeset
|
737 } |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1172
diff
changeset
|
738 } |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1172
diff
changeset
|
739 |
4491 | 740 static void generate_user_options(struct mod_account *ma, GtkWidget *box) |
2522
108b3eab22aa
[gaim-migrate @ 2535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2458
diff
changeset
|
741 { |
108b3eab22aa
[gaim-migrate @ 2535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2458
diff
changeset
|
742 /* This function will add the appropriate (depending on the current |
108b3eab22aa
[gaim-migrate @ 2535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2458
diff
changeset
|
743 * protocol) widgets to frame and return TRUE if there anything |
108b3eab22aa
[gaim-migrate @ 2535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2458
diff
changeset
|
744 * was added (meaning the frame should be shown) |
108b3eab22aa
[gaim-migrate @ 2535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2458
diff
changeset
|
745 * Eric will most likely change this (as he does all other submitted code) |
108b3eab22aa
[gaim-migrate @ 2535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2458
diff
changeset
|
746 * so that it will accept the vbox as an argument and create, add, and show |
108b3eab22aa
[gaim-migrate @ 2535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2458
diff
changeset
|
747 * the frame itself (like generate_protocol_options). I'd do it myself, but I'm |
108b3eab22aa
[gaim-migrate @ 2535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2458
diff
changeset
|
748 * tired and I don't care. */ |
108b3eab22aa
[gaim-migrate @ 2535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2458
diff
changeset
|
749 /* Sean was right. I did do that. I told him I would. */ |
108b3eab22aa
[gaim-migrate @ 2535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2458
diff
changeset
|
750 |
108b3eab22aa
[gaim-migrate @ 2535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2458
diff
changeset
|
751 GtkWidget *vbox; |
3756
08742bf8a7be
[gaim-migrate @ 3895]
Christian Hammond <chipx86@chipx86.com>
parents:
3755
diff
changeset
|
752 GtkWidget *frame; |
2522
108b3eab22aa
[gaim-migrate @ 2535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2458
diff
changeset
|
753 |
4491 | 754 struct prpl *p = find_prpl(ma->protocol); |
2522
108b3eab22aa
[gaim-migrate @ 2535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2458
diff
changeset
|
755 |
3756
08742bf8a7be
[gaim-migrate @ 3895]
Christian Hammond <chipx86@chipx86.com>
parents:
3755
diff
changeset
|
756 frame = make_frame(box, _("User Options")); |
4491 | 757 ma->user_frame = gtk_widget_get_parent(gtk_widget_get_parent(frame)); |
758 gtk_widget_show_all(ma->user_frame); | |
2522
108b3eab22aa
[gaim-migrate @ 2535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2458
diff
changeset
|
759 |
108b3eab22aa
[gaim-migrate @ 2535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2458
diff
changeset
|
760 vbox = gtk_vbox_new(FALSE, 5); |
108b3eab22aa
[gaim-migrate @ 2535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2458
diff
changeset
|
761 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); |
3756
08742bf8a7be
[gaim-migrate @ 3895]
Christian Hammond <chipx86@chipx86.com>
parents:
3755
diff
changeset
|
762 gtk_container_add(GTK_CONTAINER(frame), vbox); |
2522
108b3eab22aa
[gaim-migrate @ 2535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2458
diff
changeset
|
763 gtk_widget_show(vbox); |
108b3eab22aa
[gaim-migrate @ 2535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2458
diff
changeset
|
764 |
4491 | 765 ma->checkmail = acct_button(_("New Mail Notifications"), ma, OPT_ACCT_MAIL_CHECK, vbox); |
766 ma->iconsel = build_icon_selection(ma, vbox); | |
2522
108b3eab22aa
[gaim-migrate @ 2535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2458
diff
changeset
|
767 |
108b3eab22aa
[gaim-migrate @ 2535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2458
diff
changeset
|
768 if (!p) { |
4491 | 769 gtk_widget_hide(ma->user_frame); |
2522
108b3eab22aa
[gaim-migrate @ 2535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2458
diff
changeset
|
770 return; |
108b3eab22aa
[gaim-migrate @ 2535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2458
diff
changeset
|
771 } |
108b3eab22aa
[gaim-migrate @ 2535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2458
diff
changeset
|
772 |
108b3eab22aa
[gaim-migrate @ 2535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2458
diff
changeset
|
773 if (!(p->options & OPT_PROTO_MAIL_CHECK)) |
4491 | 774 gtk_widget_hide(ma->checkmail); |
2522
108b3eab22aa
[gaim-migrate @ 2535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2458
diff
changeset
|
775 if (!(p->options & OPT_PROTO_BUDDY_ICON)) |
4491 | 776 gtk_widget_hide(ma->iconsel); |
2525
4fc6aac9da94
[gaim-migrate @ 2538]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2522
diff
changeset
|
777 |
4fc6aac9da94
[gaim-migrate @ 2538]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2522
diff
changeset
|
778 if ((p->options & OPT_PROTO_BUDDY_ICON) || (p->options & OPT_PROTO_MAIL_CHECK)) |
4fc6aac9da94
[gaim-migrate @ 2538]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2522
diff
changeset
|
779 return; |
4491 | 780 gtk_widget_hide(ma->user_frame); |
2522
108b3eab22aa
[gaim-migrate @ 2535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2458
diff
changeset
|
781 } |
108b3eab22aa
[gaim-migrate @ 2535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2458
diff
changeset
|
782 |
4491 | 783 static void generate_protocol_options(struct mod_account *ma, GtkWidget *box) |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1172
diff
changeset
|
784 { |
4491 | 785 struct prpl *p = find_prpl(ma->protocol); |
2442
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
786 |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
787 GList *op, *tmp; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1172
diff
changeset
|
788 |
2442
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
789 GtkWidget *vbox; |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
790 GtkWidget *hbox; |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
791 GtkWidget *label; |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
792 GtkWidget *entry; |
3754 | 793 GtkWidget *frame; |
2442
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
794 |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
795 char buf[256]; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1172
diff
changeset
|
796 |
4491 | 797 if (ma->proto_frame) |
798 gtk_widget_destroy(ma->proto_frame); | |
799 ma->proto_frame = NULL; | |
2203
14100685c95f
[gaim-migrate @ 2213]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2200
diff
changeset
|
800 |
4491 | 801 if (ma->opt_entries) { |
802 g_list_free(ma->opt_entries); | |
803 ma->opt_entries = NULL; | |
2190
24d947eff811
[gaim-migrate @ 2200]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2165
diff
changeset
|
804 } |
24d947eff811
[gaim-migrate @ 2200]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2165
diff
changeset
|
805 |
2522
108b3eab22aa
[gaim-migrate @ 2535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2458
diff
changeset
|
806 if (!p) |
108b3eab22aa
[gaim-migrate @ 2535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2458
diff
changeset
|
807 return; |
108b3eab22aa
[gaim-migrate @ 2535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2458
diff
changeset
|
808 |
2442
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
809 if (!p->user_opts) |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
810 return; |
2154
cff133e0ec0c
[gaim-migrate @ 2164]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2153
diff
changeset
|
811 |
3572 | 812 tmp = op = p->user_opts; |
2154
cff133e0ec0c
[gaim-migrate @ 2164]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2153
diff
changeset
|
813 |
2522
108b3eab22aa
[gaim-migrate @ 2535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2458
diff
changeset
|
814 if (!op) |
108b3eab22aa
[gaim-migrate @ 2535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2458
diff
changeset
|
815 return; |
108b3eab22aa
[gaim-migrate @ 2535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2458
diff
changeset
|
816 |
4169 | 817 g_snprintf(buf, sizeof(buf), _("%s Options"), p->name); |
3754 | 818 frame = make_frame(box, buf); |
819 | |
820 /* BLEH */ | |
4491 | 821 ma->proto_frame = gtk_widget_get_parent(gtk_widget_get_parent(frame)); |
822 gtk_widget_show_all(ma->proto_frame); | |
2522
108b3eab22aa
[gaim-migrate @ 2535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2458
diff
changeset
|
823 |
2442
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
824 vbox = gtk_vbox_new(FALSE, 5); |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
825 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); |
3754 | 826 gtk_container_add(GTK_CONTAINER(frame), vbox); |
2442
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
827 gtk_widget_show(vbox); |
2154
cff133e0ec0c
[gaim-migrate @ 2164]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2153
diff
changeset
|
828 |
2442
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
829 while (op) { |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
830 struct proto_user_opt *puo = op->data; |
2154
cff133e0ec0c
[gaim-migrate @ 2164]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2153
diff
changeset
|
831 |
2442
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
832 hbox = gtk_hbox_new(FALSE, 5); |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
833 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
834 gtk_widget_show(hbox); |
2154
cff133e0ec0c
[gaim-migrate @ 2164]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2153
diff
changeset
|
835 |
2442
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
836 label = gtk_label_new(puo->label); |
4491 | 837 gtk_size_group_add_widget(ma->sg, label); |
3754 | 838 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); |
2442
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
839 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
840 gtk_widget_show(label); |
2154
cff133e0ec0c
[gaim-migrate @ 2164]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2153
diff
changeset
|
841 |
2442
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
842 entry = gtk_entry_new(); |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
843 gtk_box_pack_end(GTK_BOX(hbox), entry, FALSE, FALSE, 0); |
4635 | 844 g_object_set_data(G_OBJECT(entry), "position", GINT_TO_POINTER(puo->pos)); |
4491 | 845 if (ma->proto_opt[puo->pos][0]) { |
846 debug_printf("setting text %s\n", ma->proto_opt[puo->pos]); | |
847 gtk_entry_set_text(GTK_ENTRY(entry), ma->proto_opt[puo->pos]); | |
2442
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
848 } else { |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
849 gtk_entry_set_text(GTK_ENTRY(entry), puo->def); |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
850 } |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
851 gtk_widget_show(entry); |
2154
cff133e0ec0c
[gaim-migrate @ 2164]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2153
diff
changeset
|
852 |
4491 | 853 ma->opt_entries = g_list_append(ma->opt_entries, entry); |
854 | |
2442
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
855 op = op->next; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1172
diff
changeset
|
856 } |
2956 | 857 |
858 if(p->register_user != NULL) { | |
4491 | 859 ma->register_user = gtk_check_button_new_with_label(_("Register with server")); |
4635 | 860 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ma->register_user), FALSE); |
4491 | 861 gtk_box_pack_start(GTK_BOX(vbox), ma->register_user, FALSE, FALSE, 0); |
862 gtk_widget_show(ma->register_user); | |
2956 | 863 } |
864 | |
1075
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
865 } |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
866 |
4635 | 867 static void proxy_dropdown_set(GObject *w, struct mod_account *ma) { |
868 int opt = GPOINTER_TO_INT(g_object_get_data(w, "proxytype")); | |
4634 | 869 gtk_widget_set_sensitive(ma->proxy_host_box, (opt != PROXY_NONE && opt != PROXY_USE_GLOBAL)); |
870 } | |
871 | |
872 static void generate_proxy_options(struct mod_account *ma, GtkWidget *box) { | |
873 GtkWidget *frame; | |
874 GtkWidget *hbox; | |
875 GtkWidget *vbox; | |
876 GtkWidget *label; | |
877 GtkWidget *menu; | |
878 GtkWidget *dropdown; | |
879 GtkWidget *opt; | |
880 GtkWidget *entry; | |
881 GtkWidget *vbox2; | |
882 | |
883 struct gaim_proxy_info *gpi = NULL; | |
884 | |
885 if(ma->account) | |
886 gpi = ma->account->gpi; | |
887 | |
888 frame = make_frame(box, _("Proxy Options")); | |
889 ma->proxy_frame = gtk_widget_get_parent(gtk_widget_get_parent(frame)); | |
890 gtk_widget_show_all(ma->proxy_frame); | |
891 | |
892 vbox = gtk_vbox_new(FALSE, 5); | |
893 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); | |
894 gtk_container_add(GTK_CONTAINER(frame), vbox); | |
895 gtk_widget_show(vbox); | |
896 | |
897 /* make the dropdown w/o the benefit of the easy helper funcs in prefs.c */ | |
898 hbox = gtk_hbox_new(FALSE, 5); | |
899 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
900 gtk_widget_show(hbox); | |
901 | |
902 label = gtk_label_new_with_mnemonic(_("Proxy _Type")); | |
903 gtk_size_group_add_widget(ma->sg, label); | |
904 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
905 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
906 gtk_widget_show(label); | |
907 | |
908 dropdown = gtk_option_menu_new(); | |
909 menu = gtk_menu_new(); | |
910 | |
911 opt = gtk_menu_item_new_with_label("Use Global Proxy Settings"); | |
4635 | 912 g_object_set_data(G_OBJECT(opt), "proxytype", GINT_TO_POINTER(PROXY_USE_GLOBAL)); |
4634 | 913 g_signal_connect(G_OBJECT(opt), "activate", |
914 G_CALLBACK(proxy_dropdown_set), ma); | |
915 gtk_widget_show(opt); | |
916 gtk_menu_shell_append(GTK_MENU_SHELL(menu), opt); | |
917 if(!gpi) | |
918 gtk_menu_set_active(GTK_MENU(menu), 0); | |
919 | |
920 opt = gtk_menu_item_new_with_label("No Proxy"); | |
4635 | 921 g_object_set_data(G_OBJECT(opt), "proxytype", GINT_TO_POINTER(PROXY_NONE)); |
4634 | 922 g_signal_connect(G_OBJECT(opt), "activate", |
923 G_CALLBACK(proxy_dropdown_set), ma); | |
924 gtk_widget_show(opt); | |
925 gtk_menu_shell_append(GTK_MENU_SHELL(menu), opt); | |
926 if(gpi && gpi->proxytype == PROXY_NONE) | |
927 gtk_menu_set_active(GTK_MENU(menu), 1); | |
928 | |
929 opt = gtk_menu_item_new_with_label("SOCKS 4"); | |
4635 | 930 g_object_set_data(G_OBJECT(opt), "proxytype", GINT_TO_POINTER(PROXY_SOCKS4)); |
4634 | 931 g_signal_connect(G_OBJECT(opt), "activate", |
932 G_CALLBACK(proxy_dropdown_set), ma); | |
933 gtk_widget_show(opt); | |
934 gtk_menu_shell_append(GTK_MENU_SHELL(menu), opt); | |
935 if(gpi && gpi->proxytype == PROXY_SOCKS4) | |
936 gtk_menu_set_active(GTK_MENU(menu), 2); | |
937 | |
938 opt = gtk_menu_item_new_with_label("SOCKS 5"); | |
4635 | 939 g_object_set_data(G_OBJECT(opt), "proxytype", GINT_TO_POINTER(PROXY_SOCKS5)); |
4634 | 940 g_signal_connect(G_OBJECT(opt), "activate", |
941 G_CALLBACK(proxy_dropdown_set), ma); | |
942 gtk_widget_show(opt); | |
943 gtk_menu_shell_append(GTK_MENU_SHELL(menu), opt); | |
944 if(gpi && gpi->proxytype == PROXY_SOCKS5) | |
945 gtk_menu_set_active(GTK_MENU(menu), 3); | |
946 | |
947 opt = gtk_menu_item_new_with_label("HTTP"); | |
4635 | 948 g_object_set_data(G_OBJECT(opt), "proxytype", GINT_TO_POINTER(PROXY_HTTP)); |
4634 | 949 g_signal_connect(G_OBJECT(opt), "activate", |
950 G_CALLBACK(proxy_dropdown_set), ma); | |
951 gtk_widget_show(opt); | |
952 gtk_menu_shell_append(GTK_MENU_SHELL(menu), opt); | |
953 if(gpi && gpi->proxytype == PROXY_HTTP) | |
954 gtk_menu_set_active(GTK_MENU(menu), 4); | |
955 | |
956 gtk_option_menu_set_menu(GTK_OPTION_MENU(dropdown), menu); | |
957 gtk_box_pack_start(GTK_BOX(hbox), dropdown, FALSE, FALSE, 0); | |
958 gtk_widget_show(dropdown); | |
959 | |
960 ma->proxytype_menu = menu; | |
961 | |
962 | |
963 vbox2 = gtk_vbox_new(FALSE, 5); | |
964 gtk_container_add(GTK_CONTAINER(vbox), vbox2); | |
965 gtk_widget_show(vbox2); | |
966 ma->proxy_host_box = vbox2; | |
967 | |
968 hbox = gtk_hbox_new(FALSE, 5); | |
969 gtk_box_pack_start(GTK_BOX(vbox2), hbox, FALSE, FALSE, 0); | |
970 gtk_widget_show(hbox); | |
971 | |
972 label = gtk_label_new_with_mnemonic(_("_Host:")); | |
973 gtk_size_group_add_widget(ma->sg, label); | |
974 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
975 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
976 gtk_widget_show(label); | |
977 entry = gtk_entry_new(); | |
978 gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); | |
979 gtk_box_pack_start(GTK_BOX(hbox), entry, FALSE, FALSE, 0); | |
980 gtk_entry_set_text(GTK_ENTRY(entry), gpi ? gpi->proxyhost : ""); | |
981 gtk_widget_show(entry); | |
982 ma->proxyhost_entry = entry; | |
983 | |
984 hbox = gtk_hbox_new(FALSE, 5); | |
985 gtk_box_pack_start(GTK_BOX(vbox2), hbox, FALSE, FALSE, 0); | |
986 gtk_widget_show(hbox); | |
987 | |
988 label = gtk_label_new_with_mnemonic(_("Port:")); | |
989 gtk_size_group_add_widget(ma->sg, label); | |
990 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
991 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
992 gtk_widget_show(label); | |
993 entry = gtk_entry_new(); | |
994 gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); | |
995 gtk_box_pack_start(GTK_BOX(hbox), entry, FALSE, FALSE, 0); | |
996 if(gpi && gpi->proxyport) { | |
997 char buf[128]; | |
998 g_snprintf(buf, sizeof(buf), "%d", gpi->proxyport); | |
999 gtk_entry_set_text(GTK_ENTRY(entry), buf); | |
1000 } | |
1001 gtk_widget_show(entry); | |
1002 ma->proxyport_entry = entry; | |
1003 | |
1004 hbox = gtk_hbox_new(FALSE, 5); | |
1005 gtk_box_pack_start(GTK_BOX(vbox2), hbox, FALSE, FALSE, 0); | |
1006 gtk_widget_show(hbox); | |
1007 | |
1008 label = gtk_label_new_with_mnemonic(_("_User:")); | |
1009 gtk_size_group_add_widget(ma->sg, label); | |
1010 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
1011 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
1012 gtk_widget_show(label); | |
1013 entry = gtk_entry_new(); | |
1014 gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); | |
1015 gtk_box_pack_start(GTK_BOX(hbox), entry, FALSE, FALSE, 0); | |
1016 gtk_entry_set_text(GTK_ENTRY(entry), gpi ? gpi->proxyuser : ""); | |
1017 gtk_widget_show(entry); | |
1018 ma->proxyuser_entry = entry; | |
1019 | |
1020 hbox = gtk_hbox_new(FALSE, 5); | |
1021 gtk_box_pack_start(GTK_BOX(vbox2), hbox, FALSE, FALSE, 0); | |
1022 gtk_widget_show(hbox); | |
1023 | |
1024 label = gtk_label_new_with_mnemonic(_("Pa_ssword:")); | |
1025 gtk_size_group_add_widget(ma->sg, label); | |
1026 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
1027 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
1028 gtk_widget_show(label); | |
1029 entry = gtk_entry_new(); | |
1030 gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); | |
1031 gtk_box_pack_start(GTK_BOX(hbox), entry, FALSE, FALSE, 0); | |
1032 gtk_entry_set_text(GTK_ENTRY(entry), gpi ? gpi->proxypass : ""); | |
1033 gtk_widget_show(entry); | |
1034 ma->proxypass_entry = entry; | |
1035 | |
1036 gtk_widget_set_sensitive(vbox2, !(gpi == NULL || gpi->proxytype == PROXY_NONE)); | |
1037 } | |
1038 | |
4491 | 1039 static void show_acct_mod(struct gaim_account *a) |
1075
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
1040 { |
2522
108b3eab22aa
[gaim-migrate @ 2535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2458
diff
changeset
|
1041 /* This is the fucking modify account dialog. I've fucking seperated it into |
108b3eab22aa
[gaim-migrate @ 2535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2458
diff
changeset
|
1042 * three fucking frames: |
108b3eab22aa
[gaim-migrate @ 2535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2458
diff
changeset
|
1043 * a fucking Login Options frame, a fucking User Options frame and a fucking |
4491 | 1044 * Protcol Options frame. This fucking removes the two fucking tabs, which |
1045 * were quite fucking uneccessary. Fuck. */ | |
2522
108b3eab22aa
[gaim-migrate @ 2535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2458
diff
changeset
|
1046 /* -- SeanEgan */ |
3754 | 1047 /* YEAH!! -- ChipX86 */ |
1048 GtkWidget *hbox, *vbox; | |
1075
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
1049 GtkWidget *button; |
3754 | 1050 GtkWidget *sep; |
1051 GtkSizeGroup *button_sg; | |
1075
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
1052 |
4491 | 1053 struct mod_account *ma = mod_account_find(a); |
2442
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
1054 |
4491 | 1055 if (!ma) { |
1056 ma = g_new0(struct mod_account, 1); | |
1057 ma->account = a; | |
1058 mod_accounts = g_slist_append(mod_accounts, ma); | |
2442
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
1059 |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
1060 if (a) { |
2458
8208e2016d9b
[gaim-migrate @ 2471]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2445
diff
changeset
|
1061 int i; |
4491 | 1062 ma->options = a->options; |
2442
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
1063 if (find_prpl(a->protocol)) |
4491 | 1064 ma->protocol = a->protocol; |
2442
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
1065 else if (protocols) |
4491 | 1066 ma->protocol = ((struct prpl *)protocols->data)->protocol; |
2442
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
1067 else |
4491 | 1068 ma->protocol = -1; |
1069 g_snprintf(ma->iconfile, sizeof(ma->iconfile), "%s", a->iconfile); | |
2458
8208e2016d9b
[gaim-migrate @ 2471]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2445
diff
changeset
|
1070 for (i = 0; i < 7; i++) |
4491 | 1071 g_snprintf(ma->proto_opt[i], sizeof(ma->proto_opt[i]), "%s", |
2458
8208e2016d9b
[gaim-migrate @ 2471]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2445
diff
changeset
|
1072 a->proto_opt[i]); |
2442
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
1073 } else { |
4491 | 1074 ma->options = OPT_ACCT_REM_PASS; |
2442
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
1075 if (find_prpl(DEFAULT_PROTO)) |
4491 | 1076 ma->protocol = DEFAULT_PROTO; |
2442
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
1077 else if (protocols) |
4491 | 1078 ma->protocol = ((struct prpl *)protocols->data)->protocol; |
2442
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
1079 else |
4491 | 1080 ma->protocol = -1; |
2442
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
1081 } |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
1082 } else { |
4491 | 1083 gtk_widget_show(ma->mod); |
1075
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
1084 return; |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
1085 } |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
1086 |
4491 | 1087 ma->mod = gtk_window_new(GTK_WINDOW_TOPLEVEL); |
1088 gtk_window_set_role(GTK_WINDOW(ma->mod), "account"); | |
1089 gtk_widget_realize(ma->mod); | |
4703 | 1090 gtk_window_set_title(GTK_WINDOW(ma->mod), _("Modify Account")); |
4635 | 1091 gtk_window_set_resizable(GTK_WINDOW(ma->mod), FALSE); /* nothing odd here :) */ |
4491 | 1092 g_signal_connect(GTK_OBJECT(ma->mod), "destroy", G_CALLBACK(delmod), ma); |
1075
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
1093 |
3754 | 1094 vbox = gtk_vbox_new(FALSE, 6); |
4635 | 1095 gtk_container_set_border_width(GTK_CONTAINER(vbox), 6); |
4491 | 1096 gtk_container_add(GTK_CONTAINER(ma->mod), vbox); |
3756
08742bf8a7be
[gaim-migrate @ 3895]
Christian Hammond <chipx86@chipx86.com>
parents:
3755
diff
changeset
|
1097 gtk_widget_show(vbox); |
3754 | 1098 |
4491 | 1099 ma->main = gtk_vbox_new(FALSE, 12); |
4635 | 1100 gtk_container_set_border_width(GTK_CONTAINER(ma->main), 6); |
4491 | 1101 gtk_box_pack_start(GTK_BOX(vbox), ma->main, FALSE, FALSE, 0); |
1102 gtk_widget_show(ma->main); | |
3754 | 1103 |
4491 | 1104 ma->sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1172
diff
changeset
|
1105 |
4491 | 1106 generate_login_options(ma, ma->main); |
1107 generate_user_options(ma, ma->main); | |
1108 generate_protocol_options(ma, ma->main); | |
4634 | 1109 generate_proxy_options(ma, ma->main); |
1075
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1074
diff
changeset
|
1110 |
3754 | 1111 hbox = gtk_hbox_new(FALSE, 6); |
1112 gtk_container_set_border_width (GTK_CONTAINER (hbox), 6); | |
1113 gtk_box_pack_end(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
960 | 1114 |
3754 | 1115 button_sg = gtk_size_group_new(GTK_SIZE_GROUP_BOTH); |
1116 | |
1117 button = gtk_button_new_from_stock(GTK_STOCK_OK); | |
1118 gtk_size_group_add_widget(button_sg, button); | |
1119 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
4491 | 1120 g_signal_connect(GTK_OBJECT(button), "clicked", G_CALLBACK(ok_mod), ma); |
3754 | 1121 |
1122 button = gtk_button_new_from_stock(GTK_STOCK_CANCEL); | |
1123 gtk_size_group_add_widget(button_sg, button); | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1172
diff
changeset
|
1124 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0); |
4491 | 1125 g_signal_connect(GTK_OBJECT(button), "clicked", G_CALLBACK(cancel_mod), ma); |
960 | 1126 |
3756
08742bf8a7be
[gaim-migrate @ 3895]
Christian Hammond <chipx86@chipx86.com>
parents:
3755
diff
changeset
|
1127 sep = gtk_hseparator_new(); |
08742bf8a7be
[gaim-migrate @ 3895]
Christian Hammond <chipx86@chipx86.com>
parents:
3755
diff
changeset
|
1128 gtk_box_pack_end (GTK_BOX (vbox), sep, FALSE, FALSE, 0); |
08742bf8a7be
[gaim-migrate @ 3895]
Christian Hammond <chipx86@chipx86.com>
parents:
3755
diff
changeset
|
1129 gtk_widget_show(sep); |
08742bf8a7be
[gaim-migrate @ 3895]
Christian Hammond <chipx86@chipx86.com>
parents:
3755
diff
changeset
|
1130 |
08742bf8a7be
[gaim-migrate @ 3895]
Christian Hammond <chipx86@chipx86.com>
parents:
3755
diff
changeset
|
1131 gtk_widget_show_all(hbox); |
4491 | 1132 gtk_widget_show(ma->mod); |
960 | 1133 } |
1134 | |
1135 static void add_acct(GtkWidget *w, gpointer d) | |
1136 { | |
1137 show_acct_mod(NULL); | |
1138 } | |
1139 | |
3754 | 1140 static void mod_acct_func(GtkTreeModel *model, GtkTreePath *path, |
1141 GtkTreeIter *iter, gpointer data) | |
1142 { | |
4491 | 1143 struct gaim_account *a; |
3754 | 1144 |
4491 | 1145 gtk_tree_model_get(model, iter, COLUMN_DATA, &a, -1); |
3754 | 1146 |
4491 | 1147 if (a != NULL) |
1148 show_acct_mod(a); | |
3754 | 1149 } |
1150 | |
960 | 1151 static void mod_acct(GtkWidget *w, gpointer d) |
1152 { | |
3754 | 1153 GtkTreeSelection *selection; |
1154 | |
1155 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview)); | |
1156 | |
1157 gtk_tree_selection_selected_foreach(selection, mod_acct_func, NULL); | |
960 | 1158 } |
1159 | |
2442
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
1160 struct pass_prompt { |
4491 | 1161 struct gaim_account *account; |
2442
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
1162 GtkWidget *win; |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
1163 GtkWidget *entry; |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
1164 }; |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
1165 static GSList *passes = NULL; |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
1166 |
4491 | 1167 static struct pass_prompt *find_pass_prompt(struct gaim_account *account) |
960 | 1168 { |
2442
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
1169 GSList *p = passes; |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
1170 while (p) { |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
1171 struct pass_prompt *r = p->data; |
4491 | 1172 if (r->account == account) |
2442
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
1173 return r; |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
1174 p = p->next; |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
1175 } |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
1176 return NULL; |
960 | 1177 } |
1178 | |
4483 | 1179 static void pass_callback(GtkDialog *d, gint resp, struct pass_prompt *p) |
960 | 1180 { |
4483 | 1181 if (resp == GTK_RESPONSE_YES) { |
1182 const char *txt = gtk_entry_get_text(GTK_ENTRY(p->entry)); | |
4491 | 1183 g_snprintf(p->account->password, sizeof(p->account->password), "%s", txt); |
1184 serv_login(p->account); | |
4483 | 1185 } |
2442
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
1186 passes = g_slist_remove(passes, p); |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
1187 gtk_widget_destroy(p->win); |
4483 | 1188 g_free(p); |
960 | 1189 } |
1190 | |
4491 | 1191 static void do_pass_dlg(struct gaim_account *account) |
960 | 1192 { |
1193 /* we can safely assume that u is not NULL */ | |
4491 | 1194 struct pass_prompt *p = find_pass_prompt(account); |
960 | 1195 GtkWidget *label; |
4483 | 1196 GtkWidget *hbox, *vbox; |
1197 char *labeltext=NULL; | |
4491 | 1198 char *filename = g_build_filename(DATADIR, "pixmaps", "gaim", "dialogs", "gaim_auth.png", NULL); |
4483 | 1199 GtkWidget *img = gtk_image_new_from_file(filename); |
1200 g_free(filename); | |
4491 | 1201 |
960 | 1202 |
2442
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
1203 if (p) { |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
1204 gtk_widget_show(p->win); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1172
diff
changeset
|
1205 return; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1172
diff
changeset
|
1206 } |
2442
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
1207 |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
1208 p = g_new0(struct pass_prompt, 1); |
4491 | 1209 p->account = account; |
2442
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
1210 passes = g_slist_append(passes, p); |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
1211 |
4772 | 1212 p->win = gtk_dialog_new_with_buttons("Gaim", NULL, 0, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, |
4483 | 1213 _("_Login"), GTK_RESPONSE_YES, NULL); |
1214 | |
1215 gtk_dialog_set_default_response (GTK_DIALOG(p->win), GTK_RESPONSE_YES); | |
1216 g_signal_connect(G_OBJECT(p->win), "response", G_CALLBACK(pass_callback), p); | |
960 | 1217 |
4483 | 1218 gtk_container_set_border_width (GTK_CONTAINER(p->win), 6); |
1219 gtk_window_set_resizable(GTK_WINDOW(p->win), FALSE); | |
1220 gtk_dialog_set_has_separator(GTK_DIALOG(p->win), FALSE); | |
1221 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(p->win)->vbox), 12); | |
1222 gtk_container_set_border_width (GTK_CONTAINER(GTK_DIALOG(p->win)->vbox), 6); | |
1223 | |
1224 hbox = gtk_hbox_new(FALSE, 12); | |
1225 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(p->win)->vbox), hbox); | |
1226 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); | |
960 | 1227 |
4483 | 1228 vbox = gtk_vbox_new(FALSE, 0); |
1229 gtk_container_add(GTK_CONTAINER(hbox), vbox); | |
960 | 1230 |
4491 | 1231 labeltext = g_strdup_printf(_("Please enter your password for %s.\n\n"), |
1232 account->username); | |
4483 | 1233 label = gtk_label_new(labeltext); |
1234 g_free(labeltext); | |
1235 | |
1236 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); | |
1237 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
1238 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); | |
4491 | 1239 |
960 | 1240 hbox = gtk_hbox_new(FALSE, 5); |
4483 | 1241 gtk_container_add(GTK_CONTAINER(vbox), hbox); |
1242 label = gtk_label_new_with_mnemonic(_("_Password")); | |
1243 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
960 | 1244 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); |
1245 | |
2442
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
1246 p->entry = gtk_entry_new(); |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
1247 gtk_entry_set_visibility(GTK_ENTRY(p->entry), FALSE); |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
1248 gtk_box_pack_start(GTK_BOX(hbox), p->entry, FALSE, FALSE, 5); |
4483 | 1249 gtk_label_set_mnemonic_widget(GTK_LABEL(label), p->entry); |
2442
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
1250 gtk_widget_grab_focus(p->entry); |
960 | 1251 |
4413 | 1252 gtk_widget_show_all(p->win); |
960 | 1253 } |
1254 | |
3754 | 1255 static void acct_signin(GtkCellRendererToggle *cell, gchar *path_str, |
1256 gpointer d) | |
960 | 1257 { |
3754 | 1258 GtkTreeModel *model = (GtkTreeModel *)d; |
1259 GtkTreeIter iter; | |
1260 | |
4491 | 1261 struct gaim_account *account = NULL; |
3069 | 1262 struct prpl *p = NULL; |
3754 | 1263 |
1264 gtk_tree_model_get_iter_from_string(model, &iter, path_str); | |
4491 | 1265 gtk_tree_model_get(model, &iter, COLUMN_DATA, &account, -1); |
3754 | 1266 |
4491 | 1267 p = find_prpl(account->protocol); |
1268 if (!account->gc && p && p->login) { | |
1269 struct prpl *p = find_prpl(account->protocol); | |
3789 | 1270 if (p && !(p->options & OPT_PROTO_NO_PASSWORD) && |
4491 | 1271 !(p->options & OPT_PROTO_PASSWORD_OPTIONAL) && !account->password[0]) { |
1272 do_pass_dlg(account); | |
3069 | 1273 } else { |
4491 | 1274 serv_login(account); |
960 | 1275 } |
4491 | 1276 } else if (account->gc) { |
1277 account->gc->wants_to_die = TRUE; | |
1278 signoff(account->gc); | |
3754 | 1279 } else { |
4491 | 1280 if (account->protocol == PROTO_TOC) |
3754 | 1281 do_error_dialog(_("TOC not found."), |
1282 _("You have attempted to login an IM account using the " | |
1283 "TOC protocol. Because this protocol is inferior to " | |
1284 "OSCAR, it is now compiled as a plugin by default. " | |
1285 "To login, edit this account to use OSCAR or load the " | |
1286 "TOC plugin."), GAIM_ERROR); | |
1287 else | |
1288 do_error_dialog(_("Protocol not found."), | |
1289 _("You cannot log this account in; you do not have " | |
1290 "the protocol it uses loaded, or the protocol does " | |
1291 "not have a login function."), GAIM_ERROR); | |
960 | 1292 } |
1293 } | |
3754 | 1294 |
1295 static void acct_autologin(GtkCellRendererToggle *cell, gchar *path_str, | |
1296 gpointer d) | |
2007
948a67a691a6
[gaim-migrate @ 2017]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1956
diff
changeset
|
1297 { |
3867 | 1298 GtkTreeModel *model = (GtkTreeModel *)d; |
1299 GtkTreeIter iter; | |
3754 | 1300 |
4491 | 1301 struct gaim_account *account = NULL; |
3754 | 1302 |
1303 gtk_tree_model_get_iter_from_string(model, &iter, path_str); | |
4491 | 1304 gtk_tree_model_get(model, &iter, COLUMN_DATA, &account, -1); |
3754 | 1305 |
4491 | 1306 account->options ^= OPT_ACCT_AUTO; |
3754 | 1307 |
1308 gtk_list_store_set(GTK_LIST_STORE(model), &iter, | |
4491 | 1309 COLUMN_AUTOLOGIN, (account->options & OPT_ACCT_AUTO), -1); |
3754 | 1310 |
1311 save_prefs(); | |
1312 } | |
1313 | |
4491 | 1314 static void do_del_acct(struct gaim_account *account) |
3754 | 1315 { |
1316 GtkTreeIter iter; | |
4770 | 1317 GSList *grps1, *grps, *buds; |
1318 grps1 = grps = gaim_blist_groups(); | |
3754 | 1319 |
4491 | 1320 if (account->gc) { |
1321 account->gc->wants_to_die = TRUE; | |
1322 signoff(account->gc); | |
2007
948a67a691a6
[gaim-migrate @ 2017]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1956
diff
changeset
|
1323 } |
3754 | 1324 |
4491 | 1325 if (get_iter_from_data(GTK_TREE_VIEW(treeview), account, &iter)) { |
3754 | 1326 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); |
1327 } | |
1328 | |
4349 | 1329 |
1330 /* remove the buddies for the account we just destroyed */ | |
4770 | 1331 while(grps1) { |
1332 struct group *g = grps1->data; | |
1333 GSList *buds1, *buds = gaim_blist_members(g); | |
1334 buds1 = buds; | |
1335 grps1 = grps1->next; | |
1336 while(buds1) { | |
1337 struct buddy *b = buds1->data; | |
1338 buds1 = buds1->next; | |
4491 | 1339 if(b->account == account) { |
4770 | 1340 gaim_blist_remove_buddy(b); |
4349 | 1341 } |
1342 } | |
4770 | 1343 g_slist_free(buds); |
1344 if(!((GaimBlistNode*)g)->child) { | |
4687 | 1345 gaim_blist_remove_group(g); |
4349 | 1346 } |
1347 } | |
4770 | 1348 g_slist_free(grps); |
4349 | 1349 |
4491 | 1350 gaim_accounts = g_slist_remove(gaim_accounts, account); |
4349 | 1351 |
1352 gaim_blist_save(); | |
1353 | |
2007
948a67a691a6
[gaim-migrate @ 2017]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1956
diff
changeset
|
1354 save_prefs(); |
948a67a691a6
[gaim-migrate @ 2017]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1956
diff
changeset
|
1355 } |
948a67a691a6
[gaim-migrate @ 2017]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1956
diff
changeset
|
1356 |
3754 | 1357 static void del_acct_func(GtkTreeModel *model, GtkTreePath *path, |
1358 GtkTreeIter *iter, gpointer data) | |
1359 { | |
4491 | 1360 struct gaim_account *account; |
3754 | 1361 |
4491 | 1362 gtk_tree_model_get(model, iter, COLUMN_DATA, &account, -1); |
3754 | 1363 |
4491 | 1364 if (account != NULL) { |
3754 | 1365 char buf[8192]; |
1366 | |
1367 g_snprintf(buf, sizeof(buf), | |
4491 | 1368 _("Are you sure you want to delete %s?"), account->username); |
1369 do_ask_dialog(buf, NULL, account, _("Delete"), do_del_acct, _("Cancel"), NULL, NULL, FALSE); | |
3754 | 1370 } |
1371 } | |
1372 | |
960 | 1373 static void del_acct(GtkWidget *w, gpointer d) |
1374 { | |
3754 | 1375 GtkTreeSelection *selection; |
2008
6f049002d963
[gaim-migrate @ 2018]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
1376 |
3754 | 1377 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview)); |
1378 | |
1379 gtk_tree_selection_selected_foreach(selection, del_acct_func, NULL); | |
2008
6f049002d963
[gaim-migrate @ 2018]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
1380 } |
2007
948a67a691a6
[gaim-migrate @ 2017]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1956
diff
changeset
|
1381 |
960 | 1382 void account_editor(GtkWidget *w, GtkWidget *W) |
1383 { | |
1384 /* please kill me */ | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1172
diff
changeset
|
1385 GtkWidget *vbox; |
960 | 1386 GtkWidget *hbox; |
2008
6f049002d963
[gaim-migrate @ 2018]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
1387 GtkWidget *sw; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1172
diff
changeset
|
1388 GtkWidget *button; /* used for many things */ |
3754 | 1389 GtkWidget *sep; |
1390 GtkSizeGroup *sg; | |
960 | 1391 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1172
diff
changeset
|
1392 if (acctedit) { |
3472 | 1393 gtk_window_present(GTK_WINDOW(acctedit)); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1172
diff
changeset
|
1394 return; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1172
diff
changeset
|
1395 } |
3764 | 1396 |
960 | 1397 acctedit = gtk_window_new(GTK_WINDOW_TOPLEVEL); |
4703 | 1398 gtk_window_set_title(GTK_WINDOW(acctedit), _("Account Editor")); |
4074 | 1399 gtk_window_set_role(GTK_WINDOW(acctedit), "accounteditor"); |
960 | 1400 gtk_widget_realize(acctedit); |
4635 | 1401 gtk_widget_set_size_request(acctedit, -1, 250); |
3755 | 1402 gtk_window_set_default_size(GTK_WINDOW(acctedit), 550, 250); |
4275 | 1403 g_signal_connect(GTK_OBJECT(acctedit), "delete_event", G_CALLBACK(on_delete_acctedit), W); |
960 | 1404 |
3754 | 1405 vbox = gtk_vbox_new(FALSE, 6); |
1406 gtk_container_set_border_width(GTK_CONTAINER(vbox), 6); | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1172
diff
changeset
|
1407 gtk_container_add(GTK_CONTAINER(acctedit), vbox); |
960 | 1408 |
2008
6f049002d963
[gaim-migrate @ 2018]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
1409 sw = generate_list(); |
3754 | 1410 hbox = gtk_hbox_new(FALSE, 6); |
1411 gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, TRUE, 6); | |
1412 | |
4550
972af41f277c
[gaim-migrate @ 4830]
Christian Hammond <chipx86@chipx86.com>
parents:
4493
diff
changeset
|
1413 gtk_box_pack_start(GTK_BOX(hbox), sw, TRUE, TRUE, 0); |
3754 | 1414 |
1415 #if 0 | |
2008
6f049002d963
[gaim-migrate @ 2018]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
1416 vbox2 = gtk_vbox_new(TRUE, 5); |
6f049002d963
[gaim-migrate @ 2018]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
1417 gtk_box_pack_start(GTK_BOX(hbox), vbox2, FALSE, FALSE, 0); |
6f049002d963
[gaim-migrate @ 2018]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
1418 |
3754 | 1419 button = gtk_button_new_from_stock(GTK_STOCK_REFRESH); |
1420 gtk_button_set_use_stock(GTK_BUTTON(button), FALSE); | |
1421 gtk_button_set_label(GTK_BUTTON(button), "Select All"); | |
1422 // button = picture_button2(acctedit, _("Select All"), tb_refresh_xpm, 2); | |
2008
6f049002d963
[gaim-migrate @ 2018]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
1423 gtk_box_pack_start(GTK_BOX(vbox2), button, TRUE, TRUE, 0); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4114
diff
changeset
|
1424 g_signal_connect_swapped(GTK_OBJECT(button), "clicked", |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4114
diff
changeset
|
1425 G_CALLBACK(gtk_clist_select_all), GTK_OBJECT(list)); |
2008
6f049002d963
[gaim-migrate @ 2018]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
1426 |
3754 | 1427 button = gtk_button_new_from_stock(GTK_STOCK_REDO); |
1428 gtk_button_set_use_stock(GTK_BUTTON(button), FALSE); | |
1429 // gtk_button_set_label(button, "Select Autos"); | |
1430 // button = picture_button2(acctedit, _("Select Autos"), tb_redo_xpm, 2); | |
2008
6f049002d963
[gaim-migrate @ 2018]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
1431 gtk_box_pack_start(GTK_BOX(vbox2), button, TRUE, TRUE, 0); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4114
diff
changeset
|
1432 g_signal_connect(GTK_OBJECT(button), "clicked", G_CALLBACK(sel_auto), NULL); |
2008
6f049002d963
[gaim-migrate @ 2018]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
1433 |
3754 | 1434 button = gtk_button_new_from_stock(GTK_STOCK_UNDO); |
1435 gtk_button_set_use_stock(GTK_BUTTON(button), FALSE); | |
1436 gtk_button_set_label(GTK_BUTTON(button), "Select None"); | |
1437 // button = picture_button2(acctedit, _("Select None"), tb_undo_xpm, 2); | |
2008
6f049002d963
[gaim-migrate @ 2018]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
1438 gtk_box_pack_start(GTK_BOX(vbox2), button, TRUE, TRUE, 0); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4114
diff
changeset
|
1439 g_signal_connect_swapped(GTK_OBJECT(button), "clicked", |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4114
diff
changeset
|
1440 G_CALLBACK(gtk_clist_unselect_all), GTK_OBJECT(list)); |
2008
6f049002d963
[gaim-migrate @ 2018]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
1441 |
3754 | 1442 #endif |
960 | 1443 |
3754 | 1444 sep = gtk_hseparator_new(); |
1445 gtk_box_pack_start(GTK_BOX(vbox), sep, FALSE, FALSE, 0); | |
1446 | |
1447 hbox = gtk_hbox_new(FALSE, 6); | |
1448 gtk_container_set_border_width (GTK_CONTAINER (hbox), 6); | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1172
diff
changeset
|
1449 gtk_box_pack_end(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
960 | 1450 |
3754 | 1451 sg = gtk_size_group_new(GTK_SIZE_GROUP_BOTH); |
1452 | |
3885 | 1453 button = gtk_button_new_from_stock(GTK_STOCK_CLOSE); |
3754 | 1454 gtk_size_group_add_widget(sg, button); |
1455 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
4275 | 1456 g_signal_connect(GTK_OBJECT(button), "clicked", G_CALLBACK(on_close_acctedit), W); |
960 | 1457 |
3754 | 1458 button = gtk_button_new_from_stock(GTK_STOCK_DELETE); |
1459 gtk_size_group_add_widget(sg, button); | |
1460 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4114
diff
changeset
|
1461 g_signal_connect(GTK_OBJECT(button), "clicked", G_CALLBACK(del_acct), NULL); |
3754 | 1462 |
4114 | 1463 button = gaim_pixbuf_button_from_stock(_("_Modify"), GTK_STOCK_PREFERENCES, |
3754 | 1464 GAIM_BUTTON_HORIZONTAL); |
1465 gtk_size_group_add_widget(sg, button); | |
1466 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4114
diff
changeset
|
1467 g_signal_connect(GTK_OBJECT(button), "clicked", G_CALLBACK(mod_acct), NULL); |
960 | 1468 |
3754 | 1469 button = gtk_button_new_from_stock(GTK_STOCK_ADD); |
1470 gtk_size_group_add_widget(sg, button); | |
1471 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4114
diff
changeset
|
1472 g_signal_connect(GTK_OBJECT(button), "clicked", G_CALLBACK(add_acct), NULL); |
960 | 1473 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1172
diff
changeset
|
1474 gtk_widget_show_all(acctedit); |
960 | 1475 } |
1476 | |
2402
6e3dc0b3b9b1
[gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2397
diff
changeset
|
1477 struct signon_meter { |
6e3dc0b3b9b1
[gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2397
diff
changeset
|
1478 struct gaim_connection *gc; |
3060 | 1479 GtkWidget *button; |
2402
6e3dc0b3b9b1
[gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2397
diff
changeset
|
1480 GtkWidget *progress; |
6e3dc0b3b9b1
[gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2397
diff
changeset
|
1481 GtkWidget *status; |
6e3dc0b3b9b1
[gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2397
diff
changeset
|
1482 }; |
6e3dc0b3b9b1
[gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2397
diff
changeset
|
1483 static GSList *meters = NULL; |
6e3dc0b3b9b1
[gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2397
diff
changeset
|
1484 |
4687 | 1485 GtkWidget* create_meter_pixmap (struct gaim_connection *gc) |
3060 | 1486 { |
4687 | 1487 GdkPixbuf *pb = create_prpl_icon(gc->account); |
1488 GdkPixbuf *scale = gdk_pixbuf_scale_simple(pb, 30,30,GDK_INTERP_BILINEAR); | |
1489 GtkWidget *image = | |
1490 gtk_image_new_from_pixbuf(scale); | |
1491 g_object_unref(G_OBJECT(pb)); | |
1492 g_object_unref(G_OBJECT(scale)); | |
1493 return image; | |
3060 | 1494 } |
1495 | |
2402
6e3dc0b3b9b1
[gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2397
diff
changeset
|
1496 static struct signon_meter *find_signon_meter(struct gaim_connection *gc) |
6e3dc0b3b9b1
[gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2397
diff
changeset
|
1497 { |
6e3dc0b3b9b1
[gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2397
diff
changeset
|
1498 GSList *m = meters; |
6e3dc0b3b9b1
[gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2397
diff
changeset
|
1499 while (m) { |
6e3dc0b3b9b1
[gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2397
diff
changeset
|
1500 if (((struct signon_meter *)m->data)->gc == gc) |
6e3dc0b3b9b1
[gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2397
diff
changeset
|
1501 return m->data; |
6e3dc0b3b9b1
[gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2397
diff
changeset
|
1502 m = m->next; |
6e3dc0b3b9b1
[gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2397
diff
changeset
|
1503 } |
6e3dc0b3b9b1
[gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2397
diff
changeset
|
1504 return NULL; |
6e3dc0b3b9b1
[gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2397
diff
changeset
|
1505 } |
6e3dc0b3b9b1
[gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2397
diff
changeset
|
1506 |
3060 | 1507 void kill_meter(struct signon_meter *meter) { |
1508 gtk_widget_set_sensitive (meter->button, FALSE); | |
4275 | 1509 gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(meter->progress), 1); |
3060 | 1510 gtk_statusbar_pop(GTK_STATUSBAR(meter->status), 1); |
4169 | 1511 gtk_statusbar_push(GTK_STATUSBAR(meter->status), 1, _("Done.")); |
3060 | 1512 meter_win->active_count--; |
1513 if (meter_win->active_count == 0) { | |
1514 gtk_widget_destroy(meter_win->window); | |
1515 g_free (meter_win); | |
1516 meter_win = NULL; | |
3554 | 1517 } |
3060 | 1518 } |
1519 | |
1089
f0f5c10cce63
[gaim-migrate @ 1099]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1086
diff
changeset
|
1520 void account_online(struct gaim_connection *gc) |
960 | 1521 { |
2402
6e3dc0b3b9b1
[gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2397
diff
changeset
|
1522 struct signon_meter *meter = find_signon_meter(gc); |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1523 GList *wins; |
3754 | 1524 GtkTreeIter iter; |
4770 | 1525 GSList *grps, *grps1, *buds, *buds1; |
4349 | 1526 GList *add_buds=NULL; |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1527 GList *l; |
1002
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
1528 |
4333 | 1529 /* Set the time the account came online */ |
1530 time(&gc->login_time); | |
1531 | |
1002
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
1532 /* first we hide the login progress meter */ |
2402
6e3dc0b3b9b1
[gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2397
diff
changeset
|
1533 if (meter) { |
3060 | 1534 kill_meter(meter); |
2402
6e3dc0b3b9b1
[gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2397
diff
changeset
|
1535 meters = g_slist_remove(meters, meter); |
6e3dc0b3b9b1
[gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2397
diff
changeset
|
1536 g_free(meter); |
6e3dc0b3b9b1
[gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2397
diff
changeset
|
1537 } |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1172
diff
changeset
|
1538 |
1002
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
1539 /* then we do the buddy list stuff */ |
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
1540 if (mainwindow) |
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
1541 gtk_widget_hide(mainwindow); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1172
diff
changeset
|
1542 |
4687 | 1543 gaim_blist_show(); |
1002
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
1544 |
3367 | 1545 update_privacy_connections(); |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1391
diff
changeset
|
1546 do_away_menu(); |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1474
diff
changeset
|
1547 do_proto_menu(); |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1548 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1549 /* |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1550 * XXX This is a hack! Remove this and replace it with a better event |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1551 * notification system. |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1552 */ |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1553 for (wins = gaim_get_windows(); wins != NULL; wins = wins->next) { |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1554 struct gaim_window *win = (struct gaim_window *)wins->data; |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1555 gaim_conversation_update(gaim_window_get_conversation_at(win, 0), |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1556 GAIM_CONV_ACCOUNT_ONLINE); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1557 } |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1558 |
1002
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
1559 gaim_setup(gc); |
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
1560 |
4491 | 1561 gc->account->connecting = FALSE; |
3726 | 1562 connecting_count--; |
3570 | 1563 debug_printf("connecting_count: %d\n", connecting_count); |
1564 | |
3517 | 1565 plugin_event(event_signon, gc); |
1575
427e1409917c
[gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
1566 system_log(log_signon, gc, NULL, OPT_LOG_BUDDY_SIGNON | OPT_LOG_MY_SIGNON); |
1002
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
1567 |
1254
9da444224f0e
[gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1568 /* away option given? */ |
9da444224f0e
[gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1569 if (opt_away) { |
9da444224f0e
[gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1570 away_on_login(opt_away_arg); |
9da444224f0e
[gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1571 /* don't do it again */ |
9da444224f0e
[gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1572 opt_away = 0; |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1391
diff
changeset
|
1573 } else if (awaymessage) { |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1391
diff
changeset
|
1574 serv_set_away(gc, GAIM_AWAY_CUSTOM, awaymessage->message); |
1254
9da444224f0e
[gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1575 } |
9da444224f0e
[gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1576 if (opt_away_arg != NULL) { |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2364
diff
changeset
|
1577 g_free(opt_away_arg); |
1254
9da444224f0e
[gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1578 opt_away_arg = NULL; |
9da444224f0e
[gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1579 } |
9da444224f0e
[gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1580 |
4349 | 1581 /* let the prpl know what buddies we pulled out of the local list */ |
4770 | 1582 grps = gaim_blist_groups(); |
1583 for(grps1 = grps; grps1; grps1 = grps1->next) { | |
1584 struct group *g = grps1->data; | |
1585 buds = gaim_blist_members(g); | |
1586 for(buds1 = buds; buds1; buds1 = buds1->next) { | |
1587 struct buddy *b = buds1->data; | |
4491 | 1588 if(b->account == gc->account) { |
4349 | 1589 add_buds = g_list_append(add_buds, b->name); |
1590 } | |
1591 } | |
4770 | 1592 g_slist_free(buds); |
4349 | 1593 } |
4770 | 1594 g_slist_free(grps); |
4349 | 1595 |
1596 if(add_buds) { | |
1597 serv_add_buddies(gc, add_buds); | |
1598 g_list_free(add_buds); | |
1599 } | |
1600 | |
1601 serv_set_permit_deny(gc); | |
1602 | |
1002
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
1603 /* everything for the account editor */ |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1172
diff
changeset
|
1604 if (!acctedit) |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1172
diff
changeset
|
1605 return; |
3754 | 1606 |
4491 | 1607 if (get_iter_from_data(GTK_TREE_VIEW(treeview), gc->account, &iter)) { |
3754 | 1608 gtk_list_store_set(model, &iter, |
1609 COLUMN_ONLINE, TRUE, | |
1610 COLUMN_PROTOCOL, gc->prpl->name, | |
1611 -1); | |
1612 } | |
1002
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
1613 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1614 /* Update the conversation windows that use this account. */ |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1615 for (l = gaim_get_conversations(); l != NULL; l = l->next) { |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1616 struct gaim_conversation *conv = (struct gaim_conversation *)l->data; |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1617 |
4491 | 1618 if (gaim_conversation_get_account(conv) == gc->account) { |
1619 gaim_conversation_update(conv, GAIM_CONV_UPDATE_ACCOUNT); | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1620 } |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1621 } |
960 | 1622 } |
1623 | |
1624 void account_offline(struct gaim_connection *gc) | |
1625 { | |
2402
6e3dc0b3b9b1
[gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2397
diff
changeset
|
1626 struct signon_meter *meter = find_signon_meter(gc); |
3754 | 1627 GtkTreeIter iter; |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1628 GList *l; |
3754 | 1629 |
2402
6e3dc0b3b9b1
[gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2397
diff
changeset
|
1630 if (meter) { |
3060 | 1631 kill_meter(meter); |
2402
6e3dc0b3b9b1
[gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2397
diff
changeset
|
1632 meters = g_slist_remove(meters, meter); |
6e3dc0b3b9b1
[gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2397
diff
changeset
|
1633 g_free(meter); |
6e3dc0b3b9b1
[gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2397
diff
changeset
|
1634 } |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1635 debug_printf("Disconnecting. user = %p, gc = %p (%p)\n", |
4491 | 1636 gc->account, gc->account->gc, gc); |
1637 gc->account->gc = NULL; /* wasn't that awkward? */ | |
4388 | 1638 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1172
diff
changeset
|
1639 if (!acctedit) |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1172
diff
changeset
|
1640 return; |
3754 | 1641 |
4491 | 1642 if (get_iter_from_data(GTK_TREE_VIEW(treeview), gc->account, &iter)) { |
3754 | 1643 gtk_list_store_set(model, &iter, COLUMN_ONLINE, FALSE, -1); |
1644 } | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1645 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1646 /* Update the conversation windows that use this account. */ |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1647 for (l = gaim_get_conversations(); l != NULL; l = l->next) { |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1648 struct gaim_conversation *conv = (struct gaim_conversation *)l->data; |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1649 |
4491 | 1650 if (gaim_conversation_get_account(conv) == gc->account) { |
1651 gaim_conversation_update(conv, GAIM_CONV_UPDATE_ACCOUNT); | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1652 } |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1653 } |
960 | 1654 } |
1655 | |
1656 void auto_login() | |
1657 { | |
4491 | 1658 GSList *accts = gaim_accounts; |
1659 struct gaim_account *a = NULL; | |
960 | 1660 |
4491 | 1661 while (accts) { |
1662 a = (struct gaim_account *)accts->data; | |
1663 if ((a->options & OPT_ACCT_AUTO) && (a->options & OPT_ACCT_REM_PASS)) { | |
980
82c5865f7cfe
[gaim-migrate @ 990]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
977
diff
changeset
|
1664 serv_login(a); |
960 | 1665 } |
4491 | 1666 accts = accts->next; |
960 | 1667 } |
1668 } | |
988
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
1669 |
3458 | 1670 /* |
1671 * d:)->-< | |
1672 * | |
1673 * d:O-\-< | |
1674 * | |
1675 * d:D-/-< | |
1676 * | |
1677 * d8D->-< DANCE! | |
1678 */ | |
1679 | |
2402
6e3dc0b3b9b1
[gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2397
diff
changeset
|
1680 static void cancel_signon(GtkWidget *button, struct signon_meter *meter) |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1172
diff
changeset
|
1681 { |
2402
6e3dc0b3b9b1
[gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2397
diff
changeset
|
1682 meter->gc->wants_to_die = TRUE; |
6e3dc0b3b9b1
[gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2397
diff
changeset
|
1683 signoff(meter->gc); |
1089
f0f5c10cce63
[gaim-migrate @ 1099]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1086
diff
changeset
|
1684 } |
f0f5c10cce63
[gaim-migrate @ 1099]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1086
diff
changeset
|
1685 |
2402
6e3dc0b3b9b1
[gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2397
diff
changeset
|
1686 static gint meter_destroy(GtkWidget *window, GdkEvent *evt, struct signon_meter *meter) |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1172
diff
changeset
|
1687 { |
1089
f0f5c10cce63
[gaim-migrate @ 1099]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1086
diff
changeset
|
1688 return TRUE; |
988
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
1689 } |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
1690 |
3060 | 1691 static struct signon_meter *register_meter(struct gaim_connection *gc, GtkWidget *widget, GtkTable *table, gint *rows) |
1692 { | |
1693 GtkWidget *graphic; | |
3378 | 1694 GtkWidget *label; |
3060 | 1695 GtkWidget *nest_vbox; |
1696 GString *name_to_print; | |
1697 struct signon_meter *meter; | |
4491 | 1698 |
3060 | 1699 name_to_print = g_string_new(gc->username); |
4491 | 1700 |
3060 | 1701 meter = g_new0(struct signon_meter, 1); |
4491 | 1702 |
3060 | 1703 (*rows)++; |
1704 gtk_table_resize (table, *rows, 4); | |
4491 | 1705 |
4687 | 1706 graphic = create_meter_pixmap(gc); |
4491 | 1707 |
3060 | 1708 nest_vbox = gtk_vbox_new (FALSE, 0); |
4491 | 1709 |
4225 | 1710 g_string_prepend(name_to_print, _("Signon: ")); |
3378 | 1711 label = gtk_label_new (name_to_print->str); |
4225 | 1712 g_string_free(name_to_print, TRUE); |
3378 | 1713 gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5); |
4491 | 1714 |
3060 | 1715 meter->status = gtk_statusbar_new(); |
4639 | 1716 gtk_widget_set_size_request(meter->status, 250, -1); |
4491 | 1717 |
3060 | 1718 meter->progress = gtk_progress_bar_new (); |
4491 | 1719 |
4114 | 1720 meter->button = gtk_button_new_with_label (_("Cancel")); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4114
diff
changeset
|
1721 g_signal_connect (GTK_OBJECT (meter->button), "clicked", G_CALLBACK (cancel_signon), meter); |
4491 | 1722 |
3060 | 1723 gtk_table_attach (GTK_TABLE (table), graphic, 0, 1, *rows, *rows+1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); |
1724 gtk_table_attach (GTK_TABLE (table), nest_vbox, 1, 2, *rows, *rows+1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); | |
3378 | 1725 gtk_box_pack_start (GTK_BOX (nest_vbox), GTK_WIDGET (label), FALSE, FALSE, 0); |
3060 | 1726 gtk_box_pack_start (GTK_BOX (nest_vbox), GTK_WIDGET (meter->status), FALSE, FALSE, 0); |
1727 gtk_table_attach (GTK_TABLE (table), meter->progress, 2, 3, *rows, *rows+1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); | |
1728 gtk_table_attach (GTK_TABLE (table), meter->button, 3, 4, *rows, *rows+1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); | |
1729 | |
1730 gtk_widget_show_all (GTK_WIDGET (meter_win->window)); | |
4491 | 1731 |
3060 | 1732 meter_win->active_count++; |
4491 | 1733 |
3060 | 1734 return meter; |
1735 } | |
1736 | |
1737 static void loop_cancel () { | |
1738 GSList *m = meters; | |
1739 struct signon_meter *meter = NULL; | |
1740 | |
1741 while (m) { | |
1742 meter = (struct signon_meter *) (m->data); | |
1743 meter->gc->wants_to_die = TRUE; | |
1744 signoff((struct gaim_connection *) meter->gc); | |
1745 m = meters; | |
1746 } | |
1747 } | |
1748 | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1172
diff
changeset
|
1749 void set_login_progress(struct gaim_connection *gc, float howfar, char *message) |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1172
diff
changeset
|
1750 { |
2402
6e3dc0b3b9b1
[gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2397
diff
changeset
|
1751 struct signon_meter *meter = find_signon_meter(gc); |
6e3dc0b3b9b1
[gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2397
diff
changeset
|
1752 |
988
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
1753 if (mainwindow) |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
1754 gtk_widget_hide(mainwindow); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
1755 |
3060 | 1756 if (!meter_win) { |
1757 GtkWidget *cancel_button; | |
1758 GtkWidget *vbox; | |
4635 | 1759 |
3060 | 1760 meter_win = g_new0(struct meter_window, 1); |
1761 meter_win->rows=0; | |
4635 | 1762 |
3060 | 1763 meter_win->window = gtk_window_new (GTK_WINDOW_TOPLEVEL); |
1764 GAIM_DIALOG(meter_win->window); | |
4635 | 1765 gtk_window_set_resizable(GTK_WINDOW(meter_win->window), FALSE); |
4074 | 1766 gtk_window_set_role(GTK_WINDOW(meter_win->window), "signon"); |
3060 | 1767 gtk_container_set_border_width(GTK_CONTAINER(meter_win->window), 5); |
4703 | 1768 gtk_window_set_title (GTK_WINDOW (meter_win->window), _("Signon")); |
3060 | 1769 gtk_widget_realize(meter_win->window); |
4635 | 1770 |
3060 | 1771 vbox = gtk_vbox_new (FALSE, 0); |
1772 gtk_container_add (GTK_CONTAINER (meter_win->window), GTK_WIDGET (vbox)); | |
1773 | |
1774 meter_win->table = (GtkTable *) gtk_table_new (1 , 4, FALSE); | |
1775 gtk_box_pack_start (GTK_BOX (vbox), GTK_WIDGET (meter_win->table), FALSE, FALSE, 0); | |
1776 gtk_container_set_border_width (GTK_CONTAINER (meter_win->table), 5); | |
1777 gtk_table_set_row_spacings (GTK_TABLE (meter_win->table), 5); | |
1778 gtk_table_set_col_spacings (GTK_TABLE (meter_win->table), 10); | |
1779 | |
4114 | 1780 cancel_button = gtk_button_new_with_label (_("Cancel All")); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4114
diff
changeset
|
1781 g_signal_connect_swapped (GTK_OBJECT (cancel_button), "clicked", G_CALLBACK (loop_cancel), NULL); |
3060 | 1782 gtk_box_pack_start (GTK_BOX (vbox), GTK_WIDGET (cancel_button), FALSE, FALSE, 0); |
1783 | |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4114
diff
changeset
|
1784 g_signal_connect (GTK_OBJECT (meter_win->window), "delete_event", G_CALLBACK (meter_destroy), NULL); |
3060 | 1785 } |
1786 | |
2402
6e3dc0b3b9b1
[gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2397
diff
changeset
|
1787 if (!meter) { |
988
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
1788 char buf[256]; |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
1789 |
3060 | 1790 meter = register_meter(gc, GTK_WIDGET (meter_win->window), GTK_TABLE (meter_win->table), (gint *) &meter_win->rows); |
2402
6e3dc0b3b9b1
[gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2397
diff
changeset
|
1791 meter->gc = gc; |
2403
8555e48c02df
[gaim-migrate @ 2416]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2402
diff
changeset
|
1792 meters = g_slist_append(meters, meter); |
2402
6e3dc0b3b9b1
[gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2397
diff
changeset
|
1793 |
3572 | 1794 g_snprintf(buf, sizeof(buf), "%s Signing On (using %s)", gc->username, gc->prpl->name); |
988
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
1795 } |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
1796 |
4275 | 1797 gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(meter->progress), howfar / LOGIN_STEPS); |
2402
6e3dc0b3b9b1
[gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2397
diff
changeset
|
1798 gtk_statusbar_pop(GTK_STATUSBAR(meter->status), 1); |
6e3dc0b3b9b1
[gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2397
diff
changeset
|
1799 gtk_statusbar_push(GTK_STATUSBAR(meter->status), 1, message); |
988
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
1800 } |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
1801 |
2442
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
1802 struct kick_dlg { |
4491 | 1803 struct gaim_account *account; |
2442
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
1804 GtkWidget *dlg; |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
1805 }; |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
1806 static GSList *kicks = NULL; |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
1807 |
4491 | 1808 static struct kick_dlg *find_kick_dlg(struct gaim_account *account) |
1817
b367beee6448
[gaim-migrate @ 1827]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1772
diff
changeset
|
1809 { |
2442
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
1810 GSList *k = kicks; |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
1811 while (k) { |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
1812 struct kick_dlg *d = k->data; |
4491 | 1813 if (d->account == account) |
2442
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
1814 return d; |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
1815 k = k->next; |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
1816 } |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
1817 return NULL; |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
1818 } |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
1819 |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
1820 static void set_kick_null(GtkObject *obj, struct kick_dlg *k) |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
1821 { |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
1822 kicks = g_slist_remove(kicks, k); |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
1823 g_free(k); |
1817
b367beee6448
[gaim-migrate @ 1827]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1772
diff
changeset
|
1824 } |
b367beee6448
[gaim-migrate @ 1827]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1772
diff
changeset
|
1825 |
2956 | 1826 /* |
1827 * Common code for hide_login_progress(), and hide_login_progress_info() | |
1828 */ | |
1829 static void hide_login_progress_common(struct gaim_connection *gc, | |
1830 char *details, | |
1831 char *title, | |
1832 char *prologue) | |
988
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
1833 { |
4617 | 1834 gchar *buf; |
4491 | 1835 struct kick_dlg *k = find_kick_dlg(gc->account); |
2402
6e3dc0b3b9b1
[gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2397
diff
changeset
|
1836 struct signon_meter *meter = find_signon_meter(gc); |
4617 | 1837 buf = g_strdup_printf(_("%s\n%s: %s"), full_date(), prologue, details); |
2442
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
1838 if (k) |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
1839 gtk_widget_destroy(k->dlg); |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
1840 k = g_new0(struct kick_dlg, 1); |
4491 | 1841 k->account = gc->account; |
3427 | 1842 k->dlg = do_error_dialog(title, buf, GAIM_ERROR); |
2709
df0832a9ccec
[gaim-migrate @ 2722]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2707
diff
changeset
|
1843 kicks = g_slist_append(kicks, k); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4114
diff
changeset
|
1844 g_signal_connect(GTK_OBJECT(k->dlg), "destroy", G_CALLBACK(set_kick_null), k); |
2402
6e3dc0b3b9b1
[gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2397
diff
changeset
|
1845 if (meter) { |
3060 | 1846 kill_meter(meter); |
2402
6e3dc0b3b9b1
[gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2397
diff
changeset
|
1847 meters = g_slist_remove(meters, meter); |
6e3dc0b3b9b1
[gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2397
diff
changeset
|
1848 g_free(meter); |
6e3dc0b3b9b1
[gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2397
diff
changeset
|
1849 } |
4617 | 1850 g_free(buf); |
988
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
1851 } |
1355
04874e92af24
[gaim-migrate @ 1365]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1261
diff
changeset
|
1852 |
2956 | 1853 void hide_login_progress(struct gaim_connection *gc, char *why) |
1854 { | |
4617 | 1855 gchar *buf; |
2956 | 1856 |
4617 | 1857 plugin_event(event_error, gc, why); |
1858 buf = g_strdup_printf(_("%s was unable to sign on"), gc->username); | |
2956 | 1859 hide_login_progress_common(gc, why, _("Signon Error"), buf); |
4617 | 1860 g_free(buf); |
2956 | 1861 } |
1862 | |
1863 /* | |
1864 * Like hide_login_progress(), but for informational, not error/warning, | |
1865 * messages. | |
1866 * | |
1867 */ | |
1868 void hide_login_progress_notice(struct gaim_connection *gc, char *why) | |
1869 { | |
1870 hide_login_progress_common(gc, why, _("Notice"), gc->username); | |
1871 } | |
1872 | |
3074 | 1873 /* |
1874 * Like hide_login_progress(), but for non-signon error messages. | |
1875 * | |
1876 */ | |
1877 void hide_login_progress_error(struct gaim_connection *gc, char *why) | |
1878 { | |
1879 char buf[2048]; | |
4617 | 1880 |
1881 plugin_event(event_error, gc, why); | |
3074 | 1882 g_snprintf(buf, sizeof(buf), _("%s has been signed off"), gc->username); |
1883 hide_login_progress_common(gc, why, _("Connection Error"), buf); | |
1884 } | |
1885 | |
2559
e49ab50736bf
[gaim-migrate @ 2572]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2525
diff
changeset
|
1886 void signoff_all() |
2380
6f83c22d9e70
[gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
1887 { |
6f83c22d9e70
[gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
1888 GSList *c = connections; |
6f83c22d9e70
[gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
1889 struct gaim_connection *g = NULL; |
6f83c22d9e70
[gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
1890 |
6f83c22d9e70
[gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
1891 while (c) { |
6f83c22d9e70
[gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
1892 g = (struct gaim_connection *)c->data; |
6f83c22d9e70
[gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
1893 g->wants_to_die = TRUE; |
6f83c22d9e70
[gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
1894 signoff(g); |
6f83c22d9e70
[gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
1895 c = connections; |
6f83c22d9e70
[gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
1896 } |
6f83c22d9e70
[gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
1897 } |
6f83c22d9e70
[gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
1898 |
6f83c22d9e70
[gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
1899 void signoff(struct gaim_connection *gc) |
6f83c22d9e70
[gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
1900 { |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1901 GList *wins; |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1902 |
3510 | 1903 /* UI stuff */ |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1904 /* CONV XXX |
3510 | 1905 convo_menu_remove(gc); |
1906 remove_icon_data(gc); | |
4687 | 1907 */ |
1908 | |
1909 gaim_blist_remove_account(gc->account); | |
3510 | 1910 |
2380
6f83c22d9e70
[gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
1911 /* core stuff */ |
3510 | 1912 /* remove this here so plugins get a sensible count of connections */ |
1913 connections = g_slist_remove(connections, gc); | |
2380
6f83c22d9e70
[gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
1914 debug_printf("date: %s\n", full_date()); |
3517 | 1915 plugin_event(event_signoff, gc); |
2380
6f83c22d9e70
[gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
1916 system_log(log_signoff, gc, NULL, OPT_LOG_BUDDY_SIGNON | OPT_LOG_MY_SIGNON); |
3510 | 1917 /* set this in case the plugin died before really connecting. |
1918 do it after calling the plugins so they can determine if | |
1919 this user was ever on-line or not */ | |
4491 | 1920 if (gc->account->connecting) { |
1921 gc->account->connecting = FALSE; | |
3726 | 1922 connecting_count--; |
3517 | 1923 } |
3570 | 1924 debug_printf("connecting_count: %d\n", connecting_count); |
3510 | 1925 serv_close(gc); |
2380
6f83c22d9e70
[gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
1926 |
3510 | 1927 /* more UI stuff */ |
2380
6f83c22d9e70
[gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
1928 do_away_menu(); |
6f83c22d9e70
[gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
1929 do_proto_menu(); |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1930 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1931 /* |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1932 * XXX This is a hack! Remove this and replace it with a better event |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1933 * notification system. |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1934 */ |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1935 for (wins = gaim_get_windows(); wins != NULL; wins = wins->next) { |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1936 struct gaim_window *win = (struct gaim_window *)wins->data; |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1937 gaim_conversation_update(gaim_window_get_conversation_at(win, 0), |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1938 GAIM_CONV_ACCOUNT_OFFLINE); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1939 } |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1940 |
3367 | 1941 update_privacy_connections(); |
2380
6f83c22d9e70
[gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
1942 |
3510 | 1943 /* in, out, shake it all about */ |
2380
6f83c22d9e70
[gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
1944 if (connections) |
6f83c22d9e70
[gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
1945 return; |
6f83c22d9e70
[gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
1946 |
6f83c22d9e70
[gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
1947 destroy_all_dialogs(); |
4687 | 1948 gaim_blist_destroy(); |
3472 | 1949 |
2380
6f83c22d9e70
[gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
1950 show_login(); |
6f83c22d9e70
[gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
1951 } |
6f83c22d9e70
[gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
1952 |
4491 | 1953 struct gaim_account *gaim_account_new(const char *name, int proto, int opts) |
1355
04874e92af24
[gaim-migrate @ 1365]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1261
diff
changeset
|
1954 { |
4491 | 1955 struct gaim_account *account = g_new0(struct gaim_account, 1); |
1956 g_snprintf(account->username, sizeof(account->username), "%s", name); | |
1957 g_snprintf(account->user_info, sizeof(account->user_info), "%s", DEFAULT_INFO); | |
1958 account->protocol = proto; | |
1959 account->options = opts; | |
1960 account->permit = NULL; | |
1961 account->deny = NULL; | |
1962 gaim_accounts = g_slist_append(gaim_accounts, account); | |
1355
04874e92af24
[gaim-migrate @ 1365]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1261
diff
changeset
|
1963 |
3754 | 1964 if (treeview) { |
1965 GtkTreeIter iter; | |
1966 | |
1967 gtk_list_store_append(model, &iter); | |
1968 gtk_list_store_set(model, &iter, | |
4491 | 1969 COLUMN_SCREENNAME, account->username, |
1970 COLUMN_ONLINE, (account->gc ? TRUE : FALSE), | |
1971 COLUMN_AUTOLOGIN, (account->options & OPT_ACCT_AUTO), | |
1972 COLUMN_PROTOCOL, proto_name(account->protocol), | |
1973 COLUMN_DATA, account, | |
3754 | 1974 -1); |
1355
04874e92af24
[gaim-migrate @ 1365]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1261
diff
changeset
|
1975 } |
04874e92af24
[gaim-migrate @ 1365]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1261
diff
changeset
|
1976 |
4491 | 1977 return account; |
1355
04874e92af24
[gaim-migrate @ 1365]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1261
diff
changeset
|
1978 } |