Commit 60ff2c91 authored by Pierre Wieser's avatar Pierre Wieser

na_settings is renamed to fma_settings

parent ceabf86c
......@@ -115,8 +115,8 @@ libna_core_la_SOURCES = \
fma-pivot.h \
fma-selected-info.c \
fma-selected-info.h \
na-settings.c \
na-settings.h \
fma-settings.c \
fma-settings.h \
fma-timeout.c \
na-tokens.c \
na-tokens.h \
......
......@@ -37,7 +37,7 @@
#include "fma-exporter.h"
#include "fma-export-format.h"
#include "na-settings.h"
#include "fma-settings.h"
typedef struct {
const gchar *format; /* export format saved in user's preferences */
......
......@@ -40,7 +40,7 @@
*
* Migrate users actions and menus from GConf to .desktop files.
* Disable GConf I/O provider both for reading and writing.
* Migrate users preferences to NASettings.
* Migrate users preferences to FMASettings.
*
* Since: 3.1
*/
......
......@@ -35,7 +35,7 @@
#include <string.h>
#include "fma-gtk-utils.h"
#include "na-settings.h"
#include "fma-settings.h"
static void int_list_to_position( GList *list, gint *x, gint *y, gint *width, gint *height );
static GList *position_to_int_list( gint x, gint y, gint width, gint height );
......@@ -168,7 +168,7 @@ fma_gtk_utils_restore_window_position( GtkWindow *toplevel, const gchar *wsp_nam
g_debug( "%s: toplevel=%p (%s), wsp_name=%s",
thisfn, ( void * ) toplevel, G_OBJECT_TYPE_NAME( toplevel ), wsp_name );
list = na_settings_get_uint_list( wsp_name, NULL, NULL );
list = fma_settings_get_uint_list( wsp_name, NULL, NULL );
if( list ){
int_list_to_position( list, &x, &y, &width, &height );
......@@ -184,7 +184,7 @@ fma_gtk_utils_restore_window_position( GtkWindow *toplevel, const gchar *wsp_nam
/* bad hack for the first time we open the main window
* try to target an ideal size and position
*/
if( !strcmp( wsp_name, NA_IPREFS_MAIN_WINDOW_WSP )){
if( !strcmp( wsp_name, IPREFS_MAIN_WINDOW_WSP )){
if( x == 1 && y == 1 && width == 1 && height == 1 ){
x = 50;
y = 70;
......@@ -234,7 +234,7 @@ fma_gtk_utils_save_window_position( GtkWindow *toplevel, const gchar *wsp_name )
g_debug( "%s: wsp_name=%s, x=%d, y=%d, width=%d, height=%d", thisfn, wsp_name, x, y, width, height );
list = position_to_int_list( x, y, width, height );
na_settings_set_uint_list( wsp_name, list );
fma_settings_set_uint_list( wsp_name, list );
free_int_list( list );
}
......
......@@ -53,7 +53,7 @@
#include "fma-desktop-environment.h"
#include "fma-gnome-vfs-uri.h"
#include "fma-selected-info.h"
#include "na-settings.h"
#include "fma-settings.h"
/* private interface data
*/
......@@ -527,7 +527,7 @@ is_candidate_for_show_in( const FMAIContext *object, guint target, GList *files
* but this occurs only once..
*/
if( !environment ){
environment = na_settings_get_string( NA_IPREFS_DESKTOP_ENVIRONMENT, NULL, NULL );
environment = fma_settings_get_string( IPREFS_DESKTOP_ENVIRONMENT, NULL, NULL );
if( !environment || !strlen( environment )){
environment = ( gchar * ) fma_desktop_environment_detect_running_desktop();
}
......
......@@ -41,7 +41,7 @@
#include "fma-importer.h"
#include "fma-importer-ask.h"
#include "fma-ioptions-list.h"
#include "na-settings.h"
#include "fma-settings.h"
/* private class data
*/
......@@ -352,7 +352,7 @@ fma_importer_ask_user( const FMAObjectItem *importing, const FMAObjectItem *exis
} while ( !on_dialog_response( dialog, code ));
mode = dialog->private->mode;
fma_gtk_utils_save_window_position( dialog->private->toplevel, NA_IPREFS_IMPORT_ASK_USER_WSP );
fma_gtk_utils_save_window_position( dialog->private->toplevel, IPREFS_IMPORT_ASK_USER_WSP );
if( parms->parent ){
gtk_widget_hide( GTK_WIDGET( dialog->private->toplevel ));
......@@ -413,14 +413,14 @@ initialize_window( FMAImporterAsk *editor, GtkWindow *toplevel )
g_free( label );
widget = fma_gtk_utils_find_widget_by_name( GTK_CONTAINER( toplevel ), "AskModeVBox" );
mode_id = na_settings_get_string( NA_IPREFS_IMPORT_ASK_USER_LAST_MODE, NULL, NULL );
mode_id = fma_settings_get_string( IPREFS_IMPORT_ASK_USER_LAST_MODE, NULL, NULL );
fma_ioptions_list_set_default( FMA_IOPTIONS_LIST( editor ), widget, mode_id );
g_free( mode_id );
button = fma_gtk_utils_find_widget_by_name( GTK_CONTAINER( toplevel ), "AskKeepChoiceButton" );
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( button ), editor->private->parms->keep_choice );
fma_gtk_utils_restore_window_position( toplevel, NA_IPREFS_IMPORT_ASK_USER_WSP );
fma_gtk_utils_restore_window_position( toplevel, IPREFS_IMPORT_ASK_USER_WSP );
gtk_widget_show_all( GTK_WIDGET( toplevel ));
}
......@@ -437,14 +437,14 @@ get_selected_mode( FMAImporterAsk *editor )
mode = fma_ioptions_list_get_selected( FMA_IOPTIONS_LIST( editor ), widget );
mode_id = fma_ioption_get_id( mode );
na_settings_set_string( NA_IPREFS_IMPORT_ASK_USER_LAST_MODE, mode_id );
fma_settings_set_string( IPREFS_IMPORT_ASK_USER_LAST_MODE, mode_id );
g_free( mode_id );
editor->private->mode = fma_import_mode_get_id( FMA_IMPORT_MODE( mode ));
button = fma_gtk_utils_find_widget_by_name( GTK_CONTAINER( editor->private->toplevel ), "AskKeepChoiceButton" );
keep = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( button ));
na_settings_set_boolean( NA_IPREFS_IMPORT_ASK_USER_KEEP_LAST_CHOICE, keep );
fma_settings_set_boolean( IPREFS_IMPORT_ASK_USER_KEEP_LAST_CHOICE, keep );
}
/*
......
......@@ -165,7 +165,7 @@ fma_importer_import_from_uris( const FMAPivot *pivot, FMAImporterParms *parms )
/* set the default import mode
*/
if( !parms->preferred_mode ){
mode_str = na_settings_get_string( NA_IPREFS_IMPORT_PREFERRED_MODE, NULL, NULL );
mode_str = fma_settings_get_string( IPREFS_IMPORT_PREFERRED_MODE, NULL, NULL );
parms->preferred_mode = get_id_from_string( mode_str );
g_free( mode_str );
}
......@@ -432,7 +432,7 @@ ask_user_for_mode( const FMAObjectItem *importing, const FMAObjectItem *existing
mode = fma_importer_ask_user( importing, existing, parms );
} else {
mode_str = na_settings_get_string( NA_IPREFS_IMPORT_ASK_USER_LAST_MODE, NULL, NULL );
mode_str = fma_settings_get_string( IPREFS_IMPORT_ASK_USER_LAST_MODE, NULL, NULL );
mode = get_id_from_string( mode_str );
g_free( mode_str );
}
......
......@@ -120,7 +120,7 @@ typedef struct {
GSList *uris; /* the list of uris to import */
FMAImporterCheckFn check_fn; /* the check_for_duplicate function */
void *check_fn_data; /* data to be passed to the check_fn function */
guint preferred_mode; /* preferred import mode, defaults to NA_IPREFS_IMPORT_PREFERRED_MODE */
guint preferred_mode; /* preferred import mode, defaults to IPREFS_IMPORT_PREFERRED_MODE */
GtkWindow *parent_toplevel; /* parent toplevel */
}
FMAImporterParms;
......
......@@ -414,7 +414,7 @@ io_providers_list_add_from_write_order( const FMAPivot *pivot, GList *objects_li
const gchar *id;
merged = objects_list;
io_providers = na_settings_get_string_list( NA_IPREFS_IO_PROVIDERS_WRITE_ORDER, NULL, NULL );
io_providers = fma_settings_get_string_list( IPREFS_IO_PROVIDERS_WRITE_ORDER, NULL, NULL );
for( it = io_providers ; it ; it = it->next ){
id = ( const gchar * ) it->data;
......@@ -521,8 +521,8 @@ io_providers_get_from_prefs( void )
guint prefix_len;
providers = NULL;
groups = na_settings_get_groups();
group_prefix = g_strdup_printf( "%s ", NA_IPREFS_IO_PROVIDER_GROUP );
groups = fma_settings_get_groups();
group_prefix = g_strdup_printf( "%s ", IPREFS_IO_PROVIDER_GROUP );
prefix_len = strlen( group_prefix );
for( it = groups ; it ; it = it->next ){
......@@ -756,8 +756,8 @@ fma_io_provider_is_conf_readable( const FMAIOProvider *provider, const FMAPivot
if( !provider->private->dispose_has_run ){
group = g_strdup_printf( "%s %s", NA_IPREFS_IO_PROVIDER_GROUP, provider->private->id );
readable = na_settings_get_boolean_ex( group, NA_IPREFS_IO_PROVIDER_READABLE, NULL, mandatory );
group = g_strdup_printf( "%s %s", IPREFS_IO_PROVIDER_GROUP, provider->private->id );
readable = fma_settings_get_boolean_ex( group, IPREFS_IO_PROVIDER_READABLE, NULL, mandatory );
g_free( group );
}
......@@ -866,7 +866,7 @@ fma_io_provider_load_items( const FMAPivot *pivot, guint loadable_set, GSList **
/* build the items hierarchy
*/
level_zero = na_settings_get_string_list( NA_IPREFS_ITEMS_LEVEL_ZERO_ORDER, NULL, NULL );
level_zero = fma_settings_get_string_list( IPREFS_ITEMS_LEVEL_ZERO_ORDER, NULL, NULL );
hierarchy = load_items_hierarchy_build( &flat, level_zero, TRUE, NULL );
......@@ -947,8 +947,8 @@ is_conf_writable( const FMAIOProvider *provider, const FMAPivot *pivot, gboolean
gchar *group;
gboolean is_writable;
group = g_strdup_printf( "%s %s", NA_IPREFS_IO_PROVIDER_GROUP, provider->private->id );
is_writable = na_settings_get_boolean_ex( group, NA_IPREFS_IO_PROVIDER_WRITABLE, NULL, mandatory );
group = g_strdup_printf( "%s %s", IPREFS_IO_PROVIDER_GROUP, provider->private->id );
is_writable = fma_settings_get_boolean_ex( group, IPREFS_IO_PROVIDER_WRITABLE, NULL, mandatory );
g_free( group );
return( is_writable );
......
......@@ -37,7 +37,7 @@
#include "fma-importer.h"
#include "fma-iprefs.h"
#include "na-settings.h"
#include "fma-settings.h"
typedef struct {
guint id;
......@@ -83,7 +83,7 @@ fma_iprefs_get_order_mode( gboolean *mandatory )
gchar *order_mode_str;
guint order_mode;
order_mode_str = na_settings_get_string( NA_IPREFS_ITEMS_LIST_ORDER_MODE, NULL, mandatory );
order_mode_str = fma_settings_get_string( IPREFS_ITEMS_LIST_ORDER_MODE, NULL, mandatory );
order_mode = enum_map_id_from_string( st_order_mode, order_mode_str );
g_free( order_mode_str );
......@@ -123,7 +123,7 @@ fma_iprefs_set_order_mode( guint mode )
const gchar *order_str;
order_str = enum_map_string_from_id( st_order_mode, mode );
na_settings_set_string( NA_IPREFS_ITEMS_LIST_ORDER_MODE, order_str );
fma_settings_set_string( IPREFS_ITEMS_LIST_ORDER_MODE, order_str );
}
/*
......@@ -139,7 +139,7 @@ fma_iprefs_get_tabs_pos( gboolean *mandatory )
gchar *tabs_pos_str;
guint tabs_pos;
tabs_pos_str = na_settings_get_string( NA_IPREFS_MAIN_TABS_POS, NULL, mandatory );
tabs_pos_str = fma_settings_get_string( IPREFS_MAIN_TABS_POS, NULL, mandatory );
tabs_pos = enum_map_id_from_string( st_tabs_pos, tabs_pos_str );
g_free( tabs_pos_str );
......@@ -158,7 +158,7 @@ fma_iprefs_set_tabs_pos( guint position )
const gchar *tabs_pos_str;
tabs_pos_str = enum_map_string_from_id( st_tabs_pos, 1+position );
na_settings_set_string( NA_IPREFS_MAIN_TABS_POS, tabs_pos_str );
fma_settings_set_string( IPREFS_MAIN_TABS_POS, tabs_pos_str );
}
/*
......@@ -197,7 +197,7 @@ fma_iprefs_write_level_zero( const GList *items, GSList **messages )
}
content = g_slist_reverse( content );
written = na_settings_set_string_list( NA_IPREFS_ITEMS_LEVEL_ZERO_ORDER, content );
written = fma_settings_set_string_list( IPREFS_ITEMS_LEVEL_ZERO_ORDER, content );
fma_core_utils_slist_free( content );
......
......@@ -329,7 +329,7 @@ instance_dispose( GObject *object )
self->private->tree = fma_object_free_items( self->private->tree );
/* release the settings */
na_settings_free();
fma_settings_free();
/* release the I/O Provider object list */
fma_io_provider_unref_io_providers_list();
......
......@@ -75,7 +75,7 @@
#include <api/fma-iio-provider.h>
#include <api/fma-object-api.h>
#include "na-settings.h"
#include "fma-settings.h"
G_BEGIN_DECLS
......
/*
* FileManager-Actions
* A file-manager extension which offers configurable context menu modules.
*
* Copyright (C) 2005 The GNOME Foundation
* Copyright (C) 2006-2008 Frederic Ruaudel and others (see AUTHORS)
* Copyright (C) 2009-2015 Pierre Wieser and others (see AUTHORS)
*
* FileManager-Actions is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* FileManager-Actions is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with FileManager-Actions; see the file COPYING. If not, see
* <http://www.gnu.org/licenses/>.
*
* Authors:
* Frederic Ruaudel <grumz@grumz.net>
* Rodrigo Moya <rodrigo@gnome-db.org>
* Pierre Wieser <pwieser@trychlos.org>
* ... and many others (see AUTHORS)
*/
#ifndef __CORE_FMA_SETTINGS_H__
#define __CORE_FMA_SETTINGS_H__
/* @title: FMASettings
* @short_description: The Settings Class Definition
* @include: core/fma-settings.h
*
* The #FMASettings class manages users preferences.
*
* Actual configuration may come from two sources:
* - a global configuration, which apply to all users, as read-only
* parameters;
* - a per-user configuration.
*
* The configuration is implemented as keyed files:
* - global configuration is sysconfdir/xdg/file-manager-actions/nautilus-actions.conf
* - per-user configuration is HOME/.config/file-manager-actions/nautilus-actions.conf
*
* Each setting may so have its own read-only attribute, whether it
* has been read from the global configuration or from the
* per-user one.
*
* FMASettings class monitors the whole configuration.
* A client may be informed of a modification of the value of a key either by
* pre-registering a callback on this key (see fma_settings_register_key_callback()
* function), or by connecting to and filtering the notification signal.
*
* #FMASettings class defines a singleton object, which allocates itself
* when needed
*/
#include <glib-object.h>
G_BEGIN_DECLS
/* This is a composite key;
* by registering a callback on this key, a client may be informed of any
* modification regarding the readability status of the i/o providers.
*/
#define IPREFS_IO_PROVIDERS_READ_STATUS "io-providers-read-status-composite-key"
/* other keys, mainly user preferences
*/
#define IPREFS_ADMIN_PREFERENCES_LOCKED "preferences-locked"
#define IPREFS_ADMIN_IO_PROVIDERS_LOCKED "io-providers-locked"
#define IPREFS_ASSISTANT_ESC_CONFIRM "assistant-esc-confirm"
#define IPREFS_ASSISTANT_ESC_QUIT "assistant-esc-quit"
#define IPREFS_CAPABILITY_ADD_CAPABILITY_WSP "capability-add-capability-wsp"
#define IPREFS_COMMAND_CHOOSER_WSP "command-command-chooser-wsp"
#define IPREFS_COMMAND_CHOOSER_URI "command-command-chooser-lfu"
#define IPREFS_COMMAND_LEGEND_WSP "command-legend-wsp"
#define IPREFS_DESKTOP_ENVIRONMENT "desktop-environment"
#define IPREFS_CONFIRM_LOGOUT_WSP "confirm-logout-wsp"
#define IPREFS_WORKING_DIR_WSP "command-working-dir-chooser-wsp"
#define IPREFS_WORKING_DIR_URI "command-working-dir-chooser-lfu"
#define IPREFS_SHOW_IF_RUNNING_WSP "environment-show-if-running-wsp"
#define IPREFS_SHOW_IF_RUNNING_URI "environment-show-if-running-lfu"
#define IPREFS_TRY_EXEC_WSP "environment-try-exec-wsp"
#define IPREFS_TRY_EXEC_URI "environment-try-exec-lfu"
#define IPREFS_EXPORT_ASK_USER_WSP "export-ask-user-wsp"
#define IPREFS_EXPORT_ASK_USER_LAST_FORMAT "export-ask-user-last-format"
#define IPREFS_EXPORT_ASK_USER_KEEP_LAST_CHOICE "export-ask-user-keep-last-choice"
#define IPREFS_EXPORT_ASSISTANT_WSP "export-assistant-wsp"
#define IPREFS_EXPORT_ASSISTANT_URI "export-assistant-lfu"
#define IPREFS_EXPORT_ASSISTANT_PANED "export-assistant-paned-width"
#define IPREFS_EXPORT_PREFERRED_FORMAT "export-preferred-format"
#define IPREFS_FOLDER_CHOOSER_WSP "folder-chooser-wsp"
#define IPREFS_FOLDER_CHOOSER_URI "folder-chooser-lfu"
#define IPREFS_IMPORT_ASK_USER_WSP "import-ask-user-wsp"
#define IPREFS_IMPORT_ASK_USER_LAST_MODE "import-ask-user-last-mode"
#define IPREFS_IMPORT_ASSISTANT_WSP "import-assistant-wsp"
#define IPREFS_IMPORT_ASSISTANT_URI "import-assistant-lfu"
#define IPREFS_IMPORT_ASK_USER_KEEP_LAST_CHOICE "import-ask-user-keep-last-choice"
#define IPREFS_IMPORT_PREFERRED_MODE "import-preferred-mode"
#define IPREFS_ICON_CHOOSER_URI "item-icon-chooser-lfu"
#define IPREFS_ICON_CHOOSER_PANED "item-icon-chooser-paned-width"
#define IPREFS_ICON_CHOOSER_WSP "item-icon-chooser-wsp"
#define IPREFS_IO_PROVIDERS_WRITE_ORDER "io-providers-write-order"
#define IPREFS_ITEMS_ADD_ABOUT_ITEM "items-add-about-item"
#define IPREFS_ITEMS_CREATE_ROOT_MENU "items-create-root-menu"
#define IPREFS_ITEMS_LEVEL_ZERO_ORDER "items-level-zero-order"
#define IPREFS_ITEMS_LIST_ORDER_MODE "items-list-order-mode"
#define IPREFS_MAIN_PANED "main-paned-width"
#define IPREFS_MAIN_SAVE_AUTO "main-save-auto"
#define IPREFS_MAIN_SAVE_PERIOD "main-save-period"
#define IPREFS_MAIN_TABS_POS "main-tabs-pos"
#define IPREFS_MAIN_TOOLBAR_EDIT_DISPLAY "main-toolbar-edit-display"
#define IPREFS_MAIN_TOOLBAR_FILE_DISPLAY "main-toolbar-file-display"
#define IPREFS_MAIN_TOOLBAR_HELP_DISPLAY "main-toolbar-help-display"
#define IPREFS_MAIN_TOOLBAR_TOOLS_DISPLAY "main-toolbar-tools-display"
#define IPREFS_MAIN_WINDOW_WSP "main-window-wsp"
#define IPREFS_PREFERENCES_WSP "preferences-wsp"
#define IPREFS_PLUGIN_MENU_LOG "plugin-menu-log-enabled"
#define IPREFS_RELABEL_DUPLICATE_ACTION "relabel-when-duplicate-action"
#define IPREFS_RELABEL_DUPLICATE_MENU "relabel-when-duplicate-menu"
#define IPREFS_RELABEL_DUPLICATE_PROFILE "relabel-when-duplicate-profile"
#define IPREFS_SCHEME_ADD_SCHEME_WSP "scheme-add-scheme-wsp"
#define IPREFS_SCHEME_DEFAULT_LIST "scheme-default-list"
#define IPREFS_TERMINAL_PATTERN "terminal-pattern"
#define IPREFS_IO_PROVIDER_GROUP "io-provider"
#define IPREFS_IO_PROVIDER_READABLE "readable"
#define IPREFS_IO_PROVIDER_WRITABLE "writable"
/* pre-registration of a callback
*/
typedef void ( *FMASettingsKeyCallback )( const gchar *group, const gchar *key, gconstpointer new_value, gboolean mandatory, void *user_data );
void fma_settings_register_key_callback( const gchar *key, GCallback callback, gpointer user_data );
/* signal sent when the value of a key changes
*/
#define SETTINGS_SIGNAL_KEY_CHANGED "settings-key-changed"
void fma_settings_free ( void );
gboolean fma_settings_get_boolean ( const gchar *key, gboolean *found, gboolean *mandatory );
gboolean fma_settings_get_boolean_ex ( const gchar *group, const gchar *key, gboolean *found, gboolean *mandatory );
gchar *fma_settings_get_string ( const gchar *key, gboolean *found, gboolean *mandatory );
GSList *fma_settings_get_string_list ( const gchar *key, gboolean *found, gboolean *mandatory );
guint fma_settings_get_uint ( const gchar *key, gboolean *found, gboolean *mandatory );
GList *fma_settings_get_uint_list ( const gchar *key, gboolean *found, gboolean *mandatory );
gboolean fma_settings_set_boolean ( const gchar *key, gboolean value );
gboolean fma_settings_set_boolean_ex ( const gchar *group, const gchar *key, gboolean value );
gboolean fma_settings_set_string ( const gchar *key, const gchar *value );
gboolean fma_settings_set_string_ex ( const gchar *group, const gchar *key, const gchar *value );
gboolean fma_settings_set_string_list ( const gchar *key, const GSList *value );
gboolean fma_settings_set_int_ex ( const gchar *group, const gchar *key, int value );
gboolean fma_settings_set_uint ( const gchar *key, guint value );
gboolean fma_settings_set_uint_list ( const gchar *key, const GList *value );
GSList *fma_settings_get_groups ( void );
G_END_DECLS
#endif /* __CORE_FMA_SETTINGS_H__ */
......@@ -2,5 +2,5 @@
# FMAIDuplicable:: IDUPLICABLE_SIGNAL_VALID_CHANGED
VOID:POINTER,BOOLEAN
#
# NASettings:: SETTINGS_SIGNAL_KEY_CHANGED
# FMASettings:: SETTINGS_SIGNAL_KEY_CHANGED
VOID:STRING,STRING,POINTER,BOOLEAN
/*
* FileManager-Actions
* A file-manager extension which offers configurable context menu modules.
*
* Copyright (C) 2005 The GNOME Foundation
* Copyright (C) 2006-2008 Frederic Ruaudel and others (see AUTHORS)
* Copyright (C) 2009-2015 Pierre Wieser and others (see AUTHORS)
*
* FileManager-Actions is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* FileManager-Actions is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with FileManager-Actions; see the file COPYING. If not, see
* <http://www.gnu.org/licenses/>.
*
* Authors:
* Frederic Ruaudel <grumz@grumz.net>
* Rodrigo Moya <rodrigo@gnome-db.org>
* Pierre Wieser <pwieser@trychlos.org>
* ... and many others (see AUTHORS)
*/
#ifndef __CORE_NA_SETTINGS_H__
#define __CORE_NA_SETTINGS_H__
/* @title: NASettings
* @short_description: The Settings Class Definition
* @include: core/na-settings.h
*
* The #NASettings class manages users preferences.
*
* Actual configuration may come from two sources:
* - a global configuration, which apply to all users, as read-only
* parameters;
* - a per-user configuration.
*
* The configuration is implemented as keyed files:
* - global configuration is sysconfdir/xdg/file-manager-actions/nautilus-actions.conf
* - per-user configuration is HOME/.config/file-manager-actions/nautilus-actions.conf
*
* Each setting may so have its own read-only attribute, whether it
* has been read from the global configuration or from the
* per-user one.
*
* NASettings class monitors the whole configuration.
* A client may be informed of a modification of the value of a key either by
* pre-registering a callback on this key (see na_settings_register_key_callback()
* function), or by connecting to and filtering the notification signal.
*
* #NASettings class defines a singleton object, which allocates itself
* when needed
*/
#include <glib-object.h>
G_BEGIN_DECLS
/* This is a composite key;
* by registering a callback on this key, a client may be informed of any
* modification regarding the readability status of the i/o providers.
*/
#define NA_IPREFS_IO_PROVIDERS_READ_STATUS "io-providers-read-status-composite-key"
/* other keys, mainly user preferences
*/
#define NA_IPREFS_ADMIN_PREFERENCES_LOCKED "preferences-locked"
#define NA_IPREFS_ADMIN_IO_PROVIDERS_LOCKED "io-providers-locked"
#define NA_IPREFS_ASSISTANT_ESC_CONFIRM "assistant-esc-confirm"
#define NA_IPREFS_ASSISTANT_ESC_QUIT "assistant-esc-quit"
#define NA_IPREFS_CAPABILITY_ADD_CAPABILITY_WSP "capability-add-capability-wsp"
#define NA_IPREFS_COMMAND_CHOOSER_WSP "command-command-chooser-wsp"
#define NA_IPREFS_COMMAND_CHOOSER_URI "command-command-chooser-lfu"
#define NA_IPREFS_COMMAND_LEGEND_WSP "command-legend-wsp"
#define NA_IPREFS_DESKTOP_ENVIRONMENT "desktop-environment"
#define NA_IPREFS_CONFIRM_LOGOUT_WSP "confirm-logout-wsp"
#define NA_IPREFS_WORKING_DIR_WSP "command-working-dir-chooser-wsp"
#define NA_IPREFS_WORKING_DIR_URI "command-working-dir-chooser-lfu"
#define NA_IPREFS_SHOW_IF_RUNNING_WSP "environment-show-if-running-wsp"
#define NA_IPREFS_SHOW_IF_RUNNING_URI "environment-show-if-running-lfu"
#define NA_IPREFS_TRY_EXEC_WSP "environment-try-exec-wsp"
#define NA_IPREFS_TRY_EXEC_URI "environment-try-exec-lfu"
#define NA_IPREFS_EXPORT_ASK_USER_WSP "export-ask-user-wsp"
#define NA_IPREFS_EXPORT_ASK_USER_LAST_FORMAT "export-ask-user-last-format"
#define NA_IPREFS_EXPORT_ASK_USER_KEEP_LAST_CHOICE "export-ask-user-keep-last-choice"
#define NA_IPREFS_EXPORT_ASSISTANT_WSP "export-assistant-wsp"
#define NA_IPREFS_EXPORT_ASSISTANT_URI "export-assistant-lfu"
#define NA_IPREFS_EXPORT_ASSISTANT_PANED "export-assistant-paned-width"
#define NA_IPREFS_EXPORT_PREFERRED_FORMAT "export-preferred-format"
#define NA_IPREFS_FOLDER_CHOOSER_WSP "folder-chooser-wsp"
#define NA_IPREFS_FOLDER_CHOOSER_URI "folder-chooser-lfu"
#define NA_IPREFS_IMPORT_ASK_USER_WSP "import-ask-user-wsp"
#define NA_IPREFS_IMPORT_ASK_USER_LAST_MODE "import-ask-user-last-mode"
#define NA_IPREFS_IMPORT_ASSISTANT_WSP "import-assistant-wsp"
#define NA_IPREFS_IMPORT_ASSISTANT_URI "import-assistant-lfu"
#define NA_IPREFS_IMPORT_ASK_USER_KEEP_LAST_CHOICE "import-ask-user-keep-last-choice"
#define NA_IPREFS_IMPORT_PREFERRED_MODE "import-preferred-mode"
#define NA_IPREFS_ICON_CHOOSER_URI "item-icon-chooser-lfu"
#define NA_IPREFS_ICON_CHOOSER_PANED "item-icon-chooser-paned-width"
#define NA_IPREFS_ICON_CHOOSER_WSP "item-icon-chooser-wsp"
#define NA_IPREFS_IO_PROVIDERS_WRITE_ORDER "io-providers-write-order"
#define NA_IPREFS_ITEMS_ADD_ABOUT_ITEM "items-add-about-item"
#define NA_IPREFS_ITEMS_CREATE_ROOT_MENU "items-create-root-menu"
#define NA_IPREFS_ITEMS_LEVEL_ZERO_ORDER "items-level-zero-order"
#define NA_IPREFS_ITEMS_LIST_ORDER_MODE "items-list-order-mode"
#define NA_IPREFS_MAIN_PANED "main-paned-width"
#define NA_IPREFS_MAIN_SAVE_AUTO "main-save-auto"
#define NA_IPREFS_MAIN_SAVE_PERIOD "main-save-period"
#define NA_IPREFS_MAIN_TABS_POS "main-tabs-pos"
#define NA_IPREFS_MAIN_TOOLBAR_EDIT_DISPLAY "main-toolbar-edit-display"
#define NA_IPREFS_MAIN_TOOLBAR_FILE_DISPLAY "main-toolbar-file-display"
#define NA_IPREFS_MAIN_TOOLBAR_HELP_DISPLAY "main-toolbar-help-display"
#define NA_IPREFS_MAIN_TOOLBAR_TOOLS_DISPLAY "main-toolbar-tools-display"
#define NA_IPREFS_MAIN_WINDOW_WSP "main-window-wsp"
#define NA_IPREFS_PREFERENCES_WSP "preferences-wsp"
#define NA_IPREFS_PLUGIN_MENU_LOG "plugin-menu-log-enabled"
#define NA_IPREFS_RELABEL_DUPLICATE_ACTION "relabel-when-duplicate-action"
#define NA_IPREFS_RELABEL_DUPLICATE_MENU "relabel-when-duplicate-menu"
#define NA_IPREFS_RELABEL_DUPLICATE_PROFILE "relabel-when-duplicate-profile"
#define NA_IPREFS_SCHEME_ADD_SCHEME_WSP "scheme-add-scheme-wsp"
#define NA_IPREFS_SCHEME_DEFAULT_LIST "scheme-default-list"
#define NA_IPREFS_TERMINAL_PATTERN "terminal-pattern"
#define NA_IPREFS_IO_PROVIDER_GROUP "io-provider"
#define NA_IPREFS_IO_PROVIDER_READABLE "readable"
#define NA_IPREFS_IO_PROVIDER_WRITABLE "writable"
/* pre-registration of a callback
*/
typedef void ( *NASettingsKeyCallback )( const gchar *group, const gchar *key, gconstpointer new_value, gboolean mandatory, void *user_data );
void na_settings_register_key_callback( const gchar *key, GCallback callback, gpointer user_data );
/* signal sent when the value of a key changes
*/
#define SETTINGS_SIGNAL_KEY_CHANGED "settings-key-changed"
void na_settings_free ( void );
gboolean na_settings_get_boolean ( const gchar *key, gboolean *found, gboolean *mandatory );
gboolean na_settings_get_boolean_ex ( const gchar *group, const gchar *key, gboolean *found, gboolean *mandatory );
gchar *na_settings_get_string ( const gchar *key, gboolean *found, gboolean *mandatory );
GSList *na_settings_get_string_list ( const gchar *key, gboolean *found, gboolean *mandatory );
guint na_settings_get_uint ( const gchar *key, gboolean *found, gboolean *mandatory );
GList *na_settings_get_uint_list ( const gchar *key, gboolean *found, gboolean *mandatory );
gboolean na_settings_set_boolean ( const gchar *key, gboolean value );
gboolean na_settings_set_boolean_ex ( const gchar *group, const gchar *key, gboolean value );
gboolean na_settings_set_string ( const gchar *key, const gchar *value );
gboolean na_settings_set_string_ex ( const gchar *group, const gchar *key, const gchar *value );
gboolean na_settings_set_string_list ( const gchar *key, const GSList *value );
gboolean na_settings_set_int_ex ( const gchar *group, const gchar *key, int value );
gboolean na_settings_set_uint ( const gchar *key, guint value );
gboolean na_settings_set_uint_list ( const gchar *key, const GList *value );
GSList *na_settings_get_groups ( void );
G_END_DECLS
#endif /* __CORE_NA_SETTINGS_H__ */
......@@ -41,7 +41,7 @@
#include "fma-gnome-vfs-uri.h"
#include "fma-selected-info.h"
#include "na-settings.h"
#include "fma-settings.h"
#include "na-tokens.h"
/* private class data
......@@ -623,7 +623,7 @@ get_command_execution_terminal( const gchar *command )
gchar *run_command;
gchar *pattern;
pattern = na_settings_get_string( NA_IPREFS_TERMINAL_PATTERN, NULL, NULL );
pattern = fma_settings_get_string( IPREFS_TERMINAL_PATTERN, NULL, NULL );
run_command = na_tokens_command_for_terminal( pattern, command );
g_free( pattern );
......
......@@ -36,7 +36,7 @@
#include <api/fma-object-api.h>
#include "fma-io-provider.h"
#include "na-settings.h"
#include "fma-settings.h"
#include "na-updater.h"
/* private class data
......@@ -211,7 +211,7 @@ are_preferences_locked( const NAUpdater *updater )
gboolean are_locked;
gboolean mandatory;
are_locked = na_settings_get_boolean( NA_IPREFS_ADMIN_PREFERENCES_LOCKED, NULL, &mandatory );
are_locked = fma_settings_get_boolean( IPREFS_ADMIN_PREFERENCES_LOCKED, NULL, &mandatory );
return( are_locked && mandatory );
}
......@@ -222,11 +222,11 @@ is_level_zero_writable( const NAUpdater *updater )
GSList *level_zero;
gboolean mandatory;
level_zero = na_settings_get_string_list( NA_IPREFS_ITEMS_LEVEL_ZERO_ORDER, NULL, &mandatory );
level_zero = fma_settings_get_string_list( IPREFS_ITEMS_LEVEL_ZERO_ORDER, NULL, &mandatory );
fma_core_utils_slist_free( level_zero );
g_debug( "na_updater_is_level_zero_writable: NA_IPREFS_ITEMS_LEVEL_ZERO_ORDER: mandatory=%s",
g_debug( "na_updater_is_level_zero_writable: IPREFS_ITEMS_LEVEL_ZERO_ORDER: mandatory=%s",
mandatory ? "True":"False" );
return( !mandatory );
......@@ -482,13 +482,13 @@ na_updater_should_pasted_be_relabeled( const NAUpdater *updater, const FMAObject
gboolean relabel;
if( FMA_IS_OBJECT_MENU( item )){
relabel = na_settings_get_boolean( NA_IPREFS_RELABEL_DUPLICATE_MENU, NULL, NULL );
relabel = fma_settings_get_boolean( IPREFS_RELABEL_DUPLICATE_MENU, NULL, NULL );
} else if( FMA_IS_OBJECT_ACTION( item )){
relabel = na_settings_get_boolean( NA_IPREFS_RELABEL_DUPLICATE_ACTION, NULL, NULL );
relabel = fma_settings_get_boolean( IPREFS_RELABEL_DUPLICATE_ACTION, NULL, NULL );
} else if( FMA_IS_OBJECT_PROFILE( item )){
relabel = na_settings_get_boolean( NA_IPREFS_RELABEL_DUPLICATE_PROFILE, NULL, NULL );
relabel = fma_settings_get_boolean( IPREFS_RELABEL_DUPLICATE_PROFILE, NULL, NULL );
} else {
g_warning( "%s: unknown item type at %p", thisfn, ( void * ) item );
......
......@@ -413,7 +413,7 @@ base_gtk_utils_select_file_with_preview( GtkApplicationWindow *window,
gtk_file_chooser_set_filename( GTK_FILE_CHOOSER( dialog ), text );
} else {
uri = na_settings_get_string( entry_name, NULL, NULL );
uri = fma_settings_get_string( entry_name, NULL, NULL );
if( uri ){
gtk_file_chooser_set_current_folder_uri( GTK_FILE_CHOOSER( dialog ), uri );
g_free( uri );
......@@ -427,7 +427,7 @@ base_gtk_utils_select_file_with_preview( GtkApplicationWindow *window,
}
uri = gtk_file_chooser_get_current_folder_uri( GTK_FILE_CHOOSER( dialog ));
na_settings_set_string( entry_name, uri );
fma_settings_set_string( entry_name, uri );
g_free( uri );
fma_gtk_utils_save_window_position( GTK_WINDOW( dialog ), wsp_name );
......@@ -480,7 +480,7 @@ base_gtk_utils_select_dir( GtkApplicationWindow *window,
gtk_file_chooser_set_filename( GTK_FILE_CHOOSER( dialog ), text );
} else {
uri = na_settings_get_string( entry_name, NULL, NULL );
uri = fma_settings_get_string( entry_name, NULL, NULL );
if( uri ){
gtk_file_chooser_set_current_folder_uri( GTK_FILE_CHOOSER( dialog ), uri );
g_free( uri );
......@@ -494,7 +494,7 @@ base_gtk_utils_select_dir( GtkApplicationWindow *window,
}
uri = gtk_file_chooser_get_current_folder_uri( GTK_FILE_CHOOSER( dialog ));
na_settings_set_string( entry_name, uri );
fma_settings_set_string( entry_name, uri );
g_free( uri );
fma_gtk_utils_save_window_position( GTK_WINDOW( dialog ), wsp_name );
......