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