comparison src/gtkblist.c @ 13022:228b1f95e5b4

[gaim-migrate @ 15375] Here's my "I'm staying up all night anyway so I might as well take a stab at the connection error buttons" work on the connection error buttons. I left Mark's comment in since I don't think this is finished. I also left a couple warnings in place because I'm too tired to try to follow failure characteristics and recovery mechanisms for the stuff I'm doing. It works for me. I saturated the prpl icons mostly because it made the error overlay stand out better, but once I saw it I think it works well, and also fits well with our use of saturation in other places to indicate offline. I'm currently using the default status image blocked.png, if that's what we end up wanting to keep we should put a copy of it somewhere else as pulling it from status/default is silly. I had originally tried to get the blocked circle to be larger than the prpl icon, with the prpl icon centered, but couldn't come up with a good way to do that given the gdk functions I had at hand. I'll probably give it a shot again at some other point unless we decide we don't want it or someone else does it before me. I'm done rambling now, I'm tired. committer: Tailor Script <tailor@pidgin.im>
author Etan Reisner <pidgin@unreliablesource.net>
date Mon, 23 Jan 2006 15:15:01 +0000
parents 8acf409a2d5f
children e8adf8183cf4
comparison
equal deleted inserted replaced
13021:eb64b2b26e56 13022:228b1f95e5b4
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 {