Mercurial > pidgin
annotate src/prpl.c @ 1387:595a844dbe0b
[gaim-migrate @ 1397]
I'm bored.
committer: Tailor Script <tailor@pidgin.im>
author | Rob Flynn <gaim@robflynn.com> |
---|---|
date | Fri, 05 Jan 2001 09:07:49 +0000 |
parents | 638af9a58e39 |
children | f6a9bd50fd19 |
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" | |
1000
91b7377e7b45
[gaim-migrate @ 1010]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
23 |
1064
b0b40b5faede
[gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
24 #include "pixmaps/ok.xpm" |
b0b40b5faede
[gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
25 #include "pixmaps/cancel.xpm" |
1333
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
26 #include "pixmaps/close.xpm" |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
27 #include "pixmaps/register.xpm" |
1064
b0b40b5faede
[gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
28 |
1000
91b7377e7b45
[gaim-migrate @ 1010]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
29 extern void toc_init(struct prpl *); |
91b7377e7b45
[gaim-migrate @ 1010]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
30 extern void oscar_init(struct prpl *); |
981 | 31 |
32 GSList *protocols = NULL; | |
33 | |
1333
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
34 static GtkWidget *regdialog = NULL; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
35 static GtkWidget *regbox = NULL; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
36 static struct prpl *regprpl = NULL; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
37 |
981 | 38 struct prpl *find_prpl(int prot) |
39 { | |
40 GSList *e = protocols; | |
41 struct prpl *r; | |
42 | |
43 while (e) { | |
44 r = (struct prpl *)e->data; | |
45 if (r->protocol == prot) | |
46 return r; | |
47 e = e->next; | |
48 } | |
49 | |
50 return NULL; | |
51 } | |
52 | |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
53 static gint proto_compare(struct prpl *a, struct prpl *b) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
54 { |
1043
1528d05b3e6b
[gaim-migrate @ 1053]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1040
diff
changeset
|
55 /* 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
|
56 return a->protocol - b->protocol; |
1528d05b3e6b
[gaim-migrate @ 1053]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1040
diff
changeset
|
57 } |
1528d05b3e6b
[gaim-migrate @ 1053]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1040
diff
changeset
|
58 |
1000
91b7377e7b45
[gaim-migrate @ 1010]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
59 void load_protocol(proto_init pi) |
91b7377e7b45
[gaim-migrate @ 1010]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
60 { |
91b7377e7b45
[gaim-migrate @ 1010]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
61 struct prpl *p = g_new0(struct prpl, 1); |
1040
17cea517fd90
[gaim-migrate @ 1050]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1000
diff
changeset
|
62 struct prpl *old; |
1000
91b7377e7b45
[gaim-migrate @ 1010]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
63 pi(p); |
1057
d50d3abb9eb7
[gaim-migrate @ 1067]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1047
diff
changeset
|
64 if ((old = find_prpl(p->protocol)) == NULL) |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1043
diff
changeset
|
65 unload_protocol(old); |
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1043
diff
changeset
|
66 protocols = g_slist_insert_sorted(protocols, p, (GCompareFunc)proto_compare); |
1333
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
67 if (regdialog) |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
68 gtk_widget_destroy(regdialog); |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1043
diff
changeset
|
69 } |
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1043
diff
changeset
|
70 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
71 void unload_protocol(struct prpl *p) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
72 { |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1043
diff
changeset
|
73 GSList *c = connections; |
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1043
diff
changeset
|
74 struct gaim_connection *g; |
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1043
diff
changeset
|
75 while (c) { |
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1043
diff
changeset
|
76 g = (struct gaim_connection *)c->data; |
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1043
diff
changeset
|
77 if (g->prpl == p) { |
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1043
diff
changeset
|
78 char buf[256]; |
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1043
diff
changeset
|
79 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
|
80 " %s is now offline."), g->username, |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
81 (*p->name)(), g->username); |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1043
diff
changeset
|
82 do_error_dialog(buf, _("Disconnect")); |
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1043
diff
changeset
|
83 signoff(g); |
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1043
diff
changeset
|
84 c = connections; |
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1043
diff
changeset
|
85 } else |
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1043
diff
changeset
|
86 c = c->next; |
1040
17cea517fd90
[gaim-migrate @ 1050]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1000
diff
changeset
|
87 } |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1043
diff
changeset
|
88 protocols = g_slist_remove(protocols, p); |
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1043
diff
changeset
|
89 g_free(p); |
1000
91b7377e7b45
[gaim-migrate @ 1010]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
90 } |
91b7377e7b45
[gaim-migrate @ 1010]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
91 |
981 | 92 void static_proto_init() |
93 { | |
1000
91b7377e7b45
[gaim-migrate @ 1010]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
94 load_protocol(toc_init); |
91b7377e7b45
[gaim-migrate @ 1010]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
95 load_protocol(oscar_init); |
981 | 96 } |
1064
b0b40b5faede
[gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
97 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
98 static void des_win(GtkWidget *a, GtkWidget *b) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
99 { |
1064
b0b40b5faede
[gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
100 gtk_widget_destroy(b); |
b0b40b5faede
[gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
101 } |
b0b40b5faede
[gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
102 |
1333
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
103 static void rem_win(GtkWidget *a, GtkWidget *b) |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
104 { |
1333
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
105 void *d = gtk_object_get_user_data(GTK_OBJECT(a)); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
106 if (d) |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
107 gtk_signal_disconnect_by_data(GTK_OBJECT(b), d); |
1064
b0b40b5faede
[gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
108 gtk_widget_destroy(b); |
b0b40b5faede
[gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
109 } |
b0b40b5faede
[gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
110 |
b0b40b5faede
[gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
111 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
|
112 { |
b0b40b5faede
[gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
113 GtkWidget *window; |
1210 | 114 GtkWidget *vbox; |
1064
b0b40b5faede
[gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
115 GtkWidget *label; |
b0b40b5faede
[gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
116 GtkWidget *hbox; |
b0b40b5faede
[gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
117 GtkWidget *button; |
b0b40b5faede
[gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
118 |
b0b40b5faede
[gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
119 window = gtk_window_new(GTK_WINDOW_DIALOG); |
b0b40b5faede
[gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
120 gtk_window_set_wmclass(GTK_WINDOW(window), "accept", "Gaim"); |
1210 | 121 gtk_window_set_policy(GTK_WINDOW(window), FALSE, TRUE, TRUE); |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
122 gtk_window_set_title(GTK_WINDOW(window), _("Accept?")); |
1064
b0b40b5faede
[gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
123 gtk_widget_realize(window); |
b0b40b5faede
[gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
124 aol_icon(window->window); |
b0b40b5faede
[gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
125 if (dont) |
b0b40b5faede
[gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
126 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
|
127 |
1210 | 128 vbox = gtk_vbox_new(FALSE, 5); |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
129 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); |
1210 | 130 gtk_container_add(GTK_CONTAINER(window), vbox); |
1064
b0b40b5faede
[gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
131 |
b0b40b5faede
[gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
132 label = gtk_label_new(text); |
1380
638af9a58e39
[gaim-migrate @ 1390]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1355
diff
changeset
|
133 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); |
1210 | 134 gtk_box_pack_start(GTK_BOX(vbox), label, TRUE, TRUE, 0); |
1064
b0b40b5faede
[gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
135 |
1210 | 136 hbox = gtk_hbox_new(FALSE, 5); |
137 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
138 | |
139 button = picture_button(window, _("Cancel"), cancel_xpm); | |
140 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
141 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
|
142 |
b0b40b5faede
[gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
143 button = picture_button(window, _("Accept"), ok_xpm); |
1210 | 144 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0); |
1064
b0b40b5faede
[gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
145 gtk_object_set_user_data(GTK_OBJECT(button), data); |
b0b40b5faede
[gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
146 if (doit) |
b0b40b5faede
[gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
147 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
|
148 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
|
149 |
1210 | 150 gtk_widget_show_all(window); |
1064
b0b40b5faede
[gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
151 } |
1333
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
152 |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
153 static void delete_reg(gpointer a, gpointer b) |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
154 { |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
155 GtkWidget *tmp = regdialog; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
156 if (regdialog) { |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
157 regdialog = NULL; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
158 gtk_widget_destroy(tmp); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
159 } |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
160 } |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
161 |
1355
04874e92af24
[gaim-migrate @ 1365]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1333
diff
changeset
|
162 void prepare_regbox_for_next() |
1333
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
163 { |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
164 while (GTK_BOX(regbox)->children) |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
165 gtk_container_remove(GTK_CONTAINER(regbox), |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
166 ((GtkBoxChild *)GTK_BOX(regbox)->children->data)->widget); |
1355
04874e92af24
[gaim-migrate @ 1365]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1333
diff
changeset
|
167 } |
04874e92af24
[gaim-migrate @ 1365]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1333
diff
changeset
|
168 |
04874e92af24
[gaim-migrate @ 1365]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1333
diff
changeset
|
169 static void reg_prpl(gpointer a, struct prpl *p) |
04874e92af24
[gaim-migrate @ 1365]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1333
diff
changeset
|
170 { |
1333
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
171 regprpl = p; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
172 (*regprpl->draw_new_user)(regbox); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
173 } |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
174 |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
175 static void do_reg(gpointer a, gpointer b) |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
176 { |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
177 if (regprpl->do_new_user) |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
178 (*regprpl->do_new_user)(); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
179 } |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
180 |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
181 void register_user(gpointer a, gpointer b) |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
182 { |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
183 GSList *pr = protocols; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
184 struct prpl *p = NULL, *q; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
185 GtkWidget *box; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
186 GtkWidget *frame; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
187 GtkWidget *vbox; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
188 GtkWidget *hbox; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
189 GtkWidget *label; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
190 GtkWidget *optmenu; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
191 GtkWidget *menu; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
192 GtkWidget *opt; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
193 GtkWidget *button; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
194 |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
195 if (regdialog) |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
196 return; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
197 |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
198 while (pr) { |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
199 p = pr->data; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
200 if (p->draw_new_user) |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
201 break; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
202 pr = pr->next; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
203 p = NULL; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
204 } |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
205 if (p == NULL) |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
206 /* this should never happen because I said so. Hi mom. */ |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
207 return; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
208 pr = protocols; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
209 |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
210 regdialog = gtk_window_new(GTK_WINDOW_TOPLEVEL); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
211 gtk_window_set_wmclass(GTK_WINDOW(regdialog), "registration", "Gaim"); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
212 gtk_container_set_border_width(GTK_CONTAINER(regdialog), 5); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
213 gtk_window_set_title(GTK_WINDOW(regdialog), _("Gaim - New User Registration")); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
214 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
|
215 gtk_widget_realize(regdialog); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
216 aol_icon(regdialog->window); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
217 |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
218 box = gtk_vbox_new(FALSE, 5); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
219 gtk_container_add(GTK_CONTAINER(regdialog), box); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
220 gtk_widget_show(box); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
221 |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
222 frame = gtk_frame_new(_("New User Registration")); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
223 gtk_box_pack_start(GTK_BOX(box), frame, FALSE, FALSE, 5); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
224 gtk_widget_show(frame); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
225 |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
226 vbox = gtk_vbox_new(FALSE, 5); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
227 gtk_container_add(GTK_CONTAINER(frame), vbox); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
228 gtk_widget_show(vbox); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
229 |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
230 hbox = gtk_hbox_new(FALSE, 5); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
231 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
232 gtk_widget_show(hbox); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
233 |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
234 label = gtk_label_new(_("Register new user for")); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
235 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
236 gtk_widget_show(label); |
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 optmenu = gtk_option_menu_new(); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
239 gtk_box_pack_start(GTK_BOX(hbox), optmenu, FALSE, FALSE, 5); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
240 gtk_widget_show(optmenu); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
241 |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
242 menu = gtk_menu_new(); |
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 while (pr) { |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
245 q = pr->data; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
246 if (q->draw_new_user) { |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
247 opt = gtk_menu_item_new_with_label((*q->name)()); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
248 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
|
249 gtk_menu_append(GTK_MENU(menu), opt); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
250 gtk_widget_show(opt); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
251 } |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
252 pr = pr->next; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
253 } |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
254 |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
255 gtk_option_menu_set_menu(GTK_OPTION_MENU(optmenu), menu); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
256 gtk_option_menu_set_history(GTK_OPTION_MENU(optmenu), 0); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
257 regprpl = p; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
258 |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
259 regbox = gtk_vbox_new(FALSE, 5); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
260 gtk_box_pack_start(GTK_BOX(vbox), regbox, FALSE, FALSE, 5); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
261 gtk_widget_show(regbox); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
262 |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
263 (*regprpl->draw_new_user)(regbox); |
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 hbox = gtk_hbox_new(FALSE, 5); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
266 gtk_box_pack_end(GTK_BOX(box), hbox, FALSE, FALSE, 5); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
267 gtk_widget_show(hbox); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
268 |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
269 button = picture_button(regdialog, _("Close"), close_xpm); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
270 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 5); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
271 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
|
272 |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
273 button = picture_button(regdialog, _("Register"), register_xpm); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
274 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 5); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
275 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
|
276 |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
277 gtk_widget_show(regdialog); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
278 } |