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