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