annotate src/prpl.c @ 3061:9349de0706e6

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