seahorse r2660 - in trunk: . common daemon gkr libseahorse pgp pkcs11 ssh



Author: nnielsen
Date: Sun Dec 14 16:18:47 2008
New Revision: 2660
URL: http://svn.gnome.org/viewvc/seahorse?rev=2660&view=rev

Log:
	* common/seahorse-registry.c:
	* common/seahorse-registry.h:
	* daemon/seahorse-service-keyset.c:
	* gkr/seahorse-gkr-source.c:
	* gkr/seahorse-gkr-source.h:
	* libseahorse/seahorse-context.c:
	* libseahorse/seahorse-context.h:
	* libseahorse/seahorse-source.c:
	* libseahorse/seahorse-source.h:
	* libseahorse/seahorse-unknown-source.c:
	* libseahorse/seahorse-unknown-source.h:
	* pgp/seahorse-hkp-source.c:
	* pgp/seahorse-ldap-source.c:
	* pgp/seahorse-pgp-source.c:
	* pgp/seahorse-pgp-source.h:
	* pgp/seahorse-server-source.c:
	* pgp/seahorse-server-source.h:
	* pkcs11/seahorse-pkcs11-source.c:
	* pkcs11/seahorse-pkcs11-source.h: 
	* ssh/seahorse-ssh-source.c:
	* ssh/seahorse-ssh-source.h: Make SeahorseSource be an 
	interface that can be implemented on other objects (ie: keyrings).


Modified:
   trunk/ChangeLog
   trunk/common/seahorse-registry.c
   trunk/common/seahorse-registry.h
   trunk/daemon/seahorse-service-keyset.c
   trunk/gkr/seahorse-gkr-source.c
   trunk/gkr/seahorse-gkr-source.h
   trunk/libseahorse/seahorse-context.c
   trunk/libseahorse/seahorse-context.h
   trunk/libseahorse/seahorse-source.c
   trunk/libseahorse/seahorse-source.h
   trunk/libseahorse/seahorse-unknown-source.c
   trunk/libseahorse/seahorse-unknown-source.h
   trunk/pgp/seahorse-hkp-source.c
   trunk/pgp/seahorse-ldap-source.c
   trunk/pgp/seahorse-pgp-source.c
   trunk/pgp/seahorse-pgp-source.h
   trunk/pgp/seahorse-server-source.c
   trunk/pgp/seahorse-server-source.h
   trunk/pkcs11/seahorse-pkcs11-source.c
   trunk/pkcs11/seahorse-pkcs11-source.h
   trunk/ssh/seahorse-ssh-source.c
   trunk/ssh/seahorse-ssh-source.h

Modified: trunk/common/seahorse-registry.c
==============================================================================
--- trunk/common/seahorse-registry.c	(original)
+++ trunk/common/seahorse-registry.c	Sun Dec 14 16:18:47 2008
@@ -27,6 +27,7 @@
 struct _SeahorseRegistryPrivate {
 	GHashTable *types;
 	GHashTable *objects;
+	GHashTable *functions;
 };
 
 #define SEAHORSE_REGISTRY_GET_PRIVATE(o) \
@@ -58,19 +59,18 @@
 }
 
 static void
-register_value_for_category (GHashTable *table, const gchar *category, 
+register_value_for_category (GHashTable *table, GQuark category, 
                              gpointer value, GDestroyNotify destroy_func)
 {
 	GHashTable *set;
 	
 	g_return_if_fail (table);
 	g_return_if_fail (category);
-	g_return_if_fail (category[0]);
 	
-	set = g_hash_table_lookup (table, category);
+	set = g_hash_table_lookup (table, GUINT_TO_POINTER (category));
 	if (!set) {
 		set = g_hash_table_new_full (g_direct_hash, g_direct_equal, destroy_func, NULL);
-		g_hash_table_replace (table, g_strdup (category), set);
+		g_hash_table_replace (table, GUINT_TO_POINTER (category), set);
 	}
 	
 	g_hash_table_replace (set, value, NO_VALUE);
@@ -79,7 +79,7 @@
 static GList*
 lookup_category_values (GHashTable *table, const gchar *category, va_list cats)
 {
-	GList *l, *type, *types = NULL;
+	GList *l, *value, *values = NULL;
 	GHashTable *set;
 
 	g_return_val_if_fail (table, NULL);
@@ -87,15 +87,15 @@
 	g_return_val_if_fail (category[0], NULL);
 	
 	/* Get the first category */
-	set = g_hash_table_lookup (table, category);
+	set = g_hash_table_lookup (table, g_quark_try_string (category));
 	if (!set)
 		return NULL;
 	
 	/* Transfer all of that into the list */
-	g_hash_table_foreach (set, keys_to_list, &types);
+	g_hash_table_foreach (set, keys_to_list, &values);
 	
 	/* 
-	 * Go through the other types and remove any in results
+	 * Go through the other values and remove any in results
 	 * which we don't find.
 	 */
 	for (;;) {
@@ -105,25 +105,25 @@
 		g_return_val_if_fail (category[0], NULL);
 		
 		/* Lookup this category */
-		set = g_hash_table_lookup (table, category);
+		set = g_hash_table_lookup (table, g_quark_try_string (category));
 		
 		/* No category, no matches */
 		if (!set) {
-			g_list_free (types);
+			g_list_free (values);
 			return NULL;
 		}
 		
 		/* Go through each item in list and make sure it exists in this cat */
-		for (l = types; l; l = l ? g_list_next (l) : types) {
-			type = l;
-			if (!g_hash_table_lookup (set, type->data)) {
+		for (l = values; l; l = l ? g_list_next (l) : values) {
+			value = l;
+			if (!g_hash_table_lookup (set, values->data)) {
 				l = g_list_previous (l);
-				types = g_list_delete_link (types, type);
+				values = g_list_delete_link (values, value);
 			}
 		}
 	}
 	
-	return types;
+	return values;
 }
 
 static gpointer
@@ -155,10 +155,12 @@
 seahorse_registry_init (SeahorseRegistry *obj)
 {
 	SeahorseRegistryPrivate *pv = SEAHORSE_REGISTRY_GET_PRIVATE (obj);
-	pv->types = g_hash_table_new_full (g_str_hash, g_str_equal, 
-	                                   g_free, (GDestroyNotify)g_hash_table_destroy);
-	pv->objects = g_hash_table_new_full (g_str_hash, g_str_equal, 
-	                                     g_free, (GDestroyNotify)g_hash_table_destroy);
+	pv->types = g_hash_table_new_full (g_direct_hash, g_direct_equal, 
+	                                   NULL, (GDestroyNotify)g_hash_table_destroy);
+	pv->objects = g_hash_table_new_full (g_direct_hash, g_direct_equal, 
+	                                     NULL, (GDestroyNotify)g_hash_table_destroy);
+	pv->functions = g_hash_table_new_full (g_direct_hash, g_direct_equal, 
+	                                       NULL, (GDestroyNotify)g_hash_table_destroy);
 }
 
 static void
@@ -207,7 +209,7 @@
 
 void
 seahorse_registry_register_type (SeahorseRegistry *registry, GType type, 
-                            const gchar *category, ...)
+                                 const gchar *category, ...)
 {
 	SeahorseRegistryPrivate *pv;
 	va_list cats;
@@ -220,14 +222,14 @@
 	g_return_if_fail (category);
 
 	pv = SEAHORSE_REGISTRY_GET_PRIVATE (registry);
-	register_value_for_category (pv->types, category, GUINT_TO_POINTER (type), NULL);
+	register_value_for_category (pv->types, g_quark_from_string (category), GUINT_TO_POINTER (type), NULL);
 	
 	va_start (cats, category);
 	for (;;) {
 		category = va_arg (cats, const gchar*);
 		if (!category)
 			break;
-		register_value_for_category (pv->types, category, GUINT_TO_POINTER (type), NULL);
+		register_value_for_category (pv->types, g_quark_from_string (category), GUINT_TO_POINTER (type), NULL);
 	}
 	va_end (cats);
 }
@@ -247,14 +249,41 @@
 	g_return_if_fail (category);
 
 	pv = SEAHORSE_REGISTRY_GET_PRIVATE (registry);
-	register_value_for_category (pv->objects, category, g_object_ref (object), g_object_unref);
+	register_value_for_category (pv->objects, g_quark_from_string (category), g_object_ref (object), g_object_unref);
 	
 	va_start (cats, category);
 	for (;;) {
 		category = va_arg (cats, const gchar*);
 		if (!category)
 			break;
-		register_value_for_category (pv->objects, category, g_object_ref (object), g_object_unref);
+		register_value_for_category (pv->objects, g_quark_from_string (category), g_object_ref (object), g_object_unref);
+	}
+	va_end (cats);
+}
+
+void
+seahorse_registry_register_function (SeahorseRegistry *registry, gpointer func, 
+                                     const gchar *category, ...)
+{
+	SeahorseRegistryPrivate *pv;
+	va_list cats;
+
+	if (!registry)
+		registry = seahorse_registry_get ();
+	
+	g_return_if_fail (SEAHORSE_IS_REGISTRY (registry));
+	g_return_if_fail (func);
+	g_return_if_fail (category);
+
+	pv = SEAHORSE_REGISTRY_GET_PRIVATE (registry);
+	register_value_for_category (pv->functions, g_quark_from_string (category), func, NULL);
+	
+	va_start (cats, category);
+	for (;;) {
+		category = va_arg (cats, const gchar*);
+		if (!category)
+			break;
+		register_value_for_category (pv->functions, g_quark_from_string (category), func, NULL);
 	}
 	va_end (cats);
 }
@@ -358,3 +387,23 @@
 	g_list_free (types);
 	return objects;
 }
+
+gpointer
+seahorse_registry_lookup_function (SeahorseRegistry *registry, const gchar *category, ...)
+{
+	SeahorseRegistryPrivate *pv;
+	va_list cats;
+	gpointer func;
+	
+	if (!registry)
+		registry = seahorse_registry_get ();
+	
+	g_return_val_if_fail (SEAHORSE_IS_REGISTRY (registry), 0);
+	pv = SEAHORSE_REGISTRY_GET_PRIVATE (registry);
+
+	va_start (cats, category);
+	func = GPOINTER_TO_UINT (lookup_category_value (pv->functions, category, cats));
+	va_end (cats);
+
+	return func;
+}
\ No newline at end of file

Modified: trunk/common/seahorse-registry.h
==============================================================================
--- trunk/common/seahorse-registry.h	(original)
+++ trunk/common/seahorse-registry.h	Sun Dec 14 16:18:47 2008
@@ -57,6 +57,10 @@
                                                           GObject *object, const gchar *category, 
                                                           ...) G_GNUC_NULL_TERMINATED;
 
+void                 seahorse_registry_register_function (SeahorseRegistry *registry, 
+                                                          gpointer func, const gchar *category, 
+                                                          ...) G_GNUC_NULL_TERMINATED;
+
 GType                seahorse_registry_object_type       (SeahorseRegistry *registry, 
                                                           const gchar *category,
                                                           ...) G_GNUC_NULL_TERMINATED;
@@ -73,6 +77,10 @@
                                                           const gchar *category,
                                                           ...) G_GNUC_NULL_TERMINATED;
 
+gpointer             seahorse_registry_lookup_function   (SeahorseRegistry *registry, 
+                                                          const gchar *category, 
+                                                          ...) G_GNUC_NULL_TERMINATED;
+
 G_END_DECLS
 
 #endif /*SEAHORSEREGISTRY_H_*/

Modified: trunk/daemon/seahorse-service-keyset.c
==============================================================================
--- trunk/daemon/seahorse-service-keyset.c	(original)
+++ trunk/daemon/seahorse-service-keyset.c	Sun Dec 14 16:18:47 2008
@@ -188,7 +188,7 @@
     
     /* Check to make sure the key ids are valid */
     for (k = keyids; *k; k++) {
-        keyid = seahorse_source_canonize_id (keyset->ktype, *k);
+        keyid = seahorse_context_canonize_id (keyset->ktype, *k);
         if (!keyid) {
             g_set_error (error, SEAHORSE_DBUS_ERROR, SEAHORSE_DBUS_ERROR_INVALID, 
                          _("Invalid key id: %s"), *k);

Modified: trunk/gkr/seahorse-gkr-source.c
==============================================================================
--- trunk/gkr/seahorse-gkr-source.c	(original)
+++ trunk/gkr/seahorse-gkr-source.c	Sun Dec 14 16:18:47 2008
@@ -73,7 +73,10 @@
 	SeahorseObject *keyring_object;		/* Object which represents the whole keyring */
 };
 
-G_DEFINE_TYPE (SeahorseGkrSource, seahorse_gkr_source, SEAHORSE_TYPE_SOURCE);
+static void seahorse_source_iface (SeahorseSourceIface *iface);
+
+G_DEFINE_TYPE_EXTENDED (SeahorseGkrSource, seahorse_gkr_source, G_TYPE_OBJECT, 0,
+                        G_IMPLEMENT_INTERFACE (SEAHORSE_TYPE_SOURCE, seahorse_source_iface));
 
 /* -----------------------------------------------------------------------------
  * LIST OPERATION 
@@ -421,7 +424,6 @@
 seahorse_gkr_source_class_init (SeahorseGkrSourceClass *klass)
 {
     GObjectClass *gobject_class;
-    SeahorseSourceClass *key_class;
     
     seahorse_gkr_source_parent_class = g_type_class_peek_parent (klass);
     
@@ -432,34 +434,28 @@
     gobject_class->set_property = seahorse_gkr_source_set_property;
     gobject_class->get_property = seahorse_gkr_source_get_property;
     
-    key_class = SEAHORSE_SOURCE_CLASS (klass);    
-    key_class->load = seahorse_gkr_source_load;
-    key_class->import = seahorse_gkr_source_import;
-
     g_object_class_install_property (gobject_class, PROP_KEYRING_NAME,
         g_param_spec_string ("keyring-name", "Keyring Name", "GNOME Keyring name",
                              NULL, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
-    
-    g_object_class_install_property (gobject_class, PROP_KEY_TYPE,
-        g_param_spec_uint ("key-type", "Key Type", "Key type that originates from this key source.", 
-                           0, G_MAXUINT, SEAHORSE_TAG_INVALID, G_PARAM_READABLE));
-    
+       
     g_object_class_install_property (gobject_class, PROP_FLAGS,
         g_param_spec_uint ("flags", "Flags", "Object Source flags.", 
                            0, G_MAXUINT, 0, G_PARAM_READABLE));
 
-    g_object_class_install_property (gobject_class, PROP_KEY_DESC,
-        g_param_spec_string ("key-desc", "Key Desc", "Description for keys that originate here.",
-                             NULL, G_PARAM_READABLE));
-
-    g_object_class_install_property (gobject_class, PROP_LOCATION,
-        g_param_spec_uint ("location", "Key Location", "Where the key is stored. See SeahorseLocation", 
-                           0, G_MAXUINT, SEAHORSE_LOCATION_INVALID, G_PARAM_READABLE));    
-    
+	g_object_class_override_property (gobject_class, PROP_KEY_TYPE, "key-type");
+	g_object_class_override_property (gobject_class, PROP_KEY_DESC, "key-desc");
+	g_object_class_override_property (gobject_class, PROP_LOCATION, "location");
     
 	seahorse_registry_register_type (NULL, SEAHORSE_TYPE_GKR_SOURCE, "source", "local", SEAHORSE_GKR_STR, NULL);
 }
 
+static void 
+seahorse_source_iface (SeahorseSourceIface *iface)
+{
+	iface->load = seahorse_gkr_source_load;
+	iface->import = seahorse_gkr_source_import;
+}
+
 /* -------------------------------------------------------------------------- 
  * PUBLIC
  */

Modified: trunk/gkr/seahorse-gkr-source.h
==============================================================================
--- trunk/gkr/seahorse-gkr-source.h	(original)
+++ trunk/gkr/seahorse-gkr-source.h	Sun Dec 14 16:18:47 2008
@@ -49,14 +49,12 @@
 typedef struct _SeahorseGkrSourcePrivate SeahorseGkrSourcePrivate;
 
 struct _SeahorseGkrSource {
-    SeahorseSource parent;
-    
-    /*< private >*/
-    SeahorseGkrSourcePrivate *pv;
+	GObject parent;
+	SeahorseGkrSourcePrivate *pv;
 };
 
 struct _SeahorseGkrSourceClass {
-    SeahorseSourceClass parent_class;
+	GObjectClass parent_class;
 };
 
 GType               seahorse_gkr_source_get_type          (void);

Modified: trunk/libseahorse/seahorse-context.c
==============================================================================
--- trunk/libseahorse/seahorse-context.c	(original)
+++ trunk/libseahorse/seahorse-context.c	Sun Dec 14 16:18:47 2008
@@ -1090,7 +1090,7 @@
     /* Check all the ids */
     for (l = rawids; l; l = g_slist_next (l)) {
         
-        id = seahorse_source_canonize_id (ktype, (gchar*)l->data);
+        id = seahorse_context_canonize_id (ktype, (gchar*)l->data);
         if (!id) {
             /* TODO: Try and match this partial id */
             g_warning ("invalid id: %s", (gchar*)l->data);
@@ -1185,3 +1185,17 @@
 {
 	return g_strdup (g_quark_to_string (id));
 }
+
+GQuark
+seahorse_context_canonize_id (GQuark ktype, const gchar *id)
+{
+	SeahorseCanonizeFunc canonize;
+
+	g_return_val_if_fail (id != NULL, 0);
+    
+	canonize = seahorse_registry_lookup_function (NULL, "canonize", g_quark_to_string (ktype), NULL);
+	if (!canonize) 
+		return 0;
+	
+	return (canonize) (id);
+}

Modified: trunk/libseahorse/seahorse-context.h
==============================================================================
--- trunk/libseahorse/seahorse-context.h	(original)
+++ trunk/libseahorse/seahorse-context.h	Sun Dec 14 16:18:47 2008
@@ -196,4 +196,9 @@
 gchar*              seahorse_context_id_to_dbus         (SeahorseContext    *sctx,
                                                          GQuark             id);
 
+
+typedef GQuark (*SeahorseCanonizeFunc) (const gchar *id);
+
+GQuark              seahorse_context_canonize_id        (GQuark ktype, const gchar *id);
+
 #endif /* __SEAHORSE_CONTEXT_H__ */

Modified: trunk/libseahorse/seahorse-source.c
==============================================================================
--- trunk/libseahorse/seahorse-source.c	(original)
+++ trunk/libseahorse/seahorse-source.c	Sun Dec 14 16:18:47 2008
@@ -29,46 +29,59 @@
 
 #include "common/seahorse-registry.h"
 
-G_DEFINE_TYPE (SeahorseSource, seahorse_source, G_TYPE_OBJECT);
-
-/* GObject handlers */
-static void seahorse_source_dispose    (GObject *gobject);
-static void seahorse_source_finalize   (GObject *gobject);
-
-static GObjectClass *parent_class = NULL;
-
-static void
-seahorse_source_class_init (SeahorseSourceClass *klass)
-{
-    GObjectClass *gobject_class;
-   
-    parent_class = g_type_class_peek_parent (klass);
-    gobject_class = G_OBJECT_CLASS (klass);
-    
-    gobject_class->dispose = seahorse_source_dispose;
-    gobject_class->finalize = seahorse_source_finalize;
-}
+/* ---------------------------------------------------------------------------------
+ * INTERFACE
+ */
 
-/* Initialize the object */
 static void
-seahorse_source_init (SeahorseSource *sksrc)
+seahorse_source_base_init (gpointer gobject_class)
 {
-
+	static gboolean initialized = FALSE;
+	if (!initialized) {
+		
+		/* Add properties and signals to the interface */
+		g_object_interface_install_property (gobject_class,
+		        g_param_spec_uint ("key-type", "Key Type", "Key type that originates from this key source.", 
+		                           0, G_MAXUINT, SEAHORSE_TAG_INVALID, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+
+		g_object_interface_install_property (gobject_class, 
+		        g_param_spec_string ("key-desc", "Key Desc", "Description for keys that originate here.",
+		                             NULL, G_PARAM_READABLE));
+
+		g_object_interface_install_property (gobject_class, 
+		        g_param_spec_uint ("location", "Key Location", "Where the key is stored. See SeahorseLocation", 
+		                           0, G_MAXUINT, SEAHORSE_LOCATION_MISSING, G_PARAM_READABLE));    
+		
+		initialized = TRUE;
+	}
 }
 
-/* dispose of all our internal references */
-static void
-seahorse_source_dispose (GObject *gobject)
+GType
+seahorse_source_get_type (void)
 {
-    G_OBJECT_CLASS (parent_class)->dispose (gobject);
+	static GType type = 0;
+	if (!type) {
+		static const GTypeInfo info = {
+			sizeof (SeahorseSourceIface),
+			seahorse_source_base_init,               /* base init */
+			NULL,             /* base finalize */
+			NULL,             /* class_init */
+			NULL,             /* class finalize */
+			NULL,             /* class data */
+			0,
+			0,                /* n_preallocs */
+			NULL,             /* instance init */
+		};
+		type = g_type_register_static (G_TYPE_INTERFACE, "SeahorseSourceIface", &info, 0);
+		g_type_interface_add_prerequisite (type, G_TYPE_OBJECT);
+	}
+	
+	return type;
 }
 
-/* free private vars */
-static void
-seahorse_source_finalize (GObject *gobject)
-{
-    G_OBJECT_CLASS (parent_class)->finalize (gobject);
-}
+/* ---------------------------------------------------------------------------------
+ * PUBLIC
+ */
 
 /**
  * seahorse_source_load
@@ -81,10 +94,10 @@
 SeahorseOperation*
 seahorse_source_load (SeahorseSource *sksrc)
 {
-    SeahorseSourceClass *klass;
+    SeahorseSourceIface *klass;
     
     g_return_val_if_fail (SEAHORSE_IS_SOURCE (sksrc), NULL);
-    klass = SEAHORSE_SOURCE_GET_CLASS (sksrc);
+    klass = SEAHORSE_SOURCE_GET_INTERFACE (sksrc);
     g_return_val_if_fail (klass->load != NULL, NULL);
     
     return (*klass->load) (sksrc);
@@ -131,10 +144,10 @@
 SeahorseOperation*
 seahorse_source_search (SeahorseSource *sksrc, const gchar *match)
 {
-    SeahorseSourceClass *klass;
+    SeahorseSourceIface *klass;
     
     g_return_val_if_fail (SEAHORSE_IS_SOURCE (sksrc), NULL);
-    klass = SEAHORSE_SOURCE_GET_CLASS (sksrc);
+    klass = SEAHORSE_SOURCE_GET_INTERFACE (sksrc);
     g_return_val_if_fail (klass->search != NULL, NULL);
     
     return (*klass->search) (sksrc, match);
@@ -143,12 +156,12 @@
 SeahorseOperation* 
 seahorse_source_import (SeahorseSource *sksrc, GInputStream *input)
 {
-	SeahorseSourceClass *klass;
+	SeahorseSourceIface *klass;
     
 	g_return_val_if_fail (G_IS_INPUT_STREAM (input), NULL);
     
 	g_return_val_if_fail (SEAHORSE_IS_SOURCE (sksrc), NULL);
-	klass = SEAHORSE_SOURCE_GET_CLASS (sksrc);   
+	klass = SEAHORSE_SOURCE_GET_INTERFACE (sksrc);   
 	g_return_val_if_fail (klass->import != NULL, NULL);
     
 	return (*klass->import) (sksrc, input);  
@@ -268,7 +281,7 @@
 SeahorseOperation* 
 seahorse_source_export (SeahorseSource *sksrc, GList *objects, GOutputStream *output)
 {
-	SeahorseSourceClass *klass;
+	SeahorseSourceIface *klass;
 	SeahorseOperation *op;
 	GSList *ids = NULL;
 	GList *l;
@@ -276,7 +289,7 @@
 	g_return_val_if_fail (SEAHORSE_IS_SOURCE (sksrc), NULL);
 	g_return_val_if_fail (G_IS_OUTPUT_STREAM (output), NULL);
 	
-	klass = SEAHORSE_SOURCE_GET_CLASS (sksrc);   
+	klass = SEAHORSE_SOURCE_GET_INTERFACE (sksrc);   
 	if (klass->export)
 		return (*klass->export) (sksrc, objects, output);
 
@@ -295,7 +308,7 @@
 SeahorseOperation* 
 seahorse_source_export_raw (SeahorseSource *sksrc, GSList *ids, GOutputStream *output)
 {
-	SeahorseSourceClass *klass;
+	SeahorseSourceIface *klass;
 	SeahorseOperation *op;
 	SeahorseObject *sobj;
 	GList *objects = NULL;
@@ -304,7 +317,7 @@
 	g_return_val_if_fail (SEAHORSE_IS_SOURCE (sksrc), NULL);
 	g_return_val_if_fail (output == NULL || G_IS_OUTPUT_STREAM (output), NULL);
 
-	klass = SEAHORSE_SOURCE_GET_CLASS (sksrc);   
+	klass = SEAHORSE_SOURCE_GET_INTERFACE (sksrc);   
     
 	/* Either export or export_raw must be implemented */
 	if (klass->export_raw)
@@ -341,25 +354,3 @@
     g_object_get (sksrc, "location", &loc, NULL);
     return loc;
 }
-
-/* -----------------------------------------------------------------------------
- * CANONICAL IDS 
- */
-
-GQuark
-seahorse_source_canonize_id (GQuark ktype, const gchar *id)
-{
-	SeahorseSourceClass *klass;
-	GType type;
-
-	g_return_val_if_fail (id != NULL, 0);
-    
-	type = seahorse_registry_object_type (NULL, "source", g_quark_to_string (ktype), "local", NULL);
-	g_return_val_if_fail (type, 0);
-	
-	klass = SEAHORSE_SOURCE_CLASS (g_type_class_peek (type));
-	g_return_val_if_fail (klass, 0);
-	
-	g_return_val_if_fail (klass->canonize_id, 0);
-	return (klass->canonize_id) (id);
-}

Modified: trunk/libseahorse/seahorse-source.h
==============================================================================
--- trunk/libseahorse/seahorse-source.h	(original)
+++ trunk/libseahorse/seahorse-source.h	Sun Dec 14 16:18:47 2008
@@ -48,98 +48,86 @@
 #include <gio/gio.h>
 #include <glib-object.h>
 
-#define SEAHORSE_TYPE_SOURCE            (seahorse_source_get_type ())
-#define SEAHORSE_SOURCE(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), SEAHORSE_TYPE_SOURCE, SeahorseSource))
-#define SEAHORSE_SOURCE_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), SEAHORSE_TYPE_SOURCE, SeahorseSourceClass))
-#define SEAHORSE_IS_SOURCE(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SEAHORSE_TYPE_SOURCE))
-#define SEAHORSE_IS_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SEAHORSE_TYPE_SOURCE))
-#define SEAHORSE_SOURCE_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), SEAHORSE_TYPE_SOURCE, SeahorseSourceClass))
+#define SEAHORSE_TYPE_SOURCE                (seahorse_source_get_type ())
+#define SEAHORSE_SOURCE(obj)                (G_TYPE_CHECK_INSTANCE_CAST ((obj), SEAHORSE_TYPE_SOURCE, SeahorseSource))
+#define SEAHORSE_IS_SOURCE(obj)             (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SEAHORSE_TYPE_SOURCE))
+#define SEAHORSE_SOURCE_GET_INTERFACE(obj)  (G_TYPE_INSTANCE_GET_INTERFACE ((obj), SEAHORSE_TYPE_SOURCE, SeahorseSourceIface))
 
 struct _SeahorseObject;
 
-typedef struct _SeahorseSource {
-    GObject             parent;   
-} SeahorseSource;
+typedef struct _SeahorseSource SeahorseSource;
+typedef struct _SeahorseSourceIface SeahorseSourceIface;
 
-typedef struct _SeahorseSourceClass {
-    GtkObjectClass parent_class;
+struct _SeahorseSourceIface {
+	GTypeInterface parent;
     
-    /* class props ----------------------------------------------------- */
-    const GQuark obj_tag;
-    const gchar *display_name;
-    const gchar **mime_types;
+	/* virtual methods ------------------------------------------------- */
 
-    /* class methods --------------------------------------------------- */
-    
-    GQuark (*canonize_id) (const gchar *id);
-    
-    /* virtual methods ------------------------------------------------- */
-
-    /**
-     * load
-     * @sksrc: The #SeahorseSource.
-     * 
-     * Loads the requested objects, and add the objects to SeahorseContext. 
-     * 
-     * Returns: The load operation.
-     */
-    SeahorseOperation* (*load) (SeahorseSource *sksrc);
-
-    /**
-     * search
-     * @sksrc: The #SeahorseSource 
-     * @match: Match text
-     *
-     * Searches for objects in the source.
-     *
-     * Returns: The search operation.
-     */
-    SeahorseOperation* (*search) (SeahorseSource *sksrc, const gchar *match);
+	/**
+	 * load
+	 * @sksrc: The #SeahorseSource.
+	 * 
+	 * Loads the requested objects, and add the objects to SeahorseContext. 
+	 * 
+	 * Returns: The load operation.
+	 */
+	SeahorseOperation* (*load) (SeahorseSource *sksrc);
+
+	/**
+	 * search
+	 * @sksrc: The #SeahorseSource 
+	 * @match: Match text
+	 *
+	 * Searches for objects in the source.
+	 *
+	 * Returns: The search operation.
+	 */
+	SeahorseOperation* (*search) (SeahorseSource *sksrc, const gchar *match);
 
     
-    /**
-     * import
-     * @sksrc: The #SeahorseSource to import into.
-     * @input: The data to import.
-     *
-     * Import objects into the source. When operation is 'done' a GList of 
-     * updated objects may be found as the operation result. 
-     * 
-     * Returns: The import operation
-     */
-    SeahorseOperation* (*import) (SeahorseSource *sksrc, GInputStream *input);
-
-    /**
-     * export
-     * @sksrc: The #SeahorseSource to export from.
-     * @objects: A list of objects to export.
-     * @complete: Whether to export the secret objects too.
-     * @data: Output stream to export to.
-     *
-     * Import objects into the object source. When operation is 'done' the result
-     * of the operation will be a GOutputStream
-     * 
-     * Returns: The export operation
-     */    
-    SeahorseOperation* (*export) (SeahorseSource *sksrc, GList *objects, GOutputStream *output);
-
-    /**
-     * export_raw
-     * @sksrc: The #SeahorseSource to export from.
-     * @objects: A list of ids to export.
-     * @data: output stream to export to.
-     *
-     * Import objects into the source. When operation is 'done' the result
-     * of the operation will be a GOutputStream
-     * 
-     * Returns: The export operation
-     */    
-    SeahorseOperation* (*export_raw) (SeahorseSource *sksrc, GSList *ids, 
-                                      GOutputStream *output);
+	/**
+	 * import
+	 * @sksrc: The #SeahorseSource to import into.
+	 * @input: The data to import.
+	 *
+	 * Import objects into the source. When operation is 'done' a GList of 
+	 * updated objects may be found as the operation result. 
+	 * 
+	 * Returns: The import operation
+	 */
+	SeahorseOperation* (*import) (SeahorseSource *sksrc, GInputStream *input);
+
+	/**
+	 * export
+	 * @sksrc: The #SeahorseSource to export from.
+	 * @objects: A list of objects to export.
+	 * @complete: Whether to export the secret objects too.
+	 * @data: Output stream to export to.
+	 *
+	 * Import objects into the object source. When operation is 'done' the result
+	 * of the operation will be a GOutputStream
+	 * 
+	 * Returns: The export operation
+	 */    
+	SeahorseOperation* (*export) (SeahorseSource *sksrc, GList *objects, GOutputStream *output);
+
+	/**
+	 * export_raw
+	 * @sksrc: The #SeahorseSource to export from.
+	 * @objects: A list of ids to export.
+	 * @data: output stream to export to.
+	 *
+	 * Import objects into the source. When operation is 'done' the result
+	 * of the operation will be a GOutputStream
+	 * 
+	 * Returns: The export operation
+	 */    
+	SeahorseOperation* (*export_raw) (SeahorseSource *sksrc, GSList *ids, 
+	                                  GOutputStream *output);
     
-} SeahorseSourceClass;
+};
 
-GType       seahorse_source_get_type      (void);
+GType               seahorse_source_get_type             (void) G_GNUC_CONST;
 
 /* Method helper functions ------------------------------------------- */
 
@@ -179,11 +167,4 @@
 
 SeahorseLocation    seahorse_source_get_location          (SeahorseSource *sksrc);
 
-GQuark              seahorse_source_canonize_id           (GQuark ktype, 
-                                                           const gchar *id);
-
-GQuark              seahorse_source_mime_to_ktype         (const gchar *mimetype);
-
-const gchar*        seahorse_source_type_get_description  (GType type);
-
 #endif /* __SEAHORSE_SOURCE_H__ */

Modified: trunk/libseahorse/seahorse-unknown-source.c
==============================================================================
--- trunk/libseahorse/seahorse-unknown-source.c	(original)
+++ trunk/libseahorse/seahorse-unknown-source.c	Sun Dec 14 16:18:47 2008
@@ -37,7 +37,10 @@
     PROP_LOCATION
 };
 
-G_DEFINE_TYPE (SeahorseUnknownSource, seahorse_unknown_source, SEAHORSE_TYPE_SOURCE);
+static void seahorse_source_iface (SeahorseSourceIface *iface);
+
+G_DEFINE_TYPE_EXTENDED (SeahorseUnknownSource, seahorse_unknown_source, G_TYPE_OBJECT, 0,
+                        G_IMPLEMENT_INTERFACE (SEAHORSE_TYPE_SOURCE, seahorse_source_iface));
 
 /* -----------------------------------------------------------------------------
  * INTERNAL
@@ -100,31 +103,26 @@
 static void
 seahorse_unknown_source_class_init (SeahorseUnknownSourceClass *klass)
 {
-    GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-    SeahorseSourceClass *parent_class = SEAHORSE_SOURCE_CLASS (klass);
+	GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
    
-    seahorse_unknown_source_parent_class = g_type_class_peek_parent (klass);
+	seahorse_unknown_source_parent_class = g_type_class_peek_parent (klass);
     
-    gobject_class->set_property = seahorse_unknown_source_set_property;
-    gobject_class->get_property = seahorse_unknown_source_get_property;
+	gobject_class->set_property = seahorse_unknown_source_set_property;
+	gobject_class->get_property = seahorse_unknown_source_get_property;
     
-    parent_class->load = seahorse_unknown_source_load;
- 
-    g_object_class_install_property (gobject_class, PROP_KEY_TYPE,
-        g_param_spec_uint ("key-type", "Key Type", "Key type that originates from this key source.", 
-                           0, G_MAXUINT, SEAHORSE_TAG_INVALID, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
-
-    g_object_class_install_property (gobject_class, PROP_KEY_DESC,
-        g_param_spec_string ("key-desc", "Key Desc", "Description for keys that originate here.",
-                             NULL, G_PARAM_READABLE));
-
-    g_object_class_install_property (gobject_class, PROP_LOCATION,
-        g_param_spec_uint ("location", "Key Location", "Where the key is stored. See SeahorseLocation", 
-                           0, G_MAXUINT, SEAHORSE_LOCATION_MISSING, G_PARAM_READABLE));    
+	g_object_class_override_property (gobject_class, PROP_KEY_TYPE, "key-type");
+	g_object_class_override_property (gobject_class, PROP_KEY_DESC, "key-desc");
+	g_object_class_override_property (gobject_class, PROP_LOCATION, "location");
     
 	seahorse_registry_register_type (NULL, SEAHORSE_TYPE_UNKNOWN_SOURCE, "source", NULL);
 }
 
+static void 
+seahorse_source_iface (SeahorseSourceIface *iface)
+{
+	iface->load = seahorse_unknown_source_load;
+}
+
 /* -----------------------------------------------------------------------------
  * PUBLIC 
  */

Modified: trunk/libseahorse/seahorse-unknown-source.h
==============================================================================
--- trunk/libseahorse/seahorse-unknown-source.h	(original)
+++ trunk/libseahorse/seahorse-unknown-source.h	Sun Dec 14 16:18:47 2008
@@ -50,14 +50,12 @@
 typedef struct _SeahorseUnknownSourcePrivate SeahorseUnknownSourcePrivate;
 
 struct _SeahorseUnknownSource {
-    SeahorseSource parent;
-    
-    /* <public> */
-    GQuark ktype;
+	GObject parent;
+	GQuark ktype;
 };
 
 struct _SeahorseUnknownSourceClass {
-    SeahorseSourceClass parent_class;
+	GObjectClass parent_class;
 };
 
 GType                    seahorse_unknown_source_get_type      (void);

Modified: trunk/pgp/seahorse-hkp-source.c
==============================================================================
--- trunk/pgp/seahorse-hkp-source.c	(original)
+++ trunk/pgp/seahorse-hkp-source.c	Sun Dec 14 16:18:47 2008
@@ -710,10 +710,14 @@
 enum {
     PROP_0,
     PROP_KEY_TYPE,
-    PROP_KEY_DESC
+    PROP_KEY_DESC,
+    PROP_LOCATION
 };
 
-G_DEFINE_TYPE (SeahorseHKPSource, seahorse_hkp_source, SEAHORSE_TYPE_SERVER_SOURCE);
+static void seahorse_source_iface (SeahorseSourceIface *iface);
+
+G_DEFINE_TYPE_EXTENDED (SeahorseHKPSource, seahorse_hkp_source, SEAHORSE_TYPE_SERVER_SOURCE, 0,
+                        G_IMPLEMENT_INTERFACE (SEAHORSE_TYPE_SOURCE, seahorse_source_iface));
 
 static void 
 seahorse_hkp_source_init (SeahorseHKPSource *hsrc)
@@ -732,9 +736,20 @@
     case PROP_KEY_DESC:
         g_value_set_string (value, _("PGP Key"));
         break;
+    case PROP_LOCATION:
+        g_value_set_uint (value, SEAHORSE_LOCATION_REMOTE);
+        break;
     };        
 }
 
+static void 
+seahorse_hkp_source_set_property (GObject *object, guint prop_id, const GValue *value,
+                                   GParamSpec *pspec)
+{
+
+}
+
+
 static SeahorseOperation*
 seahorse_hkp_source_search (SeahorseSource *src, const gchar *match)
 {
@@ -927,31 +942,30 @@
 seahorse_hkp_source_class_init (SeahorseHKPSourceClass *klass)
 {
 	GObjectClass *gobject_class;
-	SeahorseSourceClass *key_class;
    
 	gobject_class = G_OBJECT_CLASS (klass);
 	gobject_class->get_property = seahorse_hkp_source_get_property;
-
-	key_class = SEAHORSE_SOURCE_CLASS (klass);
-	key_class->canonize_id = seahorse_pgp_key_get_cannonical_id;
-	key_class->search = seahorse_hkp_source_search;
-	key_class->import = seahorse_hkp_source_import;
-	key_class->export_raw = seahorse_hkp_source_export_raw;
-
+	gobject_class->set_property = seahorse_hkp_source_set_property;
+	
 	seahorse_hkp_source_parent_class = g_type_class_peek_parent (klass);
 
-	g_object_class_install_property (gobject_class, PROP_KEY_TYPE,
-	        g_param_spec_uint ("key-type", "Key Type", "Key type that originates from this key source.", 
-	                           0, G_MAXUINT, SEAHORSE_TAG_INVALID, G_PARAM_READABLE));
-
-	g_object_class_install_property (gobject_class, PROP_KEY_DESC,
-	        g_param_spec_string ("key-desc", "Key Desc", "Description for keys that originate here.",
-	                             NULL, G_PARAM_READABLE));
-	    
+	g_object_class_override_property (gobject_class, PROP_KEY_TYPE, "key-type");
+	g_object_class_override_property (gobject_class, PROP_KEY_DESC, "key-desc");
+	g_object_class_override_property (gobject_class, PROP_LOCATION, "location");
+
 	seahorse_registry_register_type (NULL, SEAHORSE_TYPE_HKP_SOURCE, "source", "remote", SEAHORSE_PGP_STR, NULL);
 	seahorse_servers_register_type ("hkp", _("HTTP Key Server"), seahorse_hkp_is_valid_uri);
+	
+	seahorse_registry_register_function (NULL, seahorse_pgp_key_get_cannonical_id, "canonize", SEAHORSE_PGP_STR, NULL);
 }
 
+static void 
+seahorse_source_iface (SeahorseSourceIface *iface)
+{
+	iface->search = seahorse_hkp_source_search;
+	iface->import = seahorse_hkp_source_import;
+	iface->export_raw = seahorse_hkp_source_export_raw;
+}
 
 /**
  * seahorse_hkp_source_new

Modified: trunk/pgp/seahorse-ldap-source.c
==============================================================================
--- trunk/pgp/seahorse-ldap-source.c	(original)
+++ trunk/pgp/seahorse-ldap-source.c	Sun Dec 14 16:18:47 2008
@@ -1253,11 +1253,14 @@
 enum {
     PROP_0,
     PROP_KEY_TYPE,
-    PROP_KEY_DESC
+    PROP_KEY_DESC,
+    PROP_LOCATION
 };
 
-G_DEFINE_TYPE (SeahorseLDAPSource, seahorse_ldap_source, SEAHORSE_TYPE_SERVER_SOURCE);
+static void seahorse_source_iface (SeahorseSourceIface *iface);
 
+G_DEFINE_TYPE_EXTENDED (SeahorseLDAPSource, seahorse_ldap_source, SEAHORSE_TYPE_SERVER_SOURCE, 0,
+                        G_IMPLEMENT_INTERFACE (SEAHORSE_TYPE_SOURCE, seahorse_source_iface));
 
 static void 
 seahorse_ldap_source_init (SeahorseLDAPSource *lsrc)
@@ -1276,9 +1279,19 @@
     case PROP_KEY_DESC:
         g_value_set_string (value, _("PGP Key"));
         break;
+    case PROP_LOCATION:
+        g_value_set_uint (value, SEAHORSE_LOCATION_REMOTE);
+        break;
     };        
 }
 
+static void 
+seahorse_ldap_source_set_property (GObject *object, guint prop_id, const GValue *value,
+                                   GParamSpec *pspec)
+{
+
+}
+
 static SeahorseOperation*
 seahorse_ldap_source_search (SeahorseSource *src, const gchar *match)
 {
@@ -1364,31 +1377,30 @@
 seahorse_ldap_source_class_init (SeahorseLDAPSourceClass *klass)
 {
 	GObjectClass *gobject_class;
-	SeahorseSourceClass *key_class;
    
 	gobject_class = G_OBJECT_CLASS (klass);
 	gobject_class->get_property = seahorse_ldap_source_get_property;
-   
-	key_class = SEAHORSE_SOURCE_CLASS (klass);
-	key_class->canonize_id = seahorse_pgp_key_get_cannonical_id;
-	key_class->search = seahorse_ldap_source_search;
-	key_class->import = seahorse_ldap_source_import;
-	key_class->export_raw = seahorse_ldap_source_export_raw;
+	gobject_class->set_property = seahorse_ldap_source_set_property;
 
 	seahorse_ldap_source_parent_class = g_type_class_peek_parent (klass);
     
-	g_object_class_install_property (gobject_class, PROP_KEY_TYPE,
-	        g_param_spec_uint ("key-type", "Key Type", "Key type that originates from this key source.", 
-	                           0, G_MAXUINT, SEAHORSE_TAG_INVALID, G_PARAM_READABLE));
-
-	g_object_class_install_property (gobject_class, PROP_KEY_DESC,
-	        g_param_spec_string ("key-desc", "Key Desc", "Description for keys that originate here.",
-	                             NULL, G_PARAM_READABLE));
+	g_object_class_override_property (gobject_class, PROP_KEY_TYPE, "key-type");
+	g_object_class_override_property (gobject_class, PROP_KEY_DESC, "key-desc");
+	g_object_class_override_property (gobject_class, PROP_LOCATION, "location");
 	    
 	seahorse_registry_register_type (NULL, SEAHORSE_TYPE_LDAP_SOURCE, "source", "remote", SEAHORSE_PGP_STR, NULL);
 	seahorse_servers_register_type ("ldap", _("LDAP Key Server"), seahorse_ldap_is_valid_uri);
+
+	seahorse_registry_register_function (NULL, seahorse_pgp_key_get_cannonical_id, "canonize", SEAHORSE_PGP_STR, NULL);
 }
 
+static void 
+seahorse_source_iface (SeahorseSourceIface *iface)
+{
+	iface->search = seahorse_ldap_source_search;
+	iface->import = seahorse_ldap_source_import;
+	iface->export_raw = seahorse_ldap_source_export_raw;
+}
 
 /**
  * seahorse_ldap_source_new

Modified: trunk/pgp/seahorse-pgp-source.c
==============================================================================
--- trunk/pgp/seahorse-pgp-source.c	(original)
+++ trunk/pgp/seahorse-pgp-source.c	Sun Dec 14 16:18:47 2008
@@ -251,7 +251,10 @@
     GList *orphan_secret;                   /* Orphan secret keys */
 };
 
-G_DEFINE_TYPE (SeahorsePGPSource, seahorse_pgp_source, SEAHORSE_TYPE_SOURCE);
+static void seahorse_source_iface (SeahorseSourceIface *iface);
+
+G_DEFINE_TYPE_EXTENDED (SeahorsePGPSource, seahorse_pgp_source, G_TYPE_OBJECT, 0,
+                        G_IMPLEMENT_INTERFACE (SEAHORSE_TYPE_SOURCE, seahorse_source_iface));
 
 /* GObject handlers */
 static void seahorse_pgp_source_dispose         (GObject *gobject);
@@ -285,7 +288,6 @@
 seahorse_pgp_source_class_init (SeahorsePGPSourceClass *klass)
 {
     GObjectClass *gobject_class;
-    SeahorseSourceClass *key_class;
     
     g_message ("init gpgme version %s", gpgme_check_version (NULL));
     
@@ -300,29 +302,25 @@
     gobject_class->finalize = seahorse_pgp_source_finalize;
     gobject_class->set_property = seahorse_pgp_source_set_property;
     gobject_class->get_property = seahorse_pgp_source_get_property;
-    
-    key_class = SEAHORSE_SOURCE_CLASS (klass);
-    key_class->canonize_id = seahorse_pgp_key_get_cannonical_id;
-    key_class->load = seahorse_pgp_source_load;
-    key_class->import = seahorse_pgp_source_import;
-    key_class->export = seahorse_pgp_source_export;
  
-    g_object_class_install_property (gobject_class, PROP_KEY_TYPE,
-        g_param_spec_uint ("key-type", "Key Type", "Key type that originates from this key source.", 
-                           0, G_MAXUINT, SEAHORSE_TAG_INVALID, G_PARAM_READABLE));
-                           
-    g_object_class_install_property (gobject_class, PROP_KEY_DESC,
-        g_param_spec_string ("key-desc", "Key Desc", "Description for keys that originate here.",
-                             NULL, G_PARAM_READABLE));
-
-    g_object_class_install_property (gobject_class, PROP_LOCATION,
-        g_param_spec_uint ("location", "Key Location", "Where the key is stored. See SeahorseLocation", 
-                           0, G_MAXUINT, SEAHORSE_LOCATION_INVALID, G_PARAM_READABLE));    
-    
+	g_object_class_override_property (gobject_class, PROP_KEY_TYPE, "key-type");
+	g_object_class_override_property (gobject_class, PROP_KEY_DESC, "key-desc");
+	g_object_class_override_property (gobject_class, PROP_LOCATION, "location");
+	
 	seahorse_registry_register_type (NULL, SEAHORSE_TYPE_PGP_SOURCE, "source", "local", SEAHORSE_PGP_STR, NULL);
 
+	seahorse_registry_register_function (NULL, seahorse_pgp_key_get_cannonical_id, "canonize", SEAHORSE_PGP_STR, NULL);
 }
 
+static void 
+seahorse_source_iface (SeahorseSourceIface *iface)
+{
+	iface->load = seahorse_pgp_source_load;
+	iface->import = seahorse_pgp_source_import;
+	iface->export = seahorse_pgp_source_export;
+}
+
+
 /* init context, private vars, set prefs, connect signals */
 static void
 seahorse_pgp_source_init (SeahorsePGPSource *psrc)

Modified: trunk/pgp/seahorse-pgp-source.h
==============================================================================
--- trunk/pgp/seahorse-pgp-source.h	(original)
+++ trunk/pgp/seahorse-pgp-source.h	Sun Dec 14 16:18:47 2008
@@ -56,17 +56,13 @@
 typedef struct _SeahorsePGPSourcePrivate SeahorsePGPSourcePrivate;
 
 struct _SeahorsePGPSource {
-    SeahorseSource parent;
-    
-    /*< public >*/
-    gpgme_ctx_t gctx;
-    
-    /*< private >*/
-    SeahorsePGPSourcePrivate *pv;
+	GObject parent;
+	gpgme_ctx_t gctx;
+	SeahorsePGPSourcePrivate *pv;
 };
 
 struct _SeahorsePGPSourceClass {
-    SeahorseSourceClass parent_class;
+	GObjectClass parent_class;
 };
 
 GType                seahorse_pgp_source_get_type       (void);

Modified: trunk/pgp/seahorse-server-source.c
==============================================================================
--- trunk/pgp/seahorse-server-source.c	(original)
+++ trunk/pgp/seahorse-server-source.c	Sun Dec 14 16:18:47 2008
@@ -53,7 +53,10 @@
     gchar *uri;
 };
 
-G_DEFINE_TYPE (SeahorseServerSource, seahorse_server_source, SEAHORSE_TYPE_SOURCE);
+static void seahorse_source_iface (SeahorseSourceIface *iface);
+
+G_DEFINE_TYPE_EXTENDED (SeahorseServerSource, seahorse_server_source, G_TYPE_OBJECT, 0,
+                        G_IMPLEMENT_INTERFACE (SEAHORSE_TYPE_SOURCE, seahorse_source_iface));
 
 /* GObject handlers */
 static void seahorse_server_source_dispose    (GObject *gobject);
@@ -64,7 +67,7 @@
                                                const GValue *value, GParamSpec *pspec);
                                                
 /* SeahorseSource methods */
-static SeahorseOperation*  seahorse_server_source_load (SeahorseSource *src, GQuark keyid);
+static SeahorseOperation*  seahorse_server_source_load (SeahorseSource *src);
 
 static GObjectClass *parent_class = NULL;
 
@@ -73,33 +76,19 @@
 seahorse_server_source_class_init (SeahorseServerSourceClass *klass)
 {
     GObjectClass *gobject_class;
-    SeahorseSourceClass *key_class;
    
     parent_class = g_type_class_peek_parent (klass);
     gobject_class = G_OBJECT_CLASS (klass);
     
-    key_class = SEAHORSE_SOURCE_CLASS (klass);
-        
-    key_class->canonize_id = seahorse_pgp_key_get_cannonical_id;
-    key_class->load = seahorse_server_source_load;
-    
     gobject_class->dispose = seahorse_server_source_dispose;
     gobject_class->finalize = seahorse_server_source_finalize;
     gobject_class->set_property = seahorse_server_set_property;
     gobject_class->get_property = seahorse_server_get_property;
-    
-    g_object_class_install_property (gobject_class, PROP_KEY_TYPE,
-        g_param_spec_uint ("key-type", "Key Type", "Key type that originates from this key source.", 
-                           0, G_MAXUINT, SEAHORSE_TAG_INVALID, G_PARAM_READABLE));
-
-    g_object_class_install_property (gobject_class, PROP_KEY_DESC,
-        g_param_spec_string ("key-desc", "Key Desc", "Description for keys that originate here.",
-                             NULL, G_PARAM_READABLE));
-
-    g_object_class_install_property (gobject_class, PROP_LOCATION,
-        g_param_spec_uint ("location", "Key Location", "Where the key is stored. See SeahorseLocation", 
-                           0, G_MAXUINT, SEAHORSE_LOCATION_INVALID, G_PARAM_READABLE));    
-                           
+
+	g_object_class_override_property (gobject_class, PROP_KEY_TYPE, "key-type");
+	g_object_class_override_property (gobject_class, PROP_KEY_DESC, "key-desc");
+	g_object_class_override_property (gobject_class, PROP_LOCATION, "location");
+	
     g_object_class_install_property (gobject_class, PROP_KEY_SERVER,
             g_param_spec_string ("key-server", "Key Server",
                                  "Key Server to search on", "",
@@ -109,6 +98,14 @@
             g_param_spec_string ("uri", "Key Server URI",
                                  "Key Server full URI", "",
                                  G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
+    
+	seahorse_registry_register_function (NULL, seahorse_pgp_key_get_cannonical_id, "canonize", SEAHORSE_PGP_STR, NULL);
+}
+
+static void 
+seahorse_source_iface (SeahorseSourceIface *iface)
+{
+	iface->load = seahorse_server_source_load;
 }
 
 /* init context, private vars, set prefs, connect signals */
@@ -310,7 +307,7 @@
  */
 
 static SeahorseOperation*
-seahorse_server_source_load (SeahorseSource *src, GQuark keyid)
+seahorse_server_source_load (SeahorseSource *src)
 {
     SeahorseServerSource *ssrc;
     

Modified: trunk/pgp/seahorse-server-source.h
==============================================================================
--- trunk/pgp/seahorse-server-source.h	(original)
+++ trunk/pgp/seahorse-server-source.h	Sun Dec 14 16:18:47 2008
@@ -55,14 +55,12 @@
 typedef struct _SeahorseServerSourcePrivate SeahorseServerSourcePrivate;
 
 struct _SeahorseServerSource {
-    SeahorseSource parent;
-    
-    /*< private >*/
-    SeahorseServerSourcePrivate *priv;
+	GObject parent;
+	SeahorseServerSourcePrivate *priv;
 };
 
 struct _SeahorseServerSourceClass {
-    SeahorseSourceClass parent_class;
+	GObjectClass parent_class;
 };
 
 GType        seahorse_server_source_get_type         (void);

Modified: trunk/pkcs11/seahorse-pkcs11-source.c
==============================================================================
--- trunk/pkcs11/seahorse-pkcs11-source.c	(original)
+++ trunk/pkcs11/seahorse-pkcs11-source.c	Sun Dec 14 16:18:47 2008
@@ -53,8 +53,10 @@
 	GP11Slot *slot;    
 };
 
-G_DEFINE_TYPE (SeahorsePkcs11Source, seahorse_pkcs11_source, SEAHORSE_TYPE_SOURCE);
+static void seahorse_source_iface (SeahorseSourceIface *iface);
 
+G_DEFINE_TYPE_EXTENDED (SeahorsePkcs11Source, seahorse_pkcs11_source, G_TYPE_OBJECT, 0,
+                        G_IMPLEMENT_INTERFACE (SEAHORSE_TYPE_SOURCE, seahorse_source_iface));
 
 /* -----------------------------------------------------------------------------
  * OBJECT
@@ -154,7 +156,6 @@
 seahorse_pkcs11_source_class_init (SeahorsePkcs11SourceClass *klass)
 {
 	GObjectClass *gobject_class;
-	SeahorseSourceClass *key_class;
     
 	seahorse_pkcs11_source_parent_class = g_type_class_peek_parent (klass);
 	g_type_class_add_private (klass, sizeof (SeahorsePkcs11SourcePrivate));
@@ -166,32 +167,27 @@
 	gobject_class->set_property = seahorse_pkcs11_source_set_property;
 	gobject_class->get_property = seahorse_pkcs11_source_get_property;
     
-	key_class = SEAHORSE_SOURCE_CLASS (klass);    
-	key_class->load = seahorse_pkcs11_source_load;
-
 	g_object_class_install_property (gobject_class, PROP_SLOT,
 	         g_param_spec_object ("slot", "Slot", "Pkcs#11 SLOT",
 	                              GP11_TYPE_SLOT, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
     
-	g_object_class_install_property (gobject_class, PROP_KEY_TYPE,
-	         g_param_spec_uint ("key-type", "Key Type", "Key type that originates from this key source.", 
-	                            0, G_MAXUINT, SEAHORSE_TAG_INVALID, G_PARAM_READABLE));
-    
 	g_object_class_install_property (gobject_class, PROP_FLAGS,
 	         g_param_spec_uint ("flags", "Flags", "Object Source flags.", 
 	                            0, G_MAXUINT, 0, G_PARAM_READABLE));
 
-	g_object_class_install_property (gobject_class, PROP_KEY_DESC,
-	         g_param_spec_string ("key-desc", "Key Desc", "Description for keys that originate here.",
-	                              NULL, G_PARAM_READABLE));
-
-	g_object_class_install_property (gobject_class, PROP_LOCATION,
-	         g_param_spec_uint ("location", "Key Location", "Where the key is stored. See SeahorseLocation", 
-	                            0, G_MAXUINT, SEAHORSE_LOCATION_INVALID, G_PARAM_READABLE));    
+	g_object_class_override_property (gobject_class, PROP_KEY_TYPE, "key-type");
+	g_object_class_override_property (gobject_class, PROP_KEY_DESC, "key-desc");
+	g_object_class_override_property (gobject_class, PROP_LOCATION, "location");
     
 	seahorse_registry_register_type (NULL, SEAHORSE_TYPE_PKCS11_SOURCE, "source", "local", SEAHORSE_PKCS11_TYPE_STR, NULL);
 }
 
+static void 
+seahorse_source_iface (SeahorseSourceIface *iface)
+{
+	iface->load = seahorse_pkcs11_source_load;
+}
+
 /* -------------------------------------------------------------------------- 
  * PUBLIC
  */

Modified: trunk/pkcs11/seahorse-pkcs11-source.h
==============================================================================
--- trunk/pkcs11/seahorse-pkcs11-source.h	(original)
+++ trunk/pkcs11/seahorse-pkcs11-source.h	Sun Dec 14 16:18:47 2008
@@ -39,12 +39,12 @@
 typedef struct _SeahorsePkcs11SourcePrivate SeahorsePkcs11SourcePrivate;
 
 struct _SeahorsePkcs11Source {
-	SeahorseSource parent;
+	GObject parent;
 	SeahorsePkcs11SourcePrivate *pv;
 };
 
 struct _SeahorsePkcs11SourceClass {
-	SeahorseSourceClass parent_class;
+	GObjectClass parent_class;
 };
 
 GType                  seahorse_pkcs11_source_get_type          (void);

Modified: trunk/ssh/seahorse-ssh-source.c
==============================================================================
--- trunk/ssh/seahorse-ssh-source.c	(original)
+++ trunk/ssh/seahorse-ssh-source.c	Sun Dec 14 16:18:47 2008
@@ -86,7 +86,10 @@
     SeahorseMultiOperation *mop;
 } ImportContext;
 
-G_DEFINE_TYPE (SeahorseSSHSource, seahorse_ssh_source, SEAHORSE_TYPE_SOURCE);
+static void seahorse_source_iface (SeahorseSourceIface *iface);
+
+G_DEFINE_TYPE_EXTENDED (SeahorseSSHSource, seahorse_ssh_source, G_TYPE_OBJECT, 0,
+                        G_IMPLEMENT_INTERFACE (SEAHORSE_TYPE_SOURCE, seahorse_source_iface));
 
 #define AUTHORIZED_KEYS_FILE    "authorized_keys"
 #define OTHER_KEYS_FILE         "other_keys.seahorse"
@@ -692,7 +695,6 @@
 seahorse_ssh_source_class_init (SeahorseSSHSourceClass *klass)
 {
     GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-    SeahorseSourceClass *parent_class = SEAHORSE_SOURCE_CLASS (klass);
    
     seahorse_ssh_source_parent_class = g_type_class_peek_parent (klass);
     
@@ -701,28 +703,25 @@
     gobject_class->set_property = seahorse_ssh_source_set_property;
     gobject_class->get_property = seahorse_ssh_source_get_property;
     
-    parent_class->canonize_id = seahorse_ssh_key_get_cannonical_id;
-    parent_class->load = seahorse_ssh_source_load;
-    parent_class->import = seahorse_ssh_source_import;
-    parent_class->export = seahorse_ssh_source_export;
- 
-    g_object_class_install_property (gobject_class, PROP_KEY_TYPE,
-        g_param_spec_uint ("key-type", "Key Type", "Key type that originates from this key source.", 
-                           0, G_MAXUINT, SEAHORSE_TAG_INVALID, G_PARAM_READABLE));
+	g_object_class_override_property (gobject_class, PROP_KEY_TYPE, "key-type");
+	g_object_class_override_property (gobject_class, PROP_KEY_DESC, "key-desc");
+	g_object_class_override_property (gobject_class, PROP_LOCATION, "location");
 
-    g_object_class_install_property (gobject_class, PROP_KEY_DESC,
-        g_param_spec_string ("key-desc", "Key Desc", "Description for keys that originate here.",
-                             NULL, G_PARAM_READABLE));
-
-    g_object_class_install_property (gobject_class, PROP_LOCATION,
-        g_param_spec_uint ("location", "Key Location", "Where the key is stored. See SeahorseLocation", 
-                           0, G_MAXUINT, SEAHORSE_LOCATION_INVALID, G_PARAM_READABLE));    
-                           
     g_object_class_install_property (gobject_class, PROP_BASE_DIRECTORY,
         g_param_spec_string ("base-directory", "Key directory", "Directory where the keys are stored",
                              NULL, G_PARAM_READABLE));
     
 	seahorse_registry_register_type (NULL, SEAHORSE_TYPE_SSH_SOURCE, "source", "local", SEAHORSE_SSH_STR, NULL);
+	
+	seahorse_registry_register_function (NULL, seahorse_ssh_key_get_cannonical_id, "canonize", SEAHORSE_SSH_STR, NULL);
+}
+
+static void 
+seahorse_source_iface (SeahorseSourceIface *iface)
+{
+	iface->load = seahorse_ssh_source_load;
+	iface->import = seahorse_ssh_source_import;
+	iface->export = seahorse_ssh_source_export;
 }
 
 /* -----------------------------------------------------------------------------

Modified: trunk/ssh/seahorse-ssh-source.h
==============================================================================
--- trunk/ssh/seahorse-ssh-source.h	(original)
+++ trunk/ssh/seahorse-ssh-source.h	Sun Dec 14 16:18:47 2008
@@ -54,14 +54,12 @@
 typedef struct _SeahorseSSHSourcePrivate SeahorseSSHSourcePrivate;
 
 struct _SeahorseSSHSource {
-    SeahorseSource parent;
-    
-    /*< private >*/
-    SeahorseSSHSourcePrivate *priv;
+	GObject parent;
+	SeahorseSSHSourcePrivate *priv;
 };
 
 struct _SeahorseSSHSourceClass {
-    SeahorseSourceClass parent_class;
+	GObjectClass parent_class;
 };
 
 GType                seahorse_ssh_source_get_type           (void);



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