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