Include "config.h" instead of <config.h> Command used: find -name
[platform/upstream/glib.git] / gio / gvfs.c
index 2d16516..3158d3d 100644 (file)
@@ -20,7 +20,7 @@
  * Author: Alexander Larsson <alexl@redhat.com>
  */
 
-#include <config.h>
+#include "config.h"
 #include <string.h>
 #include "gvfs.h"
 #include "glocalvfs.h"
@@ -32,7 +32,7 @@
 /**
  * SECTION:gvfs
  * @short_description: Virtual File System 
- * @include: gio.h
+ * @include: gio/gio.h
  * 
  * Entry point for using GIO functionality.
  *
@@ -167,80 +167,51 @@ g_vfs_parse_name (GVfs       *vfs,
   return (* class->parse_name) (vfs, parse_name);
 }
 
-/* Note: This compares in reverse order.
-   Higher prio -> sort first
- */
-static gint
-compare_vfs_type (gconstpointer  a,
-                 gconstpointer  b,
-                 gpointer       user_data)
-{
-  GType a_type, b_type;
-  char *a_name, *b_name;
-  int a_prio, b_prio;
-  gint res;
-  const char *use_this_monitor;
-  GQuark private_q, name_q;
-
-  private_q = g_quark_from_static_string ("gio-prio");
-  name_q = g_quark_from_static_string ("gio-name");
-  
-  use_this_monitor = user_data;
-  a_type = *(GType *)a;
-  b_type = *(GType *)b;
-  a_prio = GPOINTER_TO_INT (g_type_get_qdata (a_type, private_q));
-  a_name = g_type_get_qdata (a_type, name_q);
-  b_prio = GPOINTER_TO_INT (g_type_get_qdata (b_type, private_q));
-  b_name = g_type_get_qdata (b_type, name_q);
-
-  if (a_type == b_type)
-    res = 0;
-  else if (use_this_monitor != NULL &&
-          strcmp (a_name, use_this_monitor) == 0)
-    res = -1;
-  else if (use_this_monitor != NULL &&
-          strcmp (b_name, use_this_monitor) == 0)
-    res = 1;
-  else 
-    res = b_prio - a_prio;
-  
-  return res;
-}
-
 static gpointer
 get_default_vfs (gpointer arg)
 {
-  volatile GType local_type;
-  GType *vfs_impls;
-  int i;
-  guint n_vfs_impls;
   const char *use_this;
   GVfs *vfs;
+  GList *l;
+  GIOExtensionPoint *ep;
+  GIOExtension *extension;
+  
 
   use_this = g_getenv ("GIO_USE_VFS");
   
   /* Ensure vfs in modules loaded */
   _g_io_modules_ensure_loaded ();
 
-  vfs_impls = g_type_children (G_TYPE_VFS, &n_vfs_impls);
+  ep = g_io_extension_point_lookup (G_VFS_EXTENSION_POINT_NAME);
 
-  g_qsort_with_data (vfs_impls, n_vfs_impls, sizeof (GType),
-                    compare_vfs_type, (gpointer)use_this);
-  
-  for (i = 0; i < n_vfs_impls; i++)
+  if (use_this)
+    {
+      extension = g_io_extension_point_get_extension_by_name (ep, use_this);
+      if (extension)
+       {
+         vfs = g_object_new (g_io_extension_get_type (extension), NULL);
+         
+         if (g_vfs_is_active (vfs))
+           return vfs;
+         
+         g_object_unref (vfs);
+       }
+    }
+
+  for (l = g_io_extension_point_get_extensions (ep); l != NULL; l = l->next)
     {
-      vfs = g_object_new (vfs_impls[i], NULL);
+      extension = l->data;
+
+      vfs = g_object_new (g_io_extension_get_type (extension), NULL);
 
       if (g_vfs_is_active (vfs))
-       break;
+       return vfs;
 
       g_object_unref (vfs);
-      vfs = NULL;
     }
   
-  g_free (vfs_impls);
 
-  return vfs;
+  return NULL;
 }
 
 /**