| 3480 g_hash_table_remove(gtkblist->connection_errors, account); |
3480 g_hash_table_remove(gtkblist->connection_errors, account); |
| 3481 } |
3481 } |
| 3482 |
3482 |
| 3483 /* Add some buttons that show connection errors */ |
3483 /* Add some buttons that show connection errors */ |
| 3484 static void |
3484 static void |
| 3485 create_connection_error_buttons(gpointer key, gpointer value, gpointer user_data) |
3485 create_connection_error_buttons(gpointer key, gpointer value, |
| |
3486 gpointer user_data) |
| 3486 { |
3487 { |
| 3487 GaimAccount *account; |
3488 GaimAccount *account; |
| 3488 gchar *text; |
3489 gchar *text, *filename; |
| 3489 GtkWidget *button; |
3490 GtkWidget *button, *label, *image, *hbox; |
| |
3491 GdkPixbuf *pixbuf, *emblem, *scale; |
| 3490 |
3492 |
| 3491 account = key; |
3493 account = key; |
| 3492 text = value; |
3494 text = g_strdup_printf("<span color=\"red\">%s disconnected: %s</span>", |
| |
3495 gaim_account_get_username(account), |
| |
3496 (gchar *)value); |
| 3493 |
3497 |
| 3494 /* |
3498 /* |
| 3495 * TODO: The text needs to be bold and red. And it would probably |
3499 * TODO: The text needs to be bold and red. And it would probably |
| 3496 * be better if we displayed something like |
3500 * be better if we displayed something like |
| 3497 * "MarkDoliner disconnected: Invalid passw..." |
3501 * "MarkDoliner disconnected: Invalid passw..." |
| 3498 * And we DEFINITELY need to show an icon on the left side. |
3502 * And we DEFINITELY need to show an icon on the left side. |
| 3499 * It should be the PRPL icon overlayed with something that |
3503 * It should be the PRPL icon overlayed with something that |
| 3500 * will signal to the user that the account had an error. |
3504 * will signal to the user that the account had an error. |
| 3501 */ |
3505 */ |
| 3502 button = gtk_button_new_with_label(text); |
3506 hbox = gtk_hbox_new(FALSE, 0); |
| |
3507 gtk_widget_show(hbox); |
| |
3508 |
| |
3509 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "status", "default", "blocked.png", NULL); |
| |
3510 pixbuf = gdk_pixbuf_new_from_file(filename, NULL); |
| |
3511 g_free(filename); |
| |
3512 if (pixbuf != NULL) { |
| |
3513 scale = gdk_pixbuf_scale_simple(pixbuf, 10, 10, |
| |
3514 GDK_INTERP_BILINEAR); |
| |
3515 g_object_unref(pixbuf); |
| |
3516 emblem = scale; |
| |
3517 scale = NULL; |
| |
3518 } |
| |
3519 |
| |
3520 pixbuf = gaim_gtk_create_prpl_icon(account); |
| |
3521 if (pixbuf != NULL) { |
| |
3522 scale = gdk_pixbuf_scale_simple(pixbuf, 16, 16, |
| |
3523 GDK_INTERP_BILINEAR); |
| |
3524 gdk_pixbuf_saturate_and_pixelate(scale, scale, 0.0, FALSE); |
| |
3525 g_object_unref(G_OBJECT(pixbuf)); |
| |
3526 } |
| |
3527 |
| |
3528 gdk_pixbuf_composite(emblem, scale, 6, 6, 10, 10, 6, 6, 1, 1, |
| |
3529 GDK_INTERP_BILINEAR, 255); |
| |
3530 g_object_unref(emblem); |
| |
3531 image = gtk_image_new_from_pixbuf(scale); |
| |
3532 g_object_unref(scale); |
| |
3533 gtk_widget_show(image); |
| |
3534 gtk_box_pack_start(GTK_BOX(hbox), image, FALSE, FALSE, |
| |
3535 GAIM_HIG_BOX_SPACE); |
| |
3536 |
| |
3537 label = gtk_label_new(""); |
| |
3538 gtk_label_set_markup(GTK_LABEL(label), text); |
| |
3539 g_free(text); |
| |
3540 #if GTK_CHECK_VERSION(2,6,0) |
| |
3541 g_object_set(label, "ellipsize", PANGO_ELLIPSIZE_END, NULL); |
| |
3542 #endif |
| |
3543 gtk_widget_show(label); |
| |
3544 gtk_box_pack_start(GTK_BOX(hbox), label, TRUE, TRUE, |
| |
3545 GAIM_HIG_BOX_SPACE); |
| |
3546 |
| |
3547 button = gtk_button_new(); |
| |
3548 gtk_container_add(GTK_CONTAINER(button), hbox); |
| 3503 g_signal_connect(G_OBJECT(button), "clicked", |
3549 g_signal_connect(G_OBJECT(button), "clicked", |
| 3504 G_CALLBACK(connection_error_button_clicked_cb), |
3550 G_CALLBACK(connection_error_button_clicked_cb), |
| 3505 account); |
3551 account); |
| 3506 gtk_widget_show(button); |
3552 gtk_widget_show(button); |
| 3507 gtk_box_pack_end(GTK_BOX(gtkblist->error_buttons), button, FALSE, FALSE, 0); |
3553 gtk_box_pack_end(GTK_BOX(gtkblist->error_buttons), button, |
| |
3554 FALSE, FALSE, 0); |
| 3508 } |
3555 } |
| 3509 |
3556 |
| 3510 void |
3557 void |
| 3511 gaim_gtk_blist_update_account_error_state(GaimAccount *account, const char *text) |
3558 gaim_gtk_blist_update_account_error_state(GaimAccount *account, const char *text) |
| 3512 { |
3559 { |