comparison src/gtkblist.c @ 13049:97fa7332b034

[gaim-migrate @ 15410] Change the disconnected buttons overlay icon to our standard "offline" icon, and update some documentation committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Fri, 27 Jan 2006 04:22:19 +0000
parents 4005ad2b3ca9
children 0aa231ebbfd5
comparison
equal deleted inserted replaced
13048:80c2a2c4772f 13049:97fa7332b034
3490 static void 3490 static void
3491 create_connection_error_buttons(gpointer key, gpointer value, 3491 create_connection_error_buttons(gpointer key, gpointer value,
3492 gpointer user_data) 3492 gpointer user_data)
3493 { 3493 {
3494 GaimAccount *account; 3494 GaimAccount *account;
3495 gchar *text, *filename; 3495 gchar *escaped, *text, *filename;
3496 GtkWidget *button, *label, *image, *hbox; 3496 GtkWidget *button, *label, *image, *hbox;
3497 GdkPixbuf *pixbuf, *emblem, *scale; 3497 GdkPixbuf *pixbuf, *emblem, *scale;
3498 3498
3499 account = key; 3499 account = key;
3500 escaped = g_markup_escape_text((const gchar *)value, -1);
3500 text = g_strdup_printf(_("<span color=\"red\">%s disconnected: %s</span>"), 3501 text = g_strdup_printf(_("<span color=\"red\">%s disconnected: %s</span>"),
3501 gaim_account_get_username(account), 3502 gaim_account_get_username(account),
3502 (gchar *)value); 3503 escaped);
3503 3504 g_free(escaped);
3504 /* 3505
3505 * TODO: The text needs to be bold and red. And it would probably
3506 * be better if we displayed something like
3507 * "MarkDoliner disconnected: Invalid passw..."
3508 * And we DEFINITELY need to show an icon on the left side.
3509 * It should be the PRPL icon overlayed with something that
3510 * will signal to the user that the account had an error.
3511 */
3512 hbox = gtk_hbox_new(FALSE, 0); 3506 hbox = gtk_hbox_new(FALSE, 0);
3513 gtk_widget_show(hbox); 3507
3514 3508 /* Create the icon */
3515 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "status", "default", "blocked.png", NULL); 3509 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "status", "default", "offline.png", NULL);
3516 pixbuf = gdk_pixbuf_new_from_file(filename, NULL); 3510 pixbuf = gdk_pixbuf_new_from_file(filename, NULL);
3517 g_free(filename); 3511 g_free(filename);
3518 if (pixbuf != NULL) { 3512 if (pixbuf != NULL) {
3519 scale = gdk_pixbuf_scale_simple(pixbuf, 10, 10, 3513 scale = gdk_pixbuf_scale_simple(pixbuf, 10, 10,
3520 GDK_INTERP_BILINEAR); 3514 GDK_INTERP_BILINEAR);
3537 } 3531 }
3538 3532
3539 image = gtk_image_new_from_pixbuf(emblem); 3533 image = gtk_image_new_from_pixbuf(emblem);
3540 g_object_unref(emblem); 3534 g_object_unref(emblem);
3541 3535
3542 gtk_widget_show(image);
3543 gtk_box_pack_start(GTK_BOX(hbox), image, FALSE, FALSE, 3536 gtk_box_pack_start(GTK_BOX(hbox), image, FALSE, FALSE,
3544 GAIM_HIG_BOX_SPACE); 3537 GAIM_HIG_BOX_SPACE);
3545 } 3538 }
3546 3539
3540 /* Create the text */
3547 label = gtk_label_new(""); 3541 label = gtk_label_new("");
3548 gtk_label_set_markup(GTK_LABEL(label), text); 3542 gtk_label_set_markup(GTK_LABEL(label), text);
3549 g_free(text); 3543 g_free(text);
3550 #if GTK_CHECK_VERSION(2,6,0) 3544 #if GTK_CHECK_VERSION(2,6,0)
3551 g_object_set(label, "ellipsize", PANGO_ELLIPSIZE_END, NULL); 3545 g_object_set(label, "ellipsize", PANGO_ELLIPSIZE_END, NULL);
3552 #endif 3546 #endif
3553 gtk_widget_show(label);
3554 gtk_box_pack_start(GTK_BOX(hbox), label, TRUE, TRUE, 3547 gtk_box_pack_start(GTK_BOX(hbox), label, TRUE, TRUE,
3555 GAIM_HIG_BOX_SPACE); 3548 GAIM_HIG_BOX_SPACE);
3556 3549
3550 /* Create the actual button and put the icon and text on it */
3557 button = gtk_button_new(); 3551 button = gtk_button_new();
3558 gtk_container_add(GTK_CONTAINER(button), hbox); 3552 gtk_container_add(GTK_CONTAINER(button), hbox);
3559 g_signal_connect(G_OBJECT(button), "clicked", 3553 g_signal_connect(G_OBJECT(button), "clicked",
3560 G_CALLBACK(connection_error_button_clicked_cb), 3554 G_CALLBACK(connection_error_button_clicked_cb),
3561 account); 3555 account);
3562 gtk_widget_show(button); 3556 gtk_widget_show_all(button);
3563 gtk_box_pack_end(GTK_BOX(gtkblist->error_buttons), button, 3557 gtk_box_pack_end(GTK_BOX(gtkblist->error_buttons), button,
3564 FALSE, FALSE, 0); 3558 FALSE, FALSE, 0);
3565 } 3559 }
3566 3560
3567 void 3561 void