comparison src/gtkstatusbox.c @ 13122:d33a225fcb80

[gaim-migrate @ 15484] Remove the gtkstatusbox code for displaying connection errors, since we're using the error buttons in the buddy list, now. I really think showing connection errors in the status box is a bad idea. Users need a way to acknowledge that they've seen an error. Plus there wasn't any way to tell which account it was for. Or view the full text of the error message. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Sat, 04 Feb 2006 21:54:55 +0000
parents e2a94ab60a7e
children a9f6d9a68a04
comparison
equal deleted inserted replaced
13121:e2a94ab60a7e 13122:d33a225fcb80
326 326
327 saved_status = gaim_savedstatus_get_current(); 327 saved_status = gaim_savedstatus_get_current();
328 328
329 title = g_markup_escape_text(gaim_savedstatus_get_title(saved_status), -1); 329 title = g_markup_escape_text(gaim_savedstatus_get_title(saved_status), -1);
330 330
331 if (status_box->error) { 331 if (status_box->typing) {
332 gchar *tmp = g_markup_escape_text(status_box->error, -1); 332 text = g_strdup(_("Typing"));
333 text = g_strdup_printf("<span size=\"smaller\" weight=\"bold\" color=\"red\">%s</span>",
334 tmp);
335 g_free(tmp);
336 } else if (status_box->typing) {
337 text = g_strdup_printf("<span size=\"smaller\" color=\"%s\">%s</span>",
338 aa_color, _("Typing"));
339 } else if (status_box->connecting) { 333 } else if (status_box->connecting) {
340 text = g_strdup_printf("<span size=\"smaller\" color=\"%s\">%s</span>", 334 text = g_strdup(_("Connecting"));
341 aa_color, _("Connecting"));
342 } else if (!gaim_savedstatus_is_transient(saved_status)) { 335 } else if (!gaim_savedstatus_is_transient(saved_status)) {
343 const gchar *message; 336 const gchar *message;
344 message = gaim_savedstatus_get_message(saved_status); 337 message = gaim_savedstatus_get_message(saved_status);
345 if (message != NULL) 338 if (message != NULL)
346 { 339 {
347 gchar *stripped; 340 text = gaim_markup_strip_html(message);
348 stripped = gaim_markup_strip_html(message); 341 gaim_util_chrreplace(text, '\n', ' ');
349 gaim_util_chrreplace(stripped, '\n', ' ');
350 text = g_strdup_printf("<span size=\"smaller\" color=\"%s\">%s</span>",
351 aa_color, stripped);
352 g_free(stripped);
353 } 342 }
354 } 343 }
355 344
356 if (status_box->account != NULL) { 345 if (status_box->account != NULL) {
357 char *tmp = g_strdup_printf("%s\n<span size=\"smaller\">%s</span>", 346 char *tmp = g_strdup_printf("%s\n<span size=\"smaller\">%s</span>",
361 text = tmp; 350 text = tmp;
362 } else if (text != NULL) { 351 } else if (text != NULL) {
363 char *separator; 352 char *separator;
364 char *tmp; 353 char *tmp;
365 separator = show_buddy_icons ? "\n" : " - "; 354 separator = show_buddy_icons ? "\n" : " - ";
366 tmp = g_strdup_printf("%s%s%s", title, separator, text); 355 tmp = g_strdup_printf("%s%s<span size=\"smaller\" color=\"%s\">%s</span>",
356 title, separator, aa_color, text);
367 g_free(text); 357 g_free(text);
368 text = tmp; 358 text = tmp;
369 } else { 359 } else {
370 text = g_strdup(title); 360 text = g_strdup(title);
371 } 361 }
372 g_free(title); 362 g_free(title);
373 363
374 /* Figure out what pixbuf to use */ 364 /* Figure out what pixbuf to use */
375 if (status_box->connecting) 365 if (status_box->connecting)
376 pixbuf = status_box->connecting_pixbufs[status_box->connecting_index]; 366 pixbuf = status_box->connecting_pixbufs[status_box->connecting_index];
377 else if (status_box->error)
378 pixbuf = status_box->error_pixbuf;
379 else if (status_box->typing) 367 else if (status_box->typing)
380 pixbuf = status_box->typing_pixbufs[status_box->typing_index]; 368 pixbuf = status_box->typing_pixbufs[status_box->typing_index];
381 else 369 else
382 pixbuf = gaim_gtk_create_gaim_icon_with_status( 370 pixbuf = gaim_gtk_create_gaim_icon_with_status(
383 gaim_savedstatus_get_type(saved_status), 371 gaim_savedstatus_get_type(saved_status),
712 } else { 700 } else {
713 g_object_set(G_OBJECT(status_box->icon_rend), "xpad", 3, NULL); 701 g_object_set(G_OBJECT(status_box->icon_rend), "xpad", 3, NULL);
714 icon_size = gtk_icon_size_from_name(GAIM_ICON_SIZE_STATUS_SMALL_TWO_LINE); 702 icon_size = gtk_icon_size_from_name(GAIM_ICON_SIZE_STATUS_SMALL_TWO_LINE);
715 } 703 }
716 704
717 if (status_box->error_pixbuf != NULL)
718 gdk_pixbuf_unref(status_box->error_pixbuf);
719
720 status_box->error_pixbuf = gtk_widget_render_icon (GTK_WIDGET(status_box->vbox), GAIM_STOCK_STATUS_OFFLINE,
721 icon_size, "GtkGaimStatusBox");
722 if (status_box->connecting_pixbufs[0] != NULL) 705 if (status_box->connecting_pixbufs[0] != NULL)
723 gdk_pixbuf_unref(status_box->connecting_pixbufs[0]); 706 gdk_pixbuf_unref(status_box->connecting_pixbufs[0]);
724 if (status_box->connecting_pixbufs[1] != NULL) 707 if (status_box->connecting_pixbufs[1] != NULL)
725 gdk_pixbuf_unref(status_box->connecting_pixbufs[1]); 708 gdk_pixbuf_unref(status_box->connecting_pixbufs[1]);
726 if (status_box->connecting_pixbufs[2] != NULL) 709 if (status_box->connecting_pixbufs[2] != NULL)
1093 -1); 1076 -1);
1094 #endif 1077 #endif
1095 } 1078 }
1096 1079
1097 void 1080 void
1098 gtk_gaim_status_box_set_error(GtkGaimStatusBox *status_box, const gchar *error)
1099 {
1100 if (status_box->error)
1101 g_free(status_box->error);
1102 status_box->error = NULL;
1103 #if 0
1104 if (error != NULL)
1105 status_box->error = g_strdup(error);
1106 #endif
1107 gtk_gaim_status_box_refresh(status_box);
1108 }
1109
1110 void
1111 gtk_gaim_status_box_set_connecting(GtkGaimStatusBox *status_box, gboolean connecting) 1081 gtk_gaim_status_box_set_connecting(GtkGaimStatusBox *status_box, gboolean connecting)
1112 { 1082 {
1113 if (!status_box) 1083 if (!status_box)
1114 return; 1084 return;
1115 status_box->connecting = connecting; 1085 status_box->connecting = connecting;