Mercurial > pidgin
annotate src/prpl.c @ 1352:2e8213567278
[gaim-migrate @ 1362]
Blah Blah Blah :)
The cute grey/non grey stuff works better and is less crashy
committer: Tailor Script <tailor@pidgin.im>
author | Rob Flynn <gaim@robflynn.com> |
---|---|
date | Fri, 22 Dec 2000 02:25:28 +0000 |
parents | b332d8f46b84 |
children | 04874e92af24 |
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); |
1210 | 133 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
|
134 |
1210 | 135 hbox = gtk_hbox_new(FALSE, 5); |
136 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
137 | |
138 button = picture_button(window, _("Cancel"), cancel_xpm); | |
139 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
140 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
|
141 |
b0b40b5faede
[gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
142 button = picture_button(window, _("Accept"), ok_xpm); |
1210 | 143 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
|
144 gtk_object_set_user_data(GTK_OBJECT(button), data); |
b0b40b5faede
[gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
145 if (doit) |
b0b40b5faede
[gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
146 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
|
147 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
|
148 |
1210 | 149 gtk_widget_show_all(window); |
1064
b0b40b5faede
[gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
150 } |
1333
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
151 |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
152 static void delete_reg(gpointer a, gpointer b) |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
153 { |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
154 GtkWidget *tmp = regdialog; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
155 if (regdialog) { |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
156 regdialog = NULL; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
157 gtk_widget_destroy(tmp); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
158 } |
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 static void reg_prpl(gpointer a, struct prpl *p) |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
162 { |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
163 while (GTK_BOX(regbox)->children) |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
164 gtk_container_remove(GTK_CONTAINER(regbox), |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
165 ((GtkBoxChild *)GTK_BOX(regbox)->children->data)->widget); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
166 regprpl = p; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
167 (*regprpl->draw_new_user)(regbox); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
168 } |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
169 |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
170 static void do_reg(gpointer a, gpointer b) |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
171 { |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
172 if (regprpl->do_new_user) |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
173 (*regprpl->do_new_user)(); |
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 |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
176 void register_user(gpointer a, gpointer b) |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
177 { |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
178 GSList *pr = protocols; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
179 struct prpl *p = NULL, *q; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
180 GtkWidget *box; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
181 GtkWidget *frame; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
182 GtkWidget *vbox; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
183 GtkWidget *hbox; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
184 GtkWidget *label; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
185 GtkWidget *optmenu; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
186 GtkWidget *menu; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
187 GtkWidget *opt; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
188 GtkWidget *button; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
189 |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
190 if (regdialog) |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
191 return; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
192 |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
193 while (pr) { |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
194 p = pr->data; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
195 if (p->draw_new_user) |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
196 break; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
197 pr = pr->next; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
198 p = NULL; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
199 } |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
200 if (p == NULL) |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
201 /* this should never happen because I said so. Hi mom. */ |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
202 return; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
203 pr = protocols; |
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 regdialog = gtk_window_new(GTK_WINDOW_TOPLEVEL); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
206 gtk_window_set_wmclass(GTK_WINDOW(regdialog), "registration", "Gaim"); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
207 gtk_container_set_border_width(GTK_CONTAINER(regdialog), 5); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
208 gtk_window_set_title(GTK_WINDOW(regdialog), _("Gaim - New User Registration")); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
209 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
|
210 gtk_widget_realize(regdialog); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
211 aol_icon(regdialog->window); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
212 |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
213 box = gtk_vbox_new(FALSE, 5); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
214 gtk_container_add(GTK_CONTAINER(regdialog), box); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
215 gtk_widget_show(box); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
216 |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
217 frame = gtk_frame_new(_("New User Registration")); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
218 gtk_box_pack_start(GTK_BOX(box), frame, FALSE, FALSE, 5); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
219 gtk_widget_show(frame); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
220 |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
221 vbox = gtk_vbox_new(FALSE, 5); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
222 gtk_container_add(GTK_CONTAINER(frame), vbox); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
223 gtk_widget_show(vbox); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
224 |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
225 hbox = gtk_hbox_new(FALSE, 5); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
226 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
227 gtk_widget_show(hbox); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
228 |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
229 label = gtk_label_new(_("Register new user for")); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
230 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
231 gtk_widget_show(label); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
232 |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
233 optmenu = gtk_option_menu_new(); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
234 gtk_box_pack_start(GTK_BOX(hbox), optmenu, FALSE, FALSE, 5); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
235 gtk_widget_show(optmenu); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
236 |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
237 menu = gtk_menu_new(); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
238 |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
239 while (pr) { |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
240 q = pr->data; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
241 if (q->draw_new_user) { |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
242 opt = gtk_menu_item_new_with_label((*q->name)()); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
243 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
|
244 gtk_menu_append(GTK_MENU(menu), opt); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
245 gtk_widget_show(opt); |
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 pr = pr->next; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
248 } |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
249 |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
250 gtk_option_menu_set_menu(GTK_OPTION_MENU(optmenu), menu); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
251 gtk_option_menu_set_history(GTK_OPTION_MENU(optmenu), 0); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
252 regprpl = p; |
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 regbox = gtk_vbox_new(FALSE, 5); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
255 gtk_box_pack_start(GTK_BOX(vbox), regbox, FALSE, FALSE, 5); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
256 gtk_widget_show(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 (*regprpl->draw_new_user)(regbox); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
259 |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
260 hbox = gtk_hbox_new(FALSE, 5); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
261 gtk_box_pack_end(GTK_BOX(box), hbox, FALSE, FALSE, 5); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
262 gtk_widget_show(hbox); |
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 button = picture_button(regdialog, _("Close"), close_xpm); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
265 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 5); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
266 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
|
267 |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
268 button = picture_button(regdialog, _("Register"), register_xpm); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
269 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 5); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
270 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
|
271 |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
272 gtk_widget_show(regdialog); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
273 } |