3 * A Nautilus extension which offers configurable context menu modules.
5 * Copyright (C) 2005 The GNOME Foundation
6 * Copyright (C) 2006, 2007, 2008 Frederic Ruaudel and others (see AUTHORS)
7 * Copyright (C) 2009, 2010, 2011 Pierre Wieser and others (see AUTHORS)
9 * This Program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License as
11 * published by the Free Software Foundation; either version 2 of
12 * the License, or (at your option) any later version.
14 * This Program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public
20 * License along with this Library; see the file COPYING. If not,
21 * write to the Free Software Foundation, Inc., 59 Temple Place,
22 * Suite 330, Boston, MA 02111-1307, USA.
25 * Frederic Ruaudel <grumz@grumz.net>
26 * Rodrigo Moya <rodrigo@gnome-db.org>
27 * Pierre Wieser <pwieser@trychlos.org>
28 * ... and many others (see AUTHORS)
31 #ifndef __CORE_NA_SETTINGS_H__
32 #define __CORE_NA_SETTINGS_H__
35 * @short_description: The Settings Class Definition
36 * @include: core/na-settings.h
38 * The #NASettings class manages users preferences.
40 * Actual configuration may come from two sources:
41 * - a global configuration, which apply to all users, as read-only
43 * - a per-user configuration.
45 * The configuration is implemented as keyed files:
46 * - global configuration is sysconfdir/xdg/nautilus-actions.conf
47 * - per-user configuration is HOME/.config/nautilus-actions.conf
49 * Each setting may so have its own read-only attribute, whether it
50 * has been read from the global configuration or from the
53 * NASettings class monitors the whole configuration.
54 * A client may be informed of a modification of the value of a key either by
55 * pre-registering a callback on this key (see na_settings_register_key_callback()
56 * function), or by connecting to and filtering the notification signal.
59 #include <glib-object.h>
63 #define NA_SETTINGS_TYPE ( na_settings_get_type())
64 #define NA_SETTINGS( object ) ( G_TYPE_CHECK_INSTANCE_CAST( object, NA_SETTINGS_TYPE, NASettings ))
65 #define NA_SETTINGS_CLASS( klass ) ( G_TYPE_CHECK_CLASS_CAST( klass, NA_SETTINGS_TYPE, NASettingsClass ))
66 #define NA_IS_SETTINGS( object ) ( G_TYPE_CHECK_INSTANCE_TYPE( object, NA_SETTINGS_TYPE ))
67 #define NA_IS_SETTINGS_CLASS( klass ) ( G_TYPE_CHECK_CLASS_TYPE(( klass ), NA_SETTINGS_TYPE ))
68 #define NA_SETTINGS_GET_CLASS( object ) ( G_TYPE_INSTANCE_GET_CLASS(( object ), NA_SETTINGS_TYPE, NASettingsClass ))
70 typedef struct _NASettingsPrivate NASettingsPrivate
;
75 NASettingsPrivate
*private;
79 typedef struct _NASettingsClassPrivate NASettingsClassPrivate
;
84 NASettingsClassPrivate
*private;
88 GType
na_settings_get_type( void );
90 /* This is a composite key;
91 * by registering a callback on this key, a client may be informed of any
92 * modification regarding the readability status of the i/o providers.
94 #define NA_IPREFS_IO_PROVIDERS_READ_STATUS "io-providers-read-status-composite-key"
96 /* other keys, mainly user preferences
98 #define NA_IPREFS_ADMIN_PREFERENCES_LOCKED "preferences-locked"
99 #define NA_IPREFS_ADMIN_IO_PROVIDERS_LOCKED "io-providers-locked"
100 #define NA_IPREFS_ASSISTANT_ESC_CONFIRM "assistant-esc-confirm"
101 #define NA_IPREFS_ASSISTANT_ESC_QUIT "assistant-esc-quit"
102 #define NA_IPREFS_CAPABILITY_ADD_CAPABILITY_WSP "capability-add-capability-wsp"
103 #define NA_IPREFS_COMMAND_CHOOSER_WSP "command-command-chooser-wsp"
104 #define NA_IPREFS_COMMAND_CHOOSER_URI "command-command-chooser-lfu"
105 #define NA_IPREFS_COMMAND_LEGEND_WSP "command-legend-wsp"
106 #define NA_IPREFS_CONFIRM_LOGOUT_WSP "confirm-logout-wsp"
107 #define NA_IPREFS_WORKING_DIR_WSP "command-working-dir-chooser-wsp"
108 #define NA_IPREFS_WORKING_DIR_URI "command-working-dir-chooser-lfu"
109 #define NA_IPREFS_SHOW_IF_RUNNING_WSP "environment-show-if-running-wsp"
110 #define NA_IPREFS_SHOW_IF_RUNNING_URI "environment-show-if-running-lfu"
111 #define NA_IPREFS_TRY_EXEC_WSP "environment-try-exec-wsp"
112 #define NA_IPREFS_TRY_EXEC_URI "environment-try-exec-lfu"
113 #define NA_IPREFS_EXPORT_ASK_USER_WSP "export-ask-user-wsp"
114 #define NA_IPREFS_EXPORT_ASK_USER_LAST_FORMAT "export-ask-user-last-format"
115 #define NA_IPREFS_EXPORT_ASK_USER_KEEP_LAST_CHOICE "export-ask-user-keep-last-choice"
116 #define NA_IPREFS_EXPORT_ASSISTANT_WSP "export-assistant-wsp"
117 #define NA_IPREFS_EXPORT_ASSISTANT_URI "export-assistant-lfu"
118 #define NA_IPREFS_EXPORT_PREFERRED_FORMAT "export-preferred-format"
119 #define NA_IPREFS_FOLDER_CHOOSER_WSP "folder-chooser-wsp"
120 #define NA_IPREFS_FOLDER_CHOOSER_URI "folder-chooser-lfu"
121 #define NA_IPREFS_IMPORT_ASK_USER_WSP "import-ask-user-wsp"
122 #define NA_IPREFS_IMPORT_ASK_USER_LAST_MODE "import-ask-user-last-mode"
123 #define NA_IPREFS_IMPORT_ASSISTANT_WSP "import-assistant-wsp"
124 #define NA_IPREFS_IMPORT_ASSISTANT_URI "import-assistant-lfu"
125 #define NA_IPREFS_IMPORT_ASK_USER_KEEP_LAST_CHOICE "import-ask-user-keep-last-choice"
126 #define NA_IPREFS_IMPORT_PREFERRED_MODE "import-preferred-mode"
127 #define NA_IPREFS_ICON_CHOOSER_URI "item-icon-chooser-lfu"
128 #define NA_IPREFS_ICON_CHOOSER_PANED "item-icon-chooser-paned-width"
129 #define NA_IPREFS_ICON_CHOOSER_WSP "item-icon-chooser-wsp"
130 #define NA_IPREFS_IO_PROVIDERS_WRITE_ORDER "io-providers-write-order"
131 #define NA_IPREFS_ITEMS_ADD_ABOUT_ITEM "items-add-about-item"
132 #define NA_IPREFS_ITEMS_CREATE_ROOT_MENU "items-create-root-menu"
133 #define NA_IPREFS_ITEMS_LEVEL_ZERO_ORDER "items-level-zero-order"
134 #define NA_IPREFS_ITEMS_LIST_ORDER_MODE "items-list-order-mode"
135 #define NA_IPREFS_MAIN_PANED "main-paned-width"
136 #define NA_IPREFS_MAIN_SAVE_AUTO "main-save-auto"
137 #define NA_IPREFS_MAIN_SAVE_PERIOD "main-save-period"
138 #define NA_IPREFS_MAIN_TOOLBAR_EDIT_DISPLAY "main-toolbar-edit-display"
139 #define NA_IPREFS_MAIN_TOOLBAR_FILE_DISPLAY "main-toolbar-file-display"
140 #define NA_IPREFS_MAIN_TOOLBAR_HELP_DISPLAY "main-toolbar-help-display"
141 #define NA_IPREFS_MAIN_TOOLBAR_TOOLS_DISPLAY "main-toolbar-tools-display"
142 #define NA_IPREFS_MAIN_WINDOW_WSP "main-window-wsp"
143 #define NA_IPREFS_PREFERENCES_WSP "preferences-wsp"
144 #define NA_IPREFS_PLUGIN_LOG "log-enabled"
145 #define NA_IPREFS_RELABEL_DUPLICATE_ACTION "relabel-when-duplicate-action"
146 #define NA_IPREFS_RELABEL_DUPLICATE_MENU "relabel-when-duplicate-menu"
147 #define NA_IPREFS_RELABEL_DUPLICATE_PROFILE "relabel-when-duplicate-profile"
148 #define NA_IPREFS_SCHEME_ADD_SCHEME_WSP "scheme-add-scheme-wsp"
149 #define NA_IPREFS_SCHEME_DEFAULT_LIST "scheme-default-list"
150 #define NA_IPREFS_TERMINAL_PREFIX "terminal-prefix"
152 #define NA_IPREFS_IO_PROVIDER_GROUP "io-provider"
153 #define NA_IPREFS_IO_PROVIDER_READABLE "readable"
154 #define NA_IPREFS_IO_PROVIDER_WRITABLE "writable"
156 #define NA_IPREFS_DEFAULT_EXPORT_FORMAT "Desktop1"
157 #define NA_IPREFS_DEFAULT_IMPORT_MODE "NoImport"
158 #define NA_IPREFS_DEFAULT_LIST_ORDER_MODE "AscendingOrder"
160 /* pre-registration of a callback
162 typedef void ( *NASettingsKeyCallback
)( const gchar
*group
, const gchar
*key
, gconstpointer new_value
, gboolean mandatory
, void *user_data
);
164 void na_settings_register_key_callback ( NASettings
*settings
, const gchar
*key
, GCallback callback
, gpointer user_data
);
166 /* signal sent when the value of a key changes
168 #define SETTINGS_SIGNAL_KEY_CHANGED "settings-key-changed"
170 NASettings
*na_settings_new ( void );
172 gboolean
na_settings_get_boolean ( NASettings
*settings
, const gchar
*key
, gboolean
*found
, gboolean
*mandatory
);
173 gboolean
na_settings_get_boolean_ex ( NASettings
*settings
, const gchar
*group
, const gchar
*key
, gboolean
*found
, gboolean
*mandatory
);
174 gchar
*na_settings_get_string ( NASettings
*settings
, const gchar
*key
, gboolean
*found
, gboolean
*mandatory
);
175 GSList
*na_settings_get_string_list ( NASettings
*settings
, const gchar
*key
, gboolean
*found
, gboolean
*mandatory
);
176 guint
na_settings_get_uint ( NASettings
*settings
, const gchar
*key
, gboolean
*found
, gboolean
*mandatory
);
177 GList
*na_settings_get_uint_list ( NASettings
*settings
, const gchar
*key
, gboolean
*found
, gboolean
*mandatory
);
179 gboolean
na_settings_set_boolean ( NASettings
*settings
, const gchar
*key
, gboolean value
);
180 gboolean
na_settings_set_boolean_ex ( NASettings
*settings
, const gchar
*group
, const gchar
*key
, gboolean value
);
181 gboolean
na_settings_set_string ( NASettings
*settings
, const gchar
*key
, const gchar
*value
);
182 gboolean
na_settings_set_string_list ( NASettings
*settings
, const gchar
*key
, const GSList
*value
);
183 gboolean
na_settings_set_uint ( NASettings
*settings
, const gchar
*key
, guint value
);
184 gboolean
na_settings_set_uint_list ( NASettings
*settings
, const gchar
*key
, const GList
*value
);
186 /* na_iprefs_get_io_providers()
188 GSList
*na_settings_get_groups ( NASettings
*settings
);
192 #endif /* __CORE_NA_SETTINGS_H__ */