Mercurial > pidgin.yaz
annotate src/gtkdialogs.c @ 10501:4806967e093e
[gaim-migrate @ 11793]
bug fix
committer: Tailor Script <tailor@pidgin.im>
author | Sean Egan <seanegan@gmail.com> |
---|---|
date | Mon, 10 Jan 2005 15:05:22 +0000 |
parents | 387d06e21ae3 |
children | 4cc999cc6718 |
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"}, | |
68 {"Christian 'ChipX86' Hammond", N_("developer & webmaster"), NULL}, | |
10095
b28f9be379b3
[gaim-migrate @ 11114]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
9991
diff
changeset
|
69 {"Herman Bloggs", N_("win32 port"), "herman@bluedigits.com"}, |
9758 | 70 {"Nathan 'faceprint' Walp", N_("developer"), NULL}, |
71 {"Mark 'KingAnt' Doliner", N_("developer"), NULL}, | |
72 {"Ethan 'Paco-Paco' Blanton", N_("developer"), NULL}, | |
10370
acd5b7af0409
[gaim-migrate @ 11590]
Luke Schierer <lschiere@pidgin.im>
parents:
10369
diff
changeset
|
73 {"Etan 'deryni' Reisner", N_("developer"), NULL}, |
9758 | 74 {"Tim 'marv' Ringenbach", N_("developer"), NULL}, |
10369
584c792dd15c
[gaim-migrate @ 11588]
Luke Schierer <lschiere@pidgin.im>
parents:
10324
diff
changeset
|
75 {"Luke 'LSchiere' Schierer", N_("support"), "lschiere@users.sf.net"}, |
10116 | 76 {"Stu 'nosnilmot' Tomlinson", N_("developer"), NULL}, |
9758 | 77 {NULL, NULL, NULL} |
78 }; | |
79 | |
10372
618a330c0260
[gaim-migrate @ 11595]
Luke Schierer <lschiere@pidgin.im>
parents:
10371
diff
changeset
|
80 static struct developer patch_writers[] = { |
618a330c0260
[gaim-migrate @ 11595]
Luke Schierer <lschiere@pidgin.im>
parents:
10371
diff
changeset
|
81 {"Daniel 'datallah' Atallah", NULL, NULL}, |
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); |
216 gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0); | |
9753 | 217 |
9758 | 218 str = g_string_sized_new(4096); |
9753 | 219 |
10153 | 220 g_string_append(str, |
9758 | 221 _("Gaim is a modular messaging client capable of using " |
222 "AIM, MSN, Yahoo!, Jabber, ICQ, IRC, SILC, " | |
223 "Novell GroupWise, Napster, Zephyr, and Gadu-Gadu " | |
224 "all at once. It is written using " | |
225 "Gtk+ and is licensed under the GPL.<BR><BR>")); | |
9753 | 226 |
9758 | 227 g_string_append(str, "<FONT SIZE=\"4\">URL:</FONT> <A HREF=\"" |
228 GAIM_WEBSITE "\">" GAIM_WEBSITE "</A><BR/><BR/>"); | |
10493 | 229 #ifdef _WIN32 |
230 g_string_append_printf(str, _("<FONT SIZE=\"4\">IRC:</FONT> " | |
231 "#wingaim on irc.freenode.net<BR><BR>")); | |
232 #else | |
9758 | 233 g_string_append_printf(str, _("<FONT SIZE=\"4\">IRC:</FONT> " |
234 "#gaim on irc.freenode.net<BR><BR>")); | |
10493 | 235 #endif |
9753 | 236 |
237 /* Active Developers */ | |
9758 | 238 g_string_append_printf(str, "<FONT SIZE=\"4\">%s:</FONT><BR/>", |
239 _("Active Developers")); | |
240 for (i = 0; developers[i].name != NULL; i++) { | |
241 if (developers[i].email != NULL) { | |
10116 | 242 g_string_append_printf(str, " %s (%s) <<a href=\"mailto:%s\">%s</a>><br/>", |
9758 | 243 developers[i].name, _(developers[i].role), |
244 developers[i].email, developers[i].email); | |
245 } else { | |
246 g_string_append_printf(str, " %s (%s)<br/>", | |
247 developers[i].name, _(developers[i].role)); | |
248 } | |
249 } | |
250 g_string_append(str, "<BR/>"); | |
9709 | 251 |
9753 | 252 /* Crazy Patch Writers */ |
9758 | 253 g_string_append_printf(str, "<FONT SIZE=\"4\">%s:</FONT><BR/>", |
254 _("Crazy Patch Writers")); | |
10372
618a330c0260
[gaim-migrate @ 11595]
Luke Schierer <lschiere@pidgin.im>
parents:
10371
diff
changeset
|
255 for (i = 0; patch_writers[i].name != NULL; i++) { |
618a330c0260
[gaim-migrate @ 11595]
Luke Schierer <lschiere@pidgin.im>
parents:
10371
diff
changeset
|
256 if (patch_writers[i].email != NULL) { |
618a330c0260
[gaim-migrate @ 11595]
Luke Schierer <lschiere@pidgin.im>
parents:
10371
diff
changeset
|
257 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
|
258 patch_writers[i].name, |
618a330c0260
[gaim-migrate @ 11595]
Luke Schierer <lschiere@pidgin.im>
parents:
10371
diff
changeset
|
259 patch_writers[i].email, patch_writers[i].email); |
618a330c0260
[gaim-migrate @ 11595]
Luke Schierer <lschiere@pidgin.im>
parents:
10371
diff
changeset
|
260 } else { |
618a330c0260
[gaim-migrate @ 11595]
Luke Schierer <lschiere@pidgin.im>
parents:
10371
diff
changeset
|
261 g_string_append_printf(str, " %s<br/>", |
618a330c0260
[gaim-migrate @ 11595]
Luke Schierer <lschiere@pidgin.im>
parents:
10371
diff
changeset
|
262 patch_writers[i].name); |
618a330c0260
[gaim-migrate @ 11595]
Luke Schierer <lschiere@pidgin.im>
parents:
10371
diff
changeset
|
263 } |
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 g_string_append(str, "<BR/>"); |
9753 | 266 |
267 /* Retired Developers */ | |
9758 | 268 g_string_append_printf(str, "<FONT SIZE=\"4\">%s:</FONT><BR/>", |
269 _("Retired Developers")); | |
270 for (i = 0; retired_developers[i].name != NULL; i++) { | |
271 if (retired_developers[i].email != NULL) { | |
10116 | 272 g_string_append_printf(str, " %s (%s) <<a href=\"mailto:%s\">%s</a>><br/>", |
9758 | 273 retired_developers[i].name, _(retired_developers[i].role), |
274 retired_developers[i].email, retired_developers[i].email); | |
275 } else { | |
276 g_string_append_printf(str, " %s (%s)<br/>", | |
277 retired_developers[i].name, _(retired_developers[i].role)); | |
278 } | |
279 } | |
280 g_string_append(str, "<BR/>"); | |
9753 | 281 |
282 /* Current Translators */ | |
9758 | 283 g_string_append_printf(str, "<FONT SIZE=\"4\">%s:</FONT><BR/>", |
284 _("Current Translators")); | |
285 for (i = 0; current_translators[i].language != NULL; i++) { | |
286 if (current_translators[i].email != NULL) { | |
10116 | 287 g_string_append_printf(str, " <b>%s (%s)</b> - %s <<a href=\"mailto:%s\">%s</a>><br/>", |
9758 | 288 _(current_translators[i].language), |
289 current_translators[i].abbr, | |
290 _(current_translators[i].name), | |
291 current_translators[i].email, | |
292 current_translators[i].email); | |
293 } else { | |
294 g_string_append_printf(str, " <b>%s (%s)</b> - %s<br/>", | |
295 _(current_translators[i].language), | |
296 current_translators[i].abbr, | |
297 _(current_translators[i].name)); | |
298 } | |
299 } | |
300 g_string_append(str, "<BR/>"); | |
9753 | 301 |
302 /* Past Translators */ | |
9758 | 303 g_string_append_printf(str, "<FONT SIZE=\"4\">%s:</FONT><BR/>", |
304 _("Past Translators")); | |
305 for (i = 0; past_translators[i].language != NULL; i++) { | |
306 if (past_translators[i].email != NULL) { | |
10116 | 307 g_string_append_printf(str, " <b>%s (%s)</b> - %s <<a href=\"mailto:%s\">%s</a>><br/>", |
9758 | 308 _(past_translators[i].language), |
309 past_translators[i].abbr, | |
310 _(past_translators[i].name), | |
311 past_translators[i].email, | |
312 past_translators[i].email); | |
313 } else { | |
314 g_string_append_printf(str, " <b>%s (%s)</b> - %s<br/>", | |
315 _(past_translators[i].language), | |
316 past_translators[i].abbr, | |
317 _(past_translators[i].name)); | |
318 } | |
319 } | |
320 g_string_append(str, "<BR/>"); | |
321 | |
10411 | 322 /* The following primarly intented for user/developer interaction and thus |
323 ought not be translated */ | |
324 g_string_append(str, "<b>Gaim was compiled with the following:</b><br/>"); | |
325 #ifdef CONFIG_ARGS /* win32 build doesn't use configure */ | |
326 g_string_append(str, "Arguments to <i>./configure</i>: " CONFIG_ARGS "<br/>"); | |
327 #endif | |
328 #ifdef DEBUG | |
329 g_string_append(str, "Print debugging messages: Yes<br/>"); | |
330 #else | |
331 g_string_append(str, "Print debugging messages: No<br/>"); | |
332 #endif /* DEBUG */ | |
333 #ifdef ENABLE_BINRELOC | |
334 g_string_append(str, "Binary relocation: Enabled<br/>"); | |
335 #else | |
336 g_string_append(str, "Binary relocation: Disabled<br/>"); | |
337 #endif /* ENABLE_BINRELOC */ | |
338 #ifdef GAIM_PLUGINS | |
339 g_string_append(str, "Plugins: Enabled<br/>"); | |
340 #else | |
341 g_string_append(str, "Plugins: Disabled<br/>"); | |
342 #endif /* GAIM_PLUGINS */ | |
343 #ifdef HAVE_SSL | |
344 g_string_append(str, "SSL: Gaim was compiled with SSL support<br/>"); | |
345 #else | |
346 g_string_append(str, "SSL: Gaim was <b><i>NOT</i></b> compiled with any SSL support!<br/>"); | |
347 #endif | |
348 #ifdef HAVE_GNUTLS | |
349 g_string_append(str, "GNUTLS: Enabled<br/>"); | |
350 #else | |
351 g_string_append(str, "GNUTLS: Disabled<br/>"); | |
352 #endif | |
353 #ifdef HAVE_NSS | |
354 g_string_append(str, "NSS: Enabled<br/>"); | |
355 #else | |
356 g_string_append(str, "NSS: Disabled<br/>"); | |
357 #endif | |
358 #ifdef HAVE_TK | |
359 g_string_append(str, "TK: Yes<br/>"); | |
360 #else | |
361 g_string_append(str, "TK: No<br/>"); | |
362 #endif | |
363 #ifdef LIBZEPHYR_EXT | |
364 g_string_append(str, "External libzephyr: Yes<br/>"); | |
365 #else | |
366 g_string_append(str, "External libzephyr: No<br/>"); | |
367 #endif | |
368 #ifdef ZEPHYR_USES_KERBEROS | |
369 g_string_append(str, "Zephyr uses Kerberos: Yes<br/>"); | |
370 #else | |
371 g_string_append(str, "Zephyr uses Kerberos: No<br/>"); | |
372 #endif | |
373 #ifdef USE_AO | |
374 g_string_append(str, "AO: Yes<br/>"); | |
375 #else | |
376 g_string_append(str, "AO: No<br/>"); | |
377 #endif | |
378 #ifdef USE_NAS_AUDIO | |
379 g_string_append(str, "NAS Audio: Yes<br/>"); | |
380 #else | |
381 g_string_append(str, "NAS Audio: No<br/>"); | |
382 #endif | |
383 #ifdef USE_GTKSPELL | |
384 g_string_append(str, "GtkSpell: Enabled<br/>"); | |
385 #else | |
386 g_string_append(str, "GtkSpell: Disabled<br/>"); | |
387 #endif | |
388 #ifdef USE_SCREENSAVER | |
389 g_string_append(str, "XScreenSaver support: Yes<br/>"); | |
390 #else | |
391 g_string_append(str, "XScreenSaver support: No<br/>"); | |
392 #endif | |
393 #ifdef USE_SM | |
394 g_string_append(str, "X SM support: Yes<br/>"); | |
395 #else | |
396 g_string_append(str, "X SM support: No<br/>"); | |
397 #endif | |
398 | |
399 /* End of not to be translated section */ | |
400 | |
9758 | 401 gtk_imhtml_append_text(GTK_IMHTML(text), str->str, GTK_IMHTML_NO_SCROLL); |
402 g_string_free(str, TRUE); | |
9753 | 403 |
404 gtk_text_buffer_get_start_iter(gtk_text_view_get_buffer(GTK_TEXT_VIEW(text)), &iter); | |
405 gtk_text_buffer_place_cursor(gtk_text_view_get_buffer(GTK_TEXT_VIEW(text)), &iter); | |
10153 | 406 |
9753 | 407 /* Close Button */ |
408 bbox = gtk_hbutton_box_new(); | |
409 gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END); | |
410 gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 0); | |
411 | |
412 button = gtk_button_new_from_stock(GTK_STOCK_CLOSE); | |
413 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); | |
414 | |
415 g_signal_connect_swapped(G_OBJECT(button), "clicked", | |
416 G_CALLBACK(destroy_about), G_OBJECT(about)); | |
417 g_signal_connect(G_OBJECT(about), "destroy", | |
418 G_CALLBACK(destroy_about), G_OBJECT(about)); | |
419 | |
420 /* this makes the sizes not work? */ | |
421 GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT); | |
422 gtk_widget_grab_default(button); | |
423 | |
424 /* Let's give'em something to talk about -- woah woah woah */ | |
425 gtk_widget_show_all(about); | |
426 gtk_window_present(GTK_WINDOW(about)); | |
9709 | 427 } |
428 | |
9730 | 429 static void |
430 gaim_gtkdialogs_im_cb(gpointer data, GaimRequestFields *fields) | |
9709 | 431 { |
9730 | 432 GaimAccount *account; |
433 const char *username; | |
9709 | 434 |
9730 | 435 account = gaim_request_fields_get_account(fields, "account"); |
436 username = gaim_request_fields_get_string(fields, "screenname"); | |
9709 | 437 |
9730 | 438 gaim_gtkdialogs_im_with_user(account, username); |
9709 | 439 } |
440 | |
9730 | 441 void |
442 gaim_gtkdialogs_im(void) | |
9709 | 443 { |
9730 | 444 GaimRequestFields *fields; |
445 GaimRequestFieldGroup *group; | |
446 GaimRequestField *field; | |
9709 | 447 |
9730 | 448 fields = gaim_request_fields_new(); |
9709 | 449 |
9730 | 450 group = gaim_request_field_group_new(NULL); |
451 gaim_request_fields_add_group(fields, group); | |
9709 | 452 |
9730 | 453 field = gaim_request_field_string_new("screenname", _("_Screen name"), |
454 NULL, FALSE); | |
455 gaim_request_field_set_required(field, TRUE); | |
456 gaim_request_field_set_type_hint(field, "screenname"); | |
457 gaim_request_field_group_add_field(group, field); | |
9709 | 458 |
9730 | 459 field = gaim_request_field_account_new("account", _("_Account"), NULL); |
460 gaim_request_field_set_visible(field, | |
461 (gaim_connections_get_all() != NULL && | |
462 gaim_connections_get_all()->next != NULL)); | |
463 gaim_request_field_set_required(field, TRUE); | |
464 gaim_request_field_group_add_field(group, field); | |
465 | |
466 gaim_request_fields(gaim_get_blist(), _("New Instant Message"), | |
467 NULL, | |
468 _("Please enter the screen name of the person you " | |
469 "would like to IM."), | |
470 fields, | |
471 _("OK"), G_CALLBACK(gaim_gtkdialogs_im_cb), | |
472 _("Cancel"), NULL, | |
473 NULL); | |
9709 | 474 } |
475 | |
9730 | 476 void |
477 gaim_gtkdialogs_im_with_user(GaimAccount *account, const char *username) | |
9709 | 478 { |
9730 | 479 GaimConversation *conv; |
480 GaimConvWindow *win; | |
481 GaimGtkWindow *gtkwin; | |
9709 | 482 |
9753 | 483 g_return_if_fail(account != NULL); |
484 g_return_if_fail(username != NULL); | |
485 | |
10246 | 486 conv = gaim_find_conversation_with_account(GAIM_CONV_IM, username, account); |
9709 | 487 |
9730 | 488 if (conv == NULL) |
489 conv = gaim_conversation_new(GAIM_CONV_IM, account, username); | |
9709 | 490 |
9730 | 491 win = gaim_conversation_get_window(conv); |
492 gtkwin = GAIM_GTK_WINDOW(win); | |
9709 | 493 |
9730 | 494 gtk_window_present(GTK_WINDOW(gtkwin->window)); |
495 gaim_conv_window_switch_conversation(win, gaim_conversation_get_index(conv)); | |
9709 | 496 } |
497 | |
9730 | 498 static gboolean |
499 gaim_gtkdialogs_ee(const char *ee) | |
9709 | 500 { |
501 GtkWidget *window; | |
502 GtkWidget *hbox; | |
503 GtkWidget *label; | |
10219 | 504 GtkWidget *img; |
9709 | 505 gchar *norm = gaim_strreplace(ee, "rocksmyworld", ""); |
506 | |
507 label = gtk_label_new(NULL); | |
508 if (!strcmp(norm, "zilding")) | |
509 gtk_label_set_markup(GTK_LABEL(label), | |
510 "<span weight=\"bold\" size=\"large\" foreground=\"purple\">Amazing! Simply Amazing!</span>"); | |
511 else if (!strcmp(norm, "robflynn")) | |
512 gtk_label_set_markup(GTK_LABEL(label), | |
513 "<span weight=\"bold\" size=\"large\" foreground=\"#1f6bad\">Pimpin\' Penguin Style! *Waddle Waddle*</span>"); | |
514 else if (!strcmp(norm, "flynorange")) | |
515 gtk_label_set_markup(GTK_LABEL(label), | |
516 "<span weight=\"bold\" size=\"large\" foreground=\"blue\">You should be me. I'm so cute!</span>"); | |
517 else if (!strcmp(norm, "ewarmenhoven")) | |
518 gtk_label_set_markup(GTK_LABEL(label), | |
519 "<span weight=\"bold\" size=\"large\" foreground=\"orange\">Now that's what I like!</span>"); | |
520 else if (!strcmp(norm, "markster97")) | |
521 gtk_label_set_markup(GTK_LABEL(label), | |
522 "<span weight=\"bold\" size=\"large\" foreground=\"brown\">Ahh, and excellent choice!</span>"); | |
523 else if (!strcmp(norm, "seanegn")) | |
524 gtk_label_set_markup(GTK_LABEL(label), | |
525 "<span weight=\"bold\" size=\"large\" foreground=\"#009900\">Everytime you click my name, an angel gets its wings.</span>"); | |
526 else if (!strcmp(norm, "chipx86")) | |
527 gtk_label_set_markup(GTK_LABEL(label), | |
528 "<span weight=\"bold\" size=\"large\" foreground=\"red\">This sunflower seed taste like pizza.</span>"); | |
529 else if (!strcmp(norm, "markdoliner")) | |
530 gtk_label_set_markup(GTK_LABEL(label), | |
531 "<span weight=\"bold\" size=\"large\" foreground=\"#6364B1\">Hey! I was in that tumbleweed!</span>"); | |
532 else if (!strcmp(norm, "lschiere")) | |
533 gtk_label_set_markup(GTK_LABEL(label), | |
534 "<span weight=\"bold\" size=\"large\" foreground=\"gray\">I'm not anything.</span>"); | |
535 g_free(norm); | |
536 | |
537 if (strlen(gtk_label_get_label(GTK_LABEL(label))) <= 0) | |
538 return FALSE; | |
539 | |
540 window = gtk_dialog_new_with_buttons(GAIM_ALERT_TITLE, NULL, 0, GTK_STOCK_CLOSE, GTK_RESPONSE_OK, NULL); | |
541 gtk_dialog_set_default_response (GTK_DIALOG(window), GTK_RESPONSE_OK); | |
542 g_signal_connect(G_OBJECT(window), "response", G_CALLBACK(gtk_widget_destroy), NULL); | |
543 | |
544 gtk_container_set_border_width (GTK_CONTAINER(window), 6); | |
545 gtk_window_set_resizable(GTK_WINDOW(window), FALSE); | |
546 gtk_dialog_set_has_separator(GTK_DIALOG(window), FALSE); | |
547 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(window)->vbox), 12); | |
548 gtk_container_set_border_width (GTK_CONTAINER(GTK_DIALOG(window)->vbox), 6); | |
549 | |
550 hbox = gtk_hbox_new(FALSE, 12); | |
551 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(window)->vbox), hbox); | |
10219 | 552 img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_COOL, gtk_icon_size_from_name(GAIM_ICON_SIZE_DIALOG_COOL)); |
9709 | 553 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); |
554 | |
555 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); | |
556 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
557 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
558 | |
559 gtk_widget_show_all(window); | |
560 return TRUE; | |
561 } | |
562 | |
563 static void | |
9730 | 564 gaim_gtkdialogs_info_cb(gpointer data, GaimRequestFields *fields) |
9709 | 565 { |
566 char *username; | |
567 gboolean found = FALSE; | |
568 GaimAccount *account; | |
569 | |
570 account = gaim_request_fields_get_account(fields, "account"); | |
571 | |
572 username = g_strdup(gaim_normalize(account, | |
573 gaim_request_fields_get_string(fields, "screenname"))); | |
574 | |
575 if (username != NULL && gaim_str_has_suffix(username, "rocksmyworld")) | |
9730 | 576 found = gaim_gtkdialogs_ee(username); |
9709 | 577 |
578 if (!found && username != NULL && *username != '\0' && account != NULL) | |
579 serv_get_info(gaim_account_get_connection(account), username); | |
580 | |
581 g_free(username); | |
582 } | |
583 | |
584 void | |
9714 | 585 gaim_gtkdialogs_info(void) |
9709 | 586 { |
587 GaimRequestFields *fields; | |
588 GaimRequestFieldGroup *group; | |
589 GaimRequestField *field; | |
590 | |
591 fields = gaim_request_fields_new(); | |
592 | |
593 group = gaim_request_field_group_new(NULL); | |
594 gaim_request_fields_add_group(fields, group); | |
595 | |
596 field = gaim_request_field_string_new("screenname", _("_Screen name"), | |
597 NULL, FALSE); | |
598 gaim_request_field_set_type_hint(field, "screenname"); | |
599 gaim_request_field_set_required(field, TRUE); | |
600 gaim_request_field_group_add_field(group, field); | |
601 | |
602 field = gaim_request_field_account_new("account", _("_Account"), NULL); | |
603 gaim_request_field_set_visible(field, | |
604 (gaim_connections_get_all() != NULL && | |
605 gaim_connections_get_all()->next != NULL)); | |
606 gaim_request_field_set_required(field, TRUE); | |
607 gaim_request_field_group_add_field(group, field); | |
608 | |
609 gaim_request_fields(gaim_get_blist(), _("Get User Info"), | |
610 NULL, | |
611 _("Please enter the screen name of the person whose " | |
612 "info you would like to view."), | |
613 fields, | |
9730 | 614 _("OK"), G_CALLBACK(gaim_gtkdialogs_info_cb), |
9709 | 615 _("Cancel"), NULL, |
616 NULL); | |
617 } | |
618 | |
619 static void | |
9730 | 620 gaim_gtkdialogs_log_cb(gpointer data, GaimRequestFields *fields) |
9709 | 621 { |
622 char *username; | |
623 GaimAccount *account; | |
624 | |
625 account = gaim_request_fields_get_account(fields, "account"); | |
626 | |
627 username = g_strdup(gaim_normalize(account, | |
628 gaim_request_fields_get_string(fields, "screenname"))); | |
629 | |
9917 | 630 if(username != NULL && *username != '\0' && account != NULL ) |
631 gaim_gtk_log_show(GAIM_LOG_IM, username, account); | |
9709 | 632 |
633 g_free(username); | |
634 } | |
635 | |
9991 | 636 /* |
637 * TODO - This needs to deal with logs of all types, not just IM logs. | |
638 */ | |
9709 | 639 void |
9714 | 640 gaim_gtkdialogs_log(void) |
9709 | 641 { |
642 GaimRequestFields *fields; | |
643 GaimRequestFieldGroup *group; | |
644 GaimRequestField *field; | |
645 | |
646 fields = gaim_request_fields_new(); | |
647 | |
648 group = gaim_request_field_group_new(NULL); | |
649 gaim_request_fields_add_group(fields, group); | |
650 | |
651 field = gaim_request_field_string_new("screenname", _("_Screen name"), | |
652 NULL, FALSE); | |
653 gaim_request_field_set_type_hint(field, "screenname"); | |
654 gaim_request_field_set_required(field, TRUE); | |
655 gaim_request_field_group_add_field(group, field); | |
656 | |
657 field = gaim_request_field_account_new("account", _("_Account"), NULL); | |
658 gaim_request_field_account_set_show_all(field, TRUE); | |
659 gaim_request_field_set_visible(field, | |
660 (gaim_accounts_get_all() != NULL && | |
661 gaim_accounts_get_all()->next != NULL)); | |
662 gaim_request_field_set_required(field, TRUE); | |
663 gaim_request_field_group_add_field(group, field); | |
664 | |
665 gaim_request_fields(gaim_get_blist(), _("Get User Log"), | |
666 NULL, | |
667 _("Please enter the screen name of the person whose " | |
668 "log you would like to view."), | |
669 fields, | |
9730 | 670 _("OK"), G_CALLBACK(gaim_gtkdialogs_log_cb), |
9709 | 671 _("Cancel"), NULL, |
672 NULL); | |
673 } | |
674 | |
9730 | 675 static void |
676 gaim_gtkdialogs_warn_cb(GtkWidget *widget, gint resp, struct warning *w) | |
9709 | 677 { |
9730 | 678 if (resp == GTK_RESPONSE_OK) |
9753 | 679 serv_warn(w->gc, w->who, gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w->anon))); |
9709 | 680 |
9753 | 681 dialogwindows = g_list_remove(dialogwindows, w->window); |
682 gtk_widget_destroy(w->window); | |
683 | |
9730 | 684 g_free(w->who); |
685 g_free(w); | |
9709 | 686 } |
687 | |
9753 | 688 /* |
9991 | 689 * TODO - Make this use the request API, if possible. |
9753 | 690 */ |
9730 | 691 void |
692 gaim_gtkdialogs_warn(GaimConnection *gc, const char *who) | |
9709 | 693 { |
9753 | 694 gchar *labeltext; |
9730 | 695 GtkWidget *hbox, *vbox; |
9709 | 696 GtkWidget *label; |
9753 | 697 GtkWidget *img; |
698 struct warning *w; | |
9730 | 699 |
9753 | 700 g_return_if_fail(gc != NULL); |
701 g_return_if_fail(who != NULL); | |
702 | |
703 w = g_new0(struct warning, 1); | |
9730 | 704 w->who = g_strdup(who); |
705 w->gc = gc; | |
706 | |
9753 | 707 w->window = gtk_dialog_new_with_buttons(_("Warn User"), NULL, 0, |
9730 | 708 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, |
709 GAIM_STOCK_WARN, GTK_RESPONSE_OK, NULL); | |
710 gtk_dialog_set_default_response (GTK_DIALOG(w->window), GTK_RESPONSE_OK); | |
711 g_signal_connect(G_OBJECT(w->window), "response", G_CALLBACK(gaim_gtkdialogs_warn_cb), w); | |
712 | |
713 gtk_container_set_border_width (GTK_CONTAINER(w->window), 6); | |
714 gtk_window_set_resizable(GTK_WINDOW(w->window), FALSE); | |
715 gtk_dialog_set_has_separator(GTK_DIALOG(w->window), FALSE); | |
716 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(w->window)->vbox), 12); | |
717 gtk_container_set_border_width (GTK_CONTAINER(GTK_DIALOG(w->window)->vbox), 6); | |
9709 | 718 |
719 hbox = gtk_hbox_new(FALSE, 12); | |
9730 | 720 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(w->window)->vbox), hbox); |
9753 | 721 |
722 img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_WARNING, GTK_ICON_SIZE_DIALOG); | |
723 gtk_misc_set_alignment(GTK_MISC(img), 0, 0); | |
9730 | 724 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); |
9709 | 725 |
9730 | 726 vbox = gtk_vbox_new(FALSE, 0); |
727 gtk_container_add(GTK_CONTAINER(hbox), vbox); | |
728 labeltext = g_strdup_printf(_("<span weight=\"bold\" size=\"larger\">Warn %s?</span>\n\n" | |
729 "This will increase %s's warning level and he or she will be subject to harsher rate limiting.\n"), who, who); | |
730 label = gtk_label_new(NULL); | |
731 gtk_label_set_markup(GTK_LABEL(label), labeltext); | |
732 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); | |
733 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
734 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); | |
735 g_free(labeltext); | |
9709 | 736 |
9730 | 737 w->anon = gtk_check_button_new_with_mnemonic(_("Warn _anonymously?")); |
738 gtk_box_pack_start(GTK_BOX(vbox), w->anon, FALSE, FALSE, 0); | |
739 | |
740 hbox = gtk_hbox_new(FALSE, 6); | |
741 gtk_container_add(GTK_CONTAINER(vbox), hbox); | |
742 img = gtk_image_new_from_stock(GTK_STOCK_DIALOG_INFO, GTK_ICON_SIZE_MENU); | |
743 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); | |
744 labeltext = _("<b>Anonymous warnings are less severe.</b>"); | |
745 label = gtk_label_new(NULL); | |
746 gtk_label_set_markup(GTK_LABEL(label), labeltext); | |
747 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); | |
9709 | 748 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
749 | |
9730 | 750 dialogwindows = g_list_prepend(dialogwindows, w->window); |
751 gtk_widget_show_all(w->window); | |
9709 | 752 } |
753 | |
754 static void | |
9730 | 755 gaim_gtkdialogs_alias_contact_cb(GaimContact *contact, const char *new_alias) |
756 { | |
757 gaim_contact_set_alias(contact, new_alias); | |
758 } | |
759 | |
760 void | |
761 gaim_gtkdialogs_alias_contact(GaimContact *contact) | |
762 { | |
9753 | 763 g_return_if_fail(contact != NULL); |
764 | |
9730 | 765 gaim_request_input(NULL, _("Alias Contact"), NULL, |
766 _("Enter an alias for this contact."), | |
767 contact->alias, FALSE, FALSE, NULL, | |
768 _("Alias"), G_CALLBACK(gaim_gtkdialogs_alias_contact_cb), | |
769 _("Cancel"), NULL, contact); | |
770 } | |
771 | |
772 static void | |
773 gaim_gtkdialogs_alias_buddy_cb(GaimBuddy *buddy, const char *new_alias) | |
774 { | |
775 gaim_blist_alias_buddy(buddy, new_alias); | |
776 serv_alias_buddy(buddy); | |
777 } | |
778 | |
779 void | |
9753 | 780 gaim_gtkdialogs_alias_buddy(GaimBuddy *buddy) |
9730 | 781 { |
9753 | 782 gchar *secondary; |
783 | |
784 g_return_if_fail(buddy != NULL); | |
785 | |
786 secondary = g_strdup_printf(_("Enter an alias for %s."), buddy->name); | |
9730 | 787 |
788 gaim_request_input(NULL, _("Alias Buddy"), NULL, | |
9753 | 789 secondary, buddy->alias, FALSE, FALSE, NULL, |
9730 | 790 _("Alias"), G_CALLBACK(gaim_gtkdialogs_alias_buddy_cb), |
9753 | 791 _("Cancel"), NULL, buddy); |
9730 | 792 |
793 g_free(secondary); | |
794 } | |
795 | |
796 static void | |
797 gaim_gtkdialogs_alias_chat_cb(GaimChat *chat, const char *new_alias) | |
9709 | 798 { |
799 gaim_blist_alias_chat(chat, new_alias); | |
800 } | |
801 | |
802 void | |
9730 | 803 gaim_gtkdialogs_alias_chat(GaimChat *chat) |
9709 | 804 { |
9753 | 805 g_return_if_fail(chat != NULL); |
806 | |
9709 | 807 gaim_request_input(NULL, _("Alias Chat"), NULL, |
808 _("Enter an alias for this chat."), | |
809 chat->alias, FALSE, FALSE, NULL, | |
9730 | 810 _("Alias"), G_CALLBACK(gaim_gtkdialogs_alias_chat_cb), |
9709 | 811 _("Cancel"), NULL, chat); |
812 } | |
813 | |
814 static void | |
9753 | 815 gaim_gtkdialogs_remove_contact_cb(GaimContact *contact) |
9709 | 816 { |
9730 | 817 GaimBlistNode *bnode, *cnode; |
818 GaimGroup *group; | |
819 | |
820 cnode = (GaimBlistNode *)contact; | |
821 group = (GaimGroup*)cnode->parent; | |
822 for (bnode = cnode->child; bnode; bnode = bnode->next) { | |
823 GaimBuddy *buddy = (GaimBuddy*)bnode; | |
824 if (gaim_account_is_connected(buddy->account)) | |
825 serv_remove_buddy(buddy->account->gc, buddy, group); | |
826 } | |
827 gaim_blist_remove_contact(contact); | |
828 } | |
829 | |
830 void | |
831 gaim_gtkdialogs_remove_contact(GaimContact *contact) | |
832 { | |
833 GaimBuddy *buddy = gaim_contact_get_priority_buddy(contact); | |
834 | |
9753 | 835 g_return_if_fail(contact != NULL); |
836 g_return_if_fail(buddy != NULL); | |
9730 | 837 |
838 if (((GaimBlistNode*)contact)->child == (GaimBlistNode*)buddy && | |
839 !((GaimBlistNode*)buddy)->next) { | |
840 gaim_gtkdialogs_remove_buddy(buddy); | |
841 } else { | |
10324 | 842 gchar *text; |
843 text = g_strdup_printf( | |
844 ngettext( | |
845 "You are about to remove the contact containing %s " | |
846 "and %d other buddy from your buddy list. Do you " | |
847 "want to continue?", | |
848 "You are about to remove the contact containing %s " | |
849 "and %d other buddies from your buddy list. Do you " | |
850 "want to continue?", contact->totalsize - 1), | |
851 buddy->name, contact->totalsize - 1); | |
9730 | 852 |
10222 | 853 gaim_request_action(contact, NULL, _("Remove Contact"), text, 0, contact, 2, |
9753 | 854 _("Remove Contact"), G_CALLBACK(gaim_gtkdialogs_remove_contact_cb), |
9730 | 855 _("Cancel"), NULL); |
856 | |
857 g_free(text); | |
858 } | |
9709 | 859 } |
860 | |
861 void | |
9753 | 862 gaim_gtkdialogs_remove_group_cb(GaimGroup *group) |
9709 | 863 { |
9730 | 864 GaimBlistNode *cnode, *bnode; |
865 | |
866 cnode = ((GaimBlistNode*)group)->child; | |
867 | |
868 while (cnode) { | |
869 if (GAIM_BLIST_NODE_IS_CONTACT(cnode)) { | |
870 bnode = cnode->child; | |
871 cnode = cnode->next; | |
872 while (bnode) { | |
873 GaimBuddy *buddy; | |
874 if (GAIM_BLIST_NODE_IS_BUDDY(bnode)) { | |
875 GaimConversation *conv; | |
876 buddy = (GaimBuddy*)bnode; | |
877 bnode = bnode->next; | |
10246 | 878 conv = gaim_find_conversation_with_account(GAIM_CONV_IM, |
879 buddy->name, | |
880 buddy->account); | |
9730 | 881 if (gaim_account_is_connected(buddy->account)) { |
882 serv_remove_buddy(buddy->account->gc, buddy, group); | |
883 gaim_blist_remove_buddy(buddy); | |
884 if (conv) | |
885 gaim_conversation_update(conv, | |
886 GAIM_CONV_UPDATE_REMOVE); | |
887 } | |
888 } else { | |
889 bnode = bnode->next; | |
890 } | |
891 } | |
892 } else if (GAIM_BLIST_NODE_IS_CHAT(cnode)) { | |
893 GaimChat *chat = (GaimChat *)cnode; | |
894 cnode = cnode->next; | |
895 if (gaim_account_is_connected(chat->account)) | |
896 gaim_blist_remove_chat(chat); | |
897 } else { | |
898 cnode = cnode->next; | |
899 } | |
900 } | |
901 | |
902 gaim_blist_remove_group(group); | |
903 } | |
904 | |
905 void | |
906 gaim_gtkdialogs_remove_group(GaimGroup *group) | |
907 { | |
9753 | 908 gchar *text; |
909 | |
910 g_return_if_fail(group != NULL); | |
911 | |
912 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?"), | |
913 group->name); | |
9730 | 914 |
10222 | 915 gaim_request_action(group, NULL, _("Remove Group"), text, 0, group, 2, |
9753 | 916 _("Remove Group"), G_CALLBACK(gaim_gtkdialogs_remove_group_cb), |
9730 | 917 _("Cancel"), NULL); |
918 | |
919 g_free(text); | |
9709 | 920 } |
921 | |
10246 | 922 /* XXX - Some of this should be moved into the core, methinks. */ |
9709 | 923 static void |
9753 | 924 gaim_gtkdialogs_remove_buddy_cb(GaimBuddy *buddy) |
9709 | 925 { |
9730 | 926 GaimGroup *group; |
927 GaimConversation *conv; | |
928 gchar *name; | |
929 GaimAccount *account; | |
930 | |
931 group = gaim_find_buddys_group(buddy); | |
932 name = g_strdup(buddy->name); /* b->name is a crasher after remove_buddy */ | |
933 account = buddy->account; | |
934 | |
9753 | 935 gaim_debug_info("blist", "Removing '%s' from buddy list.\n", buddy->name); |
9991 | 936 /* TODO - Should remove from blist first... then call serv_remove_buddy()? */ |
9730 | 937 serv_remove_buddy(buddy->account->gc, buddy, group); |
938 gaim_blist_remove_buddy(buddy); | |
939 | |
10246 | 940 conv = gaim_find_conversation_with_account(GAIM_CONV_IM, name, account); |
9730 | 941 if (conv != NULL) |
942 gaim_conversation_update(conv, GAIM_CONV_UPDATE_REMOVE); | |
943 | |
944 g_free(name); | |
9709 | 945 } |
946 | |
947 void | |
9730 | 948 gaim_gtkdialogs_remove_buddy(GaimBuddy *buddy) |
9709 | 949 { |
9753 | 950 gchar *text; |
9730 | 951 |
9753 | 952 g_return_if_fail(buddy != NULL); |
9730 | 953 |
9753 | 954 text = g_strdup_printf(_("You are about to remove %s from your buddy list. Do you want to continue?"), |
955 buddy->name); | |
9730 | 956 |
10222 | 957 gaim_request_action(buddy, NULL, _("Remove Buddy"), text, 0, buddy, 2, |
9753 | 958 _("Remove Buddy"), G_CALLBACK(gaim_gtkdialogs_remove_buddy_cb), |
9730 | 959 _("Cancel"), NULL); |
960 | |
961 g_free(text); | |
962 } | |
9709 | 963 |
9730 | 964 static void |
9753 | 965 gaim_gtkdialogs_remove_chat_cb(GaimChat *chat) |
9730 | 966 { |
9918 | 967 char *name = NULL; |
10167 | 968 GaimAccount *account; |
9918 | 969 GaimConversation *conv = NULL; |
970 | |
10167 | 971 account = chat->account; |
972 | |
973 if (GAIM_PLUGIN_PROTOCOL_INFO(account->gc->prpl)->get_chat_name != NULL) | |
974 name = GAIM_PLUGIN_PROTOCOL_INFO(account->gc->prpl)->get_chat_name(chat->components); | |
9918 | 975 |
9730 | 976 gaim_blist_remove_chat(chat); |
9918 | 977 |
978 if (name != NULL) { | |
10246 | 979 conv = gaim_find_conversation_with_account(GAIM_CONV_CHAT, name, account); |
9918 | 980 g_free(name); |
981 } | |
982 | |
983 if (conv != NULL) | |
984 gaim_conversation_update(conv, GAIM_CONV_UPDATE_REMOVE); | |
9730 | 985 } |
9709 | 986 |
9730 | 987 void |
988 gaim_gtkdialogs_remove_chat(GaimChat *chat) | |
989 { | |
9753 | 990 gchar *name = gaim_chat_get_display_name(chat); |
991 gchar *text = g_strdup_printf(_("You are about to remove the chat %s from your buddy list. Do you want to continue?"), name); | |
992 | |
993 g_return_if_fail(chat != NULL); | |
9730 | 994 |
10222 | 995 gaim_request_action(chat, NULL, _("Remove Chat"), text, 0, chat, 2, |
9753 | 996 _("Remove Chat"), G_CALLBACK(gaim_gtkdialogs_remove_chat_cb), |
9730 | 997 _("Cancel"), NULL); |
998 | |
999 g_free(name); | |
1000 g_free(text); | |
9709 | 1001 } |