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