annotate src/multi.c @ 1645:2ca7329ee519

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