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