annotate src/prpl.c @ 3485:6187c93da61a

[gaim-migrate @ 3539] Bugfix by Chris Rankin. Thanks, Chris! committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Sat, 31 Aug 2002 02:49:25 +0000
parents cfbdfe334975
children 4b204c262376
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
2417
5473c8c5378d [gaim-migrate @ 2430]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2403
diff changeset
22 #include "gaim.h"
981
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
23 #include "prpl.h"
2050
ddd696ccb46b [gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2007
diff changeset
24 #include <sys/types.h>
ddd696ccb46b [gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2007
diff changeset
25 #include <sys/stat.h>
ddd696ccb46b [gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2007
diff changeset
26 #include <unistd.h>
1000
91b7377e7b45 [gaim-migrate @ 1010]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 981
diff changeset
27
1064
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1057
diff changeset
28 #include "pixmaps/ok.xpm"
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1057
diff changeset
29 #include "pixmaps/cancel.xpm"
2541
8229710b343b [gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2428
diff changeset
30 #include "pixmaps/tb_forward.xpm"
1064
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1057
diff changeset
31
981
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
32 GSList *protocols = NULL;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
33
1499
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
34 GtkWidget *protomenu = NULL;
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
35
1500
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
36 struct _prompt {
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
37 GtkWidget *window;
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
38 GtkWidget *entry;
3466
7a3f16a375a5 [gaim-migrate @ 3516]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
39 void (*doit)(void *, const char *);
1500
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
40 void (*dont)(void *);
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
41 void *data;
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
42 };
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
43
981
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
44 struct prpl *find_prpl(int prot)
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
45 {
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
46 GSList *e = protocols;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
47 struct prpl *r;
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 while (e) {
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
50 r = (struct prpl *)e->data;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
51 if (r->protocol == prot)
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
52 return r;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
53 e = e->next;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
54 }
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
55
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
56 return NULL;
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
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1210
diff changeset
59 static gint proto_compare(struct prpl *a, struct prpl *b)
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1210
diff changeset
60 {
1043
1528d05b3e6b [gaim-migrate @ 1053]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1040
diff changeset
61 /* 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
62 return a->protocol - b->protocol;
1528d05b3e6b [gaim-migrate @ 1053]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1040
diff changeset
63 }
1528d05b3e6b [gaim-migrate @ 1053]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1040
diff changeset
64
1443
336fc98b7f90 [gaim-migrate @ 1453]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1436
diff changeset
65 void load_protocol(proto_init pi, int size)
1000
91b7377e7b45 [gaim-migrate @ 1010]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 981
diff changeset
66 {
1443
336fc98b7f90 [gaim-migrate @ 1453]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1436
diff changeset
67 struct prpl *p;
1040
17cea517fd90 [gaim-migrate @ 1050]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1000
diff changeset
68 struct prpl *old;
1443
336fc98b7f90 [gaim-migrate @ 1453]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1436
diff changeset
69 if (size != sizeof(struct prpl)) {
3427
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3390
diff changeset
70 do_error_dialog(_("Incompatible protocol detected."),
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3390
diff changeset
71 _("You have attempted to load a protocol which was not compiled"
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2355
diff changeset
72 " from the same version of the source as this application was."
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2355
diff changeset
73 " Unfortunately, because it is not the same version I cannot"
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2355
diff changeset
74 " safely tell you which one it was. Needless to say, it was not"
3427
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3390
diff changeset
75 " successfully loaded."), GAIM_ERROR);
1443
336fc98b7f90 [gaim-migrate @ 1453]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1436
diff changeset
76 return;
336fc98b7f90 [gaim-migrate @ 1453]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1436
diff changeset
77 }
3382
e9a89676d120 [gaim-migrate @ 3401]
Sean Egan <seanegan@gmail.com>
parents: 3281
diff changeset
78
3390
a5d356cba156 [gaim-migrate @ 3409]
Christian Hammond <chipx86@chipx86.com>
parents: 3382
diff changeset
79 p = g_new0(struct prpl, 1);
a5d356cba156 [gaim-migrate @ 3409]
Christian Hammond <chipx86@chipx86.com>
parents: 3382
diff changeset
80 pi(p);
a5d356cba156 [gaim-migrate @ 3409]
Christian Hammond <chipx86@chipx86.com>
parents: 3382
diff changeset
81 if ((old = find_prpl(p->protocol)) != NULL)
a5d356cba156 [gaim-migrate @ 3409]
Christian Hammond <chipx86@chipx86.com>
parents: 3382
diff changeset
82 unload_protocol(old);
a5d356cba156 [gaim-migrate @ 3409]
Christian Hammond <chipx86@chipx86.com>
parents: 3382
diff changeset
83
3382
e9a89676d120 [gaim-migrate @ 3401]
Sean Egan <seanegan@gmail.com>
parents: 3281
diff changeset
84 if (p->protocol == PROTO_ICQ)
3427
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3390
diff changeset
85 do_error_dialog(_("Libicq.so detected."),
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3390
diff changeset
86 _("Gaim has loaded the ICQ plugin. This plugin has been deprecated. "
3382
e9a89676d120 [gaim-migrate @ 3401]
Sean Egan <seanegan@gmail.com>
parents: 3281
diff changeset
87 "As such, it was probably not compiled from the same version of the "
e9a89676d120 [gaim-migrate @ 3401]
Sean Egan <seanegan@gmail.com>
parents: 3281
diff changeset
88 "source as this application was, and cannot be guaranteed to work. "
e9a89676d120 [gaim-migrate @ 3401]
Sean Egan <seanegan@gmail.com>
parents: 3281
diff changeset
89 "It is reccomended that you use the AIM/ICQ protocol to connect to ICQ"),
3427
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3390
diff changeset
90 GAIM_WARNING);
3382
e9a89676d120 [gaim-migrate @ 3401]
Sean Egan <seanegan@gmail.com>
parents: 3281
diff changeset
91
3390
a5d356cba156 [gaim-migrate @ 3409]
Christian Hammond <chipx86@chipx86.com>
parents: 3382
diff changeset
92
1047
ece2d1543b20 [gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1043
diff changeset
93 protocols = g_slist_insert_sorted(protocols, p, (GCompareFunc)proto_compare);
2204
5014b802eb41 [gaim-migrate @ 2214]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2191
diff changeset
94 regenerate_user_list();
1047
ece2d1543b20 [gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1043
diff changeset
95 }
ece2d1543b20 [gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1043
diff changeset
96
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1210
diff changeset
97 void unload_protocol(struct prpl *p)
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1210
diff changeset
98 {
1047
ece2d1543b20 [gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1043
diff changeset
99 GSList *c = connections;
ece2d1543b20 [gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1043
diff changeset
100 struct gaim_connection *g;
ece2d1543b20 [gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1043
diff changeset
101 while (c) {
ece2d1543b20 [gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1043
diff changeset
102 g = (struct gaim_connection *)c->data;
ece2d1543b20 [gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1043
diff changeset
103 if (g->prpl == p) {
ece2d1543b20 [gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1043
diff changeset
104 char buf[256];
ece2d1543b20 [gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1043
diff changeset
105 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
106 " %s is now offline."), g->username,
2662
b0c5770156e1 [gaim-migrate @ 2675]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2606
diff changeset
107 p->name(), g->username);
3427
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3390
diff changeset
108 do_error_dialog(buf, NULL, GAIM_ERROR);
1047
ece2d1543b20 [gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1043
diff changeset
109 signoff(g);
ece2d1543b20 [gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1043
diff changeset
110 c = connections;
ece2d1543b20 [gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1043
diff changeset
111 } else
ece2d1543b20 [gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1043
diff changeset
112 c = c->next;
1040
17cea517fd90 [gaim-migrate @ 1050]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1000
diff changeset
113 }
1047
ece2d1543b20 [gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1043
diff changeset
114 protocols = g_slist_remove(protocols, p);
ece2d1543b20 [gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1043
diff changeset
115 g_free(p);
2204
5014b802eb41 [gaim-migrate @ 2214]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2191
diff changeset
116 regenerate_user_list();
1000
91b7377e7b45 [gaim-migrate @ 1010]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 981
diff changeset
117 }
91b7377e7b45 [gaim-migrate @ 1010]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 981
diff changeset
118
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2050
diff changeset
119 STATIC_PROTO_INIT
1064
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1057
diff changeset
120
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1210
diff changeset
121 static void des_win(GtkWidget *a, GtkWidget *b)
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1210
diff changeset
122 {
1064
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1057
diff changeset
123 gtk_widget_destroy(b);
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1057
diff changeset
124 }
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1057
diff changeset
125
1333
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
126 static void rem_win(GtkWidget *a, GtkWidget *b)
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1210
diff changeset
127 {
1333
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
128 void *d = gtk_object_get_user_data(GTK_OBJECT(a));
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
129 if (d)
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
130 gtk_signal_disconnect_by_data(GTK_OBJECT(b), d);
1064
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1057
diff changeset
131 gtk_widget_destroy(b);
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1057
diff changeset
132 }
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1057
diff changeset
133
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1057
diff changeset
134 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
135 {
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1057
diff changeset
136 GtkWidget *window;
1210
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1064
diff changeset
137 GtkWidget *vbox;
1064
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1057
diff changeset
138 GtkWidget *label;
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1057
diff changeset
139 GtkWidget *hbox;
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1057
diff changeset
140 GtkWidget *button;
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1057
diff changeset
141
2725
f3c094e78609 [gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2718
diff changeset
142 GAIM_DIALOG(window);
1064
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1057
diff changeset
143 gtk_window_set_wmclass(GTK_WINDOW(window), "accept", "Gaim");
1210
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1064
diff changeset
144 gtk_window_set_policy(GTK_WINDOW(window), FALSE, TRUE, TRUE);
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1210
diff changeset
145 gtk_window_set_title(GTK_WINDOW(window), _("Accept?"));
1064
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1057
diff changeset
146 gtk_widget_realize(window);
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1057
diff changeset
147 if (dont)
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1057
diff changeset
148 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
149
1210
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1064
diff changeset
150 vbox = gtk_vbox_new(FALSE, 5);
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1210
diff changeset
151 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
1210
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1064
diff changeset
152 gtk_container_add(GTK_CONTAINER(window), vbox);
1064
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1057
diff changeset
153
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1057
diff changeset
154 label = gtk_label_new(text);
2151
ecd5f3d29f47 [gaim-migrate @ 2161]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
155 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
ecd5f3d29f47 [gaim-migrate @ 2161]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
156 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
1064
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1057
diff changeset
157
1210
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1064
diff changeset
158 hbox = gtk_hbox_new(FALSE, 5);
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1064
diff changeset
159 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1064
diff changeset
160
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1064
diff changeset
161 button = picture_button(window, _("Cancel"), cancel_xpm);
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1064
diff changeset
162 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0);
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1064
diff changeset
163 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
164
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1057
diff changeset
165 button = picture_button(window, _("Accept"), ok_xpm);
1210
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1064
diff changeset
166 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
167 if (dont)
948a67a691a6 [gaim-migrate @ 2017]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1536
diff changeset
168 gtk_object_set_user_data(GTK_OBJECT(button), data);
1064
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1057
diff changeset
169 if (doit)
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1057
diff changeset
170 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
171 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
172
1210
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1064
diff changeset
173 gtk_widget_show_all(window);
1064
b0b40b5faede [gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1057
diff changeset
174 }
1333
b332d8f46b84 [gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
175
1500
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
176 static void des_prompt(GtkWidget *w, struct _prompt *p)
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 if (p->dont)
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
179 (p->dont)(p->data);
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
180 gtk_widget_destroy(p->window);
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
181 g_free(p);
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
182 }
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 static void act_prompt(GtkWidget *w, struct _prompt *p)
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
185 {
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
186 if (p->doit)
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
187 (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
188 gtk_widget_destroy(p->window);
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
189 }
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
190
2541
8229710b343b [gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2428
diff changeset
191 void do_prompt_dialog(const char *text, const char *def, void *data, void *doit, void *dont)
1500
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
192 {
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
193 GtkWidget *window;
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
194 GtkWidget *vbox;
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
195 GtkWidget *hbox;
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
196 GtkWidget *label;
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
197 GtkWidget *entry;
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
198 GtkWidget *button;
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
199 struct _prompt *p;
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
200
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
201 p = g_new0(struct _prompt, 1);
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
202 p->data = data;
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
203 p->doit = doit;
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
204 p->dont = dont;
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
205
2725
f3c094e78609 [gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2718
diff changeset
206 GAIM_DIALOG(window);
1500
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
207 p->window = window;
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
208 gtk_window_set_wmclass(GTK_WINDOW(window), "prompt", "Gaim");
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
209 gtk_window_set_policy(GTK_WINDOW(window), FALSE, TRUE, TRUE);
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
210 gtk_window_set_title(GTK_WINDOW(window), _("Gaim - Prompt"));
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
211 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
212 gtk_widget_realize(window);
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
213
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
214 vbox = gtk_vbox_new(FALSE, 5);
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
215 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
216 gtk_container_add(GTK_CONTAINER(window), vbox);
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
217
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
218 hbox = gtk_hbox_new(FALSE, 5);
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
219 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
220
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
221 label = gtk_label_new(text);
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
222 gtk_box_pack_start(GTK_BOX(vbox), label, TRUE, TRUE, 0);
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 entry = gtk_entry_new();
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
225 gtk_box_pack_start(GTK_BOX(vbox), entry, FALSE, FALSE, 0);
2541
8229710b343b [gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2428
diff changeset
226 if (def)
2543
830a83209475 [gaim-migrate @ 2556]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2541
diff changeset
227 gtk_entry_set_text(GTK_ENTRY(entry), def);
1500
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
228 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
229 p->entry = entry;
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 hbox = gtk_hbox_new(FALSE, 5);
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
232 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
233
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
234 button = picture_button(window, _("Cancel"), cancel_xpm);
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
235 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0);
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
236 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
237
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
238 button = picture_button(window, _("Accept"), ok_xpm);
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
239 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0);
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
240 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
241
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
242 gtk_widget_show_all(window);
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
243 }
a054c28735fb [gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
244
1499
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
245 static void proto_act(GtkObject *obj, struct gaim_connection *gc)
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
246 {
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
247 char *act = gtk_object_get_user_data(obj);
2662
b0c5770156e1 [gaim-migrate @ 2675]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2606
diff changeset
248 gc->prpl->do_action(gc, act);
1499
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
249 }
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
250
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
251 void do_proto_menu()
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
252 {
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
253 GtkWidget *menuitem;
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
254 GtkWidget *submenu;
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
255 GList *l;
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
256 GSList *c = connections;
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
257 struct gaim_connection *gc = NULL;
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
258 int count = 0;
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
259 char buf[256];
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
260
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
261 if (!protomenu)
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
262 return;
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
263
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
264 l = gtk_container_children(GTK_CONTAINER(protomenu));
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
265 while (l) {
1530
0b6e4d52de63 [gaim-migrate @ 1540]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1500
diff changeset
266 gtk_container_remove(GTK_CONTAINER(protomenu), GTK_WIDGET(l->data));
1499
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
267 l = l->next;
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
268 }
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
269
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
270 while (c) {
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
271 gc = c->data;
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
272 if (gc->prpl->actions && gc->prpl->do_action)
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
273 count++;
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
274 c = g_slist_next(c);
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
275 }
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
276 c = connections;
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
277
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
278 if (!count) {
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
279 g_snprintf(buf, sizeof(buf), "No actions available");
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
280 menuitem = gtk_menu_item_new_with_label(buf);
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
281 gtk_menu_append(GTK_MENU(protomenu), menuitem);
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
282 gtk_widget_show(menuitem);
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
283 return;
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
284 }
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
285
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
286 if (count == 1) {
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
287 GList *tmp, *act;
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
288 while (c) {
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
289 gc = c->data;
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
290 if (gc->prpl->actions && gc->prpl->do_action)
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
291 break;
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
292 c = g_slist_next(c);
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
293 }
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
294
2662
b0c5770156e1 [gaim-migrate @ 2675]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2606
diff changeset
295 tmp = act = gc->prpl->actions();
1499
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
296
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
297 while (act) {
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
298 if (act->data == NULL) {
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
299 gaim_separator(protomenu);
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
300 act = g_list_next(act);
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
301 continue;
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
302 }
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
303
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
304 menuitem = gtk_menu_item_new_with_label(act->data);
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
305 gtk_object_set_user_data(GTK_OBJECT(menuitem), act->data);
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
306 gtk_menu_append(GTK_MENU(protomenu), menuitem);
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
307 gtk_signal_connect(GTK_OBJECT(menuitem), "activate",
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
308 GTK_SIGNAL_FUNC(proto_act), gc);
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
309 gtk_widget_show(menuitem);
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
310
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
311 act = g_list_next(act);
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
312 }
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
313
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
314 g_list_free(tmp);
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
315 } else {
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
316 while (c) {
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
317 GList *tmp, *act;
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
318 gc = c->data;
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
319 if (!gc->prpl->actions || !gc->prpl->do_action) {
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
320 c = g_slist_next(c);
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
321 continue;
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
322 }
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
323
2662
b0c5770156e1 [gaim-migrate @ 2675]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2606
diff changeset
324 g_snprintf(buf, sizeof(buf), "%s (%s)", gc->username, gc->prpl->name());
1499
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
325 menuitem = gtk_menu_item_new_with_label(buf);
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
326 gtk_menu_append(GTK_MENU(protomenu), menuitem);
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
327 gtk_widget_show(menuitem);
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
328
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
329 submenu = gtk_menu_new();
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
330 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu);
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
331 gtk_widget_show(submenu);
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
332
2662
b0c5770156e1 [gaim-migrate @ 2675]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2606
diff changeset
333 tmp = act = gc->prpl->actions();
1499
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
334
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
335 while (act) {
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
336 if (act->data == NULL) {
1536
3a9f11c9278b [gaim-migrate @ 1546]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1530
diff changeset
337 gaim_separator(submenu);
1499
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
338 act = g_list_next(act);
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
339 continue;
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
340 }
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
341
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
342 menuitem = gtk_menu_item_new_with_label(act->data);
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
343 gtk_object_set_user_data(GTK_OBJECT(menuitem), act->data);
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
344 gtk_menu_append(GTK_MENU(submenu), menuitem);
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
345 gtk_signal_connect(GTK_OBJECT(menuitem), "activate",
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
346 GTK_SIGNAL_FUNC(proto_act), gc);
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
347 gtk_widget_show(menuitem);
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
348
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
349 act = g_list_next(act);
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
350 }
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
351
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
352 g_list_free(tmp);
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
353 c = g_slist_next(c);
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
354 }
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
355 }
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1470
diff changeset
356 }
2050
ddd696ccb46b [gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2007
diff changeset
357
2401
86c9b44a35ae [gaim-migrate @ 2414]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
358 struct mail_notify {
86c9b44a35ae [gaim-migrate @ 2414]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
359 struct gaim_connection *gc;
86c9b44a35ae [gaim-migrate @ 2414]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
360 GtkWidget *email_win;
86c9b44a35ae [gaim-migrate @ 2414]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
361 GtkWidget *email_label;
2541
8229710b343b [gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2428
diff changeset
362 char *url;
2401
86c9b44a35ae [gaim-migrate @ 2414]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
363 };
86c9b44a35ae [gaim-migrate @ 2414]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
364 GSList *mailnots = NULL;
86c9b44a35ae [gaim-migrate @ 2414]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
365
86c9b44a35ae [gaim-migrate @ 2414]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
366 static struct mail_notify *find_mail_notify(struct gaim_connection *gc)
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2355
diff changeset
367 {
2401
86c9b44a35ae [gaim-migrate @ 2414]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
368 GSList *m = mailnots;
86c9b44a35ae [gaim-migrate @ 2414]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
369 while (m) {
86c9b44a35ae [gaim-migrate @ 2414]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
370 if (((struct mail_notify *)m->data)->gc == gc)
86c9b44a35ae [gaim-migrate @ 2414]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
371 return m->data;
86c9b44a35ae [gaim-migrate @ 2414]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
372 m = m->next;
86c9b44a35ae [gaim-migrate @ 2414]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
373 }
86c9b44a35ae [gaim-migrate @ 2414]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
374 return NULL;
86c9b44a35ae [gaim-migrate @ 2414]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
375 }
86c9b44a35ae [gaim-migrate @ 2414]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
376
86c9b44a35ae [gaim-migrate @ 2414]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
377 static void des_email_win(GtkWidget *w, struct mail_notify *mn)
86c9b44a35ae [gaim-migrate @ 2414]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
378 {
2428
0394552f2aab [gaim-migrate @ 2441]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2417
diff changeset
379 if (w != mn->email_win) {
0394552f2aab [gaim-migrate @ 2441]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2417
diff changeset
380 gtk_widget_destroy(mn->email_win);
0394552f2aab [gaim-migrate @ 2441]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2417
diff changeset
381 return;
0394552f2aab [gaim-migrate @ 2441]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2417
diff changeset
382 }
0394552f2aab [gaim-migrate @ 2441]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2417
diff changeset
383 debug_printf("removing mail notification\n");
2401
86c9b44a35ae [gaim-migrate @ 2414]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
384 mailnots = g_slist_remove(mailnots, mn);
2541
8229710b343b [gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2428
diff changeset
385 if (mn->url)
8229710b343b [gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2428
diff changeset
386 g_free(mn->url);
2401
86c9b44a35ae [gaim-migrate @ 2414]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
387 g_free(mn);
2153
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2151
diff changeset
388 }
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2151
diff changeset
389
2541
8229710b343b [gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2428
diff changeset
390 void connection_has_mail(struct gaim_connection *gc, int count, const char *from, const char *subject, const char *url)
2153
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2151
diff changeset
391 {
2541
8229710b343b [gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2428
diff changeset
392 GtkWidget *hbox;
8229710b343b [gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2428
diff changeset
393 GtkWidget *vbox;
8229710b343b [gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2428
diff changeset
394 GtkWidget *urlbut;
8229710b343b [gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2428
diff changeset
395 GtkWidget *close;
8229710b343b [gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2428
diff changeset
396
2401
86c9b44a35ae [gaim-migrate @ 2414]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
397 struct mail_notify *mn;
2153
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2151
diff changeset
398 char buf[2048];
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2151
diff changeset
399
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2151
diff changeset
400 if (!(gc->user->options & OPT_USR_MAIL_CHECK))
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2151
diff changeset
401 return;
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2151
diff changeset
402
2401
86c9b44a35ae [gaim-migrate @ 2414]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
403 if (!(mn = find_mail_notify(gc))) {
86c9b44a35ae [gaim-migrate @ 2414]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
404 mn = g_new0(struct mail_notify, 1);
86c9b44a35ae [gaim-migrate @ 2414]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
405 mn->gc = gc;
2403
8555e48c02df [gaim-migrate @ 2416]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2401
diff changeset
406 mailnots = g_slist_append(mailnots, mn);
2401
86c9b44a35ae [gaim-migrate @ 2414]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
407 }
86c9b44a35ae [gaim-migrate @ 2414]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
408
2153
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2151
diff changeset
409 if (count < 0 && from && subject) {
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2355
diff changeset
410 g_snprintf(buf, sizeof buf, "%s has mail from %s: %s", gc->username, from, subject);
2153
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2151
diff changeset
411 } else if (count) {
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2151
diff changeset
412 g_snprintf(buf, sizeof buf, "%s has %d new message%s.",
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2355
diff changeset
413 gc->username, count, count == 1 ? "" : "s");
2541
8229710b343b [gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2428
diff changeset
414 } else if (mn->email_win) {
8229710b343b [gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2428
diff changeset
415 gtk_widget_destroy(mn->email_win);
8229710b343b [gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2428
diff changeset
416 return;
2606
f00549786a9c [gaim-migrate @ 2619]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2585
diff changeset
417 } else
f00549786a9c [gaim-migrate @ 2619]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2585
diff changeset
418 return;
2153
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2151
diff changeset
419
2541
8229710b343b [gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2428
diff changeset
420 if (mn->email_win) {
8229710b343b [gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2428
diff changeset
421 gtk_label_set_text(GTK_LABEL(mn->email_label), buf);
8229710b343b [gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2428
diff changeset
422 return;
8229710b343b [gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2428
diff changeset
423 }
8229710b343b [gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2428
diff changeset
424
8229710b343b [gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2428
diff changeset
425
2725
f3c094e78609 [gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2718
diff changeset
426 GAIM_DIALOG(mn->email_win);
2541
8229710b343b [gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2428
diff changeset
427 gtk_window_set_wmclass(GTK_WINDOW(mn->email_win), "mail", "Gaim");
8229710b343b [gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2428
diff changeset
428 gtk_window_set_policy(GTK_WINDOW(mn->email_win), FALSE, TRUE, TRUE);
8229710b343b [gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2428
diff changeset
429 gtk_window_set_title(GTK_WINDOW(mn->email_win), _("Gaim - New Mail"));
8229710b343b [gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2428
diff changeset
430 gtk_signal_connect(GTK_OBJECT(mn->email_win), "destroy", GTK_SIGNAL_FUNC(des_email_win), mn);
8229710b343b [gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2428
diff changeset
431 gtk_widget_realize(mn->email_win);
2153
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2151
diff changeset
432
2541
8229710b343b [gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2428
diff changeset
433 vbox = gtk_vbox_new(FALSE, 5);
8229710b343b [gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2428
diff changeset
434 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
8229710b343b [gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2428
diff changeset
435 gtk_container_add(GTK_CONTAINER(mn->email_win), vbox);
8229710b343b [gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2428
diff changeset
436 gtk_widget_show(vbox);
8229710b343b [gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2428
diff changeset
437
8229710b343b [gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2428
diff changeset
438 mn->email_label = gtk_label_new(buf);
8229710b343b [gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2428
diff changeset
439 gtk_label_set_text(GTK_LABEL(mn->email_label), buf);
8229710b343b [gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2428
diff changeset
440 gtk_box_pack_start(GTK_BOX(vbox), mn->email_label, 0, 0, 5);
8229710b343b [gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2428
diff changeset
441 gtk_widget_show(mn->email_label);
8229710b343b [gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2428
diff changeset
442
8229710b343b [gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2428
diff changeset
443 hbox = gtk_hbox_new(FALSE, 5);
8229710b343b [gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2428
diff changeset
444 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
8229710b343b [gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2428
diff changeset
445 gtk_widget_show(hbox);
2153
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2151
diff changeset
446
2541
8229710b343b [gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2428
diff changeset
447 close = picture_button(mn->email_win, _("Close"), cancel_xpm);
8229710b343b [gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2428
diff changeset
448 gtk_window_set_focus(GTK_WINDOW(mn->email_win), close);
8229710b343b [gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2428
diff changeset
449 gtk_box_pack_end(GTK_BOX(hbox), close, 0, 0, 5);
8229710b343b [gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2428
diff changeset
450 gtk_signal_connect(GTK_OBJECT(close), "clicked", GTK_SIGNAL_FUNC(des_email_win), mn);
2153
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2151
diff changeset
451
2541
8229710b343b [gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2428
diff changeset
452 if (url) {
8229710b343b [gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2428
diff changeset
453 mn->url = g_strdup(url);
8229710b343b [gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2428
diff changeset
454 urlbut = picture_button(mn->email_win, _("Open Mail"), tb_forward_xpm);
8229710b343b [gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2428
diff changeset
455 gtk_box_pack_end(GTK_BOX(hbox), urlbut, 0, 0, 5);
2827
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
456 gtk_signal_connect(GTK_OBJECT(urlbut), "clicked", GTK_SIGNAL_FUNC(open_url), mn->url);
2558
78a1cee07540 [gaim-migrate @ 2571]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2557
diff changeset
457 gtk_signal_connect(GTK_OBJECT(urlbut), "clicked", GTK_SIGNAL_FUNC(des_email_win), mn);
2541
8229710b343b [gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2428
diff changeset
458 }
8229710b343b [gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2428
diff changeset
459
8229710b343b [gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2428
diff changeset
460 gtk_widget_show(mn->email_win);
2153
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2151
diff changeset
461 }
2191
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
462
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
463 struct icon_data {
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
464 struct gaim_connection *gc;
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
465 char *who;
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
466 void *data;
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
467 int len;
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
468 };
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
469
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
470 static GList *icons = NULL;
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
471
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
472 static gint find_icon_data(gconstpointer a, gconstpointer b)
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
473 {
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
474 const struct icon_data *x = a;
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
475 const struct icon_data *y = b;
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
476
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
477 return ((x->gc != y->gc) || g_strcasecmp(x->who, y->who));
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
478 }
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
479
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
480 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
481 {
3281
941eb47c5bd4 [gaim-migrate @ 3299]
Sean Egan <seanegan@gmail.com>
parents: 3150
diff changeset
482 struct icon_data tmp;
941eb47c5bd4 [gaim-migrate @ 3299]
Sean Egan <seanegan@gmail.com>
parents: 3150
diff changeset
483 GList *l;
941eb47c5bd4 [gaim-migrate @ 3299]
Sean Egan <seanegan@gmail.com>
parents: 3150
diff changeset
484 struct icon_data *id;
941eb47c5bd4 [gaim-migrate @ 3299]
Sean Egan <seanegan@gmail.com>
parents: 3150
diff changeset
485 tmp.gc = gc;
941eb47c5bd4 [gaim-migrate @ 3299]
Sean Egan <seanegan@gmail.com>
parents: 3150
diff changeset
486 tmp.who = normalize(who);
941eb47c5bd4 [gaim-migrate @ 3299]
Sean Egan <seanegan@gmail.com>
parents: 3150
diff changeset
487 tmp.data=NULL;
941eb47c5bd4 [gaim-migrate @ 3299]
Sean Egan <seanegan@gmail.com>
parents: 3150
diff changeset
488 tmp.len = 0;
941eb47c5bd4 [gaim-migrate @ 3299]
Sean Egan <seanegan@gmail.com>
parents: 3150
diff changeset
489 l = g_list_find_custom(icons, &tmp, find_icon_data);
941eb47c5bd4 [gaim-migrate @ 3299]
Sean Egan <seanegan@gmail.com>
parents: 3150
diff changeset
490 id = l ? l->data : NULL;
2191
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
491
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
492 if (id) {
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
493 g_free(id->data);
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
494 if (!data) {
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
495 icons = g_list_remove(icons, id);
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
496 g_free(id->who);
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
497 g_free(id);
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
498 return;
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
499 }
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
500 } else if (data) {
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
501 id = g_new0(struct icon_data, 1);
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
502 icons = g_list_append(icons, id);
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
503 id->gc = gc;
2718
757688c301b5 [gaim-migrate @ 2731]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2662
diff changeset
504 id->who = g_strdup(normalize(who));
2191
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
505 } else {
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
506 return;
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
507 }
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
508
2284
83c7123e5a7e [gaim-migrate @ 2294]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2279
diff changeset
509 debug_printf("Got icon for %s (length %d)\n", who, len);
83c7123e5a7e [gaim-migrate @ 2294]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2279
diff changeset
510
2191
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
511 id->data = g_memdup(data, len);
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
512 id->len = len;
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
513
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
514 got_new_icon(gc, who);
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
515 }
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
516
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
517 void remove_icon_data(struct gaim_connection *gc)
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
518 {
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
519 GList *list = icons;
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
520 struct icon_data *id;
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
521
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
522 while (list) {
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
523 id = list->data;
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
524 if (id->gc == gc) {
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
525 g_free(id->data);
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
526 g_free(id->who);
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
527 list = icons = g_list_remove(icons, id);
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
528 g_free(id);
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
529 } else
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
530 list = list->next;
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
531 }
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
532 }
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
533
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
534 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
535 {
2718
757688c301b5 [gaim-migrate @ 2731]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2662
diff changeset
536 struct icon_data tmp = { gc, normalize(who), NULL, 0 };
2191
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
537 GList *l = g_list_find_custom(icons, &tmp, find_icon_data);
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
538 struct icon_data *id = l ? l->data : NULL;
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
539
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
540 if (id) {
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
541 *len = id->len;
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
542 return id->data;
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
543 }
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
544
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
545 *len = 0;
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
546 return NULL;
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2189
diff changeset
547 }
2582
5efa8077107f [gaim-migrate @ 2595]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2558
diff changeset
548
5efa8077107f [gaim-migrate @ 2595]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2558
diff changeset
549 struct got_add {
5efa8077107f [gaim-migrate @ 2595]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2558
diff changeset
550 struct gaim_connection *gc;
5efa8077107f [gaim-migrate @ 2595]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2558
diff changeset
551 char *who;
5efa8077107f [gaim-migrate @ 2595]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2558
diff changeset
552 char *alias;
5efa8077107f [gaim-migrate @ 2595]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2558
diff changeset
553 };
5efa8077107f [gaim-migrate @ 2595]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2558
diff changeset
554
5efa8077107f [gaim-migrate @ 2595]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2558
diff changeset
555 static void dont_add(gpointer x, struct got_add *ga)
5efa8077107f [gaim-migrate @ 2595]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2558
diff changeset
556 {
5efa8077107f [gaim-migrate @ 2595]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2558
diff changeset
557 g_free(ga->who);
5efa8077107f [gaim-migrate @ 2595]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2558
diff changeset
558 if (ga->alias)
5efa8077107f [gaim-migrate @ 2595]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2558
diff changeset
559 g_free(ga->alias);
5efa8077107f [gaim-migrate @ 2595]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2558
diff changeset
560 g_free(ga);
5efa8077107f [gaim-migrate @ 2595]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2558
diff changeset
561 }
5efa8077107f [gaim-migrate @ 2595]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2558
diff changeset
562
5efa8077107f [gaim-migrate @ 2595]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2558
diff changeset
563 static void do_add(gpointer x, struct got_add *ga)
5efa8077107f [gaim-migrate @ 2595]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2558
diff changeset
564 {
2585
4424c670021d [gaim-migrate @ 2598]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2582
diff changeset
565 if (g_slist_find(connections, ga->gc))
4424c670021d [gaim-migrate @ 2598]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2582
diff changeset
566 show_add_buddy(ga->gc, ga->who, NULL, ga->alias);
2582
5efa8077107f [gaim-migrate @ 2595]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2558
diff changeset
567 }
5efa8077107f [gaim-migrate @ 2595]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2558
diff changeset
568
5efa8077107f [gaim-migrate @ 2595]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2558
diff changeset
569 void show_got_added(struct gaim_connection *gc, const char *id,
5efa8077107f [gaim-migrate @ 2595]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2558
diff changeset
570 const char *who, const char *alias, const char *msg)
5efa8077107f [gaim-migrate @ 2595]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2558
diff changeset
571 {
5efa8077107f [gaim-migrate @ 2595]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2558
diff changeset
572 char buf[BUF_LONG];
5efa8077107f [gaim-migrate @ 2595]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2558
diff changeset
573 struct got_add *ga = g_new0(struct got_add, 1);
5efa8077107f [gaim-migrate @ 2595]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2558
diff changeset
574
5efa8077107f [gaim-migrate @ 2595]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2558
diff changeset
575 ga->gc = gc;
5efa8077107f [gaim-migrate @ 2595]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2558
diff changeset
576 ga->who = g_strdup(who);
5efa8077107f [gaim-migrate @ 2595]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2558
diff changeset
577 ga->alias = alias ? g_strdup(alias) : NULL;
5efa8077107f [gaim-migrate @ 2595]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2558
diff changeset
578
3150
0097f5462ac2 [gaim-migrate @ 3166]
Sean Egan <seanegan@gmail.com>
parents: 3037
diff changeset
579 g_snprintf(buf, sizeof(buf), _("%s%s%s%s has made %s his or her buddy%s%s%s"),
2582
5efa8077107f [gaim-migrate @ 2595]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2558
diff changeset
580 who,
5efa8077107f [gaim-migrate @ 2595]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2558
diff changeset
581 alias ? " (" : "",
5efa8077107f [gaim-migrate @ 2595]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2558
diff changeset
582 alias ? alias : "",
5efa8077107f [gaim-migrate @ 2595]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2558
diff changeset
583 alias ? ")" : "",
5efa8077107f [gaim-migrate @ 2595]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2558
diff changeset
584 id ? id : gc->displayname[0] ? gc->displayname : gc->username,
5efa8077107f [gaim-migrate @ 2595]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2558
diff changeset
585 msg ? ": " : ".",
5efa8077107f [gaim-migrate @ 2595]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2558
diff changeset
586 msg ? msg : "",
3150
0097f5462ac2 [gaim-migrate @ 3166]
Sean Egan <seanegan@gmail.com>
parents: 3037
diff changeset
587 find_buddy(gc, ga->who) ? "" : _("\n\nDo you wish to add him or her to your buddy list?"));
2582
5efa8077107f [gaim-migrate @ 2595]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2558
diff changeset
588 if (find_buddy(gc, ga->who))
3427
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3390
diff changeset
589 do_error_dialog(buf, NULL, GAIM_INFO);
2582
5efa8077107f [gaim-migrate @ 2595]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2558
diff changeset
590 else
5efa8077107f [gaim-migrate @ 2595]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2558
diff changeset
591 do_ask_dialog(buf, ga, do_add, dont_add);
5efa8077107f [gaim-migrate @ 2595]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2558
diff changeset
592 }
2827
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
593
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
594 static GtkWidget *regdlg = NULL;
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
595 static GtkWidget *reg_list = NULL;
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
596 static GtkWidget *reg_area = NULL;
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
597 static GtkWidget *reg_reg = NULL;
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
598
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
599 static void delete_regdlg()
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
600 {
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
601 GtkWidget *tmp = regdlg;
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
602 regdlg = NULL;
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
603 if (tmp)
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
604 gtk_widget_destroy(tmp);
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
605 }
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
606
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
607 static void reset_reg_dlg()
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
608 {
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
609 GSList *P = protocols;
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
610
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
611 if (!regdlg)
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
612 return;
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
613
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
614 while (GTK_BOX(reg_list)->children)
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
615 gtk_container_remove(GTK_CONTAINER(reg_list),
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
616 ((GtkBoxChild *)GTK_BOX(reg_list)->children->data)->widget);
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
617
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
618 while (GTK_BOX(reg_area)->children)
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
619 gtk_container_remove(GTK_CONTAINER(reg_area),
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
620 ((GtkBoxChild *)GTK_BOX(reg_area)->children->data)->widget);
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
621
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
622 while (P) {
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
623 struct prpl *p = P->data;
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
624 if (p->register_user)
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
625 break;
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
626 P = P->next;
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
627 }
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
628
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
629 if (!P) {
2843
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2827
diff changeset
630 GtkWidget *no = gtk_label_new(_("You do not currently have any protocols available"
2827
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
631 " that are able to register new accounts."));
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
632 gtk_box_pack_start(GTK_BOX(reg_area), no, FALSE, FALSE, 5);
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
633 gtk_widget_show(no);
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
634
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
635 gtk_widget_set_sensitive(reg_reg, FALSE);
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
636
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
637 return;
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
638 }
2843
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2827
diff changeset
639
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2827
diff changeset
640 gtk_widget_set_sensitive(reg_reg, TRUE);
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2827
diff changeset
641
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2827
diff changeset
642 while (P) { /* we can safely ignore all the previous ones */
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2827
diff changeset
643 struct prpl *p = P->data;
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2827
diff changeset
644 P = P->next;
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2827
diff changeset
645
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2827
diff changeset
646 if (!p->register_user)
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2827
diff changeset
647 continue;
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2827
diff changeset
648
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2827
diff changeset
649 /* do stuff */
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2827
diff changeset
650 }
2827
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
651 }
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
652
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
653 void register_dialog()
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
654 {
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
655 /* this is just one big hack */
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
656 GtkWidget *vbox;
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
657 GtkWidget *frame;
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
658 GtkWidget *hbox;
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
659 GtkWidget *close;
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
660
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
661 if (regdlg) {
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
662 gdk_window_raise(regdlg->window);
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
663 return;
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
664 }
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
665
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
666 regdlg = gtk_window_new(GTK_WINDOW_TOPLEVEL);
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
667 gtk_window_set_title(GTK_WINDOW(regdlg), _("Gaim - Registration"));
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
668 gtk_window_set_wmclass(GTK_WINDOW(regdlg), "register", "Gaim");
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
669 gtk_widget_realize(regdlg);
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
670 gtk_signal_connect(GTK_OBJECT(regdlg), "destroy", GTK_SIGNAL_FUNC(delete_regdlg), NULL);
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
671
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
672 vbox = gtk_vbox_new(FALSE, 5);
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
673 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
674 gtk_container_add(GTK_CONTAINER(regdlg), vbox);
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
675 gtk_widget_show(vbox);
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
676
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
677 reg_list = gtk_hbox_new(FALSE, 5);
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
678 gtk_box_pack_start(GTK_BOX(vbox), reg_list, FALSE, FALSE, 5);
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
679 gtk_widget_show(reg_list);
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
680
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
681 frame = gtk_frame_new(_("Registration Information"));
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
682 gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 5);
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
683 gtk_widget_show(frame);
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
684
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
685 reg_area = gtk_hbox_new(FALSE, 5);
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
686 gtk_container_add(GTK_CONTAINER(frame), reg_area);
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
687 gtk_widget_show(reg_area);
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
688
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
689 hbox = gtk_hbox_new(FALSE, 5);
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
690 gtk_box_pack_end(GTK_BOX(vbox), hbox, FALSE, FALSE, 5);
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
691 gtk_widget_show(hbox);
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
692
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
693 close = picture_button(regdlg, _("Close"), cancel_xpm);
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
694 gtk_box_pack_end(GTK_BOX(hbox), close, FALSE, FALSE, 5);
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
695 gtk_signal_connect(GTK_OBJECT(close), "clicked", GTK_SIGNAL_FUNC(delete_regdlg), NULL);
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
696 gtk_widget_show(close);
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
697
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
698 reg_reg = picture_button(regdlg, _("Register"), ok_xpm);
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
699 gtk_box_pack_end(GTK_BOX(hbox), reg_reg, FALSE, FALSE, 5);
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
700 gtk_widget_show(reg_reg);
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
701
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
702 /* fuck me */
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
703 reset_reg_dlg();
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
704
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
705 gtk_widget_show(regdlg);
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
706 }
3035
0f1766887ddd [gaim-migrate @ 3048]
Rob Flynn <gaim@robflynn.com>
parents: 2843
diff changeset
707
0f1766887ddd [gaim-migrate @ 3048]
Rob Flynn <gaim@robflynn.com>
parents: 2843
diff changeset
708 GSList *add_smiley(GSList *list, char *key, char **xpm, int show)
0f1766887ddd [gaim-migrate @ 3048]
Rob Flynn <gaim@robflynn.com>
parents: 2843
diff changeset
709 {
0f1766887ddd [gaim-migrate @ 3048]
Rob Flynn <gaim@robflynn.com>
parents: 2843
diff changeset
710 struct _prpl_smiley *smiley;
0f1766887ddd [gaim-migrate @ 3048]
Rob Flynn <gaim@robflynn.com>
parents: 2843
diff changeset
711
0f1766887ddd [gaim-migrate @ 3048]
Rob Flynn <gaim@robflynn.com>
parents: 2843
diff changeset
712 smiley = (struct _prpl_smiley *)g_new0(struct _prpl_smiley, 1);
0f1766887ddd [gaim-migrate @ 3048]
Rob Flynn <gaim@robflynn.com>
parents: 2843
diff changeset
713 smiley->key = g_strdup(key);
0f1766887ddd [gaim-migrate @ 3048]
Rob Flynn <gaim@robflynn.com>
parents: 2843
diff changeset
714 smiley->xpm = xpm;
0f1766887ddd [gaim-migrate @ 3048]
Rob Flynn <gaim@robflynn.com>
parents: 2843
diff changeset
715 smiley->show = show;
0f1766887ddd [gaim-migrate @ 3048]
Rob Flynn <gaim@robflynn.com>
parents: 2843
diff changeset
716 list = g_slist_append(list, smiley);
0f1766887ddd [gaim-migrate @ 3048]
Rob Flynn <gaim@robflynn.com>
parents: 2843
diff changeset
717
0f1766887ddd [gaim-migrate @ 3048]
Rob Flynn <gaim@robflynn.com>
parents: 2843
diff changeset
718 return list;
0f1766887ddd [gaim-migrate @ 3048]
Rob Flynn <gaim@robflynn.com>
parents: 2843
diff changeset
719 }