summaryrefslogtreecommitdiff
path: root/gvfs.c
blob: 52dbcd0b83455a5f74eea5a366cd1cd552c1d44d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#include <config.h>
#include "gvfs.h"
#include "gvfssimple.h"
#include <glib/gi18n-lib.h>

static void g_vfs_base_init (gpointer g_class);

GType
g_vfs_get_type (void)
{
  static GType vfs_type = 0;

  if (! vfs_type)
    {
      static const GTypeInfo vfs_info =
      {
        sizeof (GVfsIface), /* class_size */
	g_vfs_base_init,   /* base_init */
	NULL,		/* base_finalize */
	NULL,
	NULL,		/* class_finalize */
	NULL,		/* class_data */
	0,
	0,              /* n_preallocs */
	NULL
      };

      vfs_type =
	g_type_register_static (G_TYPE_INTERFACE, I_("GVfs"),
				&vfs_info, 0);

      g_type_interface_add_prerequisite (vfs_type, G_TYPE_OBJECT);
    }

  return vfs_type;
}

static void
g_vfs_base_init (gpointer g_class)
{
}

GFile *
g_vfs_get_file_for_path (GVfs *vfs,
			 const char *path)
{
  GVfsIface *iface;

  iface = G_VFS_GET_IFACE (vfs);

  return (* iface->get_file_for_path) (vfs, path);
}

GFile *
g_vfs_get_file_for_uri  (GVfs *vfs,
			 const char *uri)
{
  GVfsIface *iface;

  iface = G_VFS_GET_IFACE (vfs);

  return (* iface->get_file_for_uri) (vfs, uri);
}

GFile *
g_vfs_parse_name (GVfs *vfs,
		  const char *parse_name)
{
  GVfsIface *iface;

  iface = G_VFS_GET_IFACE (vfs);

  return (* iface->parse_name) (vfs, parse_name);
}

static gpointer
get_default_vfs (gpointer arg)
{
  return g_vfs_simple_new ();
}

GVfs *
g_vfs_get (void)
{
  static GOnce once_init = G_ONCE_INIT;
  GVfs *vfs;

  vfs = g_once (&once_init, get_default_vfs, NULL);
  
  return vfs;
}