seahorse r2319 - in trunk: common daemon gkr libseahorse pgp pkcs11 src ssh



Author: nnielsen
Date: Thu Jul 31 02:12:05 2008
New Revision: 2319
URL: http://svn.gnome.org/viewvc/seahorse?rev=2319&view=rev

Log:
	* common/seahorse-registry.c:
	* common/seahorse-registry.h:
	* daemon/seahorse-daemon.c:
	* gkr/seahorse-gkr-module.c:
	* gkr/seahorse-gkr-module.h:
	* libseahorse/seahorse-context.c:
	* libseahorse/seahorse-context.h:
	* pgp/seahorse-hkp-source.c:
	* pgp/seahorse-ldap-source.c:
	* pgp/seahorse-pgp-module.c:
	* pgp/seahorse-pgp-module.h:
	* pgp/seahorse-pgp-source.c:
	* pkcs11/seahorse-pkcs11-module.c:
	* pkcs11/seahorse-pkcs11-module.h:
	* src/main.c:
	* src/seahorse-keyserver-search.c:
	* ssh/seahorse-ssh-module.c:
	* ssh/seahorse-ssh-module.h:
	* ssh/seahorse-ssh-source.c: Simplify initialization of modules,
	and make modules add sources to context explicitly.

Modified:
   trunk/common/seahorse-registry.c
   trunk/common/seahorse-registry.h
   trunk/daemon/seahorse-daemon.c
   trunk/gkr/seahorse-gkr-module.c
   trunk/gkr/seahorse-gkr-module.h
   trunk/libseahorse/seahorse-context.c
   trunk/libseahorse/seahorse-context.h
   trunk/pgp/seahorse-hkp-source.c
   trunk/pgp/seahorse-ldap-source.c
   trunk/pgp/seahorse-pgp-module.c
   trunk/pgp/seahorse-pgp-module.h
   trunk/pgp/seahorse-pgp-source.c
   trunk/pkcs11/seahorse-pkcs11-module.c
   trunk/pkcs11/seahorse-pkcs11-module.h
   trunk/src/main.c
   trunk/src/seahorse-keyserver-search.c
   trunk/ssh/seahorse-ssh-module.c
   trunk/ssh/seahorse-ssh-module.h
   trunk/ssh/seahorse-ssh-source.c

Modified: trunk/common/seahorse-registry.c
==============================================================================
--- trunk/common/seahorse-registry.c	(original)
+++ trunk/common/seahorse-registry.c	Thu Jul 31 02:12:05 2008
@@ -183,23 +183,6 @@
 }
 
 void
-seahorse_registry_load_types (SeahorseRegistry *registry, const SeahorseRegisterType *types)
-{
-	GType type;
-	gpointer klass;
-	
-	while (*types) {
-		type = (*types) ();
-		g_return_if_fail (type);
-		
-		klass = g_type_class_ref (type);
-		g_type_class_unref (klass);
-		
-		++types;
-	}
-}
-
-void
 seahorse_registry_register_type (SeahorseRegistry *registry, GType type, 
                             const gchar *category, ...)
 {

Modified: trunk/common/seahorse-registry.h
==============================================================================
--- trunk/common/seahorse-registry.h	(original)
+++ trunk/common/seahorse-registry.h	Thu Jul 31 02:12:05 2008
@@ -26,8 +26,6 @@
 
 G_BEGIN_DECLS
 
-typedef GType (*SeahorseRegisterType) (void);
-
 #define SEAHORSE_TYPE_REGISTRY             (seahorse_registry_get_type())
 #define SEAHORSE_REGISTRY(obj)             (G_TYPE_CHECK_INSTANCE_CAST((obj), SEAHORSE_TYPE_REGISTRY, SeahorseRegistry))
 #define SEAHORSE_REGISTRY_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST((klass), SEAHORSE_TYPE_REGISTRY, GObject))
@@ -51,9 +49,6 @@
 
 SeahorseRegistry*    seahorse_registry_get             (void);
 
-void                 seahorse_registry_load_types      (SeahorseRegistry *registry, 
-                                                        const SeahorseRegisterType *types);
-
 void                 seahorse_registry_register_type   (SeahorseRegistry *registry, 
                                                         GType type, const gchar *category, 
                                                         ...) G_GNUC_NULL_TERMINATED;

Modified: trunk/daemon/seahorse-daemon.c
==============================================================================
--- trunk/daemon/seahorse-daemon.c	(original)
+++ trunk/daemon/seahorse-daemon.c	Thu Jul 31 02:12:05 2008
@@ -211,17 +211,18 @@
     seahorse_gtkstock_init ();
     seahorse_gtkstock_add_icons (daemon_icons);
     
+    /* Make the default SeahorseContext */
+    seahorse_context_new (SEAHORSE_CONTEXT_APP | SEAHORSE_CONTEXT_DAEMON);
+
     /* Load the various components */
 #ifdef WITH_PGP
-    seahorse_registry_load_types (NULL, SEAHORSE_PGP_REGISTRY);
+    seahorse_pgp_module_init ();
 #endif
 #ifdef WITH_SSH
-    seahorse_registry_load_types (NULL, SEAHORSE_SSH_REGISTRY);
+    seahorse_ssh_module_init ();
 #endif
-
-    /* Make the default SeahorseContext */
-    seahorse_context_new (SEAHORSE_CONTEXT_APP | SEAHORSE_CONTEXT_DAEMON, 0);
-    op = seahorse_context_load_local_objects (SCTX_APP ());
+    
+    op = seahorse_context_refresh_local (NULL);
     g_object_unref (op);
     
     /* Initialize the various daemon components */

Modified: trunk/gkr/seahorse-gkr-module.c
==============================================================================
--- trunk/gkr/seahorse-gkr-module.c	(original)
+++ trunk/gkr/seahorse-gkr-module.c	Thu Jul 31 02:12:05 2008
@@ -26,8 +26,18 @@
 #include "seahorse-gkr-commands.h"
 #include "seahorse-gkeyring-source.h"
 
-const SeahorseRegisterType SEAHORSE_GKR_REGISTRY[] = {
-	seahorse_gkeyring_source_get_type,
-	seahorse_gkeyring_commands_get_type,
-	NULL
-};
+#include "seahorse-context.h"
+
+void
+seahorse_gkr_module_init (void)
+{
+	SeahorseSource *source;
+
+	/* Always have a default keyring source added */
+	source = g_object_new (SEAHORSE_TYPE_GKEYRING_SOURCE, NULL);
+	seahorse_context_take_source (NULL, source);
+
+	/* Let these classes register themselves */
+	g_type_class_unref (g_type_class_ref (SEAHORSE_TYPE_GKEYRING_SOURCE));
+	g_type_class_unref (g_type_class_ref (SEAHORSE_GKEYRING_TYPE_COMMANDS));
+}

Modified: trunk/gkr/seahorse-gkr-module.h
==============================================================================
--- trunk/gkr/seahorse-gkr-module.h	(original)
+++ trunk/gkr/seahorse-gkr-module.h	Thu Jul 31 02:12:05 2008
@@ -22,11 +22,9 @@
 #ifndef SEAHORSEGKR_H_
 #define SEAHORSEGKR_H_
 
-#include "common/seahorse-registry.h"
-
 #define SEAHORSE_GKR_STR                     "gnome-keyring"
 #define SEAHORSE_GKR                         (g_quark_from_static_string (SEAHORSE_GKR_STR))
 
-extern const SeahorseRegisterType SEAHORSE_GKR_REGISTRY[];
+void         seahorse_gkr_module_init        (void);
 
 #endif /*SEAHORSEGKR_H_*/

Modified: trunk/libseahorse/seahorse-context.c
==============================================================================
--- trunk/libseahorse/seahorse-context.c	(original)
+++ trunk/libseahorse/seahorse-context.c	Thu Jul 31 02:12:05 2008
@@ -203,7 +203,7 @@
 }
    
 SeahorseContext*
-seahorse_context_new (guint flags, guint ktype)
+seahorse_context_new (guint flags)
 {
 	SeahorseContext *sctx = g_object_new (SEAHORSE_TYPE_CONTEXT, NULL);
     
@@ -211,15 +211,6 @@
 	    sctx->is_daemon = TRUE;
     
 	if (flags & SEAHORSE_CONTEXT_APP) {
-		
-		GList *l, *types;
-		
-		types = seahorse_registry_find_types (NULL, "key-source", "local", NULL);
-		for (l = types; l; l = g_list_next (l)) {
-			SeahorseSource *src = g_object_new (GPOINTER_TO_UINT (l->data), NULL);
-			seahorse_context_take_source (sctx, src);
-		}
-		g_list_free (types);
 
 		/* DNS-SD discovery */    
 		sctx->pv->discovery = seahorse_service_discovery_new ();
@@ -265,8 +256,11 @@
 void                
 seahorse_context_take_source (SeahorseContext *sctx, SeahorseSource *sksrc)
 {
-    g_return_if_fail (SEAHORSE_IS_CONTEXT (sctx));
     g_return_if_fail (SEAHORSE_IS_SOURCE (sksrc));
+    
+    if (!sctx)
+        sctx = seahorse_context_for_app ();
+    g_return_if_fail (SEAHORSE_IS_CONTEXT (sctx));
 
     if (!g_slist_find (sctx->pv->sources, sksrc))
         sctx->pv->sources = g_slist_append (sctx->pv->sources, sksrc);
@@ -275,9 +269,12 @@
 void
 seahorse_context_add_source (SeahorseContext *sctx, SeahorseSource *sksrc)
 {
-    g_return_if_fail (SEAHORSE_IS_CONTEXT (sctx));
     g_return_if_fail (SEAHORSE_IS_SOURCE (sksrc));
 
+    if (!sctx)
+        sctx = seahorse_context_for_app ();
+    g_return_if_fail (SEAHORSE_IS_CONTEXT (sctx));
+    
     if (g_slist_find (sctx->pv->sources, sksrc))
         return;
     
@@ -290,9 +287,12 @@
 {
     GList *l, *objects;
     
-    g_return_if_fail (SEAHORSE_IS_CONTEXT (sctx));
     g_return_if_fail (SEAHORSE_IS_SOURCE (sksrc));
 
+    if (!sctx)
+        sctx = seahorse_context_for_app ();
+    g_return_if_fail (SEAHORSE_IS_CONTEXT (sctx));
+
     if (!g_slist_find (sctx->pv->sources, sksrc)) 
         return;
 
@@ -313,7 +313,9 @@
     SeahorseSource *ks;
     GSList *l;
     
-    g_return_val_if_fail (SEAHORSE_IS_CONTEXT (sctx), NULL);
+    if (!sctx)
+        sctx = seahorse_context_for_app ();
+    g_return_if_fail (SEAHORSE_IS_CONTEXT (sctx));
 
     for (l = sctx->pv->sources; l; l = g_slist_next (l)) {
         ks = SEAHORSE_SOURCE (l->data);
@@ -347,7 +349,9 @@
     GSList *sources = NULL;
     GSList *l;
     
-    g_return_val_if_fail (SEAHORSE_IS_CONTEXT (sctx), NULL);
+    if (!sctx)
+        sctx = seahorse_context_for_app ();
+    g_return_if_fail (SEAHORSE_IS_CONTEXT (sctx));
 
     for (l = sctx->pv->sources; l; l = g_slist_next (l)) {
         ks = SEAHORSE_SOURCE (l->data);
@@ -374,9 +378,12 @@
     gchar *ks_uri;
     GSList *l;
     
-    g_return_val_if_fail (SEAHORSE_IS_CONTEXT (sctx), NULL);
     g_return_val_if_fail (uri && *uri, NULL);
 
+    if (!sctx)
+        sctx = seahorse_context_for_app ();
+    g_return_if_fail (SEAHORSE_IS_CONTEXT (sctx));
+
     for (l = sctx->pv->sources; l; l = g_slist_next (l)) {
         ks = SEAHORSE_SOURCE (l->data);
         
@@ -494,6 +501,10 @@
 void
 seahorse_context_add_object (SeahorseContext *sctx, SeahorseObject *sobj)
 {
+    if (!sctx)
+        sctx = seahorse_context_for_app ();
+    g_return_if_fail (SEAHORSE_IS_CONTEXT (sctx));
+
     g_object_ref (sobj);
     seahorse_context_take_object (sctx, sobj);
 }
@@ -503,6 +514,8 @@
 {
     gpointer ks;
     
+    if (!sctx)
+        sctx = seahorse_context_for_app ();
     g_return_if_fail (SEAHORSE_IS_CONTEXT (sctx));
     g_return_if_fail (SEAHORSE_IS_OBJECT (sobj));
     g_return_if_fail (sobj->_id != 0);
@@ -528,6 +541,9 @@
 guint
 seahorse_context_get_count (SeahorseContext *sctx)
 {
+    if (!sctx)
+        sctx = seahorse_context_for_app ();
+    g_return_if_fail (SEAHORSE_IS_CONTEXT (sctx));
     return g_hash_table_size (sctx->pv->objects_by_source);
 }
 
@@ -537,7 +553,9 @@
 {
     gconstpointer k;
     
-    g_return_val_if_fail (SEAHORSE_IS_CONTEXT (sctx), NULL);
+    if (!sctx)
+        sctx = seahorse_context_for_app ();
+    g_return_if_fail (SEAHORSE_IS_CONTEXT (sctx));
     g_return_val_if_fail (SEAHORSE_IS_SOURCE (sksrc), NULL);
     
     k = hashkey_by_source (sksrc, id);
@@ -572,7 +590,9 @@
     SeahorseObjectPredicate kp;
     ObjectMatcher km;
 
-    g_return_val_if_fail (SEAHORSE_IS_CONTEXT (sctx), NULL);
+    if (!sctx)
+        sctx = seahorse_context_for_app ();
+    g_return_if_fail (SEAHORSE_IS_CONTEXT (sctx));
     g_return_val_if_fail (sksrc == NULL || SEAHORSE_IS_SOURCE (sksrc), NULL);
 
     memset (&kp, 0, sizeof (kp));
@@ -590,7 +610,11 @@
 seahorse_context_find_object (SeahorseContext *sctx, GQuark id, SeahorseLocation location)
 {
     SeahorseObject *sobj; 
-    
+
+    if (!sctx)
+        sctx = seahorse_context_for_app ();
+    g_return_if_fail (SEAHORSE_IS_CONTEXT (sctx));
+
     sobj = (SeahorseObject*)g_hash_table_lookup (sctx->pv->objects_by_type, GUINT_TO_POINTER (id));
     while (sobj) {
         
@@ -614,6 +638,10 @@
 {
     SeahorseObjectPredicate pred;
     memset (&pred, 0, sizeof (pred));
+
+    if (!sctx)
+        sctx = seahorse_context_for_app ();
+    g_return_if_fail (SEAHORSE_IS_CONTEXT (sctx));
     
     pred.tag = ktype;
     pred.usage = usage;
@@ -627,7 +655,9 @@
 {
     ObjectMatcher km;
 
-    g_return_val_if_fail (SEAHORSE_IS_CONTEXT (sctx), NULL);
+    if (!sctx)
+        sctx = seahorse_context_for_app ();
+    g_return_if_fail (SEAHORSE_IS_CONTEXT (sctx));
 
     memset (&km, 0, sizeof (km));
     
@@ -649,6 +679,8 @@
 {
     gconstpointer k;
     
+    if (!sctx)
+        sctx = seahorse_context_for_app ();
     g_return_if_fail (SEAHORSE_IS_CONTEXT (sctx));
     g_return_if_fail (SEAHORSE_IS_OBJECT (sobj));
     
@@ -686,6 +718,10 @@
     SeahorseObject *sobj = NULL;
     gchar *id;
     
+    if (!sctx)
+        sctx = seahorse_context_for_app ();
+    g_return_if_fail (SEAHORSE_IS_CONTEXT (sctx));
+
     /* TODO: All of this needs to take multiple key types into account */
     
     id = seahorse_gconf_get_string (SEAHORSE_DEFAULT_KEY);
@@ -712,19 +748,25 @@
 SeahorseServiceDiscovery*
 seahorse_context_get_discovery (SeahorseContext *sctx)
 {
+    if (!sctx)
+        sctx = seahorse_context_for_app ();
+    g_return_if_fail (SEAHORSE_IS_CONTEXT (sctx));
     g_return_val_if_fail (sctx->pv->discovery != NULL, NULL);
+    
     return sctx->pv->discovery;
 }
 
 SeahorseOperation*  
-seahorse_context_load_local_objects (SeahorseContext *sctx)
+seahorse_context_refresh_local (SeahorseContext *sctx)
 {
     SeahorseSource *ks;
     SeahorseMultiOperation *mop = NULL;
     SeahorseOperation *op = NULL;
     GSList *l;
     
-    g_return_val_if_fail (SEAHORSE_IS_CONTEXT (sctx), NULL);
+    if (!sctx)
+        sctx = seahorse_context_for_app ();
+    g_return_if_fail (SEAHORSE_IS_CONTEXT (sctx));
 
     for (l = sctx->pv->sources; l; l = g_slist_next (l)) {
         ks = SEAHORSE_SOURCE (l->data);
@@ -746,23 +788,23 @@
 }
 
 static gboolean 
-load_local_objects (SeahorseContext *sctx)
+refresh_local (SeahorseContext *sctx)
 {
-    SeahorseOperation *op = seahorse_context_load_local_objects (sctx);
+    SeahorseOperation *op = seahorse_context_refresh_local (sctx);
     g_return_val_if_fail (op != NULL, FALSE);
     g_object_unref (op);
     return FALSE;
 }
 
 void
-seahorse_context_load_local_objects_async (SeahorseContext *sctx)
+seahorse_context_refresh_local_async (SeahorseContext *sctx)
 {
-    g_idle_add_full (G_PRIORITY_LOW, (GSourceFunc)load_local_objects, sctx, NULL);
+    g_idle_add_full (G_PRIORITY_LOW, (GSourceFunc)refresh_local, sctx, NULL);
 }
 
 
 SeahorseOperation*  
-seahorse_context_load_remote_objects (SeahorseContext *sctx, const gchar *search)
+seahorse_context_search_remote (SeahorseContext *sctx, const gchar *search)
 {
     SeahorseSource *ks;
     SeahorseMultiOperation *mop = NULL;
@@ -771,7 +813,9 @@
     GHashTable *servers = NULL;
     gchar *uri;
     
-    g_return_val_if_fail (SEAHORSE_IS_CONTEXT (sctx), NULL);
+    if (!sctx)
+        sctx = seahorse_context_for_app ();
+    g_return_if_fail (SEAHORSE_IS_CONTEXT (sctx));
     
     /* Get a list of all selected key servers */
     names = seahorse_gconf_get_string_list (LASTSERVERS_KEY);
@@ -892,6 +936,10 @@
     GList *next, *l;
     GQuark ktype;
 
+    if (!sctx)
+        sctx = seahorse_context_for_app ();
+    g_return_if_fail (SEAHORSE_IS_CONTEXT (sctx));
+
     objects = g_list_copy (objects);
     
     /* Sort by key source */
@@ -970,6 +1018,10 @@
     SeahorseSource *sksrc;
     GSList *sources, *l;
     
+    if (!sctx)
+        sctx = seahorse_context_for_app ();
+    g_return_if_fail (SEAHORSE_IS_CONTEXT (sctx));
+
     if (!to) {
         to = seahorse_context_find_source (sctx, ktype, SEAHORSE_LOCATION_LOCAL);
         if (!to) {
@@ -1020,6 +1072,10 @@
     SeahorseOperation *op;
     GSList *l;
 
+    if (!sctx)
+        sctx = seahorse_context_for_app ();
+    g_return_if_fail (SEAHORSE_IS_CONTEXT (sctx));
+
     /* Check all the ids */
     for (l = rawids; l; l = g_slist_next (l)) {
         

Modified: trunk/libseahorse/seahorse-context.h
==============================================================================
--- trunk/libseahorse/seahorse-context.h	(original)
+++ trunk/libseahorse/seahorse-context.h	Thu Jul 31 02:12:05 2008
@@ -25,7 +25,8 @@
  * together. 
  *
  * - Usually there's only one SeahorseContext per process created by passing 
- *   |TRUE| to |seahorse_context_new|, and accessed via the |SCTX_APP| macro.
+ *   |SEAHORSE_CONTEXT_APP| to |seahorse_context_new|, and accessed via 
+ *   the |SCTX_APP| macro.
  * - Retains the list of all valid struct _SeahorseObject objects. 
  * - Has a collection of SeahorseSource objects which add objects to the 
  *   SeahorseContext. 
@@ -96,8 +97,7 @@
 
 SeahorseContext*    seahorse_context_for_app            (void);
 
-SeahorseContext*    seahorse_context_new                (guint              flags,
-                                                         guint              ktype);
+SeahorseContext*    seahorse_context_new                (guint              flags);
 
 void                seahorse_context_destroy            (SeahorseContext    *sctx);
 
@@ -162,12 +162,12 @@
 
 struct _SeahorseKey*   seahorse_context_get_default_key (SeahorseContext    *sctx);
 
-SeahorseOperation*  seahorse_context_load_local_objects (SeahorseContext    *sctx);
+SeahorseOperation*  seahorse_context_refresh_local         (SeahorseContext    *sctx);
 
-void                seahorse_context_load_local_objects_async (SeahorseContext *sctx);
+void                seahorse_context_refresh_local_async   (SeahorseContext *sctx);
 
-SeahorseOperation*  seahorse_context_load_remote_objects      (SeahorseContext    *sctx,
-                                                               const gchar        *search);
+SeahorseOperation*  seahorse_context_search_remote         (SeahorseContext    *sctx,
+                                                            const gchar        *search);
 
 SeahorseOperation*  seahorse_context_transfer_objects   (SeahorseContext    *sctx, 
                                                          GList              *objs, 

Modified: trunk/pgp/seahorse-hkp-source.c
==============================================================================
--- trunk/pgp/seahorse-hkp-source.c	(original)
+++ trunk/pgp/seahorse-hkp-source.c	Thu Jul 31 02:12:05 2008
@@ -36,6 +36,8 @@
 #include "seahorse-servers.h"
 #include "seahorse-util.h"
 
+#include "common/seahorse-registry.h"
+
 #include <libsoup/soup.h>
 
 #ifdef WITH_HKP

Modified: trunk/pgp/seahorse-ldap-source.c
==============================================================================
--- trunk/pgp/seahorse-ldap-source.c	(original)
+++ trunk/pgp/seahorse-ldap-source.c	Thu Jul 31 02:12:05 2008
@@ -36,6 +36,8 @@
 #include "seahorse-servers.h"
 #include "seahorse-util.h"
 
+#include "common/seahorse-registry.h"
+
 #include <ldap.h>
 
 #ifdef WITH_SOUP

Modified: trunk/pgp/seahorse-pgp-module.c
==============================================================================
--- trunk/pgp/seahorse-pgp-module.c	(original)
+++ trunk/pgp/seahorse-pgp-module.c	Thu Jul 31 02:12:05 2008
@@ -33,16 +33,25 @@
 #ifdef WITH_HKP
 #include "seahorse-hkp-source.h"
 #endif
+
+#include "seahorse-context.h"
 	
-const SeahorseRegisterType SEAHORSE_PGP_REGISTRY[] = {
-	seahorse_pgp_source_get_type,
-	seahorse_pgp_commands_get_type,
-	seahorse_pgp_generator_get_type,
+void
+seahorse_pgp_module_init (void)
+{
+	SeahorseSource *source;
+
+	/* Always have a default pgp source added */
+	source = g_object_new (SEAHORSE_TYPE_PGP_SOURCE, NULL);
+	seahorse_context_take_source (NULL, source);
+
+	g_type_class_unref (g_type_class_ref (SEAHORSE_TYPE_PGP_SOURCE));
+	g_type_class_unref (g_type_class_ref (SEAHORSE_PGP_TYPE_COMMANDS));
+	g_type_class_unref (g_type_class_ref (SEAHORSE_PGP_TYPE_GENERATOR));
 #ifdef WITH_LDAP
-	seahorse_ldap_source_get_type,
+	g_type_class_unref (g_type_class_ref (SEAHORSE_TYPE_LDAP_SOURCE));
 #endif
 #ifdef WITH_HKP
-	seahorse_hkp_source_get_type,
-#endif
-	NULL
-};
+	g_type_class_unref (g_type_class_ref (SEAHORSE_TYPE_HKP_SOURCE));
+#endif 
+}

Modified: trunk/pgp/seahorse-pgp-module.h
==============================================================================
--- trunk/pgp/seahorse-pgp-module.h	(original)
+++ trunk/pgp/seahorse-pgp-module.h	Thu Jul 31 02:12:05 2008
@@ -22,11 +22,9 @@
 #ifndef SEAHORSEPGP_H_
 #define SEAHORSEPGP_H_
 
-#include "common/seahorse-registry.h"
-
 #define SEAHORSE_PGP_STR                     "openpgp"
 #define SEAHORSE_PGP                         (g_quark_from_static_string (SEAHORSE_PGP_STR))
 
-extern const SeahorseRegisterType SEAHORSE_PGP_REGISTRY[];
+void         seahorse_pgp_module_init        (void);
 
 #endif /*SEAHORSEPGP_H_*/

Modified: trunk/pgp/seahorse-pgp-source.c
==============================================================================
--- trunk/pgp/seahorse-pgp-source.c	(original)
+++ trunk/pgp/seahorse-pgp-source.c	Thu Jul 31 02:12:05 2008
@@ -37,6 +37,8 @@
 #include "seahorse-libdialogs.h"
 #include "seahorse-passphrase.h"
 
+#include "common/seahorse-registry.h"
+
 #include <gio/gio.h>
 
 #include <stdlib.h>

Modified: trunk/pkcs11/seahorse-pkcs11-module.c
==============================================================================
--- trunk/pkcs11/seahorse-pkcs11-module.c	(original)
+++ trunk/pkcs11/seahorse-pkcs11-module.c	Thu Jul 31 02:12:05 2008
@@ -23,6 +23,8 @@
 
 #include "seahorse-pkcs11-module.h"
 
-const SeahorseRegisterType SEAHORSE_PKCS11_REGISTRY[] = {
-	NULL
-};
+void
+seahorse_pkcs11_module_init (void)
+{
+	
+}

Modified: trunk/pkcs11/seahorse-pkcs11-module.h
==============================================================================
--- trunk/pkcs11/seahorse-pkcs11-module.h	(original)
+++ trunk/pkcs11/seahorse-pkcs11-module.h	Thu Jul 31 02:12:05 2008
@@ -22,11 +22,9 @@
 #ifndef SEAHORSE_PKCS11_H_
 #define SEAHORSE_PKCS11_H_
 
-#include "common/seahorse-registry.h"
-
 #define SEAHORSE_PKCS11_STR                  "pkcs11"
 #define SEAHORSE_PKCS11                      (g_quark_from_static_string (SEAHORSE_PKCS11_STR))
 
-extern const SeahorseRegisterType SEAHORSE_PKCS11_REGISTRY[];
+void         seahorse_pkcs11_module_init     (void);
 
 #endif /*SEAHORSE_PKCS11_H_*/

Modified: trunk/src/main.c
==============================================================================
--- trunk/src/main.c	(original)
+++ trunk/src/main.c	Thu Jul 31 02:12:05 2008
@@ -68,20 +68,21 @@
     /* Insert Icons into Stock */ 
     seahorse_gtkstock_init ();
     
+    /* Make the default SeahorseContext */
+    seahorse_context_new (SEAHORSE_CONTEXT_APP);
+
     /* Initialize the various components */
 #ifdef WITH_PGP
-    seahorse_registry_load_types (NULL, SEAHORSE_PGP_REGISTRY);
+    seahorse_pgp_module_init ();
 #endif
 #ifdef WITH_SSH
-    seahorse_registry_load_types (NULL, SEAHORSE_SSH_REGISTRY);
+    seahorse_ssh_module_init ();
 #endif
-    
-    /* Make the default SeahorseContext */
-    seahorse_context_new (SEAHORSE_CONTEXT_APP, 0);
-    op = seahorse_context_load_local_objects (SCTX_APP ());
+
+    op = seahorse_context_refresh_local (SCTX_APP ());
 
     /* Load these components after loading local keys */
-    seahorse_registry_load_types (NULL, SEAHORSE_GKR_REGISTRY);
+    seahorse_gkr_module_init ();
 
     seahorse_key_manager_show (op);
     g_signal_connect_after (SCTX_APP (), "destroy", gtk_main_quit, NULL);

Modified: trunk/src/seahorse-keyserver-search.c
==============================================================================
--- trunk/src/seahorse-keyserver-search.c	(original)
+++ trunk/src/seahorse-keyserver-search.c	Thu Jul 31 02:12:05 2008
@@ -312,7 +312,7 @@
     seahorse_gconf_set_string_list (LASTSERVERS_KEY, 
                                     selection->all ? NULL : selection->names);
                                     
-    op = seahorse_context_load_remote_objects (SCTX_APP(), search);
+    op = seahorse_context_search_remote (SCTX_APP(), search);
     
     /* Open the new result window */    
     seahorse_keyserver_results_show (op, 

Modified: trunk/ssh/seahorse-ssh-module.c
==============================================================================
--- trunk/ssh/seahorse-ssh-module.c	(original)
+++ trunk/ssh/seahorse-ssh-module.c	Thu Jul 31 02:12:05 2008
@@ -27,9 +27,18 @@
 #include "seahorse-ssh-generator.h"
 #include "seahorse-ssh-source.h"
 
-const SeahorseRegisterType SEAHORSE_SSH_REGISTRY[] = {
-	seahorse_ssh_source_get_type,
-	seahorse_ssh_commands_get_type,
-	seahorse_ssh_generator_get_type,
-	NULL
-};
+#include "seahorse-context.h"
+
+void
+seahorse_ssh_module_init (void)
+{
+	SeahorseSource *source;
+
+	/* Always have a default pgp source added */
+	source = g_object_new (SEAHORSE_TYPE_SSH_SOURCE, NULL);
+	seahorse_context_take_source (NULL, source);
+
+	g_type_class_unref (g_type_class_ref (SEAHORSE_TYPE_SSH_SOURCE));
+	g_type_class_unref (g_type_class_ref (SEAHORSE_SSH_TYPE_COMMANDS));
+	g_type_class_unref (g_type_class_ref (SEAHORSE_SSH_TYPE_GENERATOR));
+}

Modified: trunk/ssh/seahorse-ssh-module.h
==============================================================================
--- trunk/ssh/seahorse-ssh-module.h	(original)
+++ trunk/ssh/seahorse-ssh-module.h	Thu Jul 31 02:12:05 2008
@@ -22,11 +22,9 @@
 #ifndef SEASSH_H_
 #define SEASSH_H_
 
-#include "common/seahorse-registry.h"
-
 #define SEAHORSE_SSH_STR                     "openssh"
 #define SEAHORSE_SSH                         (g_quark_from_static_string (SEAHORSE_SSH_STR))
 
-extern const SeahorseRegisterType SEAHORSE_SSH_REGISTRY[];
+void         seahorse_ssh_module_init        (void);
 
 #endif /*SEASSH_H_*/

Modified: trunk/ssh/seahorse-ssh-source.c
==============================================================================
--- trunk/ssh/seahorse-ssh-source.c	(original)
+++ trunk/ssh/seahorse-ssh-source.c	Thu Jul 31 02:12:05 2008
@@ -30,6 +30,8 @@
 #include "seahorse-operation.h"
 #include "seahorse-util.h"
 
+#include "common/seahorse-registry.h"
+
 #include <glib/gstdio.h>
 
 #include <string.h>



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