Re: [Rhythmbox-devel] Genre, Artist, Album totals



On Sat, 2005-11-05 at 17:46 +1100, James Livingston wrote:
> On Thu, 2005-11-03 at 15:09 -0600, Dustin Miller wrote:
> > In iTunes it lists the total number of genres, artists, and albums
> > next to their respective browse sections, can this be added?
> 
> This is fairly trivial to add, and a patch is attached.

Or try this patch, which doesn't crash if you sort too often.


Cheers,

James "Doc" Livingston
-- 
History books in Ireland and Scotland are littered with the 'wrong'
spelling, and there is no law that tells you how to spell whisky. The
Welsh even spell it 'chwisgi', which makes sense after two or three
large ones.
Index: rhythmdb/rhythmdb-property-model.c
===================================================================
RCS file: /cvs/gnome/rhythmbox/rhythmdb/rhythmdb-property-model.c,v
retrieving revision 1.22
diff -u -u -r1.22 rhythmdb-property-model.c
--- rhythmdb/rhythmdb-property-model.c	20 Oct 2005 16:42:16 -0000	1.22
+++ rhythmdb/rhythmdb-property-model.c	5 Nov 2005 07:07:33 -0000
@@ -48,6 +48,7 @@
 					       guint prop_id,
 					       GValue *value,
 					       GParamSpec *pspec);
+static void rhythmdb_property_model_sync (RhythmDBPropertyModel *model);
 static void rhythmdb_property_model_row_inserted_cb (GtkTreeModel *model,
 						     GtkTreePath *path,
 						     GtkTreeIter *iter,
@@ -452,6 +453,8 @@
 {
 	RhythmDBEntry *entry = entry_from_tree_iter (model, iter);
 	rhythmdb_property_model_insert (propmodel, entry);
+
+	rhythmdb_property_model_sync (propmodel);
 }
 
 static void
@@ -465,6 +468,8 @@
 
 	rhythmdb_property_model_delete_prop (propmodel, g_value_get_string (old));
 	rhythmdb_property_model_insert (propmodel, entry);
+
+	rhythmdb_property_model_sync (propmodel);
 }
 
 static void
@@ -473,6 +478,8 @@
 					  RhythmDBPropertyModel *propmodel)
 {
 	rhythmdb_property_model_delete (propmodel, entry);
+
+	rhythmdb_property_model_sync (propmodel);
 }
 
 static gint
@@ -1006,3 +1013,21 @@
 					     targets, n_elements,
 					     GDK_ACTION_COPY);
 }
+
+static void
+rhythmdb_property_model_sync (RhythmDBPropertyModel *model)
+{
+	int count = g_sequence_get_length (model->priv->properties);
+	GtkTreeIter iter;
+	GtkTreePath *path;
+
+	g_free (model->priv->all->name);
+	model->priv->all->name = g_strdup_printf (_("All (%d)"), count);
+
+	iter.stamp = model->priv->stamp;
+	iter.user_data = model->priv->all;
+	path = rhythmdb_property_model_get_path (GTK_TREE_MODEL (model), &iter);
+	gtk_tree_model_row_changed (GTK_TREE_MODEL (model), path, &iter);
+	gtk_tree_path_free (path);
+}
+

Attachment: signature.asc
Description: This is a digitally signed message part



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]