cpw.qulogic.gtk3: 9d8f789a: Add an enumeration to replace a couple h...

qulogic at pidgin.im qulogic at pidgin.im
Fri Apr 10 03:35:53 EDT 2009


-----------------------------------------------------------------
Revision: 9d8f789a57f4477db7d3cfbb9752b7842ff790dd
Ancestor: 15d194c0d60b90674d98a484912c279deb08fe6e
Author: qulogic at pidgin.im
Date: 2009-04-10T05:00:13
Branch: im.pidgin.cpw.qulogic.gtk3
URL: http://d.pidgin.im/viewmtn/revision/info/9d8f789a57f4477db7d3cfbb9752b7842ff790dd

Modified files:
        pidgin/gtksavedstatuses.c

ChangeLog: 

Add an enumeration to replace a couple hardcoded numbers in the combo box
code for saved statuses.

-------------- next part --------------
============================================================
--- pidgin/gtksavedstatuses.c	2cc68b1023ead8a745014ea0f67b8dbffa80e95f
+++ pidgin/gtksavedstatuses.c	3546f0d12682507404f08e1b45031f5c1dc728a1
@@ -899,6 +899,12 @@ editor_title_changed_cb(GtkWidget *widge
 
 #if GTK_CHECK_VERSION(2,4,0)
 
+enum {
+	STATUS_MENU_STOCK_ICON,
+	STATUS_MENU_NAME,
+	STATUS_MENU_COUNT
+};
+
 static GtkWidget *
 create_status_type_menu(PurpleStatusPrimitive type)
 {
@@ -908,7 +914,7 @@ create_status_type_menu(PurpleStatusPrim
 	GtkTreeIter iter;
 	GtkCellRenderer *renderer;
 
-	store = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_STRING);
+	store = gtk_list_store_new(STATUS_MENU_COUNT, G_TYPE_STRING, G_TYPE_STRING);
 
 	for (i = PURPLE_STATUS_UNSET + 1; i < PURPLE_STATUS_NUM_PRIMITIVES; i++)
 	{
@@ -922,8 +928,8 @@ create_status_type_menu(PurpleStatusPrim
 		gtk_list_store_append(store, &iter);
 		/* TODO: how's this get the right size (since it seems to work fine)? */
 		gtk_list_store_set(store, &iter,
-		                   0, get_stock_icon_from_primitive(i),
-		                   1, purple_primitive_get_name_from_type(i),
+		                   STATUS_MENU_STOCK_ICON, get_stock_icon_from_primitive(i),
+		                   STATUS_MENU_NAME, purple_primitive_get_name_from_type(i),
 		                   -1);
 	}
 
@@ -932,13 +938,13 @@ create_status_type_menu(PurpleStatusPrim
 	renderer = gtk_cell_renderer_pixbuf_new();
 	gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(dropdown), renderer, FALSE);
 	gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(dropdown), renderer,
-	                               "stock-id", 0,
+	                               "stock-id", STATUS_MENU_STOCK_ICON,
 	                               NULL);
 
 	renderer = gtk_cell_renderer_text_new();
 	gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(dropdown), renderer, TRUE);
 	gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(dropdown), renderer,
-	                               "text", 1,
+	                               "text", STATUS_MENU_NAME,
 	                               NULL);
 
 	gtk_combo_box_set_active(GTK_COMBO_BOX(dropdown),


More information about the Commits mailing list