[gaim-migrate @ 14047]

Sun, 23 Oct 2005 17:12:52 +0000

author
Stu Tomlinson <nosnilmot@pidgin.im>
date
Sun, 23 Oct 2005 17:12:52 +0000
changeset 11756
c1b8045e540a
parent 11755
3b1b0ff3c22e
child 11757
96456b26dc43

[gaim-migrate @ 14047]
So. This fixes the status box on Gtk 2.2. Honestly, I'm not sure why or how.

It appears that trying to use the status box itself as the widget to pass to
gtk_widget_render_icon() causes things to get horribly confused or corrupted,
with some very bizarre side effects that I never really managed to debug. (I
assume it's somehow related to the fact that this code is all being called
from within the status box's own init function).
So I just used the status box's vbox instead, and bingo, it no longer lists
"Available" a billion times in the dropdown.

I've been trying to nail this issue on and off since the day the status box
landed in CVS. I'm pleased to have it working now, but also annoyed it took
so long and isn't really understandable.

I wonder how much is broken on Gtk 2.0 now?

src/gtkstatusbox.c file | annotate | diff | comparison | revisions
--- a/src/gtkstatusbox.c	Sun Oct 23 16:28:31 2005 +0000
+++ b/src/gtkstatusbox.c	Sun Oct 23 17:12:52 2005 +0000
@@ -275,13 +275,13 @@
 	account = GTK_GAIM_STATUS_BOX(status_box)->account;
 	if (account == NULL)
 	{
-		pixbuf = gtk_widget_render_icon (GTK_WIDGET(status_box), GAIM_STOCK_STATUS_ONLINE,
+		pixbuf = gtk_widget_render_icon (GTK_WIDGET(status_box->vbox), GAIM_STOCK_STATUS_ONLINE,
 		                                 icon_size, "GtkGaimStatusBox");
-		pixbuf2 = gtk_widget_render_icon (GTK_WIDGET(status_box), GAIM_STOCK_STATUS_AWAY,
+		pixbuf2 = gtk_widget_render_icon (GTK_WIDGET(status_box->vbox), GAIM_STOCK_STATUS_AWAY,
 		                                  icon_size, "GtkGaimStatusBox");
-		pixbuf3 = gtk_widget_render_icon (GTK_WIDGET(status_box), GAIM_STOCK_STATUS_OFFLINE,
+		pixbuf3 = gtk_widget_render_icon (GTK_WIDGET(status_box->vbox), GAIM_STOCK_STATUS_OFFLINE,
 		                                  icon_size, "GtkGaimStatusBox");
-		pixbuf4 = gtk_widget_render_icon (GTK_WIDGET(status_box), GAIM_STOCK_STATUS_INVISIBLE,
+		pixbuf4 = gtk_widget_render_icon (GTK_WIDGET(status_box->vbox), GAIM_STOCK_STATUS_INVISIBLE,
 		                                  icon_size, "GtkGaimStatusBox");
 		/* hacks */
 		gtk_gaim_status_box_add(GTK_GAIM_STATUS_BOX(status_box), GAIM_STATUS_AVAILABLE, pixbuf, _("Available"), NULL);
@@ -389,27 +389,6 @@
 	icon_size = gtk_icon_size_from_name(GAIM_ICON_SIZE_STATUS);
 
 	status_box->imhtml_visible = FALSE;
-	status_box->error_pixbuf = gtk_widget_render_icon (GTK_WIDGET(status_box), GAIM_STOCK_STATUS_OFFLINE,
-							   icon_size, "GtkGaimStatusBox");
-	status_box->connecting_index = 0;
-	status_box->connecting_pixbufs[0] = gtk_widget_render_icon (GTK_WIDGET(status_box), GAIM_STOCK_STATUS_CONNECT0,
-								     icon_size, "GtkGaimStatusBox");
-	status_box->connecting_pixbufs[1] = gtk_widget_render_icon (GTK_WIDGET(status_box), GAIM_STOCK_STATUS_CONNECT1,
-								     icon_size, "GtkGaimStatusBox");
-	status_box->connecting_pixbufs[2] = gtk_widget_render_icon (GTK_WIDGET(status_box), GAIM_STOCK_STATUS_CONNECT2,
-								     icon_size, "GtkGaimStatusBox");
-	status_box->connecting_pixbufs[3] = gtk_widget_render_icon (GTK_WIDGET(status_box), GAIM_STOCK_STATUS_CONNECT3,
-								     icon_size, "GtkGaimStatusBox");
-
-	status_box->typing_index = 0;
-	status_box->typing_pixbufs[0] =  gtk_widget_render_icon (GTK_WIDGET(status_box), GAIM_STOCK_STATUS_TYPING0,
-								     icon_size, "GtkGaimStatusBox");
-	status_box->typing_pixbufs[1] =  gtk_widget_render_icon (GTK_WIDGET(status_box), GAIM_STOCK_STATUS_TYPING1,
-								     icon_size, "GtkGaimStatusBox");
-	status_box->typing_pixbufs[2] =  gtk_widget_render_icon (GTK_WIDGET(status_box), GAIM_STOCK_STATUS_TYPING2,
-								     icon_size, "GtkGaimStatusBox");
-	status_box->typing_pixbufs[3] =  gtk_widget_render_icon (GTK_WIDGET(status_box), GAIM_STOCK_STATUS_TYPING3,
-								     icon_size, "GtkGaimStatusBox");
 	status_box->connecting = FALSE;
 	status_box->typing = FALSE;
 	status_box->title = NULL;
@@ -458,6 +437,28 @@
 	gtk_container_add(GTK_CONTAINER(status_box->sw), status_box->imhtml);
 	gtk_box_pack_start(GTK_BOX(status_box->vbox), status_box->sw, TRUE, TRUE, 0);
 
+	status_box->error_pixbuf = gtk_widget_render_icon (GTK_WIDGET(status_box->vbox), GAIM_STOCK_STATUS_OFFLINE,
+							   icon_size, "GtkGaimStatusBox");
+	status_box->connecting_index = 0;
+	status_box->connecting_pixbufs[0] = gtk_widget_render_icon (GTK_WIDGET(status_box->vbox), GAIM_STOCK_STATUS_CONNECT0,
+								     icon_size, "GtkGaimStatusBox");
+	status_box->connecting_pixbufs[1] = gtk_widget_render_icon (GTK_WIDGET(status_box->vbox), GAIM_STOCK_STATUS_CONNECT1,
+								     icon_size, "GtkGaimStatusBox");
+	status_box->connecting_pixbufs[2] = gtk_widget_render_icon (GTK_WIDGET(status_box->vbox), GAIM_STOCK_STATUS_CONNECT2,
+								     icon_size, "GtkGaimStatusBox");
+	status_box->connecting_pixbufs[3] = gtk_widget_render_icon (GTK_WIDGET(status_box->vbox), GAIM_STOCK_STATUS_CONNECT3,
+								     icon_size, "GtkGaimStatusBox");
+
+	status_box->typing_index = 0;
+	status_box->typing_pixbufs[0] =  gtk_widget_render_icon (GTK_WIDGET(status_box->vbox), GAIM_STOCK_STATUS_TYPING0,
+								     icon_size, "GtkGaimStatusBox");
+	status_box->typing_pixbufs[1] =  gtk_widget_render_icon (GTK_WIDGET(status_box->vbox), GAIM_STOCK_STATUS_TYPING1,
+								     icon_size, "GtkGaimStatusBox");
+	status_box->typing_pixbufs[2] =  gtk_widget_render_icon (GTK_WIDGET(status_box->vbox), GAIM_STOCK_STATUS_TYPING2,
+								     icon_size, "GtkGaimStatusBox");
+	status_box->typing_pixbufs[3] =  gtk_widget_render_icon (GTK_WIDGET(status_box->vbox), GAIM_STOCK_STATUS_TYPING3,
+								     icon_size, "GtkGaimStatusBox");
+
 	gtk_gaim_status_box_regenerate(status_box);
 }
 
@@ -573,12 +574,16 @@
 void
 gtk_gaim_status_box_add_separator(GtkGaimStatusBox *status_box)
 {
+	/* Don't do anything unless GTK actually supports
+	 * gtk_combo_box_set_row_separator_func */
+#if GTK_CHECK_VERSION(2,6,0)
 	GtkTreeIter iter;
 
 	gtk_list_store_append(status_box->dropdown_store, &iter);
 	gtk_list_store_set(status_box->dropdown_store, &iter,
 			   TYPE_COLUMN, GTK_GAIM_STATUS_BOX_TYPE_SEPARATOR,
 			   -1);
+#endif
 }
 
 void

mercurial