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. James "Doc" Livingston -- I think I've finally worked out why the Irish drink Guinness. It's to lubricate their throat so they can speak their own language. -- David P.
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 06:44:01 -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, @@ -153,6 +154,7 @@ GHashTable *reverse_map; RhythmDBPropertyModelEntry *all; + gboolean updating_all; gboolean complete; }; @@ -452,6 +454,8 @@ { RhythmDBEntry *entry = entry_from_tree_iter (model, iter); rhythmdb_property_model_insert (propmodel, entry); + + rhythmdb_property_model_sync (propmodel); } static void @@ -465,6 +469,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 +479,8 @@ RhythmDBPropertyModel *propmodel) { rhythmdb_property_model_delete (propmodel, entry); + + rhythmdb_property_model_sync (propmodel); } static gint @@ -1006,3 +1014,32 @@ targets, n_elements, GDK_ACTION_COPY); } + +static gboolean +rhythmdb_property_model_sync_all (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); + + return FALSE; +} + +static void +rhythmdb_property_model_sync (RhythmDBPropertyModel *model) +{ + if (!model->priv->updating_all) { + model->priv->updating_all = TRUE; + g_idle_add ((GSourceFunc) rhythmdb_property_model_sync_all, model); + } +} +
Attachment:
signature.asc
Description: This is a digitally signed message part