[gnome-keyring] gcr: Fix logic issue in collection model



commit 929d0a377217e139574817d5c004312b40da5cc9
Author: Stef Walter <stefw collabora co uk>
Date:   Thu May 12 10:23:32 2011 +0200

    gcr: Fix logic issue in collection model
    
     * Was refering to the wrong column.

 gcr/gcr-collection-model.c |   12 ++++--------
 1 files changed, 4 insertions(+), 8 deletions(-)
---
diff --git a/gcr/gcr-collection-model.c b/gcr/gcr-collection-model.c
index 3dcb8a4..1762fac 100644
--- a/gcr/gcr-collection-model.c
+++ b/gcr/gcr-collection-model.c
@@ -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);



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