gcr: Fix logic issue in collection model
authorStef Walter <stefw@collabora.co.uk>
Thu, 12 May 2011 08:23:32 +0000 (10:23 +0200)
committerStef Walter <stefw@collabora.co.uk>
Fri, 13 May 2011 18:40:20 +0000 (20:40 +0200)
 * Was refering to the wrong column.

gcr/gcr-collection-model.c

index 3dcb8a4..1762fac 100644 (file)
@@ -93,12 +93,6 @@ G_DEFINE_TYPE_WITH_CODE (GcrCollectionModel, gcr_collection_model, G_TYPE_OBJECT
 
 #define UNUSED_VALUE GINT_TO_POINTER (1)
 
-static gboolean
-column_id_is_valid_and_real (GcrCollectionModel *self, gint column_id)
-{
-       return (column_id >= 0 && column_id < self->pv->n_columns);
-}
-
 static gint
 on_sequence_compare (gconstpointer a, gconstpointer b, gpointer user_data)
 {
@@ -168,19 +162,21 @@ on_object_notify (GObject *object, GParamSpec *spec, GcrCollectionModel *self)
 {
        GtkTreeIter iter;
        GtkTreePath *path;
+       gboolean found = FALSE;
        guint i;
 
        g_return_if_fail (spec->name);
 
-       for (i = 0; i < self->pv->n_columns; ++i) {
+       for (i = 0; i < self->pv->n_columns - 1; ++i) {
                g_assert (self->pv->columns[i].property_name);
                if (g_str_equal (self->pv->columns[i].property_name, spec->name)) {
+                       found = TRUE;
                        break;
                }
        }
 
        /* Tell the tree view that this row changed */
-       if (column_id_is_valid_and_real (self, i)) {
+       if (found) {
                if (!gcr_collection_model_iter_for_object (self, object, &iter))
                        g_return_if_reached ();
                path = gtk_tree_model_get_path (GTK_TREE_MODEL (self), &iter);