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