Mercurial > pidgin
annotate src/gtkdialogs.c @ 10370:acd5b7af0409
[gaim-migrate @ 11590]
missing comma
committer: Tailor Script <tailor@pidgin.im>
| author | Luke Schierer <lschiere@pidgin.im> |
|---|---|
| date | Tue, 14 Dec 2004 22:17:19 +0000 |
| parents | 584c792dd15c |
| children | fb8e82fa32af |
| 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 " Etan 'deryni' Reisner<BR>" | |
| 248 " Kevin 'SimGuy' Stange<BR>" | |
| 249 "<BR>"); | |
| 9753 | 250 |
| 251 /* Retired Developers */ | |
| 9758 | 252 g_string_append_printf(str, "<FONT SIZE=\"4\">%s:</FONT><BR/>", |
| 253 _("Retired Developers")); | |
| 254 for (i = 0; retired_developers[i].name != NULL; i++) { | |
| 255 if (retired_developers[i].email != NULL) { | |
| 10116 | 256 g_string_append_printf(str, " %s (%s) <<a href=\"mailto:%s\">%s</a>><br/>", |
| 9758 | 257 retired_developers[i].name, _(retired_developers[i].role), |
| 258 retired_developers[i].email, retired_developers[i].email); | |
| 259 } else { | |
| 260 g_string_append_printf(str, " %s (%s)<br/>", | |
| 261 retired_developers[i].name, _(retired_developers[i].role)); | |
| 262 } | |
| 263 } | |
| 264 g_string_append(str, "<BR/>"); | |
| 9753 | 265 |
| 266 /* Current Translators */ | |
| 9758 | 267 g_string_append_printf(str, "<FONT SIZE=\"4\">%s:</FONT><BR/>", |
| 268 _("Current Translators")); | |
| 269 for (i = 0; current_translators[i].language != NULL; i++) { | |
| 270 if (current_translators[i].email != NULL) { | |
| 10116 | 271 g_string_append_printf(str, " <b>%s (%s)</b> - %s <<a href=\"mailto:%s\">%s</a>><br/>", |
| 9758 | 272 _(current_translators[i].language), |
| 273 current_translators[i].abbr, | |
| 274 _(current_translators[i].name), | |
| 275 current_translators[i].email, | |
| 276 current_translators[i].email); | |
| 277 } else { | |
| 278 g_string_append_printf(str, " <b>%s (%s)</b> - %s<br/>", | |
| 279 _(current_translators[i].language), | |
| 280 current_translators[i].abbr, | |
| 281 _(current_translators[i].name)); | |
| 282 } | |
| 283 } | |
| 284 g_string_append(str, "<BR/>"); | |
| 9753 | 285 |
| 286 /* Past Translators */ | |
| 9758 | 287 g_string_append_printf(str, "<FONT SIZE=\"4\">%s:</FONT><BR/>", |
| 288 _("Past Translators")); | |
| 289 for (i = 0; past_translators[i].language != NULL; i++) { | |
| 290 if (past_translators[i].email != NULL) { | |
| 10116 | 291 g_string_append_printf(str, " <b>%s (%s)</b> - %s <<a href=\"mailto:%s\">%s</a>><br/>", |
| 9758 | 292 _(past_translators[i].language), |
| 293 past_translators[i].abbr, | |
| 294 _(past_translators[i].name), | |
| 295 past_translators[i].email, | |
| 296 past_translators[i].email); | |
| 297 } else { | |
| 298 g_string_append_printf(str, " <b>%s (%s)</b> - %s<br/>", | |
| 299 _(past_translators[i].language), | |
| 300 past_translators[i].abbr, | |
| 301 _(past_translators[i].name)); | |
| 302 } | |
| 303 } | |
| 304 g_string_append(str, "<BR/>"); | |
| 305 | |
| 306 gtk_imhtml_append_text(GTK_IMHTML(text), str->str, GTK_IMHTML_NO_SCROLL); | |
| 307 g_string_free(str, TRUE); | |
| 9753 | 308 |
| 309 gtk_text_buffer_get_start_iter(gtk_text_view_get_buffer(GTK_TEXT_VIEW(text)), &iter); | |
| 310 gtk_text_buffer_place_cursor(gtk_text_view_get_buffer(GTK_TEXT_VIEW(text)), &iter); | |
| 10153 | 311 |
| 9753 | 312 /* Close Button */ |
| 313 bbox = gtk_hbutton_box_new(); | |
| 314 gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END); | |
| 315 gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 0); | |
| 316 | |
| 317 button = gtk_button_new_from_stock(GTK_STOCK_CLOSE); | |
| 318 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); | |
| 319 | |
| 320 g_signal_connect_swapped(G_OBJECT(button), "clicked", | |
| 321 G_CALLBACK(destroy_about), G_OBJECT(about)); | |
| 322 g_signal_connect(G_OBJECT(about), "destroy", | |
| 323 G_CALLBACK(destroy_about), G_OBJECT(about)); | |
| 324 | |
| 325 /* this makes the sizes not work? */ | |
| 326 GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT); | |
| 327 gtk_widget_grab_default(button); | |
| 328 | |
| 329 /* Let's give'em something to talk about -- woah woah woah */ | |
| 330 gtk_widget_show_all(about); | |
| 331 gtk_window_present(GTK_WINDOW(about)); | |
| 9709 | 332 } |
| 333 | |
| 9730 | 334 static void |
| 335 gaim_gtkdialogs_im_cb(gpointer data, GaimRequestFields *fields) | |
| 9709 | 336 { |
| 9730 | 337 GaimAccount *account; |
| 338 const char *username; | |
| 9709 | 339 |
| 9730 | 340 account = gaim_request_fields_get_account(fields, "account"); |
| 341 username = gaim_request_fields_get_string(fields, "screenname"); | |
| 9709 | 342 |
| 9730 | 343 gaim_gtkdialogs_im_with_user(account, username); |
| 9709 | 344 } |
| 345 | |
| 9730 | 346 void |
| 347 gaim_gtkdialogs_im(void) | |
| 9709 | 348 { |
| 9730 | 349 GaimRequestFields *fields; |
| 350 GaimRequestFieldGroup *group; | |
| 351 GaimRequestField *field; | |
| 9709 | 352 |
| 9730 | 353 fields = gaim_request_fields_new(); |
| 9709 | 354 |
| 9730 | 355 group = gaim_request_field_group_new(NULL); |
| 356 gaim_request_fields_add_group(fields, group); | |
| 9709 | 357 |
| 9730 | 358 field = gaim_request_field_string_new("screenname", _("_Screen name"), |
| 359 NULL, FALSE); | |
| 360 gaim_request_field_set_required(field, TRUE); | |
| 361 gaim_request_field_set_type_hint(field, "screenname"); | |
| 362 gaim_request_field_group_add_field(group, field); | |
| 9709 | 363 |
| 9730 | 364 field = gaim_request_field_account_new("account", _("_Account"), NULL); |
| 365 gaim_request_field_set_visible(field, | |
| 366 (gaim_connections_get_all() != NULL && | |
| 367 gaim_connections_get_all()->next != NULL)); | |
| 368 gaim_request_field_set_required(field, TRUE); | |
| 369 gaim_request_field_group_add_field(group, field); | |
| 370 | |
| 371 gaim_request_fields(gaim_get_blist(), _("New Instant Message"), | |
| 372 NULL, | |
| 373 _("Please enter the screen name of the person you " | |
| 374 "would like to IM."), | |
| 375 fields, | |
| 376 _("OK"), G_CALLBACK(gaim_gtkdialogs_im_cb), | |
| 377 _("Cancel"), NULL, | |
| 378 NULL); | |
| 9709 | 379 } |
| 380 | |
| 9730 | 381 void |
| 382 gaim_gtkdialogs_im_with_user(GaimAccount *account, const char *username) | |
| 9709 | 383 { |
| 9730 | 384 GaimConversation *conv; |
| 385 GaimConvWindow *win; | |
| 386 GaimGtkWindow *gtkwin; | |
| 9709 | 387 |
| 9753 | 388 g_return_if_fail(account != NULL); |
| 389 g_return_if_fail(username != NULL); | |
| 390 | |
| 10246 | 391 conv = gaim_find_conversation_with_account(GAIM_CONV_IM, username, account); |
| 9709 | 392 |
| 9730 | 393 if (conv == NULL) |
| 394 conv = gaim_conversation_new(GAIM_CONV_IM, account, username); | |
| 9709 | 395 |
| 9730 | 396 win = gaim_conversation_get_window(conv); |
| 397 gtkwin = GAIM_GTK_WINDOW(win); | |
| 9709 | 398 |
| 9730 | 399 gtk_window_present(GTK_WINDOW(gtkwin->window)); |
| 400 gaim_conv_window_switch_conversation(win, gaim_conversation_get_index(conv)); | |
| 9709 | 401 } |
| 402 | |
| 9730 | 403 static gboolean |
| 404 gaim_gtkdialogs_ee(const char *ee) | |
| 9709 | 405 { |
| 406 GtkWidget *window; | |
| 407 GtkWidget *hbox; | |
| 408 GtkWidget *label; | |
| 10219 | 409 GtkWidget *img; |
| 9709 | 410 gchar *norm = gaim_strreplace(ee, "rocksmyworld", ""); |
| 411 | |
| 412 label = gtk_label_new(NULL); | |
| 413 if (!strcmp(norm, "zilding")) | |
| 414 gtk_label_set_markup(GTK_LABEL(label), | |
| 415 "<span weight=\"bold\" size=\"large\" foreground=\"purple\">Amazing! Simply Amazing!</span>"); | |
| 416 else if (!strcmp(norm, "robflynn")) | |
| 417 gtk_label_set_markup(GTK_LABEL(label), | |
| 418 "<span weight=\"bold\" size=\"large\" foreground=\"#1f6bad\">Pimpin\' Penguin Style! *Waddle Waddle*</span>"); | |
| 419 else if (!strcmp(norm, "flynorange")) | |
| 420 gtk_label_set_markup(GTK_LABEL(label), | |
| 421 "<span weight=\"bold\" size=\"large\" foreground=\"blue\">You should be me. I'm so cute!</span>"); | |
| 422 else if (!strcmp(norm, "ewarmenhoven")) | |
| 423 gtk_label_set_markup(GTK_LABEL(label), | |
| 424 "<span weight=\"bold\" size=\"large\" foreground=\"orange\">Now that's what I like!</span>"); | |
| 425 else if (!strcmp(norm, "markster97")) | |
| 426 gtk_label_set_markup(GTK_LABEL(label), | |
| 427 "<span weight=\"bold\" size=\"large\" foreground=\"brown\">Ahh, and excellent choice!</span>"); | |
| 428 else if (!strcmp(norm, "seanegn")) | |
| 429 gtk_label_set_markup(GTK_LABEL(label), | |
| 430 "<span weight=\"bold\" size=\"large\" foreground=\"#009900\">Everytime you click my name, an angel gets its wings.</span>"); | |
| 431 else if (!strcmp(norm, "chipx86")) | |
| 432 gtk_label_set_markup(GTK_LABEL(label), | |
| 433 "<span weight=\"bold\" size=\"large\" foreground=\"red\">This sunflower seed taste like pizza.</span>"); | |
| 434 else if (!strcmp(norm, "markdoliner")) | |
| 435 gtk_label_set_markup(GTK_LABEL(label), | |
| 436 "<span weight=\"bold\" size=\"large\" foreground=\"#6364B1\">Hey! I was in that tumbleweed!</span>"); | |
| 437 else if (!strcmp(norm, "lschiere")) | |
| 438 gtk_label_set_markup(GTK_LABEL(label), | |
| 439 "<span weight=\"bold\" size=\"large\" foreground=\"gray\">I'm not anything.</span>"); | |
| 440 g_free(norm); | |
| 441 | |
| 442 if (strlen(gtk_label_get_label(GTK_LABEL(label))) <= 0) | |
| 443 return FALSE; | |
| 444 | |
| 445 window = gtk_dialog_new_with_buttons(GAIM_ALERT_TITLE, NULL, 0, GTK_STOCK_CLOSE, GTK_RESPONSE_OK, NULL); | |
| 446 gtk_dialog_set_default_response (GTK_DIALOG(window), GTK_RESPONSE_OK); | |
| 447 g_signal_connect(G_OBJECT(window), "response", G_CALLBACK(gtk_widget_destroy), NULL); | |
| 448 | |
| 449 gtk_container_set_border_width (GTK_CONTAINER(window), 6); | |
| 450 gtk_window_set_resizable(GTK_WINDOW(window), FALSE); | |
| 451 gtk_dialog_set_has_separator(GTK_DIALOG(window), FALSE); | |
| 452 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(window)->vbox), 12); | |
| 453 gtk_container_set_border_width (GTK_CONTAINER(GTK_DIALOG(window)->vbox), 6); | |
| 454 | |
| 455 hbox = gtk_hbox_new(FALSE, 12); | |
| 456 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(window)->vbox), hbox); | |
| 10219 | 457 img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_COOL, gtk_icon_size_from_name(GAIM_ICON_SIZE_DIALOG_COOL)); |
| 9709 | 458 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); |
| 459 | |
| 460 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); | |
| 461 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
| 462 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
| 463 | |
| 464 gtk_widget_show_all(window); | |
| 465 return TRUE; | |
| 466 } | |
| 467 | |
| 468 static void | |
| 9730 | 469 gaim_gtkdialogs_info_cb(gpointer data, GaimRequestFields *fields) |
| 9709 | 470 { |
| 471 char *username; | |
| 472 gboolean found = FALSE; | |
| 473 GaimAccount *account; | |
| 474 | |
| 475 account = gaim_request_fields_get_account(fields, "account"); | |
| 476 | |
| 477 username = g_strdup(gaim_normalize(account, | |
| 478 gaim_request_fields_get_string(fields, "screenname"))); | |
| 479 | |
| 480 if (username != NULL && gaim_str_has_suffix(username, "rocksmyworld")) | |
| 9730 | 481 found = gaim_gtkdialogs_ee(username); |
| 9709 | 482 |
| 483 if (!found && username != NULL && *username != '\0' && account != NULL) | |
| 484 serv_get_info(gaim_account_get_connection(account), username); | |
| 485 | |
| 486 g_free(username); | |
| 487 } | |
| 488 | |
| 489 void | |
| 9714 | 490 gaim_gtkdialogs_info(void) |
| 9709 | 491 { |
| 492 GaimRequestFields *fields; | |
| 493 GaimRequestFieldGroup *group; | |
| 494 GaimRequestField *field; | |
| 495 | |
| 496 fields = gaim_request_fields_new(); | |
| 497 | |
| 498 group = gaim_request_field_group_new(NULL); | |
| 499 gaim_request_fields_add_group(fields, group); | |
| 500 | |
| 501 field = gaim_request_field_string_new("screenname", _("_Screen name"), | |
| 502 NULL, FALSE); | |
| 503 gaim_request_field_set_type_hint(field, "screenname"); | |
| 504 gaim_request_field_set_required(field, TRUE); | |
| 505 gaim_request_field_group_add_field(group, field); | |
| 506 | |
| 507 field = gaim_request_field_account_new("account", _("_Account"), NULL); | |
| 508 gaim_request_field_set_visible(field, | |
| 509 (gaim_connections_get_all() != NULL && | |
| 510 gaim_connections_get_all()->next != NULL)); | |
| 511 gaim_request_field_set_required(field, TRUE); | |
| 512 gaim_request_field_group_add_field(group, field); | |
| 513 | |
| 514 gaim_request_fields(gaim_get_blist(), _("Get User Info"), | |
| 515 NULL, | |
| 516 _("Please enter the screen name of the person whose " | |
| 517 "info you would like to view."), | |
| 518 fields, | |
| 9730 | 519 _("OK"), G_CALLBACK(gaim_gtkdialogs_info_cb), |
| 9709 | 520 _("Cancel"), NULL, |
| 521 NULL); | |
| 522 } | |
| 523 | |
| 524 static void | |
| 9730 | 525 gaim_gtkdialogs_log_cb(gpointer data, GaimRequestFields *fields) |
| 9709 | 526 { |
| 527 char *username; | |
| 528 GaimAccount *account; | |
| 529 | |
| 530 account = gaim_request_fields_get_account(fields, "account"); | |
| 531 | |
| 532 username = g_strdup(gaim_normalize(account, | |
| 533 gaim_request_fields_get_string(fields, "screenname"))); | |
| 534 | |
| 9917 | 535 if(username != NULL && *username != '\0' && account != NULL ) |
| 536 gaim_gtk_log_show(GAIM_LOG_IM, username, account); | |
| 9709 | 537 |
| 538 g_free(username); | |
| 539 } | |
| 540 | |
| 9991 | 541 /* |
| 542 * TODO - This needs to deal with logs of all types, not just IM logs. | |
| 543 */ | |
| 9709 | 544 void |
| 9714 | 545 gaim_gtkdialogs_log(void) |
| 9709 | 546 { |
| 547 GaimRequestFields *fields; | |
| 548 GaimRequestFieldGroup *group; | |
| 549 GaimRequestField *field; | |
| 550 | |
| 551 fields = gaim_request_fields_new(); | |
| 552 | |
| 553 group = gaim_request_field_group_new(NULL); | |
| 554 gaim_request_fields_add_group(fields, group); | |
| 555 | |
| 556 field = gaim_request_field_string_new("screenname", _("_Screen name"), | |
| 557 NULL, FALSE); | |
| 558 gaim_request_field_set_type_hint(field, "screenname"); | |
| 559 gaim_request_field_set_required(field, TRUE); | |
| 560 gaim_request_field_group_add_field(group, field); | |
| 561 | |
| 562 field = gaim_request_field_account_new("account", _("_Account"), NULL); | |
| 563 gaim_request_field_account_set_show_all(field, TRUE); | |
| 564 gaim_request_field_set_visible(field, | |
| 565 (gaim_accounts_get_all() != NULL && | |
| 566 gaim_accounts_get_all()->next != NULL)); | |
| 567 gaim_request_field_set_required(field, TRUE); | |
| 568 gaim_request_field_group_add_field(group, field); | |
| 569 | |
| 570 gaim_request_fields(gaim_get_blist(), _("Get User Log"), | |
| 571 NULL, | |
| 572 _("Please enter the screen name of the person whose " | |
| 573 "log you would like to view."), | |
| 574 fields, | |
| 9730 | 575 _("OK"), G_CALLBACK(gaim_gtkdialogs_log_cb), |
| 9709 | 576 _("Cancel"), NULL, |
| 577 NULL); | |
| 578 } | |
| 579 | |
| 9730 | 580 static void |
| 581 gaim_gtkdialogs_warn_cb(GtkWidget *widget, gint resp, struct warning *w) | |
| 9709 | 582 { |
| 9730 | 583 if (resp == GTK_RESPONSE_OK) |
| 9753 | 584 serv_warn(w->gc, w->who, gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w->anon))); |
| 9709 | 585 |
| 9753 | 586 dialogwindows = g_list_remove(dialogwindows, w->window); |
| 587 gtk_widget_destroy(w->window); | |
| 588 | |
| 9730 | 589 g_free(w->who); |
| 590 g_free(w); | |
| 9709 | 591 } |
| 592 | |
| 9753 | 593 /* |
| 9991 | 594 * TODO - Make this use the request API, if possible. |
| 9753 | 595 */ |
| 9730 | 596 void |
| 597 gaim_gtkdialogs_warn(GaimConnection *gc, const char *who) | |
| 9709 | 598 { |
| 9753 | 599 gchar *labeltext; |
| 9730 | 600 GtkWidget *hbox, *vbox; |
| 9709 | 601 GtkWidget *label; |
| 9753 | 602 GtkWidget *img; |
| 603 struct warning *w; | |
| 9730 | 604 |
| 9753 | 605 g_return_if_fail(gc != NULL); |
| 606 g_return_if_fail(who != NULL); | |
| 607 | |
| 608 w = g_new0(struct warning, 1); | |
| 9730 | 609 w->who = g_strdup(who); |
| 610 w->gc = gc; | |
| 611 | |
| 9753 | 612 w->window = gtk_dialog_new_with_buttons(_("Warn User"), NULL, 0, |
| 9730 | 613 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, |
| 614 GAIM_STOCK_WARN, GTK_RESPONSE_OK, NULL); | |
| 615 gtk_dialog_set_default_response (GTK_DIALOG(w->window), GTK_RESPONSE_OK); | |
| 616 g_signal_connect(G_OBJECT(w->window), "response", G_CALLBACK(gaim_gtkdialogs_warn_cb), w); | |
| 617 | |
| 618 gtk_container_set_border_width (GTK_CONTAINER(w->window), 6); | |
| 619 gtk_window_set_resizable(GTK_WINDOW(w->window), FALSE); | |
| 620 gtk_dialog_set_has_separator(GTK_DIALOG(w->window), FALSE); | |
| 621 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(w->window)->vbox), 12); | |
| 622 gtk_container_set_border_width (GTK_CONTAINER(GTK_DIALOG(w->window)->vbox), 6); | |
| 9709 | 623 |
| 624 hbox = gtk_hbox_new(FALSE, 12); | |
| 9730 | 625 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(w->window)->vbox), hbox); |
| 9753 | 626 |
| 627 img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_WARNING, GTK_ICON_SIZE_DIALOG); | |
| 628 gtk_misc_set_alignment(GTK_MISC(img), 0, 0); | |
| 9730 | 629 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); |
| 9709 | 630 |
| 9730 | 631 vbox = gtk_vbox_new(FALSE, 0); |
| 632 gtk_container_add(GTK_CONTAINER(hbox), vbox); | |
| 633 labeltext = g_strdup_printf(_("<span weight=\"bold\" size=\"larger\">Warn %s?</span>\n\n" | |
| 634 "This will increase %s's warning level and he or she will be subject to harsher rate limiting.\n"), who, who); | |
| 635 label = gtk_label_new(NULL); | |
| 636 gtk_label_set_markup(GTK_LABEL(label), labeltext); | |
| 637 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); | |
| 638 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
| 639 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); | |
| 640 g_free(labeltext); | |
| 9709 | 641 |
| 9730 | 642 w->anon = gtk_check_button_new_with_mnemonic(_("Warn _anonymously?")); |
| 643 gtk_box_pack_start(GTK_BOX(vbox), w->anon, FALSE, FALSE, 0); | |
| 644 | |
| 645 hbox = gtk_hbox_new(FALSE, 6); | |
| 646 gtk_container_add(GTK_CONTAINER(vbox), hbox); | |
| 647 img = gtk_image_new_from_stock(GTK_STOCK_DIALOG_INFO, GTK_ICON_SIZE_MENU); | |
| 648 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); | |
| 649 labeltext = _("<b>Anonymous warnings are less severe.</b>"); | |
| 650 label = gtk_label_new(NULL); | |
| 651 gtk_label_set_markup(GTK_LABEL(label), labeltext); | |
| 652 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); | |
| 9709 | 653 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
| 654 | |
| 9730 | 655 dialogwindows = g_list_prepend(dialogwindows, w->window); |
| 656 gtk_widget_show_all(w->window); | |
| 9709 | 657 } |
| 658 | |
| 659 static void | |
| 9730 | 660 gaim_gtkdialogs_alias_contact_cb(GaimContact *contact, const char *new_alias) |
| 661 { | |
| 662 gaim_contact_set_alias(contact, new_alias); | |
| 663 } | |
| 664 | |
| 665 void | |
| 666 gaim_gtkdialogs_alias_contact(GaimContact *contact) | |
| 667 { | |
| 9753 | 668 g_return_if_fail(contact != NULL); |
| 669 | |
| 9730 | 670 gaim_request_input(NULL, _("Alias Contact"), NULL, |
| 671 _("Enter an alias for this contact."), | |
| 672 contact->alias, FALSE, FALSE, NULL, | |
| 673 _("Alias"), G_CALLBACK(gaim_gtkdialogs_alias_contact_cb), | |
| 674 _("Cancel"), NULL, contact); | |
| 675 } | |
| 676 | |
| 677 static void | |
| 678 gaim_gtkdialogs_alias_buddy_cb(GaimBuddy *buddy, const char *new_alias) | |
| 679 { | |
| 680 gaim_blist_alias_buddy(buddy, new_alias); | |
| 681 serv_alias_buddy(buddy); | |
| 682 } | |
| 683 | |
| 684 void | |
| 9753 | 685 gaim_gtkdialogs_alias_buddy(GaimBuddy *buddy) |
| 9730 | 686 { |
| 9753 | 687 gchar *secondary; |
| 688 | |
| 689 g_return_if_fail(buddy != NULL); | |
| 690 | |
| 691 secondary = g_strdup_printf(_("Enter an alias for %s."), buddy->name); | |
| 9730 | 692 |
| 693 gaim_request_input(NULL, _("Alias Buddy"), NULL, | |
| 9753 | 694 secondary, buddy->alias, FALSE, FALSE, NULL, |
| 9730 | 695 _("Alias"), G_CALLBACK(gaim_gtkdialogs_alias_buddy_cb), |
| 9753 | 696 _("Cancel"), NULL, buddy); |
| 9730 | 697 |
| 698 g_free(secondary); | |
| 699 } | |
| 700 | |
| 701 static void | |
| 702 gaim_gtkdialogs_alias_chat_cb(GaimChat *chat, const char *new_alias) | |
| 9709 | 703 { |
| 704 gaim_blist_alias_chat(chat, new_alias); | |
| 705 } | |
| 706 | |
| 707 void | |
| 9730 | 708 gaim_gtkdialogs_alias_chat(GaimChat *chat) |
| 9709 | 709 { |
| 9753 | 710 g_return_if_fail(chat != NULL); |
| 711 | |
| 9709 | 712 gaim_request_input(NULL, _("Alias Chat"), NULL, |
| 713 _("Enter an alias for this chat."), | |
| 714 chat->alias, FALSE, FALSE, NULL, | |
| 9730 | 715 _("Alias"), G_CALLBACK(gaim_gtkdialogs_alias_chat_cb), |
| 9709 | 716 _("Cancel"), NULL, chat); |
| 717 } | |
| 718 | |
| 719 static void | |
| 9753 | 720 gaim_gtkdialogs_remove_contact_cb(GaimContact *contact) |
| 9709 | 721 { |
| 9730 | 722 GaimBlistNode *bnode, *cnode; |
| 723 GaimGroup *group; | |
| 724 | |
| 725 cnode = (GaimBlistNode *)contact; | |
| 726 group = (GaimGroup*)cnode->parent; | |
| 727 for (bnode = cnode->child; bnode; bnode = bnode->next) { | |
| 728 GaimBuddy *buddy = (GaimBuddy*)bnode; | |
| 729 if (gaim_account_is_connected(buddy->account)) | |
| 730 serv_remove_buddy(buddy->account->gc, buddy, group); | |
| 731 } | |
| 732 gaim_blist_remove_contact(contact); | |
| 733 } | |
| 734 | |
| 735 void | |
| 736 gaim_gtkdialogs_remove_contact(GaimContact *contact) | |
| 737 { | |
| 738 GaimBuddy *buddy = gaim_contact_get_priority_buddy(contact); | |
| 739 | |
| 9753 | 740 g_return_if_fail(contact != NULL); |
| 741 g_return_if_fail(buddy != NULL); | |
| 9730 | 742 |
| 743 if (((GaimBlistNode*)contact)->child == (GaimBlistNode*)buddy && | |
| 744 !((GaimBlistNode*)buddy)->next) { | |
| 745 gaim_gtkdialogs_remove_buddy(buddy); | |
| 746 } else { | |
| 10324 | 747 gchar *text; |
| 748 text = g_strdup_printf( | |
| 749 ngettext( | |
| 750 "You are about to remove the contact containing %s " | |
| 751 "and %d other buddy from your buddy list. Do you " | |
| 752 "want to continue?", | |
| 753 "You are about to remove the contact containing %s " | |
| 754 "and %d other buddies from your buddy list. Do you " | |
| 755 "want to continue?", contact->totalsize - 1), | |
| 756 buddy->name, contact->totalsize - 1); | |
| 9730 | 757 |
| 10222 | 758 gaim_request_action(contact, 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; | |
| 10246 | 783 conv = gaim_find_conversation_with_account(GAIM_CONV_IM, |
| 784 buddy->name, | |
| 785 buddy->account); | |
| 9730 | 786 if (gaim_account_is_connected(buddy->account)) { |
| 787 serv_remove_buddy(buddy->account->gc, buddy, group); | |
| 788 gaim_blist_remove_buddy(buddy); | |
| 789 if (conv) | |
| 790 gaim_conversation_update(conv, | |
| 791 GAIM_CONV_UPDATE_REMOVE); | |
| 792 } | |
| 793 } else { | |
| 794 bnode = bnode->next; | |
| 795 } | |
| 796 } | |
| 797 } else if (GAIM_BLIST_NODE_IS_CHAT(cnode)) { | |
| 798 GaimChat *chat = (GaimChat *)cnode; | |
| 799 cnode = cnode->next; | |
| 800 if (gaim_account_is_connected(chat->account)) | |
| 801 gaim_blist_remove_chat(chat); | |
| 802 } else { | |
| 803 cnode = cnode->next; | |
| 804 } | |
| 805 } | |
| 806 | |
| 807 gaim_blist_remove_group(group); | |
| 808 } | |
| 809 | |
| 810 void | |
| 811 gaim_gtkdialogs_remove_group(GaimGroup *group) | |
| 812 { | |
| 9753 | 813 gchar *text; |
| 814 | |
| 815 g_return_if_fail(group != NULL); | |
| 816 | |
| 817 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?"), | |
| 818 group->name); | |
| 9730 | 819 |
| 10222 | 820 gaim_request_action(group, NULL, _("Remove Group"), text, 0, group, 2, |
| 9753 | 821 _("Remove Group"), G_CALLBACK(gaim_gtkdialogs_remove_group_cb), |
| 9730 | 822 _("Cancel"), NULL); |
| 823 | |
| 824 g_free(text); | |
| 9709 | 825 } |
| 826 | |
| 10246 | 827 /* XXX - Some of this should be moved into the core, methinks. */ |
| 9709 | 828 static void |
| 9753 | 829 gaim_gtkdialogs_remove_buddy_cb(GaimBuddy *buddy) |
| 9709 | 830 { |
| 9730 | 831 GaimGroup *group; |
| 832 GaimConversation *conv; | |
| 833 gchar *name; | |
| 834 GaimAccount *account; | |
| 835 | |
| 836 group = gaim_find_buddys_group(buddy); | |
| 837 name = g_strdup(buddy->name); /* b->name is a crasher after remove_buddy */ | |
| 838 account = buddy->account; | |
| 839 | |
| 9753 | 840 gaim_debug_info("blist", "Removing '%s' from buddy list.\n", buddy->name); |
| 9991 | 841 /* TODO - Should remove from blist first... then call serv_remove_buddy()? */ |
| 9730 | 842 serv_remove_buddy(buddy->account->gc, buddy, group); |
| 843 gaim_blist_remove_buddy(buddy); | |
| 844 | |
| 10246 | 845 conv = gaim_find_conversation_with_account(GAIM_CONV_IM, name, account); |
| 9730 | 846 if (conv != NULL) |
| 847 gaim_conversation_update(conv, GAIM_CONV_UPDATE_REMOVE); | |
| 848 | |
| 849 g_free(name); | |
| 9709 | 850 } |
| 851 | |
| 852 void | |
| 9730 | 853 gaim_gtkdialogs_remove_buddy(GaimBuddy *buddy) |
| 9709 | 854 { |
| 9753 | 855 gchar *text; |
| 9730 | 856 |
| 9753 | 857 g_return_if_fail(buddy != NULL); |
| 9730 | 858 |
| 9753 | 859 text = g_strdup_printf(_("You are about to remove %s from your buddy list. Do you want to continue?"), |
| 860 buddy->name); | |
| 9730 | 861 |
| 10222 | 862 gaim_request_action(buddy, NULL, _("Remove Buddy"), text, 0, buddy, 2, |
| 9753 | 863 _("Remove Buddy"), G_CALLBACK(gaim_gtkdialogs_remove_buddy_cb), |
| 9730 | 864 _("Cancel"), NULL); |
| 865 | |
| 866 g_free(text); | |
| 867 } | |
| 9709 | 868 |
| 9730 | 869 static void |
| 9753 | 870 gaim_gtkdialogs_remove_chat_cb(GaimChat *chat) |
| 9730 | 871 { |
| 9918 | 872 char *name = NULL; |
| 10167 | 873 GaimAccount *account; |
| 9918 | 874 GaimConversation *conv = NULL; |
| 875 | |
| 10167 | 876 account = chat->account; |
| 877 | |
| 878 if (GAIM_PLUGIN_PROTOCOL_INFO(account->gc->prpl)->get_chat_name != NULL) | |
| 879 name = GAIM_PLUGIN_PROTOCOL_INFO(account->gc->prpl)->get_chat_name(chat->components); | |
| 9918 | 880 |
| 9730 | 881 gaim_blist_remove_chat(chat); |
| 9918 | 882 |
| 883 if (name != NULL) { | |
| 10246 | 884 conv = gaim_find_conversation_with_account(GAIM_CONV_CHAT, name, account); |
| 9918 | 885 g_free(name); |
| 886 } | |
| 887 | |
| 888 if (conv != NULL) | |
| 889 gaim_conversation_update(conv, GAIM_CONV_UPDATE_REMOVE); | |
| 9730 | 890 } |
| 9709 | 891 |
| 9730 | 892 void |
| 893 gaim_gtkdialogs_remove_chat(GaimChat *chat) | |
| 894 { | |
| 9753 | 895 gchar *name = gaim_chat_get_display_name(chat); |
| 896 gchar *text = g_strdup_printf(_("You are about to remove the chat %s from your buddy list. Do you want to continue?"), name); | |
| 897 | |
| 898 g_return_if_fail(chat != NULL); | |
| 9730 | 899 |
| 10222 | 900 gaim_request_action(chat, NULL, _("Remove Chat"), text, 0, chat, 2, |
| 9753 | 901 _("Remove Chat"), G_CALLBACK(gaim_gtkdialogs_remove_chat_cb), |
| 9730 | 902 _("Cancel"), NULL); |
| 903 | |
| 904 g_free(name); | |
| 905 g_free(text); | |
| 9709 | 906 } |
