source: trunk/third/gnome-vfs/libgnomevfs/gnome-vfs-init.c @ 15497

Revision 15497, 2.8 KB checked in by ghudson, 24 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r15496, which included commits to RCS files with non-trunk default branches.
Line 
1/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
2/* gnome-vfs-init.c - Initialization for the GNOME Virtual File System.
3
4   Copyright (C) 1999 Free Software Foundation
5
6   The Gnome Library is free software; you can redistribute it and/or
7   modify it under the terms of the GNU Library General Public License as
8   published by the Free Software Foundation; either version 2 of the
9   License, or (at your option) any later version.
10
11   The Gnome Library is distributed in the hope that it will be useful,
12   but WITHOUT ANY WARRANTY; without even the implied warranty of
13   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14   Library General Public License for more details.
15
16   You should have received a copy of the GNU Library General Public
17   License along with the Gnome Library; see the file COPYING.LIB.  If not,
18   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19   Boston, MA 02111-1307, USA.
20
21   Author: Ettore Perazzoli <ettore@gnu.org>
22*/
23
24#ifdef HAVE_CONFIG_H
25#include <config.h>
26#endif
27
28#include "gnome-vfs.h"
29#include "gnome-vfs-backend.h"
30#include "gnome-vfs-private.h"
31#include "gnome-vfs-mime.h"
32
33#ifdef USING_OAF
34#include <liboaf/liboaf.h>
35#endif
36
37
38static gboolean vfs_already_initialized = FALSE;
39G_LOCK_DEFINE_STATIC (vfs_already_initialized);
40
41gboolean
42gnome_vfs_init (void)
43{
44        gboolean retval;
45        char *bogus_argv[2] = { "dummy", NULL };
46
47        G_LOCK (vfs_already_initialized);
48
49        if (!vfs_already_initialized) {
50                if (oaf_orb_get() == NULL) {
51                        oaf_init (0, bogus_argv);
52                }
53
54                retval = gnome_vfs_method_init ();
55                if (retval) {
56                        retval = gnome_vfs_process_init ();
57                }
58                if (retval) {
59                        retval = gnome_vfs_configuration_init ();
60                }
61                if (retval) {
62                        gnome_vfs_backend_loadinit(NULL, NULL);
63                        retval = gnome_vfs_backend_init (TRUE);
64                }
65                if (retval) {
66                        signal (SIGPIPE, SIG_IGN);
67                }
68        } else {
69                g_warning (_("GNOME VFS already initialized."));
70                retval = TRUE;  /* Who cares after all.  */
71        }
72
73        vfs_already_initialized = TRUE;
74        G_UNLOCK (vfs_already_initialized);
75
76        return retval;
77}
78
79
80gboolean
81gnome_vfs_initialized (void)
82{
83        gboolean out;
84
85        G_LOCK (vfs_already_initialized);
86        out = vfs_already_initialized;
87        G_UNLOCK (vfs_already_initialized);
88        return out;
89}
90
91void
92gnome_vfs_shutdown (void)
93{
94        gnome_vfs_backend_shutdown ();
95        gnome_vfs_mime_shutdown ();
96}
97
98void
99gnome_vfs_loadinit(gpointer app, gpointer modinfo)
100{
101        gnome_vfs_backend_loadinit(app, modinfo);
102}
103
104void
105gnome_vfs_preinit(gpointer app, gpointer modinfo)
106{
107}
108
109void
110gnome_vfs_postinit(gpointer app, gpointer modinfo)
111{
112        G_LOCK (vfs_already_initialized);
113
114        gnome_vfs_method_init();
115        gnome_vfs_process_init();
116        gnome_vfs_configuration_init();
117        gnome_vfs_backend_init(FALSE);
118        signal(SIGPIPE, SIG_IGN);
119
120        vfs_already_initialized = TRUE;
121        G_UNLOCK (vfs_already_initialized);
122}
Note: See TracBrowser for help on using the repository browser.