sadrul.gtkblist-theme: e8add39c: Use stock id everywhere!

sadrul at pidgin.im sadrul at pidgin.im
Wed Apr 22 23:55:41 EDT 2009


-----------------------------------------------------------------
Revision: e8add39c45fc2af07e37471d3a537eb2295a7543
Ancestor: c13af148b1fd91aad82d8b6caa8b663e677aef1a
Author: sadrul at pidgin.im
Date: 2009-04-23T03:55:35
Branch: im.pidgin.sadrul.gtkblist-theme
URL: http://d.pidgin.im/viewmtn/revision/info/e8add39c45fc2af07e37471d3a537eb2295a7543

Modified files:
        pidgin/gtkstatusbox.c

ChangeLog: 

Use stock id everywhere!

-------------- next part --------------
============================================================
--- pidgin/gtkstatusbox.c	789d4bfb65780efa9ef08ec4a431d36aa99a19b5
+++ pidgin/gtkstatusbox.c	e5ca2e38c4b9197a3dd884a337647e671f13f693
@@ -602,32 +602,6 @@ pidgin_status_box_class_init (PidginStat
 	                               );
 }
 
-static GdkPixbuf *
-pidgin_status_box_get_pixbuf(PidginStatusBox *status_box, PurpleStatusPrimitive prim)
-{
-	GdkPixbuf *pixbuf;
-	GtkIconSize icon_size = gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL);
-	if (prim == PURPLE_STATUS_UNAVAILABLE)
-		pixbuf = gtk_widget_render_icon (GTK_WIDGET(status_box), PIDGIN_STOCK_STATUS_BUSY,
-						 icon_size, "PidginStatusBox");
-	else if (prim == PURPLE_STATUS_AWAY)
-		pixbuf = gtk_widget_render_icon (GTK_WIDGET(status_box), PIDGIN_STOCK_STATUS_AWAY,
-						 icon_size, "PidginStatusBox");
-	else if (prim == PURPLE_STATUS_EXTENDED_AWAY)
-		pixbuf = gtk_widget_render_icon (GTK_WIDGET(status_box), PIDGIN_STOCK_STATUS_XA,
-						 icon_size, "PidginStatusBox");
-	else if (prim == PURPLE_STATUS_INVISIBLE)
-		pixbuf = gtk_widget_render_icon (GTK_WIDGET(status_box), PIDGIN_STOCK_STATUS_INVISIBLE,
-						 icon_size, "PidginStatusBox");
-	else if (prim == PURPLE_STATUS_OFFLINE)
-		pixbuf = gtk_widget_render_icon (GTK_WIDGET(status_box), PIDGIN_STOCK_STATUS_OFFLINE,
-						 icon_size, "PidginStatusBox");
-	else
-		pixbuf = gtk_widget_render_icon (GTK_WIDGET(status_box), PIDGIN_STOCK_STATUS_AVAILABLE,
-						 icon_size, "PidginStatusBox");
-	return pixbuf;
-}
-
 /**
  * This updates the text displayed on the status box so that it shows
  * the current status.  This is the only function in this file that
@@ -948,7 +922,6 @@ add_popular_statuses(PidginStatusBox *st
 add_popular_statuses(PidginStatusBox *statusbox)
 {
 	GList *list, *cur;
-	GdkPixbuf *pixbuf;
 
 	list = purple_savedstatuses_get_popular(6);
 	if (list == NULL)
@@ -969,8 +942,6 @@ add_popular_statuses(PidginStatusBox *st
 		prim = purple_savedstatus_get_type(saved);
 
 
-		pixbuf = pidgin_status_box_get_pixbuf(statusbox, prim);
-
 		if (purple_savedstatus_is_transient(saved))
 		{
 			/*
@@ -991,11 +962,9 @@ add_popular_statuses(PidginStatusBox *st
 		}
 
 		pidgin_status_box_add(statusbox, type,
-				pixbuf, purple_savedstatus_get_title(saved), stripped,
+				NULL, purple_savedstatus_get_title(saved), stripped,
 				GINT_TO_POINTER(purple_savedstatus_get_creation_time(saved)));
 		g_free(stripped);
-		if (pixbuf != NULL)
-			g_object_unref(G_OBJECT(pixbuf));
 	}
 
 	g_list_free(list);
@@ -2184,29 +2153,40 @@ pidgin_status_box_add(PidginStatusBox *s
 	}
 
 	if (!pixbuf) {
+		PurpleStatusPrimitive prim = PURPLE_STATUS_UNSET;
 		if (type == PIDGIN_STATUS_BOX_TYPE_PRIMITIVE) {
-			PurpleStatusPrimitive prim = GPOINTER_TO_INT(data);
-			switch (prim) {
-				case PURPLE_STATUS_UNAVAILABLE:
-					stock = PIDGIN_STOCK_STATUS_BUSY;
-					break;
-				case PURPLE_STATUS_AWAY:
-					stock = PIDGIN_STOCK_STATUS_AWAY;
-					break;
-				case PURPLE_STATUS_EXTENDED_AWAY:
-					stock = PIDGIN_STOCK_STATUS_XA;
-					break;
-				case PURPLE_STATUS_INVISIBLE:
-					stock = PIDGIN_STOCK_STATUS_INVISIBLE;
-					break;
-				case PURPLE_STATUS_OFFLINE:
-					stock = PIDGIN_STOCK_STATUS_OFFLINE;
-					break;
-				default:
-					stock = PIDGIN_STOCK_STATUS_AVAILABLE;
-					break;
+			prim = GPOINTER_TO_INT(data);
+		} else if (type == PIDGIN_STATUS_BOX_TYPE_SAVED_POPULAR ||
+				type == PIDGIN_STATUS_BOX_TYPE_POPULAR) {
+			PurpleSavedStatus *saved = purple_savedstatus_find_by_creation_time(GPOINTER_TO_INT(data));
+			if (saved) {
+				prim = purple_savedstatus_get_type(saved);
 			}
 		}
+
+		switch (prim) {
+			case PURPLE_STATUS_UNSET:
+				stock = NULL;
+				break;
+			case PURPLE_STATUS_UNAVAILABLE:
+				stock = PIDGIN_STOCK_STATUS_BUSY;
+				break;
+			case PURPLE_STATUS_AWAY:
+				stock = PIDGIN_STOCK_STATUS_AWAY;
+				break;
+			case PURPLE_STATUS_EXTENDED_AWAY:
+				stock = PIDGIN_STOCK_STATUS_XA;
+				break;
+			case PURPLE_STATUS_INVISIBLE:
+				stock = PIDGIN_STOCK_STATUS_INVISIBLE;
+				break;
+			case PURPLE_STATUS_OFFLINE:
+				stock = PIDGIN_STOCK_STATUS_OFFLINE;
+				break;
+			default:
+				stock = PIDGIN_STOCK_STATUS_AVAILABLE;
+				break;
+		}
 	}
 
 	gtk_list_store_append(status_box->dropdown_store, &iter);


More information about the Commits mailing list