Index: libseahorse/seahorse-key-source.c
===================================================================
RCS file: /cvs/gnome/seahorse/libseahorse/seahorse-key-source.c,v
retrieving revision 1.6
diff -u -r1.6 seahorse-key-source.c
--- libseahorse/seahorse-key-source.c	5 Apr 2005 20:56:24 -0000	1.6
+++ libseahorse/seahorse-key-source.c	7 May 2005 22:33:24 -0000
@@ -275,6 +275,29 @@
 }
 
 /**
+ * seahorse_key_source_find_keys
+ * @sksrc: A #SeahorseKeySource object
+ * @search_str: return keys matching string
+ * 
+ * Get a list of all the keys in the key source matching the search string.
+ * 
+ * Returns: An allocated list of keys.
+ **/
+GList*
+seahorse_key_source_find_keys (SeahorseKeySource *sksrc,
+                              gchar *search_str)
+{
+    SeahorseKeySourceClass *klass;
+    
+    g_return_val_if_fail (SEAHORSE_IS_KEY_SOURCE (sksrc), NULL);
+    g_return_val_if_fail (search_str != NULL, NULL);
+    klass = SEAHORSE_KEY_SOURCE_GET_CLASS (sksrc);
+    g_return_val_if_fail (klass->find_keys != NULL, NULL);
+    
+    return (*klass->find_keys) (sksrc, search_str);
+}
+
+/**
  * seahorse_key_source_get_state
  * @sksrc: A #SeahorseKeySource object
  * 
Index: libseahorse/seahorse-key-source.h
===================================================================
RCS file: /cvs/gnome/seahorse/libseahorse/seahorse-key-source.h,v
retrieving revision 1.5
diff -u -r1.5 seahorse-key-source.h
--- libseahorse/seahorse-key-source.h	5 Apr 2005 20:56:24 -0000	1.5
+++ libseahorse/seahorse-key-source.h	7 May 2005 22:33:24 -0000
@@ -85,6 +85,9 @@
     /* Get a list of all the keys in the key source. No loading done */
     GList* (*get_keys) (SeahorseKeySource *sksrc, gboolean secret_only);
     
+    /* Get a list of all the keys in the key source matching a string */
+    Glist* (*find_keys) (SeahorseKeySource *sksrc, gchar *search_str);
+    
     /* Get a new GPGME context for this source */
     gpgme_ctx_t (*new_context) (SeahorseKeySource *sksrc);
     
@@ -140,6 +143,9 @@
 
 GList*       seahorse_key_source_get_keys    (SeahorseKeySource *sksrc,
                                               gboolean secret_only);
+                                              
+GList*       seahorse_key_source_find_keys    (SeahorseKeySource *sksrc,
+                                              gchar *search_str);
 
 guint        seahorse_key_source_get_count   (SeahorseKeySource *sksrc,
                                               gboolean secret_only);
Index: libseahorse/seahorse-pgp-source.c
===================================================================
RCS file: /cvs/gnome/seahorse/libseahorse/seahorse-pgp-source.c,v
retrieving revision 1.15
diff -u -r1.15 seahorse-pgp-source.c
--- libseahorse/seahorse-pgp-source.c	5 Apr 2005 21:14:25 -0000	1.15
+++ libseahorse/seahorse-pgp-source.c	7 May 2005 22:33:25 -0000
@@ -116,6 +116,8 @@
                                                      const gchar *fpr);
 static GList*       seahorse_pgp_source_get_keys    (SeahorseKeySource *src,
                                                      gboolean secret_only);
+static GList*       seahorse_pgp_source_find_keys   (SeahorseKeySource *src,
+                                                     gchar *search_str);
 static guint        seahorse_pgp_source_get_count   (SeahorseKeySource *src,
                                                      gboolean secret_only);
 static gpgme_ctx_t  seahorse_pgp_source_new_context (SeahorseKeySource *src);
@@ -180,6 +182,7 @@
     key_class->get_count = seahorse_pgp_source_get_count;
     key_class->get_key = seahorse_pgp_source_get_key;
     key_class->get_keys = seahorse_pgp_source_get_keys;
+    key_class->get_keys = seahorse_pgp_source_find_keys;
     key_class->get_state = seahorse_pgp_source_get_state;
     key_class->get_operation = seahorse_pgp_source_get_operation;
     key_class->new_context = seahorse_pgp_source_new_context;    
@@ -448,6 +451,29 @@
         (*n)++;
 }
 
+static void
+matching_keys_to_list(const gchar *id, SeahorseKey *skey, gpointer *array)
+{
+	gint numids;
+	gchar *search_str;
+	Glist *l;
+	
+	search_str = (*array)[0];
+	l = (*array)[1];
+	
+	numids = seahorse_key_get_num_uids(skey);
+	
+	for(gint i = 0; i < numids; i++)
+	{
+		if((strstr(seahorse_key_get_userid_name(skey, i), search_str))||
+		   (strstr(seahorse_key_get_userid_comment(skey, i), search_str))||
+		   (strstr(seahorse_key_get_userid_email(skey, i), search_str)))
+		   {
+		   		l = g_list_append (l, skey);
+		   }
+	}
+}
+
 /* -----------------------------------------------------------------------------
  *  GPG HOME DIR MONITORING
  */
@@ -795,6 +821,25 @@
     
     g_hash_table_foreach (psrc->priv->keys, 
             (GHFunc)(secret_only ? secret_keys_to_list : keys_to_list), &l);
+    return l;
+}
+
+static GList*
+seahorse_pgp_source_find_keys (SeahorseKeySource *src,
+                              gchar *search_str)  
+{
+    SeahorsePGPSource *psrc;
+    GList *l = NULL;
+    gpointer array[2];
+    
+    array[0] = search_str;
+    array[1] = l;
+    
+    g_return_val_if_fail (SEAHORSE_IS_KEY_SOURCE (src), NULL);
+    psrc = SEAHORSE_PGP_SOURCE (src);
+    
+    g_hash_table_foreach (psrc->priv->keys, 
+            (GHFunc)matching_keys_to_list, &array);
     return l;
 }
 
