annotate src/multi.c @ 974:a57fbdc1a758

[gaim-migrate @ 984] bah committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Wed, 11 Oct 2000 03:06:50 +0000
parents eb5a82d64ce5
children e5eac6b236f1
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>
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
23 #include "multi.h"
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
24 #include "gaim.h"
966
f7886476f9d9 [gaim-migrate @ 976]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
25 #include "gnome_applet_mgr.h"
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
26 #include "aim.h"
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
27
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
28 #include "pixmaps/gnome_add.xpm"
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
29 #include "pixmaps/gnome_preferences.xpm"
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
30 #include "pixmaps/join.xpm"
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
31 #include "pixmaps/gnome_remove.xpm"
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
32 #include "pixmaps/gnome_close.xpm"
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
33 #include "pixmaps/cancel.xpm"
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
34 #include "pixmaps/ok.xpm"
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
35
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
36 GSList *connections;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
37
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
38 static GtkWidget *acctedit = NULL;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
39 static GtkWidget *list = NULL; /* the clist of names in the accteditor */
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
40 static GtkWidget *newmod = NULL; /* the dialog for creating a new account */
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
41 static struct aim_user tmpusr;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
42
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
43 struct mod_usr_opt {
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
44 struct aim_user *user;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
45 int opt;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
46 };
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
47
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
48 struct gaim_connection *new_gaim_conn(int proto, char *username, char *password)
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
49 {
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
50 struct gaim_connection *gc = g_new0(struct gaim_connection, 1);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
51 gc->protocol = proto;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
52 g_snprintf(gc->username, sizeof(gc->username), "%s", username);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
53 g_snprintf(gc->password, sizeof(gc->password), "%s", password);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
54 gc->keepalive = -1;
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 switch(proto) {
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
57 case PROTO_TOC:
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
58 gc->toc_fd = -1;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
59 gc->seqno = 0;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
60 gc->state = 0;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
61 gc->inpa = -1;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
62 break;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
63 case PROTO_OSCAR:
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
64 gc->oscar_sess = NULL;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
65 gc->oscar_conn = NULL;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
66 gc->inpa = -1;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
67 gc->cnpa = -1;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
68 gc->paspa = -1;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
69 gc->create_exchange = 0;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
70 gc->create_name = NULL;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
71 gc->oscar_chats = NULL;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
72 break;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
73 default: /* damn plugins */
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
74 /* PRPL */
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
75 break;
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 connections = g_slist_append(connections, gc);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
79
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
80 return gc;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
81 }
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
82
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
83 void destroy_gaim_conn(struct gaim_connection *gc)
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
84 {
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
85 switch (gc->protocol) {
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
86 case PROTO_TOC:
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
87 break;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
88 case PROTO_OSCAR:
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
89 break;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
90 default:
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
91 /* PRPL */
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
92 break;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
93 }
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
94 connections = g_slist_remove(connections, gc);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
95 g_free(gc);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
96 redo_convo_menus();
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
97 }
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
98
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
99 struct gaim_connection *find_gaim_conn_by_name(char *name) {
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
100 char *who = g_strdup(normalize(name));
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
101 GSList *c = connections;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
102 struct gaim_connection *g = NULL;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
103
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
104 while (c) {
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
105 g = (struct gaim_connection *)c->data;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
106 if (!strcmp(normalize(g->username), who)) {
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
107 g_free(who);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
108 return g;
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 c = c->next;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
111 }
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
112
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 NULL;
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
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
117 static void delete_acctedit(GtkWidget *w, gpointer d)
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 if (acctedit) {
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
120 save_prefs();
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
121 gtk_widget_destroy(acctedit);
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 acctedit = NULL;
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
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
126 static gint acctedit_close(GtkWidget *w, gpointer d)
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
127 {
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
128 gtk_widget_destroy(acctedit);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
129 return FALSE;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
130 }
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
131
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
132 static char *proto_name(int proto)
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 switch (proto) {
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
135 case PROTO_TOC:
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
136 return "TOC";
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
137 case PROTO_OSCAR:
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
138 return "Oscar";
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
139 default:
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
140 /* PRPL */
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
141 return "Other";
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
142 }
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
143 }
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
144
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
145 static GtkWidget *generate_list()
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
146 {
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
147 GtkWidget *win;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
148 char *titles[4] = {"Screenname", "Currently Online", "Auto-login", "Protocol"};
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
149 GList *u = aim_users;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
150 struct aim_user *a;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
151 int i;
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 win = gtk_scrolled_window_new(0, 0);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
154 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(win), GTK_POLICY_AUTOMATIC,
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
155 GTK_POLICY_ALWAYS);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
156
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
157 list = gtk_clist_new_with_titles(4, titles);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
158 gtk_clist_set_column_width(GTK_CLIST(list), 0, 90);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
159 gtk_clist_set_selection_mode(GTK_CLIST(list), GTK_SELECTION_BROWSE);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
160 gtk_clist_column_titles_passive(GTK_CLIST(list));
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
161 gtk_container_add(GTK_CONTAINER(win), list);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
162 gtk_widget_show(list);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
163
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
164 while (u) {
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
165 a = (struct aim_user *)u->data;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
166 titles[0] = a->username;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
167 titles[1] = find_gaim_conn_by_name(a->username) ? "True" : "False";
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
168 titles[2] = (a->options & OPT_USR_AUTO) ? "True" : "False";
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
169 titles[3] = proto_name(a->protocol);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
170 i = gtk_clist_append(GTK_CLIST(list), titles);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
171 gtk_clist_set_row_data(GTK_CLIST(list), i, a);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
172 u = u->next;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
173 }
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
174
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
175 gtk_widget_show(win);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
176 return win;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
177 }
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
178
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
179 static void delmod(GtkWidget *w, struct aim_user *u)
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_destroy(w);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
182 if (u) {
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
183 u->mod = NULL;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
184 } else {
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
185 newmod = NULL;
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 }
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
188
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
189 static void mod_opt(GtkWidget *b, struct mod_usr_opt *m)
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
190 {
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
191 if (m->user) {
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
192 m->user->tmp_options = m->user->tmp_options ^ m->opt;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
193 } else {
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
194 tmpusr.options = tmpusr.options ^ m->opt;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
195 }
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
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
198 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
199 {
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
200 GtkWidget *button;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
201 struct mod_usr_opt *muo = g_new0(struct mod_usr_opt, 1);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
202 button = gtk_check_button_new_with_label(text);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
203 if (u) {
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
204 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(button), (u->options & option));
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
205 } else {
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
206 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(button), (tmpusr.options & option));
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
207 }
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
208 gtk_box_pack_start(GTK_BOX(box), button, FALSE, FALSE, 0);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
209 muo->user = u; muo->opt = option;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
210 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(mod_opt), muo);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
211 gtk_widget_show(button);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
212 return button;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
213 }
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
214
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
215 static void ok_mod(GtkWidget *w, struct aim_user *u)
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
216 {
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
217 char *txt;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
218 int i;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
219 if (u) {
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
220 u->options = u->tmp_options;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
221 u->protocol = u->tmp_protocol;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
222 txt = gtk_entry_get_text(GTK_ENTRY(u->pass));
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
223 if (u->options & OPT_USR_REM_PASS)
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
224 g_snprintf(u->password, sizeof(u->password), "%s", txt);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
225 else
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
226 u->password[0] = '\0';
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
227 gtk_widget_destroy(u->mod);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
228 i = gtk_clist_find_row_from_data(GTK_CLIST(list), u);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
229 gtk_clist_set_text(GTK_CLIST(list), i, 2, (u->options & OPT_USR_AUTO) ? "True" : "False");
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
230 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
231 } else {
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
232 char *titles[4];
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
233 txt = gtk_entry_get_text(GTK_ENTRY(tmpusr.name));
968
10d8133ffab9 [gaim-migrate @ 978]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 966
diff changeset
234 if (find_user(txt)) {
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
235 /* PRPL: also need to check protocol. remember TOC and Oscar are both AIM */
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
236 gtk_widget_destroy(newmod);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
237 return;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
238 }
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
239 u = g_new0(struct aim_user, 1);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
240 u->protocol = PROTO_TOC;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
241 g_snprintf(u->username, sizeof(u->username), "%s", txt);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
242 txt = gtk_entry_get_text(GTK_ENTRY(tmpusr.pass));
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
243 g_snprintf(u->password, sizeof(u->password), "%s", txt);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
244 u->options = tmpusr.options;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
245 u->protocol = tmpusr.protocol;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
246 gtk_widget_destroy(newmod);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
247 titles[0] = u->username;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
248 titles[1] = find_gaim_conn_by_name(u->username) ? "True" : "False";
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
249 titles[2] = (u->options & OPT_USR_AUTO) ? "True" : "False";
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
250 titles[3] = proto_name(u->protocol);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
251 i = gtk_clist_append(GTK_CLIST(list), titles);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
252 gtk_clist_set_row_data(GTK_CLIST(list), i, u);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
253 }
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
254 save_prefs();
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
255 }
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
256
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
257 static void cancel_mod(GtkWidget *w, struct aim_user *u)
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
258 {
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
259 if (u) {
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
260 gtk_widget_destroy(u->mod);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
261 } else {
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
262 gtk_widget_destroy(newmod);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
263 }
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
264 }
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
265
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
266 static void set_prot(GtkWidget *opt, int proto)
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 struct aim_user *u = gtk_object_get_user_data(GTK_OBJECT(opt));
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
269 if (u) {
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
270 u->tmp_protocol = proto;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
271 } else {
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
272 tmpusr.protocol = proto;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
273 }
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
274 }
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
275
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
276 static GtkWidget *make_protocol_menu(GtkWidget *box, struct aim_user *u)
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
277 {
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
278 GtkWidget *optmenu;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
279 GtkWidget *menu;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
280 GtkWidget *opt;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
281
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
282 /* PRPL: should we set some way to update these when new protocols get added? */
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
283 optmenu = gtk_option_menu_new();
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
284 gtk_box_pack_start(GTK_BOX(box), optmenu, FALSE, FALSE, 5);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
285 gtk_widget_show(optmenu);
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 menu = gtk_menu_new();
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
288
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
289 /* PRPL: we need to have some way of getting all the plugin names, etc */
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
290 opt = gtk_menu_item_new_with_label("TOC");
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
291 gtk_object_set_user_data(GTK_OBJECT(opt), u);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
292 gtk_signal_connect(GTK_OBJECT(opt), "activate", GTK_SIGNAL_FUNC(set_prot), (void *)PROTO_TOC);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
293 gtk_menu_append(GTK_MENU(menu), opt);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
294 gtk_widget_show(opt);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
295
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
296 opt = gtk_menu_item_new_with_label("Oscar");
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
297 gtk_object_set_user_data(GTK_OBJECT(opt), u);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
298 gtk_signal_connect(GTK_OBJECT(opt), "activate", GTK_SIGNAL_FUNC(set_prot), (void *)PROTO_OSCAR);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
299 gtk_menu_append(GTK_MENU(menu), opt);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
300 gtk_widget_show(opt);
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 gtk_option_menu_set_menu(GTK_OPTION_MENU(optmenu), menu);
969
eb5a82d64ce5 [gaim-migrate @ 979]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 968
diff changeset
303 u->tmp_protocol = u->protocol;
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
304 if (u) {
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
305 gtk_option_menu_set_history(GTK_OPTION_MENU(optmenu), u->protocol);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
306 } else {
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
307 gtk_option_menu_set_history(GTK_OPTION_MENU(optmenu), PROTO_TOC);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
308 }
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
309
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
310 return optmenu;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
311 }
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
312
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
313 static void show_acct_mod(struct aim_user *u)
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
314 {
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
315 /* here we can have all the aim_user options, including ones not shown in the main acctedit
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
316 * window. this can keep the size of the acctedit window small and readable, and make this
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
317 * one the powerful editor. this is where things like name/password are edited, but can
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
318 * also have toggles (and even more complex options) like whether to autologin or whether
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
319 * to send keepalives or whatever. this would be the perfect place to specify which protocol
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
320 * to use. make sure to account for the possibility of protocol plugins. */
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
321 GtkWidget *mod;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
322 GtkWidget *frame;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
323 GtkWidget *vbox;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
324 GtkWidget *hbox;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
325 GtkWidget *label;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
326 GtkWidget *name;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
327 GtkWidget *pass;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
328 GtkWidget *button;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
329
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
330 if (!u && newmod) {
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
331 gtk_widget_show(newmod);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
332 return;
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 if (u && u->mod) {
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
335 gtk_widget_show(u->mod);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
336 return;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
337 }
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
338
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
339 mod = gtk_window_new(GTK_WINDOW_TOPLEVEL);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
340 gtk_window_set_wmclass(GTK_WINDOW(mod), "account", "Gaim");
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
341 gtk_widget_realize(mod);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
342 aol_icon(mod->window);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
343 gtk_container_border_width(GTK_CONTAINER(mod), 10);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
344 gtk_window_set_title(GTK_WINDOW(mod), _("Gaim - Modify Account"));
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
345 gtk_signal_connect(GTK_OBJECT(mod), "destroy",
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
346 GTK_SIGNAL_FUNC(delmod), u);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
347
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
348 frame = gtk_frame_new(_("Modify Account"));
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
349 gtk_container_add(GTK_CONTAINER(mod), frame);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
350 gtk_widget_show(frame);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
351
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
352 vbox = gtk_vbox_new(FALSE, 0);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
353 gtk_container_add(GTK_CONTAINER(frame), vbox);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
354 gtk_widget_show(vbox);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
355
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
356 hbox = gtk_hbox_new(FALSE, 0);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
357 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
358 gtk_widget_show(hbox);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
359
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
360 label = gtk_label_new(_("Screenname:"));
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
361 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
362 gtk_widget_show(label);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
363
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
364 name = gtk_entry_new();
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
365 gtk_box_pack_start(GTK_BOX(hbox), name, FALSE, FALSE, 5);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
366 gtk_widget_show(name);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
367
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
368 hbox = gtk_hbox_new(FALSE, 5);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
369 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
370 gtk_widget_show(hbox);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
371
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
372 label = gtk_label_new(_("Password:"));
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
373 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
374 gtk_widget_show(label);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
375
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
376 pass = gtk_entry_new();
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
377 gtk_box_pack_start(GTK_BOX(hbox), pass, FALSE, FALSE, 5);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
378 gtk_entry_set_visibility(GTK_ENTRY(pass), FALSE);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
379 gtk_widget_show(pass);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
380
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
381 hbox = gtk_hbox_new(FALSE, 5);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
382 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
383 gtk_widget_show(hbox);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
384
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
385 make_protocol_menu(hbox, u);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
386
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
387 acct_button(_("Remember Password"), u, OPT_USR_REM_PASS, vbox);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
388 acct_button(_("Auto-Login"), u, OPT_USR_AUTO, vbox);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
389 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
390
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
391 hbox = gtk_hbox_new(FALSE, 5);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
392 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
393 gtk_widget_show(hbox);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
394
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
395 button = picture_button(mod, _("Cancel"), cancel_xpm);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
396 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 5);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
397 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
398 gtk_widget_show(button);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
399
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
400 button = picture_button(mod, _("OK"), ok_xpm);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
401 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 5);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
402 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
403 gtk_widget_show(button);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
404
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
405 if (u) {
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
406 u->mod = mod;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
407 u->name = name;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
408 u->pass = pass;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
409 u->tmp_options = u->options;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
410 gtk_entry_set_text(GTK_ENTRY(name), u->username);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
411 gtk_entry_set_text(GTK_ENTRY(pass), u->password);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
412 gtk_entry_set_editable(GTK_ENTRY(name), FALSE);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
413 } else {
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
414 newmod = mod;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
415 tmpusr.name = name;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
416 tmpusr.pass = pass;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
417 }
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
418
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
419 gtk_widget_show(mod);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
420 }
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
421
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
422 static void add_acct(GtkWidget *w, gpointer d)
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
423 {
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
424 show_acct_mod(NULL);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
425 }
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
426
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
427 static void mod_acct(GtkWidget *w, gpointer d)
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
428 {
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
429 int row = -1;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
430 char *name;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
431 struct aim_user *u;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
432 if (GTK_CLIST(list)->selection)
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
433 row = (int)GTK_CLIST(list)->selection->data;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
434 if (row != -1) {
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
435 gtk_clist_get_text(GTK_CLIST(list), row, 0, &name);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
436 u = find_user(name);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
437 if (u)
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
438 show_acct_mod(u);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
439 }
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
440 }
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
441
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
442 static void pass_des(GtkWidget *w, struct aim_user *u)
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
443 {
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
444 gtk_widget_destroy(w);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
445 u->passprmt = NULL;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
446 }
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
447
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
448 static void pass_cancel(GtkWidget *w, struct aim_user *u)
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
449 {
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
450 gtk_widget_destroy(u->passprmt);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
451 u->passprmt = NULL;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
452 }
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
453
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
454 static void pass_signon(GtkWidget *w, struct aim_user *u)
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
455 {
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
456 char *txt = gtk_entry_get_text(GTK_ENTRY(u->passentry));
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
457 char *un, *ps;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
458 #ifdef USE_APPLET
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
459 set_user_state(signing_on);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
460 #endif
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
461 un = g_strdup(u->username);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
462 ps = g_strdup(txt);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
463 gtk_widget_destroy(u->passprmt);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
464 u->passprmt = NULL;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
465 serv_login(un, ps);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
466 g_free(un);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
467 g_free(ps);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
468 }
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
469
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
470 static void do_pass_dlg(struct aim_user *u)
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
471 {
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
472 /* we can safely assume that u is not NULL */
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
473 GtkWidget *frame;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
474 GtkWidget *vbox;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
475 GtkWidget *hbox;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
476 char buf[96];
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
477 GtkWidget *label;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
478 GtkWidget *button;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
479
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
480 if (u->passprmt) { gtk_widget_show(u->passprmt); return; }
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
481 u->passprmt = gtk_window_new(GTK_WINDOW_DIALOG);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
482 gtk_window_set_wmclass(GTK_WINDOW(u->passprmt), "password", "Gaim");
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
483 gtk_container_border_width(GTK_CONTAINER(u->passprmt), 5);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
484 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
485 gtk_widget_realize(u->passprmt);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
486 aol_icon(u->passprmt->window);
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 frame = gtk_frame_new(_("Enter Password"));
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
489 gtk_container_add(GTK_CONTAINER(u->passprmt), frame);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
490 gtk_widget_show(frame);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
491
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
492 vbox = gtk_vbox_new(FALSE, 5);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
493 gtk_container_add(GTK_CONTAINER(frame), vbox);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
494 gtk_widget_show(vbox);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
495
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
496 hbox = gtk_hbox_new(FALSE, 5);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
497 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
498 gtk_widget_show(hbox);
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 g_snprintf(buf, sizeof(buf), "Password for %s:", u->username);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
501 label = gtk_label_new(buf);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
502 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
503 gtk_widget_show(label);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
504
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
505 u->passentry = gtk_entry_new();
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
506 gtk_entry_set_visibility(GTK_ENTRY(u->passentry), FALSE);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
507 gtk_box_pack_start(GTK_BOX(hbox), u->passentry, FALSE, FALSE, 5);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
508 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
509 gtk_widget_grab_focus(u->passentry);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
510 gtk_widget_show(u->passentry);
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 hbox = gtk_hbox_new(FALSE, 5);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
513 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
514 gtk_widget_show(hbox);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
515
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
516 button = picture_button(u->passprmt, _("Cancel"), cancel_xpm);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
517 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
518 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 5);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
519
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
520 button = picture_button(u->passprmt, _("Signon"), ok_xpm);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
521 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
522 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 5);
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 gtk_widget_show(u->passprmt);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
525 }
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 static void acct_signin(GtkWidget *w, gpointer d)
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
528 {
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
529 int row = -1;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
530 char *name;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
531 struct aim_user *u;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
532 struct gaim_connection *gc;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
533 if (GTK_CLIST(list)->selection)
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
534 row = (int)GTK_CLIST(list)->selection->data;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
535 if (row != -1) {
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
536 gtk_clist_get_text(GTK_CLIST(list), row, 0, &name);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
537 u = find_user(name);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
538 gc = find_gaim_conn_by_name(name);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
539 if (!gc) {
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
540 char *un, *ps;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
541 if (!u->password[0]) {
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
542 do_pass_dlg(u);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
543 } else {
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
544 #ifdef USE_APPLET
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
545 set_user_state(signing_on);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
546 #endif /* USE_APPLET */
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
547
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
548 un = g_strdup(u->username);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
549 ps = g_strdup(u->password);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
550 gc = serv_login(un, ps);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
551 g_free(un);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
552 g_free(ps);
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 } else {
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
555 signoff(gc);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
556 }
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 }
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
559
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
560 static void del_acct(GtkWidget *w, gpointer d)
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
561 {
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
562 int row = -1;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
563 char *name;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
564 struct aim_user *u;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
565 if (GTK_CLIST(list)->selection)
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
566 row = (int)GTK_CLIST(list)->selection->data;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
567 if (row != -1) {
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
568 gtk_clist_get_text(GTK_CLIST(list), row, 0, &name);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
569 u = find_user(name);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
570 if (u) {
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
571 aim_users = g_list_remove(aim_users, u);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
572 save_prefs();
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 gtk_clist_remove(GTK_CLIST(list), row);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
575 }
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
576 }
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 void account_editor(GtkWidget *w, GtkWidget *W)
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
579 {
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
580 /* please kill me */
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
581 GtkWidget *frame;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
582 GtkWidget *box;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
583 GtkWidget *list;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
584 GtkWidget *hbox;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
585 GtkWidget *button; /* used for many things */
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 if (acctedit) { gtk_widget_show(acctedit); return; }
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
588
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
589 acctedit = gtk_window_new(GTK_WINDOW_TOPLEVEL);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
590 gtk_window_set_title(GTK_WINDOW(acctedit), _("Gaim - Account Editor"));
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
591 gtk_window_set_wmclass(GTK_WINDOW(acctedit), "accounteditor", "Gaim");
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
592 gtk_widget_realize(acctedit);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
593 aol_icon(acctedit->window);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
594 gtk_container_border_width(GTK_CONTAINER(acctedit), 10);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
595 gtk_widget_set_usize(acctedit, -1, 200);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
596 gtk_signal_connect(GTK_OBJECT(acctedit), "destroy",
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
597 GTK_SIGNAL_FUNC(delete_acctedit), NULL);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
598
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
599 frame = gtk_frame_new(_("Account Editor"));
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
600 gtk_container_add(GTK_CONTAINER(acctedit), frame);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
601 gtk_widget_show(frame);
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 box = gtk_vbox_new(FALSE, 5);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
604 gtk_container_add(GTK_CONTAINER(frame), box);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
605 gtk_widget_show(box);
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 list = generate_list();
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
608 gtk_box_pack_start(GTK_BOX(box), list, TRUE, TRUE, 5);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
609
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
610 hbox = gtk_hbox_new(TRUE, 5);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
611 gtk_box_pack_end(GTK_BOX(box), hbox, FALSE, FALSE, 5);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
612 gtk_widget_show(hbox);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
613
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
614 button = picture_button(acctedit, _("Add"), gnome_add_xpm);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
615 gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 5);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
616 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
617
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
618 button = picture_button(acctedit, _("Modify"), gnome_preferences_xpm);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
619 gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 5);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
620 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
621
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
622 button = picture_button(acctedit, _("Sign On/Off"), join_xpm);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
623 gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 5);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
624 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
625
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
626 button = picture_button(acctedit, _("Delete"), gnome_remove_xpm);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
627 gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 5);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
628 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
629
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
630 button = picture_button(acctedit, _("Close"), gnome_close_xpm);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
631 gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 5);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
632 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(acctedit_close), NULL);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
633
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
634 gtk_widget_show(acctedit);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
635 }
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
636
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
637 void account_online(struct gaim_connection *gc)
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
638 {
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
639 struct aim_user *u;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
640 int i;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
641 if (!acctedit) return;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
642 u = find_user(gc->username);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
643 i = gtk_clist_find_row_from_data(GTK_CLIST(list), u);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
644 gtk_clist_set_text(GTK_CLIST(list), i, 1, "True");
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
645 gtk_clist_set_text(GTK_CLIST(list), i, 3, proto_name(gc->protocol));
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
646 redo_convo_menus();
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
647 }
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
648
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
649 void account_offline(struct gaim_connection *gc)
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
650 {
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
651 struct aim_user *u;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
652 int i;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
653 if (!acctedit) return;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
654 u = find_user(gc->username);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
655 i = gtk_clist_find_row_from_data(GTK_CLIST(list), u);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
656 gtk_clist_set_text(GTK_CLIST(list), i, 1, "False");
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
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
659 void auto_login()
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
660 {
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
661 GList *u = aim_users;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
662 struct aim_user *a = NULL;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
663 char *un, *ps;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
664
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
665 while (u) {
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
666 a = (struct aim_user *)u->data;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
667 if ((a->options & OPT_USR_AUTO) && (a->options & OPT_USR_REM_PASS)) {
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
668 #ifdef USE_APPLET
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
669 set_user_state(signing_on);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
670 #endif /* USE_APPLET */
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
671
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
672 un = g_strdup(a->username);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
673 ps = g_strdup(a->password);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
674 serv_login(un, ps);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
675 g_free(un);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
676 g_free(ps);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
677 }
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
678 u = u->next;
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 }