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

Revision 17128, 3.2 KB checked in by ghudson, 23 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r17127, 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#include <config.h>
25#include "gnome-vfs-init.h"
26
27#include "gnome-vfs.h"
28#include "gnome-vfs-backend.h"
29#include "gnome-vfs-private.h"
30#include "gnome-vfs-ssl-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
41static GPrivate * private_is_primary_thread;
42
43gboolean
44gnome_vfs_init (void)
45{
46        gboolean retval;
47        char *bogus_argv[2] = { "dummy", NULL };
48
49        G_LOCK (vfs_already_initialized);
50
51        if (!vfs_already_initialized) {
52                if (oaf_orb_get() == NULL) {
53                        oaf_init (0, bogus_argv);
54                }
55
56                gnome_vfs_ssl_init ();
57
58                retval = gnome_vfs_method_init ();
59                if (retval) {
60                        retval = gnome_vfs_process_init ();
61                }
62                if (retval) {
63                        retval = gnome_vfs_configuration_init ();
64                }
65                if (retval) {
66                        gnome_vfs_backend_loadinit(NULL, NULL);
67                        retval = gnome_vfs_backend_init (TRUE);
68                }
69                if (retval) {
70                        signal (SIGPIPE, SIG_IGN);
71                }
72
73                if (g_thread_supported()) {
74                        private_is_primary_thread = g_private_new (NULL);
75                        g_private_set (private_is_primary_thread, GUINT_TO_POINTER (1));
76                }
77               
78        } else {
79                g_warning (_("GNOME VFS already initialized."));
80                retval = TRUE;  /* Who cares after all.  */
81        }
82
83        vfs_already_initialized = TRUE;
84        G_UNLOCK (vfs_already_initialized);
85
86        return retval;
87}
88
89
90gboolean
91gnome_vfs_initialized (void)
92{
93        gboolean out;
94
95        G_LOCK (vfs_already_initialized);
96        out = vfs_already_initialized;
97        G_UNLOCK (vfs_already_initialized);
98        return out;
99}
100
101void
102gnome_vfs_shutdown (void)
103{
104        gnome_vfs_backend_shutdown ();
105        gnome_vfs_mime_shutdown ();
106}
107
108void
109gnome_vfs_loadinit(gpointer app, gpointer modinfo)
110{
111        gnome_vfs_backend_loadinit(app, modinfo);
112}
113
114void
115gnome_vfs_preinit(gpointer app, gpointer modinfo)
116{
117}
118
119void
120gnome_vfs_postinit(gpointer app, gpointer modinfo)
121{
122        G_LOCK (vfs_already_initialized);
123
124        gnome_vfs_method_init();
125        gnome_vfs_process_init();
126        gnome_vfs_configuration_init();
127        gnome_vfs_backend_init(FALSE);
128        signal(SIGPIPE, SIG_IGN);
129
130        vfs_already_initialized = TRUE;
131        G_UNLOCK (vfs_already_initialized);
132}
133
134gboolean
135gnome_vfs_is_primary_thread (void)
136{
137        if (g_thread_supported()) {
138                return GPOINTER_TO_UINT(g_private_get (private_is_primary_thread)) == 1;
139        } else {
140                return TRUE;
141        }
142}
Note: See TracBrowser for help on using the repository browser.