annotate src/prpl.c @ 2204:5014b802eb41

[gaim-migrate @ 2214] if you load a protocol for an unknown account or unload one, update the account editor. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Fri, 31 Aug 2001 18:09:27 +0000
parents 657dbe515608
children 14e8978f86bb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
981
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1 /*
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2 * gaim
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3 *
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4 * Copyright (C) 1998-1999, Mark Spencer <markster@marko.net>
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
5 *
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
6 * This program is free software; you can redistribute it and/or modify
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
7 * it under the terms of the GNU General Public License as published by
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
8 * the Free Software Foundation; either version 2 of the License, or
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
9 * (at your option) any later version.
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
10 *
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
11 * This program is distributed in the hope that it will be useful,
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
14 * GNU General Public License for more details.
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
15 *
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
16 * You should have received a copy of the GNU General Public License
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
17 * along with this program; if not, write to the Free Software
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
19 *
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
20 */
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
21
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
22 #include "prpl.h"
2050
ddd696ccb46b [gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2007
diff changeset
23 #include <sys/types.h>
ddd696ccb46b [gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2007
diff changeset
24 #include <sys/stat.h>
ddd696ccb46b [gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2007
diff changeset
25 #include <unistd.h>
1000
91b7377e7b45 [gaim-migrate @ 1010]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 981
diff changeset
26
1064
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1057
diff changeset
27 #include "pixmaps/ok.xpm"
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1057
diff changeset
28 #include "pixmaps/cancel.xpm"
1333
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
29 #include "pixmaps/register.xpm"
1064
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1057
diff changeset
30
981
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
31 GSList *protocols = NULL;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
32
1333
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
33 static GtkWidget *regdialog = NULL;
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
34 static GtkWidget *regbox = NULL;
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
35 static struct prpl *regprpl = NULL;
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
36
1499
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
37 GtkWidget *protomenu = NULL;
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
38
1500
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
39 struct _prompt {
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
40 GtkWidget *window;
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
41 GtkWidget *entry;
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
42 void (*doit)(void *, char *);
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
43 void (*dont)(void *);
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
44 void *data;
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
45 };
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
46
981
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
47 struct prpl *find_prpl(int prot)
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
48 {
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
49 GSList *e = protocols;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
50 struct prpl *r;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
51
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
52 while (e) {
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
53 r = (struct prpl *)e->data;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
54 if (r->protocol == prot)
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
55 return r;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
56 e = e->next;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
57 }
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
58
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
59 return NULL;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
60 }
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
61
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1210
diff changeset
62 static gint proto_compare(struct prpl *a, struct prpl *b)
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1210
diff changeset
63 {
1043
1528d05b3e6b [gaim-migrate @ 1053]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1040
diff changeset
64 /* neg if a before b, 0 if equal, pos if a after b */
1528d05b3e6b [gaim-migrate @ 1053]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1040
diff changeset
65 return a->protocol - b->protocol;
1528d05b3e6b [gaim-migrate @ 1053]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1040
diff changeset
66 }
1528d05b3e6b [gaim-migrate @ 1053]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1040
diff changeset
67
1443
336fc98b7f90 [gaim-migrate @ 1453]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1436
diff changeset
68 void load_protocol(proto_init pi, int size)
1000
91b7377e7b45 [gaim-migrate @ 1010]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 981
diff changeset
69 {
1443
336fc98b7f90 [gaim-migrate @ 1453]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1436
diff changeset
70 struct prpl *p;
1040
17cea517fd90 [gaim-migrate @ 1050]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1000
diff changeset
71 struct prpl *old;
1443
336fc98b7f90 [gaim-migrate @ 1453]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1436
diff changeset
72 if (size != sizeof(struct prpl)) {
336fc98b7f90 [gaim-migrate @ 1453]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1436
diff changeset
73 do_error_dialog(_("You have attempted to load a protocol which was not compiled"
336fc98b7f90 [gaim-migrate @ 1453]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1436
diff changeset
74 " from the same version of the source as this application was."
336fc98b7f90 [gaim-migrate @ 1453]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1436
diff changeset
75 " Unfortunately, because it is not the same version I cannot"
336fc98b7f90 [gaim-migrate @ 1453]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1436
diff changeset
76 " safely tell you which one it was. Needless to say, it was not"
336fc98b7f90 [gaim-migrate @ 1453]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1436
diff changeset
77 " successfully loaded."), _("Protocol Error"));
336fc98b7f90 [gaim-migrate @ 1453]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1436
diff changeset
78 return;
336fc98b7f90 [gaim-migrate @ 1453]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1436
diff changeset
79 }
336fc98b7f90 [gaim-migrate @ 1453]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1436
diff changeset
80 p = g_new0(struct prpl, 1);
1000
91b7377e7b45 [gaim-migrate @ 1010]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 981
diff changeset
81 pi(p);
1057
d50d3abb9eb7 [gaim-migrate @ 1067]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1047
diff changeset
82 if ((old = find_prpl(p->protocol)) == NULL)
1047
ece2d1543b20 [gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1043
diff changeset
83 unload_protocol(old);
ece2d1543b20 [gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1043
diff changeset
84 protocols = g_slist_insert_sorted(protocols, p, (GCompareFunc)proto_compare);
1333
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
85 if (regdialog)
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
86 gtk_widget_destroy(regdialog);
2204
5014b802eb41 [gaim-migrate @ 2214]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2191
diff changeset
87 regenerate_user_list();
1047
ece2d1543b20 [gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1043
diff changeset
88 }
ece2d1543b20 [gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1043
diff changeset
89
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1210
diff changeset
90 void unload_protocol(struct prpl *p)
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1210
diff changeset
91 {
1047
ece2d1543b20 [gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1043
diff changeset
92 GSList *c = connections;
ece2d1543b20 [gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1043
diff changeset
93 struct gaim_connection *g;
ece2d1543b20 [gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1043
diff changeset
94 while (c) {
ece2d1543b20 [gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1043
diff changeset
95 g = (struct gaim_connection *)c->data;
ece2d1543b20 [gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1043
diff changeset
96 if (g->prpl == p) {
ece2d1543b20 [gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1043
diff changeset
97 char buf[256];
ece2d1543b20 [gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1043
diff changeset
98 g_snprintf(buf, sizeof buf, _("%s was using %s, which got removed."
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1210
diff changeset
99 " %s is now offline."), g->username,
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1210
diff changeset
100 (*p->name)(), g->username);
1047
ece2d1543b20 [gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1043
diff changeset
101 do_error_dialog(buf, _("Disconnect"));
ece2d1543b20 [gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1043
diff changeset
102 signoff(g);
ece2d1543b20 [gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1043
diff changeset
103 c = connections;
ece2d1543b20 [gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1043
diff changeset
104 } else
ece2d1543b20 [gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1043
diff changeset
105 c = c->next;
1040
17cea517fd90 [gaim-migrate @ 1050]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1000
diff changeset
106 }
1047
ece2d1543b20 [gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1043
diff changeset
107 protocols = g_slist_remove(protocols, p);
ece2d1543b20 [gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1043
diff changeset
108 g_free(p);
2204
5014b802eb41 [gaim-migrate @ 2214]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2191
diff changeset
109 regenerate_user_list();
1000
91b7377e7b45 [gaim-migrate @ 1010]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 981
diff changeset
110 }
91b7377e7b45 [gaim-migrate @ 1010]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 981
diff changeset
111
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2050
diff changeset
112 STATIC_PROTO_INIT
1064
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1057
diff changeset
113
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1210
diff changeset
114 static void des_win(GtkWidget *a, GtkWidget *b)
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1210
diff changeset
115 {
1064
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1057
diff changeset
116 gtk_widget_destroy(b);
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1057
diff changeset
117 }
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1057
diff changeset
118
1333
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
119 static void rem_win(GtkWidget *a, GtkWidget *b)
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1210
diff changeset
120 {
1333
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
121 void *d = gtk_object_get_user_data(GTK_OBJECT(a));
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
122 if (d)
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
123 gtk_signal_disconnect_by_data(GTK_OBJECT(b), d);
1064
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1057
diff changeset
124 gtk_widget_destroy(b);
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1057
diff changeset
125 }
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1057
diff changeset
126
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1057
diff changeset
127 void do_ask_dialog(const char *text, void *data, void *doit, void *dont)
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1057
diff changeset
128 {
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1057
diff changeset
129 GtkWidget *window;
1210
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1064
diff changeset
130 GtkWidget *vbox;
1064
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1057
diff changeset
131 GtkWidget *label;
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1057
diff changeset
132 GtkWidget *hbox;
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1057
diff changeset
133 GtkWidget *button;
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1057
diff changeset
134
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1057
diff changeset
135 window = gtk_window_new(GTK_WINDOW_DIALOG);
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1057
diff changeset
136 gtk_window_set_wmclass(GTK_WINDOW(window), "accept", "Gaim");
1210
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1064
diff changeset
137 gtk_window_set_policy(GTK_WINDOW(window), FALSE, TRUE, TRUE);
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1210
diff changeset
138 gtk_window_set_title(GTK_WINDOW(window), _("Accept?"));
1064
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1057
diff changeset
139 gtk_widget_realize(window);
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1057
diff changeset
140 aol_icon(window->window);
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1057
diff changeset
141 if (dont)
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1057
diff changeset
142 gtk_signal_connect(GTK_OBJECT(window), "destroy", GTK_SIGNAL_FUNC(dont), data);
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1057
diff changeset
143
1210
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1064
diff changeset
144 vbox = gtk_vbox_new(FALSE, 5);
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1210
diff changeset
145 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
1210
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1064
diff changeset
146 gtk_container_add(GTK_CONTAINER(window), vbox);
1064
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1057
diff changeset
147
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1057
diff changeset
148 label = gtk_label_new(text);
2151
ecd5f3d29f47 [gaim-migrate @ 2161]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
149 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
ecd5f3d29f47 [gaim-migrate @ 2161]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
150 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
1064
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1057
diff changeset
151
1210
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1064
diff changeset
152 hbox = gtk_hbox_new(FALSE, 5);
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1064
diff changeset
153 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1064
diff changeset
154
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1064
diff changeset
155 button = picture_button(window, _("Cancel"), cancel_xpm);
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1064
diff changeset
156 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0);
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1064
diff changeset
157 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(des_win), window);
1064
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1057
diff changeset
158
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1057
diff changeset
159 button = picture_button(window, _("Accept"), ok_xpm);
1210
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1064
diff changeset
160 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0);
2007
948a67a691a6 [gaim-migrate @ 2017]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1536
diff changeset
161 if (dont)
948a67a691a6 [gaim-migrate @ 2017]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1536
diff changeset
162 gtk_object_set_user_data(GTK_OBJECT(button), data);
1064
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1057
diff changeset
163 if (doit)
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1057
diff changeset
164 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(doit), data);
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1057
diff changeset
165 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(rem_win), window);
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1057
diff changeset
166
1210
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1064
diff changeset
167 gtk_widget_show_all(window);
1064
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1057
diff changeset
168 }
1333
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
169
1500
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
170 static void des_prompt(GtkWidget *w, struct _prompt *p)
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
171 {
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
172 if (p->dont)
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
173 (p->dont)(p->data);
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
174 gtk_widget_destroy(p->window);
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
175 g_free(p);
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
176 }
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
177
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
178 static void act_prompt(GtkWidget *w, struct _prompt *p)
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
179 {
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
180 if (p->doit)
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
181 (p->doit)(p->data, gtk_entry_get_text(GTK_ENTRY(p->entry)));
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
182 gtk_widget_destroy(p->window);
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
183 }
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
184
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
185 void do_prompt_dialog(const char *text, void *data, void *doit, void *dont)
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
186 {
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
187 GtkWidget *window;
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
188 GtkWidget *vbox;
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
189 GtkWidget *hbox;
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
190 GtkWidget *label;
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
191 GtkWidget *entry;
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
192 GtkWidget *button;
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
193 struct _prompt *p;
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
194
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
195 p = g_new0(struct _prompt, 1);
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
196 p->data = data;
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
197 p->doit = doit;
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
198 p->dont = dont;
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
199
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
200 window = gtk_window_new(GTK_WINDOW_DIALOG);
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
201 p->window = window;
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
202 gtk_window_set_wmclass(GTK_WINDOW(window), "prompt", "Gaim");
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
203 gtk_window_set_policy(GTK_WINDOW(window), FALSE, TRUE, TRUE);
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
204 gtk_window_set_title(GTK_WINDOW(window), _("Gaim - Prompt"));
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
205 gtk_signal_connect(GTK_OBJECT(window), "destroy", GTK_SIGNAL_FUNC(des_prompt), p);
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
206 gtk_widget_realize(window);
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
207 aol_icon(window->window);
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
208
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
209 vbox = gtk_vbox_new(FALSE, 5);
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
210 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
211 gtk_container_add(GTK_CONTAINER(window), vbox);
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
212
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
213 hbox = gtk_hbox_new(FALSE, 5);
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
214 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
215
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
216 label = gtk_label_new(text);
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
217 gtk_box_pack_start(GTK_BOX(vbox), label, TRUE, TRUE, 0);
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
218
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
219 entry = gtk_entry_new();
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
220 gtk_box_pack_start(GTK_BOX(vbox), entry, FALSE, FALSE, 0);
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
221 gtk_signal_connect(GTK_OBJECT(entry), "activate", GTK_SIGNAL_FUNC(act_prompt), p);
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
222 p->entry = entry;
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
223
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
224 hbox = gtk_hbox_new(FALSE, 5);
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
225 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
226
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
227 button = picture_button(window, _("Cancel"), cancel_xpm);
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
228 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0);
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
229 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(des_win), window);
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
230
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
231 button = picture_button(window, _("Accept"), ok_xpm);
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
232 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0);
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
233 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(act_prompt), p);
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
234
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
235 gtk_widget_show_all(window);
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
236 }
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
237
1333
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
238 static void delete_reg(gpointer a, gpointer b)
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
239 {
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
240 GtkWidget *tmp = regdialog;
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
241 if (regdialog) {
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
242 regdialog = NULL;
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
243 gtk_widget_destroy(tmp);
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
244 }
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
245 }
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
246
1355
04874e92af24 [gaim-migrate @ 1365]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1333
diff changeset
247 void prepare_regbox_for_next()
1333
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
248 {
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
249 while (GTK_BOX(regbox)->children)
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
250 gtk_container_remove(GTK_CONTAINER(regbox),
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
251 ((GtkBoxChild *)GTK_BOX(regbox)->children->data)->widget);
1355
04874e92af24 [gaim-migrate @ 1365]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1333
diff changeset
252 }
04874e92af24 [gaim-migrate @ 1365]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1333
diff changeset
253
04874e92af24 [gaim-migrate @ 1365]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1333
diff changeset
254 static void reg_prpl(gpointer a, struct prpl *p)
04874e92af24 [gaim-migrate @ 1365]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1333
diff changeset
255 {
1470
5efd3988e5d3 [gaim-migrate @ 1480]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1457
diff changeset
256 prepare_regbox_for_next();
1333
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
257 regprpl = p;
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
258 (*regprpl->draw_new_user)(regbox);
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
259 }
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
260
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
261 static void do_reg(gpointer a, gpointer b)
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
262 {
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
263 if (regprpl->do_new_user)
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
264 (*regprpl->do_new_user)();
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
265 }
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
266
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
267 void register_user(gpointer a, gpointer b)
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
268 {
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
269 GSList *pr = protocols;
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
270 struct prpl *p = NULL, *q;
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
271 GtkWidget *box;
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
272 GtkWidget *frame;
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
273 GtkWidget *vbox;
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
274 GtkWidget *hbox;
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
275 GtkWidget *label;
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
276 GtkWidget *optmenu;
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
277 GtkWidget *menu;
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
278 GtkWidget *opt;
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
279 GtkWidget *button;
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
280
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
281 if (regdialog)
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
282 return;
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
283
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
284 while (pr) {
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
285 p = pr->data;
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
286 if (p->draw_new_user)
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
287 break;
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
288 pr = pr->next;
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
289 p = NULL;
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
290 }
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
291 if (p == NULL)
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
292 /* this should never happen because I said so. Hi mom. */
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
293 return;
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
294 pr = protocols;
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
295
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
296 regdialog = gtk_window_new(GTK_WINDOW_TOPLEVEL);
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
297 gtk_window_set_wmclass(GTK_WINDOW(regdialog), "registration", "Gaim");
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
298 gtk_container_set_border_width(GTK_CONTAINER(regdialog), 5);
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
299 gtk_window_set_title(GTK_WINDOW(regdialog), _("Gaim - New User Registration"));
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
300 gtk_signal_connect(GTK_OBJECT(regdialog), "destroy", GTK_SIGNAL_FUNC(delete_reg), NULL);
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
301 gtk_widget_realize(regdialog);
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
302 aol_icon(regdialog->window);
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
303
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
304 box = gtk_vbox_new(FALSE, 5);
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
305 gtk_container_add(GTK_CONTAINER(regdialog), box);
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
306 gtk_widget_show(box);
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
307
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
308 frame = gtk_frame_new(_("New User Registration"));
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
309 gtk_box_pack_start(GTK_BOX(box), frame, FALSE, FALSE, 5);
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
310 gtk_widget_show(frame);
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
311
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
312 vbox = gtk_vbox_new(FALSE, 5);
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
313 gtk_container_add(GTK_CONTAINER(frame), vbox);
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
314 gtk_widget_show(vbox);
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
315
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
316 hbox = gtk_hbox_new(FALSE, 5);
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
317 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5);
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
318 gtk_widget_show(hbox);
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
319
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
320 label = gtk_label_new(_("Register new user for"));
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
321 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5);
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
322 gtk_widget_show(label);
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
323
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
324 optmenu = gtk_option_menu_new();
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
325 gtk_box_pack_start(GTK_BOX(hbox), optmenu, FALSE, FALSE, 5);
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
326 gtk_widget_show(optmenu);
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
327
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
328 menu = gtk_menu_new();
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
329
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
330 while (pr) {
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
331 q = pr->data;
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
332 if (q->draw_new_user) {
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
333 opt = gtk_menu_item_new_with_label((*q->name)());
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
334 gtk_signal_connect(GTK_OBJECT(opt), "activate", GTK_SIGNAL_FUNC(reg_prpl), q);
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
335 gtk_menu_append(GTK_MENU(menu), opt);
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
336 gtk_widget_show(opt);
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
337 }
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
338 pr = pr->next;
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
339 }
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
340
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
341 gtk_option_menu_set_menu(GTK_OPTION_MENU(optmenu), menu);
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
342 gtk_option_menu_set_history(GTK_OPTION_MENU(optmenu), 0);
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
343 regprpl = p;
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
344
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
345 regbox = gtk_vbox_new(FALSE, 5);
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
346 gtk_box_pack_start(GTK_BOX(vbox), regbox, FALSE, FALSE, 5);
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
347 gtk_widget_show(regbox);
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
348
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
349 (*regprpl->draw_new_user)(regbox);
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
350
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
351 hbox = gtk_hbox_new(FALSE, 5);
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
352 gtk_box_pack_end(GTK_BOX(box), hbox, FALSE, FALSE, 5);
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
353 gtk_widget_show(hbox);
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
354
1436
f6a9bd50fd19 [gaim-migrate @ 1446]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1380
diff changeset
355 button = picture_button(regdialog, _("Close"), cancel_xpm);
1333
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
356 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 5);
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
357 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(delete_reg), NULL);
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
358
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
359 button = picture_button(regdialog, _("Register"), register_xpm);
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
360 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 5);
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
361 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(do_reg), NULL);
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
362
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
363 gtk_widget_show(regdialog);
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
364 }
1499
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
365
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
366 static void proto_act(GtkObject *obj, struct gaim_connection *gc)
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
367 {
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
368 char *act = gtk_object_get_user_data(obj);
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
369 (*gc->prpl->do_action)(gc, act);
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
370 }
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
371
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
372 void do_proto_menu()
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
373 {
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
374 GtkWidget *menuitem;
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
375 GtkWidget *submenu;
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
376 GList *l;
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
377 GSList *c = connections;
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
378 struct gaim_connection *gc = NULL;
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
379 int count = 0;
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
380 char buf[256];
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
381
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
382 if (!protomenu)
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
383 return;
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
384
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
385 l = gtk_container_children(GTK_CONTAINER(protomenu));
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
386 while (l) {
1530
0b6e4d52de63 [gaim-migrate @ 1540]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1500
diff changeset
387 gtk_container_remove(GTK_CONTAINER(protomenu), GTK_WIDGET(l->data));
1499
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
388 l = l->next;
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
389 }
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
390
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
391 while (c) {
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
392 gc = c->data;
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
393 if (gc->prpl->actions && gc->prpl->do_action)
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
394 count++;
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
395 c = g_slist_next(c);
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
396 }
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
397 c = connections;
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
398
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
399 if (!count) {
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
400 g_snprintf(buf, sizeof(buf), "No actions available");
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
401 menuitem = gtk_menu_item_new_with_label(buf);
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
402 gtk_menu_append(GTK_MENU(protomenu), menuitem);
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
403 gtk_widget_show(menuitem);
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
404 return;
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
405 }
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
406
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
407 if (count == 1) {
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
408 GList *tmp, *act;
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
409 while (c) {
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
410 gc = c->data;
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
411 if (gc->prpl->actions && gc->prpl->do_action)
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
412 break;
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
413 c = g_slist_next(c);
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
414 }
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
415
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
416 tmp = act = (*gc->prpl->actions)();
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
417
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
418 while (act) {
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
419 if (act->data == NULL) {
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
420 gaim_separator(protomenu);
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
421 act = g_list_next(act);
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
422 continue;
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
423 }
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
424
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
425 menuitem = gtk_menu_item_new_with_label(act->data);
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
426 gtk_object_set_user_data(GTK_OBJECT(menuitem), act->data);
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
427 gtk_menu_append(GTK_MENU(protomenu), menuitem);
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
428 gtk_signal_connect(GTK_OBJECT(menuitem), "activate",
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
429 GTK_SIGNAL_FUNC(proto_act), gc);
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
430 gtk_widget_show(menuitem);
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
431
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
432 act = g_list_next(act);
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
433 }
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
434
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
435 g_list_free(tmp);
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
436 } else {
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
437 while (c) {
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
438 GList *tmp, *act;
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
439 gc = c->data;
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
440 if (!gc->prpl->actions || !gc->prpl->do_action) {
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
441 c = g_slist_next(c);
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
442 continue;
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
443 }
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
444
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
445 g_snprintf(buf, sizeof(buf), "%s (%s)", gc->username, (*gc->prpl->name)());
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
446 menuitem = gtk_menu_item_new_with_label(buf);
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
447 gtk_menu_append(GTK_MENU(protomenu), menuitem);
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
448 gtk_widget_show(menuitem);
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
449
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
450 submenu = gtk_menu_new();
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
451 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu);
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
452 gtk_widget_show(submenu);
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
453
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
454 tmp = act = (*gc->prpl->actions)();
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
455
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
456 while (act) {
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
457 if (act->data == NULL) {
1536
3a9f11c9278b [gaim-migrate @ 1546]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1530
diff changeset
458 gaim_separator(submenu);
1499
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
459 act = g_list_next(act);
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
460 continue;
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
461 }
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
462
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
463 menuitem = gtk_menu_item_new_with_label(act->data);
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
464 gtk_object_set_user_data(GTK_OBJECT(menuitem), act->data);
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
465 gtk_menu_append(GTK_MENU(submenu), menuitem);
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
466 gtk_signal_connect(GTK_OBJECT(menuitem), "activate",
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
467 GTK_SIGNAL_FUNC(proto_act), gc);
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
468 gtk_widget_show(menuitem);
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
469
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
470 act = g_list_next(act);
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
471 }
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
472
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
473 g_list_free(tmp);
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
474 c = g_slist_next(c);
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
475 }
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
476 }
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
477 }
2050
ddd696ccb46b [gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2007
diff changeset
478
2153
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2151
diff changeset
479 static void des_email_win(GtkWidget *w, struct gaim_connection *yd) {
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2151
diff changeset
480 gtk_widget_destroy(yd->email_win);
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2151
diff changeset
481 if (yd->email_win == w)
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2151
diff changeset
482 yd->email_win = NULL;
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2151
diff changeset
483 yd->email_label = NULL;
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2151
diff changeset
484 }
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2151
diff changeset
485
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2151
diff changeset
486 void connection_has_mail(struct gaim_connection *gc, int count, const char *from, const char *subject)
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2151
diff changeset
487 {
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2151
diff changeset
488 char buf[2048];
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2151
diff changeset
489
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2151
diff changeset
490 if (!(gc->user->options & OPT_USR_MAIL_CHECK))
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2151
diff changeset
491 return;
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2151
diff changeset
492
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2151
diff changeset
493 if (count < 0 && from && subject) {
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2151
diff changeset
494 g_snprintf(buf, sizeof buf, "%s has mail from %s: %s",
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2151
diff changeset
495 gc->username, from, subject);
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2151
diff changeset
496 if (!gc->email_win) {
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2151
diff changeset
497 GtkWidget *close;
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2151
diff changeset
498
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2151
diff changeset
499 gc->email_win = gtk_dialog_new();
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2151
diff changeset
500 gtk_window_set_policy(GTK_WINDOW(gc->email_win), 0, 0, 1);
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2151
diff changeset
501 gtk_container_set_border_width(GTK_CONTAINER(gc->email_win), 5);
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2151
diff changeset
502 gtk_window_set_title(GTK_WINDOW(gc->email_win), "New Mail");
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2151
diff changeset
503 gtk_signal_connect(GTK_OBJECT(gc->email_win), "destroy",
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2151
diff changeset
504 GTK_SIGNAL_FUNC(des_email_win), gc);
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2151
diff changeset
505 gtk_widget_realize(gc->email_win);
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2151
diff changeset
506 aol_icon(gc->email_win->window);
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2151
diff changeset
507
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2151
diff changeset
508 gc->email_label = gtk_label_new(buf);
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2151
diff changeset
509 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(gc->email_win)->vbox),
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2151
diff changeset
510 gc->email_label, 0, 0, 5);
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2151
diff changeset
511 gtk_widget_show(gc->email_label);
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2151
diff changeset
512
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2151
diff changeset
513 close = picture_button(gc->email_win, _("Close"), cancel_xpm);
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2151
diff changeset
514 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(gc->email_win)->action_area),
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2151
diff changeset
515 close, 0, 0, 5);
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2151
diff changeset
516 gtk_signal_connect(GTK_OBJECT(close), "clicked",
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2151
diff changeset
517 GTK_SIGNAL_FUNC(des_email_win), gc);
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2151
diff changeset
518
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2151
diff changeset
519 gtk_widget_show(gc->email_win);
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2151
diff changeset
520 }
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2151
diff changeset
521 gtk_label_set_text(GTK_LABEL(gc->email_label), buf);
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2151
diff changeset
522 } else if (count) {
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2151
diff changeset
523 g_snprintf(buf, sizeof buf, "%s has %d new message%s.",
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2151
diff changeset
524 gc->username, count, count == 1 ? "" : "s");
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2151
diff changeset
525 if (!gc->email_win) {
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2151
diff changeset
526 GtkWidget *close;
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2151
diff changeset
527
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2151
diff changeset
528 gc->email_win = gtk_dialog_new();
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2151
diff changeset
529 gtk_window_set_policy(GTK_WINDOW(gc->email_win), 0, 0, 1);
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2151
diff changeset
530 gtk_container_set_border_width(GTK_CONTAINER(gc->email_win), 5);
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2151
diff changeset
531 gtk_window_set_title(GTK_WINDOW(gc->email_win), "New Mail");
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2151
diff changeset
532 gtk_signal_connect(GTK_OBJECT(gc->email_win), "destroy",
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2151
diff changeset
533 GTK_SIGNAL_FUNC(des_email_win), gc);
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2151
diff changeset
534 gtk_widget_realize(gc->email_win);
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2151
diff changeset
535 aol_icon(gc->email_win->window);
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2151
diff changeset
536
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2151
diff changeset
537 gc->email_label = gtk_label_new(buf);
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2151
diff changeset
538 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(gc->email_win)->vbox),
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2151
diff changeset
539 gc->email_label, 0, 0, 5);
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2151
diff changeset
540 gtk_widget_show(gc->email_label);
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2151
diff changeset
541
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2151
diff changeset
542 close = picture_button(gc->email_win, _("Close"), cancel_xpm);
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2151
diff changeset
543 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(gc->email_win)->action_area),
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2151
diff changeset
544 close, 0, 0, 5);
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2151
diff changeset
545 gtk_signal_connect(GTK_OBJECT(close), "clicked",
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2151
diff changeset
546 GTK_SIGNAL_FUNC(des_email_win), gc);
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2151
diff changeset
547
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2151
diff changeset
548 gtk_widget_show(gc->email_win);
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2151
diff changeset
549 }
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2151
diff changeset
550 gtk_label_set_text(GTK_LABEL(gc->email_label), buf);
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2151
diff changeset
551 } else if (gc->email_win)
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2151
diff changeset
552 gtk_widget_destroy(gc->email_win);
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2151
diff changeset
553 }
2191
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
554
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
555 struct icon_data {
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
556 struct gaim_connection *gc;
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
557 char *who;
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
558 void *data;
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
559 int len;
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
560 };
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
561
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
562 static GList *icons = NULL;
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
563
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
564 static gint find_icon_data(gconstpointer a, gconstpointer b)
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
565 {
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
566 const struct icon_data *x = a;
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
567 const struct icon_data *y = b;
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
568
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
569 return ((x->gc != y->gc) || g_strcasecmp(x->who, y->who));
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
570 }
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
571
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
572 void set_icon_data(struct gaim_connection *gc, char *who, void *data, int len)
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
573 {
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
574 struct icon_data tmp = { gc, who, NULL, 0 };
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
575 GList *l = g_list_find_custom(icons, &tmp, find_icon_data);
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
576 struct icon_data *id = l ? l->data : NULL;
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
577
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
578 if (id) {
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
579 g_free(id->data);
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
580 if (!data) {
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
581 icons = g_list_remove(icons, id);
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
582 g_free(id->who);
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
583 g_free(id);
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
584 return;
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
585 }
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
586 } else if (data) {
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
587 id = g_new0(struct icon_data, 1);
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
588 icons = g_list_append(icons, id);
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
589 id->gc = gc;
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
590 id->who = g_strdup(who);
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
591 } else {
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
592 return;
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
593 }
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
594
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
595 id->data = g_memdup(data, len);
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
596 id->len = len;
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
597
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
598 got_new_icon(gc, who);
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
599 }
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
600
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
601 void remove_icon_data(struct gaim_connection *gc)
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
602 {
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
603 GList *list = icons;
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
604 struct icon_data *id;
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
605
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
606 while (list) {
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
607 id = list->data;
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
608 if (id->gc == gc) {
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
609 g_free(id->data);
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
610 g_free(id->who);
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
611 list = icons = g_list_remove(icons, id);
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
612 g_free(id);
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
613 } else
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
614 list = list->next;
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
615 }
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
616 }
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
617
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
618 void *get_icon_data(struct gaim_connection *gc, char *who, int *len)
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
619 {
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
620 struct icon_data tmp = { gc, who, NULL, 0 };
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
621 GList *l = g_list_find_custom(icons, &tmp, find_icon_data);
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
622 struct icon_data *id = l ? l->data : NULL;
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
623
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
624 if (id) {
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
625 *len = id->len;
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
626 return id->data;
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
627 }
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
628
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
629 *len = 0;
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
630 return NULL;
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
631 }