[seahorse/refactor: 2/37] Use GcrCollectionModel instead of our own GtkTreeModel implementation.



commit efef15901be0b7541b552001caad485451946562
Author: Stef Walter <stefw collabora co uk>
Date:   Mon Sep 5 12:59:59 2011 +0200

    Use GcrCollectionModel instead of our own GtkTreeModel implementation.
    
     * More maintained code base and easier to integrate objects
       from gcr.
     * EAsier to format coluns how we want them without changing
       the underlying objects.
     * Split out SeahorsePredicate into its own header in preparation
       for later work.

 configure.ac                         |    9 +-
 gkr/seahorse-gkr-item-commands.c     |    2 +-
 gkr/seahorse-gkr-keyring-commands.c  |    2 +-
 gkr/seahorse-gkr-keyring.c           |    5 +-
 gkr/seahorse-gkr-source.c            |    9 +-
 libseahorse/Makefile.am              |    6 +-
 libseahorse/seahorse-collection.c    |  329 +++++++++++++
 libseahorse/seahorse-collection.h    |   64 +++
 libseahorse/seahorse-combo-keys.c    |  262 ++++++------
 libseahorse/seahorse-combo-keys.h    |    4 +-
 libseahorse/seahorse-context.c       |   22 +-
 libseahorse/seahorse-context.h       |    6 +-
 libseahorse/seahorse-object.c        |   31 +-
 libseahorse/seahorse-object.h        |   22 -
 libseahorse/seahorse-predicate.h     |   56 +++
 libseahorse/seahorse-set-model.c     |  840 ----------------------------------
 libseahorse/seahorse-set-model.h     |   82 ----
 libseahorse/seahorse-set.c           |  336 --------------
 libseahorse/seahorse-set.h           |  109 -----
 libseahorse/seahorse-view.c          |   12 +-
 libseahorse/seahorse-view.h          |   14 +-
 pgp/seahorse-gpgme-key.c             |    8 +-
 pgp/seahorse-gpgme-sign.c            |   31 +-
 pgp/seahorse-pgp-commands.c          |    4 +-
 pgp/seahorse-pgp-key-properties.c    |    2 +-
 pgp/seahorse-pgp-key.c               |   55 ---
 pgp/seahorse-pgp-key.h               |    6 -
 pgp/seahorse-pgp-keysets.c           |   40 +-
 pgp/seahorse-pgp-keysets.h           |    4 +-
 pgp/seahorse-pgp-uid.c               |   15 -
 pgp/seahorse-pgp-uid.h               |    3 -
 pgp/seahorse-signer.c                |   16 +-
 pkcs11/Makefile.am                   |    2 -
 pkcs11/seahorse-pkcs11-certificate.c |   61 +---
 pkcs11/seahorse-pkcs11-certificate.h |    6 -
 pkcs11/seahorse-pkcs11-commands.c    |    2 +-
 pkcs11/seahorse-pkcs11-operations.c  |    1 -
 src/seahorse-key-manager-store.c     |  619 ++++++++++++--------------
 src/seahorse-key-manager-store.h     |   18 +-
 src/seahorse-key-manager.c           |   30 +-
 src/seahorse-keyserver-results.c     |   18 +-
 src/seahorse-viewer.c                |   52 ++-
 src/seahorse-viewer.h                |    5 +-
 ssh/seahorse-ssh-commands.c          |    2 +-
 44 files changed, 1054 insertions(+), 2168 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 4892ce6..b086f13 100644
--- a/configure.ac
+++ b/configure.ac
@@ -40,7 +40,8 @@ PKG_CHECK_MODULES(GTK, gtk+-3.0 >= $GTK_REQUIRED)
 AC_SUBST(GTK_CFLAGS)
 AC_SUBST(GTK_LIBS)
 
-PKG_CHECK_MODULES(SEAHORSE, gmodule-2.0 gio-2.0 gthread-2.0 gtk+-3.0 >= $GTK_REQUIRED)
+PKG_CHECK_MODULES(SEAHORSE, gmodule-2.0 gio-2.0 gthread-2.0 gtk+-3.0 >= $GTK_REQUIRED gcr-3 >= $GCR_REQUIRED)
+SEAHORSE_CFLAGS="$SEAHORSE_CFLAGS -DGCR_API_SUBJECT_TO_CHANGE -DGCK_API_SUBJECT_TO_CHANGE"
 
 GLIB_GSETTINGS
 
@@ -384,12 +385,8 @@ if test "$enable_pkcs11" = "no"; then
 	echo "disabling pkcs11 support"
 	enable_pkcs11="no"
 else
-	PKG_CHECK_MODULES(GCR, gcr-3 >= $GCR_REQUIRED, gcr_is_present="yes", gcr_is_present="no")
-	if test "$gcr_is_present" = "no"; then
-		echo "disabling pkcs11 support"
-	fi
 	PKG_CHECK_MODULES(GCK, gck-1 >= 3.1.2, enable_pkcs11="yes", enable_pkcs11="no")
-	if test "$enable_pkcs11" = "yes" && test "$gcr_is_present" = "yes"; then
+	if test "$enable_pkcs11" = "yes"; then
 		AC_DEFINE(WITH_PKCS11, 1, [gck library available])
 		SEAHORSE_CFLAGS="$SEAHORSE_CFLAGS $GCK_CFLAGS $GCR_CFLAGS"
 		SEAHORSE_LIBS="$SEAHORSE_LIBS $GCK_LIBS $GCR_LIBS"
diff --git a/gkr/seahorse-gkr-item-commands.c b/gkr/seahorse-gkr-item-commands.c
index 93d6983..2a7ad1b 100644
--- a/gkr/seahorse-gkr-item-commands.c
+++ b/gkr/seahorse-gkr-item-commands.c
@@ -38,7 +38,7 @@
 
 G_DEFINE_TYPE (SeahorseGkrItemCommands, seahorse_gkr_item_commands, SEAHORSE_TYPE_COMMANDS);
 
-static SeahorseObjectPredicate commands_predicate = { 0, };
+static SeahorsePredicate commands_predicate = { 0, };
 
 /* -----------------------------------------------------------------------------
  * INTERNAL 
diff --git a/gkr/seahorse-gkr-keyring-commands.c b/gkr/seahorse-gkr-keyring-commands.c
index e023676..a92f4c9 100644
--- a/gkr/seahorse-gkr-keyring-commands.c
+++ b/gkr/seahorse-gkr-keyring-commands.c
@@ -55,7 +55,7 @@ static const char* UI_KEYRING = ""\
 "	</popup>"\
 "</ui>";
 
-static SeahorseObjectPredicate keyring_predicate = { 0, };
+static SeahorsePredicate keyring_predicate = { 0, };
 
 static void on_view_selection_changed (SeahorseView *view, gpointer user_data);
 
diff --git a/gkr/seahorse-gkr-keyring.c b/gkr/seahorse-gkr-keyring.c
index a7d365f..d1ddb66 100644
--- a/gkr/seahorse-gkr-keyring.c
+++ b/gkr/seahorse-gkr-keyring.c
@@ -26,6 +26,7 @@
 #include "seahorse-gkr-keyring.h"
 #include "seahorse-gkr-operation.h"
 
+#include "seahorse-predicate.h"
 #include "seahorse-progress.h"
 #include "seahorse-util.h"
 
@@ -193,7 +194,7 @@ on_keyring_load_list_item_ids (GnomeKeyringResult result,
 {
 	GSimpleAsyncResult *res = G_SIMPLE_ASYNC_RESULT (user_data);
 	keyring_load_closure *closure = g_simple_async_result_get_op_res_gpointer (res);
-	SeahorseObjectPredicate pred;
+	SeahorsePredicate pred;
 	SeahorseGkrItem *git;
 	const gchar *keyring_name;
 	GError *error = NULL;
@@ -214,7 +215,7 @@ on_keyring_load_list_item_ids (GnomeKeyringResult result,
 
 	/* When loading new keys prepare a list of current */
 	checks = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, NULL);
-	seahorse_object_predicate_clear (&pred);
+	seahorse_predicate_clear (&pred);
 	pred.source = SEAHORSE_SOURCE (closure->keyring);
 	pred.type = SEAHORSE_TYPE_GKR_ITEM;
 	seahorse_context_for_objects_full (SCTX_APP (), &pred, insert_id_hashtable, checks);
diff --git a/gkr/seahorse-gkr-source.c b/gkr/seahorse-gkr-source.c
index 1f93d3b..d899465 100644
--- a/gkr/seahorse-gkr-source.c
+++ b/gkr/seahorse-gkr-source.c
@@ -29,6 +29,7 @@
 #include <glib/gi18n.h>
 
 #include "seahorse-passphrase.h"
+#include "seahorse-predicate.h"
 #include "seahorse-progress.h"
 #include "seahorse-registry.h"
 #include "seahorse-secure-memory.h"
@@ -181,7 +182,7 @@ on_source_load_default_keyring (GnomeKeyringResult result,
                                 gpointer user_data)
 {
 	SeahorseGkrSource *self = SEAHORSE_GKR_SOURCE (user_data);
-	SeahorseObjectPredicate pred;
+	SeahorsePredicate pred;
 
 	if (result != GNOME_KEYRING_RESULT_OK) {
 		if (result != GNOME_KEYRING_RESULT_CANCELLED)
@@ -189,7 +190,7 @@ on_source_load_default_keyring (GnomeKeyringResult result,
 		return;
 	}
 
-	seahorse_object_predicate_clear (&pred);
+	seahorse_predicate_clear (&pred);
 	pred.source = SEAHORSE_SOURCE (self);
 	pred.type = SEAHORSE_TYPE_GKR_KEYRING;
 	seahorse_context_for_objects_full (NULL, &pred, update_each_default_keyring, (gpointer)default_name);
@@ -241,7 +242,7 @@ on_source_load_list_keyring_names_complete (GnomeKeyringResult result,
 	GSimpleAsyncResult *res = G_SIMPLE_ASYNC_RESULT (user_data);
 	source_load_closure *closure = g_simple_async_result_get_op_res_gpointer (res);
 	SeahorseGkrKeyring *keyring;
-	SeahorseObjectPredicate pred;
+	SeahorsePredicate pred;
 	GError *error = NULL;
 	gchar *keyring_name;
 	GHashTable *checks;
@@ -257,7 +258,7 @@ on_source_load_list_keyring_names_complete (GnomeKeyringResult result,
 
 	/* Load up a list of all the current names */
 	checks = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref);
-	seahorse_object_predicate_clear (&pred);
+	seahorse_predicate_clear (&pred);
 	pred.source = SEAHORSE_SOURCE (closure->source);
 	pred.type = SEAHORSE_TYPE_GKR_KEYRING;
 	seahorse_context_for_objects_full (NULL, &pred, insert_each_keyring_in_hashtable, checks);
diff --git a/libseahorse/Makefile.am b/libseahorse/Makefile.am
index 421462d..43c2716 100644
--- a/libseahorse/Makefile.am
+++ b/libseahorse/Makefile.am
@@ -29,6 +29,7 @@ endif
 libseahorse_la_SOURCES = \
 	seahorse-bind.c seahorse-bind.h \
 	seahorse-cleanup.c seahorse-cleanup.h \
+	seahorse-collection.c seahorse-collection.h \
 	seahorse-combo-keys.c seahorse-combo-keys.h \
 	seahorse-commands.c seahorse-commands.h \
 	seahorse-context.c seahorse-context.h \
@@ -40,14 +41,13 @@ libseahorse_la_SOURCES = \
 	seahorse-object-model.c seahorse-object-model.h \
 	seahorse-object-widget.c seahorse-object-widget.h \
 	seahorse-passphrase.c seahorse-passphrase.h \
+	seahorse-predicate.h \
 	seahorse-prefs.c seahorse-prefs.h \
 	seahorse-progress.c seahorse-progress.h \
 	seahorse-registry.c seahorse-registry.h \
 	seahorse-secure-memory.c seahorse-secure-memory.h \
 	seahorse-secure-buffer.c seahorse-secure-buffer.h \
 	seahorse-servers.c seahorse-servers.h \
-	seahorse-set.c seahorse-set.h \
-	seahorse-set-model.c seahorse-set-model.h \
 	seahorse-source.c seahorse-source.h \
 	seahorse-transfer.c seahorse-transfer.h \
 	seahorse-types.c seahorse-types.h \
@@ -56,7 +56,7 @@ libseahorse_la_SOURCES = \
 	seahorse-util.c seahorse-util.h \
 	seahorse-validity.c seahorse-validity.h \
 	seahorse-view.c seahorse-view.h \
-	seahorse-widget.c seahorse-widget.h \	
+	seahorse-widget.c seahorse-widget.h \
 	$(MARSHAL_SRCS) \
 	$(KEYSERVER_SRCS)
 
diff --git a/libseahorse/seahorse-collection.c b/libseahorse/seahorse-collection.c
new file mode 100644
index 0000000..457060a
--- /dev/null
+++ b/libseahorse/seahorse-collection.c
@@ -0,0 +1,329 @@
+/*
+ * Seahorse
+ *
+ * Copyright (C) 2005 Stefan Walter
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include "config.h"
+
+#include "seahorse-collection.h"
+#include "seahorse-marshal.h"
+
+enum {
+	PROP_0,
+	PROP_PREDICATE
+};
+
+struct _SeahorseCollectionPrivate {
+	GHashTable *objects;
+	SeahorsePredicate *pred;
+	GDestroyNotify destroy_func;
+};
+
+static void      seahorse_collection_iface_init     (GcrCollectionIface *iface);
+
+G_DEFINE_TYPE_WITH_CODE (SeahorseCollection, seahorse_collection, G_TYPE_OBJECT,
+                         G_IMPLEMENT_INTERFACE (GCR_TYPE_COLLECTION, seahorse_collection_iface_init);
+);
+
+static gboolean
+remove_update (SeahorseObject *object,
+               gpointer unused,
+               SeahorseCollection *self)
+{
+	gcr_collection_emit_removed (GCR_COLLECTION (self), G_OBJECT (object));
+	return TRUE;
+}
+
+static void
+remove_object (gpointer key,
+               gpointer value,
+               gpointer user_data)
+{
+	SeahorseCollection *self = SEAHORSE_COLLECTION (user_data);
+	SeahorseObject *object = SEAHORSE_OBJECT (key);
+	g_hash_table_remove (self->pv->objects, object);
+	remove_update (object, NULL, self);
+}
+
+static gboolean
+maybe_add_object (SeahorseCollection *self,
+                  SeahorseObject *object)
+{
+	if (g_hash_table_lookup (self->pv->objects, object))
+		return FALSE;
+
+	if (!self->pv->pred || !seahorse_predicate_match (self->pv->pred, object))
+		return FALSE;
+
+	g_hash_table_replace (self->pv->objects, object, GINT_TO_POINTER (TRUE));
+	gcr_collection_emit_added (GCR_COLLECTION (self), G_OBJECT (object));
+	return TRUE;
+}
+
+static gboolean
+maybe_remove_object (SeahorseCollection *self,
+                     SeahorseObject *object)
+{
+	if (!g_hash_table_lookup (self->pv->objects, object))
+		return FALSE;
+
+	if (self->pv->pred && seahorse_predicate_match (self->pv->pred, object))
+		return FALSE;
+
+	remove_object (object, NULL, self);
+	return TRUE;
+}
+
+static void
+on_context_object_added (SeahorseContext *context,
+                         SeahorseObject *object,
+                         gpointer user_data)
+{
+	SeahorseCollection *self = SEAHORSE_COLLECTION (user_data);
+
+	maybe_add_object (self, object);
+}
+
+static void
+on_context_object_removed (SeahorseContext *context,
+                           SeahorseObject *object,
+                           gpointer user_data)
+{
+	SeahorseCollection *self = SEAHORSE_COLLECTION (user_data);
+
+	if (g_hash_table_lookup (self->pv->objects, object))
+		remove_object (object, NULL, self);
+}
+
+static void
+on_context_object_changed (SeahorseContext *context,
+                           SeahorseObject *object,
+                           gpointer user_data)
+{
+	SeahorseCollection *self = SEAHORSE_COLLECTION (user_data);
+	if (g_hash_table_lookup (self->pv->objects, object))
+		maybe_remove_object (self, object);
+	else
+		maybe_add_object (self, object);
+}
+
+static void
+objects_to_list (SeahorseObject *sobj, gpointer *c, GList **l)
+{
+	*l = g_list_append (*l, sobj);
+}
+
+static void
+objects_to_hash (SeahorseObject *sobj, gpointer *c, GHashTable *ht)
+{
+	g_hash_table_replace (ht, sobj, NULL);
+}
+
+static void
+seahorse_collection_dispose (GObject *obj)
+{
+	SeahorseCollection *self = SEAHORSE_COLLECTION (obj);
+
+	g_signal_handlers_disconnect_by_func (seahorse_context_instance (),
+	                                      on_context_object_added, self);
+	g_signal_handlers_disconnect_by_func (seahorse_context_instance (),
+	                                      on_context_object_removed, self);
+	g_signal_handlers_disconnect_by_func (seahorse_context_instance (),
+	                                      on_context_object_changed, self);
+
+	/* Release all our pointers and stuff */
+	g_hash_table_foreach_remove (self->pv->objects, (GHRFunc)remove_update, self);
+
+	G_OBJECT_CLASS (seahorse_collection_parent_class)->dispose (obj);
+}
+
+static void
+seahorse_collection_finalize (GObject *obj)
+{
+	SeahorseCollection *self = SEAHORSE_COLLECTION (obj);
+
+	g_hash_table_destroy (self->pv->objects);
+
+	if (self->pv->destroy_func)
+		(self->pv->destroy_func) (self->pv->pred);
+
+	G_OBJECT_CLASS (seahorse_collection_parent_class)->finalize (obj);
+}
+
+static void
+seahorse_collection_set_property (GObject *obj,
+                                  guint prop_id,
+                                  const GValue *value,
+                                  GParamSpec *pspec)
+{
+	SeahorseCollection *self = SEAHORSE_COLLECTION (obj);
+
+	switch (prop_id) {
+	case PROP_PREDICATE:
+		g_return_if_fail (self->pv->pred == NULL);
+		self->pv->pred = g_value_get_pointer (value);
+		seahorse_collection_refresh (self);
+		break;
+	default:
+		G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
+		break;
+	}
+}
+
+static void
+seahorse_collection_get_property (GObject *obj,
+                                  guint prop_id,
+                                  GValue *value,
+                                  GParamSpec *pspec)
+{
+	SeahorseCollection *self = SEAHORSE_COLLECTION (obj);
+
+	switch (prop_id) {
+	case PROP_PREDICATE:
+		g_value_set_pointer (value, self->pv->pred);
+		break;
+	default:
+		G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
+		break;
+	}
+}
+
+static void
+seahorse_collection_init (SeahorseCollection *self)
+{
+	self->pv = G_TYPE_INSTANCE_GET_PRIVATE (self, SEAHORSE_TYPE_COLLECTION,
+	                                        SeahorseCollectionPrivate);
+
+	self->pv->objects = g_hash_table_new (g_direct_hash, g_direct_equal);
+
+	g_signal_connect (seahorse_context_instance (), "added",
+	                  G_CALLBACK (on_context_object_added), self);
+	g_signal_connect (seahorse_context_instance (), "removed",
+	                  G_CALLBACK (on_context_object_removed), self);
+	g_signal_connect (seahorse_context_instance (), "changed",
+	                  G_CALLBACK (on_context_object_changed), self);
+}
+
+static void
+seahorse_collection_class_init (SeahorseCollectionClass *klass)
+{
+	GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+
+	gobject_class->dispose = seahorse_collection_dispose;
+	gobject_class->finalize = seahorse_collection_finalize;
+	gobject_class->set_property = seahorse_collection_set_property;
+	gobject_class->get_property = seahorse_collection_get_property;
+
+	g_object_class_install_property (gobject_class, PROP_PREDICATE,
+	          g_param_spec_pointer ("predicate", "Predicate", "Predicate for matching objects into this set.",
+	                                G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+
+	g_type_class_add_private (klass, sizeof (SeahorseCollectionPrivate));
+}
+
+static guint
+seahorse_collection_get_length (GcrCollection *collection)
+{
+	SeahorseCollection *self = SEAHORSE_COLLECTION (collection);
+	return g_hash_table_size (self->pv->objects);
+}
+
+static GList *
+seahorse_collection_get_objects (GcrCollection *collection)
+{
+	SeahorseCollection *self = SEAHORSE_COLLECTION (collection);
+	GList *objs = NULL;
+
+	g_hash_table_foreach (self->pv->objects, (GHFunc)objects_to_list, &objs);
+
+	return objs;
+}
+
+static void
+seahorse_collection_iface_init (GcrCollectionIface *iface)
+{
+	iface->get_length = seahorse_collection_get_length;
+	iface->get_objects = seahorse_collection_get_objects;
+}
+
+SeahorseCollection *
+seahorse_collection_new_for_predicate (SeahorsePredicate *pred,
+                                       GDestroyNotify destroy_func)
+{
+	SeahorseCollection *collection;
+
+	collection = g_object_new (SEAHORSE_TYPE_COLLECTION,
+	                           "predicate", pred,
+	                           NULL);
+
+	collection->pv->destroy_func = destroy_func;
+	return collection;
+}
+
+gboolean
+seahorse_collection_has_object (SeahorseCollection *self,
+                                SeahorseObject *object)
+{
+	if (g_hash_table_lookup (self->pv->objects, object))
+		return TRUE;
+
+	/*
+	 * This happens when the object has changed state, but we have
+	 * not yet received the signal.
+	 */
+	if (maybe_add_object (self, object))
+		return TRUE;
+
+	return FALSE;
+}
+
+void
+seahorse_collection_refresh (SeahorseCollection *self)
+{
+	GHashTable *check = g_hash_table_new (g_direct_hash, g_direct_equal);
+	GList *l, *objects = NULL;
+
+	/* Make note of all the objects we had prior to refresh */
+	g_hash_table_foreach (self->pv->objects, (GHFunc)objects_to_hash, check);
+
+	if (self->pv->pred)
+		objects = seahorse_context_find_objects_full (seahorse_context_instance (),
+		                                              self->pv->pred);
+
+	for (l = objects; l != NULL; l = g_list_next (l)) {
+
+		/* Make note that we've seen this object */
+		g_hash_table_remove (check, l->data);
+
+		/* This will add to set */
+		maybe_add_object (self, l->data);
+	}
+
+	g_list_free (objects);
+
+	g_hash_table_foreach (check, remove_object, self);
+	g_hash_table_destroy (check);
+}
+
+SeahorsePredicate *
+seahorse_collection_get_predicate (SeahorseCollection *self)
+{
+	g_return_val_if_fail (SEAHORSE_IS_COLLECTION (self), NULL);
+	return self->pv->pred;
+}
diff --git a/libseahorse/seahorse-collection.h b/libseahorse/seahorse-collection.h
new file mode 100644
index 0000000..ad8c004
--- /dev/null
+++ b/libseahorse/seahorse-collection.h
@@ -0,0 +1,64 @@
+/*
+ * Seahorse
+ *
+ * Copyright (C) 2005-2006 Stefan Walter
+ * Copyright (C) 2011 Collabora Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __SEAHORSE_COLLECTION_H__
+#define __SEAHORSE_COLLECTION_H__
+
+#include <gcr/gcr.h>
+
+#include "seahorse-predicate.h"
+
+#define SEAHORSE_TYPE_COLLECTION               (seahorse_collection_get_type ())
+#define SEAHORSE_COLLECTION(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), SEAHORSE_TYPE_COLLECTION, SeahorseCollection))
+#define SEAHORSE_COLLECTION_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), SEAHORSE_TYPE_COLLECTION, SeahorseCollectionClass))
+#define SEAHORSE_IS_COLLECTION(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SEAHORSE_TYPE_COLLECTION))
+#define SEAHORSE_IS_COLLECTION_CLASS(klass)    (G_TYPE_CHECK_CLASS_TYPE ((klass), SEAHORSE_TYPE_COLLECTION))
+#define SEAHORSE_COLLECTION_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), SEAHORSE_TYPE_COLLECTION, SeahorseCollectionClass))
+
+typedef struct _SeahorseCollection SeahorseCollection;
+typedef struct _SeahorseCollectionClass SeahorseCollectionClass;
+typedef struct _SeahorseCollectionPrivate SeahorseCollectionPrivate;
+
+struct _SeahorseCollection {
+	GObject parent;
+
+	/* <private> */
+	SeahorseCollectionPrivate *pv;
+};
+
+struct _SeahorseCollectionClass {
+	GObjectClass parent_class;
+};
+
+GType                seahorse_collection_get_type             (void);
+
+SeahorseCollection * seahorse_collection_new_for_predicate    (SeahorsePredicate *predicate,
+                                                               GDestroyNotify destroy_func);
+
+SeahorsePredicate *  seahorse_collection_get_predicate        (SeahorseCollection *self);
+
+gboolean             seahorse_collection_has_object           (SeahorseCollection *self,
+                                                               SeahorseObject *object);
+
+void                 seahorse_collection_refresh              (SeahorseCollection *self);
+
+#endif /* __SEAHORSE_COLLECTION_H__ */
diff --git a/libseahorse/seahorse-combo-keys.c b/libseahorse/seahorse-combo-keys.c
index 35c34ff..8b2bf35 100644
--- a/libseahorse/seahorse-combo-keys.c
+++ b/libseahorse/seahorse-combo-keys.c
@@ -36,99 +36,109 @@ enum {
  */
 
 static void
-object_added (SeahorseSet *skset, SeahorseObject *object, GtkComboBox *combo)
+on_label_changed (GObject *obj,
+                  GParamSpec *param,
+                  gpointer user_data)
 {
-    GtkListStore *model;
-    GtkTreeIter iter;
-    const gchar *userid;
-    
-    g_return_if_fail (SEAHORSE_IS_OBJECT (object));
-    g_return_if_fail (combo != NULL);
-    
-    model = GTK_LIST_STORE (gtk_combo_box_get_model (combo));
-    
-    userid = seahorse_object_get_label (object);
+	SeahorseObject *object = SEAHORSE_OBJECT (obj);
+	GtkComboBox *combo = GTK_COMBO_BOX (user_data);
+	GtkTreeModel *model;
+	GtkTreeIter iter;
+	gboolean valid;
+	const gchar *userid;
+	gpointer pntr;
+	SeahorseObject *frommodel;
 
-    gtk_list_store_append (model, &iter);
-    gtk_list_store_set (model, &iter,
-                        COMBO_STRING, userid,
-                        COMBO_POINTER, object,
-                        -1);
+	model = gtk_combo_box_get_model (combo);
+	valid = gtk_tree_model_get_iter_first (model, &iter);
+
+	while (valid) {
+		gtk_tree_model_get (model, &iter,
+		                    COMBO_POINTER, &pntr,
+		                    -1);
+
+		frommodel = SEAHORSE_OBJECT (pntr);
+		if (frommodel == object) {
+			userid = seahorse_object_get_label (object);
+			gtk_list_store_set (GTK_LIST_STORE (model), &iter,
+			                    COMBO_STRING, userid,
+			                    -1);
+			break;
+		}
+
+		valid = gtk_tree_model_iter_next (model, &iter);
+	}
 }
 
 static void
-object_changed (SeahorseSet *skset, SeahorseObject *object, GtkComboBox *combo)
+on_collection_added (GcrCollection *collection,
+                     GObject *obj,
+                     gpointer user_data)
 {
-    GtkTreeModel *model;
-    GtkTreeIter iter;
-    gboolean valid;
-    const gchar *userid;
-    gpointer pntr;
-    SeahorseObject *frommodel;
-    
-    g_return_if_fail (SEAHORSE_IS_OBJECT (object));
+	SeahorseObject *object = SEAHORSE_OBJECT (obj);
+	GtkComboBox *combo = GTK_COMBO_BOX (user_data);
+	GtkListStore *model;
+	GtkTreeIter iter;
+	const gchar *userid;
 
-    model = gtk_combo_box_get_model (combo);
-    valid = gtk_tree_model_get_iter_first (model, &iter);
-    
-    while (valid) {
-        gtk_tree_model_get (model, &iter,
-                            COMBO_POINTER, &pntr,
-                            -1);
-                            
-        frommodel = SEAHORSE_OBJECT (pntr);
-        
-        if (frommodel == object) {
-        userid = seahorse_object_get_label (object);
-            gtk_list_store_set (GTK_LIST_STORE (model), &iter,
-                                COMBO_STRING, userid,
-                                -1);
-                                
-            break;
-        }
-    
-        valid = gtk_tree_model_iter_next (model, &iter);
-    }
+	model = GTK_LIST_STORE (gtk_combo_box_get_model (combo));
+	userid = seahorse_object_get_label (object);
+
+	gtk_list_store_append (model, &iter);
+	gtk_list_store_set (model, &iter,
+	                    COMBO_STRING, userid,
+	                    COMBO_POINTER, object,
+	                    -1);
+
+	g_signal_connect (object, "notify::label", G_CALLBACK (on_label_changed), combo);
 }
 
 static void
-object_removed (SeahorseSet *skset, SeahorseObject *object, GtkComboBox *combo)
+on_collection_removed (GcrCollection *collection,
+                       GObject *obj,
+                       gpointer user_data)
 {
-    GtkTreeModel *model;
-    GtkTreeIter iter;
-    gpointer pntr;
-    gboolean valid;
-    SeahorseObject *frommodel;
-    
-    g_return_if_fail (SEAHORSE_IS_OBJECT (object));
-    g_return_if_fail (combo != NULL);
+	SeahorseObject *object = SEAHORSE_OBJECT (obj);
+	GtkComboBox *combo = GTK_COMBO_BOX (user_data);
+	GtkTreeModel *model;
+	GtkTreeIter iter;
+	gpointer pntr;
+	gboolean valid;
+	SeahorseObject *frommodel;
 
-    model = gtk_combo_box_get_model (combo);
-    valid = gtk_tree_model_get_iter_first (model, &iter);
-    
-    while (valid) {
-        gtk_tree_model_get (model, &iter,
-                            COMBO_POINTER, &pntr,
-                            -1);
-                            
-        frommodel = SEAHORSE_OBJECT (pntr);
-        
-        if (frommodel == object) {
-            gtk_list_store_remove (GTK_LIST_STORE (model), &iter);
-                                
-            break;
-        }
-        
-        valid = gtk_tree_model_iter_next (model, &iter);
-    }
+	model = gtk_combo_box_get_model (combo);
+	valid = gtk_tree_model_get_iter_first (model, &iter);
+
+	while (valid) {
+		gtk_tree_model_get (model, &iter,
+		                    COMBO_POINTER, &pntr,
+		                    -1);
+
+		frommodel = SEAHORSE_OBJECT (pntr);
+		if (frommodel == object) {
+			gtk_list_store_remove (GTK_LIST_STORE (model), &iter);
+			break;
+		}
+
+		valid = gtk_tree_model_iter_next (model, &iter);
+	}
+
+	g_signal_handlers_disconnect_by_func (object, on_label_changed, combo);
 }
 
 static void
-combo_destroyed (GtkComboBox *combo, SeahorseSet *skset)
+on_combo_destroy (GtkComboBox *combo,
+                  gpointer user_data)
 {
-    g_signal_handlers_disconnect_by_func (skset, object_added, combo);
-    g_signal_handlers_disconnect_by_func (skset, object_changed, combo);
-    g_signal_handlers_disconnect_by_func (skset, object_removed, combo);
+	GcrCollection *collection = GCR_COLLECTION (user_data);
+	GList *objects, *l;
+
+	objects = gcr_collection_get_objects (collection);
+	for (l = objects; l != NULL; l = g_list_next (l))
+		g_signal_handlers_disconnect_by_func (l->data, on_label_changed, combo);
+	g_list_free (objects);
+	g_signal_handlers_disconnect_by_func (collection, on_collection_added, combo);
+	g_signal_handlers_disconnect_by_func (collection, on_collection_removed, combo);
 }
 
 /* -----------------------------------------------------------------------------
@@ -136,57 +146,51 @@ combo_destroyed (GtkComboBox *combo, SeahorseSet *skset)
  */
 
 void 
-seahorse_combo_keys_attach (GtkComboBox *combo, SeahorseSet *skset,
+seahorse_combo_keys_attach (GtkComboBox *combo,
+                            GcrCollection *collection,
                             const gchar *none_option)
 {
-    GtkTreeModel *model;
-    GtkTreeIter iter;
-    GtkCellRenderer *renderer;
-    SeahorseObject *object;
-    GList *l, *objects;
+	GtkTreeModel *model;
+	GtkTreeIter iter;
+	GtkCellRenderer *renderer;
+	GList *l, *objects;
 
-    /* Setup the None Option */
-    model = gtk_combo_box_get_model (combo);
-    if (!model) {
-        model = GTK_TREE_MODEL (gtk_list_store_new (N_COLUMNS, G_TYPE_STRING, G_TYPE_POINTER));
-        gtk_combo_box_set_model (combo, model);
-        
-        gtk_cell_layout_clear (GTK_CELL_LAYOUT (combo));
-        renderer = gtk_cell_renderer_text_new ();
-        
-        gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), renderer, TRUE);
-        gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (combo), renderer,
-                                       "text", COMBO_STRING);                            
-    }
+	/* Setup the None Option */
+	model = gtk_combo_box_get_model (combo);
+	if (!model) {
+		model = GTK_TREE_MODEL (gtk_list_store_new (N_COLUMNS, G_TYPE_STRING, G_TYPE_POINTER));
+		gtk_combo_box_set_model (combo, model);
 
-    /* Setup the object list */
-    objects = seahorse_set_get_objects (skset);  
-    for (l = objects; l != NULL; l = g_list_next (l)) {
-        object = SEAHORSE_OBJECT (l->data);
-        object_added (skset, object, combo);
-    }
-    g_list_free (objects);
-
-    g_signal_connect_after (skset, "added", G_CALLBACK (object_added), combo);
-    g_signal_connect_after (skset, "changed", G_CALLBACK (object_changed), combo);
-    g_signal_connect_after (skset, "removed", G_CALLBACK (object_removed), combo);
-
-    if (none_option) {
-        gtk_list_store_prepend (GTK_LIST_STORE (model), &iter);
-        gtk_list_store_set (GTK_LIST_STORE (model), &iter,
-                            COMBO_STRING, none_option,
-                            COMBO_POINTER, NULL,
-                            -1);    
-    }
+		gtk_cell_layout_clear (GTK_CELL_LAYOUT (combo));
+		renderer = gtk_cell_renderer_text_new ();
 
-    gtk_tree_model_get_iter_first (model, &iter);
-    
-    gtk_combo_box_set_active_iter (combo, &iter);
-    
-    /* Cleanup */
-    g_object_ref (skset);
-    g_object_set_data_full (G_OBJECT (combo), "skset", skset, g_object_unref);
-    g_signal_connect (combo, "destroy", G_CALLBACK (combo_destroyed), skset);
+		gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), renderer, TRUE);
+		gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (combo), renderer,
+		                               "text", COMBO_STRING);
+	}
+
+	/* Setup the object list */
+	objects = gcr_collection_get_objects (collection);
+	for (l = objects; l != NULL; l = g_list_next (l))
+		on_collection_added (collection, l->data, combo);
+	g_list_free (objects);
+
+	g_signal_connect_after (collection, "added", G_CALLBACK (on_collection_added), combo);
+	g_signal_connect_after (collection, "removed", G_CALLBACK (on_collection_removed), combo);
+
+	if (none_option) {
+		gtk_list_store_prepend (GTK_LIST_STORE (model), &iter);
+		gtk_list_store_set (GTK_LIST_STORE (model), &iter,
+		                    COMBO_STRING, none_option,
+		                    COMBO_POINTER, NULL,
+		                    -1);
+	}
+
+	gtk_tree_model_get_iter_first (model, &iter);
+	gtk_combo_box_set_active_iter (combo, &iter);
+
+	g_signal_connect_data (combo, "destroy", G_CALLBACK (on_combo_destroy),
+	                       g_object_ref (collection), (GClosureNotify)g_object_unref, 0);
 }
 
 void
diff --git a/libseahorse/seahorse-combo-keys.h b/libseahorse/seahorse-combo-keys.h
index 4437491..9e6f928 100644
--- a/libseahorse/seahorse-combo-keys.h
+++ b/libseahorse/seahorse-combo-keys.h
@@ -30,12 +30,12 @@
 #define __SEAHORSE_COMBO_KEYS_H__
 
 #include "seahorse-object.h"
-#include "seahorse-set.h"
 
 #include <gtk/gtk.h>
+#include <gcr/gcr.h>
 
 void                        seahorse_combo_keys_attach              (GtkComboBox *combo,
-                                                                     SeahorseSet *skset,
+                                                                     GcrCollection *collection,
                                                                      const gchar *none_option);
 
 void                        seahorse_combo_keys_set_active_id       (GtkComboBox *combo,
diff --git a/libseahorse/seahorse-context.c b/libseahorse/seahorse-context.c
index ad4852e..5c84710 100644
--- a/libseahorse/seahorse-context.c
+++ b/libseahorse/seahorse-context.c
@@ -31,6 +31,7 @@
 #include "seahorse-context.h"
 #include "seahorse-dns-sd.h"
 #include "seahorse-marshal.h"
+#include "seahorse-predicate.h"
 #include "seahorse-progress.h"
 #include "seahorse-registry.h"
 #include "seahorse-servers.h"
@@ -825,7 +826,7 @@ seahorse_context_get_object (SeahorseContext *sctx, SeahorseSource *sksrc,
  *
  **/
 typedef struct _ObjectMatcher {
-	SeahorseObjectPredicate *kp;
+	SeahorsePredicate *kp;
 	gboolean many;
 	SeahorseObjectFunc func;
 	gpointer user_data;
@@ -846,8 +847,8 @@ static gboolean
 find_matching_objects (gpointer key, SeahorseObject *sobj, ObjectMatcher *km)
 {
 	gboolean matched;
-	
-	if (km->kp && seahorse_object_predicate_match (km->kp, SEAHORSE_OBJECT (sobj))) {
+
+	if (km->kp && seahorse_predicate_match (km->kp, SEAHORSE_OBJECT (sobj))) {
 		matched = TRUE;
 		(km->func) (sobj, km->user_data);
 	}
@@ -884,7 +885,8 @@ add_object_to_list (SeahorseObject *object, gpointer user_data)
  * Returns: a #GList list containing the matching objects
  */
 GList*
-seahorse_context_find_objects_full (SeahorseContext *self, SeahorseObjectPredicate *pred)
+seahorse_context_find_objects_full (SeahorseContext *self,
+                                    SeahorsePredicate *pred)
 {
 	GList *list = NULL;
 	ObjectMatcher km;
@@ -915,8 +917,10 @@ seahorse_context_find_objects_full (SeahorseContext *self, SeahorseObjectPredica
  * is passed to this function
  */
 void
-seahorse_context_for_objects_full (SeahorseContext *self, SeahorseObjectPredicate *pred,
-                                   SeahorseObjectFunc func, gpointer user_data)
+seahorse_context_for_objects_full (SeahorseContext *self,
+                                   SeahorsePredicate *pred,
+                                   SeahorseObjectFunc func,
+                                   gpointer user_data)
 {
 	ObjectMatcher km;
 
@@ -947,14 +951,14 @@ seahorse_context_for_objects_full (SeahorseContext *self, SeahorseObjectPredicat
 GList*
 seahorse_context_get_objects (SeahorseContext *self, SeahorseSource *source)
 {
-	SeahorseObjectPredicate pred;
+	SeahorsePredicate pred;
 
 	if (!self)
 		self = seahorse_context_instance ();
 	g_return_val_if_fail (SEAHORSE_IS_CONTEXT (self), NULL);
 	g_return_val_if_fail (source == NULL || SEAHORSE_IS_SOURCE (source), NULL);
 
-	seahorse_object_predicate_clear (&pred);
+	seahorse_predicate_clear (&pred);
 	pred.source = source;
 	
 	return seahorse_context_find_objects_full (self, &pred);
@@ -1013,7 +1017,7 @@ GList*
 seahorse_context_find_objects (SeahorseContext *sctx, GQuark ktype, 
                                SeahorseUsage usage, SeahorseLocation location)
 {
-    SeahorseObjectPredicate pred;
+    SeahorsePredicate pred;
     memset (&pred, 0, sizeof (pred));
 
     if (!sctx)
diff --git a/libseahorse/seahorse-context.h b/libseahorse/seahorse-context.h
index c14d40e..96ea6e8 100644
--- a/libseahorse/seahorse-context.h
+++ b/libseahorse/seahorse-context.h
@@ -38,7 +38,7 @@
 
 struct _SeahorseKey;
 struct _SeahorseObject;
-struct _SeahorseObjectPredicate;
+struct _SeahorsePredicate;
 
 typedef struct _SeahorseContext SeahorseContext;
 typedef struct _SeahorseContextClass SeahorseContextClass;
@@ -156,10 +156,10 @@ GList*              seahorse_context_find_objects            (SeahorseContext *s
                                                               SeahorseLocation location);
 
 GList*              seahorse_context_find_objects_full       (SeahorseContext *self,
-                                                              struct _SeahorseObjectPredicate *skpred);
+                                                              struct _SeahorsePredicate *skpred);
 
 void                seahorse_context_for_objects_full        (SeahorseContext *self,
-                                                              struct _SeahorseObjectPredicate *skpred,
+                                                              struct _SeahorsePredicate *skpred,
                                                               SeahorseObjectFunc func,
                                                               gpointer user_data);
 
diff --git a/libseahorse/seahorse-object.c b/libseahorse/seahorse-object.c
index 9ac740a..a0dbc73 100644
--- a/libseahorse/seahorse-object.c
+++ b/libseahorse/seahorse-object.c
@@ -22,9 +22,9 @@
 
 #include "config.h"
 
-#include "seahorse-object.h"
-
 #include "seahorse-context.h"
+#include "seahorse-object.h"
+#include "seahorse-predicate.h"
 #include "seahorse-source.h"
 
 #include "string.h"
@@ -942,7 +942,7 @@ seahorse_object_get_flags (SeahorseObject *self)
 }
 
 /**
- * seahorse_object_predicate_match:
+ * seahorse_predicate_match:
  * @self: the object to test
  * @obj: The predicate to match
  *
@@ -950,26 +950,27 @@ seahorse_object_get_flags (SeahorseObject *self)
  *
  * Returns: FALSE if predicate does not match the #SeahorseObject, TRUE else
  */
-gboolean 
-seahorse_object_predicate_match (SeahorseObjectPredicate *self, SeahorseObject* obj) 
+gboolean
+seahorse_predicate_match (SeahorsePredicate *self,
+                          SeahorseObject* object)
 {
 	SeahorseObjectPrivate *pv;
-	
-	g_return_val_if_fail (SEAHORSE_IS_OBJECT (obj), FALSE);
-	pv = obj->pv;
+
+	g_return_val_if_fail (SEAHORSE_IS_OBJECT (object), FALSE);
+	pv = object->pv;
 
 	/* Check all the fields */
 	if (self->tag != 0 && self->tag != pv->tag)
 		return FALSE;
 	if (self->id != 0 && self->id != pv->id)
 		return FALSE;
-	if (self->type != 0 && self->type != G_OBJECT_TYPE (obj))
+	if (self->type != 0 && self->type != G_OBJECT_TYPE (object))
 		return FALSE;
 	if (self->location != 0 && self->location != pv->location)
 		return FALSE;
-	if (self->usage != 0 && self->usage != pv->usage) 
+	if (self->usage != 0 && self->usage != pv->usage)
 		return FALSE;
-	if (self->flags != 0 && (self->flags & pv->flags) == 0) 
+	if (self->flags != 0 && (self->flags & pv->flags) == 0)
 		return FALSE;
 	if (self->nflags != 0 && (self->nflags & pv->flags) != 0)
 		return FALSE;
@@ -977,20 +978,20 @@ seahorse_object_predicate_match (SeahorseObjectPredicate *self, SeahorseObject*
 		return FALSE;
 
 	/* And any custom stuff */
-	if (self->custom != NULL && !self->custom (obj, self->custom_target)) 
+	if (self->custom != NULL && !self->custom (object, self->custom_target))
 		return FALSE;
 
 	return TRUE;
 }
 
 /**
- * seahorse_object_predicate_clear:
+ * seahorse_predicate_clear:
  * @self: The predicate to clean
  *
- * Clears a seahorse predicate (#SeahorseObjectPredicate)
+ * Clears a seahorse predicate (#SeahorsePredicate)
  */
 void
-seahorse_object_predicate_clear (SeahorseObjectPredicate *self)
+seahorse_predicate_clear (SeahorsePredicate *self)
 {
 	memset (self, 0, sizeof (*self));
 }
diff --git a/libseahorse/seahorse-object.h b/libseahorse/seahorse-object.h
index beff10f..c00ce32 100644
--- a/libseahorse/seahorse-object.h
+++ b/libseahorse/seahorse-object.h
@@ -113,26 +113,4 @@ SeahorseUsage       seahorse_object_get_usage              (SeahorseObject *self
 
 guint               seahorse_object_get_flags              (SeahorseObject *self);
 
-typedef gboolean (*SeahorseObjectPredicateFunc) (SeahorseObject *obj, void *user_data);
-
-typedef struct _SeahorseObjectPredicate SeahorseObjectPredicate;
-
-struct _SeahorseObjectPredicate {
-	GQuark tag;
-	GQuark id;
-	GType type;
-	SeahorseLocation location;
-	SeahorseUsage usage;
-	guint flags;
-	guint nflags;
-	SeahorseSource *source;
-	SeahorseObjectPredicateFunc custom;
-	gpointer custom_target;
-};
-
-void               seahorse_object_predicate_clear         (SeahorseObjectPredicate *self);
-
-gboolean           seahorse_object_predicate_match         (SeahorseObjectPredicate *self, 
-                                                            SeahorseObject *obj);
-
 #endif /* __SEAHORSE_OBJECT_H__ */
diff --git a/libseahorse/seahorse-predicate.h b/libseahorse/seahorse-predicate.h
new file mode 100644
index 0000000..332d723
--- /dev/null
+++ b/libseahorse/seahorse-predicate.h
@@ -0,0 +1,56 @@
+/*
+ * Seahorse
+ *
+ * Copyright (C) 2008 Stefan Walter
+ * Copyright (C) 2011 Collabora Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ */
+
+#ifndef __SEAHORSE_PREDICATE_H__
+#define __SEAHORSE_PREDICATE_H__
+
+#include "seahorse-context.h"
+#include "seahorse-object.h"
+#include "seahorse-source.h"
+#include "seahorse-types.h"
+
+#include <glib-object.h>
+
+typedef gboolean (*SeahorsePredicateFunc) (SeahorseObject *object,
+                                           void *user_data);
+
+typedef struct _SeahorsePredicate SeahorsePredicate;
+
+struct _SeahorsePredicate {
+	GQuark tag;
+	GQuark id;
+	GType type;
+	SeahorseLocation location;
+	SeahorseUsage usage;
+	guint flags;
+	guint nflags;
+	SeahorseSource *source;
+	SeahorsePredicateFunc custom;
+	gpointer custom_target;
+};
+
+void               seahorse_predicate_clear         (SeahorsePredicate *self);
+
+gboolean           seahorse_predicate_match         (SeahorsePredicate *self,
+                                                     SeahorseObject *object);
+
+#endif /* __SEAHORSE_PREDICATE_H__ */
diff --git a/libseahorse/seahorse-view.c b/libseahorse/seahorse-view.c
index 5da6e16..61d349e 100644
--- a/libseahorse/seahorse-view.c
+++ b/libseahorse/seahorse-view.c
@@ -38,7 +38,8 @@ seahorse_view_set_selected_objects (SeahorseView* self, GList* objects)
 
 
 GList*
-seahorse_view_get_selected_matching (SeahorseView *self, SeahorseObjectPredicate *pred)
+seahorse_view_get_selected_matching (SeahorseView *self,
+                                     SeahorsePredicate *pred)
 {
 	g_return_val_if_fail (SEAHORSE_VIEW_GET_INTERFACE (self)->get_selected_matching, NULL);
 	return SEAHORSE_VIEW_GET_INTERFACE (self)->get_selected_matching (self, pred);
@@ -67,7 +68,8 @@ seahorse_view_get_window (SeahorseView* self)
 }
 
 void
-seahorse_view_register_commands (SeahorseView *self, SeahorseObjectPredicate *pred,
+seahorse_view_register_commands (SeahorseView *self,
+                                 SeahorsePredicate *pred,
                                  SeahorseCommands *commands)
 {
 	g_return_if_fail (SEAHORSE_VIEW_GET_INTERFACE (self)->register_commands);
@@ -75,8 +77,10 @@ seahorse_view_register_commands (SeahorseView *self, SeahorseObjectPredicate *pr
 }
 
 void
-seahorse_view_register_ui (SeahorseView *self, SeahorseObjectPredicate *pred, 
-                           const gchar *ui_definition, GtkActionGroup *actions)
+seahorse_view_register_ui (SeahorseView *self,
+                           SeahorsePredicate *pred,
+                           const gchar *ui_definition,
+                           GtkActionGroup *actions)
 {
 	g_return_if_fail (SEAHORSE_VIEW_GET_INTERFACE (self)->register_ui);
 	SEAHORSE_VIEW_GET_INTERFACE (self)->register_ui (self, pred, ui_definition, actions);
diff --git a/libseahorse/seahorse-view.h b/libseahorse/seahorse-view.h
index 5c277e0..ad7f8ec 100644
--- a/libseahorse/seahorse-view.h
+++ b/libseahorse/seahorse-view.h
@@ -25,8 +25,8 @@
 #include <glib.h>
 #include <glib-object.h>
 
-#include "seahorse-set.h"
 #include "seahorse-object.h"
+#include "seahorse-predicate.h"
 
 typedef struct _SeahorseCommands SeahorseCommands;
 
@@ -48,7 +48,7 @@ struct _SeahorseViewIface {
 	                                           GList *objects);
 	
 	GList*          (*get_selected_matching)  (SeahorseView *self, 
-	                                           SeahorseObjectPredicate *pred);
+	                                           SeahorsePredicate *pred);
 	
 	SeahorseObject* (*get_selected)           (SeahorseView *self);
 	
@@ -58,11 +58,11 @@ struct _SeahorseViewIface {
 	GtkWindow*      (*get_window)             (SeahorseView *self);
 	
 	void            (*register_commands)      (SeahorseView *self, 
-	                                           SeahorseObjectPredicate *pred,
+	                                           SeahorsePredicate *pred,
 	                                           SeahorseCommands *commands);
 	
 	void            (*register_ui)            (SeahorseView *self, 
-	                                           SeahorseObjectPredicate *pred, 
+	                                           SeahorsePredicate *pred,
 	                                           const gchar *ui_definition, 
 	                                           GtkActionGroup *actions);
 };
@@ -76,7 +76,7 @@ void              seahorse_view_set_selected_objects        (SeahorseView *self,
                                                              GList *objects);
 
 GList*            seahorse_view_get_selected_matching       (SeahorseView *self, 
-                                                             SeahorseObjectPredicate *pred);
+                                                             SeahorsePredicate *pred);
 
 SeahorseObject*   seahorse_view_get_selected                (SeahorseView *self);
 
@@ -86,12 +86,12 @@ void              seahorse_view_set_selected                (SeahorseView *self,
 GtkWindow*        seahorse_view_get_window                  (SeahorseView *self);
 
 void              seahorse_view_register_ui                 (SeahorseView *self, 
-                                                             SeahorseObjectPredicate *pred,
+                                                             SeahorsePredicate *pred,
                                                              const gchar *ui_definition,
                                                              GtkActionGroup *actions);
 
 void              seahorse_view_register_commands           (SeahorseView *self, 
-                                                             SeahorseObjectPredicate *pred,
+                                                             SeahorsePredicate *pred,
                                                              SeahorseCommands *commands);
 
 #endif
diff --git a/pgp/seahorse-gpgme-key.c b/pgp/seahorse-gpgme-key.c
index 8f748bc..4f7ebcd 100644
--- a/pgp/seahorse-gpgme-key.c
+++ b/pgp/seahorse-gpgme-key.c
@@ -27,6 +27,7 @@
 
 #include "seahorse-context.h"
 #include "seahorse-icons.h"
+#include "seahorse-predicate.h"
 #include "seahorse-object-list.h"
 #include "seahorse-source.h"
 #include "seahorse-util.h"
@@ -605,11 +606,8 @@ seahorse_gpgme_key_set_public (SeahorseGpgmeKey *self, gpgme_key_t key)
 	seahorse_gpgme_key_realize (self);
 	g_object_notify (obj, "fingerprint");
 	g_object_notify (obj, "validity");
-	g_object_notify (obj, "validity-str");
 	g_object_notify (obj, "trust");
-	g_object_notify (obj, "trust-str");
 	g_object_notify (obj, "expires");
-	g_object_notify (obj, "expires-str");
 	g_object_notify (obj, "length");
 	g_object_notify (obj, "algo");
 	g_object_thaw_notify (obj);
@@ -674,8 +672,8 @@ seahorse_gpgme_key_get_trust (SeahorseGpgmeKey *self)
 void
 seahorse_gpgme_key_refresh_matching (gpgme_key_t key)
 {
-	SeahorseObjectPredicate pred;
-	
+	SeahorsePredicate pred;
+
 	g_return_if_fail (key->subkeys->keyid);
 	
 	memset (&pred, 0, sizeof (pred));
diff --git a/pgp/seahorse-gpgme-sign.c b/pgp/seahorse-gpgme-sign.c
index e7d8dc7..d00eb27 100644
--- a/pgp/seahorse-gpgme-sign.c
+++ b/pgp/seahorse-gpgme-sign.c
@@ -25,7 +25,6 @@
 #include "seahorse-combo-keys.h"
 #include "seahorse-icons.h"
 #include "seahorse-object-widget.h"
-#include "seahorse-set.h"
 #include "seahorse-util.h"
 
 #include "pgp/seahorse-gpgme-dialogs.h"
@@ -111,12 +110,15 @@ sign_ok_clicked (SeahorseWidget *swidget, GtkWindow *parent)
 }
 
 static void
-keyset_changed (SeahorseSet *skset, GtkWidget *widget)
+on_collection_changed (GcrCollection *collection,
+                       GObject *object,
+                       gpointer user_data)
 {
-    if (seahorse_set_get_count (skset) <= 1)
-        gtk_widget_hide (widget);
-    else
-        gtk_widget_show (widget);
+	GtkWidget *widget = GTK_WIDGET (user_data);
+	if (gcr_collection_get_length (collection) <= 1)
+		gtk_widget_hide (widget);
+	else
+		gtk_widget_show (widget);
 }
 
 G_MODULE_EXPORT void
@@ -144,7 +146,7 @@ on_gpgme_sign_choice_toggled (GtkToggleButton *toggle,
 static void
 sign_internal (SeahorseObject *to_sign, GtkWindow *parent)
 {
-    SeahorseSet *skset;
+    GcrCollection *collection;
     GtkWidget *w;
     gint response;
     SeahorseWidget *swidget;
@@ -152,10 +154,10 @@ sign_internal (SeahorseObject *to_sign, GtkWindow *parent)
     gchar *userid;
 
     /* Some initial checks */
-    skset = seahorse_keyset_pgp_signers_new ();
-    
+    collection = seahorse_keyset_pgp_signers_new ();
+
     /* If no signing keys then we can't sign */
-    if (seahorse_set_get_count (skset) == 0) {
+    if (gcr_collection_get_length (collection) == 0) {
         /* TODO: We should be giving an error message that allows them to 
            generate or import a key */
         seahorse_util_show_error (NULL, _("No keys usable for signing"), 
@@ -201,20 +203,21 @@ sign_internal (SeahorseObject *to_sign, GtkWindow *parent)
     /* Signature area */
     w = GTK_WIDGET (seahorse_widget_get_widget (swidget, "signer-frame"));
     g_return_if_fail (w != NULL);
-    g_signal_connect_object (skset, "set-changed", G_CALLBACK (keyset_changed), w, 0);
-    keyset_changed (skset, w);
+    g_signal_connect_object (collection, "added", G_CALLBACK (on_collection_changed), w, 0);
+    g_signal_connect_object (collection, "removed", G_CALLBACK (on_collection_changed), w, 0);
+    on_collection_changed (collection, NULL, w);
 
     /* Signer box */
     w = GTK_WIDGET (seahorse_widget_get_widget (swidget, "signer-select"));
     g_return_if_fail (w != NULL);
-    seahorse_combo_keys_attach (GTK_COMBO_BOX (w), skset, NULL);
+    seahorse_combo_keys_attach (GTK_COMBO_BOX (w), collection, NULL);
 
     /* Image */
     w = GTK_WIDGET (seahorse_widget_get_widget (swidget, "sign-image"));
     g_return_if_fail (w != NULL);
     gtk_image_set_from_icon_name (GTK_IMAGE (w), SEAHORSE_ICON_SIGN, GTK_ICON_SIZE_DIALOG);
 
-    g_object_unref (skset);
+    g_object_unref (collection);
     seahorse_widget_show (swidget);
     
     while (do_sign) {
diff --git a/pgp/seahorse-pgp-commands.c b/pgp/seahorse-pgp-commands.c
index 64b33b3..8c35037 100644
--- a/pgp/seahorse-pgp-commands.c
+++ b/pgp/seahorse-pgp-commands.c
@@ -65,8 +65,8 @@ static const char* UI_DEFINITION = ""\
 "	</popup>"\
 "</ui>";
 
-static SeahorseObjectPredicate actions_predicate = { 0 };
-static SeahorseObjectPredicate commands_predicate = { 0 };
+static SeahorsePredicate actions_predicate = { 0 };
+static SeahorsePredicate commands_predicate = { 0 };
 
 /* -----------------------------------------------------------------------------
  * INTERNAL 
diff --git a/pgp/seahorse-pgp-key-properties.c b/pgp/seahorse-pgp-key-properties.c
index 24007ee..a2686d3 100644
--- a/pgp/seahorse-pgp-key-properties.c
+++ b/pgp/seahorse-pgp-key-properties.c
@@ -246,7 +246,7 @@ on_pgp_signature_row_activated (GtkTreeView *treeview,
 		model = gtk_tree_model_filter_get_model (GTK_TREE_MODEL_FILTER (model));
         
 	g_return_if_fail (gtk_tree_model_get_iter (model, &iter, path));
-    
+
 	object = seahorse_object_model_get_row_key (SEAHORSE_OBJECT_MODEL (model), &iter);
 	if (object != NULL && SEAHORSE_IS_PGP_KEY (object)) {
 		seahorse_pgp_key_properties_show (SEAHORSE_PGP_KEY (object), 
diff --git a/pgp/seahorse-pgp-key.c b/pgp/seahorse-pgp-key.c
index ff7552c..9e640ec 100644
--- a/pgp/seahorse-pgp-key.c
+++ b/pgp/seahorse-pgp-key.c
@@ -41,11 +41,8 @@ enum {
 	PROP_UIDS,
 	PROP_FINGERPRINT,
 	PROP_VALIDITY,
-	PROP_VALIDITY_STR,
 	PROP_TRUST,
-	PROP_TRUST_STR,
 	PROP_EXPIRES,
-	PROP_EXPIRES_STR,
 	PROP_LENGTH,
 	PROP_ALGO
 };
@@ -241,18 +238,9 @@ seahorse_pgp_key_get_property (GObject *object, guint prop_id,
 	case PROP_FINGERPRINT:
 		g_value_set_string (value, seahorse_pgp_key_get_fingerprint (self));
 		break;
-	case PROP_VALIDITY_STR:
-		g_value_set_string (value, seahorse_pgp_key_get_validity_str (self));
-		break;
-	case PROP_TRUST_STR:
-		g_value_set_string (value, seahorse_pgp_key_get_trust_str (self));
-		break;
 	case PROP_EXPIRES:
 		g_value_set_ulong (value, seahorse_pgp_key_get_expires (self));
 		break;
-	case PROP_EXPIRES_STR:
-		g_value_take_string (value, seahorse_pgp_key_get_expires_str (self));
-		break;
 	case PROP_LENGTH:
 		g_value_set_uint (value, seahorse_pgp_key_get_length (self));
 		break;
@@ -364,26 +352,14 @@ seahorse_pgp_key_class_init (SeahorsePgpKeyClass *klass)
 	        g_param_spec_uint ("validity", "Validity", "Validity of this key",
                                    0, G_MAXUINT, 0, G_PARAM_READABLE));
 
-        g_object_class_install_property (gobject_class, PROP_VALIDITY_STR,
-                g_param_spec_string ("validity-str", "Validity String", "Validity of this key as a string",
-                                     "", G_PARAM_READABLE));
-
         g_object_class_install_property (gobject_class, PROP_TRUST,
                 g_param_spec_uint ("trust", "Trust", "Trust in this key",
                                    0, G_MAXUINT, 0, G_PARAM_READABLE));
 
-        g_object_class_install_property (gobject_class, PROP_TRUST_STR,
-                g_param_spec_string ("trust-str", "Trust String", "Trust in this key as a string",
-                                     "", G_PARAM_READABLE));
-
         g_object_class_install_property (gobject_class, PROP_EXPIRES,
                 g_param_spec_ulong ("expires", "Expires On", "Date this key expires on",
                                     0, G_MAXULONG, 0, G_PARAM_READABLE));
 
- 	g_object_class_install_property (gobject_class, PROP_EXPIRES_STR,
- 	        g_param_spec_string ("expires-str", "Expires String", "Readable expiry date",
- 	                             "", G_PARAM_READABLE));
-
  	g_object_class_install_property (gobject_class, PROP_LENGTH,
  	        g_param_spec_uint ("length", "Length", "The length of this key.",
  	                           0, G_MAXUINT, 0, G_PARAM_READABLE));
@@ -538,12 +514,6 @@ seahorse_pgp_key_get_validity (SeahorsePgpKey *self)
 	return validity;
 }
 
-const gchar*
-seahorse_pgp_key_get_validity_str (SeahorsePgpKey *self)
-{
-	return seahorse_validity_get_string (seahorse_pgp_key_get_validity (self));
-}
-
 gulong
 seahorse_pgp_key_get_expires (SeahorsePgpKey *self)
 {
@@ -558,25 +528,6 @@ seahorse_pgp_key_get_expires (SeahorsePgpKey *self)
 	return seahorse_pgp_subkey_get_expires (subkeys->data);
 }
 
-gchar*
-seahorse_pgp_key_get_expires_str (SeahorsePgpKey *self)
-{
-	GTimeVal timeval;
-	gulong expires;
-	
-	g_return_val_if_fail (SEAHORSE_IS_PGP_KEY (self), NULL);
-	
-	expires = seahorse_pgp_key_get_expires (self);
-	if (expires == 0)
-		return g_strdup ("");
-	
-	g_get_current_time (&timeval);
-	if (timeval.tv_sec > expires)
-		return g_strdup (_("Expired"));
-	
-	return seahorse_util_get_date_string (expires);
-}
-
 SeahorseValidity
 seahorse_pgp_key_get_trust (SeahorsePgpKey *self)
 {
@@ -585,12 +536,6 @@ seahorse_pgp_key_get_trust (SeahorsePgpKey *self)
 	return trust;
 }
 
-const gchar*
-seahorse_pgp_key_get_trust_str (SeahorsePgpKey *self)
-{
-	return seahorse_validity_get_string (seahorse_pgp_key_get_trust (self));
-}
-
 guint
 seahorse_pgp_key_get_length (SeahorsePgpKey *self)
 {
diff --git a/pgp/seahorse-pgp-key.h b/pgp/seahorse-pgp-key.h
index a7cbd6b..5fb54cd 100644
--- a/pgp/seahorse-pgp-key.h
+++ b/pgp/seahorse-pgp-key.h
@@ -90,16 +90,10 @@ const gchar*      seahorse_pgp_key_get_fingerprint      (SeahorsePgpKey *self);
 
 SeahorseValidity  seahorse_pgp_key_get_validity         (SeahorsePgpKey *self);
 
-const gchar*      seahorse_pgp_key_get_validity_str     (SeahorsePgpKey *self);
-
 gulong            seahorse_pgp_key_get_expires          (SeahorsePgpKey *self);
 
-gchar*            seahorse_pgp_key_get_expires_str      (SeahorsePgpKey *self);
-
 SeahorseValidity  seahorse_pgp_key_get_trust            (SeahorsePgpKey *self);
 
-const gchar*      seahorse_pgp_key_get_trust_str        (SeahorsePgpKey *self);
-
 guint             seahorse_pgp_key_get_length           (SeahorsePgpKey *self);
 
 const gchar*      seahorse_pgp_key_get_algo             (SeahorsePgpKey *self);
diff --git a/pgp/seahorse-pgp-keysets.c b/pgp/seahorse-pgp-keysets.c
index 94d890c..8eda89b 100644
--- a/pgp/seahorse-pgp-keysets.c
+++ b/pgp/seahorse-pgp-keysets.c
@@ -21,7 +21,9 @@
 
 #include "config.h"
 
+#include "seahorse-collection.h"
 #include "seahorse-object.h"
+#include "seahorse-predicate.h"
 
 #include "seahorse-pgp-module.h"
 #include "seahorse-pgp-keysets.h"
@@ -33,14 +35,13 @@
 static void
 on_settings_default_key_changed (GSettings *settings, const gchar *key, gpointer user_data)
 {
-	SeahorseSet *skset = SEAHORSE_SET (user_data);
-
 	/* Default key changed, refresh */
-	seahorse_set_refresh (skset);
+	seahorse_collection_refresh (SEAHORSE_COLLECTION (user_data));
 }
 
 static gboolean 
-pgp_signers_match (SeahorseObject *obj, gpointer data)
+pgp_signers_match (SeahorseObject *obj,
+                   gpointer data)
 {
     SeahorseObject *defkey;
     
@@ -56,24 +57,23 @@ pgp_signers_match (SeahorseObject *obj, gpointer data)
     return TRUE;
 }
 
-SeahorseSet *
+GcrCollection *
 seahorse_keyset_pgp_signers_new (void)
 {
-    SeahorseObjectPredicate *pred = g_new0 (SeahorseObjectPredicate, 1);
-    SeahorseSet *skset;
-    
-    pred->location = SEAHORSE_LOCATION_LOCAL;
-    pred->tag = SEAHORSE_PGP;
-    pred->usage = SEAHORSE_USAGE_PRIVATE_KEY;
-    pred->flags = SEAHORSE_FLAG_CAN_SIGN;
-    pred->nflags = SEAHORSE_FLAG_EXPIRED | SEAHORSE_FLAG_REVOKED | SEAHORSE_FLAG_DISABLED;
-    pred->custom = pgp_signers_match;
-    
-    skset = seahorse_set_new_full (pred);
-    g_object_set_data_full (G_OBJECT (skset), "pgp-signers-predicate", pred, g_free);
+	SeahorsePredicate *predicate = g_new0 (SeahorsePredicate, 1);
+	SeahorseCollection *collection;
+
+	predicate->location = SEAHORSE_LOCATION_LOCAL;
+	predicate->tag = SEAHORSE_PGP;
+	predicate->usage = SEAHORSE_USAGE_PRIVATE_KEY;
+	predicate->flags = SEAHORSE_FLAG_CAN_SIGN;
+	predicate->nflags = SEAHORSE_FLAG_EXPIRED | SEAHORSE_FLAG_REVOKED | SEAHORSE_FLAG_DISABLED;
+	predicate->custom = pgp_signers_match;
+
+	collection = seahorse_collection_new_for_predicate (predicate, g_free);
 
-    g_signal_connect_object (seahorse_context_pgp_settings (NULL), "changed::default-key",
-                             G_CALLBACK (on_settings_default_key_changed), skset, 0);
+	g_signal_connect_object (seahorse_context_pgp_settings (NULL), "changed::default-key",
+	                         G_CALLBACK (on_settings_default_key_changed), collection, 0);
 
-    return skset;
+	return GCR_COLLECTION (collection);
 }
diff --git a/pgp/seahorse-pgp-keysets.h b/pgp/seahorse-pgp-keysets.h
index 788bef4..500e7db 100644
--- a/pgp/seahorse-pgp-keysets.h
+++ b/pgp/seahorse-pgp-keysets.h
@@ -22,12 +22,12 @@
 #ifndef SEAPGPKEYSETS_H_
 #define SEAPGPKEYSETS_H_
 
-#include "seahorse-set.h"
+#include <gcr/gcr.h>
 
 /* -----------------------------------------------------------------------------
  * SOME COMMON KEYSETS 
  */
  
-SeahorseSet*     seahorse_keyset_pgp_signers_new     (void);
+GcrCollection *     seahorse_keyset_pgp_signers_new     (void);
 
 #endif /*SEAPGPKEYSETS_H_*/
diff --git a/pgp/seahorse-pgp-uid.c b/pgp/seahorse-pgp-uid.c
index 01a0d00..44684d8 100644
--- a/pgp/seahorse-pgp-uid.c
+++ b/pgp/seahorse-pgp-uid.c
@@ -36,7 +36,6 @@ enum {
 	PROP_0,
 	PROP_SIGNATURES,
 	PROP_VALIDITY,
-	PROP_VALIDITY_STR,
 	PROP_NAME,
 	PROP_EMAIL,
 	PROP_COMMENT
@@ -244,9 +243,6 @@ seahorse_pgp_uid_get_property (GObject *object, guint prop_id,
 	case PROP_VALIDITY:
 		g_value_set_uint (value, seahorse_pgp_uid_get_validity (self));
 		break;
-	case PROP_VALIDITY_STR:
-		g_value_set_string (value, seahorse_pgp_uid_get_validity_str (self));
-		break;
 	case PROP_NAME:
 		g_value_set_string (value, seahorse_pgp_uid_get_name (self));
 		break;
@@ -321,10 +317,6 @@ seahorse_pgp_uid_class_init (SeahorsePgpUidClass *klass)
 	        g_param_spec_uint ("validity", "Validity", "Validity of this identity",
 	                           0, G_MAXUINT, 0, G_PARAM_READWRITE));
 
-        g_object_class_install_property (gobject_class, PROP_VALIDITY_STR,
-                g_param_spec_string ("validity-str", "Validity String", "Validity of this identity as a string",
-                                     "", G_PARAM_READABLE));
-        
         g_object_class_install_property (gobject_class, PROP_NAME,
                 g_param_spec_string ("name", "Name", "User ID name",
                                      "", G_PARAM_READWRITE));
@@ -397,13 +389,6 @@ seahorse_pgp_uid_set_validity (SeahorsePgpUid *self, SeahorseValidity validity)
 	g_return_if_fail (SEAHORSE_IS_PGP_UID (self));
 	self->pv->validity = validity;
 	g_object_notify (G_OBJECT (self), "validity");
-	g_object_notify (G_OBJECT (self), "validity-str");
-}
-
-const gchar*
-seahorse_pgp_uid_get_validity_str (SeahorsePgpUid *self)
-{
-	return seahorse_validity_get_string (seahorse_pgp_uid_get_validity (self));
 }
 
 const gchar*
diff --git a/pgp/seahorse-pgp-uid.h b/pgp/seahorse-pgp-uid.h
index e5a5d2d..fbad76d 100644
--- a/pgp/seahorse-pgp-uid.h
+++ b/pgp/seahorse-pgp-uid.h
@@ -64,9 +64,6 @@ SeahorseValidity  seahorse_pgp_uid_get_validity         (SeahorsePgpUid *self);
 void              seahorse_pgp_uid_set_validity         (SeahorsePgpUid *self,
                                                          SeahorseValidity validity);
 
-const gchar*      seahorse_pgp_uid_get_validity_str     (SeahorsePgpUid *self);
-
-
 const gchar*      seahorse_pgp_uid_get_name             (SeahorsePgpUid *self);
 
 void              seahorse_pgp_uid_set_name             (SeahorsePgpUid *self,
diff --git a/pgp/seahorse-signer.c b/pgp/seahorse-signer.c
index aacf861..de2b97c 100755
--- a/pgp/seahorse-signer.c
+++ b/pgp/seahorse-signer.c
@@ -40,7 +40,7 @@ SeahorsePgpKey*
 seahorse_signer_get (GtkWindow *parent)
 {
     SeahorseWidget *swidget;
-    SeahorseSet *skset;
+    GcrCollection *collection;
     SeahorseObject *object = NULL;
     GtkWidget *combo;
     GtkWidget *widget;
@@ -51,9 +51,9 @@ seahorse_signer_get (GtkWindow *parent)
     gchar *id;
     guint nkeys;
 
-    skset = seahorse_keyset_pgp_signers_new ();
-    nkeys = seahorse_set_get_count (skset);
-    
+    collection = seahorse_keyset_pgp_signers_new ();
+    nkeys = gcr_collection_get_length (collection);
+
     /* If no signing keys then we can't sign */
     if (nkeys == 0) {
         /* TODO: We should be giving an error message that allows them to 
@@ -65,11 +65,11 @@ seahorse_signer_get (GtkWindow *parent)
     
     /* If only one key (probably default) then return it immediately */
     if (nkeys == 1) {
-        GList *keys = seahorse_set_get_objects (skset);
+        GList *keys = gcr_collection_get_objects (collection);
         object = SEAHORSE_OBJECT (keys->data);
         
         g_list_free (keys);
-        g_object_unref (skset);
+        g_object_unref (collection);
 
         g_assert (SEAHORSE_IS_PGP_KEY (object));
         return SEAHORSE_PGP_KEY (object);
@@ -80,8 +80,8 @@ seahorse_signer_get (GtkWindow *parent)
             
     combo = GTK_WIDGET (seahorse_widget_get_widget (swidget, "signer-select"));
     g_return_val_if_fail (combo != NULL, NULL);
-    seahorse_combo_keys_attach (GTK_COMBO_BOX (combo), skset, NULL);
-    g_object_unref (skset);
+    seahorse_combo_keys_attach (GTK_COMBO_BOX (combo), collection, NULL);
+    g_object_unref (collection);
 
     settings = seahorse_context_pgp_settings (NULL);
 
diff --git a/pkcs11/Makefile.am b/pkcs11/Makefile.am
index eb8e2e2..7adf2d7 100644
--- a/pkcs11/Makefile.am
+++ b/pkcs11/Makefile.am
@@ -10,8 +10,6 @@ INCLUDES = -I$(top_builddir) \
 	-DSEAHORSE_UIDIR=\""$(uidir)"\" \
 	-DLOCALEDIR=\"$(localedir)\" \
 	-DEXECDIR=\""$(seahorselibexecbindir)"\" \
-	-DGCR_API_SUBJECT_TO_CHANGE \
-	-DGCK_API_SUBJECT_TO_CHANGE \
 	-DGETTEXT_PACKAGE=\""seahorse\""
 
 noinst_LTLIBRARIES = libseahorse-pkcs11.la
diff --git a/pkcs11/seahorse-pkcs11-certificate.c b/pkcs11/seahorse-pkcs11-certificate.c
index 76edec4..03f4c13 100644
--- a/pkcs11/seahorse-pkcs11-certificate.c
+++ b/pkcs11/seahorse-pkcs11-certificate.c
@@ -47,11 +47,8 @@ enum {
 	PROP_0,
 	PROP_FINGERPRINT,
 	PROP_VALIDITY,
-	PROP_VALIDITY_STR,
 	PROP_TRUST,
-	PROP_TRUST_STR,
 	PROP_EXPIRES,
-	PROP_EXPIRES_STR
 };
 
 struct _SeahorsePkcs11CertificatePrivate {
@@ -147,11 +144,8 @@ seahorse_pkcs11_certificate_notify (GObject *obj, GParamSpec *pspec)
 	if (g_str_equal (pspec->name, "pkcs11-attributes")) {
 		g_object_notify (obj, "fingerprint");
 		g_object_notify (obj, "validity");
-		g_object_notify (obj, "validity-str");
 		g_object_notify (obj, "trust");
-		g_object_notify (obj, "trust-str");
 		g_object_notify (obj, "expires");
-		g_object_notify (obj, "expires-str");
 	}
 	
 	if (G_OBJECT_CLASS (seahorse_pkcs11_certificate_parent_class)->notify)
@@ -182,21 +176,12 @@ seahorse_pkcs11_certificate_get_property (GObject *obj, guint prop_id, GValue *v
 	case PROP_VALIDITY:
 		g_value_set_uint (value, seahorse_pkcs11_certificate_get_validity (self));
 		break;
-	case PROP_VALIDITY_STR:
-		g_value_set_string (value, seahorse_pkcs11_certificate_get_validity_str (self));
-		break;
 	case PROP_TRUST:
 		g_value_set_uint (value, seahorse_pkcs11_certificate_get_trust (self));
 		break;
-	case PROP_TRUST_STR:
-		g_value_set_string (value, seahorse_pkcs11_certificate_get_trust_str (self));
-		break;
 	case PROP_EXPIRES:
 		g_value_set_ulong (value, seahorse_pkcs11_certificate_get_expires (self));
 		break;
-	case PROP_EXPIRES_STR:
-		g_value_take_string (value, seahorse_pkcs11_certificate_get_expires_str (self));
-		break;
 	default:
 		gcr_certificate_mixin_get_property (obj, prop_id, value, pspec);
 		break;
@@ -235,26 +220,14 @@ seahorse_pkcs11_certificate_class_init (SeahorsePkcs11CertificateClass *klass)
 	g_object_class_install_property (gobject_class, PROP_VALIDITY, 
 	         g_param_spec_uint ("validity", "validity", "validity", 0, G_MAXUINT, 0U, 
 	                            G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
-	
-	g_object_class_install_property (gobject_class, PROP_VALIDITY_STR, 
-	         g_param_spec_string ("validity-str", "validity-str", "validity-str", NULL, 
-	                              G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
-	
+
 	g_object_class_install_property (gobject_class, PROP_TRUST, 
 	         g_param_spec_uint ("trust", "trust", "trust", 0, G_MAXUINT, 0U, 
 	                            G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
-	
-	g_object_class_install_property (gobject_class, PROP_TRUST_STR, 
-	         g_param_spec_string ("trust-str", "trust-str", "trust-str", NULL, 
-	                              G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
-	
+
 	g_object_class_install_property (gobject_class, PROP_EXPIRES, 
 	         g_param_spec_ulong ("expires", "expires", "expires", 0, G_MAXULONG, 0UL, 
 	                             G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
-	
-	g_object_class_install_property (gobject_class, PROP_EXPIRES_STR, 
-	         g_param_spec_string ("expires-str", "expires-str", "expires-str", NULL, 
-	                              G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
 
 	gcr_certificate_mixin_class_init (gobject_class);
 }
@@ -328,13 +301,6 @@ seahorse_pkcs11_certificate_get_validity (SeahorsePkcs11Certificate* self)
 	return SEAHORSE_VALIDITY_UNKNOWN;
 }
 
-const char* 
-seahorse_pkcs11_certificate_get_validity_str (SeahorsePkcs11Certificate* self) 
-{
-	g_return_val_if_fail (SEAHORSE_PKCS11_IS_CERTIFICATE (self), NULL);
-	return seahorse_validity_get_string (seahorse_pkcs11_certificate_get_validity (self));
-}
-
 guint 
 seahorse_pkcs11_certificate_get_trust (SeahorsePkcs11Certificate* self) 
 {
@@ -349,14 +315,6 @@ seahorse_pkcs11_certificate_get_trust (SeahorsePkcs11Certificate* self)
 	return SEAHORSE_VALIDITY_UNKNOWN;
 }
 
-const char* 
-seahorse_pkcs11_certificate_get_trust_str (SeahorsePkcs11Certificate* self) 
-{
-	g_return_val_if_fail (SEAHORSE_PKCS11_IS_CERTIFICATE (self), NULL);
-	return seahorse_validity_get_string (seahorse_pkcs11_certificate_get_trust (self));
-}
-
-
 gulong
 seahorse_pkcs11_certificate_get_expires (SeahorsePkcs11Certificate* self) 
 {
@@ -374,18 +332,3 @@ seahorse_pkcs11_certificate_get_expires (SeahorsePkcs11Certificate* self)
 	g_date_to_struct_tm (&date, &time);
 	return (gulong)(mktime (&time));
 }
-
-char* 
-seahorse_pkcs11_certificate_get_expires_str (SeahorsePkcs11Certificate* self) 
-{
-	gulong expiry;
-	
-	g_return_val_if_fail (SEAHORSE_PKCS11_IS_CERTIFICATE (self), NULL);
-	
-	/* TODO: When expired return Expired */
-	expiry = seahorse_pkcs11_certificate_get_expires (self);
-	if (expiry == 0)
-		return g_strdup ("");
-	return seahorse_util_get_date_string (expiry);
-}
-
diff --git a/pkcs11/seahorse-pkcs11-certificate.h b/pkcs11/seahorse-pkcs11-certificate.h
index aa1b733..e520e12 100644
--- a/pkcs11/seahorse-pkcs11-certificate.h
+++ b/pkcs11/seahorse-pkcs11-certificate.h
@@ -58,14 +58,8 @@ gchar*                      seahorse_pkcs11_certificate_get_fingerprint        (
 
 guint                       seahorse_pkcs11_certificate_get_validity           (SeahorsePkcs11Certificate* self);
 
-const gchar*                seahorse_pkcs11_certificate_get_validity_str       (SeahorsePkcs11Certificate* self);
-
 guint                       seahorse_pkcs11_certificate_get_trust              (SeahorsePkcs11Certificate* self);
 
-const gchar*                seahorse_pkcs11_certificate_get_trust_str          (SeahorsePkcs11Certificate* self);
-
 gulong                      seahorse_pkcs11_certificate_get_expires            (SeahorsePkcs11Certificate* self);
 
-gchar*                      seahorse_pkcs11_certificate_get_expires_str        (SeahorsePkcs11Certificate* self);
-
 #endif /* __SEAHORSE_PKCS11_CERTIFICATE_H__ */
diff --git a/pkcs11/seahorse-pkcs11-commands.c b/pkcs11/seahorse-pkcs11-commands.c
index c8573b9..77f7f1c 100644
--- a/pkcs11/seahorse-pkcs11-commands.c
+++ b/pkcs11/seahorse-pkcs11-commands.c
@@ -48,7 +48,7 @@ G_DEFINE_TYPE (SeahorsePkcs11Commands, seahorse_pkcs11_commands, SEAHORSE_TYPE_C
 #define SEAHORSE_PKCS11_COMMANDS_GET_PRIVATE(o) \
 	(G_TYPE_INSTANCE_GET_PRIVATE ((o), SEAHORSE_PKCS11_TYPE_COMMANDS, SeahorsePkcs11CommandsPrivate))
 
-static SeahorseObjectPredicate commands_predicate = { 0, };
+static SeahorsePredicate commands_predicate = { 0, };
 
 /* -----------------------------------------------------------------------------
  * INTERNAL 
diff --git a/pkcs11/seahorse-pkcs11-operations.c b/pkcs11/seahorse-pkcs11-operations.c
index 97fec38..85b4fcf 100644
--- a/pkcs11/seahorse-pkcs11-operations.c
+++ b/pkcs11/seahorse-pkcs11-operations.c
@@ -26,7 +26,6 @@
 #include "seahorse-pkcs11-operations.h"
 #include "seahorse-pkcs11-source.h"
 
-#include "seahorse-object-list.h"
 #include "seahorse-progress.h"
 
 #include <gck/gck.h>
diff --git a/src/seahorse-key-manager-store.c b/src/seahorse-key-manager-store.c
index 5b573ac..4a7757c 100644
--- a/src/seahorse-key-manager-store.c
+++ b/src/seahorse-key-manager-store.c
@@ -48,33 +48,74 @@ enum {
 	PROP_SETTINGS
 };
 
+static void
+on_transform_validity_to_string (const GValue *source,
+                                 GValue *dest)
+{
+	g_return_if_fail (G_VALUE_TYPE (source) == G_TYPE_UINT);
+	g_value_set_string (dest, seahorse_validity_get_string (g_value_get_uint (source)));
+}
+
+static void
+on_transform_trust_to_string (const GValue *source,
+                              GValue *dest)
+{
+	g_return_if_fail (G_VALUE_TYPE (source) == G_TYPE_UINT);
+	g_value_set_string (dest, seahorse_validity_get_string (g_value_get_uint (source)));
+}
+
+static void
+on_transform_expires_to_string (const GValue *source,
+                                GValue *dest)
+{
+	GTimeVal timeval;
+	gulong expires;
+
+	g_return_if_fail (G_VALUE_TYPE (source) == G_TYPE_ULONG);
+	expires = g_value_get_ulong (source);
+
+	if (expires == 0) {
+		g_value_set_string (dest, "");
+	} else {
+		g_get_current_time (&timeval);
+		if (timeval.tv_sec > expires) {
+			g_value_set_string (dest, _("Expired"));
+		} else {
+			g_value_take_string (dest, seahorse_util_get_date_string (expires));
+		}
+	}
+}
+
 enum {
-    COL_USAGE,
-    COL_ICON,
-    COL_NAME,
-    COL_KEYID,
-    COL_VALIDITY_STR,
-    COL_TRUST_STR,
-    COL_TYPE,
-    COL_EXPIRES_STR,
-    COL_VALIDITY,
-    COL_EXPIRES,
-    COL_TRUST,
-    N_COLS
+	COL_ICON,
+	COL_USAGE,
+	COL_NAME,
+	COL_KEYID,
+	COL_VALIDITY,
+	COL_TRUST,
+	COL_TYPE,
+	COL_EXPIRES,
+	N_COLS
 };
 
-static SeahorseSetModelColumn column_info[] = {
-	{ "usage", G_TYPE_UINT, "usage" },
-	{ "icon", 0 /* later */, NULL },
-	{ "markup", G_TYPE_STRING, "label" },
-	{ "identifier", G_TYPE_STRING, "id" },
-	{ "validity-str", G_TYPE_STRING, "validity" },
-	{ "trust-str", G_TYPE_STRING, "trust" },
-	{ "type", G_TYPE_STRING, "type" },
-	{ "expires-str", G_TYPE_STRING, "expires" },
-	{ "validity", G_TYPE_UINT, "validity" },
-	{ "expires", G_TYPE_ULONG, "expires" },
-	{ "trust", G_TYPE_UINT, "trust" }
+static GcrColumn columns[] = {
+	{ "icon", /* later */ 0, /* later */ 0, NULL,
+	  0, NULL, NULL },
+	{ "usage", G_TYPE_UINT, G_TYPE_UINT, NULL,
+	  GCR_COLUMN_SORTABLE, NULL, "usage" },
+	{ "markup", G_TYPE_STRING, G_TYPE_STRING, NULL,
+	  GCR_COLUMN_SORTABLE, NULL, "label" },
+	{ "identifier", G_TYPE_STRING, G_TYPE_STRING, NULL,
+	  GCR_COLUMN_SORTABLE, NULL, "id" },
+	{ "validity", G_TYPE_UINT, G_TYPE_STRING, NULL,
+	  GCR_COLUMN_SORTABLE, on_transform_validity_to_string, "validity" },
+	{ "trust", G_TYPE_UINT, G_TYPE_STRING, NULL,
+	  GCR_COLUMN_SORTABLE, on_transform_trust_to_string, "trust" },
+	{ "type", G_TYPE_STRING, G_TYPE_STRING, NULL,
+	  GCR_COLUMN_SORTABLE, NULL, "type" },
+	{ "expires", G_TYPE_ULONG, G_TYPE_STRING, NULL,
+	  GCR_COLUMN_SORTABLE, on_transform_expires_to_string, "expires" },
+	{ NULL }
 };
 
 enum {
@@ -93,8 +134,6 @@ static GtkTargetEntry store_targets[] = {
 };
 
 struct _SeahorseKeyManagerStorePriv {
-	GtkTreeModelFilter *filter;
-	GtkTreeModelSort *sort;
 	GSettings *settings;
 
     SeahorseKeyManagerStoreMode    filter_mode;
@@ -106,165 +145,88 @@ struct _SeahorseKeyManagerStorePriv {
 	GList *drag_objects;
 };
 
-G_DEFINE_TYPE (SeahorseKeyManagerStore, seahorse_key_manager_store, SEAHORSE_TYPE_SET_MODEL);
-
-/* -----------------------------------------------------------------------------
- * INTERNAL 
- */
+G_DEFINE_TYPE (SeahorseKeyManagerStore, seahorse_key_manager_store, GCR_TYPE_COLLECTION_MODEL);
 
-/* Given a treeview iter, get the base store iterator */
-static void 
-get_base_iter (SeahorseKeyManagerStore *skstore, GtkTreeIter *base_iter, 
-               const GtkTreeIter *iter)
+/* Search through row for text */
+static gboolean
+object_contains_filtered_text (SeahorseObject *object,
+                               const gchar* text)
 {
-	GtkTreeIter i;
-	g_return_if_fail (skstore->priv->sort && skstore->priv->filter);
-	gtk_tree_model_sort_convert_iter_to_child_iter (skstore->priv->sort, &i, (GtkTreeIter*)iter);
-	gtk_tree_model_filter_convert_iter_to_child_iter (skstore->priv->filter, base_iter, &i);
-}
+	gchar* name = NULL;
+	gchar* id = NULL;
+	gchar* lower;
+	gboolean ret = FALSE;
 
-/* Given a base store iter, get the treeview iter */
-static gboolean 
-get_upper_iter (SeahorseKeyManagerStore *skstore, GtkTreeIter *upper_iter, 
-                const GtkTreeIter *iter)
-{
-    GtkTreeIter i;
-    GtkTreePath *child_path, *path;
-    gboolean ret;
-    
-    g_return_val_if_fail (skstore->priv->filter, FALSE);
-    child_path = gtk_tree_model_get_path (gtk_tree_model_filter_get_model (skstore->priv->filter), 
-                                          (GtkTreeIter*)iter);
-    g_return_val_if_fail (child_path != NULL, FALSE);
-    path = gtk_tree_model_filter_convert_child_path_to_path (skstore->priv->filter, child_path);
-    gtk_tree_path_free (child_path);
-
-    if (!path)
-        return FALSE;
-
-    ret = gtk_tree_model_get_iter (GTK_TREE_MODEL (skstore->priv->filter), &i, path);
-    gtk_tree_path_free (path);
-    
-    if (!ret)
-        return FALSE;
-  
-    g_return_val_if_fail (skstore->priv->sort, FALSE);
-    gtk_tree_model_sort_convert_child_iter_to_iter (skstore->priv->sort, upper_iter, &i);
-    return TRUE;
-}
+	/* Empty search text results in a match */
+	if (!text || !text[0])
+		return TRUE;
 
-/* Try to find our key store given a tree model */
-static SeahorseKeyManagerStore* 
-key_store_from_model (GtkTreeModel *model)
-{
-    /* Sort models are what's set on the tree */
-    if (GTK_IS_TREE_MODEL_SORT (model))
-        model = gtk_tree_model_sort_get_model (GTK_TREE_MODEL_SORT (model));
-    if (GTK_IS_TREE_MODEL_FILTER (model)) 
-        model = gtk_tree_model_filter_get_model (GTK_TREE_MODEL_FILTER (model));
-    if (SEAHORSE_IS_KEY_MANAGER_STORE (model))
-        return SEAHORSE_KEY_MANAGER_STORE (model);
-    
-    g_return_val_if_reached (NULL);
-}
+	g_object_get (object, "label", &name, NULL);
+	if (name != NULL) {
+		lower = g_utf8_strdown (name, -1);
+		if (strstr (lower, text))
+			ret = TRUE;
+		g_free (lower);
+		g_free (name);
+	}
 
-/* Given an iterator find the associated object */
-static SeahorseObject*
-object_from_iterator (GtkTreeModel* model, GtkTreeIter* iter)
-{
-	GtkTreeIter i;
-    
-	/* Convert to base iter if necessary */
-	if (!SEAHORSE_IS_KEY_MANAGER_STORE (model)) {
-		SeahorseKeyManagerStore* skstore = key_store_from_model (model);
-		g_return_val_if_fail (SEAHORSE_IS_KEY_MANAGER_STORE (skstore), NULL);
-		get_base_iter (skstore, &i, iter);
-        
-		iter = &i;
-		model = GTK_TREE_MODEL (skstore);
+	if (!ret && g_object_class_find_property (G_OBJECT_GET_CLASS (object), "identifier")) {
+		g_object_get (object, "identifier", &id, NULL);
+		if (id != NULL) {
+			lower = g_utf8_strdown (id, -1);
+			if (strstr (lower, text))
+				ret = TRUE;
+			g_free (lower);
+			g_free (id);
+		}
 	}
-    
-	return seahorse_set_model_object_for_iter (SEAHORSE_SET_MODEL (model), iter);
-}
 
-/* Search through row for text */
-static gboolean
-row_contains_filtered_text (GtkTreeModel* model, GtkTreeIter* iter, const gchar* text)
-{
-    gchar* name = NULL;
-    gchar* id = NULL;
-    gchar* t;
-    gboolean ret = FALSE;
-    
-    /* Empty search text results in a match */
-    if (!text || !text[0])
-        return TRUE;
-    
-    /* Note that we only search the name and id */
-    gtk_tree_model_get (model, iter, COL_NAME, &name, COL_KEYID, &id, -1);
-    
-    if(name) {
-        t = g_utf8_strdown (name, -1);
-        if (strstr (t, text))
-            ret = TRUE;
-        g_free (t);
-    }
-    
-    if (!ret && id) {
-        t = g_utf8_strdown (id, -1);
-        if (strstr (t, text))
-            ret = TRUE;
-        g_free (t);
-    }
-    
-    g_free (name);
-    g_free (id);
-    return ret;
+	return ret;
 }
 
 /* Called to filter each row */
-static gboolean 
-filter_callback (GtkTreeModel *model, GtkTreeIter *iter, gpointer data)
+static gboolean
+on_filter_visible (SeahorseObject *object,
+                   gpointer user_data)
 {
-    SeahorseKeyManagerStore* skstore = SEAHORSE_KEY_MANAGER_STORE(data);
-    GtkTreeIter child;
-    gboolean ret = FALSE;
-    
-    /* Check the row requested */
-    switch (skstore->priv->filter_mode)
-    {
-    case KEY_STORE_MODE_FILTERED:
-        ret = row_contains_filtered_text (model, iter, skstore->priv->filter_text);
-        break;
-        
-    case KEY_STORE_MODE_ALL:
-        ret = TRUE;
-        break;
-        
-    default:
-        g_assert_not_reached ();
-        break;
-    };
-    
-    /* If current is not being shown, double check with children */
-    if (!ret && gtk_tree_model_iter_children (model, &child, iter)) {
-        do {
-            ret = filter_callback (model, &child, data);
-        } while (!ret && gtk_tree_model_iter_next (model, &child));
-    }
+	SeahorseKeyManagerStore* self = SEAHORSE_KEY_MANAGER_STORE (user_data);
+	GList *children, *l;
+	gboolean ret = FALSE;
+
+	/* Check the row requested */
+	switch (self->priv->filter_mode) {
+	case KEY_STORE_MODE_FILTERED:
+		ret = object_contains_filtered_text (object, self->priv->filter_text);
+		break;
+
+	case KEY_STORE_MODE_ALL:
+		ret = TRUE;
+		break;
+
+	default:
+		g_assert_not_reached ();
+		break;
+	};
+
+	/* If current is not being shown, double check with children */
+	if (!ret && GCR_IS_COLLECTION (object)) {
+		children = gcr_collection_get_objects (GCR_COLLECTION (object));
+		for (l = children; !ret && l != NULL; l = g_list_next (l))
+			ret = on_filter_visible (l->data, user_data);
+	}
 
-    return ret;
+	return ret;
 }
 
 /* Refilter the tree */
 static gboolean
-refilter_now (SeahorseKeyManagerStore* skstore)
+refilter_now (gpointer user_data)
 {
-    g_return_val_if_fail (skstore->priv->filter, FALSE);
-    seahorse_set_refresh (SEAHORSE_SET_MODEL (skstore)->set);
-    gtk_tree_model_filter_refilter (skstore->priv->filter);    
-    skstore->priv->filter_stag = 0;
-    return FALSE;
+	SeahorseKeyManagerStore* self = SEAHORSE_KEY_MANAGER_STORE (user_data);
+	GcrCollection *collection = gcr_collection_model_get_collection (GCR_COLLECTION_MODEL (self));
+	seahorse_collection_refresh (SEAHORSE_COLLECTION (collection));
+	self->priv->filter_stag = 0;
+	return FALSE;
 }
 
 /* Refilter the tree after a timeout has passed */
@@ -280,7 +242,6 @@ refilter_later (SeahorseKeyManagerStore* skstore)
 static void
 set_sort_to (SeahorseKeyManagerStore *skstore, const gchar *name)
 {
-    GtkTreeSortable* sort;
     gint i, id = -1;
     GtkSortType ord = GTK_SORT_ASCENDING;
     const gchar* n;
@@ -301,39 +262,36 @@ set_sort_to (SeahorseKeyManagerStore *skstore, const gchar *name)
     
     /* Find the column sort id */
     for (i = N_COLS - 1; i >= 0 ; i--) {
-        n = column_info[i].data;
+        n = columns[i].user_data;
         if (n && g_ascii_strcasecmp (name, n) == 0) {
             id = i;
             break;
         }
     }
-    
-    if (id != -1) {
-        g_return_if_fail (skstore->priv->sort);
-        sort = GTK_TREE_SORTABLE (skstore->priv->sort);
-        gtk_tree_sortable_set_sort_column_id (sort, id, ord);
-    }
+
+    if (id != -1)
+        gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (skstore), id, ord);
 }
 
 /* Called when the column sort is changed */
 static void
-sort_changed (GtkTreeSortable *sort, gpointer user_data)
+on_sort_column_changed (GtkTreeSortable *sort,
+                        gpointer user_data)
 {
 	SeahorseKeyManagerStore *self = SEAHORSE_KEY_MANAGER_STORE (user_data);
 	GtkSortType ord;
 	gchar* value;
 	gint column_id;
 
-	g_return_if_fail (self->priv->sort);
 	if (!self->priv->settings)
 		return;
 
 	/* We have a sort so save it */
-	if (gtk_tree_sortable_get_sort_column_id (sort, &column_id, &ord)) {
+	if (gtk_tree_sortable_get_sort_column_id (GTK_TREE_SORTABLE (self), &column_id, &ord)) {
 		if (column_id >= 0 && column_id < N_COLS) {
-			if (column_info[column_id].data != NULL) {
+			if (columns[column_id].user_data != NULL) {
 				value = g_strconcat (ord == GTK_SORT_DESCENDING ? "-" : "",
-				                     column_info[column_id].data, NULL);
+				                     columns[column_id].user_data, NULL);
 				g_settings_set_string (self->priv->settings, "sort-by", value);
 				g_free (value);
 			}
@@ -356,7 +314,7 @@ on_manager_settings_changed (GSettings *settings, const gchar *key, gpointer use
 	gchar *sort_by;
 
 	if (g_str_equal (key, "sort-by")) {
-		self = key_store_from_model (gtk_tree_view_get_model (view));
+		self = SEAHORSE_KEY_MANAGER_STORE (gtk_tree_view_get_model (view));
 		g_return_if_fail (SEAHORSE_IS_KEY_MANAGER_STORE (self));
 		sort_by = g_settings_get_string (settings, key);
 		set_sort_to (self, sort_by);
@@ -719,17 +677,8 @@ seahorse_key_manager_store_finalize (GObject *gobject)
 {
     SeahorseKeyManagerStore *skstore = SEAHORSE_KEY_MANAGER_STORE (gobject);
 
-    if (skstore->priv->sort) {
-        g_signal_handlers_disconnect_by_func (skstore->priv->sort, sort_changed, skstore);
-        g_object_remove_weak_pointer (G_OBJECT (skstore->priv->sort), (gpointer*)&skstore->priv->sort);
-        skstore->priv->sort = NULL;
-    }
-    
-    if (skstore->priv->filter) {
-        g_object_remove_weak_pointer (G_OBJECT (skstore->priv->filter), (gpointer*)&skstore->priv->filter);
-        skstore->priv->filter = NULL;
-    }
-     
+    g_signal_handlers_disconnect_by_func (skstore, on_sort_column_changed, skstore);
+
     /* Allocated in property setter */
     g_free (skstore->priv->filter_text); 
     
@@ -739,28 +688,31 @@ seahorse_key_manager_store_finalize (GObject *gobject)
 static void
 seahorse_key_manager_store_class_init (SeahorseKeyManagerStoreClass *klass)
 {
-    GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-    seahorse_key_manager_store_parent_class = g_type_class_peek_parent (klass);
-    
-    /* Some simple checks to make sure all column info is on the same page */
-    g_assert (N_COLS == G_N_ELEMENTS (column_info));
-    column_info[1].type = G_TYPE_ICON;
-
-    gobject_class->finalize = seahorse_key_manager_store_finalize;
-    gobject_class->set_property = seahorse_key_manager_store_set_property;
-    gobject_class->get_property = seahorse_key_manager_store_get_property;
-  
-    g_object_class_install_property (gobject_class, PROP_MODE,
-        g_param_spec_uint ("mode", "Key Store Mode", "Key store mode controls which keys to display",
-                           0, KEY_STORE_MODE_FILTERED, KEY_STORE_MODE_ALL, G_PARAM_READWRITE));
-
-    g_object_class_install_property (gobject_class, PROP_FILTER,
-        g_param_spec_string ("filter", "Key Store Filter", "Key store filter for when in filtered mode",
-                             "", G_PARAM_READWRITE));
-
-    g_object_class_install_property (gobject_class, PROP_SETTINGS,
-        g_param_spec_object ("settings", "Settings", "Manager Settings",
-                             G_TYPE_SETTINGS, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+	GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+
+	columns[COL_ICON].column_type = G_TYPE_ICON;
+	columns[COL_ICON].property_type = G_TYPE_ICON;
+
+	gobject_class->finalize = seahorse_key_manager_store_finalize;
+	gobject_class->set_property = seahorse_key_manager_store_set_property;
+	gobject_class->get_property = seahorse_key_manager_store_get_property;
+
+	g_object_class_install_property (gobject_class, PROP_MODE,
+	        g_param_spec_uint ("mode", "Key Store Mode", "Key store mode controls which keys to display",
+	                           0, KEY_STORE_MODE_FILTERED, KEY_STORE_MODE_ALL, G_PARAM_READWRITE));
+
+	g_object_class_install_property (gobject_class, PROP_FILTER,
+	        g_param_spec_string ("filter", "Key Store Filter", "Key store filter for when in filtered mode",
+	                             "", G_PARAM_READWRITE));
+
+	g_object_class_install_property (gobject_class, PROP_SETTINGS,
+	        g_param_spec_object ("settings", "Settings", "Manager Settings",
+	                             G_TYPE_SETTINGS, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+
+	/* Couldn't initialize this earlier */
+	g_assert (N_COLS + 1 == G_N_ELEMENTS (columns));
+	columns[0].property_type = G_TYPE_ICON;
+	columns[0].column_type = G_TYPE_ICON;
 }
 
 /* -----------------------------------------------------------------------------
@@ -768,110 +720,111 @@ seahorse_key_manager_store_class_init (SeahorseKeyManagerStoreClass *klass)
  */
 
 SeahorseKeyManagerStore*
-seahorse_key_manager_store_new (SeahorseSet *skset, GtkTreeView *view, GSettings *settings)
+seahorse_key_manager_store_new (SeahorseCollection *collection,
+                                GtkTreeView *view,
+                                GSettings *settings)
 {
-    SeahorseKeyManagerStore *skstore;
-    GtkTreeViewColumn *col;
-    SeahorseObjectPredicate *pred;
-    GtkCellRenderer *renderer;
-    gchar *sort_by;
-    gint last;
-
-    skstore = g_object_new (SEAHORSE_TYPE_KEY_MANAGER_STORE, "set", skset, "settings", settings, NULL);
-    last = seahorse_set_model_set_columns (SEAHORSE_SET_MODEL (skstore), column_info, N_COLS);
-    g_return_val_if_fail (last == N_COLS - 1, NULL);
-
-    /* Setup the sort and filter */
-    skstore->priv->filter = GTK_TREE_MODEL_FILTER (gtk_tree_model_filter_new (GTK_TREE_MODEL (skstore), NULL));
-    gtk_tree_model_filter_set_visible_func (skstore->priv->filter, filter_callback, skstore, NULL);
-    skstore->priv->sort = GTK_TREE_MODEL_SORT (gtk_tree_model_sort_new_with_model (GTK_TREE_MODEL (skstore->priv->filter)));
-
-    /* The sorted model is the top level model */
-    gtk_tree_view_set_model (view, GTK_TREE_MODEL (skstore->priv->sort));
-
-    /* add the icon column */
-    renderer = gtk_cell_renderer_pixbuf_new ();
-    g_object_set (renderer, "stock-size", GTK_ICON_SIZE_LARGE_TOOLBAR, NULL);
-    g_object_set (renderer, "xpad", 6, NULL);
-    col = gtk_tree_view_column_new_with_attributes ("", renderer, "gicon", COL_ICON, NULL);
-    gtk_tree_view_column_set_resizable (col, FALSE);
-    gtk_tree_view_append_column (view, col);
-    gtk_tree_view_column_set_sort_column_id (col, COL_USAGE);
-    
-    /* Name column */
-    renderer = gtk_cell_renderer_text_new ();
-    col = gtk_tree_view_column_new_with_attributes (_("Name"), renderer, "markup", COL_NAME, NULL);
-    gtk_tree_view_column_set_resizable (col, TRUE);
-    gtk_tree_view_column_set_expand (col, TRUE);
-    gtk_tree_view_append_column (view, col);
-    gtk_tree_view_set_expander_column (view, col);
-    gtk_tree_view_column_set_sort_column_id (col, COL_NAME);
-
-    /* Use predicate to figure out which columns to add */
-    g_object_get (skset, "predicate", &pred, NULL);
-    
-    /* Key ID column, don't show for passwords */
-    if (pred->usage != SEAHORSE_USAGE_CREDENTIALS) {
-        col = append_text_column (skstore, view, _("Key ID"), COL_KEYID);
-        gtk_tree_view_column_set_sort_column_id (col, COL_KEYID);
-    }
+	SeahorseKeyManagerStore *self;
+	GtkTreeViewColumn *col;
+	SeahorsePredicate *pred;
+	GtkCellRenderer *renderer;
+	gchar *sort_by;
+	guint last;
+
+	self = g_object_new (SEAHORSE_TYPE_KEY_MANAGER_STORE,
+	                     "collection", collection,
+	                     "settings", settings,
+	                     NULL);
+	last = gcr_collection_model_set_columns (GCR_COLLECTION_MODEL (self), columns);
+	g_return_val_if_fail (last == N_COLS, NULL);
+
+	/* We assume we're the only user for this collection :( */
+	pred = seahorse_collection_get_predicate (collection);
+	g_assert (pred->custom == NULL);
+	pred->custom = on_filter_visible;
+	pred->custom_target = self;
+
+	/* The sorted model is the top level model */
+	gtk_tree_view_set_model (view, GTK_TREE_MODEL (self));
+
+	/* add the icon column */
+	renderer = gtk_cell_renderer_pixbuf_new ();
+	g_object_set (renderer, "stock-size", GTK_ICON_SIZE_LARGE_TOOLBAR, NULL);
+	g_object_set (renderer, "xpad", 6, NULL);
+	col = gtk_tree_view_column_new_with_attributes ("", renderer, "gicon", COL_ICON, NULL);
+	gtk_tree_view_column_set_resizable (col, FALSE);
+	gtk_tree_view_append_column (view, col);
+	gtk_tree_view_column_set_sort_column_id (col, COL_USAGE);
+
+	/* Name column */
+	renderer = gtk_cell_renderer_text_new ();
+	col = gtk_tree_view_column_new_with_attributes (_("Name"), renderer, "markup", COL_NAME, NULL);
+	gtk_tree_view_column_set_resizable (col, TRUE);
+	gtk_tree_view_column_set_expand (col, TRUE);
+	gtk_tree_view_append_column (view, col);
+	gtk_tree_view_set_expander_column (view, col);
+	gtk_tree_view_column_set_sort_column_id (col, COL_NAME);
+
+	/* Use predicate to figure out which columns to add */
+	pred = seahorse_collection_get_predicate (collection);
+	g_return_val_if_fail (pred != NULL, NULL);
+
+	/* Key ID column, don't show for passwords */
+	if (pred->usage != SEAHORSE_USAGE_CREDENTIALS) {
+		col = append_text_column (self, view, _("Key ID"), COL_KEYID);
+		gtk_tree_view_column_set_sort_column_id (col, COL_KEYID);
+	}
 
-    /* Public keys show validity */
-    if (pred->usage == SEAHORSE_USAGE_PUBLIC_KEY) {
-        col = append_text_column (skstore, view, _("Validity"), COL_VALIDITY_STR);
-        g_object_set_data (G_OBJECT (col), "settings-key", "show-validity");
-        gtk_tree_view_column_set_visible (col, g_settings_get_boolean (settings, "show-validity"));
-        gtk_tree_view_column_set_sort_column_id (col, COL_VALIDITY);
-    }
+	/* Public keys show validity */
+	if (pred->usage == SEAHORSE_USAGE_PUBLIC_KEY) {
+		col = append_text_column (self, view, _("Validity"), COL_VALIDITY);
+		g_object_set_data (G_OBJECT (col), "settings-key", "show-validity");
+		gtk_tree_view_column_set_visible (col, g_settings_get_boolean (settings, "show-validity"));
+		gtk_tree_view_column_set_sort_column_id (col, COL_VALIDITY);
+	}
 
-    /* Trust column */
-    col = append_text_column (skstore, view, _("Trust"), COL_TRUST_STR);
-    g_object_set_data (G_OBJECT (col), "settings-key", "show-trust");
-    gtk_tree_view_column_set_visible (col, g_settings_get_boolean (settings, "show-trust"));
-    gtk_tree_view_column_set_sort_column_id (col, COL_TRUST);
-
-    /* The key type column */
-    col = append_text_column (skstore, view, _("Type"), COL_TYPE);
-    g_object_set_data (G_OBJECT (col), "settings-key", "show-type");
-    gtk_tree_view_column_set_visible (col, g_settings_get_boolean (settings, "show-type"));
-    gtk_tree_view_column_set_sort_column_id (col, COL_TYPE);
-
-    /* Expiry date column */
-    col = append_text_column (skstore, view, _("Expiration Date"), COL_EXPIRES_STR);
-    g_object_set_data (G_OBJECT (col), "settings-key", "show-expiry");
-    gtk_tree_view_column_set_visible (col, g_settings_get_boolean (settings, "show-expiry"));
-    gtk_tree_view_column_set_sort_column_id (col, COL_EXPIRES);
-
-    /* Also watch for sort-changed on the store */
-    g_signal_connect (skstore->priv->sort, "sort-column-changed", G_CALLBACK (sort_changed), skstore);
-
-    /* Update sort order in case the sorted column was added */
-    if ((sort_by = g_settings_get_string (settings, "sort-by")) != NULL) {
-        set_sort_to (skstore, sort_by);
-        g_free (sort_by);
-    } 
-    
-    gtk_tree_view_set_enable_search (view, FALSE);
+	/* Trust column */
+	col = append_text_column (self, view, _("Trust"), COL_TRUST);
+	g_object_set_data (G_OBJECT (col), "settings-key", "show-trust");
+	gtk_tree_view_column_set_visible (col, g_settings_get_boolean (settings, "show-trust"));
+	gtk_tree_view_column_set_sort_column_id (col, COL_TRUST);
+
+	/* The key type column */
+	col = append_text_column (self, view, _("Type"), COL_TYPE);
+	g_object_set_data (G_OBJECT (col), "settings-key", "show-type");
+	gtk_tree_view_column_set_visible (col, g_settings_get_boolean (settings, "show-type"));
+	gtk_tree_view_column_set_sort_column_id (col, COL_TYPE);
+
+	/* Expiry date column */
+	col = append_text_column (self, view, _("Expiration Date"), COL_EXPIRES);
+	g_object_set_data (G_OBJECT (col), "settings-key", "show-expiry");
+	gtk_tree_view_column_set_visible (col, g_settings_get_boolean (settings, "show-expiry"));
+	gtk_tree_view_column_set_sort_column_id (col, COL_EXPIRES);
+
+	/* Also watch for sort-changed on the store */
+	g_signal_connect (self, "sort-column-changed", G_CALLBACK (on_sort_column_changed), self);
+
+	/* Update sort order in case the sorted column was added */
+	if ((sort_by = g_settings_get_string (settings, "sort-by")) != NULL) {
+		set_sort_to (self, sort_by);
+		g_free (sort_by);
+	}
 
-    g_signal_connect_object (settings, "changed", G_CALLBACK (on_manager_settings_changed), view, 0);
+	gtk_tree_view_set_enable_search (view, FALSE);
 
-    /* Tree drag */
-    egg_tree_multi_drag_add_drag_support (view);    
-    
-    g_signal_connect (G_OBJECT (view), "drag_data_get", G_CALLBACK (drag_data_get), skstore);
-    g_signal_connect (G_OBJECT (view), "drag_begin",  G_CALLBACK (drag_begin), skstore);
-    g_signal_connect (G_OBJECT (view), "drag_end",  G_CALLBACK (drag_end), skstore);
-
-    gtk_drag_source_set (GTK_WIDGET (view), GDK_BUTTON1_MASK,
-                         store_targets, G_N_ELEMENTS (store_targets), GDK_ACTION_COPY);
-
-    /* We keep track of these but not as a strong reference */
-    g_object_add_weak_pointer (G_OBJECT (skstore->priv->filter), (gpointer*)&skstore->priv->filter);
-    g_object_unref (skstore->priv->filter);
-    g_object_add_weak_pointer (G_OBJECT (skstore->priv->sort), (gpointer*)&skstore->priv->sort);
-    g_object_unref (skstore->priv->sort);
-    
-    return skstore;
+	g_signal_connect_object (settings, "changed", G_CALLBACK (on_manager_settings_changed), view, 0);
+
+	/* Tree drag */
+	egg_tree_multi_drag_add_drag_support (view);
+
+	g_signal_connect (G_OBJECT (view), "drag_data_get", G_CALLBACK (drag_data_get), self);
+	g_signal_connect (G_OBJECT (view), "drag_begin",  G_CALLBACK (drag_begin), self);
+	g_signal_connect (G_OBJECT (view), "drag_end",  G_CALLBACK (drag_end), self);
+
+	gtk_drag_source_set (GTK_WIDGET (view), GDK_BUTTON1_MASK,
+	                     store_targets, G_N_ELEMENTS (store_targets), GDK_ACTION_COPY);
+
+	return self;
 }
 
 SeahorseObject*
@@ -885,7 +838,7 @@ seahorse_key_manager_store_get_object_from_path (GtkTreeView *view, GtkTreePath
     
     model = gtk_tree_view_get_model (view);
     g_return_val_if_fail (gtk_tree_model_get_iter (model, &iter, path), NULL);
-    return object_from_iterator (model, &iter);
+    return SEAHORSE_OBJECT (gcr_collection_model_object_for_iter (GCR_COLLECTION_MODEL (model), &iter));
 }
 
 GList*
@@ -894,9 +847,9 @@ seahorse_key_manager_store_get_all_objects (GtkTreeView *view)
     SeahorseKeyManagerStore* skstore;
     
     g_return_val_if_fail (GTK_IS_TREE_VIEW (view), NULL);
-    skstore = key_store_from_model (gtk_tree_view_get_model (view));
+    skstore = SEAHORSE_KEY_MANAGER_STORE (gtk_tree_view_get_model (view));
     g_return_val_if_fail (SEAHORSE_IS_KEY_MANAGER_STORE (skstore), NULL);
-    return seahorse_set_get_objects (SEAHORSE_SET_MODEL (skstore)->set);
+    return gcr_collection_get_objects (gcr_collection_model_get_collection (GCR_COLLECTION_MODEL (skstore)));
 }
 
 GList*
@@ -909,7 +862,7 @@ seahorse_key_manager_store_get_selected_objects (GtkTreeView *view)
     GtkTreeSelection *selection;    
     
     g_return_val_if_fail (GTK_IS_TREE_VIEW (view), NULL);
-    skstore = key_store_from_model (gtk_tree_view_get_model (view));
+    skstore = SEAHORSE_KEY_MANAGER_STORE (gtk_tree_view_get_model (view));
     g_return_val_if_fail (SEAHORSE_IS_KEY_MANAGER_STORE (skstore), NULL);
     
     selection = gtk_tree_view_get_selection (view);
@@ -949,25 +902,21 @@ seahorse_key_manager_store_set_selected_objects (GtkTreeView *view, GList* objec
 	g_return_if_fail (GTK_IS_TREE_VIEW (view));
 	selection = gtk_tree_view_get_selection (view);
 	gtk_tree_selection_unselect_all (selection);
-    
-	skstore = key_store_from_model (gtk_tree_view_get_model (view));
+
+	skstore = SEAHORSE_KEY_MANAGER_STORE (gtk_tree_view_get_model (view));
 	g_return_if_fail (SEAHORSE_IS_KEY_MANAGER_STORE (skstore));
     
 	for (l = objects; l; l = g_list_next (l)) {
-		if (seahorse_set_model_iter_for_object (SEAHORSE_SET_MODEL (skstore), 
-		                                        SEAHORSE_OBJECT (l->data), &iter)) {
-			/* And select them ... */
-			if (get_upper_iter (skstore, &upper, &iter)) {
-
-				gtk_tree_selection_select_iter (selection, &upper);
-		                
-				/* Scroll the first row selected into view */
-				if (first) {
-					path = gtk_tree_model_get_path (gtk_tree_view_get_model (view), &upper);
-					gtk_tree_view_scroll_to_cell (view, path, NULL, FALSE, 0.0, 0.0);
-					gtk_tree_path_free (path);
-					first = FALSE;
-				}
+		if (gcr_collection_model_iter_for_object (GCR_COLLECTION_MODEL (skstore),
+		                                          l->data, &iter)) {
+			gtk_tree_selection_select_iter (selection, &upper);
+
+			/* Scroll the first row selected into view */
+			if (first) {
+				path = gtk_tree_model_get_path (gtk_tree_view_get_model (view), &upper);
+				gtk_tree_view_scroll_to_cell (view, path, NULL, FALSE, 0.0, 0.0);
+				gtk_tree_path_free (path);
+				first = FALSE;
 			}
 		}
 	}
@@ -982,7 +931,7 @@ seahorse_key_manager_store_get_selected_object (GtkTreeView *view)
 	GtkTreeSelection *selection;
     
 	g_return_val_if_fail (GTK_IS_TREE_VIEW (view), NULL);
-	skstore = key_store_from_model (gtk_tree_view_get_model (view));
+	skstore = SEAHORSE_KEY_MANAGER_STORE (gtk_tree_view_get_model (view));
 	g_return_val_if_fail (SEAHORSE_IS_KEY_MANAGER_STORE (skstore), NULL);
     
 	selection = gtk_tree_view_get_selection (view);
diff --git a/src/seahorse-key-manager-store.h b/src/seahorse-key-manager-store.h
index 11c627c..36c1856 100644
--- a/src/seahorse-key-manager-store.h
+++ b/src/seahorse-key-manager-store.h
@@ -23,11 +23,11 @@
 #ifndef __SEAHORSE_KEY_MANAGER_STORE_H__
 #define __SEAHORSE_KEY_MANAGER_STORE_H__
 
-#include <gtk/gtk.h>
+#include "seahorse-collection.h"
+#include "seahorse-object.h"
 
-#include "seahorse-context.h"
-#include "seahorse-set.h"
-#include "seahorse-set-model.h"
+#include <gtk/gtk.h>
+#include <gcr/gcr.h>
 
 #define SEAHORSE_TYPE_KEY_MANAGER_STORE             (seahorse_key_manager_store_get_type ())
 #define SEAHORSE_KEY_MANAGER_STORE(obj)             (G_TYPE_CHECK_INSTANCE_CAST ((obj), SEAHORSE_TYPE_KEY_MANAGER_STORE, SeahorseKeyManagerStore))
@@ -46,19 +46,19 @@ typedef enum _SeahorseKeyManagerStoreMode {
 } SeahorseKeyManagerStoreMode;
 
 struct _SeahorseKeyManagerStore {
-	SeahorseSetModel               parent;
-	
+	GcrCollectionModel parent;
+
 	/*< private >*/
-	SeahorseKeyManagerStorePriv    *priv;
+	SeahorseKeyManagerStorePriv *priv;
 };
 
 struct _SeahorseKeyManagerStoreClass {
-	SeahorseSetModelClass           parent_class;
+	GcrCollectionModelClass parent_class;
 };
 
 GType                      seahorse_key_manager_store_get_type               (void) G_GNUC_CONST;
 
-SeahorseKeyManagerStore*   seahorse_key_manager_store_new                    (SeahorseSet *skset,
+SeahorseKeyManagerStore*   seahorse_key_manager_store_new                    (SeahorseCollection *collection,
                                                                               GtkTreeView *view,
                                                                               GSettings *settings);
 
diff --git a/src/seahorse-key-manager.c b/src/seahorse-key-manager.c
index 2da358a..ff923c0 100644
--- a/src/seahorse-key-manager.c
+++ b/src/seahorse-key-manager.c
@@ -22,6 +22,7 @@
 
 #include "config.h"
 
+#include "seahorse-collection.h"
 #include "seahorse-generate-select.h"
 #include "seahorse-key-manager.h"
 #include "seahorse-key-manager-store.h"
@@ -62,7 +63,7 @@ typedef struct _TabInfo {
 	guint id;
 	gint page;
 	GtkTreeView* view;
-	SeahorseSet* objects;
+	SeahorseCollection* collection;
 	GtkWidget* widget;
 	SeahorseKeyManagerStore* store;
 } TabInfo;
@@ -89,7 +90,7 @@ enum  {
 	TAB_NUM_TABS
 } SeahorseKeyManagerTabs;
 
-static SeahorseObjectPredicate pred_public = {
+static SeahorsePredicate pred_public = {
 	0, 
 	0, 
 	0, 
@@ -100,7 +101,7 @@ static SeahorseObjectPredicate pred_public = {
 	NULL
 };
 
-static SeahorseObjectPredicate pred_private = {
+static SeahorsePredicate pred_private = {
 	0, 
 	0, 
 	0, 
@@ -111,7 +112,7 @@ static SeahorseObjectPredicate pred_private = {
 	NULL
 };
 
-static SeahorseObjectPredicate pred_password = {
+static SeahorsePredicate pred_password = {
 	0, 
 	0, /* Tag filled in later */ 
 	0, 
@@ -138,7 +139,7 @@ get_tab_for_object (SeahorseKeyManager* self, SeahorseObject* obj)
 	
 	for (i = 0; i < TAB_NUM_TABS; ++i) {
 		TabInfo* tab = &self->pv->tabs[i];
-		if (seahorse_set_has_object (tab->objects, obj))
+		if (seahorse_collection_has_object (tab->collection, obj))
 			return tab;
 	}
 	
@@ -346,9 +347,9 @@ on_keymanager_new_button (GtkButton* button, SeahorseKeyManager* self)
 
 static void 
 initialize_tab (SeahorseKeyManager* self, const char* tabwidget, guint tabid, const char* viewwidget, 
-                const SeahorseObjectPredicate* pred) 
+                const SeahorsePredicate* pred)
 {
-	SeahorseSet *objects;
+	SeahorseCollection *collection;
 	GtkTreeSelection *selection;
 	GtkTreeView *view;
 	
@@ -360,9 +361,9 @@ initialize_tab (SeahorseKeyManager* self, const char* tabwidget, guint tabid, co
 	
 	self->pv->tabs[tabid].page = gtk_notebook_page_num (self->pv->notebook, self->pv->tabs[tabid].widget);
 	g_return_if_fail (self->pv->tabs[tabid].page >= 0);
-	
-	objects = seahorse_set_new_full ((SeahorseObjectPredicate*)pred);
-	self->pv->tabs[tabid].objects = objects;
+
+	collection = seahorse_collection_new_for_predicate ((SeahorsePredicate*)pred, NULL);
+	self->pv->tabs[tabid].collection = SEAHORSE_COLLECTION (collection);
 
 	/* Init key list & selection settings */
 	view = GTK_TREE_VIEW (seahorse_widget_get_widget (SEAHORSE_WIDGET (self), viewwidget));
@@ -375,7 +376,8 @@ initialize_tab (SeahorseKeyManager* self, const char* tabwidget, guint tabid, co
 	gtk_widget_realize (GTK_WIDGET (view));
 
 	/* Add new key store and associate it */
-	self->pv->tabs[tabid].store = seahorse_key_manager_store_new (objects, view, self->pv->settings);
+	self->pv->tabs[tabid].store = seahorse_key_manager_store_new (collection, view,
+	                                                              self->pv->settings);
 }
 
 static gboolean 
@@ -1026,10 +1028,8 @@ seahorse_key_manager_finalize (GObject *obj)
 	
 	if (self->pv->tabs) {
 		for (i = 0; i < TAB_NUM_TABS; ++i) {
-			if (self->pv->tabs[i].store)
-				g_object_unref (self->pv->tabs[i].store);
-			if (self->pv->tabs[i].objects)
-				g_object_unref (self->pv->tabs[i].objects);
+			g_clear_object (&self->pv->tabs[i].store);
+			g_clear_object (&self->pv->tabs[i].collection);
 		}
 		g_free (self->pv->tabs);
 		self->pv->tabs = NULL;
diff --git a/src/seahorse-keyserver-results.c b/src/seahorse-keyserver-results.c
index 43432bf..bdf9b08 100644
--- a/src/seahorse-keyserver-results.c
+++ b/src/seahorse-keyserver-results.c
@@ -50,8 +50,8 @@ struct _SeahorseKeyserverResultsPrivate {
 	GtkTreeView *view;
 	GtkActionGroup *object_actions;
 	SeahorseKeyManagerStore *store;
-	SeahorseSet *objects;
-	SeahorseObjectPredicate pred;
+	SeahorseCollection *collection;
+	SeahorsePredicate pred;
 	GSettings *settings;
 };
 
@@ -369,12 +369,12 @@ seahorse_keyserver_results_constructor (GType type, guint n_props, GObjectConstr
 	/* Our predicate for filtering keys */
 	self->pv->pred.tag = g_quark_from_string ("openpgp");
 	self->pv->pred.location = SEAHORSE_LOCATION_REMOTE;
-	self->pv->pred.custom = (SeahorseObjectPredicateFunc)on_filter_objects;
+	self->pv->pred.custom = (SeahorsePredicateFunc)on_filter_objects;
 	self->pv->pred.custom_target = self;
 	
 	/* Our set all nicely filtered */
-	self->pv->objects = seahorse_set_new_full (&self->pv->pred);
-	self->pv->store = seahorse_key_manager_store_new (self->pv->objects, self->pv->view,
+	self->pv->collection = seahorse_collection_new_for_predicate (&self->pv->pred, NULL);
+	self->pv->store = seahorse_key_manager_store_new (self->pv->collection, self->pv->view,
 	                                                  self->pv->settings);
 	on_view_selection_changed (selection, self);
 	
@@ -411,11 +411,9 @@ seahorse_keyserver_results_finalize (GObject *obj)
 	if (self->pv->object_actions)
 		g_object_unref (self->pv->object_actions);
 	self->pv->object_actions = NULL;
-	
-	if (self->pv->objects)
-		g_object_unref (self->pv->objects);
-	self->pv->objects = NULL;
-	
+
+	g_clear_object (&self->pv->collection);
+
 	if (self->pv->store)
 		g_object_unref (self->pv->store);
 	self->pv->store = NULL;
diff --git a/src/seahorse-viewer.c b/src/seahorse-viewer.c
index bbd470b..92a5f9a 100644
--- a/src/seahorse-viewer.c
+++ b/src/seahorse-viewer.c
@@ -46,7 +46,7 @@ enum {
 };
 
 typedef struct _ViewerPredicate {
-	SeahorseObjectPredicate pred;
+	SeahorsePredicate pred;
 	gboolean is_commands;
 	GObject *commands_or_actions;
 } ViewerPredicate;
@@ -69,17 +69,19 @@ G_DEFINE_TYPE_EXTENDED (SeahorseViewer, seahorse_viewer, SEAHORSE_TYPE_WIDGET, 0
 	(G_TYPE_INSTANCE_GET_PRIVATE ((o), SEAHORSE_TYPE_VIEWER, SeahorseViewerPrivate))
 
 /* Predicates which control export and delete commands, inited in class_init */
-static SeahorseObjectPredicate exportable_predicate = { 0, };
-static SeahorseObjectPredicate deletable_predicate = { 0, };
-static SeahorseObjectPredicate importable_predicate = { 0, };
-static SeahorseObjectPredicate remote_predicate = { 0, };
+static SeahorsePredicate exportable_predicate = { 0, };
+static SeahorsePredicate deletable_predicate = { 0, };
+static SeahorsePredicate importable_predicate = { 0, };
+static SeahorsePredicate remote_predicate = { 0, };
 
 /* -----------------------------------------------------------------------------
  * INTERNAL 
  */
 
-typedef gboolean (*ForEachCommandsFunc) (SeahorseViewer *self, SeahorseCommands *commands, 
-                                         SeahorseObjectPredicate *predicate, gpointer user_data);
+typedef gboolean     (*ForEachCommandsFunc)     (SeahorseViewer *self,
+                                                 SeahorseCommands *commands,
+                                                 SeahorsePredicate *predicate,
+                                                 gpointer user_data);
 
 static void
 for_each_commands (SeahorseViewer *self, ForEachCommandsFunc func, gpointer user_data)
@@ -209,7 +211,8 @@ objects_prune_non_exportable (GList *objects)
 }
 
 static GList*
-filter_matching_objects (SeahorseObjectPredicate *pred, GList** all_objects)
+filter_matching_objects (SeahorsePredicate *pred,
+                         GList** all_objects)
 {
 	GList *results, *next, *here;
 	SeahorseObject *object;
@@ -223,7 +226,7 @@ filter_matching_objects (SeahorseObjectPredicate *pred, GList** all_objects)
 		next = g_list_next (here);
 
 		/* If it matches then separate it */
-		if (seahorse_object_predicate_match (pred, object)) {
+		if (seahorse_predicate_match (pred, object)) {
 			results = g_list_append (results, object);
 			*all_objects = g_list_delete_link (*all_objects, here);
 		}
@@ -233,7 +236,8 @@ filter_matching_objects (SeahorseObjectPredicate *pred, GList** all_objects)
 }
 
 static gboolean
-has_matching_objects (SeahorseObjectPredicate *pred, GList *objects)
+has_matching_objects (SeahorsePredicate *pred,
+                      GList *objects)
 {
 	SeahorseObject *object;
 	GList *l;
@@ -243,7 +247,7 @@ has_matching_objects (SeahorseObjectPredicate *pred, GList *objects)
 		object = SEAHORSE_OBJECT (l->data);
 
 		/* If it matches then separate it */
-		if (seahorse_object_predicate_match (pred, object)) 
+		if (seahorse_predicate_match (pred, object))
 			return TRUE;
 	}
 	
@@ -376,8 +380,10 @@ on_key_export_clipboard (GtkAction* action, SeahorseViewer* self)
 }
 
 static gboolean
-delete_objects_for_selected (SeahorseViewer *self, SeahorseCommands *commands, 
-                             SeahorseObjectPredicate *pred, gpointer user_data)
+delete_objects_for_selected (SeahorseViewer *self,
+                             SeahorseCommands *commands,
+                             SeahorsePredicate *pred,
+                             gpointer user_data)
 {
 	GList **all_objects;
 	GList *objects;
@@ -485,13 +491,15 @@ on_key_import_keyring (GtkAction* action, SeahorseViewer* self)
 
 
 static gboolean
-show_properties_for_selected (SeahorseViewer *self, SeahorseCommands *commands, 
-                              SeahorseObjectPredicate *pred, gpointer user_data)
+show_properties_for_selected (SeahorseViewer *self,
+                              SeahorseCommands *commands,
+                              SeahorsePredicate *pred,
+                              gpointer user_data)
 {
 	g_return_val_if_fail (SEAHORSE_IS_OBJECT (user_data), FALSE);
 	
 	/* If not mactched, then continue enumeration */
-	if (!seahorse_object_predicate_match (pred, user_data))
+	if (!seahorse_predicate_match (pred, user_data))
 		return TRUE;
 	
 	seahorse_commands_show_properties (commands, user_data);
@@ -625,7 +633,8 @@ on_add_widget (GtkUIManager* ui, GtkWidget* widget, SeahorseViewer* self)
  */
 
 static GList*
-seahorse_viewer_get_selected_matching (SeahorseView *base, SeahorseObjectPredicate *pred)
+seahorse_viewer_get_selected_matching (SeahorseView *base,
+                                       SeahorsePredicate *pred)
 {
 	GList *all_objects;
 	GList *objects;
@@ -960,8 +969,10 @@ seahorse_viewer_get_window (SeahorseViewer* self)
 }
 
 void
-seahorse_viewer_register_ui (SeahorseViewer *self, SeahorseObjectPredicate *pred,
-                             const gchar *uidef, GtkActionGroup *actions)
+seahorse_viewer_register_ui (SeahorseViewer *self,
+                             SeahorsePredicate *pred,
+                             const gchar *uidef,
+                             GtkActionGroup *actions)
 {
 	SeahorseViewerPrivate *pv = SEAHORSE_VIEWER_GET_PRIVATE (self);
 	GError *error = NULL;
@@ -991,7 +1002,8 @@ seahorse_viewer_register_ui (SeahorseViewer *self, SeahorseObjectPredicate *pred
 }
 
 void
-seahorse_viewer_register_commands (SeahorseViewer *self, SeahorseObjectPredicate *pred, 
+seahorse_viewer_register_commands (SeahorseViewer *self,
+                                   SeahorsePredicate *pred,
                                    SeahorseCommands *commands)
 {
 	SeahorseViewerPrivate *pv = SEAHORSE_VIEWER_GET_PRIVATE (self);
diff --git a/src/seahorse-viewer.h b/src/seahorse-viewer.h
index 35eb686..699addd 100644
--- a/src/seahorse-viewer.h
+++ b/src/seahorse-viewer.h
@@ -25,7 +25,6 @@
 #include <glib-object.h>
 
 #include "seahorse-object.h"
-#include "seahorse-set.h"
 #include "seahorse-view.h"
 #include "seahorse-widget.h"
 
@@ -101,12 +100,12 @@ void                seahorse_viewer_set_selected                    (SeahorseVie
 GtkWindow*          seahorse_viewer_get_window                      (SeahorseViewer* self);
 
 void                seahorse_viewer_register_ui                     (SeahorseViewer *self, 
-                                                                     SeahorseObjectPredicate *pred,
+                                                                     SeahorsePredicate *pred,
                                                                      const gchar *uidef, 
                                                                      GtkActionGroup *actions);
 
 void                seahorse_viewer_register_commands               (SeahorseViewer *self, 
-                                                                     SeahorseObjectPredicate *pred,
+                                                                     SeahorsePredicate *pred,
                                                                      SeahorseCommands *commands);
 
 #endif /* __SEAHORSE_VIEWER_H__ */
diff --git a/ssh/seahorse-ssh-commands.c b/ssh/seahorse-ssh-commands.c
index 5d806d3..6fdc514 100644
--- a/ssh/seahorse-ssh-commands.c
+++ b/ssh/seahorse-ssh-commands.c
@@ -55,7 +55,7 @@ static const char* UI_DEFINITION = ""\
 "	</popup>"\
 "</ui>";
 
-static SeahorseObjectPredicate commands_predicate = { 0, };
+static SeahorsePredicate commands_predicate = { 0, };
 
 /* -----------------------------------------------------------------------------
  * INTERNAL 



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