Initial original import from: fuse-2.4.2-2.fc4
[captive.git] / src / libcaptive / client / standalone-gnome.c
1 /* $Id$
2  * --enable-standalone optional Gnome init for static builds of captive
3  * Copyright (C) 2005 Jan Kratochvil <project-captive@jankratochvil.net>
4  * 
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; exactly version 2 of June 1991 is required
8  * 
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  * 
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17  */
18
19
20 #include "config.h"
21
22 #include "standalone-gnome.h"   /* self */
23 #include <stdlib.h>
24 #include "standalone.h"
25 #include <fontconfig/fontconfig.h>
26
27
28 void captive_standalone_gnome_init(void)
29 {
30 static gboolean done=FALSE;
31
32         if (done)
33                 return;
34
35         captive_standalone_init();
36
37 #ifdef HAVE_GNOMEUI
38
39 #ifdef ENABLE_STANDALONE
40
41         /* Prevent loading of custom theme needing icons which may
42          * be problematic to be loaded by our static binary.
43          * However user still may have specified his/her theme in $HOME.
44          */
45         setenv("GTK2_RC_FILES","",
46                         1);     /* overwrite */
47
48         /* Prevent: Cannot open Input Method ...
49          */
50         setenv("GTK_IM_MODULE_FILE","/dev/null",
51                         1);     /* overwrite */
52
53 #endif /* ENABLE_STANDALONE */
54
55 #ifdef STANDALONE_FONTSDIR
56
57         /* Prevent handling (even writing!): ~/.fonts.cache-1 */
58         FcConfigEnableHome(FcFalse);
59
60         /* Prevent fontconfig loading: /etc/fonts/fonts.conf */
61         /* 'fonts_conf_dir' is created by: bundle_files_write() */
62         setenv("FONTCONFIG_PATH",STANDALONE_FONTSDIR,
63                         1);     /* overwrite */
64
65 #endif /* STANDALONE_FONTSDIR */
66
67 #endif /* HAVE_GNOMEUI */
68
69         done=TRUE;
70 }