--- noweb/g_funcs.nw.orig	2005-01-23 18:24:39.000000000 +0100
+++ noweb/g_funcs.nw	2005-01-23 18:22:33.000000000 +0100
@@ -267,54 +267,44 @@
 /* get names from all objects of current_page, which */
 /* selected-flags are true. */
 
+static void
+hash_table_2_list (gpointer key,
+                   gpointer value,
+                   gpointer user_data)
+{
+  SCM* plist = (SCM*)user_data;
+  *plist = gh_cons(gh_str2scm((char*)value, strlen ((char*)value)),
+                   *plist);
+}
+
 SCM get_selected_component_attributes(gpointer data,		
-				      guint callback_action,	
-				      GtkWidget *widget)
+                                      guint callback_action,	
+                                      GtkWidget *widget)
 {
-  OBJECT *obj;
-  PAGE *p;
-  
-  TOPLEVEL *w_current = (TOPLEVEL *) data;
   SCM list = SCM_EOL;
-  /*NETLIST *nl_current = NULL; */
-
-  /*nl_current = netlist_head; */
-  p = w_current->page_current;
-  obj = p->object_head;
+  TOPLEVEL *toplevel = (TOPLEVEL*) data;
+  OBJECT *obj;
+  GHashTable *ht;
 
-  s_scratch_string_init();
-  
-  while (obj != NULL)
-  {
-    if (obj->selected) 
-    {
-	  
-      /*if (obj->type == OBJ_COMPLEX)
-        {
-        if (s_scratch_string_fill(obj->complex_basename)) 
-        {
-        list = gh_cons( gh_str2scm (obj->complex_basename, 
-        strlen(obj->complex_basename)), 
-        list);	
-        }
-        }
-        else*/
-      {
-        if (obj->text && obj->text->string)
-        {
-          if (s_scratch_string_fill(obj->text->string))
-          {
-            list = gh_cons( gh_str2scm (obj->text->string, 
-                                        strlen(obj->text->string)), 
-                            list);	
-          } 
-        }
-      }
+  /* build a hash table */
+  ht = g_hash_table_new (g_str_hash, g_str_equal);
+  for (obj = toplevel->page_current->object_head; obj != NULL;
+       obj = obj->next) {
+    if (obj->selected &&
+        obj->type == OBJ_TEXT &&
+        obj->text->string != NULL) {
+      /* add text string in the hash table */
+      g_hash_table_insert (ht,
+                           obj->text->string,
+                           obj->text->string);
     }
-    obj = obj->next;
   }
-  s_scratch_string_free();
-  return(list);
+  /* now create a scheme list of the entries in the hash table */
+  g_hash_table_foreach (ht, hash_table_2_list, &list);
+  /* and get ride of the hast table */
+  g_hash_table_destroy (ht);
+
+  return list;
 }
 
 
