Mercurial > pidgin.yaz
comparison gtk/gtkdialogs.c @ 14191:009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
16854:16861, due to some vagaries of the way the original renames were
done. Witness that monotone can do in one revision what svn had to
spread across several.
author | Ethan Blanton <elb@pidgin.im> |
---|---|
date | Sat, 16 Dec 2006 04:59:55 +0000 |
parents | |
children | ec2cd563da47 |
comparison
equal
deleted
inserted
replaced
14190:366be2ce35a7 | 14191:009db0b357b5 |
---|---|
1 /* | |
2 * @file gtkdialogs.c GTK+ Dialogs | |
3 * @ingroup gtkui | |
4 * | |
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 */ | |
25 #include "internal.h" | |
26 #include "gtkgaim.h" | |
27 | |
28 #include "debug.h" | |
29 #include "notify.h" | |
30 #include "prpl.h" | |
31 #include "request.h" | |
32 #include "util.h" | |
33 | |
34 #include "gtkblist.h" | |
35 #include "gtkdialogs.h" | |
36 #include "gtkimhtml.h" | |
37 #include "gtkimhtmltoolbar.h" | |
38 #include "gtklog.h" | |
39 #include "gtkutils.h" | |
40 #include "gtkstock.h" | |
41 | |
42 static GList *dialogwindows = NULL; | |
43 | |
44 static GtkWidget *about = NULL; | |
45 | |
46 struct developer { | |
47 char *name; | |
48 char *role; | |
49 char *email; | |
50 }; | |
51 | |
52 struct translator { | |
53 char *language; | |
54 char *abbr; | |
55 char *name; | |
56 char *email; | |
57 }; | |
58 | |
59 /* Order: Lead Developer, then Alphabetical by Last Name */ | |
60 static struct developer developers[] = { | |
61 {"Sean Egan", N_("lead developer"), "sean.egan@gmail.com"}, | |
62 {"Daniel 'datallah' Atallah", N_("developer"), NULL}, | |
63 {"Ethan 'Paco-Paco' Blanton", N_("developer"), NULL}, | |
64 {"Herman Bloggs", N_("win32 port"), "herman@bluedigits.com"}, | |
65 {"Thomas Butter", N_("developer"), NULL}, | |
66 {"Mark 'KingAnt' Doliner", N_("developer"), NULL}, | |
67 {"Christian 'ChipX86' Hammond", N_("developer & webmaster"), NULL}, | |
68 {"Gary 'grim' Kramlich", N_("developer"), NULL}, | |
69 {"Richard 'rlaager' Laager", N_("developer"), NULL}, | |
70 {"Christopher 'siege' O'Brien", N_("developer"), "taliesein@users.sf.net"}, | |
71 {"Bartosz Oler", N_("developer"), NULL}, | |
72 {"Etan 'deryni' Reisner", N_("developer"), NULL}, | |
73 {"Tim 'marv' Ringenbach", N_("developer"), NULL}, | |
74 {"Luke 'LSchiere' Schierer", N_("support"), "lschiere@users.sf.net"}, | |
75 {"Evan Schoenberg", N_("developer"), NULL}, | |
76 {"Stu 'nosnilmot' Tomlinson", N_("developer"), NULL}, | |
77 {"Nathan 'faceprint' Walp", N_("developer"), NULL}, | |
78 {NULL, NULL, NULL} | |
79 }; | |
80 | |
81 /* Order: Alphabetical by Last Name */ | |
82 static struct developer patch_writers[] = { | |
83 {"Ka-Hing 'javabsp' Cheung", NULL, NULL}, | |
84 {"Sadrul Habib Chowdhury", NULL, NULL}, | |
85 {"Felipe 'shx' Contreras", NULL, NULL}, | |
86 {"Decklin Foster", NULL, NULL}, | |
87 {"Casey Harkins", NULL, NULL}, | |
88 {"Peter 'Bleeter' Lawler", NULL, NULL}, | |
89 {"Robert 'Robot101' McQueen", NULL, NULL}, | |
90 {"Benjamin Miller", NULL, NULL}, | |
91 {"Kevin 'SimGuy' Stange", NULL, NULL}, | |
92 {NULL, NULL, NULL} | |
93 }; | |
94 | |
95 /* Order: Alphabetical by Last Name */ | |
96 static struct developer retired_developers[] = { | |
97 {"Jim Duchek", N_("maintainer"), "jim@linuxpimps.com"}, | |
98 {"Rob Flynn", N_("maintainer"), "gaim@robflynn.com"}, | |
99 {"Adam Fritzler", N_("libfaim maintainer"), NULL}, | |
100 /* If "lazy bum" translates literally into a serious insult, use something else or omit it. */ | |
101 {"Syd Logan", N_("hacker and designated driver [lazy bum]"), NULL}, | |
102 {"Jim Seymour", N_("Jabber developer"), NULL}, | |
103 {"Mark Spencer", N_("original author"), "markster@marko.net"}, | |
104 {"Eric Warmenhoven", N_("lead developer"), "warmenhoven@yahoo.com"}, | |
105 {NULL, NULL, NULL} | |
106 }; | |
107 | |
108 /* Order: Code, then Alphabetical by Last Name */ | |
109 static struct translator current_translators[] = { | |
110 {N_("Bulgarian"), "bg", "Vladimira Girginova", "missing@here.is"}, | |
111 {N_("Bulgarian"), "bg", "Vladimir (Kaladan) Petkov", "vpetkov@i-space.org"}, | |
112 {N_("Bengali"), "bn", "INDRANIL DAS GUPTA", "indradg@l2c2.org"}, | |
113 {N_("Bengali"), "bn", "Samia Nimatullah", "mailsamia2001@yahoo.com"}, | |
114 {N_("Bosnian"), "bs", "Lejla Hadzialic", "lejlah@gmail.com"}, | |
115 {N_("Catalan"), "ca", "Josep Puigdemont", "tradgnome@softcatala.org"}, | |
116 {N_("Valencian-Catalan"), "ca@valencia", "Toni Hermoso", "toniher@softcatala.org"}, | |
117 {N_("Valencian-Catalan"), "ca@valencia", "Josep Puigdemont", "tradgnome@softcatala.org"}, | |
118 {N_("Czech"), "cs", "Miloslav Trmac", "mitr@volny.cz"}, | |
119 {N_("Danish"), "da", "Morten Brix Pedersen", "morten@wtf.dk"}, | |
120 {N_("German"), "de", "Björn Voigt", "bjoern@cs.tu-berlin.de"}, | |
121 {N_("German"), "de", "Jochen Kemnade", "kemnade@gmail.com"}, | |
122 {N_("Greek"), "el", "Katsaloulis Panayotis", "panayotis@panayotis.com"}, | |
123 {N_("Greek"), "el", "Bouklis Panos", "panos@echidna-band.com"}, | |
124 {N_("Australian English"), "en_AU", "Peter Lawler", "trans@six-by-nine.com.au"}, | |
125 {N_("Canadian English"), "en_CA", "Adam Weinberger", "adamw@gnome.org"}, | |
126 {N_("British English"), "en_GB", "Luke Ross", "lukeross@sys3175.co.uk"}, | |
127 {N_("Spanish"), "es", "Javier Fernández-Sanguino Peña", "jfs@debian.org"}, | |
128 {N_("Euskera(Basque)"), "eu", "Hizkuntza Politikarako Sailburuordetza", "hizkpol@ej-gv.es"}, | |
129 {N_("Euskera(Basque)"), "eu", "Iñaki Larrañaga Murgoitio", "dooteo@zundan.com"}, | |
130 {N_("Persian"), "fa", "Elnaz Sarbar", "elnaz@farsiweb.info"}, | |
131 {N_("Persian"), "fa", "Meelad Zakaria", "meelad@farsiweb.info"}, | |
132 {N_("Finnish"), "fi", "Timo Jyrinki", "timo.jyrinki@iki.fi"}, | |
133 {N_("French"), "fr", "Éric Boumaour", "zongo_fr@users.sourceforge.net"}, | |
134 {N_("Galician"), "gl", "Ignacio Casal Quinteiro", "nacho.resa@gmail.com"}, | |
135 {N_("Gujarati"), "gu", "Ankit Patel", "ankit_patel@users.sf.net"}, | |
136 {N_("Hebrew"), "he", "Shalom Craimer", "scraimer@gmail.com"}, | |
137 {N_("Hindi"), "hi", "Ravishankar Shrivastava", "raviratlami@yahoo.com"}, | |
138 {N_("Hungarian"), "hu", "Zoltan Sutto", "sutto.zoltan@rutinsoft.hu"}, | |
139 {N_("Italian"), "it", "Claudio Satriano", "satriano@na.infn.it"}, | |
140 {N_("Japanese"), "ja", "Takashi Aihana", "aihana@gnome.gr.jp"}, | |
141 {N_("Georgian"), "ka", "Ubuntu Georgian Translators", "alexander.didebulidze@stusta.mhn.de"}, | |
142 {N_("Korean"), "ko", "Kyung-uk Son", "vvs740@chol.com"}, | |
143 {N_("Kurdish"), "ku", "Erdal Ronahi", "erdal.ronahi@gmail.com"}, | |
144 {N_("Kurdish"), "ku", "Amed Ç. Jiyan", "amedcj@hotmail.com"}, | |
145 {N_("Kurdish"), "ku", "Rizoyê Xerzî", "rizoxerzi@hotmail.com"}, | |
146 {N_("Lithuanian"), "lt", "Laurynas Biveinis", "laurynas.biveinis@gmail.com"}, | |
147 {N_("Macedonian"), "mk", "Tomislav Markovski", "herrera@users.sf.net"}, | |
148 {N_("Nepali"), "ne", "Shyam Krishna Bal", "shyamkrishna_bal@yahoo.com"}, | |
149 {N_("Dutch, Flemish"), "nl", "Vincent van Adrighem", "V.vanAdrighem@dirck.mine.nu"}, | |
150 {N_("Norwegian"), "no", "Petter Johan Olsen", "petter.olsen@cc.uit.no"}, | |
151 {N_("Polish"), "pl", "Emil Nowak", "emil5@go2.pl"}, | |
152 {N_("Polish"), "pl", "Krzysztof Foltman", "krzysztof@foltman.com"}, | |
153 {N_("Portuguese"), "pt", "Duarte Henriques", "duarte_henriques@myrealbox.com"}, | |
154 {N_("Portuguese-Brazil"), "pt_BR", "Maurício de Lemos Rodrigues Collares Neto", "mauricioc@gmail.com"}, | |
155 {N_("Romanian"), "ro", "Mişu Moldovan", "dumol@gnome.ro"}, | |
156 {N_("Russian"), "ru", "Dmitry Beloglazov", "dmaa@users.sf.net"}, | |
157 {N_("Serbian"), "sr", "Danilo Šegan", "dsegan@gmx.net"}, | |
158 {N_("Serbian"), "sr", "Aleksandar Urosevic", "urke@users.sourceforge.net"}, | |
159 {N_("Slovak"), "sk", "Richard Golier", "golierr@gmail.com"}, | |
160 {N_("Slovenian"), "sl", "Matjaz Horvat", "matjaz@owca.info"}, | |
161 {N_("Swedish"), "sv", "Tore Lundqvist", "tlt@mima.x.se"}, | |
162 {N_("Tamil"), "ta", "Viveka Nathan K", "vivekanathan@users.sourceforge.net"}, | |
163 {N_("Telugu"), "te", "Mr. Subbaramaih", "info.gist@cdac.in"}, | |
164 {N_("Thai"), "th", "Isriya Paireepairit", "markpeak@gmail.com"}, | |
165 {N_("Turkish"), "tr", "Ahmet Alp BALKAN", "prf_q@users.sf.net"}, | |
166 {N_("Vietnamese"), "vi", N_("T.M.Thanh and the Gnome-Vi Team"), "gnomevi-list@lists.sf.net"}, | |
167 {N_("Simplified Chinese"), "zh_CN", "Funda Wang", "fundawang@linux.net.cn"}, | |
168 {N_("Traditional Chinese"), "zh_TW", "Ambrose C. Li", "acli@ada.dhs.org"}, | |
169 {N_("Traditional Chinese"), "zh_TW", "Paladin R. Liu", "paladin@ms1.hinet.net"}, | |
170 {NULL, NULL, NULL, NULL} | |
171 }; | |
172 | |
173 | |
174 static struct translator past_translators[] = { | |
175 {N_("Amharic"), "am", "Daniel Yacob", NULL}, | |
176 {N_("Bulgarian"), "bg", "Hristo Todorov", NULL}, | |
177 {N_("Catalan"), "ca", "JM Pérez Cáncer", NULL}, | |
178 {N_("Catalan"), "ca", "Robert Millan", NULL}, | |
179 {N_("Czech"), "cs", "Honza Král", NULL}, | |
180 {N_("German"), "de", "Daniel Seifert, Karsten Weiss", NULL}, | |
181 {N_("Spanish"), "es", "JM Pérez Cáncer", NULL}, | |
182 {N_("Spanish"), "es", "Nicolás Lichtmaier", NULL}, | |
183 {N_("Spanish"), "es", "Amaya Rodrigo", NULL}, | |
184 {N_("Spanish"), "es", "Alejandro G Villar", NULL}, | |
185 {N_("Finnish"), "fi", "Arto Alakulju", NULL}, | |
186 {N_("Finnish"), "fi", "Tero Kuusela", NULL}, | |
187 {N_("French"), "fr", "Sébastien François", NULL}, | |
188 {N_("French"), "fr", "Stéphane Pontier", NULL}, | |
189 {N_("French"), "fr", "Stéphane Wirtel", NULL}, | |
190 {N_("French"), "fr", "Loïc Jeannin", NULL}, | |
191 {N_("Hebrew"), "he", "Pavel Bibergal", NULL}, | |
192 {N_("Italian"), "it", "Salvatore di Maggio", NULL}, | |
193 {N_("Japanese"), "ja", "Ryosuke Kutsuna", NULL}, | |
194 {N_("Japanese"), "ja", "Taku Yasui", NULL}, | |
195 {N_("Japanese"), "ja", "Junichi Uekawa", NULL}, | |
196 {N_("Georgian"), "ka", "Temuri Doghonadze", NULL}, | |
197 {N_("Korean"), "ko", "Sang-hyun S, A Ho-seok Lee", NULL}, | |
198 {N_("Lithuanian"), "lt", "Andrius Štikonas", NULL}, | |
199 {N_("Lithuanian"), "lt", "Gediminas Čičinskas", NULL}, | |
200 {N_("Polish"), "pl", "Przemysław Sułek", NULL}, | |
201 {N_("Russian"), "ru", "Alexandre Prokoudine", NULL}, | |
202 {N_("Russian"), "ru", "Sergey Volozhanin", NULL}, | |
203 {N_("Slovak"), "sk", "Daniel Režný", NULL}, | |
204 {N_("Swedish"), "sv", "Christian Rose", NULL}, | |
205 {N_("Simplified Chinese"), "zh_CN", "Hashao, Rocky S. Lee", NULL}, | |
206 {N_("Traditional Chinese"), "zh_TW", "Hashao, Rocky S. Lee", NULL}, | |
207 {NULL, NULL, NULL, NULL} | |
208 }; | |
209 | |
210 void | |
211 gaim_gtkdialogs_destroy_all() | |
212 { | |
213 while (dialogwindows) { | |
214 gtk_widget_destroy(dialogwindows->data); | |
215 dialogwindows = g_list_remove(dialogwindows, dialogwindows->data); | |
216 } | |
217 } | |
218 | |
219 static void destroy_about() | |
220 { | |
221 if (about != NULL) | |
222 gtk_widget_destroy(about); | |
223 about = NULL; | |
224 } | |
225 | |
226 /* This function puts the version number onto the pixmap we use in the 'about' | |
227 * screen in Gaim. */ | |
228 static void | |
229 gaim_gtk_logo_versionize(GdkPixbuf **original, GtkWidget *widget) { | |
230 GdkPixmap *pixmap; | |
231 GtkStyle *style; | |
232 PangoContext *context; | |
233 PangoLayout *layout; | |
234 gchar *markup; | |
235 gint width, height; | |
236 gint lwidth = 0, lheight = 0; | |
237 | |
238 style = gtk_widget_get_style(widget); | |
239 | |
240 gdk_pixbuf_render_pixmap_and_mask(*original, &pixmap, NULL, 255); | |
241 width = gdk_pixbuf_get_width(*original); | |
242 height = gdk_pixbuf_get_height(*original); | |
243 g_object_unref(G_OBJECT(*original)); | |
244 | |
245 context = gtk_widget_get_pango_context(widget); | |
246 layout = pango_layout_new(context); | |
247 | |
248 markup = g_strdup_printf("<span foreground=\"#FFFFFF\" size=\"larger\">%s</span>", VERSION); | |
249 pango_layout_set_font_description(layout, style->font_desc); | |
250 pango_layout_set_markup(layout, markup, strlen(markup)); | |
251 g_free(markup); | |
252 | |
253 pango_layout_get_pixel_size(layout, &lwidth, &lheight); | |
254 gdk_draw_layout(GDK_DRAWABLE(pixmap), style->bg_gc[GTK_STATE_NORMAL], | |
255 width - (lwidth + 3), height - (lheight + 1), layout); | |
256 g_object_unref(G_OBJECT(layout)); | |
257 | |
258 *original = gdk_pixbuf_get_from_drawable(NULL, pixmap, NULL, | |
259 0, 0, 0, 0, | |
260 width, height); | |
261 g_object_unref(G_OBJECT(pixmap)); | |
262 } | |
263 | |
264 void gaim_gtkdialogs_about() | |
265 { | |
266 GtkWidget *hbox; | |
267 GtkWidget *vbox; | |
268 GtkWidget *logo; | |
269 GtkWidget *frame; | |
270 GtkWidget *text; | |
271 GtkWidget *bbox; | |
272 GtkWidget *button; | |
273 GtkTextIter iter; | |
274 GString *str; | |
275 int i; | |
276 AtkObject *obj; | |
277 char* filename; | |
278 GdkPixbuf *pixbuf; | |
279 | |
280 if (about != NULL) { | |
281 gtk_window_present(GTK_WINDOW(about)); | |
282 return; | |
283 } | |
284 | |
285 GAIM_DIALOG(about); | |
286 gtk_window_set_default_size(GTK_WINDOW(about), 450, -1); | |
287 gtk_window_set_title(GTK_WINDOW(about), _("About Gaim")); | |
288 gtk_window_set_role(GTK_WINDOW(about), "about"); | |
289 gtk_window_set_resizable(GTK_WINDOW(about), TRUE); | |
290 gtk_window_set_default_size(GTK_WINDOW(about), 340, 550); /* Golden ratio in da hizzy */ | |
291 | |
292 hbox = gtk_hbox_new(FALSE, GAIM_HIG_BORDER); | |
293 gtk_container_set_border_width(GTK_CONTAINER(hbox), GAIM_HIG_BORDER); | |
294 gtk_container_add(GTK_CONTAINER(about), hbox); | |
295 | |
296 vbox = gtk_vbox_new(FALSE, GAIM_HIG_BORDER); | |
297 gtk_container_add(GTK_CONTAINER(hbox), vbox); | |
298 | |
299 /* Generate a logo with a version number */ | |
300 logo = gtk_window_new(GTK_WINDOW_TOPLEVEL); | |
301 gtk_widget_realize(logo); | |
302 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "logo.png", NULL); | |
303 pixbuf = gdk_pixbuf_new_from_file(filename, NULL); | |
304 g_free(filename); | |
305 gaim_gtk_logo_versionize(&pixbuf, logo); | |
306 gtk_widget_destroy(logo); | |
307 logo = gtk_image_new_from_pixbuf(pixbuf); | |
308 gdk_pixbuf_unref(pixbuf); | |
309 /* Insert the logo */ | |
310 obj = gtk_widget_get_accessible(logo); | |
311 atk_object_set_description(obj, "Gaim " VERSION); | |
312 gtk_box_pack_start(GTK_BOX(vbox), logo, FALSE, FALSE, 0); | |
313 | |
314 frame = gaim_gtk_create_imhtml(FALSE, &text, NULL, NULL); | |
315 gtk_imhtml_set_format_functions(GTK_IMHTML(text), GTK_IMHTML_ALL ^ GTK_IMHTML_SMILEY); | |
316 gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0); | |
317 | |
318 str = g_string_sized_new(4096); | |
319 | |
320 g_string_append(str, | |
321 _("Gaim is a modular messaging client capable of using " | |
322 "AIM, MSN, Yahoo!, Jabber, ICQ, IRC, SILC, " | |
323 "Novell GroupWise, Lotus Sametime, Zephyr, and Gadu-Gadu " | |
324 "all at once. It is written using GTK+.<BR><BR>" | |
325 "You may modify and redistribute the program under " | |
326 "the terms of the GPL (version 2 or later). A copy of the GPL is " | |
327 "contained in the 'COPYING' file distributed with Gaim. " | |
328 "Gaim is copyrighted by its contributors. See the 'COPYRIGHT' " | |
329 "file for the complete list of contributors. We provide no " | |
330 "warranty for this program.<BR><BR>")); | |
331 | |
332 g_string_append(str, "<FONT SIZE=\"4\">URL:</FONT> <A HREF=\"" | |
333 GAIM_WEBSITE "\">" GAIM_WEBSITE "</A><BR/><BR/>"); | |
334 #ifdef _WIN32 | |
335 g_string_append_printf(str, _("<FONT SIZE=\"4\">IRC:</FONT> " | |
336 "#wingaim on irc.freenode.net<BR><BR>")); | |
337 #else | |
338 g_string_append_printf(str, _("<FONT SIZE=\"4\">IRC:</FONT> " | |
339 "#gaim on irc.freenode.net<BR><BR>")); | |
340 #endif | |
341 | |
342 /* Current Developers */ | |
343 g_string_append_printf(str, "<FONT SIZE=\"4\">%s:</FONT><BR/>", | |
344 _("Current Developers")); | |
345 for (i = 0; developers[i].name != NULL; i++) { | |
346 if (developers[i].email != NULL) { | |
347 g_string_append_printf(str, " %s (%s) <<a href=\"mailto:%s\">%s</a>><br/>", | |
348 developers[i].name, _(developers[i].role), | |
349 developers[i].email, developers[i].email); | |
350 } else { | |
351 g_string_append_printf(str, " %s (%s)<br/>", | |
352 developers[i].name, _(developers[i].role)); | |
353 } | |
354 } | |
355 g_string_append(str, "<BR/>"); | |
356 | |
357 /* Crazy Patch Writers */ | |
358 g_string_append_printf(str, "<FONT SIZE=\"4\">%s:</FONT><BR/>", | |
359 _("Crazy Patch Writers")); | |
360 for (i = 0; patch_writers[i].name != NULL; i++) { | |
361 if (patch_writers[i].email != NULL) { | |
362 g_string_append_printf(str, " %s <<a href=\"mailto:%s\">%s</a>><br/>", | |
363 patch_writers[i].name, | |
364 patch_writers[i].email, patch_writers[i].email); | |
365 } else { | |
366 g_string_append_printf(str, " %s<br/>", | |
367 patch_writers[i].name); | |
368 } | |
369 } | |
370 g_string_append(str, "<BR/>"); | |
371 | |
372 /* Retired Developers */ | |
373 g_string_append_printf(str, "<FONT SIZE=\"4\">%s:</FONT><BR/>", | |
374 _("Retired Developers")); | |
375 for (i = 0; retired_developers[i].name != NULL; i++) { | |
376 if (retired_developers[i].email != NULL) { | |
377 g_string_append_printf(str, " %s (%s) <<a href=\"mailto:%s\">%s</a>><br/>", | |
378 retired_developers[i].name, _(retired_developers[i].role), | |
379 retired_developers[i].email, retired_developers[i].email); | |
380 } else { | |
381 g_string_append_printf(str, " %s (%s)<br/>", | |
382 retired_developers[i].name, _(retired_developers[i].role)); | |
383 } | |
384 } | |
385 g_string_append(str, "<BR/>"); | |
386 | |
387 /* Current Translators */ | |
388 g_string_append_printf(str, "<FONT SIZE=\"4\">%s:</FONT><BR/>", | |
389 _("Current Translators")); | |
390 for (i = 0; current_translators[i].language != NULL; i++) { | |
391 if (current_translators[i].email != NULL) { | |
392 g_string_append_printf(str, " <b>%s (%s)</b> - %s <<a href=\"mailto:%s\">%s</a>><br/>", | |
393 _(current_translators[i].language), | |
394 current_translators[i].abbr, | |
395 _(current_translators[i].name), | |
396 current_translators[i].email, | |
397 current_translators[i].email); | |
398 } else { | |
399 g_string_append_printf(str, " <b>%s (%s)</b> - %s<br/>", | |
400 _(current_translators[i].language), | |
401 current_translators[i].abbr, | |
402 _(current_translators[i].name)); | |
403 } | |
404 } | |
405 g_string_append(str, "<BR/>"); | |
406 | |
407 /* Past Translators */ | |
408 g_string_append_printf(str, "<FONT SIZE=\"4\">%s:</FONT><BR/>", | |
409 _("Past Translators")); | |
410 for (i = 0; past_translators[i].language != NULL; i++) { | |
411 if (past_translators[i].email != NULL) { | |
412 g_string_append_printf(str, " <b>%s (%s)</b> - %s <<a href=\"mailto:%s\">%s</a>><br/>", | |
413 _(past_translators[i].language), | |
414 past_translators[i].abbr, | |
415 _(past_translators[i].name), | |
416 past_translators[i].email, | |
417 past_translators[i].email); | |
418 } else { | |
419 g_string_append_printf(str, " <b>%s (%s)</b> - %s<br/>", | |
420 _(past_translators[i].language), | |
421 past_translators[i].abbr, | |
422 _(past_translators[i].name)); | |
423 } | |
424 } | |
425 g_string_append(str, "<BR/>"); | |
426 | |
427 g_string_append_printf(str, "<FONT SIZE=\"4\">%s</FONT><br/>", _("Debugging Information")); | |
428 | |
429 /* The following primarly intented for user/developer interaction and thus | |
430 ought not be translated */ | |
431 | |
432 #ifdef CONFIG_ARGS /* win32 build doesn't use configure */ | |
433 g_string_append(str, " <b>Arguments to <i>./configure</i>:</b> " CONFIG_ARGS "<br/>"); | |
434 #endif | |
435 | |
436 #ifndef _WIN32 | |
437 #ifdef DEBUG | |
438 g_string_append(str, " <b>Print debugging messages:</b> Yes<br/>"); | |
439 #else | |
440 g_string_append(str, " <b>Print debugging messages:</b> No<br/>"); | |
441 #endif | |
442 | |
443 #ifdef ENABLE_BINRELOC | |
444 g_string_append(str, " <b>Binary relocation:</b> Enabled<br/>"); | |
445 #else | |
446 g_string_append(str, " <b>Binary relocation:</b> Disabled<br/>"); | |
447 #endif | |
448 #endif | |
449 | |
450 #ifdef GAIM_PLUGINS | |
451 g_string_append(str, " <b>Plugins:</b> Enabled<br/>"); | |
452 #else | |
453 g_string_append(str, " <b>Plugins:</b> Disabled<br/>"); | |
454 #endif | |
455 | |
456 #ifdef HAVE_SSL | |
457 g_string_append(str, " <b>SSL:</b> Gaim was compiled with SSL support.<br/>"); | |
458 #else | |
459 g_string_append(str, " <b>SSL:</b> Gaim was <b><i>NOT</i></b> compiled with any SSL support!<br/>"); | |
460 #endif | |
461 | |
462 /* This might be useful elsewhere too, but it is particularly useful for | |
463 * debugging stuff known to be GTK+/Glib bugs on Windows */ | |
464 #ifdef _WIN32 | |
465 g_string_append_printf(str, " <b>GTK+ Runtime:</b> %u.%u.%u<br/>" | |
466 " <b>Glib Runtime:</b> %u.%u.%u<br/>", | |
467 gtk_major_version, gtk_minor_version, gtk_micro_version, | |
468 glib_major_version, glib_minor_version, glib_micro_version); | |
469 #endif | |
470 | |
471 g_string_append(str, "<br/> <b>Library Support</b><br/>"); | |
472 | |
473 #ifdef HAVE_CYRUS_SASL | |
474 g_string_append_printf(str, " <b>Cyrus SASL:</b> Enabled<br/>"); | |
475 #else | |
476 g_string_append_printf(str, " <b>Cyrus SASL:</b> Disabled<br/>"); | |
477 #endif | |
478 | |
479 #ifndef _WIN32 | |
480 #ifdef HAVE_DBUS | |
481 g_string_append_printf(str, " <b>D-BUS:</b> Enabled<br/>"); | |
482 #else | |
483 g_string_append_printf(str, " <b>D-BUS:</b> Disabled<br/>"); | |
484 #endif | |
485 | |
486 #ifdef HAVE_EVOLUTION_ADDRESSBOOK | |
487 g_string_append_printf(str, " <b>Evolution Addressbook:</b> Enabled<br/>"); | |
488 #else | |
489 g_string_append_printf(str, " <b>Evolution Addressbook:</b> Disabled<br/>"); | |
490 #endif | |
491 #endif | |
492 | |
493 #ifdef HAVE_LIBGADU | |
494 #ifdef _WIN32 | |
495 g_string_append(str, " <b>Gadu-Gadu library (libgadu):</b> Internal<br/>"); | |
496 #else | |
497 g_string_append(str, " <b>Gadu-Gadu library (libgadu):</b> Enabled<br/>"); | |
498 #endif | |
499 #else | |
500 g_string_append(str, " <b>Gadu-Gadu library (libgadu):</b> Disabled<br/>"); | |
501 #endif | |
502 | |
503 #ifdef USE_GTKSPELL | |
504 g_string_append(str, " <b>GtkSpell:</b> Enabled<br/>"); | |
505 #else | |
506 g_string_append(str, " <b>GtkSpell:</b> Disabled<br/>"); | |
507 #endif | |
508 | |
509 #ifdef HAVE_GNUTLS | |
510 g_string_append(str, " <b>GnuTLS:</b> Enabled<br/>"); | |
511 #else | |
512 g_string_append(str, " <b>GnuTLS:</b> Disabled<br/>"); | |
513 #endif | |
514 | |
515 #ifndef _WIN32 | |
516 #ifdef USE_GSTREAMER | |
517 g_string_append(str, " <b>GStreamer:</b> Enabled<br/>"); | |
518 #else | |
519 g_string_append(str, " <b>GStreamer:</b> Disabled<br/>"); | |
520 #endif | |
521 #endif | |
522 | |
523 #ifdef ENABLE_MONO | |
524 g_string_append(str, " <b>Mono:</b> Enabled<br/>"); | |
525 #else | |
526 g_string_append(str, " <b>Mono:</b> Disabled<br/>"); | |
527 #endif | |
528 | |
529 #ifdef HAVE_NSS | |
530 g_string_append(str, " <b>Network Security Services (NSS):</b> Enabled<br/>"); | |
531 #else | |
532 g_string_append(str, " <b>Network Security Services (NSS):</b> Disabled<br/>"); | |
533 #endif | |
534 | |
535 #ifdef HAVE_PERL | |
536 g_string_append(str, " <b>Perl:</b> Enabled<br/>"); | |
537 #else | |
538 g_string_append(str, " <b>Perl:</b> Disabled<br/>"); | |
539 #endif | |
540 | |
541 #ifndef _WIN32 | |
542 #ifdef HAVE_STARTUP_NOTIFICATION | |
543 g_string_append(str, " <b>Startup Notification:</b> Enabled<br/>"); | |
544 #else | |
545 g_string_append(str, " <b>Startup Notification:</b> Disabled<br/>"); | |
546 #endif | |
547 #endif | |
548 | |
549 #ifdef HAVE_TCL | |
550 g_string_append(str, " <b>Tcl:</b> Enabled<br/>"); | |
551 #else | |
552 g_string_append(str, " <b>Tcl:</b> Disabled<br/>"); | |
553 #endif | |
554 | |
555 #ifdef HAVE_TK | |
556 g_string_append(str, " <b>Tk:</b> Enabled<br/>"); | |
557 #else | |
558 g_string_append(str, " <b>Tk:</b> Disabled<br/>"); | |
559 #endif | |
560 | |
561 #ifdef HAVE_LIBXML | |
562 g_string_append(str, " <b>XML Parser:</b> libxml2<br/>"); | |
563 #else | |
564 g_string_append(str, " <b>XML Parser:</b> GMarkup<br/>"); | |
565 #endif | |
566 | |
567 #ifndef _WIN32 | |
568 #ifdef USE_SM | |
569 g_string_append(str, " <b>X Session Management:</b> Enabled<br/>"); | |
570 #else | |
571 g_string_append(str, " <b>X Session Management:</b> Disabled<br/>"); | |
572 #endif | |
573 | |
574 #ifdef USE_SCREENSAVER | |
575 g_string_append(str, " <b>XScreenSaver:</b> Enabled<br/>"); | |
576 #else | |
577 g_string_append(str, " <b>XScreenSaver:</b> Disabled<br/>"); | |
578 #endif | |
579 | |
580 #ifdef LIBZEPHYR_EXT | |
581 g_string_append(str, " <b>Zephyr library (libzephyr):</b> External<br/>"); | |
582 #else | |
583 g_string_append(str, " <b>Zephyr library (libzephyr):</b> Not External<br/>"); | |
584 #endif | |
585 | |
586 #ifdef ZEPHYR_USES_KERBEROS | |
587 g_string_append(str, " <b>Zephyr uses Kerberos:</b> Yes<br/>"); | |
588 #else | |
589 g_string_append(str, " <b>Zephyr uses Kerberos:</b> No<br/>"); | |
590 #endif | |
591 #endif | |
592 | |
593 /* End of not to be translated section */ | |
594 | |
595 gtk_imhtml_append_text(GTK_IMHTML(text), str->str, GTK_IMHTML_NO_SCROLL); | |
596 g_string_free(str, TRUE); | |
597 | |
598 gtk_text_buffer_get_start_iter(gtk_text_view_get_buffer(GTK_TEXT_VIEW(text)), &iter); | |
599 gtk_text_buffer_place_cursor(gtk_text_view_get_buffer(GTK_TEXT_VIEW(text)), &iter); | |
600 | |
601 /* Close Button */ | |
602 bbox = gtk_hbutton_box_new(); | |
603 gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END); | |
604 gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 0); | |
605 | |
606 button = gtk_button_new_from_stock(GTK_STOCK_CLOSE); | |
607 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); | |
608 | |
609 g_signal_connect_swapped(G_OBJECT(button), "clicked", | |
610 G_CALLBACK(destroy_about), G_OBJECT(about)); | |
611 g_signal_connect(G_OBJECT(about), "destroy", | |
612 G_CALLBACK(destroy_about), G_OBJECT(about)); | |
613 | |
614 /* this makes the sizes not work? */ | |
615 GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT); | |
616 gtk_widget_grab_default(button); | |
617 | |
618 /* Let's give'em something to talk about -- woah woah woah */ | |
619 gtk_widget_show_all(about); | |
620 gtk_window_present(GTK_WINDOW(about)); | |
621 } | |
622 | |
623 static void | |
624 gaim_gtkdialogs_im_cb(gpointer data, GaimRequestFields *fields) | |
625 { | |
626 GaimAccount *account; | |
627 const char *username; | |
628 | |
629 account = gaim_request_fields_get_account(fields, "account"); | |
630 username = gaim_request_fields_get_string(fields, "screenname"); | |
631 | |
632 gaim_gtkdialogs_im_with_user(account, username); | |
633 } | |
634 | |
635 void | |
636 gaim_gtkdialogs_im(void) | |
637 { | |
638 GaimRequestFields *fields; | |
639 GaimRequestFieldGroup *group; | |
640 GaimRequestField *field; | |
641 | |
642 fields = gaim_request_fields_new(); | |
643 | |
644 group = gaim_request_field_group_new(NULL); | |
645 gaim_request_fields_add_group(fields, group); | |
646 | |
647 field = gaim_request_field_string_new("screenname", _("_Name"), NULL, FALSE); | |
648 gaim_request_field_set_type_hint(field, "screenname"); | |
649 gaim_request_field_set_required(field, TRUE); | |
650 gaim_request_field_group_add_field(group, field); | |
651 | |
652 field = gaim_request_field_account_new("account", _("_Account"), NULL); | |
653 gaim_request_field_set_type_hint(field, "account"); | |
654 gaim_request_field_set_visible(field, | |
655 (gaim_connections_get_all() != NULL && | |
656 gaim_connections_get_all()->next != NULL)); | |
657 gaim_request_field_set_required(field, TRUE); | |
658 gaim_request_field_group_add_field(group, field); | |
659 | |
660 gaim_request_fields(gaim_get_blist(), _("New Instant Message"), | |
661 NULL, | |
662 _("Please enter the screen name or alias of the person " | |
663 "you would like to IM."), | |
664 fields, | |
665 _("OK"), G_CALLBACK(gaim_gtkdialogs_im_cb), | |
666 _("Cancel"), NULL, | |
667 NULL); | |
668 } | |
669 | |
670 void | |
671 gaim_gtkdialogs_im_with_user(GaimAccount *account, const char *username) | |
672 { | |
673 GaimConversation *conv; | |
674 | |
675 g_return_if_fail(account != NULL); | |
676 g_return_if_fail(username != NULL); | |
677 | |
678 conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, username, account); | |
679 | |
680 if (conv == NULL) | |
681 conv = gaim_conversation_new(GAIM_CONV_TYPE_IM, account, username); | |
682 | |
683 gaim_gtkconv_present_conversation(conv); | |
684 } | |
685 | |
686 static gboolean | |
687 gaim_gtkdialogs_ee(const char *ee) | |
688 { | |
689 GtkWidget *window; | |
690 GtkWidget *hbox; | |
691 GtkWidget *label; | |
692 GtkWidget *img; | |
693 gchar *norm = gaim_strreplace(ee, "rocksmyworld", ""); | |
694 | |
695 label = gtk_label_new(NULL); | |
696 if (!strcmp(norm, "zilding")) | |
697 gtk_label_set_markup(GTK_LABEL(label), | |
698 "<span weight=\"bold\" size=\"large\" foreground=\"purple\">Amazing! Simply Amazing!</span>"); | |
699 else if (!strcmp(norm, "robflynn")) | |
700 gtk_label_set_markup(GTK_LABEL(label), | |
701 "<span weight=\"bold\" size=\"large\" foreground=\"#1f6bad\">Pimpin\' Penguin Style! *Waddle Waddle*</span>"); | |
702 else if (!strcmp(norm, "flynorange")) | |
703 gtk_label_set_markup(GTK_LABEL(label), | |
704 "<span weight=\"bold\" size=\"large\" foreground=\"blue\">You should be me. I'm so cute!</span>"); | |
705 else if (!strcmp(norm, "ewarmenhoven")) | |
706 gtk_label_set_markup(GTK_LABEL(label), | |
707 "<span weight=\"bold\" size=\"large\" foreground=\"orange\">Now that's what I like!</span>"); | |
708 else if (!strcmp(norm, "markster97")) | |
709 gtk_label_set_markup(GTK_LABEL(label), | |
710 "<span weight=\"bold\" size=\"large\" foreground=\"brown\">Ahh, and excellent choice!</span>"); | |
711 else if (!strcmp(norm, "seanegn")) | |
712 gtk_label_set_markup(GTK_LABEL(label), | |
713 "<span weight=\"bold\" size=\"large\" foreground=\"#009900\">Everytime you click my name, an angel gets its wings.</span>"); | |
714 else if (!strcmp(norm, "chipx86")) | |
715 gtk_label_set_markup(GTK_LABEL(label), | |
716 "<span weight=\"bold\" size=\"large\" foreground=\"red\">This sunflower seed taste like pizza.</span>"); | |
717 else if (!strcmp(norm, "markdoliner")) | |
718 gtk_label_set_markup(GTK_LABEL(label), | |
719 "<span weight=\"bold\" size=\"large\" foreground=\"#6364B1\">Hey! I was in that tumbleweed!</span>"); | |
720 else if (!strcmp(norm, "lschiere")) | |
721 gtk_label_set_markup(GTK_LABEL(label), | |
722 "<span weight=\"bold\" size=\"large\" foreground=\"gray\">I'm not anything.</span>"); | |
723 g_free(norm); | |
724 | |
725 if (strlen(gtk_label_get_label(GTK_LABEL(label))) <= 0) | |
726 return FALSE; | |
727 | |
728 window = gtk_dialog_new_with_buttons(GAIM_ALERT_TITLE, NULL, 0, GTK_STOCK_CLOSE, GTK_RESPONSE_OK, NULL); | |
729 gtk_dialog_set_default_response (GTK_DIALOG(window), GTK_RESPONSE_OK); | |
730 g_signal_connect(G_OBJECT(window), "response", G_CALLBACK(gtk_widget_destroy), NULL); | |
731 | |
732 gtk_container_set_border_width (GTK_CONTAINER(window), GAIM_HIG_BOX_SPACE); | |
733 gtk_window_set_resizable(GTK_WINDOW(window), FALSE); | |
734 gtk_dialog_set_has_separator(GTK_DIALOG(window), FALSE); | |
735 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(window)->vbox), GAIM_HIG_BORDER); | |
736 gtk_container_set_border_width (GTK_CONTAINER(GTK_DIALOG(window)->vbox), GAIM_HIG_BOX_SPACE); | |
737 | |
738 hbox = gtk_hbox_new(FALSE, GAIM_HIG_BORDER); | |
739 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(window)->vbox), hbox); | |
740 img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_COOL, gtk_icon_size_from_name(GAIM_ICON_SIZE_DIALOG_COOL)); | |
741 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); | |
742 | |
743 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); | |
744 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
745 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
746 | |
747 gtk_widget_show_all(window); | |
748 return TRUE; | |
749 } | |
750 | |
751 static void | |
752 gaim_gtkdialogs_info_cb(gpointer data, GaimRequestFields *fields) | |
753 { | |
754 char *username; | |
755 gboolean found = FALSE; | |
756 GaimAccount *account; | |
757 | |
758 account = gaim_request_fields_get_account(fields, "account"); | |
759 | |
760 username = g_strdup(gaim_normalize(account, | |
761 gaim_request_fields_get_string(fields, "screenname"))); | |
762 | |
763 if (username != NULL && gaim_str_has_suffix(username, "rocksmyworld")) | |
764 found = gaim_gtkdialogs_ee(username); | |
765 | |
766 if (!found && username != NULL && *username != '\0' && account != NULL) | |
767 serv_get_info(gaim_account_get_connection(account), username); | |
768 | |
769 g_free(username); | |
770 } | |
771 | |
772 void | |
773 gaim_gtkdialogs_info(void) | |
774 { | |
775 GaimRequestFields *fields; | |
776 GaimRequestFieldGroup *group; | |
777 GaimRequestField *field; | |
778 | |
779 fields = gaim_request_fields_new(); | |
780 | |
781 group = gaim_request_field_group_new(NULL); | |
782 gaim_request_fields_add_group(fields, group); | |
783 | |
784 field = gaim_request_field_string_new("screenname", _("_Name"), NULL, FALSE); | |
785 gaim_request_field_set_type_hint(field, "screenname"); | |
786 gaim_request_field_set_required(field, TRUE); | |
787 gaim_request_field_group_add_field(group, field); | |
788 | |
789 field = gaim_request_field_account_new("account", _("_Account"), NULL); | |
790 gaim_request_field_set_type_hint(field, "account"); | |
791 gaim_request_field_set_visible(field, | |
792 (gaim_connections_get_all() != NULL && | |
793 gaim_connections_get_all()->next != NULL)); | |
794 gaim_request_field_set_required(field, TRUE); | |
795 gaim_request_field_group_add_field(group, field); | |
796 | |
797 gaim_request_fields(gaim_get_blist(), _("Get User Info"), | |
798 NULL, | |
799 _("Please enter the screen name or alias of the person " | |
800 "whose info you would like to view."), | |
801 fields, | |
802 _("OK"), G_CALLBACK(gaim_gtkdialogs_info_cb), | |
803 _("Cancel"), NULL, | |
804 NULL); | |
805 } | |
806 | |
807 static void | |
808 gaim_gtkdialogs_log_cb(gpointer data, GaimRequestFields *fields) | |
809 { | |
810 char *username; | |
811 GaimAccount *account; | |
812 | |
813 account = gaim_request_fields_get_account(fields, "account"); | |
814 | |
815 username = g_strdup(gaim_normalize(account, | |
816 gaim_request_fields_get_string(fields, "screenname"))); | |
817 | |
818 if (username != NULL && *username != '\0' && account != NULL) | |
819 { | |
820 GaimGtkBuddyList *gtkblist = gaim_gtk_blist_get_default_gtk_blist(); | |
821 | |
822 gaim_gtk_set_cursor(gtkblist->window, GDK_WATCH); | |
823 | |
824 gaim_gtk_log_show(GAIM_LOG_IM, username, account); | |
825 | |
826 gaim_gtk_clear_cursor(gtkblist->window); | |
827 } | |
828 | |
829 g_free(username); | |
830 } | |
831 | |
832 /* | |
833 * TODO - This needs to deal with logs of all types, not just IM logs. | |
834 */ | |
835 void | |
836 gaim_gtkdialogs_log(void) | |
837 { | |
838 GaimRequestFields *fields; | |
839 GaimRequestFieldGroup *group; | |
840 GaimRequestField *field; | |
841 | |
842 fields = gaim_request_fields_new(); | |
843 | |
844 group = gaim_request_field_group_new(NULL); | |
845 gaim_request_fields_add_group(fields, group); | |
846 | |
847 field = gaim_request_field_string_new("screenname", _("_Name"), NULL, FALSE); | |
848 gaim_request_field_set_type_hint(field, "screenname-all"); | |
849 gaim_request_field_set_required(field, TRUE); | |
850 gaim_request_field_group_add_field(group, field); | |
851 | |
852 field = gaim_request_field_account_new("account", _("_Account"), NULL); | |
853 | |
854 /* gaim_request_field_account_new() only sets a default value if you're | |
855 * connected, and it sets it from the list of connected accounts. Since | |
856 * we're going to set show_all here, it makes sense to use the first | |
857 * account, not the first connected account. */ | |
858 if (gaim_accounts_get_all() != NULL) { | |
859 gaim_request_field_account_set_default_value(field, gaim_accounts_get_all()->data); | |
860 gaim_request_field_account_set_value(field, gaim_accounts_get_all()->data); | |
861 } | |
862 | |
863 gaim_request_field_set_type_hint(field, "account"); | |
864 gaim_request_field_account_set_show_all(field, TRUE); | |
865 gaim_request_field_set_visible(field, | |
866 (gaim_accounts_get_all() != NULL && | |
867 gaim_accounts_get_all()->next != NULL)); | |
868 gaim_request_field_set_required(field, TRUE); | |
869 gaim_request_field_group_add_field(group, field); | |
870 | |
871 gaim_request_fields(gaim_get_blist(), _("View User Log"), | |
872 NULL, | |
873 _("Please enter the screen name or alias of the person " | |
874 "whose log you would like to view."), | |
875 fields, | |
876 _("OK"), G_CALLBACK(gaim_gtkdialogs_log_cb), | |
877 _("Cancel"), NULL, | |
878 NULL); | |
879 } | |
880 | |
881 static void | |
882 gaim_gtkdialogs_alias_contact_cb(GaimContact *contact, const char *new_alias) | |
883 { | |
884 gaim_contact_set_alias(contact, new_alias); | |
885 } | |
886 | |
887 void | |
888 gaim_gtkdialogs_alias_contact(GaimContact *contact) | |
889 { | |
890 g_return_if_fail(contact != NULL); | |
891 | |
892 gaim_request_input(NULL, _("Alias Contact"), NULL, | |
893 _("Enter an alias for this contact."), | |
894 contact->alias, FALSE, FALSE, NULL, | |
895 _("Alias"), G_CALLBACK(gaim_gtkdialogs_alias_contact_cb), | |
896 _("Cancel"), NULL, contact); | |
897 } | |
898 | |
899 static void | |
900 gaim_gtkdialogs_alias_buddy_cb(GaimBuddy *buddy, const char *new_alias) | |
901 { | |
902 gaim_blist_alias_buddy(buddy, new_alias); | |
903 serv_alias_buddy(buddy); | |
904 } | |
905 | |
906 void | |
907 gaim_gtkdialogs_alias_buddy(GaimBuddy *buddy) | |
908 { | |
909 gchar *secondary; | |
910 | |
911 g_return_if_fail(buddy != NULL); | |
912 | |
913 secondary = g_strdup_printf(_("Enter an alias for %s."), buddy->name); | |
914 | |
915 gaim_request_input(NULL, _("Alias Buddy"), NULL, | |
916 secondary, buddy->alias, FALSE, FALSE, NULL, | |
917 _("Alias"), G_CALLBACK(gaim_gtkdialogs_alias_buddy_cb), | |
918 _("Cancel"), NULL, buddy); | |
919 | |
920 g_free(secondary); | |
921 } | |
922 | |
923 static void | |
924 gaim_gtkdialogs_alias_chat_cb(GaimChat *chat, const char *new_alias) | |
925 { | |
926 gaim_blist_alias_chat(chat, new_alias); | |
927 } | |
928 | |
929 void | |
930 gaim_gtkdialogs_alias_chat(GaimChat *chat) | |
931 { | |
932 g_return_if_fail(chat != NULL); | |
933 | |
934 gaim_request_input(NULL, _("Alias Chat"), NULL, | |
935 _("Enter an alias for this chat."), | |
936 chat->alias, FALSE, FALSE, NULL, | |
937 _("Alias"), G_CALLBACK(gaim_gtkdialogs_alias_chat_cb), | |
938 _("Cancel"), NULL, chat); | |
939 } | |
940 | |
941 static void | |
942 gaim_gtkdialogs_remove_contact_cb(GaimContact *contact) | |
943 { | |
944 GaimBlistNode *bnode, *cnode; | |
945 GaimGroup *group; | |
946 | |
947 cnode = (GaimBlistNode *)contact; | |
948 group = (GaimGroup*)cnode->parent; | |
949 for (bnode = cnode->child; bnode; bnode = bnode->next) { | |
950 GaimBuddy *buddy = (GaimBuddy*)bnode; | |
951 if (gaim_account_is_connected(buddy->account)) | |
952 gaim_account_remove_buddy(buddy->account, buddy, group); | |
953 } | |
954 gaim_blist_remove_contact(contact); | |
955 } | |
956 | |
957 void | |
958 gaim_gtkdialogs_remove_contact(GaimContact *contact) | |
959 { | |
960 GaimBuddy *buddy = gaim_contact_get_priority_buddy(contact); | |
961 | |
962 g_return_if_fail(contact != NULL); | |
963 g_return_if_fail(buddy != NULL); | |
964 | |
965 if (((GaimBlistNode*)contact)->child == (GaimBlistNode*)buddy && | |
966 !((GaimBlistNode*)buddy)->next) { | |
967 gaim_gtkdialogs_remove_buddy(buddy); | |
968 } else { | |
969 gchar *text; | |
970 text = g_strdup_printf( | |
971 ngettext( | |
972 "You are about to remove the contact containing %s " | |
973 "and %d other buddy from your buddy list. Do you " | |
974 "want to continue?", | |
975 "You are about to remove the contact containing %s " | |
976 "and %d other buddies from your buddy list. Do you " | |
977 "want to continue?", contact->totalsize - 1), | |
978 buddy->name, contact->totalsize - 1); | |
979 | |
980 gaim_request_action(contact, NULL, _("Remove Contact"), text, 0, contact, 2, | |
981 _("_Remove Contact"), G_CALLBACK(gaim_gtkdialogs_remove_contact_cb), | |
982 _("Cancel"), NULL); | |
983 | |
984 g_free(text); | |
985 } | |
986 } | |
987 | |
988 static void | |
989 gaim_gtkdialogs_remove_group_cb(GaimGroup *group) | |
990 { | |
991 GaimBlistNode *cnode, *bnode; | |
992 | |
993 cnode = ((GaimBlistNode*)group)->child; | |
994 | |
995 while (cnode) { | |
996 if (GAIM_BLIST_NODE_IS_CONTACT(cnode)) { | |
997 bnode = cnode->child; | |
998 cnode = cnode->next; | |
999 while (bnode) { | |
1000 GaimBuddy *buddy; | |
1001 if (GAIM_BLIST_NODE_IS_BUDDY(bnode)) { | |
1002 buddy = (GaimBuddy*)bnode; | |
1003 bnode = bnode->next; | |
1004 if (gaim_account_is_connected(buddy->account)) { | |
1005 gaim_account_remove_buddy(buddy->account, buddy, group); | |
1006 gaim_blist_remove_buddy(buddy); | |
1007 } | |
1008 } else { | |
1009 bnode = bnode->next; | |
1010 } | |
1011 } | |
1012 } else if (GAIM_BLIST_NODE_IS_CHAT(cnode)) { | |
1013 GaimChat *chat = (GaimChat *)cnode; | |
1014 cnode = cnode->next; | |
1015 if (gaim_account_is_connected(chat->account)) | |
1016 gaim_blist_remove_chat(chat); | |
1017 } else { | |
1018 cnode = cnode->next; | |
1019 } | |
1020 } | |
1021 | |
1022 gaim_blist_remove_group(group); | |
1023 } | |
1024 | |
1025 void | |
1026 gaim_gtkdialogs_remove_group(GaimGroup *group) | |
1027 { | |
1028 gchar *text; | |
1029 | |
1030 g_return_if_fail(group != NULL); | |
1031 | |
1032 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?"), | |
1033 group->name); | |
1034 | |
1035 gaim_request_action(group, NULL, _("Remove Group"), text, 0, group, 2, | |
1036 _("_Remove Group"), G_CALLBACK(gaim_gtkdialogs_remove_group_cb), | |
1037 _("Cancel"), NULL); | |
1038 | |
1039 g_free(text); | |
1040 } | |
1041 | |
1042 /* XXX - Some of this should be moved into the core, methinks. */ | |
1043 static void | |
1044 gaim_gtkdialogs_remove_buddy_cb(GaimBuddy *buddy) | |
1045 { | |
1046 GaimGroup *group; | |
1047 gchar *name; | |
1048 GaimAccount *account; | |
1049 | |
1050 group = gaim_buddy_get_group(buddy); | |
1051 name = g_strdup(buddy->name); /* b->name is a crasher after remove_buddy */ | |
1052 account = buddy->account; | |
1053 | |
1054 gaim_debug_info("blist", "Removing '%s' from buddy list.\n", buddy->name); | |
1055 /* TODO - Should remove from blist first... then call gaim_account_remove_buddy()? */ | |
1056 gaim_account_remove_buddy(buddy->account, buddy, group); | |
1057 gaim_blist_remove_buddy(buddy); | |
1058 | |
1059 g_free(name); | |
1060 } | |
1061 | |
1062 void | |
1063 gaim_gtkdialogs_remove_buddy(GaimBuddy *buddy) | |
1064 { | |
1065 gchar *text; | |
1066 | |
1067 g_return_if_fail(buddy != NULL); | |
1068 | |
1069 text = g_strdup_printf(_("You are about to remove %s from your buddy list. Do you want to continue?"), | |
1070 buddy->name); | |
1071 | |
1072 gaim_request_action(buddy, NULL, _("Remove Buddy"), text, 0, buddy, 2, | |
1073 _("_Remove Buddy"), G_CALLBACK(gaim_gtkdialogs_remove_buddy_cb), | |
1074 _("Cancel"), NULL); | |
1075 | |
1076 g_free(text); | |
1077 } | |
1078 | |
1079 static void | |
1080 gaim_gtkdialogs_remove_chat_cb(GaimChat *chat) | |
1081 { | |
1082 gaim_blist_remove_chat(chat); | |
1083 } | |
1084 | |
1085 void | |
1086 gaim_gtkdialogs_remove_chat(GaimChat *chat) | |
1087 { | |
1088 const gchar *name; | |
1089 gchar *text; | |
1090 | |
1091 g_return_if_fail(chat != NULL); | |
1092 | |
1093 name = gaim_chat_get_name(chat); | |
1094 text = g_strdup_printf(_("You are about to remove the chat %s from your buddy list. Do you want to continue?"), | |
1095 name ? name : ""); | |
1096 | |
1097 gaim_request_action(chat, NULL, _("Remove Chat"), text, 0, chat, 2, | |
1098 _("_Remove Chat"), G_CALLBACK(gaim_gtkdialogs_remove_chat_cb), | |
1099 _("Cancel"), NULL); | |
1100 | |
1101 g_free(text); | |
1102 } |