Mercurial > pidgin.yaz
annotate src/prpl.c @ 2054:e339de749a08
[gaim-migrate @ 2064]
i love a good competition.
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Sun, 17 Jun 2001 21:42:28 +0000 |
parents | ddd696ccb46b |
children | 424a40f12a6c |
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 |
1000
91b7377e7b45
[gaim-migrate @ 1010]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
31 extern void toc_init(struct prpl *); |
91b7377e7b45
[gaim-migrate @ 1010]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
32 extern void oscar_init(struct prpl *); |
981 | 33 |
34 GSList *protocols = NULL; | |
35 | |
1333
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
36 static GtkWidget *regdialog = NULL; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
37 static GtkWidget *regbox = NULL; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
38 static struct prpl *regprpl = NULL; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
39 |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
40 GtkWidget *protomenu = NULL; |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
41 |
1500
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
42 struct _prompt { |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
43 GtkWidget *window; |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
44 GtkWidget *entry; |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
45 void (*doit)(void *, char *); |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
46 void (*dont)(void *); |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
47 void *data; |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
48 }; |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
49 |
981 | 50 struct prpl *find_prpl(int prot) |
51 { | |
52 GSList *e = protocols; | |
53 struct prpl *r; | |
54 | |
55 while (e) { | |
56 r = (struct prpl *)e->data; | |
57 if (r->protocol == prot) | |
58 return r; | |
59 e = e->next; | |
60 } | |
61 | |
62 return NULL; | |
63 } | |
64 | |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
65 static gint proto_compare(struct prpl *a, struct prpl *b) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
66 { |
1043
1528d05b3e6b
[gaim-migrate @ 1053]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1040
diff
changeset
|
67 /* 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
|
68 return a->protocol - b->protocol; |
1528d05b3e6b
[gaim-migrate @ 1053]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1040
diff
changeset
|
69 } |
1528d05b3e6b
[gaim-migrate @ 1053]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1040
diff
changeset
|
70 |
1443
336fc98b7f90
[gaim-migrate @ 1453]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1436
diff
changeset
|
71 void load_protocol(proto_init pi, int size) |
1000
91b7377e7b45
[gaim-migrate @ 1010]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
72 { |
1443
336fc98b7f90
[gaim-migrate @ 1453]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1436
diff
changeset
|
73 struct prpl *p; |
1040
17cea517fd90
[gaim-migrate @ 1050]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1000
diff
changeset
|
74 struct prpl *old; |
1443
336fc98b7f90
[gaim-migrate @ 1453]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1436
diff
changeset
|
75 if (size != sizeof(struct prpl)) { |
336fc98b7f90
[gaim-migrate @ 1453]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1436
diff
changeset
|
76 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
|
77 " from the same version of the source as this application was." |
336fc98b7f90
[gaim-migrate @ 1453]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1436
diff
changeset
|
78 " Unfortunately, because it is not the same version I cannot" |
336fc98b7f90
[gaim-migrate @ 1453]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1436
diff
changeset
|
79 " 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
|
80 " successfully loaded."), _("Protocol Error")); |
336fc98b7f90
[gaim-migrate @ 1453]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1436
diff
changeset
|
81 return; |
336fc98b7f90
[gaim-migrate @ 1453]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1436
diff
changeset
|
82 } |
336fc98b7f90
[gaim-migrate @ 1453]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1436
diff
changeset
|
83 p = g_new0(struct prpl, 1); |
1000
91b7377e7b45
[gaim-migrate @ 1010]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
84 pi(p); |
1057
d50d3abb9eb7
[gaim-migrate @ 1067]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1047
diff
changeset
|
85 if ((old = find_prpl(p->protocol)) == NULL) |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1043
diff
changeset
|
86 unload_protocol(old); |
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1043
diff
changeset
|
87 protocols = g_slist_insert_sorted(protocols, p, (GCompareFunc)proto_compare); |
1333
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
88 if (regdialog) |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
89 gtk_widget_destroy(regdialog); |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1043
diff
changeset
|
90 } |
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1043
diff
changeset
|
91 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
92 void unload_protocol(struct prpl *p) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
93 { |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1043
diff
changeset
|
94 GSList *c = connections; |
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1043
diff
changeset
|
95 struct gaim_connection *g; |
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1043
diff
changeset
|
96 while (c) { |
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1043
diff
changeset
|
97 g = (struct gaim_connection *)c->data; |
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1043
diff
changeset
|
98 if (g->prpl == p) { |
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1043
diff
changeset
|
99 char buf[256]; |
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1043
diff
changeset
|
100 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
|
101 " %s is now offline."), g->username, |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
102 (*p->name)(), g->username); |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1043
diff
changeset
|
103 do_error_dialog(buf, _("Disconnect")); |
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1043
diff
changeset
|
104 signoff(g); |
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1043
diff
changeset
|
105 c = connections; |
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1043
diff
changeset
|
106 } else |
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1043
diff
changeset
|
107 c = c->next; |
1040
17cea517fd90
[gaim-migrate @ 1050]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1000
diff
changeset
|
108 } |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1043
diff
changeset
|
109 protocols = g_slist_remove(protocols, p); |
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1043
diff
changeset
|
110 g_free(p); |
1000
91b7377e7b45
[gaim-migrate @ 1010]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
111 } |
91b7377e7b45
[gaim-migrate @ 1010]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
112 |
981 | 113 void static_proto_init() |
114 { | |
1443
336fc98b7f90
[gaim-migrate @ 1453]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1436
diff
changeset
|
115 load_protocol(toc_init, sizeof(struct prpl)); |
336fc98b7f90
[gaim-migrate @ 1453]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1436
diff
changeset
|
116 load_protocol(oscar_init, sizeof(struct prpl)); |
981 | 117 } |
1064
b0b40b5faede
[gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
118 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
119 static void des_win(GtkWidget *a, GtkWidget *b) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
120 { |
1064
b0b40b5faede
[gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
121 gtk_widget_destroy(b); |
b0b40b5faede
[gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
122 } |
b0b40b5faede
[gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
123 |
1333
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
124 static void rem_win(GtkWidget *a, GtkWidget *b) |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
125 { |
1333
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
126 void *d = gtk_object_get_user_data(GTK_OBJECT(a)); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
127 if (d) |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
128 gtk_signal_disconnect_by_data(GTK_OBJECT(b), d); |
1064
b0b40b5faede
[gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
129 gtk_widget_destroy(b); |
b0b40b5faede
[gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
130 } |
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 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
|
133 { |
b0b40b5faede
[gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
134 GtkWidget *window; |
1210 | 135 GtkWidget *vbox; |
1064
b0b40b5faede
[gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
136 GtkWidget *label; |
b0b40b5faede
[gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
137 GtkWidget *hbox; |
b0b40b5faede
[gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
138 GtkWidget *button; |
b0b40b5faede
[gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
139 |
b0b40b5faede
[gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
140 window = gtk_window_new(GTK_WINDOW_DIALOG); |
b0b40b5faede
[gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
141 gtk_window_set_wmclass(GTK_WINDOW(window), "accept", "Gaim"); |
1210 | 142 gtk_window_set_policy(GTK_WINDOW(window), FALSE, TRUE, TRUE); |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
143 gtk_window_set_title(GTK_WINDOW(window), _("Accept?")); |
1064
b0b40b5faede
[gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
144 gtk_widget_realize(window); |
b0b40b5faede
[gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
145 aol_icon(window->window); |
b0b40b5faede
[gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
146 if (dont) |
b0b40b5faede
[gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
147 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
|
148 |
1210 | 149 vbox = gtk_vbox_new(FALSE, 5); |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
150 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); |
1210 | 151 gtk_container_add(GTK_CONTAINER(window), vbox); |
1064
b0b40b5faede
[gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
152 |
b0b40b5faede
[gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
153 label = gtk_label_new(text); |
1210 | 154 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
|
155 |
1210 | 156 hbox = gtk_hbox_new(FALSE, 5); |
157 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
158 | |
159 button = picture_button(window, _("Cancel"), cancel_xpm); | |
160 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
161 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
|
162 |
b0b40b5faede
[gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
163 button = picture_button(window, _("Accept"), ok_xpm); |
1210 | 164 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
|
165 if (dont) |
948a67a691a6
[gaim-migrate @ 2017]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1536
diff
changeset
|
166 gtk_object_set_user_data(GTK_OBJECT(button), data); |
1064
b0b40b5faede
[gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
167 if (doit) |
b0b40b5faede
[gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
168 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
|
169 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
|
170 |
1210 | 171 gtk_widget_show_all(window); |
1064
b0b40b5faede
[gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
172 } |
1333
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
173 |
1500
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
174 static void des_prompt(GtkWidget *w, struct _prompt *p) |
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 if (p->dont) |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
177 (p->dont)(p->data); |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
178 gtk_widget_destroy(p->window); |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
179 g_free(p); |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
180 } |
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 static void act_prompt(GtkWidget *w, struct _prompt *p) |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
183 { |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
184 if (p->doit) |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
185 (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
|
186 gtk_widget_destroy(p->window); |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
187 } |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
188 |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
189 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
|
190 { |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
191 GtkWidget *window; |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
192 GtkWidget *vbox; |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
193 GtkWidget *hbox; |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
194 GtkWidget *label; |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
195 GtkWidget *entry; |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
196 GtkWidget *button; |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
197 struct _prompt *p; |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
198 |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
199 p = g_new0(struct _prompt, 1); |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
200 p->data = data; |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
201 p->doit = doit; |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
202 p->dont = dont; |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
203 |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
204 window = gtk_window_new(GTK_WINDOW_DIALOG); |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
205 p->window = window; |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
206 gtk_window_set_wmclass(GTK_WINDOW(window), "prompt", "Gaim"); |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
207 gtk_window_set_policy(GTK_WINDOW(window), FALSE, TRUE, TRUE); |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
208 gtk_window_set_title(GTK_WINDOW(window), _("Gaim - Prompt")); |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
209 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
|
210 gtk_widget_realize(window); |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
211 aol_icon(window->window); |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
212 |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
213 vbox = gtk_vbox_new(FALSE, 5); |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
214 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
215 gtk_container_add(GTK_CONTAINER(window), vbox); |
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 hbox = gtk_hbox_new(FALSE, 5); |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
218 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
219 |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
220 label = gtk_label_new(text); |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
221 gtk_box_pack_start(GTK_BOX(vbox), label, TRUE, TRUE, 0); |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
222 |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
223 entry = gtk_entry_new(); |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
224 gtk_box_pack_start(GTK_BOX(vbox), entry, FALSE, FALSE, 0); |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
225 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
|
226 p->entry = entry; |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
227 |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
228 hbox = gtk_hbox_new(FALSE, 5); |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
229 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
230 |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
231 button = picture_button(window, _("Cancel"), cancel_xpm); |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
232 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0); |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
233 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
|
234 |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
235 button = picture_button(window, _("Accept"), ok_xpm); |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
236 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0); |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
237 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
|
238 |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
239 gtk_widget_show_all(window); |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
240 } |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
241 |
1333
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
242 static void delete_reg(gpointer a, gpointer b) |
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 GtkWidget *tmp = regdialog; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
245 if (regdialog) { |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
246 regdialog = NULL; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
247 gtk_widget_destroy(tmp); |
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 |
1355
04874e92af24
[gaim-migrate @ 1365]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1333
diff
changeset
|
251 void prepare_regbox_for_next() |
1333
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
252 { |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
253 while (GTK_BOX(regbox)->children) |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
254 gtk_container_remove(GTK_CONTAINER(regbox), |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
255 ((GtkBoxChild *)GTK_BOX(regbox)->children->data)->widget); |
1355
04874e92af24
[gaim-migrate @ 1365]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1333
diff
changeset
|
256 } |
04874e92af24
[gaim-migrate @ 1365]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1333
diff
changeset
|
257 |
04874e92af24
[gaim-migrate @ 1365]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1333
diff
changeset
|
258 static void reg_prpl(gpointer a, struct prpl *p) |
04874e92af24
[gaim-migrate @ 1365]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1333
diff
changeset
|
259 { |
1470
5efd3988e5d3
[gaim-migrate @ 1480]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
260 prepare_regbox_for_next(); |
1333
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
261 regprpl = p; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
262 (*regprpl->draw_new_user)(regbox); |
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 static void do_reg(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 if (regprpl->do_new_user) |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
268 (*regprpl->do_new_user)(); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
269 } |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
270 |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
271 void register_user(gpointer a, gpointer b) |
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 GSList *pr = protocols; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
274 struct prpl *p = NULL, *q; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
275 GtkWidget *box; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
276 GtkWidget *frame; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
277 GtkWidget *vbox; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
278 GtkWidget *hbox; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
279 GtkWidget *label; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
280 GtkWidget *optmenu; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
281 GtkWidget *menu; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
282 GtkWidget *opt; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
283 GtkWidget *button; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
284 |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
285 if (regdialog) |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
286 return; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
287 |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
288 while (pr) { |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
289 p = pr->data; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
290 if (p->draw_new_user) |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
291 break; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
292 pr = pr->next; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
293 p = NULL; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
294 } |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
295 if (p == NULL) |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
296 /* this should never happen because I said so. Hi mom. */ |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
297 return; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
298 pr = protocols; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
299 |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
300 regdialog = gtk_window_new(GTK_WINDOW_TOPLEVEL); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
301 gtk_window_set_wmclass(GTK_WINDOW(regdialog), "registration", "Gaim"); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
302 gtk_container_set_border_width(GTK_CONTAINER(regdialog), 5); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
303 gtk_window_set_title(GTK_WINDOW(regdialog), _("Gaim - New User Registration")); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
304 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
|
305 gtk_widget_realize(regdialog); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
306 aol_icon(regdialog->window); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
307 |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
308 box = gtk_vbox_new(FALSE, 5); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
309 gtk_container_add(GTK_CONTAINER(regdialog), box); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
310 gtk_widget_show(box); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
311 |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
312 frame = gtk_frame_new(_("New User Registration")); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
313 gtk_box_pack_start(GTK_BOX(box), frame, FALSE, FALSE, 5); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
314 gtk_widget_show(frame); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
315 |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
316 vbox = gtk_vbox_new(FALSE, 5); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
317 gtk_container_add(GTK_CONTAINER(frame), vbox); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
318 gtk_widget_show(vbox); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
319 |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
320 hbox = gtk_hbox_new(FALSE, 5); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
321 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
322 gtk_widget_show(hbox); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
323 |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
324 label = gtk_label_new(_("Register new user for")); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
325 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
326 gtk_widget_show(label); |
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 optmenu = gtk_option_menu_new(); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
329 gtk_box_pack_start(GTK_BOX(hbox), optmenu, FALSE, FALSE, 5); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
330 gtk_widget_show(optmenu); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
331 |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
332 menu = gtk_menu_new(); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
333 |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
334 while (pr) { |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
335 q = pr->data; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
336 if (q->draw_new_user) { |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
337 opt = gtk_menu_item_new_with_label((*q->name)()); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
338 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
|
339 gtk_menu_append(GTK_MENU(menu), opt); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
340 gtk_widget_show(opt); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
341 } |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
342 pr = pr->next; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
343 } |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
344 |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
345 gtk_option_menu_set_menu(GTK_OPTION_MENU(optmenu), menu); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
346 gtk_option_menu_set_history(GTK_OPTION_MENU(optmenu), 0); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
347 regprpl = p; |
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 regbox = gtk_vbox_new(FALSE, 5); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
350 gtk_box_pack_start(GTK_BOX(vbox), regbox, FALSE, FALSE, 5); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
351 gtk_widget_show(regbox); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
352 |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
353 (*regprpl->draw_new_user)(regbox); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
354 |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
355 hbox = gtk_hbox_new(FALSE, 5); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
356 gtk_box_pack_end(GTK_BOX(box), hbox, FALSE, FALSE, 5); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
357 gtk_widget_show(hbox); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
358 |
1436
f6a9bd50fd19
[gaim-migrate @ 1446]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1380
diff
changeset
|
359 button = picture_button(regdialog, _("Close"), cancel_xpm); |
1333
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
360 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 5); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
361 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
|
362 |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
363 button = picture_button(regdialog, _("Register"), register_xpm); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
364 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 5); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
365 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
|
366 |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
367 gtk_widget_show(regdialog); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
368 } |
1499
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 static void proto_act(GtkObject *obj, struct gaim_connection *gc) |
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 char *act = gtk_object_get_user_data(obj); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
373 (*gc->prpl->do_action)(gc, act); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
374 } |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
375 |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
376 void do_proto_menu() |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
377 { |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
378 GtkWidget *menuitem; |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
379 GtkWidget *submenu; |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
380 GList *l; |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
381 GSList *c = connections; |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
382 struct gaim_connection *gc = NULL; |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
383 int count = 0; |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
384 char buf[256]; |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
385 |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
386 if (!protomenu) |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
387 return; |
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 l = gtk_container_children(GTK_CONTAINER(protomenu)); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
390 while (l) { |
1530
0b6e4d52de63
[gaim-migrate @ 1540]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1500
diff
changeset
|
391 gtk_container_remove(GTK_CONTAINER(protomenu), GTK_WIDGET(l->data)); |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
392 l = l->next; |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
393 } |
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 while (c) { |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
396 gc = c->data; |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
397 if (gc->prpl->actions && gc->prpl->do_action) |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
398 count++; |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
399 c = g_slist_next(c); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
400 } |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
401 c = connections; |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
402 |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
403 if (!count) { |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
404 g_snprintf(buf, sizeof(buf), "No actions available"); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
405 menuitem = gtk_menu_item_new_with_label(buf); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
406 gtk_menu_append(GTK_MENU(protomenu), menuitem); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
407 gtk_widget_show(menuitem); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
408 return; |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
409 } |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
410 |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
411 if (count == 1) { |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
412 GList *tmp, *act; |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
413 while (c) { |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
414 gc = c->data; |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
415 if (gc->prpl->actions && gc->prpl->do_action) |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
416 break; |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
417 c = g_slist_next(c); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
418 } |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
419 |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
420 tmp = act = (*gc->prpl->actions)(); |
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 while (act) { |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
423 if (act->data == NULL) { |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
424 gaim_separator(protomenu); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
425 act = g_list_next(act); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
426 continue; |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
427 } |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
428 |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
429 menuitem = gtk_menu_item_new_with_label(act->data); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
430 gtk_object_set_user_data(GTK_OBJECT(menuitem), act->data); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
431 gtk_menu_append(GTK_MENU(protomenu), menuitem); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
432 gtk_signal_connect(GTK_OBJECT(menuitem), "activate", |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
433 GTK_SIGNAL_FUNC(proto_act), gc); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
434 gtk_widget_show(menuitem); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
435 |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
436 act = g_list_next(act); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
437 } |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
438 |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
439 g_list_free(tmp); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
440 } else { |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
441 while (c) { |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
442 GList *tmp, *act; |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
443 gc = c->data; |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
444 if (!gc->prpl->actions || !gc->prpl->do_action) { |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
445 c = g_slist_next(c); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
446 continue; |
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 |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
449 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
|
450 menuitem = gtk_menu_item_new_with_label(buf); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
451 gtk_menu_append(GTK_MENU(protomenu), menuitem); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
452 gtk_widget_show(menuitem); |
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 submenu = gtk_menu_new(); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
455 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
456 gtk_widget_show(submenu); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
457 |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
458 tmp = act = (*gc->prpl->actions)(); |
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 while (act) { |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
461 if (act->data == NULL) { |
1536
3a9f11c9278b
[gaim-migrate @ 1546]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1530
diff
changeset
|
462 gaim_separator(submenu); |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
463 act = g_list_next(act); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
464 continue; |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
465 } |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
466 |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
467 menuitem = gtk_menu_item_new_with_label(act->data); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
468 gtk_object_set_user_data(GTK_OBJECT(menuitem), act->data); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
469 gtk_menu_append(GTK_MENU(submenu), menuitem); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
470 gtk_signal_connect(GTK_OBJECT(menuitem), "activate", |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
471 GTK_SIGNAL_FUNC(proto_act), gc); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
472 gtk_widget_show(menuitem); |
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 act = g_list_next(act); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
475 } |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
476 |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
477 g_list_free(tmp); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
478 c = g_slist_next(c); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
479 } |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
480 } |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
481 } |
2050
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
482 |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
483 struct ft_req { |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
484 struct gaim_connection *gc; |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
485 gboolean send; |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
486 gboolean multiple; |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
487 guint size; |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
488 char *name; |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
489 ft_callback cb; |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
490 gpointer data; |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
491 GtkWidget *fd; |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
492 }; |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
493 |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
494 static void ftrrno(gpointer w, struct ft_req *fr) |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
495 { |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
496 if (fr->fd && (w != fr->fd)) { |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
497 gtk_widget_destroy(fr->fd); |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
498 return; |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
499 } |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
500 if (fr->cb) |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
501 fr->cb(fr->gc, NULL, TRUE, fr->data); |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
502 if (fr->name) |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
503 g_free(fr->name); |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
504 g_free(fr); |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
505 } |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
506 |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
507 static void do_exist_dialog(const char *name, unsigned long size, struct ft_req *fr) |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
508 { |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
509 /* |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
510 GtkWidget *window; |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
511 GtkWidget *vbox; |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
512 GtkWidget *label; |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
513 GtkWidget *hbox; |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
514 GtkWidget *button; |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
515 char buf[8192]; |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
516 |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
517 g_snprintf(buf, sizeof(buf), "It appears that %s already exists. Do you want to " |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
518 "overwrite the file%s or cancel the transfer?", name, |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
519 (size <= fr->size) ? ", resume the download," : ""); |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
520 |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
521 window = gtk_window_new(GTK_WINDOW_DIALOG); |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
522 */ |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
523 } |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
524 |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
525 static void ftgotfile(gpointer w, struct ft_req *fr) |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
526 { |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
527 const char *fname = gtk_file_selection_get_filename(GTK_FILE_SELECTION(fr->fd)); |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
528 if (!fr->multiple && file_is_dir(fname, fr->fd)) |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
529 return; |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
530 |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
531 if (!fr->multiple && !fr->send) { |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
532 struct stat st; |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
533 if (stat(fname, &st) == 0) { |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
534 do_exist_dialog(fname, st.st_size, fr); |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
535 return; |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
536 } |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
537 } |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
538 |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
539 fr->cb(fr->gc, fname, FT_EXIST_DNE, fr->data); |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
540 fr->cb = NULL; |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
541 |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
542 gtk_widget_destroy(fr->fd); |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
543 } |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
544 |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
545 static void ftrrok(gpointer w, struct ft_req *ft) |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
546 { |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
547 /* ft is going to be free'd as soon as we leave this function, so we'll copy it */ |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
548 struct ft_req *fr = g_memdup(ft, sizeof(struct ft_req)); |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
549 char buf[256]; |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
550 |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
551 if (fr->send) |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
552 fr->fd = gtk_file_selection_new(_("Gaim - Select File")); |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
553 else |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
554 fr->fd = gtk_file_selection_new(_("Gaim - Send File")); |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
555 |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
556 g_snprintf(buf, sizeof(buf), "%s/%s", g_get_home_dir(), fr->name ? fr->name : ""); |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
557 gtk_file_selection_set_filename(GTK_FILE_SELECTION(fr->fd), buf); |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
558 |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
559 gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(fr->fd)->ok_button), "clicked", |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
560 GTK_SIGNAL_FUNC(ftgotfile), fr); |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
561 gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(fr->fd)->cancel_button), "clicked", |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
562 GTK_SIGNAL_FUNC(ftrrno), fr); |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
563 gtk_signal_connect(GTK_OBJECT(fr->fd), "destroy", GTK_SIGNAL_FUNC(ftrrno), fr); |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
564 |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
565 gtk_widget_show(fr->fd); |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
566 } |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
567 |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
568 void ft_receive_request(struct gaim_connection *gc, const char *who, gboolean send, gboolean multiple, |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
569 char *name, guint size, ft_callback cb, gpointer data) |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
570 { |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
571 char buf[8192]; |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
572 struct ft_req *fr = g_new0(struct ft_req, 1); |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
573 |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
574 fr->gc = gc; |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
575 fr->send = send; |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
576 fr->multiple = multiple; |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
577 fr->size = size; |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
578 if (name) |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
579 fr->name = g_strdup(name); |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
580 fr->cb = cb; |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
581 fr->data = data; |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
582 |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
583 if (send) |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
584 g_snprintf(buf, sizeof(buf), "%s has just asked %s to send a file.", |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
585 who, gc->username); |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
586 else if (multiple) |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
587 g_snprintf(buf, sizeof(buf), "%s has just asked %s to receive some files.", |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
588 who, gc->username); |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
589 else if (name && size) |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
590 g_snprintf(buf, sizeof(buf), "%s has just asked %s to receive %s (%d bytes).", |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
591 who, gc->username, name, size); |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
592 else if (name) |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
593 g_snprintf(buf, sizeof(buf), "%s has just asked %s to receive %s.", |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
594 who, gc->username, name); |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
595 else |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
596 g_snprintf(buf, sizeof(buf), "%s has just asked %s to receive a file.", |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
597 who, gc->username); |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
598 |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
599 do_ask_dialog(buf, fr, ftrrok, ftrrno); |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
600 } |