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