changeset 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 eb64b2b26e56
children e8adf8183cf4
files src/gtkblist.c
diffstat 1 files changed, 55 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/gtkblist.c	Mon Jan 23 12:31:27 2006 +0000
+++ b/src/gtkblist.c	Mon Jan 23 15:15:01 2006 +0000
@@ -3482,14 +3482,18 @@
 
 /* Add some buttons that show connection errors */
 static void
-create_connection_error_buttons(gpointer key, gpointer value, gpointer user_data)
+create_connection_error_buttons(gpointer key, gpointer value,
+                                gpointer user_data)
 {
 	GaimAccount *account;
-	gchar *text;
-	GtkWidget *button;
+	gchar *text, *filename;
+	GtkWidget *button, *label, *image, *hbox;
+	GdkPixbuf *pixbuf, *emblem, *scale;
 
 	account = key;
-	text = value;
+	text = g_strdup_printf("<span color=\"red\">%s disconnected: %s</span>",
+	                       gaim_account_get_username(account),
+	                       (gchar *)value);
 
 	/*
 	 * TODO: The text needs to be bold and red.  And it would probably
@@ -3499,12 +3503,55 @@
 	 *       It should be the PRPL icon overlayed with something that
 	 *       will signal to the user that the account had an error.
 	 */
-	button = gtk_button_new_with_label(text);
+	hbox = gtk_hbox_new(FALSE, 0);
+	gtk_widget_show(hbox);
+
+	filename = g_build_filename(DATADIR, "pixmaps", "gaim", "status", "default", "blocked.png", NULL);
+	pixbuf = gdk_pixbuf_new_from_file(filename, NULL);
+	g_free(filename);
+	if (pixbuf != NULL) {
+		scale = gdk_pixbuf_scale_simple(pixbuf, 10, 10,
+		                                GDK_INTERP_BILINEAR);
+		g_object_unref(pixbuf);
+		emblem = scale;
+		scale = NULL;
+	}
+
+	pixbuf = gaim_gtk_create_prpl_icon(account);
+	if (pixbuf != NULL) {
+		scale = gdk_pixbuf_scale_simple(pixbuf, 16, 16,
+		                                GDK_INTERP_BILINEAR);
+		gdk_pixbuf_saturate_and_pixelate(scale, scale, 0.0, FALSE);
+		g_object_unref(G_OBJECT(pixbuf));
+	}
+
+	gdk_pixbuf_composite(emblem, scale, 6, 6, 10, 10, 6, 6, 1, 1,
+	                     GDK_INTERP_BILINEAR, 255);
+	g_object_unref(emblem);
+	image = gtk_image_new_from_pixbuf(scale);
+	g_object_unref(scale);
+	gtk_widget_show(image);
+	gtk_box_pack_start(GTK_BOX(hbox), image, FALSE, FALSE,
+	                   GAIM_HIG_BOX_SPACE);
+
+	label = gtk_label_new("");
+	gtk_label_set_markup(GTK_LABEL(label), text);
+	g_free(text);
+#if GTK_CHECK_VERSION(2,6,0)
+	g_object_set(label, "ellipsize", PANGO_ELLIPSIZE_END, NULL);
+#endif
+	gtk_widget_show(label);
+	gtk_box_pack_start(GTK_BOX(hbox), label, TRUE, TRUE,
+	                   GAIM_HIG_BOX_SPACE);
+
+	button = gtk_button_new();
+	gtk_container_add(GTK_CONTAINER(button), hbox);
 	g_signal_connect(G_OBJECT(button), "clicked",
-					 G_CALLBACK(connection_error_button_clicked_cb),
-					 account);
+	                 G_CALLBACK(connection_error_button_clicked_cb),
+	                 account);
 	gtk_widget_show(button);
-	gtk_box_pack_end(GTK_BOX(gtkblist->error_buttons), button, FALSE, FALSE, 0);
+	gtk_box_pack_end(GTK_BOX(gtkblist->error_buttons), button,
+	                 FALSE, FALSE, 0);
 }
 
 void