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