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