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