Mercurial > pidgin
annotate src/multi.c @ 1051:713b0e14e0a9
[gaim-migrate @ 1061]
user_info only in aim_user (saves 2k per connection); mem leak fixes in dialogs.c and multi.c; and proto_opt in aim_user (so prpls can have their own saved information per user). no way to draw protocol option selection window thingy yet, so prpls will either have to do that on their own or something. i don't know. we'll figure it out.
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Thu, 02 Nov 2000 22:29:51 +0000 |
parents | 38452403563b |
children | bde34730789c |
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 | |
22 #include <gtk/gtk.h> | |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
23 #include "prpl.h" |
960 | 24 #include "multi.h" |
25 #include "gaim.h" | |
966
f7886476f9d9
[gaim-migrate @ 976]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
960
diff
changeset
|
26 #include "gnome_applet_mgr.h" |
960 | 27 #include "aim.h" |
28 | |
29 #include "pixmaps/gnome_add.xpm" | |
30 #include "pixmaps/gnome_preferences.xpm" | |
31 #include "pixmaps/join.xpm" | |
32 #include "pixmaps/gnome_remove.xpm" | |
33 #include "pixmaps/gnome_close.xpm" | |
34 #include "pixmaps/cancel.xpm" | |
35 #include "pixmaps/ok.xpm" | |
36 | |
37 GSList *connections; | |
38 | |
39 static GtkWidget *acctedit = NULL; | |
40 static GtkWidget *list = NULL; /* the clist of names in the accteditor */ | |
41 static GtkWidget *newmod = NULL; /* the dialog for creating a new account */ | |
42 static struct aim_user tmpusr; | |
43 | |
44 struct mod_usr_opt { | |
45 struct aim_user *user; | |
46 int opt; | |
47 }; | |
48 | |
49 struct gaim_connection *new_gaim_conn(int proto, char *username, char *password) | |
50 { | |
51 struct gaim_connection *gc = g_new0(struct gaim_connection, 1); | |
52 gc->protocol = proto; | |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
53 gc->prpl = find_prpl(proto); |
960 | 54 g_snprintf(gc->username, sizeof(gc->username), "%s", username); |
55 g_snprintf(gc->password, sizeof(gc->password), "%s", password); | |
56 gc->keepalive = -1; | |
998
70c685de2be5
[gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
993
diff
changeset
|
57 gc->inpa = -1; |
70c685de2be5
[gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
993
diff
changeset
|
58 gc->buddy_chats = NULL; |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1009
diff
changeset
|
59 gc->groups = NULL; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1009
diff
changeset
|
60 gc->permit = NULL; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1009
diff
changeset
|
61 gc->deny = NULL; |
960 | 62 |
63 connections = g_slist_append(connections, gc); | |
64 | |
65 return gc; | |
66 } | |
67 | |
68 void destroy_gaim_conn(struct gaim_connection *gc) | |
69 { | |
70 connections = g_slist_remove(connections, gc); | |
71 g_free(gc); | |
72 redo_convo_menus(); | |
988
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
73 if (!connections && mainwindow) |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
74 gtk_widget_show(mainwindow); |
960 | 75 } |
76 | |
77 struct gaim_connection *find_gaim_conn_by_name(char *name) { | |
78 char *who = g_strdup(normalize(name)); | |
79 GSList *c = connections; | |
80 struct gaim_connection *g = NULL; | |
81 | |
82 while (c) { | |
83 g = (struct gaim_connection *)c->data; | |
84 if (!strcmp(normalize(g->username), who)) { | |
85 g_free(who); | |
86 return g; | |
87 } | |
88 c = c->next; | |
89 } | |
90 | |
91 g_free(who); | |
92 return NULL; | |
93 } | |
94 | |
95 static void delete_acctedit(GtkWidget *w, gpointer d) | |
96 { | |
97 if (acctedit) { | |
98 save_prefs(); | |
99 gtk_widget_destroy(acctedit); | |
100 } | |
101 acctedit = NULL; | |
1009
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1005
diff
changeset
|
102 if (d == NULL && blist == NULL) |
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1005
diff
changeset
|
103 exit(0); |
960 | 104 } |
105 | |
106 static gint acctedit_close(GtkWidget *w, gpointer d) | |
107 { | |
108 gtk_widget_destroy(acctedit); | |
1009
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1005
diff
changeset
|
109 if (d == NULL && blist == NULL) |
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1005
diff
changeset
|
110 exit(0); |
960 | 111 return FALSE; |
112 } | |
113 | |
114 static char *proto_name(int proto) | |
115 { | |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
116 struct prpl *p = find_prpl(proto); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
117 if (p && p->name) |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
118 return (*p->name)(); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
119 else |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
120 return "Unknown"; |
960 | 121 } |
122 | |
123 static GtkWidget *generate_list() | |
124 { | |
125 GtkWidget *win; | |
126 char *titles[4] = {"Screenname", "Currently Online", "Auto-login", "Protocol"}; | |
127 GList *u = aim_users; | |
128 struct aim_user *a; | |
129 int i; | |
130 | |
131 win = gtk_scrolled_window_new(0, 0); | |
132 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(win), GTK_POLICY_AUTOMATIC, | |
133 GTK_POLICY_ALWAYS); | |
134 | |
135 list = gtk_clist_new_with_titles(4, titles); | |
136 gtk_clist_set_column_width(GTK_CLIST(list), 0, 90); | |
137 gtk_clist_set_selection_mode(GTK_CLIST(list), GTK_SELECTION_BROWSE); | |
138 gtk_clist_column_titles_passive(GTK_CLIST(list)); | |
139 gtk_container_add(GTK_CONTAINER(win), list); | |
140 gtk_widget_show(list); | |
141 | |
142 while (u) { | |
143 a = (struct aim_user *)u->data; | |
144 titles[0] = a->username; | |
977
e5eac6b236f1
[gaim-migrate @ 987]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
969
diff
changeset
|
145 titles[1] = find_gaim_conn_by_name(a->username) ? "Yes" : "No"; |
960 | 146 titles[2] = (a->options & OPT_USR_AUTO) ? "True" : "False"; |
147 titles[3] = proto_name(a->protocol); | |
148 i = gtk_clist_append(GTK_CLIST(list), titles); | |
149 gtk_clist_set_row_data(GTK_CLIST(list), i, a); | |
150 u = u->next; | |
151 } | |
152 | |
153 gtk_widget_show(win); | |
154 return win; | |
155 } | |
156 | |
157 static void delmod(GtkWidget *w, struct aim_user *u) | |
158 { | |
159 gtk_widget_destroy(w); | |
160 if (u) { | |
161 u->mod = NULL; | |
162 } else { | |
163 newmod = NULL; | |
164 } | |
165 } | |
166 | |
167 static void mod_opt(GtkWidget *b, struct mod_usr_opt *m) | |
168 { | |
169 if (m->user) { | |
170 m->user->tmp_options = m->user->tmp_options ^ m->opt; | |
171 } else { | |
172 tmpusr.options = tmpusr.options ^ m->opt; | |
173 } | |
174 } | |
175 | |
1051
713b0e14e0a9
[gaim-migrate @ 1061]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
176 static void free_muo(GtkWidget *b, struct mod_usr_opt *m) { |
713b0e14e0a9
[gaim-migrate @ 1061]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
177 g_free(m); |
713b0e14e0a9
[gaim-migrate @ 1061]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
178 } |
713b0e14e0a9
[gaim-migrate @ 1061]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
179 |
960 | 180 static GtkWidget *acct_button(const char *text, struct aim_user *u, int option, GtkWidget *box) |
181 { | |
182 GtkWidget *button; | |
183 struct mod_usr_opt *muo = g_new0(struct mod_usr_opt, 1); | |
184 button = gtk_check_button_new_with_label(text); | |
185 if (u) { | |
186 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(button), (u->options & option)); | |
187 } else { | |
188 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(button), (tmpusr.options & option)); | |
189 } | |
190 gtk_box_pack_start(GTK_BOX(box), button, FALSE, FALSE, 0); | |
191 muo->user = u; muo->opt = option; | |
192 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(mod_opt), muo); | |
1051
713b0e14e0a9
[gaim-migrate @ 1061]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
193 gtk_signal_connect(GTK_OBJECT(button), "destroy", GTK_SIGNAL_FUNC(free_muo), muo); |
960 | 194 gtk_widget_show(button); |
195 return button; | |
196 } | |
197 | |
198 static void ok_mod(GtkWidget *w, struct aim_user *u) | |
199 { | |
200 char *txt; | |
201 int i; | |
202 if (u) { | |
203 u->options = u->tmp_options; | |
204 u->protocol = u->tmp_protocol; | |
205 txt = gtk_entry_get_text(GTK_ENTRY(u->pass)); | |
206 if (u->options & OPT_USR_REM_PASS) | |
207 g_snprintf(u->password, sizeof(u->password), "%s", txt); | |
208 else | |
209 u->password[0] = '\0'; | |
210 gtk_widget_destroy(u->mod); | |
211 i = gtk_clist_find_row_from_data(GTK_CLIST(list), u); | |
212 gtk_clist_set_text(GTK_CLIST(list), i, 2, (u->options & OPT_USR_AUTO) ? "True" : "False"); | |
213 gtk_clist_set_text(GTK_CLIST(list), i, 3, proto_name(u->protocol)); | |
214 } else { | |
215 char *titles[4]; | |
216 txt = gtk_entry_get_text(GTK_ENTRY(tmpusr.name)); | |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1009
diff
changeset
|
217 if (find_user(txt, tmpusr.protocol)) { |
960 | 218 gtk_widget_destroy(newmod); |
219 return; | |
220 } | |
221 u = g_new0(struct aim_user, 1); | |
222 g_snprintf(u->username, sizeof(u->username), "%s", txt); | |
223 txt = gtk_entry_get_text(GTK_ENTRY(tmpusr.pass)); | |
224 g_snprintf(u->password, sizeof(u->password), "%s", txt); | |
225 u->options = tmpusr.options; | |
226 u->protocol = tmpusr.protocol; | |
227 gtk_widget_destroy(newmod); | |
228 titles[0] = u->username; | |
977
e5eac6b236f1
[gaim-migrate @ 987]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
969
diff
changeset
|
229 titles[1] = find_gaim_conn_by_name(u->username) ? "Yes" : "No"; |
960 | 230 titles[2] = (u->options & OPT_USR_AUTO) ? "True" : "False"; |
231 titles[3] = proto_name(u->protocol); | |
232 i = gtk_clist_append(GTK_CLIST(list), titles); | |
233 gtk_clist_set_row_data(GTK_CLIST(list), i, u); | |
984
7ec6b092f227
[gaim-migrate @ 994]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
982
diff
changeset
|
234 aim_users = g_list_append(aim_users, u); |
960 | 235 } |
236 save_prefs(); | |
237 } | |
238 | |
239 static void cancel_mod(GtkWidget *w, struct aim_user *u) | |
240 { | |
241 if (u) { | |
242 gtk_widget_destroy(u->mod); | |
243 } else { | |
244 gtk_widget_destroy(newmod); | |
245 } | |
246 } | |
247 | |
248 static void set_prot(GtkWidget *opt, int proto) | |
249 { | |
250 struct aim_user *u = gtk_object_get_user_data(GTK_OBJECT(opt)); | |
251 if (u) { | |
252 u->tmp_protocol = proto; | |
253 } else { | |
254 tmpusr.protocol = proto; | |
255 } | |
256 } | |
257 | |
258 static GtkWidget *make_protocol_menu(GtkWidget *box, struct aim_user *u) | |
259 { | |
260 GtkWidget *optmenu; | |
261 GtkWidget *menu; | |
262 GtkWidget *opt; | |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
263 GSList *p = protocols; |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
264 struct prpl *e; |
960 | 265 |
266 /* PRPL: should we set some way to update these when new protocols get added? */ | |
267 optmenu = gtk_option_menu_new(); | |
268 gtk_box_pack_start(GTK_BOX(box), optmenu, FALSE, FALSE, 5); | |
269 gtk_widget_show(optmenu); | |
270 | |
271 menu = gtk_menu_new(); | |
272 | |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
273 while (p) { |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
274 e = (struct prpl *)p->data; |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
275 if (e->name) |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
276 opt = gtk_menu_item_new_with_label((*e->name)()); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
277 else |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
278 opt = gtk_menu_item_new_with_label("Unknown"); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
279 gtk_object_set_user_data(GTK_OBJECT(opt), u); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
280 gtk_signal_connect(GTK_OBJECT(opt), "activate", |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
281 GTK_SIGNAL_FUNC(set_prot), (void *)e->protocol); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
282 gtk_menu_append(GTK_MENU(menu), opt); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
283 gtk_widget_show(opt); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
284 p = p->next; |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
285 } |
960 | 286 |
287 gtk_option_menu_set_menu(GTK_OPTION_MENU(optmenu), menu); | |
288 if (u) { | |
289 gtk_option_menu_set_history(GTK_OPTION_MENU(optmenu), u->protocol); | |
982
09e5065fe22c
[gaim-migrate @ 992]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
290 u->tmp_protocol = u->protocol; |
960 | 291 } else { |
1005
b1572ac4246c
[gaim-migrate @ 1015]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
292 gtk_option_menu_set_history(GTK_OPTION_MENU(optmenu), |
b1572ac4246c
[gaim-migrate @ 1015]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
293 ((struct prpl *)protocols->data)->protocol); |
960 | 294 } |
295 | |
296 return optmenu; | |
297 } | |
298 | |
299 static void show_acct_mod(struct aim_user *u) | |
300 { | |
301 /* here we can have all the aim_user options, including ones not shown in the main acctedit | |
302 * window. this can keep the size of the acctedit window small and readable, and make this | |
303 * one the powerful editor. this is where things like name/password are edited, but can | |
304 * also have toggles (and even more complex options) like whether to autologin or whether | |
305 * to send keepalives or whatever. this would be the perfect place to specify which protocol | |
306 * to use. make sure to account for the possibility of protocol plugins. */ | |
307 GtkWidget *mod; | |
308 GtkWidget *frame; | |
309 GtkWidget *vbox; | |
310 GtkWidget *hbox; | |
311 GtkWidget *label; | |
312 GtkWidget *name; | |
313 GtkWidget *pass; | |
314 GtkWidget *button; | |
315 | |
316 if (!u && newmod) { | |
317 gtk_widget_show(newmod); | |
318 return; | |
319 } | |
320 if (u && u->mod) { | |
321 gtk_widget_show(u->mod); | |
322 return; | |
323 } | |
324 | |
325 mod = gtk_window_new(GTK_WINDOW_TOPLEVEL); | |
326 gtk_window_set_wmclass(GTK_WINDOW(mod), "account", "Gaim"); | |
327 gtk_widget_realize(mod); | |
328 aol_icon(mod->window); | |
329 gtk_container_border_width(GTK_CONTAINER(mod), 10); | |
330 gtk_window_set_title(GTK_WINDOW(mod), _("Gaim - Modify Account")); | |
331 gtk_signal_connect(GTK_OBJECT(mod), "destroy", | |
332 GTK_SIGNAL_FUNC(delmod), u); | |
333 | |
334 frame = gtk_frame_new(_("Modify Account")); | |
335 gtk_container_add(GTK_CONTAINER(mod), frame); | |
336 gtk_widget_show(frame); | |
337 | |
338 vbox = gtk_vbox_new(FALSE, 0); | |
339 gtk_container_add(GTK_CONTAINER(frame), vbox); | |
340 gtk_widget_show(vbox); | |
341 | |
342 hbox = gtk_hbox_new(FALSE, 0); | |
343 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5); | |
344 gtk_widget_show(hbox); | |
345 | |
346 label = gtk_label_new(_("Screenname:")); | |
347 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); | |
348 gtk_widget_show(label); | |
349 | |
350 name = gtk_entry_new(); | |
351 gtk_box_pack_start(GTK_BOX(hbox), name, FALSE, FALSE, 5); | |
352 gtk_widget_show(name); | |
353 | |
354 hbox = gtk_hbox_new(FALSE, 5); | |
355 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5); | |
356 gtk_widget_show(hbox); | |
357 | |
358 label = gtk_label_new(_("Password:")); | |
359 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); | |
360 gtk_widget_show(label); | |
361 | |
362 pass = gtk_entry_new(); | |
363 gtk_box_pack_start(GTK_BOX(hbox), pass, FALSE, FALSE, 5); | |
364 gtk_entry_set_visibility(GTK_ENTRY(pass), FALSE); | |
365 gtk_widget_show(pass); | |
366 | |
367 hbox = gtk_hbox_new(FALSE, 5); | |
368 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5); | |
369 gtk_widget_show(hbox); | |
370 | |
371 make_protocol_menu(hbox, u); | |
372 | |
373 acct_button(_("Remember Password"), u, OPT_USR_REM_PASS, vbox); | |
374 acct_button(_("Auto-Login"), u, OPT_USR_AUTO, vbox); | |
375 acct_button(_("Send KeepAlive packet (6 bytes/second)"), u, OPT_USR_KEEPALV, vbox); | |
376 | |
377 hbox = gtk_hbox_new(FALSE, 5); | |
378 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5); | |
379 gtk_widget_show(hbox); | |
380 | |
381 button = picture_button(mod, _("Cancel"), cancel_xpm); | |
382 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 5); | |
383 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(cancel_mod), u); | |
384 gtk_widget_show(button); | |
385 | |
386 button = picture_button(mod, _("OK"), ok_xpm); | |
387 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 5); | |
388 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(ok_mod), u); | |
389 gtk_widget_show(button); | |
390 | |
391 if (u) { | |
392 u->mod = mod; | |
393 u->name = name; | |
394 u->pass = pass; | |
395 u->tmp_options = u->options; | |
396 gtk_entry_set_text(GTK_ENTRY(name), u->username); | |
397 gtk_entry_set_text(GTK_ENTRY(pass), u->password); | |
398 gtk_entry_set_editable(GTK_ENTRY(name), FALSE); | |
399 } else { | |
400 newmod = mod; | |
401 tmpusr.name = name; | |
402 tmpusr.pass = pass; | |
403 } | |
404 | |
405 gtk_widget_show(mod); | |
406 } | |
407 | |
408 static void add_acct(GtkWidget *w, gpointer d) | |
409 { | |
410 show_acct_mod(NULL); | |
411 } | |
412 | |
413 static void mod_acct(GtkWidget *w, gpointer d) | |
414 { | |
415 int row = -1; | |
416 struct aim_user *u; | |
417 if (GTK_CLIST(list)->selection) | |
418 row = (int)GTK_CLIST(list)->selection->data; | |
419 if (row != -1) { | |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1009
diff
changeset
|
420 u = g_list_nth_data(aim_users, row); |
960 | 421 if (u) |
422 show_acct_mod(u); | |
423 } | |
424 } | |
425 | |
426 static void pass_des(GtkWidget *w, struct aim_user *u) | |
427 { | |
428 gtk_widget_destroy(w); | |
429 u->passprmt = NULL; | |
430 } | |
431 | |
432 static void pass_cancel(GtkWidget *w, struct aim_user *u) | |
433 { | |
434 gtk_widget_destroy(u->passprmt); | |
435 u->passprmt = NULL; | |
436 } | |
437 | |
438 static void pass_signon(GtkWidget *w, struct aim_user *u) | |
439 { | |
440 char *txt = gtk_entry_get_text(GTK_ENTRY(u->passentry)); | |
980
82c5865f7cfe
[gaim-migrate @ 990]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
977
diff
changeset
|
441 g_snprintf(u->password, sizeof(u->password), "%s", txt); |
960 | 442 #ifdef USE_APPLET |
443 set_user_state(signing_on); | |
444 #endif | |
445 gtk_widget_destroy(u->passprmt); | |
446 u->passprmt = NULL; | |
980
82c5865f7cfe
[gaim-migrate @ 990]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
977
diff
changeset
|
447 serv_login(u); |
960 | 448 } |
449 | |
450 static void do_pass_dlg(struct aim_user *u) | |
451 { | |
452 /* we can safely assume that u is not NULL */ | |
453 GtkWidget *frame; | |
454 GtkWidget *vbox; | |
455 GtkWidget *hbox; | |
456 char buf[96]; | |
457 GtkWidget *label; | |
458 GtkWidget *button; | |
459 | |
460 if (u->passprmt) { gtk_widget_show(u->passprmt); return; } | |
461 u->passprmt = gtk_window_new(GTK_WINDOW_DIALOG); | |
462 gtk_window_set_wmclass(GTK_WINDOW(u->passprmt), "password", "Gaim"); | |
463 gtk_container_border_width(GTK_CONTAINER(u->passprmt), 5); | |
464 gtk_signal_connect(GTK_OBJECT(u->passprmt), "destroy", GTK_SIGNAL_FUNC(pass_des), u); | |
465 gtk_widget_realize(u->passprmt); | |
466 aol_icon(u->passprmt->window); | |
467 | |
468 frame = gtk_frame_new(_("Enter Password")); | |
469 gtk_container_add(GTK_CONTAINER(u->passprmt), frame); | |
470 gtk_widget_show(frame); | |
471 | |
472 vbox = gtk_vbox_new(FALSE, 5); | |
473 gtk_container_add(GTK_CONTAINER(frame), vbox); | |
474 gtk_widget_show(vbox); | |
475 | |
476 hbox = gtk_hbox_new(FALSE, 5); | |
477 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5); | |
478 gtk_widget_show(hbox); | |
479 | |
480 g_snprintf(buf, sizeof(buf), "Password for %s:", u->username); | |
481 label = gtk_label_new(buf); | |
482 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); | |
483 gtk_widget_show(label); | |
484 | |
485 u->passentry = gtk_entry_new(); | |
486 gtk_entry_set_visibility(GTK_ENTRY(u->passentry), FALSE); | |
487 gtk_box_pack_start(GTK_BOX(hbox), u->passentry, FALSE, FALSE, 5); | |
488 gtk_signal_connect(GTK_OBJECT(u->passentry), "activate", GTK_SIGNAL_FUNC(pass_signon), u); | |
489 gtk_widget_grab_focus(u->passentry); | |
490 gtk_widget_show(u->passentry); | |
491 | |
492 hbox = gtk_hbox_new(FALSE, 5); | |
493 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5); | |
494 gtk_widget_show(hbox); | |
495 | |
496 button = picture_button(u->passprmt, _("Cancel"), cancel_xpm); | |
497 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(pass_cancel), u); | |
498 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 5); | |
499 | |
500 button = picture_button(u->passprmt, _("Signon"), ok_xpm); | |
501 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(pass_signon), u); | |
502 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 5); | |
503 | |
504 gtk_widget_show(u->passprmt); | |
505 } | |
506 | |
507 static void acct_signin(GtkWidget *w, gpointer d) | |
508 { | |
509 int row = -1; | |
510 struct aim_user *u; | |
511 if (GTK_CLIST(list)->selection) | |
512 row = (int)GTK_CLIST(list)->selection->data; | |
513 if (row != -1) { | |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1009
diff
changeset
|
514 u = g_list_nth_data(aim_users, row); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1009
diff
changeset
|
515 if (!u->gc) { |
960 | 516 if (!u->password[0]) { |
517 do_pass_dlg(u); | |
518 } else { | |
519 #ifdef USE_APPLET | |
520 set_user_state(signing_on); | |
521 #endif /* USE_APPLET */ | |
980
82c5865f7cfe
[gaim-migrate @ 990]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
977
diff
changeset
|
522 serv_login(u); |
960 | 523 } |
524 } else { | |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1009
diff
changeset
|
525 signoff(u->gc); |
960 | 526 } |
527 } | |
528 } | |
529 | |
530 static void del_acct(GtkWidget *w, gpointer d) | |
531 { | |
532 int row = -1; | |
533 struct aim_user *u; | |
534 if (GTK_CLIST(list)->selection) | |
535 row = (int)GTK_CLIST(list)->selection->data; | |
536 if (row != -1) { | |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1009
diff
changeset
|
537 u = g_list_nth_data(aim_users, row); |
960 | 538 if (u) { |
539 aim_users = g_list_remove(aim_users, u); | |
540 save_prefs(); | |
541 } | |
542 gtk_clist_remove(GTK_CLIST(list), row); | |
543 } | |
544 } | |
545 | |
546 void account_editor(GtkWidget *w, GtkWidget *W) | |
547 { | |
548 /* please kill me */ | |
549 GtkWidget *frame; | |
550 GtkWidget *box; | |
551 GtkWidget *list; | |
552 GtkWidget *hbox; | |
553 GtkWidget *button; /* used for many things */ | |
554 | |
555 if (acctedit) { gtk_widget_show(acctedit); return; } | |
556 | |
557 acctedit = gtk_window_new(GTK_WINDOW_TOPLEVEL); | |
558 gtk_window_set_title(GTK_WINDOW(acctedit), _("Gaim - Account Editor")); | |
559 gtk_window_set_wmclass(GTK_WINDOW(acctedit), "accounteditor", "Gaim"); | |
560 gtk_widget_realize(acctedit); | |
561 aol_icon(acctedit->window); | |
562 gtk_container_border_width(GTK_CONTAINER(acctedit), 10); | |
563 gtk_widget_set_usize(acctedit, -1, 200); | |
564 gtk_signal_connect(GTK_OBJECT(acctedit), "destroy", | |
1009
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1005
diff
changeset
|
565 GTK_SIGNAL_FUNC(delete_acctedit), W); |
960 | 566 |
567 frame = gtk_frame_new(_("Account Editor")); | |
568 gtk_container_add(GTK_CONTAINER(acctedit), frame); | |
569 gtk_widget_show(frame); | |
570 | |
571 box = gtk_vbox_new(FALSE, 5); | |
572 gtk_container_add(GTK_CONTAINER(frame), box); | |
573 gtk_widget_show(box); | |
574 | |
575 list = generate_list(); | |
576 gtk_box_pack_start(GTK_BOX(box), list, TRUE, TRUE, 5); | |
577 | |
578 hbox = gtk_hbox_new(TRUE, 5); | |
579 gtk_box_pack_end(GTK_BOX(box), hbox, FALSE, FALSE, 5); | |
580 gtk_widget_show(hbox); | |
581 | |
582 button = picture_button(acctedit, _("Add"), gnome_add_xpm); | |
583 gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 5); | |
584 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(add_acct), NULL); | |
585 | |
586 button = picture_button(acctedit, _("Modify"), gnome_preferences_xpm); | |
587 gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 5); | |
588 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(mod_acct), NULL); | |
589 | |
590 button = picture_button(acctedit, _("Sign On/Off"), join_xpm); | |
591 gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 5); | |
592 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(acct_signin), NULL); | |
593 | |
594 button = picture_button(acctedit, _("Delete"), gnome_remove_xpm); | |
595 gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 5); | |
596 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(del_acct), NULL); | |
597 | |
598 button = picture_button(acctedit, _("Close"), gnome_close_xpm); | |
599 gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 5); | |
1009
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1005
diff
changeset
|
600 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(acctedit_close), W); |
960 | 601 |
602 gtk_widget_show(acctedit); | |
603 } | |
604 | |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1009
diff
changeset
|
605 void account_online(struct aim_user *u, struct gaim_connection *gc) |
960 | 606 { |
607 int i; | |
1002
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
608 |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1009
diff
changeset
|
609 gc->user = u; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1009
diff
changeset
|
610 u->gc = gc; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1009
diff
changeset
|
611 |
1002
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
612 /* first we hide the login progress meter */ |
988
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
613 if (gc->meter) |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
614 gtk_widget_destroy(gc->meter); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
615 gc->meter = NULL; |
1002
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
616 |
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
617 /* then we do the buddy list stuff */ |
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
618 if (mainwindow) |
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
619 gtk_widget_hide(mainwindow); |
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
620 show_buddy_list(); |
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
621 |
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
622 #ifdef USE_APPLET |
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
623 if (general_options & OPT_GEN_APP_BUDDY_SHOW) { |
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
624 refresh_buddy_window(); |
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
625 createOnlinePopup(); |
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
626 applet_buddy_show = TRUE; |
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
627 } else { |
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
628 gtk_widget_hide(blist); |
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
629 applet_buddy_show = FALSE; |
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
630 } |
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
631 set_user_state(online); |
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
632 #else |
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
633 refresh_buddy_window(); |
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
634 #endif |
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
635 setup_buddy_chats(); |
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
636 |
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
637 redo_convo_menus(); |
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
638 gaim_setup(gc); |
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
639 |
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
640 plugin_event(event_signon, gc, 0, 0, 0); |
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
641 |
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
642 /* everything for the account editor */ |
960 | 643 if (!acctedit) return; |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1009
diff
changeset
|
644 i = gtk_clist_find_row_from_data(GTK_CLIST(list), gc->user); |
977
e5eac6b236f1
[gaim-migrate @ 987]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
969
diff
changeset
|
645 gtk_clist_set_text(GTK_CLIST(list), i, 1, "Yes"); |
960 | 646 gtk_clist_set_text(GTK_CLIST(list), i, 3, proto_name(gc->protocol)); |
1002
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
647 |
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
648 return; |
960 | 649 } |
650 | |
651 void account_offline(struct gaim_connection *gc) | |
652 { | |
653 int i; | |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1009
diff
changeset
|
654 gc->user->gc = NULL; /* wasn't that awkward? */ |
960 | 655 if (!acctedit) return; |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1009
diff
changeset
|
656 i = gtk_clist_find_row_from_data(GTK_CLIST(list), gc->user); |
977
e5eac6b236f1
[gaim-migrate @ 987]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
969
diff
changeset
|
657 gtk_clist_set_text(GTK_CLIST(list), i, 1, "No"); |
993
eacd93d0089a
[gaim-migrate @ 1003]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
658 redo_convo_menus(); |
960 | 659 } |
660 | |
661 void auto_login() | |
662 { | |
663 GList *u = aim_users; | |
664 struct aim_user *a = NULL; | |
665 | |
666 while (u) { | |
667 a = (struct aim_user *)u->data; | |
668 if ((a->options & OPT_USR_AUTO) && (a->options & OPT_USR_REM_PASS)) { | |
669 #ifdef USE_APPLET | |
670 set_user_state(signing_on); | |
671 #endif /* USE_APPLET */ | |
980
82c5865f7cfe
[gaim-migrate @ 990]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
977
diff
changeset
|
672 serv_login(a); |
960 | 673 } |
674 u = u->next; | |
675 } | |
676 } | |
988
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
677 |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
678 static void meter_destroy(GtkWidget *meter, struct gaim_connection *gc) { |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
679 gtk_widget_destroy(meter); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
680 gc->meter = NULL; |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
681 } |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
682 |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
683 void set_login_progress(struct gaim_connection *gc, float howfar, char *message) { |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
684 if (mainwindow) |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
685 gtk_widget_hide(mainwindow); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
686 |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
687 if (!gc->meter) { |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
688 GtkWidget *box, *label; |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
689 char buf[256]; |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
690 |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
691 gc->meter = gtk_window_new(GTK_WINDOW_TOPLEVEL); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
692 gtk_window_set_policy(GTK_WINDOW(gc->meter), 0, 0, 1); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
693 gtk_window_set_wmclass(GTK_WINDOW(gc->meter), "signon", "Gaim"); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
694 gtk_container_set_border_width(GTK_CONTAINER(gc->meter), 5); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
695 g_snprintf(buf, sizeof(buf), "%s Signing On", gc->username); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
696 gtk_window_set_title(GTK_WINDOW(gc->meter), buf); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
697 gtk_signal_connect(GTK_OBJECT(gc->meter), "destroy", |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
698 GTK_SIGNAL_FUNC(meter_destroy), gc); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
699 gtk_widget_realize(gc->meter); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
700 aol_icon(gc->meter->window); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
701 |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
702 box = gtk_vbox_new(FALSE, 5); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
703 gtk_container_add(GTK_CONTAINER(gc->meter), box); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
704 gtk_widget_show(box); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
705 |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
706 label = gtk_label_new(buf); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
707 gtk_box_pack_start(GTK_BOX(box), label, 0, 0, 5); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
708 gtk_widget_show(label); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
709 |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
710 gc->progress = gtk_progress_bar_new(); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
711 gtk_widget_set_usize(gc->progress, 150, 0); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
712 gtk_box_pack_start(GTK_BOX(box), gc->progress, 0, 0, 5); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
713 gtk_widget_show(gc->progress); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
714 |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
715 gc->status = gtk_statusbar_new(); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
716 gtk_widget_set_usize(gc->status, 150, 0); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
717 gtk_box_pack_start(GTK_BOX(box), gc->status, 0, 0, 5); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
718 gtk_widget_show(gc->status); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
719 |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
720 gtk_widget_show(gc->meter); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
721 } |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
722 |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
723 gtk_progress_bar_update(GTK_PROGRESS_BAR(gc->progress), howfar / 5); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
724 gtk_statusbar_pop(GTK_STATUSBAR(gc->status), 1); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
725 gtk_statusbar_push(GTK_STATUSBAR(gc->status), 1, message); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
726 } |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
727 |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
728 void hide_login_progress(struct gaim_connection *gc, char *why) |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
729 { |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
730 char buf[2048]; |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
731 sprintf(buf, _("%s was unable to sign on: %s"), gc->username, why); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
732 do_error_dialog(buf, _("Signon Error")); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
733 if (gc->meter) |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
734 gtk_widget_destroy(gc->meter); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
735 gc->meter = NULL; |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
984
diff
changeset
|
736 } |