===================================================================
RCS file: /cvs/gnome/pango/pango/querymodules.c,v
retrieving revision 1.32
diff -u -w -u -w -r1.32 querymodules.c
--- pango/querymodules.c	4 Apr 2006 22:53:04 -0000	1.32
+++ pango/querymodules.c	30 Jun 2006 14:41:07 -0000
@@ -239,10 +239,35 @@
       
       path = pango_config_key_get ("Pango/ModulesPath");
       if (!path)
+        {
 	path = g_build_filename (pango_get_lib_subdirectory (),
 				 MODULE_VERSION,
 				 "modules",
 				 NULL);
+          GDir *dir = g_dir_open (path, 0, NULL);
+          char *dpath, *fulldent;
+          if (dir)
+            {
+              char *origpath = g_strdup (path);
+              const char *dent;
+
+              while ((dent = g_dir_read_name (dir)))
+                {
+                  fulldent = g_strconcat (origpath, G_DIR_SEPARATOR_S, dent, NULL);
+                  if (g_file_test (fulldent, G_FILE_TEST_IS_DIR))
+                    {
+                      dpath = path;
+                      path = g_strconcat (dpath, ":", origpath,
+                                          G_DIR_SEPARATOR_S, dent, NULL);
+                      g_free (dpath);
+                    }
+                  g_free (fulldent);
+                }
+              
+              g_dir_close (dir);
+              g_free (origpath);
+            }
+        }
 
       g_printf ("# ModulesPath = %s\n#\n", path);
 
@@ -250,18 +275,32 @@
 
       g_free (path);
 
+      GSList *module_list = NULL;
+
       for (i=0; dirs[i]; i++)
 	{
 	  GDir *dir = g_dir_open (dirs[i], 0, NULL);
 	  if (dir)
 	    {
 	      const char *dent;
+	      GQuark dent_quark;
 
 	      while ((dent = g_dir_read_name (dir)))
 		{
 		  int len = strlen (dent);
 		  if (len > SOEXT_LEN && strcmp (dent + len - SOEXT_LEN, SOEXT) == 0)
+		    {
+		      dent_quark = g_quark_from_string (dent);
+		      if (!g_slist_find (module_list, GINT_TO_POINTER(dent_quark)))
+		        {
 		    query_module (dirs[i], dent);
+			  module_list = g_slist_prepend (module_list, GINT_TO_POINTER(dent_quark));
+			}
+                      else
+			{
+			  g_printf("#WARNING: module %s has already been found, not using the one in\n#%s\n", dent, dirs[i]);
+			}
+		    }
 		}
 	      
 	      g_dir_close (dir);
