Mercurial > pidgin
annotate src/prpl.c @ 4440:d9e4eacf6b46
[gaim-migrate @ 4715]
this was bad. glad i noticed it.
committer: Tailor Script <tailor@pidgin.im>
author | Nathan Walp <nwalp@pidgin.im> |
---|---|
date | Tue, 28 Jan 2003 05:39:29 +0000 |
parents | 5fb47ec9bfe4 |
children | 3196d9044a45 |
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 | |
2417
5473c8c5378d
[gaim-migrate @ 2430]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2403
diff
changeset
|
22 #include "gaim.h" |
981 | 23 #include "prpl.h" |
2050
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
24 #include <sys/types.h> |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
25 #include <sys/stat.h> |
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
26 #include <unistd.h> |
4235 | 27 #include <string.h> |
1000
91b7377e7b45
[gaim-migrate @ 1010]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
28 |
3738 | 29 #ifdef _WIN32 |
30 #include "win32dep.h" | |
31 #endif | |
32 | |
1064
b0b40b5faede
[gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
33 #include "pixmaps/ok.xpm" |
b0b40b5faede
[gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
34 #include "pixmaps/cancel.xpm" |
2541
8229710b343b
[gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2428
diff
changeset
|
35 #include "pixmaps/tb_forward.xpm" |
1064
b0b40b5faede
[gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
36 |
981 | 37 GSList *protocols = NULL; |
38 | |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
39 GtkWidget *protomenu = NULL; |
3572 | 40 int prpl_accounts[PROTO_UNTAKEN]; |
1499
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; |
3466 | 45 void (*doit)(void *, const char *); |
1500
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 | |
3572 | 65 gint proto_compare(struct prpl *a, struct prpl *b) |
1252
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 |
3572 | 71 #ifdef GAIM_PLUGINS |
72 gboolean load_prpl(struct prpl *p) | |
73 { | |
74 char *(*gaim_prpl_init)(struct prpl *); | |
75 debug_printf("Loading protocol %d\n", p->protocol); | |
76 | |
77 if (!p->plug) | |
78 return TRUE; | |
79 | |
80 p->plug->handle = g_module_open(p->plug->path, 0); | |
81 if (!p->plug->handle) { | |
82 debug_printf("%s is unloadable: %s\n", p->plug->path, g_module_error()); | |
83 return TRUE; | |
84 } | |
85 | |
86 if (!g_module_symbol(p->plug->handle, "gaim_prpl_init", (gpointer *)&gaim_prpl_init)) { | |
87 return TRUE; | |
88 } | |
89 | |
90 gaim_prpl_init(p); | |
91 return FALSE; | |
92 } | |
93 #endif | |
94 | |
3577 | 95 /* This is used only by static protocols */ |
3572 | 96 void load_protocol(proto_init pi) |
1000
91b7377e7b45
[gaim-migrate @ 1010]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
97 { |
3577 | 98 struct prpl *p = g_new0(struct prpl, 1); |
3390
a5d356cba156
[gaim-migrate @ 3409]
Christian Hammond <chipx86@chipx86.com>
parents:
3382
diff
changeset
|
99 |
3382 | 100 if (p->protocol == PROTO_ICQ) |
3577 | 101 do_error_dialog(_("ICQ Protocol detected."), |
3427 | 102 _("Gaim has loaded the ICQ plugin. This plugin has been deprecated. " |
3382 | 103 "As such, it was probably not compiled from the same version of the " |
104 "source as this application was, and cannot be guaranteed to work. " | |
4053 | 105 "It is recommended that you use the AIM/ICQ protocol to connect to ICQ"), |
3427 | 106 GAIM_WARNING); |
3577 | 107 pi(p); |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1043
diff
changeset
|
108 protocols = g_slist_insert_sorted(protocols, p, (GCompareFunc)proto_compare); |
2204
5014b802eb41
[gaim-migrate @ 2214]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2191
diff
changeset
|
109 regenerate_user_list(); |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1043
diff
changeset
|
110 } |
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1043
diff
changeset
|
111 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
112 void unload_protocol(struct prpl *p) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
113 { |
3572 | 114 GList *c; |
115 struct proto_user_opt *puo; | |
116 if (p->name) | |
117 g_free(p->name); | |
118 c = p->user_opts; | |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1043
diff
changeset
|
119 while (c) { |
3572 | 120 puo = c->data; |
121 g_free(puo->label); | |
122 g_free(puo->def); | |
123 g_free(puo); | |
124 c = c->next; | |
1040
17cea517fd90
[gaim-migrate @ 1050]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1000
diff
changeset
|
125 } |
3572 | 126 g_list_free(p->user_opts); |
127 p->user_opts = NULL; | |
1000
91b7377e7b45
[gaim-migrate @ 1010]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
128 } |
91b7377e7b45
[gaim-migrate @ 1010]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
129 |
2086
424a40f12a6c
[gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2050
diff
changeset
|
130 STATIC_PROTO_INIT |
1064
b0b40b5faede
[gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
131 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
132 static void des_win(GtkWidget *a, GtkWidget *b) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1210
diff
changeset
|
133 { |
1064
b0b40b5faede
[gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
134 gtk_widget_destroy(b); |
b0b40b5faede
[gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
135 } |
b0b40b5faede
[gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
136 |
4249 | 137 static GSList *do_ask_dialogs = NULL; |
138 | |
3730 | 139 struct doaskstruct { |
4249 | 140 GtkWidget *dialog; |
141 GModule *handle; | |
3730 | 142 void (*yesfunc)(gpointer); |
143 void (*nofunc)(gpointer); | |
144 gpointer data; | |
145 }; | |
146 | |
4249 | 147 void do_ask_cancel_by_handle(GModule *handle) |
148 { | |
149 GSList *d = do_ask_dialogs; | |
150 | |
151 debug_printf("%d dialogs to search\n", g_slist_length(d)); | |
152 | |
153 while (d) { | |
154 struct doaskstruct *doask = d->data; | |
155 | |
156 d = d->next; | |
157 | |
158 if (doask->handle == handle) { | |
159 debug_printf("removing dialog, %d remain\n", g_slist_length(d)); | |
160 gtk_dialog_response(GTK_DIALOG(doask->dialog), GTK_RESPONSE_NONE); | |
161 } | |
162 } | |
163 } | |
164 | |
3730 | 165 static void do_ask_callback(GtkDialog *d, gint resp, struct doaskstruct *doask) |
166 { | |
167 switch (resp) | |
168 { | |
169 case GTK_RESPONSE_YES: | |
170 if (doask->yesfunc) | |
171 doask->yesfunc(doask->data); | |
172 break; | |
4249 | 173 default: |
3730 | 174 if (doask->nofunc) |
175 doask->nofunc(doask->data); | |
176 break; | |
177 } | |
4249 | 178 do_ask_dialogs = g_slist_remove(do_ask_dialogs, doask); |
3730 | 179 g_free(doask); |
3738 | 180 gtk_widget_destroy(GTK_WIDGET(d)); |
3730 | 181 } |
182 | |
3753 | 183 #define STOCK_ITEMIZE(r, l) if (!strcmp(r,yestext)) \ |
184 yestext = l; \ | |
185 if (!strcmp(r,notext)) \ | |
186 notext = l; | |
3730 | 187 |
4249 | 188 void do_ask_dialog(const char *prim, const char *sec, void *data, char *yestext, void *doit, char *notext, void *dont, GModule *handle, gboolean modal) |
1064
b0b40b5faede
[gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
189 { |
b0b40b5faede
[gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
190 GtkWidget *window; |
3730 | 191 GtkWidget *hbox; |
1064
b0b40b5faede
[gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
192 GtkWidget *label; |
3730 | 193 char labeltext[1024 * 2]; |
3732 | 194 char *filename = g_build_filename(DATADIR, "pixmaps", "gaim", "dialogs", "gaim_question.png", NULL); |
3730 | 195 GtkWidget *img = gtk_image_new_from_file(filename); |
196 struct doaskstruct *doask = g_new0(struct doaskstruct, 1); | |
1064
b0b40b5faede
[gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
197 |
3730 | 198 g_free(filename); |
199 gtk_misc_set_alignment(GTK_MISC(img), 0, 0); | |
1064
b0b40b5faede
[gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
200 |
3753 | 201 /* This is ugly. GTK Stock items will take a button with a label "gtk-cancel" and turn it into a |
202 * Cancel button with a Cancel icon and whatnot. We want to avoid using anything gtk in the prpls | |
203 * so we replace "Cancel" with "gtk-cancel" right here. */ | |
204 STOCK_ITEMIZE("Add", GTK_STOCK_ADD); | |
205 STOCK_ITEMIZE("Apply", GTK_STOCK_APPLY); | |
206 STOCK_ITEMIZE("Cancel", GTK_STOCK_CANCEL); | |
207 STOCK_ITEMIZE("Close", GTK_STOCK_CLOSE); | |
208 STOCK_ITEMIZE("Delete", GTK_STOCK_DELETE); | |
209 STOCK_ITEMIZE("Remove", GTK_STOCK_REMOVE); | |
210 STOCK_ITEMIZE("Yes", GTK_STOCK_YES); | |
211 STOCK_ITEMIZE("No", GTK_STOCK_NO); | |
212 | |
4245 | 213 window = gtk_dialog_new_with_buttons("", NULL, 0, notext, GTK_RESPONSE_NO, yestext, GTK_RESPONSE_YES, NULL); |
214 | |
215 if (modal) { | |
216 gtk_window_set_modal(GTK_WINDOW(window), TRUE); | |
217 } | |
218 | |
3730 | 219 gtk_dialog_set_default_response (GTK_DIALOG(window), GTK_RESPONSE_YES); |
220 g_signal_connect(G_OBJECT(window), "response", G_CALLBACK(do_ask_callback), doask); | |
4249 | 221 |
3730 | 222 gtk_container_set_border_width (GTK_CONTAINER(window), 6); |
223 gtk_window_set_resizable(GTK_WINDOW(window), FALSE); | |
224 gtk_dialog_set_has_separator(GTK_DIALOG(window), FALSE); | |
225 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(window)->vbox), 12); | |
226 gtk_container_set_border_width (GTK_CONTAINER(GTK_DIALOG(window)->vbox), 6); | |
1210 | 227 |
3730 | 228 hbox = gtk_hbox_new(FALSE, 12); |
229 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(window)->vbox), hbox); | |
230 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); | |
231 | |
232 g_snprintf(labeltext, sizeof(labeltext), "<span weight=\"bold\" size=\"larger\">%s</span>\n\n%s", prim, sec ? sec : ""); | |
233 label = gtk_label_new(NULL); | |
234 gtk_label_set_markup(GTK_LABEL(label), labeltext); | |
235 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); | |
236 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
237 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
4249 | 238 |
239 doask->dialog = window; | |
240 doask->handle = handle; | |
241 doask->yesfunc = doit; | |
242 doask->nofunc = dont; | |
243 doask->data = data; | |
244 do_ask_dialogs = g_slist_append(do_ask_dialogs, doask); | |
245 | |
1210 | 246 gtk_widget_show_all(window); |
1064
b0b40b5faede
[gaim-migrate @ 1074]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
247 } |
1333
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1252
diff
changeset
|
248 |
1500
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
249 static void des_prompt(GtkWidget *w, struct _prompt *p) |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
250 { |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
251 if (p->dont) |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
252 (p->dont)(p->data); |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
253 gtk_widget_destroy(p->window); |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
254 g_free(p); |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
255 } |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
256 |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
257 static void act_prompt(GtkWidget *w, struct _prompt *p) |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
258 { |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
259 if (p->doit) |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
260 (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
|
261 gtk_widget_destroy(p->window); |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
262 } |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
263 |
2541
8229710b343b
[gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2428
diff
changeset
|
264 void do_prompt_dialog(const char *text, const char *def, void *data, void *doit, void *dont) |
1500
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
265 { |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
266 GtkWidget *window; |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
267 GtkWidget *vbox; |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
268 GtkWidget *hbox; |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
269 GtkWidget *label; |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
270 GtkWidget *entry; |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
271 GtkWidget *button; |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
272 struct _prompt *p; |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
273 |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
274 p = g_new0(struct _prompt, 1); |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
275 p->data = data; |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
276 p->doit = doit; |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
277 p->dont = dont; |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
278 |
2725
f3c094e78609
[gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2718
diff
changeset
|
279 GAIM_DIALOG(window); |
1500
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
280 p->window = window; |
4074 | 281 gtk_window_set_role(GTK_WINDOW(window), "prompt"); |
1500
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
282 gtk_window_set_policy(GTK_WINDOW(window), FALSE, TRUE, TRUE); |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
283 gtk_window_set_title(GTK_WINDOW(window), _("Gaim - Prompt")); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4092
diff
changeset
|
284 g_signal_connect(GTK_OBJECT(window), "destroy", G_CALLBACK(des_prompt), p); |
1500
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
285 gtk_widget_realize(window); |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
286 |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
287 vbox = gtk_vbox_new(FALSE, 5); |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
288 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
289 gtk_container_add(GTK_CONTAINER(window), vbox); |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
290 |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
291 hbox = gtk_hbox_new(FALSE, 5); |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
292 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
293 |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
294 label = gtk_label_new(text); |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
295 gtk_box_pack_start(GTK_BOX(vbox), label, TRUE, TRUE, 0); |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
296 |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
297 entry = gtk_entry_new(); |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
298 gtk_box_pack_start(GTK_BOX(vbox), entry, FALSE, FALSE, 0); |
2541
8229710b343b
[gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2428
diff
changeset
|
299 if (def) |
2543
830a83209475
[gaim-migrate @ 2556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2541
diff
changeset
|
300 gtk_entry_set_text(GTK_ENTRY(entry), def); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4092
diff
changeset
|
301 g_signal_connect(GTK_OBJECT(entry), "activate", G_CALLBACK(act_prompt), p); |
1500
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
302 p->entry = entry; |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
303 |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
304 hbox = gtk_hbox_new(FALSE, 5); |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
305 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
306 |
4092 | 307 button = picture_button(window, _("Accept"), ok_xpm); |
308 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4092
diff
changeset
|
309 g_signal_connect(GTK_OBJECT(button), "clicked", G_CALLBACK(act_prompt), p); |
4092 | 310 |
1500
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
311 button = picture_button(window, _("Cancel"), cancel_xpm); |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
312 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4092
diff
changeset
|
313 g_signal_connect(GTK_OBJECT(button), "clicked", G_CALLBACK(des_win), window); |
1500
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
314 |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
315 gtk_widget_show_all(window); |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
316 } |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
317 |
4333 | 318 static void proto_act(GtkObject *obj, struct proto_actions_menu *pam) |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
319 { |
4333 | 320 if (pam->callback && pam->gc) |
321 pam->callback(pam->gc); | |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
322 } |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
323 |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
324 void do_proto_menu() |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
325 { |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
326 GtkWidget *menuitem; |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
327 GtkWidget *submenu; |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
328 GList *l; |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
329 GSList *c = connections; |
4333 | 330 struct proto_actions_menu *pam; |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
331 struct gaim_connection *gc = NULL; |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
332 int count = 0; |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
333 char buf[256]; |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
334 |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
335 if (!protomenu) |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
336 return; |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
337 |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
338 l = gtk_container_children(GTK_CONTAINER(protomenu)); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
339 while (l) { |
4333 | 340 menuitem = l->data; |
341 pam = gtk_object_get_data(GTK_OBJECT(menuitem), "user_data"); | |
342 if (pam) | |
343 g_free(pam); | |
344 gtk_container_remove(GTK_CONTAINER(protomenu), GTK_WIDGET(menuitem)); | |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
345 l = l->next; |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
346 } |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
347 |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
348 while (c) { |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
349 gc = c->data; |
4333 | 350 if (gc->prpl->actions && gc->login_time) |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
351 count++; |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
352 c = g_slist_next(c); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
353 } |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
354 c = connections; |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
355 |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
356 if (!count) { |
4333 | 357 g_snprintf(buf, sizeof(buf), _("No actions available")); |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
358 menuitem = gtk_menu_item_new_with_label(buf); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
359 gtk_menu_append(GTK_MENU(protomenu), menuitem); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
360 gtk_widget_show(menuitem); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
361 return; |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
362 } |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
363 |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
364 if (count == 1) { |
4333 | 365 GList *act; |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
366 while (c) { |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
367 gc = c->data; |
4333 | 368 if (gc->prpl->actions && gc->login_time) |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
369 break; |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
370 c = g_slist_next(c); |
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 |
4333 | 373 act = gc->prpl->actions(gc); |
1499
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 while (act) { |
4333 | 376 if (act->data) { |
377 struct proto_actions_menu *pam = act->data; | |
378 menuitem = gtk_menu_item_new_with_label(pam->label); | |
379 gtk_menu_append(GTK_MENU(protomenu), menuitem); | |
380 g_signal_connect(GTK_OBJECT(menuitem), "activate", | |
381 G_CALLBACK(proto_act), pam); | |
382 gtk_object_set_data(GTK_OBJECT(menuitem), "user_data", pam); | |
383 gtk_widget_show(menuitem); | |
384 } else { | |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
385 gaim_separator(protomenu); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
386 } |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
387 act = g_list_next(act); |
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 } else { |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
390 while (c) { |
4333 | 391 GList *act; |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
392 gc = c->data; |
4333 | 393 if (!gc->prpl->actions || !gc->login_time) { |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
394 c = g_slist_next(c); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
395 continue; |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
396 } |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
397 |
3572 | 398 g_snprintf(buf, sizeof(buf), "%s (%s)", gc->username, gc->prpl->name); |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
399 menuitem = gtk_menu_item_new_with_label(buf); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
400 gtk_menu_append(GTK_MENU(protomenu), menuitem); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
401 gtk_widget_show(menuitem); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
402 |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
403 submenu = gtk_menu_new(); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
404 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
405 gtk_widget_show(submenu); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
406 |
4333 | 407 act = gc->prpl->actions(gc); |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
408 |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
409 while (act) { |
4333 | 410 if (act->data) { |
411 struct proto_actions_menu *pam = act->data; | |
412 menuitem = gtk_menu_item_new_with_label(pam->label); | |
413 gtk_menu_append(GTK_MENU(submenu), menuitem); | |
414 g_signal_connect(GTK_OBJECT(menuitem), "activate", | |
415 G_CALLBACK(proto_act), pam); | |
416 gtk_object_set_data(GTK_OBJECT(menuitem), "user_data", pam); | |
417 gtk_widget_show(menuitem); | |
418 } else { | |
1536
3a9f11c9278b
[gaim-migrate @ 1546]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1530
diff
changeset
|
419 gaim_separator(submenu); |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
420 } |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
421 act = g_list_next(act); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
422 } |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
423 c = g_slist_next(c); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
424 } |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
425 } |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1470
diff
changeset
|
426 } |
2050
ddd696ccb46b
[gaim-migrate @ 2060]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2007
diff
changeset
|
427 |
2401
86c9b44a35ae
[gaim-migrate @ 2414]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
428 struct mail_notify { |
86c9b44a35ae
[gaim-migrate @ 2414]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
429 struct gaim_connection *gc; |
86c9b44a35ae
[gaim-migrate @ 2414]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
430 GtkWidget *email_win; |
86c9b44a35ae
[gaim-migrate @ 2414]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
431 GtkWidget *email_label; |
2541
8229710b343b
[gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2428
diff
changeset
|
432 char *url; |
2401
86c9b44a35ae
[gaim-migrate @ 2414]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
433 }; |
86c9b44a35ae
[gaim-migrate @ 2414]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
434 GSList *mailnots = NULL; |
86c9b44a35ae
[gaim-migrate @ 2414]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
435 |
86c9b44a35ae
[gaim-migrate @ 2414]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
436 static struct mail_notify *find_mail_notify(struct gaim_connection *gc) |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2355
diff
changeset
|
437 { |
2401
86c9b44a35ae
[gaim-migrate @ 2414]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
438 GSList *m = mailnots; |
86c9b44a35ae
[gaim-migrate @ 2414]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
439 while (m) { |
86c9b44a35ae
[gaim-migrate @ 2414]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
440 if (((struct mail_notify *)m->data)->gc == gc) |
86c9b44a35ae
[gaim-migrate @ 2414]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
441 return m->data; |
86c9b44a35ae
[gaim-migrate @ 2414]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
442 m = m->next; |
86c9b44a35ae
[gaim-migrate @ 2414]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
443 } |
86c9b44a35ae
[gaim-migrate @ 2414]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
444 return NULL; |
86c9b44a35ae
[gaim-migrate @ 2414]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
445 } |
86c9b44a35ae
[gaim-migrate @ 2414]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
446 |
86c9b44a35ae
[gaim-migrate @ 2414]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
447 static void des_email_win(GtkWidget *w, struct mail_notify *mn) |
86c9b44a35ae
[gaim-migrate @ 2414]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
448 { |
2428
0394552f2aab
[gaim-migrate @ 2441]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2417
diff
changeset
|
449 if (w != mn->email_win) { |
0394552f2aab
[gaim-migrate @ 2441]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2417
diff
changeset
|
450 gtk_widget_destroy(mn->email_win); |
0394552f2aab
[gaim-migrate @ 2441]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2417
diff
changeset
|
451 return; |
0394552f2aab
[gaim-migrate @ 2441]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2417
diff
changeset
|
452 } |
0394552f2aab
[gaim-migrate @ 2441]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2417
diff
changeset
|
453 debug_printf("removing mail notification\n"); |
2401
86c9b44a35ae
[gaim-migrate @ 2414]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
454 mailnots = g_slist_remove(mailnots, mn); |
2541
8229710b343b
[gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2428
diff
changeset
|
455 if (mn->url) |
8229710b343b
[gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2428
diff
changeset
|
456 g_free(mn->url); |
2401
86c9b44a35ae
[gaim-migrate @ 2414]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
457 g_free(mn); |
2153
0befa2d2e540
[gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2151
diff
changeset
|
458 } |
0befa2d2e540
[gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2151
diff
changeset
|
459 |
2541
8229710b343b
[gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2428
diff
changeset
|
460 void connection_has_mail(struct gaim_connection *gc, int count, const char *from, const char *subject, const char *url) |
2153
0befa2d2e540
[gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2151
diff
changeset
|
461 { |
2541
8229710b343b
[gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2428
diff
changeset
|
462 GtkWidget *hbox; |
8229710b343b
[gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2428
diff
changeset
|
463 GtkWidget *vbox; |
8229710b343b
[gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2428
diff
changeset
|
464 GtkWidget *urlbut; |
8229710b343b
[gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2428
diff
changeset
|
465 GtkWidget *close; |
8229710b343b
[gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2428
diff
changeset
|
466 |
2401
86c9b44a35ae
[gaim-migrate @ 2414]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
467 struct mail_notify *mn; |
2153
0befa2d2e540
[gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2151
diff
changeset
|
468 char buf[2048]; |
0befa2d2e540
[gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2151
diff
changeset
|
469 |
0befa2d2e540
[gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2151
diff
changeset
|
470 if (!(gc->user->options & OPT_USR_MAIL_CHECK)) |
0befa2d2e540
[gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2151
diff
changeset
|
471 return; |
0befa2d2e540
[gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2151
diff
changeset
|
472 |
2401
86c9b44a35ae
[gaim-migrate @ 2414]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
473 if (!(mn = find_mail_notify(gc))) { |
86c9b44a35ae
[gaim-migrate @ 2414]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
474 mn = g_new0(struct mail_notify, 1); |
86c9b44a35ae
[gaim-migrate @ 2414]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
475 mn->gc = gc; |
2403
8555e48c02df
[gaim-migrate @ 2416]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2401
diff
changeset
|
476 mailnots = g_slist_append(mailnots, mn); |
2401
86c9b44a35ae
[gaim-migrate @ 2414]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
477 } |
86c9b44a35ae
[gaim-migrate @ 2414]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
478 |
3694 | 479 if (count < 0) { |
480 if (from && subject) | |
4276 | 481 g_snprintf(buf, sizeof buf, _("%s has mail from %s: %s"), gc->username, from, *subject ? subject : _("No Subject")); |
3694 | 482 else |
4276 | 483 g_snprintf(buf, sizeof buf, _("%s has new mail."), gc->username); |
3694 | 484 } else if (count > 0) { |
4276 | 485 g_snprintf(buf, sizeof buf, |
486 ngettext("%s has %d new message.","%s has %d new messages.",count), gc->username, count); | |
2541
8229710b343b
[gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2428
diff
changeset
|
487 } else if (mn->email_win) { |
8229710b343b
[gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2428
diff
changeset
|
488 gtk_widget_destroy(mn->email_win); |
8229710b343b
[gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2428
diff
changeset
|
489 return; |
2606
f00549786a9c
[gaim-migrate @ 2619]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2585
diff
changeset
|
490 } else |
f00549786a9c
[gaim-migrate @ 2619]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2585
diff
changeset
|
491 return; |
2153
0befa2d2e540
[gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2151
diff
changeset
|
492 |
2541
8229710b343b
[gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2428
diff
changeset
|
493 if (mn->email_win) { |
8229710b343b
[gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2428
diff
changeset
|
494 gtk_label_set_text(GTK_LABEL(mn->email_label), buf); |
8229710b343b
[gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2428
diff
changeset
|
495 return; |
8229710b343b
[gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2428
diff
changeset
|
496 } |
8229710b343b
[gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2428
diff
changeset
|
497 |
8229710b343b
[gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2428
diff
changeset
|
498 |
2725
f3c094e78609
[gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2718
diff
changeset
|
499 GAIM_DIALOG(mn->email_win); |
4074 | 500 gtk_window_set_role(GTK_WINDOW(mn->email_win), "mail"); |
2541
8229710b343b
[gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2428
diff
changeset
|
501 gtk_window_set_policy(GTK_WINDOW(mn->email_win), FALSE, TRUE, TRUE); |
8229710b343b
[gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2428
diff
changeset
|
502 gtk_window_set_title(GTK_WINDOW(mn->email_win), _("Gaim - New Mail")); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4092
diff
changeset
|
503 g_signal_connect(GTK_OBJECT(mn->email_win), "destroy", G_CALLBACK(des_email_win), mn); |
2541
8229710b343b
[gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2428
diff
changeset
|
504 gtk_widget_realize(mn->email_win); |
2153
0befa2d2e540
[gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2151
diff
changeset
|
505 |
2541
8229710b343b
[gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2428
diff
changeset
|
506 vbox = gtk_vbox_new(FALSE, 5); |
8229710b343b
[gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2428
diff
changeset
|
507 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); |
8229710b343b
[gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2428
diff
changeset
|
508 gtk_container_add(GTK_CONTAINER(mn->email_win), vbox); |
8229710b343b
[gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2428
diff
changeset
|
509 gtk_widget_show(vbox); |
8229710b343b
[gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2428
diff
changeset
|
510 |
8229710b343b
[gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2428
diff
changeset
|
511 mn->email_label = gtk_label_new(buf); |
8229710b343b
[gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2428
diff
changeset
|
512 gtk_label_set_text(GTK_LABEL(mn->email_label), buf); |
3493 | 513 gtk_label_set_line_wrap(GTK_LABEL(mn->email_label), TRUE); |
514 gtk_box_pack_start(GTK_BOX(vbox), mn->email_label, FALSE, TRUE, 5); | |
2541
8229710b343b
[gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2428
diff
changeset
|
515 gtk_widget_show(mn->email_label); |
8229710b343b
[gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2428
diff
changeset
|
516 |
8229710b343b
[gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2428
diff
changeset
|
517 hbox = gtk_hbox_new(FALSE, 5); |
8229710b343b
[gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2428
diff
changeset
|
518 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
8229710b343b
[gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2428
diff
changeset
|
519 gtk_widget_show(hbox); |
2153
0befa2d2e540
[gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2151
diff
changeset
|
520 |
2541
8229710b343b
[gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2428
diff
changeset
|
521 close = picture_button(mn->email_win, _("Close"), cancel_xpm); |
8229710b343b
[gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2428
diff
changeset
|
522 gtk_window_set_focus(GTK_WINDOW(mn->email_win), close); |
8229710b343b
[gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2428
diff
changeset
|
523 gtk_box_pack_end(GTK_BOX(hbox), close, 0, 0, 5); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4092
diff
changeset
|
524 g_signal_connect(GTK_OBJECT(close), "clicked", G_CALLBACK(des_email_win), mn); |
2153
0befa2d2e540
[gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2151
diff
changeset
|
525 |
2541
8229710b343b
[gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2428
diff
changeset
|
526 if (url) { |
8229710b343b
[gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2428
diff
changeset
|
527 mn->url = g_strdup(url); |
8229710b343b
[gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2428
diff
changeset
|
528 urlbut = picture_button(mn->email_win, _("Open Mail"), tb_forward_xpm); |
8229710b343b
[gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2428
diff
changeset
|
529 gtk_box_pack_end(GTK_BOX(hbox), urlbut, 0, 0, 5); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4092
diff
changeset
|
530 g_signal_connect(GTK_OBJECT(urlbut), "clicked", G_CALLBACK(open_url), mn->url); |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4092
diff
changeset
|
531 g_signal_connect(GTK_OBJECT(urlbut), "clicked", G_CALLBACK(des_email_win), mn); |
2541
8229710b343b
[gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2428
diff
changeset
|
532 } |
8229710b343b
[gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2428
diff
changeset
|
533 |
8229710b343b
[gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2428
diff
changeset
|
534 gtk_widget_show(mn->email_win); |
2153
0befa2d2e540
[gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2151
diff
changeset
|
535 } |
2191
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2189
diff
changeset
|
536 |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2189
diff
changeset
|
537 struct icon_data { |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2189
diff
changeset
|
538 struct gaim_connection *gc; |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2189
diff
changeset
|
539 char *who; |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2189
diff
changeset
|
540 void *data; |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2189
diff
changeset
|
541 int len; |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2189
diff
changeset
|
542 }; |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2189
diff
changeset
|
543 |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2189
diff
changeset
|
544 static GList *icons = NULL; |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2189
diff
changeset
|
545 |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2189
diff
changeset
|
546 static gint find_icon_data(gconstpointer a, gconstpointer b) |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2189
diff
changeset
|
547 { |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2189
diff
changeset
|
548 const struct icon_data *x = a; |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2189
diff
changeset
|
549 const struct icon_data *y = b; |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2189
diff
changeset
|
550 |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2189
diff
changeset
|
551 return ((x->gc != y->gc) || g_strcasecmp(x->who, y->who)); |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2189
diff
changeset
|
552 } |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2189
diff
changeset
|
553 |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2189
diff
changeset
|
554 void set_icon_data(struct gaim_connection *gc, char *who, void *data, int len) |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2189
diff
changeset
|
555 { |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
556 struct gaim_conversation *conv; |
3281 | 557 struct icon_data tmp; |
558 GList *l; | |
559 struct icon_data *id; | |
560 tmp.gc = gc; | |
561 tmp.who = normalize(who); | |
562 tmp.data=NULL; | |
563 tmp.len = 0; | |
564 l = g_list_find_custom(icons, &tmp, find_icon_data); | |
565 id = l ? l->data : NULL; | |
2191
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2189
diff
changeset
|
566 |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2189
diff
changeset
|
567 if (id) { |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2189
diff
changeset
|
568 g_free(id->data); |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2189
diff
changeset
|
569 if (!data) { |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2189
diff
changeset
|
570 icons = g_list_remove(icons, id); |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2189
diff
changeset
|
571 g_free(id->who); |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2189
diff
changeset
|
572 g_free(id); |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2189
diff
changeset
|
573 return; |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2189
diff
changeset
|
574 } |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2189
diff
changeset
|
575 } else if (data) { |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2189
diff
changeset
|
576 id = g_new0(struct icon_data, 1); |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2189
diff
changeset
|
577 icons = g_list_append(icons, id); |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2189
diff
changeset
|
578 id->gc = gc; |
2718
757688c301b5
[gaim-migrate @ 2731]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2662
diff
changeset
|
579 id->who = g_strdup(normalize(who)); |
2191
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2189
diff
changeset
|
580 } else { |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2189
diff
changeset
|
581 return; |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2189
diff
changeset
|
582 } |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2189
diff
changeset
|
583 |
2284
83c7123e5a7e
[gaim-migrate @ 2294]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2279
diff
changeset
|
584 debug_printf("Got icon for %s (length %d)\n", who, len); |
83c7123e5a7e
[gaim-migrate @ 2294]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2279
diff
changeset
|
585 |
2191
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2189
diff
changeset
|
586 id->data = g_memdup(data, len); |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2189
diff
changeset
|
587 id->len = len; |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2189
diff
changeset
|
588 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
589 /* Update the buddy icon for this user. */ |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
590 conv = gaim_find_conversation(who); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
591 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
592 if (conv != NULL && gaim_conversation_get_gc(conv) == gc) |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
593 gaim_gtkconv_update_buddy_icon(conv); |
2191
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2189
diff
changeset
|
594 } |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2189
diff
changeset
|
595 |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2189
diff
changeset
|
596 void remove_icon_data(struct gaim_connection *gc) |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2189
diff
changeset
|
597 { |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2189
diff
changeset
|
598 GList *list = icons; |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2189
diff
changeset
|
599 struct icon_data *id; |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2189
diff
changeset
|
600 |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2189
diff
changeset
|
601 while (list) { |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2189
diff
changeset
|
602 id = list->data; |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2189
diff
changeset
|
603 if (id->gc == gc) { |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2189
diff
changeset
|
604 g_free(id->data); |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2189
diff
changeset
|
605 g_free(id->who); |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2189
diff
changeset
|
606 list = icons = g_list_remove(icons, id); |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2189
diff
changeset
|
607 g_free(id); |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2189
diff
changeset
|
608 } else |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2189
diff
changeset
|
609 list = list->next; |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2189
diff
changeset
|
610 } |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2189
diff
changeset
|
611 } |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2189
diff
changeset
|
612 |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2189
diff
changeset
|
613 void *get_icon_data(struct gaim_connection *gc, char *who, int *len) |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2189
diff
changeset
|
614 { |
2718
757688c301b5
[gaim-migrate @ 2731]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2662
diff
changeset
|
615 struct icon_data tmp = { gc, normalize(who), NULL, 0 }; |
2191
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2189
diff
changeset
|
616 GList *l = g_list_find_custom(icons, &tmp, find_icon_data); |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2189
diff
changeset
|
617 struct icon_data *id = l ? l->data : NULL; |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2189
diff
changeset
|
618 |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2189
diff
changeset
|
619 if (id) { |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2189
diff
changeset
|
620 *len = id->len; |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2189
diff
changeset
|
621 return id->data; |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2189
diff
changeset
|
622 } |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2189
diff
changeset
|
623 |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2189
diff
changeset
|
624 *len = 0; |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2189
diff
changeset
|
625 return NULL; |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2189
diff
changeset
|
626 } |
2582
5efa8077107f
[gaim-migrate @ 2595]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2558
diff
changeset
|
627 |
5efa8077107f
[gaim-migrate @ 2595]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2558
diff
changeset
|
628 struct got_add { |
5efa8077107f
[gaim-migrate @ 2595]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2558
diff
changeset
|
629 struct gaim_connection *gc; |
5efa8077107f
[gaim-migrate @ 2595]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2558
diff
changeset
|
630 char *who; |
5efa8077107f
[gaim-migrate @ 2595]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2558
diff
changeset
|
631 char *alias; |
5efa8077107f
[gaim-migrate @ 2595]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2558
diff
changeset
|
632 }; |
5efa8077107f
[gaim-migrate @ 2595]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2558
diff
changeset
|
633 |
3730 | 634 static void dont_add(struct got_add *ga) |
2582
5efa8077107f
[gaim-migrate @ 2595]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2558
diff
changeset
|
635 { |
5efa8077107f
[gaim-migrate @ 2595]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2558
diff
changeset
|
636 g_free(ga->who); |
5efa8077107f
[gaim-migrate @ 2595]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2558
diff
changeset
|
637 if (ga->alias) |
5efa8077107f
[gaim-migrate @ 2595]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2558
diff
changeset
|
638 g_free(ga->alias); |
5efa8077107f
[gaim-migrate @ 2595]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2558
diff
changeset
|
639 g_free(ga); |
5efa8077107f
[gaim-migrate @ 2595]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2558
diff
changeset
|
640 } |
5efa8077107f
[gaim-migrate @ 2595]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2558
diff
changeset
|
641 |
3730 | 642 static void do_add(struct got_add *ga) |
2582
5efa8077107f
[gaim-migrate @ 2595]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2558
diff
changeset
|
643 { |
2585
4424c670021d
[gaim-migrate @ 2598]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2582
diff
changeset
|
644 if (g_slist_find(connections, ga->gc)) |
4424c670021d
[gaim-migrate @ 2598]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2582
diff
changeset
|
645 show_add_buddy(ga->gc, ga->who, NULL, ga->alias); |
3730 | 646 dont_add(ga); |
2582
5efa8077107f
[gaim-migrate @ 2595]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2558
diff
changeset
|
647 } |
5efa8077107f
[gaim-migrate @ 2595]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2558
diff
changeset
|
648 |
5efa8077107f
[gaim-migrate @ 2595]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2558
diff
changeset
|
649 void show_got_added(struct gaim_connection *gc, const char *id, |
5efa8077107f
[gaim-migrate @ 2595]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2558
diff
changeset
|
650 const char *who, const char *alias, const char *msg) |
5efa8077107f
[gaim-migrate @ 2595]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2558
diff
changeset
|
651 { |
5efa8077107f
[gaim-migrate @ 2595]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2558
diff
changeset
|
652 char buf[BUF_LONG]; |
5efa8077107f
[gaim-migrate @ 2595]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2558
diff
changeset
|
653 struct got_add *ga = g_new0(struct got_add, 1); |
4349 | 654 struct buddy *b = find_buddy(gc->user, who); |
2582
5efa8077107f
[gaim-migrate @ 2595]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2558
diff
changeset
|
655 |
5efa8077107f
[gaim-migrate @ 2595]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2558
diff
changeset
|
656 ga->gc = gc; |
5efa8077107f
[gaim-migrate @ 2595]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2558
diff
changeset
|
657 ga->who = g_strdup(who); |
5efa8077107f
[gaim-migrate @ 2595]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2558
diff
changeset
|
658 ga->alias = alias ? g_strdup(alias) : NULL; |
5efa8077107f
[gaim-migrate @ 2595]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2558
diff
changeset
|
659 |
4349 | 660 |
3150 | 661 g_snprintf(buf, sizeof(buf), _("%s%s%s%s has made %s his or her buddy%s%s%s"), |
2582
5efa8077107f
[gaim-migrate @ 2595]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2558
diff
changeset
|
662 who, |
5efa8077107f
[gaim-migrate @ 2595]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2558
diff
changeset
|
663 alias ? " (" : "", |
5efa8077107f
[gaim-migrate @ 2595]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2558
diff
changeset
|
664 alias ? alias : "", |
5efa8077107f
[gaim-migrate @ 2595]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2558
diff
changeset
|
665 alias ? ")" : "", |
5efa8077107f
[gaim-migrate @ 2595]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2558
diff
changeset
|
666 id ? id : gc->displayname[0] ? gc->displayname : gc->username, |
5efa8077107f
[gaim-migrate @ 2595]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2558
diff
changeset
|
667 msg ? ": " : ".", |
5efa8077107f
[gaim-migrate @ 2595]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2558
diff
changeset
|
668 msg ? msg : "", |
4349 | 669 b ? "" : _("\n\nDo you wish to add him or her to your buddy list?")); |
670 if (b) | |
4333 | 671 do_error_dialog(_("Gaim - Information"), buf, GAIM_INFO); |
2582
5efa8077107f
[gaim-migrate @ 2595]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2558
diff
changeset
|
672 else |
4333 | 673 do_ask_dialog(_("Gaim - Confirm"), buf, ga, _("Add"), do_add, _("Cancel"), dont_add, NULL, FALSE); |
2582
5efa8077107f
[gaim-migrate @ 2595]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2558
diff
changeset
|
674 } |
2827
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
675 |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
676 static GtkWidget *regdlg = NULL; |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
677 static GtkWidget *reg_list = NULL; |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
678 static GtkWidget *reg_area = NULL; |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
679 static GtkWidget *reg_reg = NULL; |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
680 |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
681 static void delete_regdlg() |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
682 { |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
683 GtkWidget *tmp = regdlg; |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
684 regdlg = NULL; |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
685 if (tmp) |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
686 gtk_widget_destroy(tmp); |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
687 } |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
688 |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
689 static void reset_reg_dlg() |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
690 { |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
691 GSList *P = protocols; |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
692 |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
693 if (!regdlg) |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
694 return; |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
695 |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
696 while (GTK_BOX(reg_list)->children) |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
697 gtk_container_remove(GTK_CONTAINER(reg_list), |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
698 ((GtkBoxChild *)GTK_BOX(reg_list)->children->data)->widget); |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
699 |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
700 while (GTK_BOX(reg_area)->children) |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
701 gtk_container_remove(GTK_CONTAINER(reg_area), |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
702 ((GtkBoxChild *)GTK_BOX(reg_area)->children->data)->widget); |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
703 |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
704 while (P) { |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
705 struct prpl *p = P->data; |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
706 if (p->register_user) |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
707 break; |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
708 P = P->next; |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
709 } |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
710 |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
711 if (!P) { |
2843
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2827
diff
changeset
|
712 GtkWidget *no = gtk_label_new(_("You do not currently have any protocols available" |
2827
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
713 " that are able to register new accounts.")); |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
714 gtk_box_pack_start(GTK_BOX(reg_area), no, FALSE, FALSE, 5); |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
715 gtk_widget_show(no); |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
716 |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
717 gtk_widget_set_sensitive(reg_reg, FALSE); |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
718 |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
719 return; |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
720 } |
2843
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2827
diff
changeset
|
721 |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2827
diff
changeset
|
722 gtk_widget_set_sensitive(reg_reg, TRUE); |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2827
diff
changeset
|
723 |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2827
diff
changeset
|
724 while (P) { /* we can safely ignore all the previous ones */ |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2827
diff
changeset
|
725 struct prpl *p = P->data; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2827
diff
changeset
|
726 P = P->next; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2827
diff
changeset
|
727 |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2827
diff
changeset
|
728 if (!p->register_user) |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2827
diff
changeset
|
729 continue; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2827
diff
changeset
|
730 |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2827
diff
changeset
|
731 /* do stuff */ |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2827
diff
changeset
|
732 } |
2827
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
733 } |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
734 |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
735 void register_dialog() |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
736 { |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
737 /* this is just one big hack */ |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
738 GtkWidget *vbox; |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
739 GtkWidget *frame; |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
740 GtkWidget *hbox; |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
741 GtkWidget *close; |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
742 |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
743 if (regdlg) { |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
744 gdk_window_raise(regdlg->window); |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
745 return; |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
746 } |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
747 |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
748 regdlg = gtk_window_new(GTK_WINDOW_TOPLEVEL); |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
749 gtk_window_set_title(GTK_WINDOW(regdlg), _("Gaim - Registration")); |
4074 | 750 gtk_window_set_role(GTK_WINDOW(regdlg), "register"); |
2827
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
751 gtk_widget_realize(regdlg); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4092
diff
changeset
|
752 g_signal_connect(GTK_OBJECT(regdlg), "destroy", G_CALLBACK(delete_regdlg), NULL); |
2827
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
753 |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
754 vbox = gtk_vbox_new(FALSE, 5); |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
755 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
756 gtk_container_add(GTK_CONTAINER(regdlg), vbox); |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
757 gtk_widget_show(vbox); |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
758 |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
759 reg_list = gtk_hbox_new(FALSE, 5); |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
760 gtk_box_pack_start(GTK_BOX(vbox), reg_list, FALSE, FALSE, 5); |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
761 gtk_widget_show(reg_list); |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
762 |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
763 frame = gtk_frame_new(_("Registration Information")); |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
764 gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 5); |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
765 gtk_widget_show(frame); |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
766 |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
767 reg_area = gtk_hbox_new(FALSE, 5); |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
768 gtk_container_add(GTK_CONTAINER(frame), reg_area); |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
769 gtk_widget_show(reg_area); |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
770 |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
771 hbox = gtk_hbox_new(FALSE, 5); |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
772 gtk_box_pack_end(GTK_BOX(vbox), hbox, FALSE, FALSE, 5); |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
773 gtk_widget_show(hbox); |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
774 |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
775 close = picture_button(regdlg, _("Close"), cancel_xpm); |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
776 gtk_box_pack_end(GTK_BOX(hbox), close, FALSE, FALSE, 5); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4092
diff
changeset
|
777 g_signal_connect(GTK_OBJECT(close), "clicked", G_CALLBACK(delete_regdlg), NULL); |
2827
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
778 gtk_widget_show(close); |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
779 |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
780 reg_reg = picture_button(regdlg, _("Register"), ok_xpm); |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
781 gtk_box_pack_end(GTK_BOX(hbox), reg_reg, FALSE, FALSE, 5); |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
782 gtk_widget_show(reg_reg); |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
783 |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
784 /* fuck me */ |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
785 reset_reg_dlg(); |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
786 |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
787 gtk_widget_show(regdlg); |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2725
diff
changeset
|
788 } |
3035 | 789 |
4040 | 790 static gboolean delayed_unload(void *handle) { |
791 g_module_close(handle); | |
792 return FALSE; | |
793 } | |
794 | |
795 gboolean ref_protocol(struct prpl *p) { | |
796 #ifdef GAIM_PLUGINS | |
797 if(p->plug) { /* This protocol is a plugin */ | |
798 prpl_accounts[p->protocol]++; | |
799 debug_printf("Protocol %s now in use by %d connections.\n", p->name, prpl_accounts[p->protocol]); | |
800 if(!p->plug->handle) { /*But the protocol isn't yet loaded */ | |
801 unload_protocol(p); | |
802 if (load_prpl(p)) | |
803 return FALSE; | |
804 } | |
805 } | |
806 #endif /* GAIM_PLUGINS */ | |
807 return TRUE; | |
808 } | |
809 | |
810 void unref_protocol(struct prpl *p) { | |
811 #ifdef GAIM_PLUGINS | |
812 if(p->plug) { /* This protocol is a plugin */ | |
813 prpl_accounts[p->protocol]--; | |
814 debug_printf("Protocol %s now in use by %d connections.\n", p->name, prpl_accounts[p->protocol]); | |
815 if(prpl_accounts[p->protocol] == 0) { /* No longer needed */ | |
816 debug_printf("Throwing out %s protocol plugin\n", p->name); | |
4249 | 817 do_ask_cancel_by_handle(p->plug->handle); |
4040 | 818 g_timeout_add(0, delayed_unload, p->plug->handle); |
819 p->plug->handle = NULL; | |
820 } | |
821 } | |
822 #endif /* GAIM_PLUGINS */ | |
823 } | |
824 |