Mercurial > pidgin
annotate src/gtkdialogs.c @ 10589:0f7452b1f777
[gaim-migrate @ 11994]
Use GLib 2.6's gstdio functions. This should fix gaim not liking non-ascii filenames in win32.
committer: Tailor Script <tailor@pidgin.im>
author | Daniel Atallah <daniel.atallah@gmail.com> |
---|---|
date | Fri, 11 Feb 2005 05:10:40 +0000 |
parents | e8b160971254 |
children | 2e720df50861 |
rev | line source |
---|---|
9709 | 1 /* |
10297
ec140184437b
[gaim-migrate @ 11480]
Luke Schierer <lschiere@pidgin.im>
parents:
10266
diff
changeset
|
2 * @file gtkdialogs.c GTK+ Dialogs |
ec140184437b
[gaim-migrate @ 11480]
Luke Schierer <lschiere@pidgin.im>
parents:
10266
diff
changeset
|
3 * @ingroup gtkui |
ec140184437b
[gaim-migrate @ 11480]
Luke Schierer <lschiere@pidgin.im>
parents:
10266
diff
changeset
|
4 * |
9709 | 5 * gaim |
6 * | |
7 * Gaim is the legal property of its developers, whose names are too numerous | |
8 * to list here. Please refer to the COPYRIGHT file distributed with this | |
9 * source distribution. | |
10 * | |
11 * This program is free software; you can redistribute it and/or modify | |
12 * it under the terms of the GNU General Public License as published by | |
13 * the Free Software Foundation; either version 2 of the License, or | |
14 * (at your option) any later version. | |
15 * | |
16 * This program is distributed in the hope that it will be useful, | |
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 * GNU General Public License for more details. | |
20 * | |
21 * You should have received a copy of the GNU General Public License | |
22 * along with this program; if not, write to the Free Software | |
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
24 */ | |
9791 | 25 #include "internal.h" |
26 #include "gtkgaim.h" | |
9709 | 27 |
28 #include "debug.h" | |
29 #include "notify.h" | |
30 #include "prpl.h" | |
31 #include "request.h" | |
32 #include "util.h" | |
33 | |
34 #include "gtkdialogs.h" | |
35 #include "gtkimhtml.h" | |
36 #include "gtkimhtmltoolbar.h" | |
37 #include "gtklog.h" | |
38 #include "gtkutils.h" | |
10297
ec140184437b
[gaim-migrate @ 11480]
Luke Schierer <lschiere@pidgin.im>
parents:
10266
diff
changeset
|
39 #include "gtkstock.h" |
9709 | 40 |
9753 | 41 static GList *dialogwindows = NULL; |
9709 | 42 |
9753 | 43 static GtkWidget *about = NULL; |
9709 | 44 |
45 struct warning { | |
46 GtkWidget *window; | |
47 GtkWidget *anon; | |
48 char *who; | |
49 GaimConnection *gc; | |
50 }; | |
51 | |
9758 | 52 struct developer { |
53 char *name; | |
54 char *role; | |
55 char *email; | |
56 }; | |
57 | |
58 struct translator { | |
59 char *language; | |
60 char *abbr; | |
61 char *name; | |
62 char *email; | |
63 }; | |
64 | |
65 static struct developer developers[] = { | |
66 {"Rob Flynn", N_("maintainer"), "gaim@robflynn.com"}, | |
67 {"Sean Egan", N_("lead developer"), "sean.egan@binghamton.edu"}, | |
10508
4cc999cc6718
[gaim-migrate @ 11802]
Luke Schierer <lschiere@pidgin.im>
parents:
10493
diff
changeset
|
68 {"Daniel 'datallah' Atallah", N_("developer"), NULL}, |
9758 | 69 {"Christian 'ChipX86' Hammond", N_("developer & webmaster"), NULL}, |
10095
b28f9be379b3
[gaim-migrate @ 11114]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
9991
diff
changeset
|
70 {"Herman Bloggs", N_("win32 port"), "herman@bluedigits.com"}, |
9758 | 71 {"Nathan 'faceprint' Walp", N_("developer"), NULL}, |
72 {"Mark 'KingAnt' Doliner", N_("developer"), NULL}, | |
73 {"Ethan 'Paco-Paco' Blanton", N_("developer"), NULL}, | |
10370
acd5b7af0409
[gaim-migrate @ 11590]
Luke Schierer <lschiere@pidgin.im>
parents:
10369
diff
changeset
|
74 {"Etan 'deryni' Reisner", N_("developer"), NULL}, |
9758 | 75 {"Tim 'marv' Ringenbach", N_("developer"), NULL}, |
10369
584c792dd15c
[gaim-migrate @ 11588]
Luke Schierer <lschiere@pidgin.im>
parents:
10324
diff
changeset
|
76 {"Luke 'LSchiere' Schierer", N_("support"), "lschiere@users.sf.net"}, |
10116 | 77 {"Stu 'nosnilmot' Tomlinson", N_("developer"), NULL}, |
9758 | 78 {NULL, NULL, NULL} |
79 }; | |
80 | |
10372
618a330c0260
[gaim-migrate @ 11595]
Luke Schierer <lschiere@pidgin.im>
parents:
10371
diff
changeset
|
81 static struct developer patch_writers[] = { |
618a330c0260
[gaim-migrate @ 11595]
Luke Schierer <lschiere@pidgin.im>
parents:
10371
diff
changeset
|
82 {"Ka-Hing 'javabsp' Cheung", NULL, NULL}, |
618a330c0260
[gaim-migrate @ 11595]
Luke Schierer <lschiere@pidgin.im>
parents:
10371
diff
changeset
|
83 {"Felipe 'shx' Contreras", NULL, NULL}, |
618a330c0260
[gaim-migrate @ 11595]
Luke Schierer <lschiere@pidgin.im>
parents:
10371
diff
changeset
|
84 {"Decklin Foster", NULL, NULL}, |
618a330c0260
[gaim-migrate @ 11595]
Luke Schierer <lschiere@pidgin.im>
parents:
10371
diff
changeset
|
85 {"Gary 'grim' Kramlich", NULL, NULL}, |
618a330c0260
[gaim-migrate @ 11595]
Luke Schierer <lschiere@pidgin.im>
parents:
10371
diff
changeset
|
86 {"Robert 'Robot101' McQueen", NULL, NULL}, |
618a330c0260
[gaim-migrate @ 11595]
Luke Schierer <lschiere@pidgin.im>
parents:
10371
diff
changeset
|
87 {"Benjamin Miller", NULL, NULL}, |
618a330c0260
[gaim-migrate @ 11595]
Luke Schierer <lschiere@pidgin.im>
parents:
10371
diff
changeset
|
88 {"Kevin 'SimGuy' Stange", NULL, NULL}, |
618a330c0260
[gaim-migrate @ 11595]
Luke Schierer <lschiere@pidgin.im>
parents:
10371
diff
changeset
|
89 {NULL, NULL, NULL} |
618a330c0260
[gaim-migrate @ 11595]
Luke Schierer <lschiere@pidgin.im>
parents:
10371
diff
changeset
|
90 }; |
618a330c0260
[gaim-migrate @ 11595]
Luke Schierer <lschiere@pidgin.im>
parents:
10371
diff
changeset
|
91 |
9758 | 92 static struct developer retired_developers[] = { |
93 {"Adam Fritzler", N_("former libfaim maintainer"), NULL}, | |
94 {"Eric Warmenhoven", N_("former lead developer"), "warmenhoven@yahoo.com"}, | |
95 {"Jim Duchek", N_("former maintainer"), NULL}, | |
96 {"Jim Seymour", N_("former Jabber developer"), NULL}, | |
97 {"Mark Spencer", N_("original author"), "markster@marko.net"}, | |
98 {"Syd Logan", N_("hacker and designated driver [lazy bum]"), NULL}, | |
99 {NULL, NULL, NULL} | |
100 }; | |
101 | |
102 static struct translator current_translators[] = { | |
103 {N_("Bulgarian"), "bg", "Alexander Shopov", "al_shopov@users.sf.net"}, | |
10131 | 104 {N_("Catalan"), "ca", "Josep Puigdemont", "tradgnome@softcatala.org"}, |
9758 | 105 {N_("Czech"), "cs", "Miloslav Trmac", "mitr@volny.cz"}, |
106 {N_("Danish"), "da", "Morten Brix Pedersen", "morten@wtf.dk"}, | |
10131 | 107 {N_("Australian English"), "en_AU", "Peter Lawler", "trans@six-by-nine.com.au"}, |
9758 | 108 {N_("British English"), "en_GB", "Luke Ross", "lukeross@sys3175.co.uk"}, |
109 {N_("Canadian English"), "en_CA", "Adam Weinberger", "adamw@gnome.org"}, | |
110 {N_("German"), "de", "Björn Voigt", "bjoern@cs.tu-berlin.de"}, | |
111 {N_("Spanish"), "es", "Javier Fernández-Sanguino Peña", "jfs@debian.org"}, | |
112 {N_("Finnish"), "fi", "Arto Alakulju", "arto@alakulju.net"}, | |
113 {N_("French"), "fr", "Éric Boumaour", "zongo_fr@users.sourceforge.net"}, | |
114 {N_("Hebrew"), "he", "Pavel Bibergal", "cyberkm203@hotmail.com"}, | |
115 {N_("Hindi"), "hi", "Ravishankar Shrivastava", "raviratlami@yahoo.com"}, | |
116 {N_("Hungarian"), "hu", "Zoltan Sutto", "suttozoltan@chello.hu"}, | |
117 {N_("Italian"), "it", "Claudio Satriano", "satriano@na.infn.it"}, | |
118 {N_("Japanese"), "ja", "Takashi Aihana", "aihana@gnome.gr.jp"}, | |
119 {N_("Lithuanian"), "lt", "Gediminas Čičinskas", "gediminas@parok.lt"}, | |
120 {N_("Korean"), "ko", "Kyung-uk Son", "vvs740@chol.com"}, | |
121 {N_("Dutch; Flemish"), "nl", "Vincent van Adrighem", "V.vanAdrighem@dirck.mine.nu"}, | |
122 {N_("Macedonian"), "mk", "Tomislav Markovski", "herrera@users.sf.net"}, | |
123 {N_("Norwegian"), "no", "Petter Johan Olsen", "petter.olsen@cc.uit.no"}, | |
124 {N_("Polish"), "pl", "Krzysztof Foltman, Emil Nowak", "krzysztof@foltman.com;emil5@go2.pl"}, | |
125 {N_("Portuguese"), "pt", "Duarte Henriques", "duarte_henriques@myrealbox.com"}, | |
126 {N_("Portuguese-Brazil"), "pt_BR", "Maurício de Lemos Rodrigues Collares Neto", "mauricioc@gmail.com"}, | |
127 {N_("Romanian"), "ro", "Mişu Moldovan", "dumol@go.ro"}, | |
128 {N_("Russian"), "ru", "Dmitry Beloglazov", "dmaa@users.sf.net"}, | |
129 {N_("Serbian"), "sr", "Danilo Šegan, Aleksandar Urosevic", "dsegan@gmx.net;urke@users.sourceforge.net"}, | |
130 {N_("Slovenian"), "sl", "Matjaz Horvat", "matjaz@owca.info"}, | |
131 {N_("Swedish"), "sv", "Tore Lundqvist", "tlt@mima.x.se"}, | |
132 {N_("Vietnamese"), "vi", N_("T.M.Thanh and the Gnome-Vi Team"), "gnomevi-list@lists.sf.net"}, | |
133 {N_("Simplified Chinese"), "zh_CN", "Funda Wang", "fundawang@linux.net.cn"}, | |
134 {N_("Traditional Chinese"), "zh_TW", "Ambrose C. Li, Paladin R. Liu", "acli@ada.dhs.org;paladin@ms1.hinet.net"}, | |
135 {NULL, NULL, NULL, NULL} | |
136 }; | |
137 | |
138 | |
139 static struct translator past_translators[] = { | |
140 {N_("Amharic"), "am", "Daniel Yacob", NULL}, | |
141 {N_("Bulgarian"), "bg", "Hristo Todorov", NULL}, | |
142 {N_("Catalan"), "ca", "JM Pérez Cáncer", NULL}, | |
10131 | 143 {N_("Catalan"), "ca", "Robert Millan", NULL}, |
9758 | 144 {N_("Czech"), "cs", "Honza Král", NULL}, |
145 {N_("German"), "de", "Daniel Seifert, Karsten Weiss", NULL}, | |
146 {N_("Spanish"), "es", "Amaya Rodrigo, Alejandro G Villar, Nicolás Lichtmaier, JM Pérez Cáncer", NULL}, | |
147 {N_("Finnish"), "fi", "Tero Kuusela", NULL}, | |
148 {N_("French"), "fr", "Sébastien François, Stéphane Pontier, Stéphane Wirtel, Loïc Jeannin", NULL}, | |
149 {N_("Italian"), "it", "Salvatore di Maggio", NULL}, | |
150 {N_("Japanese"), "ja", "Ryosuke Kutsuna, Taku Yasui, Junichi Uekawa", NULL}, | |
151 {N_("Korean"), "ko", "Sang-hyun S, A Ho-seok Lee", NULL}, | |
152 {N_("Polish"), "pl", "Przemysław Sułek", NULL}, | |
153 {N_("Russian"), "ru", "Sergey Volozhanin", NULL}, | |
154 {N_("Russian"), "ru", "Alexandre Prokoudine", NULL}, | |
155 {N_("Slovak"), "sk", "Daniel Režný", NULL}, | |
156 {N_("Swedish"), "sv", "Christian Rose", NULL}, | |
157 {N_("Chinese"), "zh_CN, zh_TW", "Hashao, Rocky S. Lee", NULL}, | |
158 {NULL, NULL, NULL, NULL} | |
159 }; | |
160 | |
9730 | 161 void |
162 gaim_gtkdialogs_destroy_all() | |
9709 | 163 { |
9753 | 164 while (dialogwindows) { |
165 gtk_widget_destroy(dialogwindows->data); | |
166 dialogwindows = g_list_remove(dialogwindows, dialogwindows->data); | |
167 } | |
168 } | |
169 | |
170 static void destroy_about() | |
171 { | |
172 if (about != NULL) | |
173 gtk_widget_destroy(about); | |
174 about = NULL; | |
175 } | |
176 | |
177 void gaim_gtkdialogs_about(GtkWidget *w, void *data) | |
178 { | |
179 GtkWidget *hbox; | |
180 GtkWidget *vbox; | |
181 GtkWidget *logo; | |
10175 | 182 GtkWidget *frame; |
9753 | 183 GtkWidget *text; |
184 GtkWidget *bbox; | |
185 GtkWidget *button; | |
186 GtkTextIter iter; | |
9758 | 187 GString *str; |
188 int i; | |
10266 | 189 AtkObject *obj; |
9753 | 190 |
191 if (about != NULL) { | |
192 gtk_window_present(GTK_WINDOW(about)); | |
193 return; | |
194 } | |
195 | |
196 GAIM_DIALOG(about); | |
197 gtk_window_set_default_size(GTK_WINDOW(about), 450, -1); | |
198 gtk_window_set_title(GTK_WINDOW(about), _("About Gaim")); | |
199 gtk_window_set_role(GTK_WINDOW(about), "about"); | |
200 gtk_window_set_resizable(GTK_WINDOW(about), TRUE); | |
9778 | 201 gtk_window_set_default_size(GTK_WINDOW(about), 340, 550); /* Golden ratio in da hizzy */ |
9753 | 202 |
203 hbox = gtk_hbox_new(FALSE, 12); | |
204 gtk_container_set_border_width(GTK_CONTAINER(hbox), 12); | |
205 gtk_container_add(GTK_CONTAINER(about), hbox); | |
206 | |
207 vbox = gtk_vbox_new(FALSE, 12); | |
208 gtk_container_add(GTK_CONTAINER(hbox), vbox); | |
209 | |
210 logo = gtk_image_new_from_stock(GAIM_STOCK_LOGO, gtk_icon_size_from_name(GAIM_ICON_SIZE_LOGO)); | |
10266 | 211 obj = gtk_widget_get_accessible(logo); |
212 atk_object_set_description(obj, "Gaim " VERSION); | |
9753 | 213 gtk_box_pack_start(GTK_BOX(vbox), logo, FALSE, FALSE, 0); |
214 | |
10175 | 215 frame = gaim_gtk_create_imhtml(FALSE, &text, NULL); |
10522 | 216 gtk_imhtml_set_format_functions(GTK_IMHTML(text), GTK_IMHTML_ALL ^ GTK_IMHTML_SMILEY); |
10175 | 217 gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0); |
9753 | 218 |
9758 | 219 str = g_string_sized_new(4096); |
9753 | 220 |
10153 | 221 g_string_append(str, |
9758 | 222 _("Gaim is a modular messaging client capable of using " |
223 "AIM, MSN, Yahoo!, Jabber, ICQ, IRC, SILC, " | |
224 "Novell GroupWise, Napster, Zephyr, and Gadu-Gadu " | |
225 "all at once. It is written using " | |
226 "Gtk+ and is licensed under the GPL.<BR><BR>")); | |
9753 | 227 |
9758 | 228 g_string_append(str, "<FONT SIZE=\"4\">URL:</FONT> <A HREF=\"" |
229 GAIM_WEBSITE "\">" GAIM_WEBSITE "</A><BR/><BR/>"); | |
10493 | 230 #ifdef _WIN32 |
231 g_string_append_printf(str, _("<FONT SIZE=\"4\">IRC:</FONT> " | |
232 "#wingaim on irc.freenode.net<BR><BR>")); | |
233 #else | |
9758 | 234 g_string_append_printf(str, _("<FONT SIZE=\"4\">IRC:</FONT> " |
235 "#gaim on irc.freenode.net<BR><BR>")); | |
10493 | 236 #endif |
9753 | 237 |
238 /* Active Developers */ | |
9758 | 239 g_string_append_printf(str, "<FONT SIZE=\"4\">%s:</FONT><BR/>", |
240 _("Active Developers")); | |
241 for (i = 0; developers[i].name != NULL; i++) { | |
242 if (developers[i].email != NULL) { | |
10116 | 243 g_string_append_printf(str, " %s (%s) <<a href=\"mailto:%s\">%s</a>><br/>", |
9758 | 244 developers[i].name, _(developers[i].role), |
245 developers[i].email, developers[i].email); | |
246 } else { | |
247 g_string_append_printf(str, " %s (%s)<br/>", | |
248 developers[i].name, _(developers[i].role)); | |
249 } | |
250 } | |
251 g_string_append(str, "<BR/>"); | |
9709 | 252 |
9753 | 253 /* Crazy Patch Writers */ |
9758 | 254 g_string_append_printf(str, "<FONT SIZE=\"4\">%s:</FONT><BR/>", |
255 _("Crazy Patch Writers")); | |
10372
618a330c0260
[gaim-migrate @ 11595]
Luke Schierer <lschiere@pidgin.im>
parents:
10371
diff
changeset
|
256 for (i = 0; patch_writers[i].name != NULL; i++) { |
618a330c0260
[gaim-migrate @ 11595]
Luke Schierer <lschiere@pidgin.im>
parents:
10371
diff
changeset
|
257 if (patch_writers[i].email != NULL) { |
618a330c0260
[gaim-migrate @ 11595]
Luke Schierer <lschiere@pidgin.im>
parents:
10371
diff
changeset
|
258 g_string_append_printf(str, " %s <<a href=\"mailto:%s\">%s</a>><br/>", |
618a330c0260
[gaim-migrate @ 11595]
Luke Schierer <lschiere@pidgin.im>
parents:
10371
diff
changeset
|
259 patch_writers[i].name, |
618a330c0260
[gaim-migrate @ 11595]
Luke Schierer <lschiere@pidgin.im>
parents:
10371
diff
changeset
|
260 patch_writers[i].email, patch_writers[i].email); |
618a330c0260
[gaim-migrate @ 11595]
Luke Schierer <lschiere@pidgin.im>
parents:
10371
diff
changeset
|
261 } else { |
618a330c0260
[gaim-migrate @ 11595]
Luke Schierer <lschiere@pidgin.im>
parents:
10371
diff
changeset
|
262 g_string_append_printf(str, " %s<br/>", |
618a330c0260
[gaim-migrate @ 11595]
Luke Schierer <lschiere@pidgin.im>
parents:
10371
diff
changeset
|
263 patch_writers[i].name); |
618a330c0260
[gaim-migrate @ 11595]
Luke Schierer <lschiere@pidgin.im>
parents:
10371
diff
changeset
|
264 } |
618a330c0260
[gaim-migrate @ 11595]
Luke Schierer <lschiere@pidgin.im>
parents:
10371
diff
changeset
|
265 } |
618a330c0260
[gaim-migrate @ 11595]
Luke Schierer <lschiere@pidgin.im>
parents:
10371
diff
changeset
|
266 g_string_append(str, "<BR/>"); |
9753 | 267 |
268 /* Retired Developers */ | |
9758 | 269 g_string_append_printf(str, "<FONT SIZE=\"4\">%s:</FONT><BR/>", |
270 _("Retired Developers")); | |
271 for (i = 0; retired_developers[i].name != NULL; i++) { | |
272 if (retired_developers[i].email != NULL) { | |
10116 | 273 g_string_append_printf(str, " %s (%s) <<a href=\"mailto:%s\">%s</a>><br/>", |
9758 | 274 retired_developers[i].name, _(retired_developers[i].role), |
275 retired_developers[i].email, retired_developers[i].email); | |
276 } else { | |
277 g_string_append_printf(str, " %s (%s)<br/>", | |
278 retired_developers[i].name, _(retired_developers[i].role)); | |
279 } | |
280 } | |
281 g_string_append(str, "<BR/>"); | |
9753 | 282 |
283 /* Current Translators */ | |
9758 | 284 g_string_append_printf(str, "<FONT SIZE=\"4\">%s:</FONT><BR/>", |
285 _("Current Translators")); | |
286 for (i = 0; current_translators[i].language != NULL; i++) { | |
287 if (current_translators[i].email != NULL) { | |
10116 | 288 g_string_append_printf(str, " <b>%s (%s)</b> - %s <<a href=\"mailto:%s\">%s</a>><br/>", |
9758 | 289 _(current_translators[i].language), |
290 current_translators[i].abbr, | |
291 _(current_translators[i].name), | |
292 current_translators[i].email, | |
293 current_translators[i].email); | |
294 } else { | |
295 g_string_append_printf(str, " <b>%s (%s)</b> - %s<br/>", | |
296 _(current_translators[i].language), | |
297 current_translators[i].abbr, | |
298 _(current_translators[i].name)); | |
299 } | |
300 } | |
301 g_string_append(str, "<BR/>"); | |
9753 | 302 |
303 /* Past Translators */ | |
9758 | 304 g_string_append_printf(str, "<FONT SIZE=\"4\">%s:</FONT><BR/>", |
305 _("Past Translators")); | |
306 for (i = 0; past_translators[i].language != NULL; i++) { | |
307 if (past_translators[i].email != NULL) { | |
10116 | 308 g_string_append_printf(str, " <b>%s (%s)</b> - %s <<a href=\"mailto:%s\">%s</a>><br/>", |
9758 | 309 _(past_translators[i].language), |
310 past_translators[i].abbr, | |
311 _(past_translators[i].name), | |
312 past_translators[i].email, | |
313 past_translators[i].email); | |
314 } else { | |
315 g_string_append_printf(str, " <b>%s (%s)</b> - %s<br/>", | |
316 _(past_translators[i].language), | |
317 past_translators[i].abbr, | |
318 _(past_translators[i].name)); | |
319 } | |
320 } | |
321 g_string_append(str, "<BR/>"); | |
322 | |
10411 | 323 /* The following primarly intented for user/developer interaction and thus |
324 ought not be translated */ | |
325 g_string_append(str, "<b>Gaim was compiled with the following:</b><br/>"); | |
326 #ifdef CONFIG_ARGS /* win32 build doesn't use configure */ | |
327 g_string_append(str, "Arguments to <i>./configure</i>: " CONFIG_ARGS "<br/>"); | |
328 #endif | |
329 #ifdef DEBUG | |
330 g_string_append(str, "Print debugging messages: Yes<br/>"); | |
331 #else | |
332 g_string_append(str, "Print debugging messages: No<br/>"); | |
333 #endif /* DEBUG */ | |
334 #ifdef ENABLE_BINRELOC | |
335 g_string_append(str, "Binary relocation: Enabled<br/>"); | |
336 #else | |
337 g_string_append(str, "Binary relocation: Disabled<br/>"); | |
338 #endif /* ENABLE_BINRELOC */ | |
339 #ifdef GAIM_PLUGINS | |
340 g_string_append(str, "Plugins: Enabled<br/>"); | |
341 #else | |
342 g_string_append(str, "Plugins: Disabled<br/>"); | |
343 #endif /* GAIM_PLUGINS */ | |
344 #ifdef HAVE_SSL | |
345 g_string_append(str, "SSL: Gaim was compiled with SSL support<br/>"); | |
346 #else | |
347 g_string_append(str, "SSL: Gaim was <b><i>NOT</i></b> compiled with any SSL support!<br/>"); | |
348 #endif | |
349 #ifdef HAVE_GNUTLS | |
350 g_string_append(str, "GNUTLS: Enabled<br/>"); | |
351 #else | |
352 g_string_append(str, "GNUTLS: Disabled<br/>"); | |
353 #endif | |
354 #ifdef HAVE_NSS | |
355 g_string_append(str, "NSS: Enabled<br/>"); | |
356 #else | |
357 g_string_append(str, "NSS: Disabled<br/>"); | |
358 #endif | |
359 #ifdef HAVE_TK | |
360 g_string_append(str, "TK: Yes<br/>"); | |
361 #else | |
362 g_string_append(str, "TK: No<br/>"); | |
363 #endif | |
364 #ifdef LIBZEPHYR_EXT | |
365 g_string_append(str, "External libzephyr: Yes<br/>"); | |
366 #else | |
367 g_string_append(str, "External libzephyr: No<br/>"); | |
368 #endif | |
369 #ifdef ZEPHYR_USES_KERBEROS | |
370 g_string_append(str, "Zephyr uses Kerberos: Yes<br/>"); | |
371 #else | |
372 g_string_append(str, "Zephyr uses Kerberos: No<br/>"); | |
373 #endif | |
374 #ifdef USE_AO | |
375 g_string_append(str, "AO: Yes<br/>"); | |
376 #else | |
377 g_string_append(str, "AO: No<br/>"); | |
378 #endif | |
379 #ifdef USE_NAS_AUDIO | |
380 g_string_append(str, "NAS Audio: Yes<br/>"); | |
381 #else | |
382 g_string_append(str, "NAS Audio: No<br/>"); | |
383 #endif | |
384 #ifdef USE_GTKSPELL | |
385 g_string_append(str, "GtkSpell: Enabled<br/>"); | |
386 #else | |
387 g_string_append(str, "GtkSpell: Disabled<br/>"); | |
388 #endif | |
389 #ifdef USE_SCREENSAVER | |
390 g_string_append(str, "XScreenSaver support: Yes<br/>"); | |
391 #else | |
392 g_string_append(str, "XScreenSaver support: No<br/>"); | |
393 #endif | |
394 #ifdef USE_SM | |
395 g_string_append(str, "X SM support: Yes<br/>"); | |
396 #else | |
397 g_string_append(str, "X SM support: No<br/>"); | |
398 #endif | |
399 | |
400 /* End of not to be translated section */ | |
401 | |
9758 | 402 gtk_imhtml_append_text(GTK_IMHTML(text), str->str, GTK_IMHTML_NO_SCROLL); |
403 g_string_free(str, TRUE); | |
9753 | 404 |
405 gtk_text_buffer_get_start_iter(gtk_text_view_get_buffer(GTK_TEXT_VIEW(text)), &iter); | |
406 gtk_text_buffer_place_cursor(gtk_text_view_get_buffer(GTK_TEXT_VIEW(text)), &iter); | |
10153 | 407 |
9753 | 408 /* Close Button */ |
409 bbox = gtk_hbutton_box_new(); | |
410 gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END); | |
411 gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 0); | |
412 | |
413 button = gtk_button_new_from_stock(GTK_STOCK_CLOSE); | |
414 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); | |
415 | |
416 g_signal_connect_swapped(G_OBJECT(button), "clicked", | |
417 G_CALLBACK(destroy_about), G_OBJECT(about)); | |
418 g_signal_connect(G_OBJECT(about), "destroy", | |
419 G_CALLBACK(destroy_about), G_OBJECT(about)); | |
420 | |
421 /* this makes the sizes not work? */ | |
422 GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT); | |
423 gtk_widget_grab_default(button); | |
424 | |
425 /* Let's give'em something to talk about -- woah woah woah */ | |
426 gtk_widget_show_all(about); | |
427 gtk_window_present(GTK_WINDOW(about)); | |
9709 | 428 } |
429 | |
9730 | 430 static void |
431 gaim_gtkdialogs_im_cb(gpointer data, GaimRequestFields *fields) | |
9709 | 432 { |
9730 | 433 GaimAccount *account; |
434 const char *username; | |
9709 | 435 |
9730 | 436 account = gaim_request_fields_get_account(fields, "account"); |
437 username = gaim_request_fields_get_string(fields, "screenname"); | |
9709 | 438 |
9730 | 439 gaim_gtkdialogs_im_with_user(account, username); |
9709 | 440 } |
441 | |
9730 | 442 void |
443 gaim_gtkdialogs_im(void) | |
9709 | 444 { |
9730 | 445 GaimRequestFields *fields; |
446 GaimRequestFieldGroup *group; | |
447 GaimRequestField *field; | |
9709 | 448 |
9730 | 449 fields = gaim_request_fields_new(); |
9709 | 450 |
9730 | 451 group = gaim_request_field_group_new(NULL); |
452 gaim_request_fields_add_group(fields, group); | |
9709 | 453 |
9730 | 454 field = gaim_request_field_string_new("screenname", _("_Screen name"), |
455 NULL, FALSE); | |
456 gaim_request_field_set_required(field, TRUE); | |
457 gaim_request_field_set_type_hint(field, "screenname"); | |
458 gaim_request_field_group_add_field(group, field); | |
9709 | 459 |
9730 | 460 field = gaim_request_field_account_new("account", _("_Account"), NULL); |
461 gaim_request_field_set_visible(field, | |
462 (gaim_connections_get_all() != NULL && | |
463 gaim_connections_get_all()->next != NULL)); | |
464 gaim_request_field_set_required(field, TRUE); | |
465 gaim_request_field_group_add_field(group, field); | |
466 | |
467 gaim_request_fields(gaim_get_blist(), _("New Instant Message"), | |
468 NULL, | |
469 _("Please enter the screen name of the person you " | |
470 "would like to IM."), | |
471 fields, | |
472 _("OK"), G_CALLBACK(gaim_gtkdialogs_im_cb), | |
473 _("Cancel"), NULL, | |
474 NULL); | |
9709 | 475 } |
476 | |
9730 | 477 void |
478 gaim_gtkdialogs_im_with_user(GaimAccount *account, const char *username) | |
9709 | 479 { |
9730 | 480 GaimConversation *conv; |
481 GaimConvWindow *win; | |
482 GaimGtkWindow *gtkwin; | |
9709 | 483 |
9753 | 484 g_return_if_fail(account != NULL); |
485 g_return_if_fail(username != NULL); | |
486 | |
10246 | 487 conv = gaim_find_conversation_with_account(GAIM_CONV_IM, username, account); |
9709 | 488 |
9730 | 489 if (conv == NULL) |
490 conv = gaim_conversation_new(GAIM_CONV_IM, account, username); | |
9709 | 491 |
9730 | 492 win = gaim_conversation_get_window(conv); |
493 gtkwin = GAIM_GTK_WINDOW(win); | |
9709 | 494 |
9730 | 495 gtk_window_present(GTK_WINDOW(gtkwin->window)); |
496 gaim_conv_window_switch_conversation(win, gaim_conversation_get_index(conv)); | |
9709 | 497 } |
498 | |
9730 | 499 static gboolean |
500 gaim_gtkdialogs_ee(const char *ee) | |
9709 | 501 { |
502 GtkWidget *window; | |
503 GtkWidget *hbox; | |
504 GtkWidget *label; | |
10219 | 505 GtkWidget *img; |
9709 | 506 gchar *norm = gaim_strreplace(ee, "rocksmyworld", ""); |
507 | |
508 label = gtk_label_new(NULL); | |
509 if (!strcmp(norm, "zilding")) | |
510 gtk_label_set_markup(GTK_LABEL(label), | |
511 "<span weight=\"bold\" size=\"large\" foreground=\"purple\">Amazing! Simply Amazing!</span>"); | |
512 else if (!strcmp(norm, "robflynn")) | |
513 gtk_label_set_markup(GTK_LABEL(label), | |
514 "<span weight=\"bold\" size=\"large\" foreground=\"#1f6bad\">Pimpin\' Penguin Style! *Waddle Waddle*</span>"); | |
515 else if (!strcmp(norm, "flynorange")) | |
516 gtk_label_set_markup(GTK_LABEL(label), | |
517 "<span weight=\"bold\" size=\"large\" foreground=\"blue\">You should be me. I'm so cute!</span>"); | |
518 else if (!strcmp(norm, "ewarmenhoven")) | |
519 gtk_label_set_markup(GTK_LABEL(label), | |
520 "<span weight=\"bold\" size=\"large\" foreground=\"orange\">Now that's what I like!</span>"); | |
521 else if (!strcmp(norm, "markster97")) | |
522 gtk_label_set_markup(GTK_LABEL(label), | |
523 "<span weight=\"bold\" size=\"large\" foreground=\"brown\">Ahh, and excellent choice!</span>"); | |
524 else if (!strcmp(norm, "seanegn")) | |
525 gtk_label_set_markup(GTK_LABEL(label), | |
526 "<span weight=\"bold\" size=\"large\" foreground=\"#009900\">Everytime you click my name, an angel gets its wings.</span>"); | |
527 else if (!strcmp(norm, "chipx86")) | |
528 gtk_label_set_markup(GTK_LABEL(label), | |
529 "<span weight=\"bold\" size=\"large\" foreground=\"red\">This sunflower seed taste like pizza.</span>"); | |
530 else if (!strcmp(norm, "markdoliner")) | |
531 gtk_label_set_markup(GTK_LABEL(label), | |
532 "<span weight=\"bold\" size=\"large\" foreground=\"#6364B1\">Hey! I was in that tumbleweed!</span>"); | |
533 else if (!strcmp(norm, "lschiere")) | |
534 gtk_label_set_markup(GTK_LABEL(label), | |
535 "<span weight=\"bold\" size=\"large\" foreground=\"gray\">I'm not anything.</span>"); | |
536 g_free(norm); | |
537 | |
538 if (strlen(gtk_label_get_label(GTK_LABEL(label))) <= 0) | |
539 return FALSE; | |
540 | |
541 window = gtk_dialog_new_with_buttons(GAIM_ALERT_TITLE, NULL, 0, GTK_STOCK_CLOSE, GTK_RESPONSE_OK, NULL); | |
542 gtk_dialog_set_default_response (GTK_DIALOG(window), GTK_RESPONSE_OK); | |
543 g_signal_connect(G_OBJECT(window), "response", G_CALLBACK(gtk_widget_destroy), NULL); | |
544 | |
545 gtk_container_set_border_width (GTK_CONTAINER(window), 6); | |
546 gtk_window_set_resizable(GTK_WINDOW(window), FALSE); | |
547 gtk_dialog_set_has_separator(GTK_DIALOG(window), FALSE); | |
548 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(window)->vbox), 12); | |
549 gtk_container_set_border_width (GTK_CONTAINER(GTK_DIALOG(window)->vbox), 6); | |
550 | |
551 hbox = gtk_hbox_new(FALSE, 12); | |
552 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(window)->vbox), hbox); | |
10219 | 553 img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_COOL, gtk_icon_size_from_name(GAIM_ICON_SIZE_DIALOG_COOL)); |
9709 | 554 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); |
555 | |
556 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); | |
557 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
558 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
559 | |
560 gtk_widget_show_all(window); | |
561 return TRUE; | |
562 } | |
563 | |
564 static void | |
9730 | 565 gaim_gtkdialogs_info_cb(gpointer data, GaimRequestFields *fields) |
9709 | 566 { |
567 char *username; | |
568 gboolean found = FALSE; | |
569 GaimAccount *account; | |
570 | |
571 account = gaim_request_fields_get_account(fields, "account"); | |
572 | |
573 username = g_strdup(gaim_normalize(account, | |
574 gaim_request_fields_get_string(fields, "screenname"))); | |
575 | |
576 if (username != NULL && gaim_str_has_suffix(username, "rocksmyworld")) | |
9730 | 577 found = gaim_gtkdialogs_ee(username); |
9709 | 578 |
579 if (!found && username != NULL && *username != '\0' && account != NULL) | |
580 serv_get_info(gaim_account_get_connection(account), username); | |
581 | |
582 g_free(username); | |
583 } | |
584 | |
585 void | |
9714 | 586 gaim_gtkdialogs_info(void) |
9709 | 587 { |
588 GaimRequestFields *fields; | |
589 GaimRequestFieldGroup *group; | |
590 GaimRequestField *field; | |
591 | |
592 fields = gaim_request_fields_new(); | |
593 | |
594 group = gaim_request_field_group_new(NULL); | |
595 gaim_request_fields_add_group(fields, group); | |
596 | |
597 field = gaim_request_field_string_new("screenname", _("_Screen name"), | |
598 NULL, FALSE); | |
599 gaim_request_field_set_type_hint(field, "screenname"); | |
600 gaim_request_field_set_required(field, TRUE); | |
601 gaim_request_field_group_add_field(group, field); | |
602 | |
603 field = gaim_request_field_account_new("account", _("_Account"), NULL); | |
604 gaim_request_field_set_visible(field, | |
605 (gaim_connections_get_all() != NULL && | |
606 gaim_connections_get_all()->next != NULL)); | |
607 gaim_request_field_set_required(field, TRUE); | |
608 gaim_request_field_group_add_field(group, field); | |
609 | |
610 gaim_request_fields(gaim_get_blist(), _("Get User Info"), | |
611 NULL, | |
612 _("Please enter the screen name of the person whose " | |
613 "info you would like to view."), | |
614 fields, | |
9730 | 615 _("OK"), G_CALLBACK(gaim_gtkdialogs_info_cb), |
9709 | 616 _("Cancel"), NULL, |
617 NULL); | |
618 } | |
619 | |
620 static void | |
9730 | 621 gaim_gtkdialogs_log_cb(gpointer data, GaimRequestFields *fields) |
9709 | 622 { |
623 char *username; | |
624 GaimAccount *account; | |
625 | |
626 account = gaim_request_fields_get_account(fields, "account"); | |
627 | |
628 username = g_strdup(gaim_normalize(account, | |
629 gaim_request_fields_get_string(fields, "screenname"))); | |
630 | |
9917 | 631 if(username != NULL && *username != '\0' && account != NULL ) |
632 gaim_gtk_log_show(GAIM_LOG_IM, username, account); | |
9709 | 633 |
634 g_free(username); | |
635 } | |
636 | |
9991 | 637 /* |
638 * TODO - This needs to deal with logs of all types, not just IM logs. | |
639 */ | |
9709 | 640 void |
9714 | 641 gaim_gtkdialogs_log(void) |
9709 | 642 { |
643 GaimRequestFields *fields; | |
644 GaimRequestFieldGroup *group; | |
645 GaimRequestField *field; | |
646 | |
647 fields = gaim_request_fields_new(); | |
648 | |
649 group = gaim_request_field_group_new(NULL); | |
650 gaim_request_fields_add_group(fields, group); | |
651 | |
652 field = gaim_request_field_string_new("screenname", _("_Screen name"), | |
653 NULL, FALSE); | |
654 gaim_request_field_set_type_hint(field, "screenname"); | |
655 gaim_request_field_set_required(field, TRUE); | |
656 gaim_request_field_group_add_field(group, field); | |
657 | |
658 field = gaim_request_field_account_new("account", _("_Account"), NULL); | |
659 gaim_request_field_account_set_show_all(field, TRUE); | |
660 gaim_request_field_set_visible(field, | |
661 (gaim_accounts_get_all() != NULL && | |
662 gaim_accounts_get_all()->next != NULL)); | |
663 gaim_request_field_set_required(field, TRUE); | |
664 gaim_request_field_group_add_field(group, field); | |
665 | |
666 gaim_request_fields(gaim_get_blist(), _("Get User Log"), | |
667 NULL, | |
668 _("Please enter the screen name of the person whose " | |
669 "log you would like to view."), | |
670 fields, | |
9730 | 671 _("OK"), G_CALLBACK(gaim_gtkdialogs_log_cb), |
9709 | 672 _("Cancel"), NULL, |
673 NULL); | |
674 } | |
675 | |
9730 | 676 static void |
677 gaim_gtkdialogs_warn_cb(GtkWidget *widget, gint resp, struct warning *w) | |
9709 | 678 { |
9730 | 679 if (resp == GTK_RESPONSE_OK) |
9753 | 680 serv_warn(w->gc, w->who, gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w->anon))); |
9709 | 681 |
9753 | 682 dialogwindows = g_list_remove(dialogwindows, w->window); |
683 gtk_widget_destroy(w->window); | |
684 | |
9730 | 685 g_free(w->who); |
686 g_free(w); | |
9709 | 687 } |
688 | |
9753 | 689 /* |
9991 | 690 * TODO - Make this use the request API, if possible. |
9753 | 691 */ |
9730 | 692 void |
693 gaim_gtkdialogs_warn(GaimConnection *gc, const char *who) | |
9709 | 694 { |
9753 | 695 gchar *labeltext; |
9730 | 696 GtkWidget *hbox, *vbox; |
9709 | 697 GtkWidget *label; |
9753 | 698 GtkWidget *img; |
699 struct warning *w; | |
9730 | 700 |
9753 | 701 g_return_if_fail(gc != NULL); |
702 g_return_if_fail(who != NULL); | |
703 | |
704 w = g_new0(struct warning, 1); | |
9730 | 705 w->who = g_strdup(who); |
706 w->gc = gc; | |
707 | |
9753 | 708 w->window = gtk_dialog_new_with_buttons(_("Warn User"), NULL, 0, |
9730 | 709 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, |
710 GAIM_STOCK_WARN, GTK_RESPONSE_OK, NULL); | |
711 gtk_dialog_set_default_response (GTK_DIALOG(w->window), GTK_RESPONSE_OK); | |
712 g_signal_connect(G_OBJECT(w->window), "response", G_CALLBACK(gaim_gtkdialogs_warn_cb), w); | |
713 | |
714 gtk_container_set_border_width (GTK_CONTAINER(w->window), 6); | |
715 gtk_window_set_resizable(GTK_WINDOW(w->window), FALSE); | |
716 gtk_dialog_set_has_separator(GTK_DIALOG(w->window), FALSE); | |
717 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(w->window)->vbox), 12); | |
718 gtk_container_set_border_width (GTK_CONTAINER(GTK_DIALOG(w->window)->vbox), 6); | |
9709 | 719 |
720 hbox = gtk_hbox_new(FALSE, 12); | |
9730 | 721 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(w->window)->vbox), hbox); |
9753 | 722 |
723 img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_WARNING, GTK_ICON_SIZE_DIALOG); | |
724 gtk_misc_set_alignment(GTK_MISC(img), 0, 0); | |
9730 | 725 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); |
9709 | 726 |
9730 | 727 vbox = gtk_vbox_new(FALSE, 0); |
728 gtk_container_add(GTK_CONTAINER(hbox), vbox); | |
729 labeltext = g_strdup_printf(_("<span weight=\"bold\" size=\"larger\">Warn %s?</span>\n\n" | |
730 "This will increase %s's warning level and he or she will be subject to harsher rate limiting.\n"), who, who); | |
731 label = gtk_label_new(NULL); | |
732 gtk_label_set_markup(GTK_LABEL(label), labeltext); | |
733 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); | |
734 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
735 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); | |
736 g_free(labeltext); | |
9709 | 737 |
9730 | 738 w->anon = gtk_check_button_new_with_mnemonic(_("Warn _anonymously?")); |
739 gtk_box_pack_start(GTK_BOX(vbox), w->anon, FALSE, FALSE, 0); | |
740 | |
741 hbox = gtk_hbox_new(FALSE, 6); | |
742 gtk_container_add(GTK_CONTAINER(vbox), hbox); | |
743 img = gtk_image_new_from_stock(GTK_STOCK_DIALOG_INFO, GTK_ICON_SIZE_MENU); | |
744 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); | |
745 labeltext = _("<b>Anonymous warnings are less severe.</b>"); | |
746 label = gtk_label_new(NULL); | |
747 gtk_label_set_markup(GTK_LABEL(label), labeltext); | |
748 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); | |
9709 | 749 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
750 | |
9730 | 751 dialogwindows = g_list_prepend(dialogwindows, w->window); |
752 gtk_widget_show_all(w->window); | |
9709 | 753 } |
754 | |
755 static void | |
9730 | 756 gaim_gtkdialogs_alias_contact_cb(GaimContact *contact, const char *new_alias) |
757 { | |
758 gaim_contact_set_alias(contact, new_alias); | |
759 } | |
760 | |
761 void | |
762 gaim_gtkdialogs_alias_contact(GaimContact *contact) | |
763 { | |
9753 | 764 g_return_if_fail(contact != NULL); |
765 | |
9730 | 766 gaim_request_input(NULL, _("Alias Contact"), NULL, |
767 _("Enter an alias for this contact."), | |
768 contact->alias, FALSE, FALSE, NULL, | |
769 _("Alias"), G_CALLBACK(gaim_gtkdialogs_alias_contact_cb), | |
770 _("Cancel"), NULL, contact); | |
771 } | |
772 | |
773 static void | |
774 gaim_gtkdialogs_alias_buddy_cb(GaimBuddy *buddy, const char *new_alias) | |
775 { | |
776 gaim_blist_alias_buddy(buddy, new_alias); | |
777 serv_alias_buddy(buddy); | |
778 } | |
779 | |
780 void | |
9753 | 781 gaim_gtkdialogs_alias_buddy(GaimBuddy *buddy) |
9730 | 782 { |
9753 | 783 gchar *secondary; |
784 | |
785 g_return_if_fail(buddy != NULL); | |
786 | |
787 secondary = g_strdup_printf(_("Enter an alias for %s."), buddy->name); | |
9730 | 788 |
789 gaim_request_input(NULL, _("Alias Buddy"), NULL, | |
9753 | 790 secondary, buddy->alias, FALSE, FALSE, NULL, |
9730 | 791 _("Alias"), G_CALLBACK(gaim_gtkdialogs_alias_buddy_cb), |
9753 | 792 _("Cancel"), NULL, buddy); |
9730 | 793 |
794 g_free(secondary); | |
795 } | |
796 | |
797 static void | |
798 gaim_gtkdialogs_alias_chat_cb(GaimChat *chat, const char *new_alias) | |
9709 | 799 { |
800 gaim_blist_alias_chat(chat, new_alias); | |
801 } | |
802 | |
803 void | |
9730 | 804 gaim_gtkdialogs_alias_chat(GaimChat *chat) |
9709 | 805 { |
9753 | 806 g_return_if_fail(chat != NULL); |
807 | |
9709 | 808 gaim_request_input(NULL, _("Alias Chat"), NULL, |
809 _("Enter an alias for this chat."), | |
810 chat->alias, FALSE, FALSE, NULL, | |
9730 | 811 _("Alias"), G_CALLBACK(gaim_gtkdialogs_alias_chat_cb), |
9709 | 812 _("Cancel"), NULL, chat); |
813 } | |
814 | |
815 static void | |
9753 | 816 gaim_gtkdialogs_remove_contact_cb(GaimContact *contact) |
9709 | 817 { |
9730 | 818 GaimBlistNode *bnode, *cnode; |
819 GaimGroup *group; | |
820 | |
821 cnode = (GaimBlistNode *)contact; | |
822 group = (GaimGroup*)cnode->parent; | |
823 for (bnode = cnode->child; bnode; bnode = bnode->next) { | |
824 GaimBuddy *buddy = (GaimBuddy*)bnode; | |
825 if (gaim_account_is_connected(buddy->account)) | |
826 serv_remove_buddy(buddy->account->gc, buddy, group); | |
827 } | |
828 gaim_blist_remove_contact(contact); | |
829 } | |
830 | |
831 void | |
832 gaim_gtkdialogs_remove_contact(GaimContact *contact) | |
833 { | |
834 GaimBuddy *buddy = gaim_contact_get_priority_buddy(contact); | |
835 | |
9753 | 836 g_return_if_fail(contact != NULL); |
837 g_return_if_fail(buddy != NULL); | |
9730 | 838 |
839 if (((GaimBlistNode*)contact)->child == (GaimBlistNode*)buddy && | |
840 !((GaimBlistNode*)buddy)->next) { | |
841 gaim_gtkdialogs_remove_buddy(buddy); | |
842 } else { | |
10324 | 843 gchar *text; |
844 text = g_strdup_printf( | |
845 ngettext( | |
846 "You are about to remove the contact containing %s " | |
847 "and %d other buddy from your buddy list. Do you " | |
848 "want to continue?", | |
849 "You are about to remove the contact containing %s " | |
850 "and %d other buddies from your buddy list. Do you " | |
851 "want to continue?", contact->totalsize - 1), | |
852 buddy->name, contact->totalsize - 1); | |
9730 | 853 |
10222 | 854 gaim_request_action(contact, NULL, _("Remove Contact"), text, 0, contact, 2, |
9753 | 855 _("Remove Contact"), G_CALLBACK(gaim_gtkdialogs_remove_contact_cb), |
9730 | 856 _("Cancel"), NULL); |
857 | |
858 g_free(text); | |
859 } | |
9709 | 860 } |
861 | |
862 void | |
9753 | 863 gaim_gtkdialogs_remove_group_cb(GaimGroup *group) |
9709 | 864 { |
9730 | 865 GaimBlistNode *cnode, *bnode; |
866 | |
867 cnode = ((GaimBlistNode*)group)->child; | |
868 | |
869 while (cnode) { | |
870 if (GAIM_BLIST_NODE_IS_CONTACT(cnode)) { | |
871 bnode = cnode->child; | |
872 cnode = cnode->next; | |
873 while (bnode) { | |
874 GaimBuddy *buddy; | |
875 if (GAIM_BLIST_NODE_IS_BUDDY(bnode)) { | |
876 GaimConversation *conv; | |
877 buddy = (GaimBuddy*)bnode; | |
878 bnode = bnode->next; | |
10246 | 879 conv = gaim_find_conversation_with_account(GAIM_CONV_IM, |
880 buddy->name, | |
881 buddy->account); | |
9730 | 882 if (gaim_account_is_connected(buddy->account)) { |
883 serv_remove_buddy(buddy->account->gc, buddy, group); | |
884 gaim_blist_remove_buddy(buddy); | |
885 if (conv) | |
886 gaim_conversation_update(conv, | |
887 GAIM_CONV_UPDATE_REMOVE); | |
888 } | |
889 } else { | |
890 bnode = bnode->next; | |
891 } | |
892 } | |
893 } else if (GAIM_BLIST_NODE_IS_CHAT(cnode)) { | |
894 GaimChat *chat = (GaimChat *)cnode; | |
895 cnode = cnode->next; | |
896 if (gaim_account_is_connected(chat->account)) | |
897 gaim_blist_remove_chat(chat); | |
898 } else { | |
899 cnode = cnode->next; | |
900 } | |
901 } | |
902 | |
903 gaim_blist_remove_group(group); | |
904 } | |
905 | |
906 void | |
907 gaim_gtkdialogs_remove_group(GaimGroup *group) | |
908 { | |
9753 | 909 gchar *text; |
910 | |
911 g_return_if_fail(group != NULL); | |
912 | |
913 text = g_strdup_printf(_("You are about to remove the group %s and all its members from your buddy list. Do you want to continue?"), | |
914 group->name); | |
9730 | 915 |
10222 | 916 gaim_request_action(group, NULL, _("Remove Group"), text, 0, group, 2, |
9753 | 917 _("Remove Group"), G_CALLBACK(gaim_gtkdialogs_remove_group_cb), |
9730 | 918 _("Cancel"), NULL); |
919 | |
920 g_free(text); | |
9709 | 921 } |
922 | |
10246 | 923 /* XXX - Some of this should be moved into the core, methinks. */ |
9709 | 924 static void |
9753 | 925 gaim_gtkdialogs_remove_buddy_cb(GaimBuddy *buddy) |
9709 | 926 { |
9730 | 927 GaimGroup *group; |
928 GaimConversation *conv; | |
929 gchar *name; | |
930 GaimAccount *account; | |
931 | |
932 group = gaim_find_buddys_group(buddy); | |
933 name = g_strdup(buddy->name); /* b->name is a crasher after remove_buddy */ | |
934 account = buddy->account; | |
935 | |
9753 | 936 gaim_debug_info("blist", "Removing '%s' from buddy list.\n", buddy->name); |
9991 | 937 /* TODO - Should remove from blist first... then call serv_remove_buddy()? */ |
9730 | 938 serv_remove_buddy(buddy->account->gc, buddy, group); |
939 gaim_blist_remove_buddy(buddy); | |
940 | |
10246 | 941 conv = gaim_find_conversation_with_account(GAIM_CONV_IM, name, account); |
9730 | 942 if (conv != NULL) |
943 gaim_conversation_update(conv, GAIM_CONV_UPDATE_REMOVE); | |
944 | |
945 g_free(name); | |
9709 | 946 } |
947 | |
948 void | |
9730 | 949 gaim_gtkdialogs_remove_buddy(GaimBuddy *buddy) |
9709 | 950 { |
9753 | 951 gchar *text; |
9730 | 952 |
9753 | 953 g_return_if_fail(buddy != NULL); |
9730 | 954 |
9753 | 955 text = g_strdup_printf(_("You are about to remove %s from your buddy list. Do you want to continue?"), |
956 buddy->name); | |
9730 | 957 |
10222 | 958 gaim_request_action(buddy, NULL, _("Remove Buddy"), text, 0, buddy, 2, |
9753 | 959 _("Remove Buddy"), G_CALLBACK(gaim_gtkdialogs_remove_buddy_cb), |
9730 | 960 _("Cancel"), NULL); |
961 | |
962 g_free(text); | |
963 } | |
9709 | 964 |
9730 | 965 static void |
9753 | 966 gaim_gtkdialogs_remove_chat_cb(GaimChat *chat) |
9730 | 967 { |
9918 | 968 char *name = NULL; |
10167 | 969 GaimAccount *account; |
9918 | 970 GaimConversation *conv = NULL; |
971 | |
10167 | 972 account = chat->account; |
973 | |
974 if (GAIM_PLUGIN_PROTOCOL_INFO(account->gc->prpl)->get_chat_name != NULL) | |
975 name = GAIM_PLUGIN_PROTOCOL_INFO(account->gc->prpl)->get_chat_name(chat->components); | |
9918 | 976 |
9730 | 977 gaim_blist_remove_chat(chat); |
9918 | 978 |
979 if (name != NULL) { | |
10246 | 980 conv = gaim_find_conversation_with_account(GAIM_CONV_CHAT, name, account); |
9918 | 981 g_free(name); |
982 } | |
983 | |
984 if (conv != NULL) | |
985 gaim_conversation_update(conv, GAIM_CONV_UPDATE_REMOVE); | |
9730 | 986 } |
9709 | 987 |
9730 | 988 void |
989 gaim_gtkdialogs_remove_chat(GaimChat *chat) | |
990 { | |
9753 | 991 gchar *name = gaim_chat_get_display_name(chat); |
992 gchar *text = g_strdup_printf(_("You are about to remove the chat %s from your buddy list. Do you want to continue?"), name); | |
993 | |
994 g_return_if_fail(chat != NULL); | |
9730 | 995 |
10222 | 996 gaim_request_action(chat, NULL, _("Remove Chat"), text, 0, chat, 2, |
9753 | 997 _("Remove Chat"), G_CALLBACK(gaim_gtkdialogs_remove_chat_cb), |
9730 | 998 _("Cancel"), NULL); |
999 | |
1000 g_free(name); | |
1001 g_free(text); | |
9709 | 1002 } |