--- widgets/rb-query-creator.c-orig	2004-11-18 01:58:20.000000000 -0800
+++ widgets/rb-query-creator.c	2004-11-18 03:04:46.000000000 -0800
@@ -54,7 +54,8 @@
 	{ N_("Artist"), RHYTHMDB_PROP_ARTIST, RHYTHMDB_PROP_ARTIST_FOLDED },
 	{ N_("Album"), RHYTHMDB_PROP_ALBUM, RHYTHMDB_PROP_ALBUM_FOLDED },
 	{ N_("Genre"), RHYTHMDB_PROP_GENRE, RHYTHMDB_PROP_GENRE_FOLDED },
-	{ N_("Rating"), RHYTHMDB_PROP_RATING, RHYTHMDB_PROP_RATING }
+	{ N_("Rating"), RHYTHMDB_PROP_RATING, RHYTHMDB_PROP_RATING },
+	{ N_("Play Count"), RHYTHMDB_PROP_PLAY_COUNT, RHYTHMDB_PROP_PLAY_COUNT }
 };
 
 const RBQueryCreatorCriteriaOption string_criteria_options[] =
@@ -419,10 +420,14 @@
 					    GTK_WIDGET (criteria_menu), data->propid,
 					    data->type);
 
-		if (data->propid != RHYTHMDB_PROP_RATING) {
+		if (data->propid != RHYTHMDB_PROP_RATING && data->propid != RHYTHMDB_PROP_PLAY_COUNT) {
 			GtkEntry *text = GTK_ENTRY (get_box_widget_at_pos (GTK_BOX (rows->data), 2));
 			
 			gtk_entry_set_text (text, g_value_get_string (data->val));
+		} else if (data->propid == RHYTHMDB_PROP_PLAY_COUNT) {
+			GtkSpinButton *spin = GTK_SPIN_BUTTON (get_box_widget_at_pos (GTK_BOX (rows->data), 2));
+
+			gtk_spin_button_set_value(spin, g_value_get_int (data->val));
 		} else {
 			RBRating *rating = RB_RATING (get_box_widget_at_pos (GTK_BOX (rows->data), 2));
 			g_object_set (G_OBJECT (rating), "score",
@@ -500,7 +505,7 @@
 		options = string_criteria_options;
 		if (length)
 			*length = G_N_ELEMENTS (string_criteria_options);
-	} else if (proptype == G_TYPE_DOUBLE) {
+	} else if (proptype == G_TYPE_DOUBLE || proptype == G_TYPE_INT) {
 		options = numeric_criteria_options;
 		if (length)
 			*length = G_N_ELEMENTS (numeric_criteria_options);
@@ -532,6 +537,8 @@
 					 G_CALLBACK (set_rating_score), NULL, 0);
 		*constrain = FALSE;
 		return GTK_WIDGET (rating);
+	} else if (prop == RHYTHMDB_PROP_PLAY_COUNT) {
+		return gtk_spin_button_new_with_range(0, G_MAXDOUBLE, 1);
 	} else
 		g_assert_not_reached ();
 	return NULL;
@@ -575,7 +582,7 @@
 		RhythmDBQueryType criteria = criteria_option->val;
 		RhythmDBPropType prop = criteria_option->strict ? prop_option->strict_val : prop_option->fuzzy_val;
 
-		if (prop != RHYTHMDB_PROP_RATING) {
+		if (prop != RHYTHMDB_PROP_RATING && prop != RHYTHMDB_PROP_PLAY_COUNT) {
 			GtkEntry *text = GTK_ENTRY (get_box_widget_at_pos (GTK_BOX (row->data), 2));
 			const char *data = gtk_entry_get_text (GTK_ENTRY (text));
 			char *folded_data = criteria_option->strict ? g_strdup (data) : g_utf8_casefold (data, -1);
@@ -596,6 +603,25 @@
 						       folded_data,
 						       RHYTHMDB_QUERY_END);
 			g_free (folded_data);
+		} else if (prop == RHYTHMDB_PROP_PLAY_COUNT) {
+			GtkSpinButton *spin = GTK_SPIN_BUTTON (get_box_widget_at_pos (GTK_BOX (row->data), 2));
+			const int data = gtk_spin_button_get_value_as_int (spin);
+
+			if (disjunction && row->next)
+				rhythmdb_query_append (dlg->priv->db,
+							sub_query,
+							criteria,
+							prop,
+							data,
+							RHYTHMDB_QUERY_DISJUNCTION,
+							RHYTHMDB_QUERY_END);
+			else
+				rhythmdb_query_append (dlg->priv->db,
+							sub_query,
+							criteria,
+							prop,
+							data,
+							RHYTHMDB_QUERY_END);
 		} else {
 			double rating;
 
