Let's make Ivan a developer!
[pidgin-git.git] / pidgin / gtkdialogs.c
blob93bcbd99af1c2a3edee7ae8c9105b4a6008d17a5
1 /*
2 * @file gtkdialogs.c GTK+ Dialogs
3 * @ingroup pidgin
4 */
6 /* pidgin
8 * Pidgin is the legal property of its developers, whose names are too numerous
9 * to list here. Please refer to the COPYRIGHT file distributed with this
10 * source distribution.
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
26 #define _PIDGIN_GTKDIALOGS_C_
28 #include "internal.h"
29 #include "pidgin.h"
30 #include "package_revision.h"
32 #include "debug.h"
33 #include "notify.h"
34 #include "prpl.h"
35 #include "request.h"
36 #include "util.h"
37 #include "core.h"
39 #include "gtkblist.h"
40 #include "gtkdialogs.h"
41 #include "gtkimhtml.h"
42 #include "gtkimhtmltoolbar.h"
43 #include "gtklog.h"
44 #include "gtkutils.h"
45 #include "pidginstock.h"
47 static GList *dialogwindows = NULL;
49 struct _PidginGroupMergeObject {
50 PurpleGroup* parent;
51 char *new_name;
54 struct developer {
55 char *name;
56 char *role;
57 char *email;
60 struct translator {
61 char *language;
62 char *abbr;
63 char *name;
64 char *email;
67 struct artist {
68 char *name;
69 char *email;
72 /* Order: Alphabetical by Last Name */
73 static const struct developer developers[] = {
74 {"Daniel 'datallah' Atallah", NULL, NULL},
75 {"Paul 'darkrain42' Aurich", NULL, NULL},
76 {"John 'rekkanoryo' Bailey", N_("bug master"), NULL},
77 {"Ethan 'Paco-Paco' Blanton", NULL, NULL},
78 {"Hylke Bons", N_("artist"), "hylkebons@gmail.com"},
79 /* feel free to not translate this */
80 {N_("Ka-Hing Cheung"), NULL, NULL},
81 {"Sadrul Habib Chowdhury", NULL, NULL},
82 {"Mark 'KingAnt' Doliner", NULL, "mark@kingant.net"},
83 {"Sean Egan", NULL, "sean.egan@gmail.com"},
84 {"Casey Harkins", NULL, NULL},
85 {"Ivan Komarov", NULL, NULL},
86 {"Gary 'grim' Kramlich", NULL, "grim@pidgin.im"},
87 {"Richard 'rlaager' Laager", NULL, "rlaager@pidgin.im"},
88 {"Sulabh 'sulabh_m' Mahajan", NULL, NULL},
89 {"Richard 'wabz' Nelson", NULL, NULL},
90 {"Etan 'deryni' Reisner", NULL, NULL},
91 {"Tim 'marv' Ringenbach", NULL, NULL},
92 {"Michael 'Maiku' Ruprecht", N_("voice and video"), NULL},
93 {"Elliott 'QuLogic' Sales de Andrade", NULL, NULL},
94 {"Luke 'LSchiere' Schierer", N_("support"), "lschiere@users.sf.net"},
95 {"Evan Schoenberg", NULL, NULL},
96 {"Kevin 'SimGuy' Stange", N_("webmaster"), NULL},
97 {"Will 'resiak' Thompson", NULL, NULL},
98 {"Stu 'nosnilmot' Tomlinson", NULL, NULL},
99 {NULL, NULL, NULL}
102 /* Order: Alphabetical by Last Name */
103 static const struct developer patch_writers[] = {
104 {"Marcus 'malu' Lundblad", NULL, NULL},
105 {"Dennis 'EvilDennisR' Ristuccia", N_("Senior Contributor/QA"), NULL},
106 {"Peter 'Fmoo' Ruibal", NULL, NULL},
107 {"Gabriel 'Nix' Schulhof", NULL, NULL},
108 {"Jorge 'Masca' Villaseñor", NULL, NULL},
109 {NULL, NULL, NULL}
112 /* Order: Alphabetical by Last Name */
113 static const struct developer retired_developers[] = {
114 {"Herman Bloggs", N_("win32 port"), "herman@bluedigits.com"},
115 {"Thomas Butter", NULL, NULL},
116 {"Jim Duchek", N_("maintainer"), "jim@linuxpimps.com"},
117 {"Rob Flynn", N_("maintainer"), NULL},
118 {"Adam Fritzler", N_("libfaim maintainer"), NULL},
119 {"Christian 'ChipX86' Hammond", N_("webmaster"), NULL},
120 /* If "lazy bum" translates literally into a serious insult, use something else or omit it. */
121 {"Syd Logan", N_("hacker and designated driver [lazy bum]"), NULL},
122 {"Christopher 'siege' O'Brien", NULL, "taliesein@users.sf.net"},
123 {"Bartosz Oler", NULL, NULL},
124 {"Megan 'Cae' Schneider", N_("support/QA"), NULL},
125 {"Jim Seymour", N_("XMPP"), NULL},
126 {"Mark Spencer", N_("original author"), "markster@marko.net"},
127 {"Nathan 'faceprint' Walp", NULL, NULL},
128 {"Eric Warmenhoven", N_("lead developer"), "warmenhoven@yahoo.com"},
129 {NULL, NULL, NULL}
132 /* Order: Alphabetical by Last Name */
133 static const struct developer retired_patch_writers[] = {
134 {"Felipe 'shx' Contreras", NULL, NULL},
135 {"Decklin Foster", NULL, NULL},
136 {"Peter 'Bleeter' Lawler", NULL, NULL},
137 {"Robert 'Robot101' McQueen", NULL, NULL},
138 {"Benjamin Miller", NULL, NULL},
139 {NULL, NULL, NULL}
142 /* Order: Code, then Alphabetical by Last Name */
143 static const struct translator translators[] = {
144 {N_("Afrikaans"), "af", "Samuel Murray", "afrikaans@gmail.com"},
145 {N_("Afrikaans"), "af", "Friedel Wolff", "friedel@translate.org.za"},
146 {N_("Arabic"), "ar", "Khaled Hosny", "khaledhosny@eglug.org"},
147 {N_("Assamese"), "as", "Amitakhya Phukan", "aphukan@fedoraproject.org"},
148 {N_("Belarusian Latin"), "be@latin", "Ihar Hrachyshka", "ihar.hrachyshka@gmail.com"},
149 {N_("Bulgarian"), "bg", "Vladimira Girginova", "missing@here.is"},
150 {N_("Bulgarian"), "bg", "Vladimir (Kaladan) Petkov", "vpetkov@i-space.org"},
151 {N_("Bengali"), "bn", "Israt Jahan", "israt@ankur.org.bd"},
152 {N_("Bengali"), "bn", "Jamil Ahmed", "jamil@bengalinux.org"},
153 {N_("Bengali"), "bn", "Samia Nimatullah", "mailsamia2001@yahoo.com"},
154 {N_("Bengali-India"), "bn", "Runa Bhattacharjee", "runab@fedoraproject.org"},
155 {N_("Bosnian"), "bs", "Lejla Hadzialic", "lejlah@gmail.com"},
156 {N_("Catalan"), "ca", "Josep Puigdemont", "josep.puigdemont@gmail.com"},
157 {N_("Valencian-Catalan"), "ca@valencia", "Toni Hermoso", "toniher@softcatala.org"},
158 {N_("Valencian-Catalan"), "ca@valencia", "Josep Puigdemont", "tradgnome@softcatala.org"},
159 {N_("Czech"), "cs", "David Vachulka", "david@konstrukce-cad.com"},
160 {N_("Danish"), "da", "Morten Brix Pedersen", "morten@wtf.dk"},
161 {N_("Danish"), "da", "Peter Bach", "bach.peter@gmail.com"},
162 {N_("German"), "de", "Björn Voigt", "bjoern@cs.tu-berlin.de"},
163 {N_("German"), "de", "Jochen Kemnade", "jochenkemnade@web.de"},
164 {N_("Dzongkha"), "dz", "Norbu", "nor_den@hotmail.com"},
165 {N_("Dzongkha"), "dz", "Jurmey Rabgay", "jur_gay@yahoo.com"},
166 {N_("Dzongkha"), "dz", "Wangmo Sherpa", "rinwanshe@yahoo.com"},
167 {N_("Greek"), "el", "Katsaloulis Panayotis", "panayotis@panayotis.com"},
168 {N_("Greek"), "el", "Bouklis Panos", "panos@echidna-band.com"},
169 {N_("Australian English"), "en_AU", "Peter Lawler", "trans@six-by-nine.com.au"},
170 {N_("Canadian English"), "en_CA", "Adam Weinberger", "adamw@gnome.org"},
171 {N_("British English"), "en_GB", "Luke Ross", "lukeross@sys3175.co.uk"},
172 {N_("Esperanto"), "eo", "Stéphane Fillod", "fillods@users.sourceforge.net"},
173 {N_("Spanish"), "es", "Javier Fernández-Sanguino Peña", "jfs@debian.org"},
174 {N_("Estonian"), "et", "Ivar Smolin", "okul@linux.ee"},
175 {N_("Basque"), "eu", "Mikel Pascual Aldabaldetreku", "mikel.paskual@gmail.com"},
176 {N_("Persian"), "fa", "Elnaz Sarbar", "elnaz@farsiweb.info"},
177 {N_("Persian"), "fa", "Meelad Zakaria", "meelad@farsiweb.info"},
178 {N_("Persian"), "fa", "Roozbeh Pournader ", "roozbeh@farsiweb.info"},
179 {N_("Finnish"), "fi", "Timo Jyrinki", "timo.jyrinki@iki.fi"},
180 {N_("French"), "fr", "Éric Boumaour", "zongo_fr@users.sourceforge.net"},
181 {N_("Irish"), "ga", "Aaron Kearns", "ajkearns6@gmail.com"},
182 {N_("Galician"), "gl", "Mar Castro", "mariamarcp@gmail.com"},
183 {N_("Galician"), "gl", "Frco. Javier Rial", "fjrial@cesga.es"},
184 {N_("Gujarati"), "gu", "Ankit Patel", "ankit_patel@users.sf.net"},
185 {N_("Gujarati"), "gu", N_("Gujarati Language Team"), "indianoss-gujarati@lists.sourceforge.net"},
186 {N_("Hebrew"), "he", "Shalom Craimer", "scraimer@gmail.com"},
187 {N_("Hindi"), "hi", "Rajesh Ranjan", "rajeshkajha@yahoo.com"},
188 {N_("Hungarian"), "hu", "Kelemen Gábor", "kelemeng@gnome.hu"},
189 {N_("Armenian"), "hy", "David Avsharyan", "avsharyan@gmail.com"},
190 {N_("Indonesian"), "id", "Rai S. Regawa", "raireg@yahoo.com"},
191 {N_("Italian"), "it", "Claudio Satriano", "satriano@na.infn.it"},
192 {N_("Japanese"), "ja", "Takashi Aihana", "aihana@gnome.gr.jp"},
193 {N_("Georgian"), "ka", N_("Ubuntu Georgian Translators"), "alexander.didebulidze@stusta.mhn.de"},
194 {N_("Khmer"), "km", "Khoem Sokhem", "khoemsokhem@khmeros.info"},
195 {N_("Kannada"), "kn", N_("Kannada Translation team"), "translation@sampada.info"},
196 {N_("Korean"), "ko", "Sushizang", "sushizang@empal.com"},
197 {N_("Kurdish"), "ku", "Erdal Ronahi", "erdal.ronahi@gmail.com"},
198 {N_("Kurdish"), "ku", "Amed Ç. Jiyan", "amedcj@hotmail.com"},
199 {N_("Kurdish"), "ku", "Rizoyê Xerzî", "rizoxerzi@hotmail.com"},
200 {N_("Lao"), "lo", "Anousak Souphavah", "anousak@gmail.com"},
201 {N_("Macedonian"), "mk", "Arangel Angov ", "arangel@linux.net.mk"},
202 {N_("Macedonian"), "mk", "Ivana Kirkovska", "ivana.kirkovska@gmail.com"},
203 {N_("Macedonian"), "mk", "Jovan Naumovski", "jovan@lugola.net"},
204 {N_("Malayalam"), "ml", "Ani Peter", "apeter@redhat.com"},
205 {N_("Mongolian"), "mn", "gooyo", NULL},
206 {N_("Marathi"), "mr", "Sandeep Shedmake", "sandeep.shedmake@gmail.com"},
207 {N_("Malay"), "ms_MY", "Muhammad Najmi bin Ahmad Zabidi", "najmi.zabidi@gmail.com"},
208 {N_("Bokmål Norwegian"), "nb", "Hans Fredrik Nordhaug", "hans@nordhaug.priv.no"},
209 {N_("Nepali"), "ne", "Shyam Krishna Bal", "shyamkrishna_bal@yahoo.com"},
210 {N_("Dutch, Flemish"), "nl", "Gideon van Melle", "translations@gvmelle.com"},
211 {N_("Norwegian Nynorsk"), "nn", "Yngve Spjeld Landro", "l10n@landro.net"},
212 {N_("Occitan"), "oc", "Yannig Marchegay", "yannig@marchegay.org"},
213 {N_("Oriya"), "or", "Manoj Kumar Giri", "giri.manojkr@gmail.com"},
214 {N_("Punjabi"), "pa", "Amanpreet Singh Alam", "aalam@users.sf.net"},
215 {N_("Polish"), "pl", "Piotr Drąg", "piotrdrag@gmail.com"},
216 {N_("Polish"), "pl", "Piotr Makowski", "pmakowski@aviary.pl"},
217 {N_("Portuguese"), "pt", "Duarte Henriques", "duarte_henriques@myrealbox.com"},
218 {N_("Portuguese-Brazil"), "pt_BR", "Rodrigo Luiz Marques Flores", "rodrigomarquesflores@gmail.com"},
219 {N_("Pashto"), "ps", "Kashif Masood", "masudmails@yahoo.com"},
220 {N_("Romanian"), "ro", "Mișu Moldovan", "dumol@gnome.org"},
221 {N_("Romanian"), "ro", "Andrei Popescu", "andreimpopescu@gmail.com"},
222 {N_("Russian"), "ru", "Антон Самохвалов", "samant.ua@mail.ru"},
223 {N_("Slovak"), "sk", "Jozef Káčer", "quickparser@gmail.com"},
224 {N_("Slovak"), "sk", "loptosko", "loptosko@gmail.com"},
225 {N_("Slovenian"), "sl", "Martin Srebotnjak", "miles@filmsi.net"},
226 {N_("Albanian"), "sq", "Besnik Bleta", "besnik@programeshqip.org"},
227 {N_("Serbian"), "sr", "Miloš Popović", "gpopac@gmail.com"},
228 {N_("Serbian"), "sr@Latn", "Miloš Popović", "gpopac@gmail.com"},
229 {N_("Sinhala"), "si", "Danishka Navin", "snavin@redhat.com"},
230 {N_("Sinhala"), "si", "Yajith Ajantha Dayarathna", "yajith@gmail.com"},
231 {N_("Swedish"), "sv", "Peter Hjalmarsson", "xake@telia.com"},
232 {N_("Swahili"), "sw", "Paul Msegeya", "msegeya@gmail.com"},
233 {N_("Tamil"), "ta", "I. Felix", "ifelix25@gmail.com"},
234 {N_("Tamil"), "ta", "Viveka Nathan K", "vivekanathan@users.sourceforge.net"},
235 {N_("Telugu"), "te", "Krishnababu Krottapalli", "krottapalli@ymail.com"},
236 {N_("Thai"), "th", "Isriya Paireepairit", "markpeak@gmail.com"},
237 {N_("Turkish"), "tr", "Serdar Soytetir", "tulliana@gmail.com"},
238 {N_("Ukranian"), "uk", "Oleksandr Kovalenko", "alx.kovalenko@gmail.com"},
239 {N_("Urdu"), "ur", "RKVS Raman", "rkvsraman@gmail.com"},
240 {N_("Vietnamese"), "vi", N_("T.M.Thanh and the Gnome-Vi Team"), "gnomevi-list@lists.sf.net"},
241 {N_("Simplified Chinese"), "zh_CN", "Aron Xu", "happyaron.xu@gmail.com"},
242 {N_("Hong Kong Chinese"), "zh_HK", "Abel Cheung", "abelindsay@gmail.com"},
243 {N_("Hong Kong Chinese"), "zh_HK", "Ambrose C. Li", "acli@ada.dhs.org"},
244 {N_("Hong Kong Chinese"), "zh_HK", "Paladin R. Liu", "paladin@ms1.hinet.net"},
245 {N_("Traditional Chinese"), "zh_TW", "Ambrose C. Li", "acli@ada.dhs.org"},
246 {N_("Traditional Chinese"), "zh_TW", "Paladin R. Liu", "paladin@ms1.hinet.net"},
247 {NULL, NULL, NULL, NULL}
251 static const struct translator past_translators[] = {
252 {N_("Amharic"), "am", "Daniel Yacob", NULL},
253 {N_("Arabic"), "ar", "Mohamed Magdy", "alnokta@yahoo.com"},
254 {N_("Bulgarian"), "bg", "Hristo Todorov", NULL},
255 {N_("Bengali"), "bn", "INDRANIL DAS GUPTA", "indradg@l2c2.org"},
256 {N_("Bengali"), "bn", "Tisa Nafisa", "tisa_nafisa@yahoo.com"},
257 {N_("Catalan"), "ca", "JM Pérez Cáncer", NULL},
258 {N_("Catalan"), "ca", "Robert Millan", NULL},
259 {N_("Czech"), "cs", "Honza Král", NULL},
260 {N_("Czech"), "cs", "Miloslav Trmac", "mitr@volny.cz"},
261 {N_("German"), "de", "Daniel Seifert, Karsten Weiss", NULL},
262 {N_("Spanish"), "es", "JM Pérez Cáncer", NULL},
263 {N_("Spanish"), "es", "Nicolás Lichtmaier", NULL},
264 {N_("Spanish"), "es", "Amaya Rodrigo", NULL},
265 {N_("Spanish"), "es", "Alejandro G Villar", NULL},
266 {N_("Basque"), "eu", "Iñaki Larrañaga Murgoitio", "dooteo@zundan.com"},
267 {N_("Basque"), "eu", "Hizkuntza Politikarako Sailburuordetza", "hizkpol@ej-gv.es"},
268 {N_("Finnish"), "fi", "Arto Alakulju", NULL},
269 {N_("Finnish"), "fi", "Tero Kuusela", NULL},
270 {N_("French"), "fr", "Sébastien François", NULL},
271 {N_("French"), "fr", "Stéphane Pontier", NULL},
272 {N_("French"), "fr", "Stéphane Wirtel", NULL},
273 {N_("French"), "fr", "Loïc Jeannin", NULL},
274 {N_("Galician"), "gl", "Ignacio Casal Quinteiro", NULL},
275 {N_("Hebrew"), "he", "Pavel Bibergal", NULL},
276 {N_("Hindi"), "hi", "Ravishankar Shrivastava", NULL},
277 {N_("Hungarian"), "hu", "Zoltan Sutto", NULL},
278 {N_("Italian"), "it", "Salvatore di Maggio", NULL},
279 {N_("Japanese"), "ja", "Ryosuke Kutsuna", NULL},
280 {N_("Japanese"), "ja", "Taku Yasui", NULL},
281 {N_("Japanese"), "ja", "Junichi Uekawa", NULL},
282 {N_("Georgian"), "ka", "Temuri Doghonadze", NULL},
283 {N_("Korean"), "ko", "Sang-hyun S, A Ho-seok Lee", NULL},
284 {N_("Korean"), "ko", "Kyeong-uk Son", NULL},
285 {N_("Lithuanian"), "lt", "Laurynas Biveinis", "laurynas.biveinis@gmail.com"},
286 {N_("Lithuanian"), "lt", "Gediminas Čičinskas", NULL},
287 {N_("Lithuanian"), "lt", "Andrius Štikonas", NULL},
288 {N_("Macedonian"), "mk", "Tomislav Markovski", NULL},
289 {N_("Bokmål Norwegian"), "nb", "Hallvard Glad", "hallvard.glad@gmail.com"},
290 {N_("Bokmål Norwegian"), "nb", "Petter Johan Olsen", NULL},
291 {N_("Bokmål Norwegian"), "nb", "Espen Stefansen", "espenas@gmail.com"},
292 {N_("Dutch, Flemish"), "nl", "Vincent van Adrighem", "V.vanAdrighem@dirck.mine.nu"},
293 {N_("Polish"), "pl", "Emil Nowak", "emil5@go2.pl"},
294 {N_("Polish"), "pl", "Paweł Godlewski", "pawel@bajk.pl"},
295 {N_("Polish"), "pl", "Krzysztof Foltman", "krzysztof@foltman.com"},
296 {N_("Polish"), "pl", "Przemysław Sułek", NULL},
297 {N_("Portuguese-Brazil"), "pt_BR", "Maurício de Lemos Rodrigues Collares Neto", "mauricioc@gmail.com"},
298 {N_("Russian"), "ru", "Dmitry Beloglazov", "dmaa@users.sf.net"},
299 {N_("Russian"), "ru", "Alexandre Prokoudine", NULL},
300 {N_("Russian"), "ru", "Sergey Volozhanin", NULL},
301 {N_("Slovak"), "sk", "Daniel Režný", NULL},
302 {N_("Slovak"), "sk", "helix84", NULL},
303 {N_("Slovak"), "sk", "Richard Golier", NULL},
304 {N_("Slovenian"), "sl", "Matjaz Horvat", NULL},
305 {N_("Serbian"), "sr", "Danilo Šegan", "dsegan@gmx.net"},
306 {N_("Serbian"), "sr", "Aleksandar Urosevic", "urke@users.sourceforge.net"},
307 {N_("Swedish"), "sv", "Tore Lundqvist", NULL},
308 {N_("Swedish"), "sv", "Christian Rose", NULL},
309 {N_("Telugu"), "te", "Mr. Subbaramaih", "info.gist@cdac.in"},
310 {N_("Turkish"), "tr", "Ahmet Alp BALKAN", NULL},
311 {N_("Simplified Chinese"), "zh_CN", "Hashao, Rocky S. Lee", NULL},
312 {N_("Simplified Chinese"), "zh_CN", "Funda Wang", "fundawang@linux.net.cn"},
313 {N_("Traditional Chinese"), "zh_TW", "Hashao, Rocky S. Lee", NULL},
314 {NULL, NULL, NULL, NULL}
317 static void
318 add_developers(GString *str, const struct developer *list)
320 for (; list->name != NULL; list++) {
321 if (list->email != NULL) {
322 g_string_append_printf(str, " <a href=\"mailto:%s\">%s</a>%s%s%s<br/>",
323 list->email, _(list->name),
324 list->role ? " (" : "",
325 list->role ? _(list->role) : "",
326 list->role ? ")" : "");
327 } else {
328 g_string_append_printf(str, " %s%s%s%s<br/>",
329 _(list->name),
330 list->role ? " (" : "",
331 list->role ? _(list->role) : "",
332 list->role ? ")" : "");
337 static void
338 add_translators(GString *str, const struct translator *list)
340 for (; list->language != NULL; list++) {
341 if (list->email != NULL) {
342 g_string_append_printf(str, " <b>%s (%s)</b> - <a href=\"mailto:%s\">%s</a><br/>",
343 _(list->language),
344 list->abbr,
345 list->email,
346 _(list->name));
347 } else {
348 g_string_append_printf(str, " <b>%s (%s)</b> - %s<br/>",
349 _(list->language),
350 list->abbr,
351 _(list->name));
356 void
357 pidgin_dialogs_destroy_all()
359 while (dialogwindows) {
360 gtk_widget_destroy(dialogwindows->data);
361 dialogwindows = g_list_remove(dialogwindows, dialogwindows->data);
365 static void destroy_win(GtkWidget *button, GtkWidget *win)
367 gtk_widget_destroy(win);
370 #if 0
371 /* This function puts the version number onto the pixmap we use in the 'about'
372 * screen in Pidgin. */
373 static void
374 pidgin_logo_versionize(GdkPixbuf **original, GtkWidget *widget) {
375 GdkPixmap *pixmap;
376 GtkStyle *style;
377 PangoContext *context;
378 PangoLayout *layout;
379 gchar *markup;
380 gint width, height;
381 gint lwidth = 0, lheight = 0;
383 style = gtk_widget_get_style(widget);
385 gdk_pixbuf_render_pixmap_and_mask(*original, &pixmap, NULL, 255);
386 width = gdk_pixbuf_get_width(*original);
387 height = gdk_pixbuf_get_height(*original);
388 g_object_unref(G_OBJECT(*original));
390 context = gtk_widget_get_pango_context(widget);
391 layout = pango_layout_new(context);
393 markup = g_strdup_printf("<span foreground=\"#000000\">%s</span>", DISPLAY_VERSION);
394 pango_layout_set_font_description(layout, style->font_desc);
395 pango_layout_set_markup(layout, markup, strlen(markup));
396 g_free(markup);
398 pango_layout_get_pixel_size(layout, &lwidth, &lheight);
399 gdk_draw_layout(GDK_DRAWABLE(pixmap), style->bg_gc[GTK_STATE_NORMAL],
400 width - (lwidth + 3), 1, layout);
401 g_object_unref(G_OBJECT(layout));
403 *original = gdk_pixbuf_get_from_drawable(NULL, pixmap, NULL,
404 0, 0, 0, 0,
405 width, height);
406 g_object_unref(G_OBJECT(pixmap));
408 #endif
410 /* Note: Frees 'string' */
411 static GtkWidget *
412 pidgin_build_help_dialog(const char *title, const char *role, GString *string)
414 GtkWidget *win, *vbox, *frame, *logo, *imhtml, *button;
415 GdkPixbuf *pixbuf;
416 GtkTextIter iter;
417 AtkObject *obj;
418 char *filename, *tmp;
420 win = pidgin_create_dialog(title, PIDGIN_HIG_BORDER, role, TRUE);
421 vbox = pidgin_dialog_get_vbox_with_properties(GTK_DIALOG(win), FALSE, PIDGIN_HIG_BORDER);
422 gtk_window_set_default_size(GTK_WINDOW(win), 450, 450);
424 /* Generate a logo with a version number */
425 filename = g_build_filename(DATADIR, "pixmaps", "pidgin", "logo.png", NULL);
426 pixbuf = gdk_pixbuf_new_from_file(filename, NULL);
427 g_free(filename);
429 #if 0 /* Don't versionize the logo when the logo has the version in it */
430 pidgin_logo_versionize(&pixbuf, logo);
431 #endif
433 /* Insert the logo */
434 logo = gtk_image_new_from_pixbuf(pixbuf);
435 if (pixbuf)
436 g_object_unref(G_OBJECT(pixbuf));
437 obj = gtk_widget_get_accessible(logo);
438 tmp = g_strconcat(PIDGIN_NAME, " " DISPLAY_VERSION, NULL);
439 atk_object_set_description(obj, tmp);
440 g_free(tmp);
441 gtk_box_pack_start(GTK_BOX(vbox), logo, FALSE, FALSE, 0);
443 frame = pidgin_create_imhtml(FALSE, &imhtml, NULL, NULL);
444 gtk_imhtml_set_format_functions(GTK_IMHTML(imhtml), GTK_IMHTML_ALL ^ GTK_IMHTML_SMILEY);
445 gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0);
447 gtk_imhtml_append_text(GTK_IMHTML(imhtml), string->str, GTK_IMHTML_NO_SCROLL);
448 gtk_text_buffer_get_start_iter(gtk_text_view_get_buffer(GTK_TEXT_VIEW(imhtml)), &iter);
449 gtk_text_buffer_place_cursor(gtk_text_view_get_buffer(GTK_TEXT_VIEW(imhtml)), &iter);
451 button = pidgin_dialog_add_button(GTK_DIALOG(win), GTK_STOCK_CLOSE,
452 G_CALLBACK(destroy_win), win);
454 GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT);
455 gtk_widget_grab_default(button);
457 gtk_widget_show_all(win);
458 gtk_window_present(GTK_WINDOW(win));
460 g_string_free(string, TRUE);
462 return win;
465 void pidgin_dialogs_about(void)
467 GString *str;
468 char *tmp;
469 static GtkWidget *about = NULL;
471 if (about != NULL) {
472 gtk_window_present(GTK_WINDOW(about));
473 return;
476 str = g_string_sized_new(4096);
478 g_string_append_printf(str,
479 "<CENTER><FONT SIZE=\"4\"><B>%s %s</B></FONT></CENTER> (libpurple %s)"
480 "<BR>%s<BR><BR>", PIDGIN_NAME, DISPLAY_VERSION,
481 purple_core_get_version(), REVISION);
483 g_string_append_printf(str,
484 _("%s is a messaging client based on libpurple which is capable of "
485 "connecting to multiple messaging services at once. %s is written "
486 "in C using GTK+. %s is released, and may be modified and "
487 "redistributed, under the terms of the GPL version 2 (or later). "
488 "A copy of the GPL is distributed with %s. %s is copyrighted by "
489 "its contributors, a list of whom is also distributed with %s. "
490 "There is no warranty for %s.<BR><BR>"), PIDGIN_NAME, PIDGIN_NAME,
491 PIDGIN_NAME, PIDGIN_NAME, PIDGIN_NAME, PIDGIN_NAME, PIDGIN_NAME);
493 g_string_append_printf(str,
494 _("<FONT SIZE=\"4\"><B>Helpful Resources</B></FONT><BR>\t<A "
495 "HREF=\"%s\">Website</A><BR>\t<A HREF=\"%s\">Frequently Asked "
496 "Questions</A><BR>\tIRC Channel: #pidgin on irc.freenode.net<BR>"
497 "\tXMPP MUC: devel@conference.pidgin.im<BR><BR>"), PURPLE_WEBSITE,
498 "http://developer.pidgin.im/wiki/FAQ");
500 g_string_append_printf(str,
501 _("<font size=\"4\"><b>Help from other Pidgin users</b></font> is "
502 "available by e-mailing <a "
503 "href=\"mailto:support@pidgin.im\">support@pidgin.im</a><br/>"
504 "This is a <b>public</b> mailing list! "
505 "(<a href=\"http://pidgin.im/pipermail/support/\">archive</a>)<br/>"
506 "We can't help with third-party protocols or plugins!<br/>"
507 "This list's primary language is <b>English</b>. You are "
508 "welcome to post in another language, but the responses may "
509 "be less helpful.<br/>"));
511 tmp = g_strdup_printf(_("About %s"), PIDGIN_NAME);
512 about = pidgin_build_help_dialog(tmp, "about", str);
513 g_signal_connect(G_OBJECT(about), "destroy", G_CALLBACK(gtk_widget_destroyed), &about);
514 g_free(tmp);
517 void pidgin_dialogs_buildinfo(void)
519 GString *str;
520 char *tmp;
521 static GtkWidget *buildinfo = NULL;
523 if (buildinfo != NULL) {
524 gtk_window_present(GTK_WINDOW(buildinfo));
525 return;
528 str = g_string_sized_new(4096);
530 g_string_append_printf(str,
531 "<FONT SIZE=\"4\"><B>%s %s</B></FONT> (libpurple %s)<BR>%s<BR><BR>", PIDGIN_NAME, DISPLAY_VERSION, purple_core_get_version(), REVISION);
533 g_string_append_printf(str, "<FONT SIZE=\"4\"><B>%s</B></FONT><br/>", _("Build Information"));
535 /* The following primarly intented for user/developer interaction and thus
536 ought not be translated */
538 #ifdef CONFIG_ARGS /* win32 build doesn't use configure */
539 g_string_append(str, " <b>Arguments to <i>./configure</i>:</b> " CONFIG_ARGS "<br/>");
540 #endif
542 #ifndef _WIN32
543 #ifdef DEBUG
544 g_string_append(str, " <b>Print debugging messages:</b> Yes<br/>");
545 #else
546 g_string_append(str, " <b>Print debugging messages:</b> No<br/>");
547 #endif
548 #endif
550 #ifdef PURPLE_PLUGINS
551 g_string_append(str, " <b>Plugins:</b> Enabled<br/>");
552 #else
553 g_string_append(str, " <b>Plugins:</b> Disabled<br/>");
554 #endif
556 #ifdef HAVE_SSL
557 g_string_append(str, " <b>SSL:</b> SSL support is present.<br/>");
558 #else
559 g_string_append(str, " <b>SSL:</b> SSL support was <b><i>NOT</i></b> compiled!<br/>");
560 #endif
562 /* This might be useful elsewhere too, but it is particularly useful for
563 * debugging stuff known to be GTK+/Glib bugs on Windows */
564 #ifdef _WIN32
565 g_string_append_printf(str, " <b>GTK+ Runtime:</b> %u.%u.%u<br/>"
566 " <b>Glib Runtime:</b> %u.%u.%u<br/>",
567 gtk_major_version, gtk_minor_version, gtk_micro_version,
568 glib_major_version, glib_minor_version, glib_micro_version);
569 #endif
571 g_string_append(str, "<br/> <b>Library Support</b><br/>");
573 #ifdef HAVE_CYRUS_SASL
574 g_string_append_printf(str, " <b>Cyrus SASL:</b> Enabled<br/>");
575 #else
576 g_string_append_printf(str, " <b>Cyrus SASL:</b> Disabled<br/>");
577 #endif
579 #ifndef _WIN32
580 #ifdef HAVE_DBUS
581 g_string_append_printf(str, " <b>D-Bus:</b> Enabled<br/>");
582 #else
583 g_string_append_printf(str, " <b>D-Bus:</b> Disabled<br/>");
584 #endif
586 #ifdef HAVE_EVOLUTION_ADDRESSBOOK
587 g_string_append_printf(str, " <b>Evolution Addressbook:</b> Enabled<br/>");
588 #else
589 g_string_append_printf(str, " <b>Evolution Addressbook:</b> Disabled<br/>");
590 #endif
591 #endif
593 #if defined(_WIN32) || defined(USE_INTERNAL_LIBGADU)
594 g_string_append(str, " <b>Gadu-Gadu library (libgadu):</b> Internal<br/>");
595 #else
596 #ifdef HAVE_LIBGADU
597 g_string_append(str, " <b>Gadu-Gadu library (libgadu):</b> Enabled<br/>");
598 #else
599 g_string_append(str, " <b>Gadu-Gadu library (libgadu):</b> Disabled<br/>");
600 #endif
601 #endif
603 #ifdef USE_GTKSPELL
604 g_string_append(str, " <b>GtkSpell:</b> Enabled<br/>");
605 #else
606 g_string_append(str, " <b>GtkSpell:</b> Disabled<br/>");
607 #endif
609 #ifdef HAVE_GNUTLS
610 g_string_append(str, " <b>GnuTLS:</b> Enabled<br/>");
611 #else
612 g_string_append(str, " <b>GnuTLS:</b> Disabled<br/>");
613 #endif
615 #ifndef _WIN32
616 #ifdef USE_GSTREAMER
617 g_string_append(str, " <b>GStreamer:</b> Enabled<br/>");
618 #else
619 g_string_append(str, " <b>GStreamer:</b> Disabled<br/>");
620 #endif
621 #endif
623 #ifndef _WIN32
624 #ifdef ENABLE_MONO
625 g_string_append(str, " <b>Mono:</b> Enabled<br/>");
626 #else
627 g_string_append(str, " <b>Mono:</b> Disabled<br/>");
628 #endif
629 #endif
631 #ifndef _WIN32
632 #ifdef HAVE_NETWORKMANAGER
633 g_string_append(str, " <b>NetworkManager:</b> Enabled<br/>");
634 #else
635 g_string_append(str, " <b>NetworkManager:</b> Disabled<br/>");
636 #endif
637 #endif
639 #ifdef HAVE_NSS
640 g_string_append(str, " <b>Network Security Services (NSS):</b> Enabled<br/>");
641 #else
642 g_string_append(str, " <b>Network Security Services (NSS):</b> Disabled<br/>");
643 #endif
645 if (purple_plugins_find_with_id("core-perl") != NULL)
646 g_string_append(str, " <b>Perl:</b> Enabled<br/>");
647 else
648 g_string_append(str, " <b>Perl:</b> Disabled<br/>");
650 #ifndef _WIN32
651 #ifdef HAVE_STARTUP_NOTIFICATION
652 g_string_append(str, " <b>Startup Notification:</b> Enabled<br/>");
653 #else
654 g_string_append(str, " <b>Startup Notification:</b> Disabled<br/>");
655 #endif
656 #endif
658 if (purple_plugins_find_with_id("core-tcl") != NULL) {
659 g_string_append(str, " <b>Tcl:</b> Enabled<br/>");
660 #ifdef HAVE_TK
661 g_string_append(str, " <b>Tk:</b> Enabled<br/>");
662 #else
663 g_string_append(str, " <b>Tk:</b> Disabled<br/>");
664 #endif
665 } else {
666 g_string_append(str, " <b>Tcl:</b> Disabled<br/>");
667 g_string_append(str, " <b>Tk:</b> Disabled<br/>");
670 #ifdef USE_IDN
671 g_string_append(str, " <b>UTF-8 DNS (IDN):</b> Enabled<br/>");
672 #else
673 g_string_append(str, " <b>UTF-8 DNS (IDN):</b> Disabled<br/>");
674 #endif
676 #ifdef USE_VV
677 g_string_append(str, " <b>Voice and Video:</b> Enabled<br/>");
678 #else
679 g_string_append(str, " <b>Voice and Video:</b> Disabled<br/>");
680 #endif
682 #ifndef _WIN32
683 #ifdef USE_SM
684 g_string_append(str, " <b>X Session Management:</b> Enabled<br/>");
685 #else
686 g_string_append(str, " <b>X Session Management:</b> Disabled<br/>");
687 #endif
689 #ifdef USE_SCREENSAVER
690 g_string_append(str, " <b>XScreenSaver:</b> Enabled<br/>");
691 #else
692 g_string_append(str, " <b>XScreenSaver:</b> Disabled<br/>");
693 #endif
695 #ifdef LIBZEPHYR_EXT
696 g_string_append(str, " <b>Zephyr library (libzephyr):</b> External<br/>");
697 #else
698 g_string_append(str, " <b>Zephyr library (libzephyr):</b> Internal<br/>");
699 #endif
701 #ifdef ZEPHYR_USES_KERBEROS
702 g_string_append(str, " <b>Zephyr uses Kerberos:</b> Yes<br/>");
703 #else
704 g_string_append(str, " <b>Zephyr uses Kerberos:</b> No<br/>");
705 #endif
706 #endif
708 /* End of not to be translated section */
710 tmp = g_strdup_printf(_("%s Build Information"), PIDGIN_NAME);
711 buildinfo = pidgin_build_help_dialog(tmp, "buildinfo", str);
712 g_signal_connect(G_OBJECT(buildinfo), "destroy", G_CALLBACK(gtk_widget_destroyed), &buildinfo);
713 g_free(tmp);
716 void pidgin_dialogs_developers(void)
718 GString *str;
719 char *tmp;
720 static GtkWidget *developer_info = NULL;
722 if (developer_info != NULL) {
723 gtk_window_present(GTK_WINDOW(developer_info));
724 return;
727 str = g_string_sized_new(4096);
729 /* Current Developers */
730 g_string_append_printf(str, "<FONT SIZE=\"4\"><B>%s:</B></FONT><BR/>",
731 _("Current Developers"));
732 add_developers(str, developers);
733 g_string_append(str, "<BR/>");
735 /* Crazy Patch Writers */
736 g_string_append_printf(str, "<FONT SIZE=\"4\"><B>%s:</B></FONT><BR/>",
737 _("Crazy Patch Writers"));
738 add_developers(str, patch_writers);
739 g_string_append(str, "<BR/>");
741 /* Retired Developers */
742 g_string_append_printf(str, "<FONT SIZE=\"4\"><B>%s:</B></FONT><BR/>",
743 _("Retired Developers"));
744 add_developers(str, retired_developers);
745 g_string_append(str, "<BR/>");
747 /* Retired Crazy Patch Writers */
748 g_string_append_printf(str, "<FONT SIZE=\"4\"><B>%s:</B></FONT><BR/>",
749 _("Retired Crazy Patch Writers"));
750 add_developers(str, retired_patch_writers);
752 tmp = g_strdup_printf(_("%s Developer Information"), PIDGIN_NAME);
753 developer_info = pidgin_build_help_dialog(tmp, "developer_info", str);
754 g_signal_connect(G_OBJECT(developer_info), "destroy", G_CALLBACK(gtk_widget_destroyed), &developer_info);
755 g_free(tmp);
758 void pidgin_dialogs_translators(void)
760 GString *str;
761 char *tmp;
762 static GtkWidget *translator_info = NULL;
764 if (translator_info != NULL) {
765 gtk_window_present(GTK_WINDOW(translator_info));
766 return;
769 str = g_string_sized_new(4096);
771 /* Current Translators */
772 g_string_append_printf(str, "<FONT SIZE=\"4\">%s:</FONT><BR/>",
773 _("Current Translators"));
774 add_translators(str, translators);
775 g_string_append(str, "<BR/>");
777 /* Past Translators */
778 g_string_append_printf(str, "<FONT SIZE=\"4\">%s:</FONT><BR/>",
779 _("Past Translators"));
780 add_translators(str, past_translators);
782 tmp = g_strdup_printf(_("%s Translator Information"), PIDGIN_NAME);
783 translator_info = pidgin_build_help_dialog(tmp, "translator_info", str);
784 g_signal_connect(G_OBJECT(translator_info), "destroy", G_CALLBACK(gtk_widget_destroyed), &translator_info);
785 g_free(tmp);
788 static void
789 pidgin_dialogs_im_cb(gpointer data, PurpleRequestFields *fields)
791 PurpleAccount *account;
792 const char *username;
794 account = purple_request_fields_get_account(fields, "account");
795 username = purple_request_fields_get_string(fields, "screenname");
797 pidgin_dialogs_im_with_user(account, username);
800 void
801 pidgin_dialogs_im(void)
803 PurpleRequestFields *fields;
804 PurpleRequestFieldGroup *group;
805 PurpleRequestField *field;
807 fields = purple_request_fields_new();
809 group = purple_request_field_group_new(NULL);
810 purple_request_fields_add_group(fields, group);
812 field = purple_request_field_string_new("screenname", _("_Name"), NULL, FALSE);
813 purple_request_field_set_type_hint(field, "screenname");
814 purple_request_field_set_required(field, TRUE);
815 purple_request_field_group_add_field(group, field);
817 field = purple_request_field_account_new("account", _("_Account"), NULL);
818 purple_request_field_set_type_hint(field, "account");
819 purple_request_field_set_visible(field,
820 (purple_connections_get_all() != NULL &&
821 purple_connections_get_all()->next != NULL));
822 purple_request_field_set_required(field, TRUE);
823 purple_request_field_group_add_field(group, field);
825 purple_request_fields(purple_get_blist(), _("New Instant Message"),
826 NULL,
827 _("Please enter the username or alias of the person "
828 "you would like to IM."),
829 fields,
830 _("OK"), G_CALLBACK(pidgin_dialogs_im_cb),
831 _("Cancel"), NULL,
832 NULL, NULL, NULL,
833 NULL);
836 void
837 pidgin_dialogs_im_with_user(PurpleAccount *account, const char *username)
839 PurpleConversation *conv;
841 g_return_if_fail(account != NULL);
842 g_return_if_fail(username != NULL);
844 conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, username, account);
846 if (conv == NULL)
847 conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, username);
849 pidgin_conv_attach_to_conversation(conv);
850 purple_conversation_present(conv);
853 static gboolean
854 pidgin_dialogs_ee(const char *ee)
856 GtkWidget *window;
857 GtkWidget *hbox;
858 GtkWidget *label;
859 GtkWidget *img;
860 gchar *norm = purple_strreplace(ee, "rocksmyworld", "");
862 label = gtk_label_new(NULL);
863 if (!strcmp(norm, "zilding"))
864 gtk_label_set_markup(GTK_LABEL(label),
865 "<span weight=\"bold\" size=\"large\" foreground=\"purple\">Amazing! Simply Amazing!</span>");
866 else if (!strcmp(norm, "robflynn"))
867 gtk_label_set_markup(GTK_LABEL(label),
868 "<span weight=\"bold\" size=\"large\" foreground=\"#1f6bad\">Pimpin\' Penguin Style! *Waddle Waddle*</span>");
869 else if (!strcmp(norm, "flynorange"))
870 gtk_label_set_markup(GTK_LABEL(label),
871 "<span weight=\"bold\" size=\"large\" foreground=\"blue\">You should be me. I'm so cute!</span>");
872 else if (!strcmp(norm, "ewarmenhoven"))
873 gtk_label_set_markup(GTK_LABEL(label),
874 "<span weight=\"bold\" size=\"large\" foreground=\"orange\">Now that's what I like!</span>");
875 else if (!strcmp(norm, "markster97"))
876 gtk_label_set_markup(GTK_LABEL(label),
877 "<span weight=\"bold\" size=\"large\" foreground=\"brown\">Ahh, and excellent choice!</span>");
878 else if (!strcmp(norm, "seanegn"))
879 gtk_label_set_markup(GTK_LABEL(label),
880 "<span weight=\"bold\" size=\"large\" foreground=\"#009900\">Everytime you click my name, an angel gets its wings.</span>");
881 else if (!strcmp(norm, "chipx86"))
882 gtk_label_set_markup(GTK_LABEL(label),
883 "<span weight=\"bold\" size=\"large\" foreground=\"red\">This sunflower seed taste like pizza.</span>");
884 else if (!strcmp(norm, "markdoliner"))
885 gtk_label_set_markup(GTK_LABEL(label),
886 "<span weight=\"bold\" size=\"large\" foreground=\"#6364B1\">Hey! I was in that tumbleweed!</span>");
887 else if (!strcmp(norm, "lschiere"))
888 gtk_label_set_markup(GTK_LABEL(label),
889 "<span weight=\"bold\" size=\"large\" foreground=\"gray\">I'm not anything.</span>");
890 g_free(norm);
892 if (strlen(gtk_label_get_label(GTK_LABEL(label))) <= 0)
893 return FALSE;
895 window = gtk_dialog_new_with_buttons(PIDGIN_ALERT_TITLE, NULL, 0, GTK_STOCK_CLOSE, GTK_RESPONSE_OK, NULL);
896 gtk_dialog_set_default_response (GTK_DIALOG(window), GTK_RESPONSE_OK);
897 g_signal_connect(G_OBJECT(window), "response", G_CALLBACK(gtk_widget_destroy), NULL);
899 gtk_container_set_border_width (GTK_CONTAINER(window), PIDGIN_HIG_BOX_SPACE);
900 gtk_window_set_resizable(GTK_WINDOW(window), FALSE);
901 gtk_dialog_set_has_separator(GTK_DIALOG(window), FALSE);
902 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(window)->vbox), PIDGIN_HIG_BORDER);
903 gtk_container_set_border_width (GTK_CONTAINER(GTK_DIALOG(window)->vbox), PIDGIN_HIG_BOX_SPACE);
905 hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BORDER);
906 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(window)->vbox), hbox);
907 img = gtk_image_new_from_stock(PIDGIN_STOCK_DIALOG_COOL, gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_HUGE));
908 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0);
910 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
911 gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
912 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
914 gtk_widget_show_all(window);
915 return TRUE;
918 static void
919 pidgin_dialogs_info_cb(gpointer data, PurpleRequestFields *fields)
921 char *username;
922 gboolean found = FALSE;
923 PurpleAccount *account;
925 account = purple_request_fields_get_account(fields, "account");
927 username = g_strdup(purple_normalize(account,
928 purple_request_fields_get_string(fields, "screenname")));
930 if (username != NULL && purple_str_has_suffix(username, "rocksmyworld"))
931 found = pidgin_dialogs_ee(username);
933 if (!found && username != NULL && *username != '\0' && account != NULL)
934 pidgin_retrieve_user_info(purple_account_get_connection(account), username);
936 g_free(username);
939 void
940 pidgin_dialogs_info(void)
942 PurpleRequestFields *fields;
943 PurpleRequestFieldGroup *group;
944 PurpleRequestField *field;
946 fields = purple_request_fields_new();
948 group = purple_request_field_group_new(NULL);
949 purple_request_fields_add_group(fields, group);
951 field = purple_request_field_string_new("screenname", _("_Name"), NULL, FALSE);
952 purple_request_field_set_type_hint(field, "screenname");
953 purple_request_field_set_required(field, TRUE);
954 purple_request_field_group_add_field(group, field);
956 field = purple_request_field_account_new("account", _("_Account"), NULL);
957 purple_request_field_set_type_hint(field, "account");
958 purple_request_field_set_visible(field,
959 (purple_connections_get_all() != NULL &&
960 purple_connections_get_all()->next != NULL));
961 purple_request_field_set_required(field, TRUE);
962 purple_request_field_group_add_field(group, field);
964 purple_request_fields(purple_get_blist(), _("Get User Info"),
965 NULL,
966 _("Please enter the username or alias of the person "
967 "whose info you would like to view."),
968 fields,
969 _("OK"), G_CALLBACK(pidgin_dialogs_info_cb),
970 _("Cancel"), NULL,
971 NULL, NULL, NULL,
972 NULL);
975 static void
976 pidgin_dialogs_log_cb(gpointer data, PurpleRequestFields *fields)
978 char *username;
979 PurpleAccount *account;
980 GSList *cur;
982 account = purple_request_fields_get_account(fields, "account");
984 username = g_strdup(purple_normalize(account,
985 purple_request_fields_get_string(fields, "screenname")));
987 if (username != NULL && *username != '\0' && account != NULL)
989 PidginBuddyList *gtkblist = pidgin_blist_get_default_gtk_blist();
990 GSList *buddies;
992 pidgin_set_cursor(gtkblist->window, GDK_WATCH);
994 buddies = purple_find_buddies(account, username);
995 for (cur = buddies; cur != NULL; cur = cur->next)
997 PurpleBlistNode *node = cur->data;
998 if ((node != NULL) && ((node->prev != NULL) || (node->next != NULL)))
1000 pidgin_log_show_contact((PurpleContact *)node->parent);
1001 g_slist_free(buddies);
1002 pidgin_clear_cursor(gtkblist->window);
1003 g_free(username);
1004 return;
1007 g_slist_free(buddies);
1009 pidgin_log_show(PURPLE_LOG_IM, username, account);
1011 pidgin_clear_cursor(gtkblist->window);
1014 g_free(username);
1018 * TODO - This needs to deal with logs of all types, not just IM logs.
1020 void
1021 pidgin_dialogs_log(void)
1023 PurpleRequestFields *fields;
1024 PurpleRequestFieldGroup *group;
1025 PurpleRequestField *field;
1027 fields = purple_request_fields_new();
1029 group = purple_request_field_group_new(NULL);
1030 purple_request_fields_add_group(fields, group);
1032 field = purple_request_field_string_new("screenname", _("_Name"), NULL, FALSE);
1033 purple_request_field_set_type_hint(field, "screenname-all");
1034 purple_request_field_set_required(field, TRUE);
1035 purple_request_field_group_add_field(group, field);
1037 field = purple_request_field_account_new("account", _("_Account"), NULL);
1039 /* purple_request_field_account_new() only sets a default value if you're
1040 * connected, and it sets it from the list of connected accounts. Since
1041 * we're going to set show_all here, it makes sense to use the first
1042 * account, not the first connected account. */
1043 if (purple_accounts_get_all() != NULL) {
1044 purple_request_field_account_set_default_value(field, purple_accounts_get_all()->data);
1045 purple_request_field_account_set_value(field, purple_accounts_get_all()->data);
1048 purple_request_field_set_type_hint(field, "account");
1049 purple_request_field_account_set_show_all(field, TRUE);
1050 purple_request_field_set_visible(field,
1051 (purple_accounts_get_all() != NULL &&
1052 purple_accounts_get_all()->next != NULL));
1053 purple_request_field_set_required(field, TRUE);
1054 purple_request_field_group_add_field(group, field);
1056 purple_request_fields(purple_get_blist(), _("View User Log"),
1057 NULL,
1058 _("Please enter the username or alias of the person "
1059 "whose log you would like to view."),
1060 fields,
1061 _("OK"), G_CALLBACK(pidgin_dialogs_log_cb),
1062 _("Cancel"), NULL,
1063 NULL, NULL, NULL,
1064 NULL);
1067 static void
1068 pidgin_dialogs_alias_contact_cb(PurpleContact *contact, const char *new_alias)
1070 purple_blist_alias_contact(contact, new_alias);
1073 void
1074 pidgin_dialogs_alias_contact(PurpleContact *contact)
1076 g_return_if_fail(contact != NULL);
1078 purple_request_input(NULL, _("Alias Contact"), NULL,
1079 _("Enter an alias for this contact."),
1080 contact->alias, FALSE, FALSE, NULL,
1081 _("Alias"), G_CALLBACK(pidgin_dialogs_alias_contact_cb),
1082 _("Cancel"), NULL,
1083 NULL, purple_contact_get_alias(contact), NULL,
1084 contact);
1087 static void
1088 pidgin_dialogs_alias_buddy_cb(PurpleBuddy *buddy, const char *new_alias)
1090 purple_blist_alias_buddy(buddy, new_alias);
1091 serv_alias_buddy(buddy);
1094 void
1095 pidgin_dialogs_alias_buddy(PurpleBuddy *buddy)
1097 gchar *secondary;
1099 g_return_if_fail(buddy != NULL);
1101 secondary = g_strdup_printf(_("Enter an alias for %s."), buddy->name);
1103 purple_request_input(NULL, _("Alias Buddy"), NULL,
1104 secondary, buddy->alias, FALSE, FALSE, NULL,
1105 _("Alias"), G_CALLBACK(pidgin_dialogs_alias_buddy_cb),
1106 _("Cancel"), NULL,
1107 purple_buddy_get_account(buddy), purple_buddy_get_name(buddy), NULL,
1108 buddy);
1110 g_free(secondary);
1113 static void
1114 pidgin_dialogs_alias_chat_cb(PurpleChat *chat, const char *new_alias)
1116 purple_blist_alias_chat(chat, new_alias);
1119 void
1120 pidgin_dialogs_alias_chat(PurpleChat *chat)
1122 g_return_if_fail(chat != NULL);
1124 purple_request_input(NULL, _("Alias Chat"), NULL,
1125 _("Enter an alias for this chat."),
1126 chat->alias, FALSE, FALSE, NULL,
1127 _("Alias"), G_CALLBACK(pidgin_dialogs_alias_chat_cb),
1128 _("Cancel"), NULL,
1129 chat->account, NULL, NULL,
1130 chat);
1133 static void
1134 pidgin_dialogs_remove_contact_cb(PurpleContact *contact)
1136 PurpleBlistNode *bnode, *cnode;
1137 PurpleGroup *group;
1139 cnode = (PurpleBlistNode *)contact;
1140 group = (PurpleGroup*)cnode->parent;
1141 for (bnode = cnode->child; bnode; bnode = bnode->next) {
1142 PurpleBuddy *buddy = (PurpleBuddy*)bnode;
1143 if (purple_account_is_connected(buddy->account))
1144 purple_account_remove_buddy(buddy->account, buddy, group);
1146 purple_blist_remove_contact(contact);
1149 void
1150 pidgin_dialogs_remove_contact(PurpleContact *contact)
1152 PurpleBuddy *buddy = purple_contact_get_priority_buddy(contact);
1154 g_return_if_fail(contact != NULL);
1155 g_return_if_fail(buddy != NULL);
1157 if (PURPLE_BLIST_NODE(contact)->child == PURPLE_BLIST_NODE(buddy) &&
1158 PURPLE_BLIST_NODE(buddy)->next == NULL) {
1159 pidgin_dialogs_remove_buddy(buddy);
1160 } else {
1161 gchar *text;
1162 text = g_strdup_printf(
1163 ngettext(
1164 "You are about to remove the contact containing %s "
1165 "and %d other buddy from your buddy list. Do you "
1166 "want to continue?",
1167 "You are about to remove the contact containing %s "
1168 "and %d other buddies from your buddy list. Do you "
1169 "want to continue?", contact->totalsize - 1),
1170 buddy->name, contact->totalsize - 1);
1172 purple_request_action(contact, NULL, _("Remove Contact"), text, 0,
1173 NULL, purple_contact_get_alias(contact), NULL,
1174 contact, 2,
1175 _("_Remove Contact"), G_CALLBACK(pidgin_dialogs_remove_contact_cb),
1176 _("Cancel"),
1177 NULL);
1179 g_free(text);
1183 static void free_ggmo(struct _PidginGroupMergeObject *ggp)
1185 g_free(ggp->new_name);
1186 g_free(ggp);
1189 static void
1190 pidgin_dialogs_merge_groups_cb(struct _PidginGroupMergeObject *GGP)
1192 purple_blist_rename_group(GGP->parent, GGP->new_name);
1193 free_ggmo(GGP);
1196 void
1197 pidgin_dialogs_merge_groups(PurpleGroup *source, const char *new_name)
1199 gchar *text;
1200 struct _PidginGroupMergeObject *ggp;
1202 g_return_if_fail(source != NULL);
1203 g_return_if_fail(new_name != NULL);
1205 text = g_strdup_printf(
1206 _("You are about to merge the group called %s into the group "
1207 "called %s. Do you want to continue?"), source->name, new_name);
1209 ggp = g_new(struct _PidginGroupMergeObject, 1);
1210 ggp->parent = source;
1211 ggp->new_name = g_strdup(new_name);
1213 purple_request_action(source, NULL, _("Merge Groups"), text, 0,
1214 NULL, NULL, NULL,
1215 ggp, 2,
1216 _("_Merge Groups"), G_CALLBACK(pidgin_dialogs_merge_groups_cb),
1217 _("Cancel"), G_CALLBACK(free_ggmo));
1219 g_free(text);
1222 static void
1223 pidgin_dialogs_remove_group_cb(PurpleGroup *group)
1225 PurpleBlistNode *cnode, *bnode;
1227 cnode = ((PurpleBlistNode*)group)->child;
1229 while (cnode) {
1230 if (PURPLE_BLIST_NODE_IS_CONTACT(cnode)) {
1231 bnode = cnode->child;
1232 cnode = cnode->next;
1233 while (bnode) {
1234 PurpleBuddy *buddy;
1235 if (PURPLE_BLIST_NODE_IS_BUDDY(bnode)) {
1236 buddy = (PurpleBuddy*)bnode;
1237 bnode = bnode->next;
1238 if (purple_account_is_connected(buddy->account)) {
1239 purple_account_remove_buddy(buddy->account, buddy, group);
1240 purple_blist_remove_buddy(buddy);
1242 } else {
1243 bnode = bnode->next;
1246 } else if (PURPLE_BLIST_NODE_IS_CHAT(cnode)) {
1247 PurpleChat *chat = (PurpleChat *)cnode;
1248 cnode = cnode->next;
1249 if (purple_account_is_connected(chat->account))
1250 purple_blist_remove_chat(chat);
1251 } else {
1252 cnode = cnode->next;
1256 purple_blist_remove_group(group);
1259 void
1260 pidgin_dialogs_remove_group(PurpleGroup *group)
1262 gchar *text;
1264 g_return_if_fail(group != NULL);
1266 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?"),
1267 group->name);
1269 purple_request_action(group, NULL, _("Remove Group"), text, 0,
1270 NULL, NULL, NULL,
1271 group, 2,
1272 _("_Remove Group"), G_CALLBACK(pidgin_dialogs_remove_group_cb),
1273 _("Cancel"), NULL);
1275 g_free(text);
1278 /* XXX - Some of this should be moved into the core, methinks. */
1279 static void
1280 pidgin_dialogs_remove_buddy_cb(PurpleBuddy *buddy)
1282 PurpleGroup *group;
1283 gchar *name;
1284 PurpleAccount *account;
1286 group = purple_buddy_get_group(buddy);
1287 name = g_strdup(buddy->name); /* b->name is a crasher after remove_buddy */
1288 account = buddy->account;
1290 purple_debug_info("blist", "Removing '%s' from buddy list.\n", buddy->name);
1291 /* TODO - Should remove from blist first... then call purple_account_remove_buddy()? */
1292 purple_account_remove_buddy(account, buddy, group);
1293 purple_blist_remove_buddy(buddy);
1295 g_free(name);
1298 void
1299 pidgin_dialogs_remove_buddy(PurpleBuddy *buddy)
1301 gchar *text;
1303 g_return_if_fail(buddy != NULL);
1305 text = g_strdup_printf(_("You are about to remove %s from your buddy list. Do you want to continue?"),
1306 buddy->name);
1308 purple_request_action(buddy, NULL, _("Remove Buddy"), text, 0,
1309 purple_buddy_get_account(buddy), purple_buddy_get_name(buddy), NULL,
1310 buddy, 2,
1311 _("_Remove Buddy"), G_CALLBACK(pidgin_dialogs_remove_buddy_cb),
1312 _("Cancel"), NULL);
1314 g_free(text);
1317 static void
1318 pidgin_dialogs_remove_chat_cb(PurpleChat *chat)
1320 purple_blist_remove_chat(chat);
1323 void
1324 pidgin_dialogs_remove_chat(PurpleChat *chat)
1326 const gchar *name;
1327 gchar *text;
1329 g_return_if_fail(chat != NULL);
1331 name = purple_chat_get_name(chat);
1332 text = g_strdup_printf(_("You are about to remove the chat %s from your buddy list. Do you want to continue?"),
1333 name ? name : "");
1335 purple_request_action(chat, NULL, _("Remove Chat"), text, 0,
1336 chat->account, NULL, NULL,
1337 chat, 2,
1338 _("_Remove Chat"), G_CALLBACK(pidgin_dialogs_remove_chat_cb),
1339 _("Cancel"), NULL);
1341 g_free(text);