1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
2 
3 /* caja-global-preferences.c - Caja specific preference keys and
4                                    functions.
5 
6    Copyright (C) 1999, 2000, 2001 Eazel, Inc.
7 
8    The Mate Library is free software; you can redistribute it and/or
9    modify it under the terms of the GNU Library General Public License as
10    published by the Free Software Foundation; either version 2 of the
11    License, or (at your option) any later version.
12 
13    The Mate Library is distributed in the hope that it will be useful,
14    but WITHOUT ANY WARRANTY; without even the implied warranty of
15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16    Library General Public License for more details.
17 
18    You should have received a copy of the GNU Library General Public
19    License along with the Mate Library; see the file COPYING.LIB.  If not,
20    write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
21    Boston, MA 02110-1301, USA.
22 
23    Authors: Ramiro Estrugo <ramiro@eazel.com>
24 */
25 
26 #include <config.h>
27 #include <glib/gi18n.h>
28 
29 #include <eel/eel-glib-extensions.h>
30 #include <eel/eel-gtk-extensions.h>
31 #include <eel/eel-stock-dialogs.h>
32 #include <eel/eel-string.h>
33 
34 #include "caja-global-preferences.h"
35 #include "caja-file-utilities.h"
36 #include "caja-file.h"
37 
38 GSettings *caja_preferences;
39 GSettings *caja_media_preferences;
40 GSettings *caja_window_state;
41 GSettings *caja_icon_view_preferences;
42 GSettings *caja_desktop_preferences;
43 GSettings *caja_tree_sidebar_preferences;
44 GSettings *caja_compact_view_preferences;
45 GSettings *caja_list_view_preferences;
46 GSettings *caja_extension_preferences;
47 
48 GSettings *mate_background_preferences;
49 GSettings *mate_lockdown_preferences;
50 
51 /*
52  * Public functions
53  */
54 char *
caja_global_preferences_get_default_folder_viewer_preference_as_iid(void)55 caja_global_preferences_get_default_folder_viewer_preference_as_iid (void)
56 {
57     int preference_value;
58     const char *viewer_iid;
59 
60     preference_value =
61         g_settings_get_enum (caja_preferences, CAJA_PREFERENCES_DEFAULT_FOLDER_VIEWER);
62 
63     if (preference_value == CAJA_DEFAULT_FOLDER_VIEWER_LIST_VIEW)
64     {
65         viewer_iid = CAJA_LIST_VIEW_IID;
66     }
67     else if (preference_value == CAJA_DEFAULT_FOLDER_VIEWER_COMPACT_VIEW)
68     {
69         viewer_iid = CAJA_COMPACT_VIEW_IID;
70     }
71     else
72     {
73         viewer_iid = CAJA_ICON_VIEW_IID;
74     }
75 
76     return g_strdup (viewer_iid);
77 }
78 
79 void
caja_global_preferences_init(void)80 caja_global_preferences_init (void)
81 {
82     static gboolean initialized = FALSE;
83 
84     if (initialized)
85     {
86         return;
87     }
88 
89     initialized = TRUE;
90 
91     caja_preferences = g_settings_new("org.mate.caja.preferences");
92     caja_media_preferences = g_settings_new("org.mate.media-handling");
93     caja_window_state = g_settings_new("org.mate.caja.window-state");
94     caja_icon_view_preferences = g_settings_new("org.mate.caja.icon-view");
95     caja_compact_view_preferences = g_settings_new("org.mate.caja.compact-view");
96     caja_desktop_preferences = g_settings_new("org.mate.caja.desktop");
97     caja_tree_sidebar_preferences = g_settings_new("org.mate.caja.sidebar-panels.tree");
98     caja_list_view_preferences = g_settings_new("org.mate.caja.list-view");
99     caja_extension_preferences = g_settings_new("org.mate.caja.extensions");
100 
101     mate_background_preferences = g_settings_new("org.mate.background");
102     mate_lockdown_preferences = g_settings_new("org.mate.lockdown");
103 }
104