[nautilus-actions] Convert NASettings to a private singleton
- From: Pierre Wieser <pwieser src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus-actions] Convert NASettings to a private singleton
- Date: Fri, 25 Feb 2011 02:46:39 +0000 (UTC)
commit daf98224f828d09c1bf56cce2c0445f6a7af695c
Author: Pierre Wieser <pwieser trychlos org>
Date: Fri Feb 25 03:46:15 2011 +0100
Convert NASettings to a private singleton
ChangeLog | 34 ++++
src/core/na-importer-ask.c | 6 +-
src/core/na-importer.c | 4 +-
src/core/na-io-provider.c | 19 +--
src/core/na-iprefs.c | 64 ++-----
src/core/na-iprefs.h | 16 +-
src/core/na-pivot.c | 33 +----
src/core/na-pivot.h | 4 -
src/core/na-settings.c | 326 ++++++++++++++++++-----------------
src/core/na-settings.h | 60 ++-----
src/core/na-tokens.c | 39 +++--
src/core/na-tokens.h | 4 +-
src/core/na-updater.c | 16 +--
src/nact/base-gtk-utils.c | 49 +-----
src/nact/nact-assistant-export.c | 54 +-----
src/nact/nact-assistant-import.c | 43 +----
src/nact/nact-clipboard.c | 2 +-
src/nact/nact-export-ask.c | 24 +--
src/nact/nact-icon-chooser.c | 35 +----
src/nact/nact-ifolders-tab.c | 11 +-
src/nact/nact-main-toolbar.c | 15 +--
src/nact/nact-main-window.c | 10 +-
src/nact/nact-menubar-file.c | 17 +--
src/nact/nact-preferences-editor.c | 151 +++++++----------
src/nact/nact-providers-list.c | 23 +--
src/nact/nact-schemes-list.c | 18 +--
src/nact/nact-sort-buttons.c | 9 +-
src/nact/nact-tree-model-dnd.c | 2 +-
src/nact/nact-tree-model.c | 14 +--
src/plugin-menu/nautilus-actions.c | 47 ++----
src/utils/nautilus-actions-run.c | 19 +-
31 files changed, 424 insertions(+), 744 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 2829e02..0fb1563 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,39 @@
2011-02-25 Pierre Wieser <pwieser trychlos org>
+ NASettings is now a private singleton which allocates itself when needed.
+ Preference are so available anywhere without requiring an object.
+
+ * src/core/na-importer-ask.c (na_importer_ask_user):
+ * src/core/na-importer.c (import_from_uri):
+ * src/core/na-io-provider.c (na_io_provider_is_conf_readable):
+ * src/core/na-iprefs.c:
+ * src/core/na-iprefs.h:
+ * src/core/na-pivot.c (instance_constructed, instance_dispose):
+ * src/core/na-pivot.h (na_pivot_get_settings):
+ * src/core/na-settings.c:
+ * src/core/na-settings.h:
+ * src/core/na-tokens.c:
+ * src/core/na-tokens.h(na_tokens_execute_action):
+ * src/core/na-updater.c (are_preferences_locked):
+ * src/nact/base-gtk-utils.c:
+ * src/nact/nact-assistant-export.c (nact_assistant_export_run):
+ * src/nact/nact-assistant-import.c (nact_assistant_import_run):
+ * src/nact/nact-clipboard.c (export_row_object):
+ * src/nact/nact-export-ask.c (nact_export_ask_user):
+ * src/nact/nact-icon-chooser.c:
+ * src/nact/nact-ifolders-tab.c (on_browse_folder_clicked):
+ * src/nact/nact-main-toolbar.c (nact_main_toolbar_init):
+ * src/nact/nact-main-window.c (on_base_initialize_base_window):
+ * src/nact/nact-menubar-file.c (nact_menubar_file_save_items):
+ * src/nact/nact-preferences-editor.c:
+ * src/nact/nact-providers-list.c (nact_providers_list_save):
+ * src/nact/nact-schemes-list.c (init_view_get_default_list):
+ * src/nact/nact-sort-buttons.c (on_base_initialize_buttons):
+ * src/nact/nact-tree-model-dnd.c (drop_uri_list):
+ * src/nact/nact-tree-model.c (nact_tree_model_new):
+ * src/plugin-menu/nautilus-actions.c:
+ * src/utils/nautilus-actions-run.c: Updated accordingly.
+
Current desktop environment can be a user preference
* src/core/na-desktop-environment.c:
diff --git a/src/core/na-importer-ask.c b/src/core/na-importer-ask.c
index e62d067..eb4aad9 100644
--- a/src/core/na-importer-ask.c
+++ b/src/core/na-importer-ask.c
@@ -251,7 +251,7 @@ na_importer_ask_user( const NAObjectItem *importing, const NAObjectItem *existin
dialog->private->importing = ( NAObjectItem * ) importing;
dialog->private->existing = ( NAObjectItem * ) existing;
dialog->private->parms = parms;
- dialog->private->mode = na_iprefs_get_import_mode( parms->pivot, NA_IPREFS_IMPORT_ASK_USER_LAST_MODE, NULL );
+ dialog->private->mode = na_iprefs_get_import_mode( NA_IPREFS_IMPORT_ASK_USER_LAST_MODE, NULL );
init_dialog( dialog );
/* toplevel is modal, not dialog
@@ -387,11 +387,11 @@ get_selected_mode( NAImporterAsk *editor )
}
editor->private->mode = import_mode;
- na_iprefs_set_import_mode( editor->private->parms->pivot, NA_IPREFS_IMPORT_ASK_USER_LAST_MODE, editor->private->mode );
+ na_iprefs_set_import_mode( NA_IPREFS_IMPORT_ASK_USER_LAST_MODE, editor->private->mode );
button = na_gtk_utils_search_for_child_widget( GTK_CONTAINER( editor->private->toplevel ), "AskKeepChoiceButton" );
keep = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( button ));
- na_settings_set_boolean( na_pivot_get_settings( editor->private->parms->pivot ), NA_IPREFS_IMPORT_ASK_USER_KEEP_LAST_CHOICE, keep );
+ na_settings_set_boolean( NA_IPREFS_IMPORT_ASK_USER_KEEP_LAST_CHOICE, keep );
}
/*
diff --git a/src/core/na-importer.c b/src/core/na-importer.c
index fa57403..d700671 100644
--- a/src/core/na-importer.c
+++ b/src/core/na-importer.c
@@ -151,7 +151,7 @@ import_from_uri( const NAPivot *pivot, GList *modules, NAImporterParms *parms, c
ask_parms.parent = parms->parent;
ask_parms.uri = ( gchar * ) uri;
ask_parms.count = g_list_length( parms->results );
- ask_parms.keep_choice = na_settings_get_boolean( na_pivot_get_settings( pivot ), NA_IPREFS_IMPORT_ASK_USER_KEEP_LAST_CHOICE, NULL, NULL );
+ ask_parms.keep_choice = na_settings_get_boolean( NA_IPREFS_IMPORT_ASK_USER_KEEP_LAST_CHOICE, NULL, NULL );
ask_parms.pivot = pivot;
memset( &provider_parms, '\0', sizeof( NAIImporterImportFromUriParms ));
@@ -229,7 +229,7 @@ ask_user_for_mode( const NAObjectItem *importing, const NAObjectItem *existing,
mode = na_importer_ask_user( importing, existing, parms );
} else {
- mode = na_iprefs_get_import_mode( parms->pivot, NA_IPREFS_IMPORT_ASK_USER_LAST_MODE, NULL );
+ mode = na_iprefs_get_import_mode( NA_IPREFS_IMPORT_ASK_USER_LAST_MODE, NULL );
}
return( mode );
diff --git a/src/core/na-io-provider.c b/src/core/na-io-provider.c
index fcbb37b..51cc1b3 100644
--- a/src/core/na-io-provider.c
+++ b/src/core/na-io-provider.c
@@ -533,8 +533,7 @@ na_io_provider_is_conf_readable( const NAIOProvider *provider, const NAPivot *pi
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(
- na_pivot_get_settings( pivot ), group, NA_IPREFS_IO_PROVIDER_READABLE, NULL, mandatory );
+ readable = na_settings_get_boolean_ex( group, NA_IPREFS_IO_PROVIDER_READABLE, NULL, mandatory );
g_free( group );
}
@@ -643,8 +642,7 @@ na_io_provider_load_items( const NAPivot *pivot, guint loadable_set, GSList **me
/* build the items hierarchy
*/
- level_zero = na_settings_get_string_list(
- na_pivot_get_settings( pivot ), NA_IPREFS_ITEMS_LEVEL_ZERO_ORDER, NULL, NULL );
+ level_zero = na_settings_get_string_list( NA_IPREFS_ITEMS_LEVEL_ZERO_ORDER, NULL, NULL );
hierarchy = load_items_hierarchy_build( &flat, level_zero, TRUE, NULL );
@@ -658,7 +656,7 @@ na_io_provider_load_items( const NAPivot *pivot, guint loadable_set, GSList **me
if( flat || !level_zero || !g_slist_length( level_zero )){
g_debug( "%s: rewriting level-zero", thisfn );
- if( !na_iprefs_write_level_zero( pivot, hierarchy, messages )){
+ if( !na_iprefs_write_level_zero( hierarchy, messages )){
g_warning( "%s: unable to update level-zero", thisfn );
}
}
@@ -667,7 +665,7 @@ na_io_provider_load_items( const NAPivot *pivot, guint loadable_set, GSList **me
/* sort the hierarchy according to preferences
*/
- order_mode = na_iprefs_get_order_mode( pivot, NULL );
+ order_mode = na_iprefs_get_order_mode( NULL );
switch( order_mode ){
case IPREFS_ORDER_ALPHA_ASCENDING:
hierarchy = load_items_hierarchy_sort( pivot, hierarchy, ( GCompareFunc ) na_object_id_sort_alpha_asc );
@@ -799,7 +797,7 @@ io_providers_list_add_from_prefs( const NAPivot *pivot, GList *objects_list )
GSList *io_providers, *it;
merged = objects_list;
- io_providers = na_iprefs_get_io_providers( pivot );
+ io_providers = na_iprefs_get_io_providers();
for( it = io_providers ; it ; it = it->next ){
id = ( const gchar * ) it->data;
@@ -819,13 +817,11 @@ static GList *
io_providers_list_add_from_write_order( const NAPivot *pivot, GList *objects_list )
{
GList *merged;
- NASettings *settings;
GSList *io_providers, *it;
const gchar *id;
merged = objects_list;
- settings = na_pivot_get_settings( pivot );
- io_providers = na_settings_get_string_list( settings, NA_IPREFS_IO_PROVIDERS_WRITE_ORDER, NULL, NULL );
+ io_providers = na_settings_get_string_list( NA_IPREFS_IO_PROVIDERS_WRITE_ORDER, NULL, NULL );
for( it = io_providers ; it ; it = it->next ){
id = ( const gchar * ) it->data;
@@ -886,8 +882,7 @@ is_conf_writable( const NAIOProvider *provider, const NAPivot *pivot, gboolean *
gboolean is_writable;
group = g_strdup_printf( "%s %s", NA_IPREFS_IO_PROVIDER_GROUP, provider->private->id );
- is_writable = na_settings_get_boolean_ex(
- na_pivot_get_settings( pivot ), group, NA_IPREFS_IO_PROVIDER_WRITABLE, NULL, mandatory );
+ is_writable = na_settings_get_boolean_ex( group, NA_IPREFS_IO_PROVIDER_WRITABLE, NULL, mandatory );
g_free( group );
return( is_writable );
diff --git a/src/core/na-iprefs.c b/src/core/na-iprefs.c
index e2e9960..97c0614 100644
--- a/src/core/na-iprefs.c
+++ b/src/core/na-iprefs.c
@@ -81,7 +81,6 @@ static guint enum_map_id_from_string( const EnumMap *map, const gchar *st
/*
* na_iprefs_get_import_mode:
- * @pivot: the #NAPivot application object.
* @pref: name of the import key to be read.
* @mandatory: if not %NULL, a pointer to a boolean which will receive the
* mandatory property.
@@ -93,14 +92,12 @@ static guint enum_map_id_from_string( const EnumMap *map, const gchar *st
* Returns: the import mode currently set.
*/
guint
-na_iprefs_get_import_mode( const NAPivot *pivot, const gchar *pref, gboolean *mandatory )
+na_iprefs_get_import_mode( const gchar *pref, gboolean *mandatory )
{
gchar *import_mode_str;
guint import_mode;
- NASettings *settings;
- settings = na_pivot_get_settings( pivot );
- import_mode_str = na_settings_get_string( settings, pref, NULL, mandatory );
+ import_mode_str = na_settings_get_string( pref, NULL, mandatory );
import_mode = enum_map_id_from_string( st_import_mode, import_mode_str );
g_free( import_mode_str );
@@ -109,40 +106,34 @@ na_iprefs_get_import_mode( const NAPivot *pivot, const gchar *pref, gboolean *ma
/*
* na_iprefs_set_import_mode:
- * @pivot: the #NAPivot application object.
* @pref: name of the import key to be written.
* @mode: the new value to be written.
*
* Writes the current status of 'import mode' to the preferences system.
*/
void
-na_iprefs_set_import_mode( const NAPivot *pivot, const gchar *pref, guint mode )
+na_iprefs_set_import_mode( const gchar *pref, guint mode )
{
const gchar *import_str;
- NASettings *settings;
- settings = na_pivot_get_settings( pivot );
import_str = enum_map_string_from_id( st_import_mode, mode );
- na_settings_set_string( settings, pref, import_str );
+ na_settings_set_string( pref, import_str );
}
/*
* na_iprefs_get_order_mode:
- * @pivot: the #NAPivot application object.
* @mandatory: if not %NULL, a pointer to a boolean which will receive the
* mandatory property.
*
* Returns: the order mode currently set.
*/
guint
-na_iprefs_get_order_mode( const NAPivot *pivot, gboolean *mandatory )
+na_iprefs_get_order_mode( gboolean *mandatory )
{
gchar *order_mode_str;
guint order_mode;
- NASettings *settings;
- settings = na_pivot_get_settings( pivot );
- order_mode_str = na_settings_get_string( settings, NA_IPREFS_ITEMS_LIST_ORDER_MODE, NULL, mandatory );
+ order_mode_str = na_settings_get_string( NA_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 );
@@ -171,26 +162,22 @@ na_iprefs_get_order_mode_by_label( const gchar *label )
/*
* na_iprefs_set_order_mode:
- * @pivot: the #NAPivot application object.
* @mode: the new value to be written.
*
* Writes the current status of 'alphabetical order' to the GConf
* preference system.
*/
void
-na_iprefs_set_order_mode( const NAPivot *pivot, guint mode )
+na_iprefs_set_order_mode( guint mode )
{
const gchar *order_str;
- NASettings *settings;
- settings = na_pivot_get_settings( pivot );
order_str = enum_map_string_from_id( st_order_mode, mode );
- na_settings_set_string( settings, NA_IPREFS_ITEMS_LIST_ORDER_MODE, order_str );
+ na_settings_set_string( NA_IPREFS_ITEMS_LIST_ORDER_MODE, order_str );
}
/**
* na_iprefs_get_export_format:
- * @pivot: the #NAPivot application object.
* @name: name of the export format key to be read
* @mandatory: if not %NULL, a pointer to a boolean which will receive the
* mandatory property.
@@ -201,16 +188,14 @@ na_iprefs_set_order_mode( const NAPivot *pivot, guint mode )
* Returns: the export format currently set as a #GQuark.
*/
GQuark
-na_iprefs_get_export_format( const NAPivot *pivot, const gchar *name, gboolean *mandatory )
+na_iprefs_get_export_format( const gchar *name, gboolean *mandatory )
{
GQuark export_format;
- NASettings *settings;
gchar *format_str;
export_format = g_quark_from_static_string( NA_IPREFS_DEFAULT_EXPORT_FORMAT );
- settings = na_pivot_get_settings( pivot );
- format_str = na_settings_get_string( settings, name, NULL, mandatory );
+ format_str = na_settings_get_string( name, NULL, mandatory );
if( format_str ){
export_format = g_quark_from_string( format_str );
@@ -222,18 +207,14 @@ na_iprefs_get_export_format( const NAPivot *pivot, const gchar *name, gboolean *
/**
* na_iprefs_set_export_format:
- * @pivot: the #NAPivot application object.
* @format: the new value to be written.
*
* Writes the preferred export format' to the preference system.
*/
void
-na_iprefs_set_export_format( const NAPivot *pivot, const gchar *name, GQuark format )
+na_iprefs_set_export_format( const gchar *name, GQuark format )
{
- NASettings *settings;
-
- settings = na_pivot_get_settings( pivot );
- na_settings_set_string( settings, name, g_quark_to_string( format ));
+ na_settings_set_string( name, g_quark_to_string( format ));
}
/*
@@ -253,10 +234,9 @@ na_iprefs_set_export_format( const NAPivot *pivot, const gchar *name, GQuark for
* since: 3.1.0
*/
GSList *
-na_iprefs_get_io_providers( const NAPivot *pivot )
+na_iprefs_get_io_providers( void )
{
GSList *providers;
- NASettings *settings;
GSList *write_order, *groups;
GSList *it;
const gchar *name;
@@ -264,16 +244,15 @@ na_iprefs_get_io_providers( const NAPivot *pivot )
guint prefix_len;
providers = NULL;
- settings = na_pivot_get_settings( pivot );
- write_order = na_settings_get_string_list( settings, NA_IPREFS_IO_PROVIDERS_WRITE_ORDER, NULL, NULL );
+ write_order = na_settings_get_string_list( NA_IPREFS_IO_PROVIDERS_WRITE_ORDER, NULL, NULL );
for( it = write_order ; it ; it = it->next ){
name = ( const gchar * ) it->data;
providers = g_slist_prepend( providers, g_strdup( name ));
}
na_core_utils_slist_free( write_order );
- groups = na_settings_get_groups( settings );
+ groups = na_settings_get_groups();
group_prefix = g_strdup_printf( "%s ", NA_IPREFS_IO_PROVIDER_GROUP );
prefix_len = strlen( group_prefix );
@@ -291,7 +270,6 @@ na_iprefs_get_io_providers( const NAPivot *pivot )
/*
* na_iprefs_write_level_zero:
- * @pivot: the #NAPivot application object.
* @items: the #GList of items whose first level is to be written.
* @messages: a pointer to a #GSList in which we will add happening
* error messages;
@@ -310,29 +288,23 @@ na_iprefs_get_io_providers( const NAPivot *pivot )
* state that it has been provided.
*/
gboolean
-na_iprefs_write_level_zero( const NAPivot *pivot, const GList *items, GSList **messages )
+na_iprefs_write_level_zero( const GList *items, GSList **messages )
{
- static const gchar *thisfn = "na_iprefs_write_level_zero";
gboolean written;
const GList *it;
gchar *id;
GSList *content;
- g_return_val_if_fail( NA_IS_PIVOT( pivot ), FALSE );
-
written = FALSE;
-
- g_debug( "%s: pivot=%p", thisfn, ( void * ) pivot);
-
content = NULL;
+
for( it = items ; it ; it = it->next ){
id = na_object_get_id( it->data );
content = g_slist_prepend( content, id );
}
content = g_slist_reverse( content );
- written = na_settings_set_string_list(
- na_pivot_get_settings( pivot ), NA_IPREFS_ITEMS_LEVEL_ZERO_ORDER, content );
+ written = na_settings_set_string_list( NA_IPREFS_ITEMS_LEVEL_ZERO_ORDER, content );
na_core_utils_slist_free( content );
diff --git a/src/core/na-iprefs.h b/src/core/na-iprefs.h
index 0490e17..1f007c2 100644
--- a/src/core/na-iprefs.h
+++ b/src/core/na-iprefs.h
@@ -52,19 +52,19 @@ enum {
IPREFS_ORDER_MANUAL
};
-guint na_iprefs_get_import_mode ( const NAPivot *pivot, const gchar *pref, gboolean *mandatory );
-void na_iprefs_set_import_mode ( const NAPivot *pivot, const gchar *pref, guint mode );
+guint na_iprefs_get_import_mode ( const gchar *pref, gboolean *mandatory );
+void na_iprefs_set_import_mode ( const gchar *pref, guint mode );
-guint na_iprefs_get_order_mode ( const NAPivot *pivot, gboolean *mandatory );
+guint na_iprefs_get_order_mode ( gboolean *mandatory );
guint na_iprefs_get_order_mode_by_label( const gchar *label );
-void na_iprefs_set_order_mode ( const NAPivot *pivot, guint mode );
+void na_iprefs_set_order_mode ( guint mode );
-GQuark na_iprefs_get_export_format ( const NAPivot *pivot, const gchar *pref, gboolean *mandatory );
-void na_iprefs_set_export_format ( const NAPivot *pivot, const gchar *pref, GQuark format );
+GQuark na_iprefs_get_export_format ( const gchar *pref, gboolean *mandatory );
+void na_iprefs_set_export_format ( const gchar *pref, GQuark format );
-GSList *na_iprefs_get_io_providers ( const NAPivot * );
+GSList *na_iprefs_get_io_providers ( void );
-gboolean na_iprefs_write_level_zero ( const NAPivot *pivot, const GList *items, GSList **messages );
+gboolean na_iprefs_write_level_zero ( const GList *items, GSList **messages );
G_END_DECLS
diff --git a/src/core/na-pivot.c b/src/core/na-pivot.c
index 49d9690..e2bc2b5 100644
--- a/src/core/na-pivot.c
+++ b/src/core/na-pivot.c
@@ -66,10 +66,6 @@ struct _NAPivotPrivate {
/* timeout to manage i/o providers 'item-changed' burst
*/
NATimeout change_timeout;
-
- /* the preferences management
- */
- NASettings *settings;
};
/* NAPivot properties
@@ -242,7 +238,6 @@ instance_constructed( GObject *object )
g_debug( "%s: object=%p", thisfn, ( void * ) object );
self->private->modules = na_module_load_modules();
- self->private->settings = na_settings_new();
/* force class initialization and io-factory registration
*/
@@ -335,7 +330,7 @@ instance_dispose( GObject *object )
self->private->tree = na_object_free_items( self->private->tree );
/* release the settings */
- g_object_unref( self->private->settings );
+ na_settings_free();
/* release the I/O Provider object list */
na_io_provider_unref_io_providers_list();
@@ -659,32 +654,6 @@ on_items_changed_timeout( NAPivot *pivot )
}
/*
- * na_pivot_get_settings:
- * @pivot: this #NAPivot instance.
- *
- * Returns: a pointer (not a reference) to the common #NASettings object.
- * This pointer is owned by @pivot, and should not be released by the caller.
- *
- * Since: 3.1.0
- */
-NASettings *
-na_pivot_get_settings( const NAPivot *pivot )
-{
- NASettings *settings;
-
- g_return_val_if_fail( NA_IS_PIVOT( pivot ), NULL );
-
- settings = NULL;
-
- if( !pivot->private->dispose_has_run ){
-
- settings = pivot->private->settings;
- }
-
- return( settings );
-}
-
-/*
* na_pivot_set_loadable:
* @pivot: this #NAPivot instance.
* @loadable: the population of items to be loaded.
diff --git a/src/core/na-pivot.h b/src/core/na-pivot.h
index 336e6d4..53e04ad 100644
--- a/src/core/na-pivot.h
+++ b/src/core/na-pivot.h
@@ -153,10 +153,6 @@ void na_pivot_set_new_items( NAPivot *pivot, GList *tree );
void na_pivot_on_item_changed_handler( NAIIOProvider *provider, NAPivot *pivot );
-/* Monitoring and preferences management
- */
-NASettings *na_pivot_get_settings ( const NAPivot *pivot );
-
/* NAPivot properties and configuration
*/
void na_pivot_set_loadable ( NAPivot *pivot, guint loadable );
diff --git a/src/core/na-settings.c b/src/core/na-settings.c
index 0be96a8..6ed2767 100644
--- a/src/core/na-settings.c
+++ b/src/core/na-settings.c
@@ -45,6 +45,31 @@
#include "na-settings.h"
#include "na-marshal.h"
+#define NA_SETTINGS_TYPE ( settings_get_type())
+#define NA_SETTINGS( object ) ( G_TYPE_CHECK_INSTANCE_CAST( object, NA_SETTINGS_TYPE, NASettings ))
+#define NA_SETTINGS_CLASS( klass ) ( G_TYPE_CHECK_CLASS_CAST( klass, NA_SETTINGS_TYPE, NASettingsClass ))
+#define NA_IS_SETTINGS( object ) ( G_TYPE_CHECK_INSTANCE_TYPE( object, NA_SETTINGS_TYPE ))
+#define NA_IS_SETTINGS_CLASS( klass ) ( G_TYPE_CHECK_CLASS_TYPE(( klass ), NA_SETTINGS_TYPE ))
+#define NA_SETTINGS_GET_CLASS( object ) ( G_TYPE_INSTANCE_GET_CLASS(( object ), NA_SETTINGS_TYPE, NASettingsClass ))
+
+typedef struct _NASettingsPrivate NASettingsPrivate;
+
+typedef struct {
+ /*< private >*/
+ GObject parent;
+ NASettingsPrivate *private;
+}
+ NASettings;
+
+typedef struct _NASettingsClassPrivate NASettingsClassPrivate;
+
+typedef struct {
+ /*< private >*/
+ GObjectClass parent;
+ NASettingsClassPrivate *private;
+}
+ NASettingsClass;
+
/* private class data
*/
struct _NASettingsClassPrivate {
@@ -186,32 +211,36 @@ enum {
static GObjectClass *st_parent_class = NULL;
static gint st_burst_timeout = 100; /* burst timeout in msec */
static gint st_signals[ LAST_SIGNAL ] = { 0 };
+static NASettings *st_settings = NULL;
+static GType settings_get_type( void );
static GType register_type( void );
static void class_init( NASettingsClass *klass );
static void instance_init( GTypeInstance *instance, gpointer klass );
static void instance_dispose( GObject *object );
static void instance_finalize( GObject *object );
+static void settings_new( void );
+
static GList *content_diff( GList *old, GList *new );
-static GList *content_load( NASettings *settings );
-static GList *content_load_keys( NASettings *settings, GList *content, KeyFile *key_file, gboolean mandatory );
+static GList *content_load( void );
+static GList *content_load_keys( GList *content, KeyFile *key_file, gboolean mandatory );
static KeyDef *get_key_def( const gchar *key );
-static KeyFile *key_file_new( NASettings *settings, const gchar *dir );
-static void on_keyfile_changed( GFileMonitor *monitor, GFile *file, GFile *other_file, GFileMonitorEvent event_type, NASettings *settings );
-static void on_keyfile_changed_timeout( NASettings *settings );
+static KeyFile *key_file_new( const gchar *dir );
+static void on_keyfile_changed( GFileMonitor *monitor, GFile *file, GFile *other_file, GFileMonitorEvent event_type );
+static void on_keyfile_changed_timeout( void );
static void on_key_changed_final_handler( NASettings *settings, gchar *group, gchar *key, NABoxed *new_value, gboolean mandatory );
static KeyValue *peek_key_value_from_content( GList *content, const gchar *group, const gchar *key );
-static KeyValue *read_key_value( NASettings *settings, const gchar *group, const gchar *key, gboolean *found, gboolean *mandatory );
+static KeyValue *read_key_value( const gchar *group, const gchar *key, gboolean *found, gboolean *mandatory );
static KeyValue *read_key_value_from_key_file( GKeyFile *key_file, const gchar *group, const gchar *key, const KeyDef *key_def );
static void release_consumer( Consumer *consumer );
static void release_key_file( KeyFile *key_file );
static void release_key_value( KeyValue *value );
-static gboolean set_key_value( NASettings *settings, const gchar *group, const gchar *key, const gchar *string );
-static gboolean write_user_key_file( NASettings *settings );
+static gboolean set_key_value( const gchar *group, const gchar *key, const gchar *string );
+static gboolean write_user_key_file( void );
-GType
-na_settings_get_type( void )
+static GType
+settings_get_type( void )
{
static GType object_type = 0;
@@ -317,7 +346,7 @@ instance_init( GTypeInstance *instance, gpointer klass )
self->private->timeout.timeout = st_burst_timeout;
self->private->timeout.handler = ( NATimeoutFunc ) on_keyfile_changed_timeout;
- self->private->timeout.user_data = self;
+ self->private->timeout.user_data = NULL;
self->private->timeout.source_id = 0;
}
@@ -378,33 +407,43 @@ instance_finalize( GObject *object )
* Returns: a new #NASettings object which should be g_object_unref()
* by the caller.
*/
-NASettings *
-na_settings_new( void )
+static void
+settings_new( void )
{
static const gchar *thisfn = "na_settings_new";
- NASettings *settings;
gchar *dir;
- settings = g_object_new( NA_SETTINGS_TYPE, NULL );
+ if( !st_settings ){
+ st_settings = g_object_new( NA_SETTINGS_TYPE, NULL );
- dir = g_build_filename( SYSCONFDIR, "xdg", PACKAGE, NULL );
- g_debug( "%s: reading mandatory configuration", thisfn );
- settings->private->mandatory = key_file_new( settings, dir );
- g_free( dir );
+ dir = g_build_filename( SYSCONFDIR, "xdg", PACKAGE, NULL );
+ g_debug( "%s: reading mandatory configuration", thisfn );
+ st_settings->private->mandatory = key_file_new( dir );
+ g_free( dir );
- dir = g_build_filename( g_get_home_dir(), ".config", PACKAGE, NULL );
- g_debug( "%s: reading user configuration", thisfn );
- settings->private->user = key_file_new( settings, dir );
- g_free( dir );
+ dir = g_build_filename( g_get_home_dir(), ".config", PACKAGE, NULL );
+ g_debug( "%s: reading user configuration", thisfn );
+ st_settings->private->user = key_file_new( dir );
+ g_free( dir );
- settings->private->content = content_load( settings );
+ st_settings->private->content = content_load();
+ }
+}
- return( settings );
+/**
+ * na_settings_free:
+ */
+void
+na_settings_free( void )
+{
+ if( st_settings ){
+ g_object_unref( st_settings );
+ st_settings = NULL;
+ }
}
/**
* na_settings_register_key_callback:
- * @settings: this #NASettings instance.
* @key: the key to be monitored.
* @callback: the function to be called when the value of the key changes.
* @user_data: data to be passed to the @callback function.
@@ -414,28 +453,24 @@ na_settings_new( void )
* Since: 3.1.0
*/
void
-na_settings_register_key_callback( NASettings *settings, const gchar *key, GCallback callback, gpointer user_data )
+na_settings_register_key_callback( const gchar *key, GCallback callback, gpointer user_data )
{
static const gchar *thisfn = "na_settings_register_key_callback";
- g_return_if_fail( NA_IS_SETTINGS( settings ));
-
- if( !settings->private->dispose_has_run ){
- g_debug( "%s: settings=%p, key=%s, callback=%p, user_data=%p",
- thisfn, ( void * ) settings, key, ( void * ) callback, ( void * ) user_data );
+ g_debug( "%s: key=%s, callback=%p, user_data=%p",
+ thisfn, key, ( void * ) callback, ( void * ) user_data );
- Consumer *consumer = g_new0( Consumer, 1 );
+ Consumer *consumer = g_new0( Consumer, 1 );
+ consumer->monitored_key = g_strdup( key );
+ consumer->callback = callback;
+ consumer->user_data = user_data;
- consumer->monitored_key = g_strdup( key );
- consumer->callback = callback;
- consumer->user_data = user_data;
- settings->private->consumers = g_list_prepend( settings->private->consumers, consumer );
- }
+ settings_new();
+ st_settings->private->consumers = g_list_prepend( st_settings->private->consumers, consumer );
}
/**
* na_settings_get_boolean:
- * @settings: this #NASettings instance.
* @key: the key whose value is to be returned.
* @found: if not %NULL, a pointer to a gboolean in which we will store
* whether the searched @key has been found (%TRUE), or if the returned
@@ -453,14 +488,13 @@ na_settings_register_key_callback( NASettings *settings, const gchar *key, GCall
* Since: 3.1.0
*/
gboolean
-na_settings_get_boolean( NASettings *settings, const gchar *key, gboolean *found, gboolean *mandatory )
+na_settings_get_boolean( const gchar *key, gboolean *found, gboolean *mandatory )
{
- return( na_settings_get_boolean_ex( settings, NULL, key, found, mandatory ));
+ return( na_settings_get_boolean_ex( NULL, key, found, mandatory ));
}
/**
* na_settings_get_boolean_ex:
- * @settings: this #NASettings instance.
* @group: the group where the @key is to be searched for. May be %NULL.
* @key: the key whose value is to be returned.
* @found: if not %NULL, a pointer to a gboolean in which we will store
@@ -476,14 +510,14 @@ na_settings_get_boolean( NASettings *settings, const gchar *key, gboolean *found
* Since: 3.1.0
*/
gboolean
-na_settings_get_boolean_ex( NASettings *settings, const gchar *group, const gchar *key, gboolean *found, gboolean *mandatory )
+na_settings_get_boolean_ex( const gchar *group, const gchar *key, gboolean *found, gboolean *mandatory )
{
gboolean value;
KeyValue *key_value;
KeyDef *key_def;
value = FALSE;
- key_value = read_key_value( settings, group, key, found, mandatory );
+ key_value = read_key_value( group, key, found, mandatory );
if( key_value ){
value = na_boxed_get_boolean( key_value->boxed );
@@ -501,7 +535,6 @@ na_settings_get_boolean_ex( NASettings *settings, const gchar *group, const gcha
/**
* na_settings_get_string:
- * @settings: this #NASettings instance.
* @key: the key whose value is to be returned.
* @found: if not %NULL, a pointer to a gboolean in which we will store
* whether the searched @key has been found (%TRUE), or if the returned
@@ -520,14 +553,14 @@ na_settings_get_boolean_ex( NASettings *settings, const gchar *group, const gcha
* Since: 3.1.0
*/
gchar *
-na_settings_get_string( NASettings *settings, const gchar *key, gboolean *found, gboolean *mandatory )
+na_settings_get_string( const gchar *key, gboolean *found, gboolean *mandatory )
{
gchar *value;
KeyValue *key_value;
KeyDef *key_def;
value = NULL;
- key_value = read_key_value( settings, NULL, key, found, mandatory );
+ key_value = read_key_value( NULL, key, found, mandatory );
if( key_value ){
value = na_boxed_get_string( key_value->boxed );
@@ -545,7 +578,6 @@ na_settings_get_string( NASettings *settings, const gchar *key, gboolean *found,
/**
* na_settings_get_string_list:
- * @settings: this #NASettings instance.
* @key: the key whose value is to be returned.
* @found: if not %NULL, a pointer to a gboolean in which we will store
* whether the searched @key has been found (%TRUE), or if the returned
@@ -564,14 +596,14 @@ na_settings_get_string( NASettings *settings, const gchar *key, gboolean *found,
* Since: 3.1.0
*/
GSList *
-na_settings_get_string_list( NASettings *settings, const gchar *key, gboolean *found, gboolean *mandatory )
+na_settings_get_string_list( const gchar *key, gboolean *found, gboolean *mandatory )
{
GSList *value;
KeyValue *key_value;
KeyDef *key_def;
value = NULL;
- key_value = read_key_value( settings, NULL, key, found, mandatory );
+ key_value = read_key_value( NULL, key, found, mandatory );
if( key_value ){
value = na_boxed_get_string_list( key_value->boxed );
@@ -589,7 +621,6 @@ na_settings_get_string_list( NASettings *settings, const gchar *key, gboolean *f
/**
* na_settings_get_uint:
- * @settings: this #NASettings instance.
* @key: the key whose value is to be returned.
* @found: if not %NULL, a pointer to a gboolean in which we will store
* whether the searched @key has been found (%TRUE), or if the returned
@@ -607,14 +638,14 @@ na_settings_get_string_list( NASettings *settings, const gchar *key, gboolean *f
* Since: 3.1.0
*/
guint
-na_settings_get_uint( NASettings *settings, const gchar *key, gboolean *found, gboolean *mandatory )
+na_settings_get_uint( const gchar *key, gboolean *found, gboolean *mandatory )
{
guint value;
KeyDef *key_def;
KeyValue *key_value;
value = 0;
- key_value = read_key_value( settings, NULL, key, found, mandatory );
+ key_value = read_key_value( NULL, key, found, mandatory );
if( key_value ){
value = na_boxed_get_uint( key_value->boxed );
@@ -632,7 +663,6 @@ na_settings_get_uint( NASettings *settings, const gchar *key, gboolean *found, g
/**
* na_settings_get_uint_list:
- * @settings: this #NASettings instance.
* @key: the key whose value is to be returned.
* @found: if not %NULL, a pointer to a gboolean in which we will store
* whether the searched @key has been found (%TRUE), or if the returned
@@ -651,14 +681,14 @@ na_settings_get_uint( NASettings *settings, const gchar *key, gboolean *found, g
* Since: 3.1.0
*/
GList *
-na_settings_get_uint_list( NASettings *settings, const gchar *key, gboolean *found, gboolean *mandatory )
+na_settings_get_uint_list( const gchar *key, gboolean *found, gboolean *mandatory )
{
GList *value;
KeyDef *key_def;
KeyValue *key_value;
value = NULL;
- key_value = read_key_value( settings, NULL, key, found, mandatory );
+ key_value = read_key_value( NULL, key, found, mandatory );
if( key_value ){
value = na_boxed_get_uint_list( key_value->boxed );
@@ -676,7 +706,6 @@ na_settings_get_uint_list( NASettings *settings, const gchar *key, gboolean *fou
/**
* na_settings_set_boolean:
- * @settings: this #NASettings instance.
* @key: the key whose value is to be returned.
* @value: the boolean to be written.
*
@@ -690,13 +719,13 @@ na_settings_get_uint_list( NASettings *settings, const gchar *key, gboolean *fou
* Since: 3.1.0
*/
gboolean
-na_settings_set_boolean( NASettings *settings, const gchar *key, gboolean value )
+na_settings_set_boolean( const gchar *key, gboolean value )
{
gchar *string;
gboolean ok;
string = g_strdup_printf( "%s", value ? "true" : "false" );
- ok = set_key_value( settings, NULL, key, string );
+ ok = set_key_value( NULL, key, string );
g_free( string );
return( ok );
@@ -704,7 +733,6 @@ na_settings_set_boolean( NASettings *settings, const gchar *key, gboolean value
/**
* na_settings_set_boolean_ex:
- * @settings: this #NASettings instance.
* @group: the group in the keyed file;
* @key: the key whose value is to be returned.
* @value: the boolean to be written.
@@ -716,13 +744,13 @@ na_settings_set_boolean( NASettings *settings, const gchar *key, gboolean value
* Since: 3.1.0
*/
gboolean
-na_settings_set_boolean_ex( NASettings *settings, const gchar *group, const gchar *key, gboolean value )
+na_settings_set_boolean_ex( const gchar *group, const gchar *key, gboolean value )
{
gchar *string;
gboolean ok;
string = g_strdup_printf( "%s", value ? "true" : "false" );
- ok = set_key_value( settings, group, key, string );
+ ok = set_key_value( group, key, string );
g_free( string );
return( ok );
@@ -730,7 +758,6 @@ na_settings_set_boolean_ex( NASettings *settings, const gchar *group, const gcha
/**
* na_settings_set_string:
- * @settings: this #NASettings instance.
* @key: the key whose value is to be returned.
* @value: the string to be written.
*
@@ -744,14 +771,13 @@ na_settings_set_boolean_ex( NASettings *settings, const gchar *group, const gcha
* Since: 3.1.0
*/
gboolean
-na_settings_set_string( NASettings *settings, const gchar *key, const gchar *value )
+na_settings_set_string( const gchar *key, const gchar *value )
{
- return( set_key_value( settings, NULL, key, value ));
+ return( set_key_value( NULL, key, value ));
}
/**
* na_settings_set_string_list:
- * @settings: this #NASettings instance.
* @key: the key whose value is to be returned.
* @value: the list of strings to be written.
*
@@ -765,7 +791,7 @@ na_settings_set_string( NASettings *settings, const gchar *key, const gchar *val
* Since: 3.1.0
*/
gboolean
-na_settings_set_string_list( NASettings *settings, const gchar *key, const GSList *value )
+na_settings_set_string_list( const gchar *key, const GSList *value )
{
GString *string;
const GSList *it;
@@ -775,7 +801,7 @@ na_settings_set_string_list( NASettings *settings, const gchar *key, const GSLis
for( it = value ; it ; it = it->next ){
g_string_append_printf( string, "%s;", ( const gchar * ) it->data );
}
- ok = set_key_value( settings, NULL, key, string->str );
+ ok = set_key_value( NULL, key, string->str );
g_string_free( string, TRUE );
return( ok );
@@ -783,7 +809,6 @@ na_settings_set_string_list( NASettings *settings, const gchar *key, const GSLis
/**
* na_settings_set_uint:
- * @settings: this #NASettings instance.
* @key: the key whose value is to be returned.
* @value: the unsigned integer to be written.
*
@@ -797,13 +822,13 @@ na_settings_set_string_list( NASettings *settings, const gchar *key, const GSLis
* Since: 3.1.0
*/
gboolean
-na_settings_set_uint( NASettings *settings, const gchar *key, guint value )
+na_settings_set_uint( const gchar *key, guint value )
{
gchar *string;
gboolean ok;
string = g_strdup_printf( "%u", value );
- ok = set_key_value( settings, NULL, key, string );
+ ok = set_key_value( NULL, key, string );
g_free( string );
return( ok );
@@ -811,7 +836,6 @@ na_settings_set_uint( NASettings *settings, const gchar *key, guint value )
/**
* na_settings_set_uint_list:
- * @settings: this #NASettings instance.
* @key: the key whose value is to be returned.
* @value: the list of unsigned integers to be written.
*
@@ -825,7 +849,7 @@ na_settings_set_uint( NASettings *settings, const gchar *key, guint value )
* Since: 3.1.0
*/
gboolean
-na_settings_set_uint_list( NASettings *settings, const gchar *key, const GList *value )
+na_settings_set_uint_list( const gchar *key, const GList *value )
{
GString *string;
const GList *it;
@@ -835,7 +859,7 @@ na_settings_set_uint_list( NASettings *settings, const gchar *key, const GList *
for( it = value ; it ; it = it->next ){
g_string_append_printf( string, "%u;", GPOINTER_TO_UINT( it->data ));
}
- ok = set_key_value( settings, NULL, key, string->str );
+ ok = set_key_value( NULL, key, string->str );
g_string_free( string, TRUE );
return( ok );
@@ -843,7 +867,6 @@ na_settings_set_uint_list( NASettings *settings, const gchar *key, const GList *
/**
* na_settings_get_groups:
- * @settings: this #NASettings instance.
*
* Returns: the list of groups in the configuration; this list should be
* na_core_utils_slist_free() by the caller.
@@ -855,28 +878,24 @@ na_settings_set_uint_list( NASettings *settings, const gchar *key, const GList *
* Since: 3.1.0
*/
GSList *
-na_settings_get_groups( NASettings *settings )
+na_settings_get_groups( void )
{
GSList *groups;
gchar **array;
groups = NULL;
+ settings_new();
- g_return_val_if_fail( NA_IS_SETTINGS( settings ), NULL );
-
- if( !settings->private->dispose_has_run ){
-
- array = g_key_file_get_groups( settings->private->mandatory->key_file, NULL );
- if( array ){
- groups = na_core_utils_slist_from_array(( const gchar ** ) array );
- g_strfreev( array );
- }
+ array = g_key_file_get_groups( st_settings->private->mandatory->key_file, NULL );
+ if( array ){
+ groups = na_core_utils_slist_from_array(( const gchar ** ) array );
+ g_strfreev( array );
+ }
- array = g_key_file_get_groups( settings->private->user->key_file, NULL );
- if( array ){
- groups = g_slist_concat( groups, na_core_utils_slist_from_array(( const gchar ** ) array ));
- g_strfreev( array );
- }
+ array = g_key_file_get_groups( st_settings->private->user->key_file, NULL );
+ if( array ){
+ groups = g_slist_concat( groups, na_core_utils_slist_from_array(( const gchar ** ) array ));
+ g_strfreev( array );
}
return( groups );
@@ -959,18 +978,19 @@ content_diff( GList *old, GList *new )
* taking care of not overriding mandatory preferences with user ones
*/
static GList *
-content_load( NASettings *settings )
+content_load( void )
{
GList *content;
- content = content_load_keys( settings, NULL, settings->private->mandatory, TRUE );
- content = content_load_keys( settings, content, settings->private->user, FALSE );
+ settings_new();
+ content = content_load_keys( NULL, st_settings->private->mandatory, TRUE );
+ content = content_load_keys( content, st_settings->private->user, FALSE );
return( content );
}
static GList *
-content_load_keys( NASettings *settings, GList *content, KeyFile *key_file, gboolean mandatory )
+content_load_keys( GList *content, KeyFile *key_file, gboolean mandatory )
{
static const gchar *thisfn = "na_settings_content_load_keys";
GError *error;
@@ -1042,7 +1062,7 @@ get_key_def( const gchar *key )
* allocate and load the key files for global and user preferences
*/
static KeyFile *
-key_file_new( NASettings *settings, const gchar *dir )
+key_file_new( const gchar *dir )
{
static const gchar *thisfn = "na_settings_key_file_new";
KeyFile *key_file;
@@ -1062,7 +1082,7 @@ key_file_new( NASettings *settings, const gchar *dir )
g_error_free( error );
error = NULL;
} else {
- key_file->handler = g_signal_connect( key_file->monitor, "changed", ( GCallback ) on_keyfile_changed, settings );
+ key_file->handler = g_signal_connect( key_file->monitor, "changed", ( GCallback ) on_keyfile_changed, NULL );
}
g_object_unref( file );
@@ -1079,18 +1099,14 @@ key_file_new( NASettings *settings, const gchar *dir )
*/
static void
on_keyfile_changed( GFileMonitor *monitor,
- GFile *file, GFile *other_file, GFileMonitorEvent event_type, NASettings *settings )
+ GFile *file, GFile *other_file, GFileMonitorEvent event_type )
{
- g_return_if_fail( NA_IS_SETTINGS( settings ));
-
- if( !settings->private->dispose_has_run ){
-
- na_timeout_event( &settings->private->timeout );
- }
+ settings_new();
+ na_timeout_event( &st_settings->private->timeout );
}
static void
-on_keyfile_changed_timeout( NASettings *settings )
+on_keyfile_changed_timeout( void )
{
static const gchar *thisfn = "na_settings_on_keyfile_changed_timeout";
GList *new_content;
@@ -1106,8 +1122,8 @@ on_keyfile_changed_timeout( NASettings *settings )
/* last individual notification is older that the st_burst_timeout
* we may so suppose that the burst is terminated
*/
- new_content = content_load( settings );
- modifs = content_diff( settings->private->content, new_content );
+ new_content = content_load();
+ modifs = content_diff( st_settings->private->content, new_content );
#ifdef NA_MAINTAINER_MODE
g_debug( "%s: %d found update(s)", thisfn, g_list_length( modifs ));
@@ -1126,7 +1142,7 @@ on_keyfile_changed_timeout( NASettings *settings )
for( im = modifs ; im ; im = im->next ){
changed = ( const KeyValue * ) im->data;
- for( ic = settings->private->consumers ; ic ; ic = ic->next ){
+ for( ic = st_settings->private->consumers ; ic ; ic = ic->next ){
consumer = ( const Consumer * ) ic->data;
group_prefix = NULL;
@@ -1150,15 +1166,15 @@ on_keyfile_changed_timeout( NASettings *settings )
}
g_debug( "%s: sending signal for group=%s, key=%s", thisfn, changed->group, changed->def->key );
- g_signal_emit_by_name( settings,
+ g_signal_emit_by_name( st_settings,
SETTINGS_SIGNAL_KEY_CHANGED,
changed->group, changed->def->key, changed->boxed, changed->mandatory );
}
g_debug( "%s: releasing content", thisfn );
- g_list_foreach( settings->private->content, ( GFunc ) release_key_value, NULL );
- g_list_free( settings->private->content );
- settings->private->content = new_content;
+ g_list_foreach( st_settings->private->content, ( GFunc ) release_key_value, NULL );
+ g_list_free( st_settings->private->content );
+ st_settings->private->content = new_content;
g_debug( "%s: releasing modifs", thisfn );
g_list_foreach( modifs, ( GFunc ) release_key_value, NULL );
@@ -1192,14 +1208,12 @@ peek_key_value_from_content( GList *content, const gchar *group, const gchar *ke
/* group may be NULL
*/
static KeyValue *
-read_key_value( NASettings *settings, const gchar *group, const gchar *key, gboolean *found, gboolean *mandatory )
+read_key_value( const gchar *group, const gchar *key, gboolean *found, gboolean *mandatory )
{
KeyDef *key_def;
gboolean has_entry;
KeyValue *key_value;
- g_return_val_if_fail( NA_IS_SETTINGS( settings ), NULL );
-
key_value = NULL;
if( found ){
*found = FALSE;
@@ -1208,29 +1222,28 @@ read_key_value( NASettings *settings, const gchar *group, const gchar *key, gboo
*mandatory = FALSE;
}
- if( !settings->private->dispose_has_run ){
+ settings_new();
+ key_def = get_key_def( key );
- key_def = get_key_def( key );
- if( key_def ){
- has_entry = FALSE;
- key_value = read_key_value_from_key_file( settings->private->mandatory->key_file, group ? group : key_def->group, key, key_def );
+ if( key_def ){
+ has_entry = FALSE;
+ key_value = read_key_value_from_key_file( st_settings->private->mandatory->key_file, group ? group : key_def->group, key, key_def );
+ if( key_value ){
+ has_entry = TRUE;
+ if( found ){
+ *found = TRUE;
+ }
+ if( mandatory ){
+ *mandatory = TRUE;
+ }
+ }
+ if( !has_entry ){
+ key_value = read_key_value_from_key_file( st_settings->private->user->key_file, group ? group : key_def->group, key, key_def );
if( key_value ){
has_entry = TRUE;
if( found ){
*found = TRUE;
}
- if( mandatory ){
- *mandatory = TRUE;
- }
- }
- if( !has_entry ){
- key_value = read_key_value_from_key_file( settings->private->user->key_file, group ? group : key_def->group, key, key_def );
- if( key_value ){
- has_entry = TRUE;
- if( found ){
- *found = TRUE;
- }
- }
}
}
}
@@ -1334,7 +1347,7 @@ release_key_value( KeyValue *value )
}
static gboolean
-set_key_value( NASettings *settings, const gchar *group, const gchar *key, const gchar *string )
+set_key_value( const gchar *group, const gchar *key, const gchar *string )
{
static const gchar *thisfn = "na_settings_set_key_value";
KeyDef *key_def;
@@ -1342,43 +1355,39 @@ set_key_value( NASettings *settings, const gchar *group, const gchar *key, const
gboolean ok;
GError *error;
- g_return_val_if_fail( NA_IS_SETTINGS( settings ), FALSE );
-
ok = FALSE;
+ settings_new();
- if( !settings->private->dispose_has_run ){
-
- wgroup = group;
- if( !wgroup ){
- key_def = get_key_def( key );
- if( key_def ){
- wgroup = key_def->group;
- }
+ wgroup = group;
+ if( !wgroup ){
+ key_def = get_key_def( key );
+ if( key_def ){
+ wgroup = key_def->group;
}
- if( wgroup ){
- ok = TRUE;
+ }
+ if( wgroup ){
+ ok = TRUE;
- if( string ){
- g_key_file_set_string( settings->private->user->key_file, wgroup, key, string );
+ if( string ){
+ g_key_file_set_string( st_settings->private->user->key_file, wgroup, key, string );
- } else {
- error = NULL;
- ok = g_key_file_remove_key( settings->private->user->key_file, wgroup, key, &error );
- if( error ){
- g_warning( "%s: g_key_file_remove_key: %s", thisfn, error->message );
- g_error_free( error );
- }
+ } else {
+ error = NULL;
+ ok = g_key_file_remove_key( st_settings->private->user->key_file, wgroup, key, &error );
+ if( error ){
+ g_warning( "%s: g_key_file_remove_key: %s", thisfn, error->message );
+ g_error_free( error );
}
-
- ok &= write_user_key_file( settings );
}
+
+ ok &= write_user_key_file();
}
return( ok );
}
static gboolean
-write_user_key_file( NASettings *settings )
+write_user_key_file( void )
{
static const gchar *thisfn = "na_settings_write_user_key_file";
gchar *data;
@@ -1388,8 +1397,9 @@ write_user_key_file( NASettings *settings )
gsize length;
error = NULL;
- data = g_key_file_to_data( settings->private->user->key_file, &length, NULL );
- file = g_file_new_for_path( settings->private->user->fname );
+ settings_new();
+ data = g_key_file_to_data( st_settings->private->user->key_file, &length, NULL );
+ file = g_file_new_for_path( st_settings->private->user->fname );
stream = g_file_replace( file, NULL, FALSE, G_FILE_CREATE_NONE, NULL, &error );
if( error ){
diff --git a/src/core/na-settings.h b/src/core/na-settings.h
index e6a0253..70745b9 100644
--- a/src/core/na-settings.h
+++ b/src/core/na-settings.h
@@ -54,39 +54,15 @@
* 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
-#define NA_SETTINGS_TYPE ( na_settings_get_type())
-#define NA_SETTINGS( object ) ( G_TYPE_CHECK_INSTANCE_CAST( object, NA_SETTINGS_TYPE, NASettings ))
-#define NA_SETTINGS_CLASS( klass ) ( G_TYPE_CHECK_CLASS_CAST( klass, NA_SETTINGS_TYPE, NASettingsClass ))
-#define NA_IS_SETTINGS( object ) ( G_TYPE_CHECK_INSTANCE_TYPE( object, NA_SETTINGS_TYPE ))
-#define NA_IS_SETTINGS_CLASS( klass ) ( G_TYPE_CHECK_CLASS_TYPE(( klass ), NA_SETTINGS_TYPE ))
-#define NA_SETTINGS_GET_CLASS( object ) ( G_TYPE_INSTANCE_GET_CLASS(( object ), NA_SETTINGS_TYPE, NASettingsClass ))
-
-typedef struct _NASettingsPrivate NASettingsPrivate;
-
-typedef struct {
- /*< private >*/
- GObject parent;
- NASettingsPrivate *private;
-}
- NASettings;
-
-typedef struct _NASettingsClassPrivate NASettingsClassPrivate;
-
-typedef struct {
- /*< private >*/
- GObjectClass parent;
- NASettingsClassPrivate *private;
-}
- NASettingsClass;
-
-GType na_settings_get_type( void );
-
/* 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.
@@ -162,31 +138,31 @@ GType na_settings_get_type( void );
*/
typedef void ( *NASettingsKeyCallback )( const gchar *group, const gchar *key, gconstpointer new_value, gboolean mandatory, void *user_data );
-void na_settings_register_key_callback ( NASettings *settings, const gchar *key, GCallback callback, gpointer 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"
-NASettings *na_settings_new ( void );
+void na_settings_free ( void );
-gboolean na_settings_get_boolean ( NASettings *settings, const gchar *key, gboolean *found, gboolean *mandatory );
-gboolean na_settings_get_boolean_ex ( NASettings *settings, const gchar *group, const gchar *key, gboolean *found, gboolean *mandatory );
-gchar *na_settings_get_string ( NASettings *settings, const gchar *key, gboolean *found, gboolean *mandatory );
-GSList *na_settings_get_string_list ( NASettings *settings, const gchar *key, gboolean *found, gboolean *mandatory );
-guint na_settings_get_uint ( NASettings *settings, const gchar *key, gboolean *found, gboolean *mandatory );
-GList *na_settings_get_uint_list ( NASettings *settings, const gchar *key, gboolean *found, gboolean *mandatory );
+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 ( NASettings *settings, const gchar *key, gboolean value );
-gboolean na_settings_set_boolean_ex ( NASettings *settings, const gchar *group, const gchar *key, gboolean value );
-gboolean na_settings_set_string ( NASettings *settings, const gchar *key, const gchar *value );
-gboolean na_settings_set_string_list ( NASettings *settings, const gchar *key, const GSList *value );
-gboolean na_settings_set_uint ( NASettings *settings, const gchar *key, guint value );
-gboolean na_settings_set_uint_list ( NASettings *settings, const gchar *key, const GList *value );
+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_list ( const gchar *key, const GSList *value );
+gboolean na_settings_set_uint ( const gchar *key, guint value );
+gboolean na_settings_set_uint_list ( const gchar *key, const GList *value );
/* na_iprefs_get_io_providers()
*/
-GSList *na_settings_get_groups ( NASettings *settings );
+GSList *na_settings_get_groups ( void );
G_END_DECLS
diff --git a/src/core/na-tokens.c b/src/core/na-tokens.c
index 6deb0fd..e1c4403 100644
--- a/src/core/na-tokens.c
+++ b/src/core/na-tokens.c
@@ -42,6 +42,7 @@
#include "na-gnome-vfs-uri.h"
#include "na-selected-info.h"
+#include "na-settings.h"
#include "na-tokens.h"
/* private class data
@@ -77,11 +78,11 @@ static void instance_dispose( GObject *object );
static void instance_finalize( GObject *object );
static gchar *display_output_get_content( int fd );
-static void execute_action_command( const NASettings *settings, gchar *command, const NAObjectProfile *profile );
-static gchar *get_command_execution_display_output( const NASettings *settings, const gchar *command );
-static gchar *get_command_execution_embedded( const NASettings *settings, const gchar *command );
-static gchar *get_command_execution_normal( const NASettings *settings, const gchar *command );
-static gchar *get_command_execution_terminal( const NASettings *settings, const gchar *command );
+static void execute_action_command( gchar *command, const NAObjectProfile *profile );
+static gchar *get_command_execution_display_output( const gchar *command );
+static gchar *get_command_execution_embedded( const gchar *command );
+static gchar *get_command_execution_normal( const gchar *command );
+static gchar *get_command_execution_terminal( const gchar *command );
static gboolean is_singular_exec( const NATokens *tokens, const gchar *exec );
static gchar *parse_singular( const NATokens *tokens, const gchar *input, guint i, gboolean utf8, gboolean quoted );
static GString *quote_string( GString *input, const gchar *name, gboolean quoted );
@@ -364,7 +365,7 @@ na_tokens_parse_for_display( const NATokens *tokens, const gchar *string, gboole
* Execute the given action, regarding the context described by @tokens.
*/
void
-na_tokens_execute_action( const NATokens *tokens, const NASettings *settings, const NAObjectProfile *profile )
+na_tokens_execute_action( const NATokens *tokens, const NAObjectProfile *profile )
{
gchar *path, *parameters, *exec;
gboolean singular;
@@ -382,13 +383,13 @@ na_tokens_execute_action( const NATokens *tokens, const NASettings *settings, co
if( singular ){
for( i = 0 ; i < tokens->private->count ; ++i ){
command = parse_singular( tokens, exec, i, FALSE, TRUE );
- execute_action_command( settings, command, profile );
+ execute_action_command( command, profile );
g_free( command );
}
} else {
command = parse_singular( tokens, exec, 0, FALSE, TRUE );
- execute_action_command( settings, command, profile );
+ execute_action_command( command, profile );
g_free( command );
}
@@ -463,7 +464,7 @@ display_output_get_content( int fd )
* - DisplayOutput: execute in a shell
*/
static void
-execute_action_command( const NASettings *settings, gchar *command, const NAObjectProfile *profile )
+execute_action_command( gchar *command, const NAObjectProfile *profile )
{
static const gchar *thisfn = "nautilus_actions_execute_action_command";
GError *error;
@@ -481,16 +482,16 @@ execute_action_command( const NASettings *settings, gchar *command, const NAObje
execution_mode = na_object_get_execution_mode( profile );
if( !strcmp( execution_mode, "Normal" )){
- run_command = get_command_execution_normal( settings, command );
+ run_command = get_command_execution_normal( command );
} else if( !strcmp( execution_mode, "Terminal" )){
- run_command = get_command_execution_terminal( settings, command );
+ run_command = get_command_execution_terminal( command );
} else if( !strcmp( execution_mode, "Embedded" )){
- run_command = get_command_execution_embedded( settings, command );
+ run_command = get_command_execution_embedded( command );
} else if( !strcmp( execution_mode, "DisplayOutput" )){
- run_command = get_command_execution_display_output( settings, command );
+ run_command = get_command_execution_display_output( command );
} else {
g_warning( "%s: unknown execution mode: %s", thisfn, execution_mode );
@@ -539,31 +540,31 @@ execute_action_command( const NASettings *settings, gchar *command, const NAObje
}
static gchar *
-get_command_execution_display_output( const NASettings *settings, const gchar *command )
+get_command_execution_display_output( const gchar *command )
{
static const gchar *bin_sh = "/bin/sh -c ";
return( na_tokens_command_from_terminal_prefix( bin_sh, command ));
}
static gchar *
-get_command_execution_embedded( const NASettings *settings, const gchar *command )
+get_command_execution_embedded( const gchar *command )
{
- return( get_command_execution_terminal( settings, command ));
+ return( get_command_execution_terminal( command ));
}
static gchar *
-get_command_execution_normal( const NASettings *settings, const gchar *command )
+get_command_execution_normal( const gchar *command )
{
return( g_strdup( command ));
}
static gchar *
-get_command_execution_terminal( const NASettings *settings, const gchar *command )
+get_command_execution_terminal( const gchar *command )
{
gchar *run_command;
gchar *prefix;
- prefix = na_settings_get_string(( NASettings * ) settings, NA_IPREFS_TERMINAL_PREFIX, NULL, NULL );
+ prefix = na_settings_get_string( NA_IPREFS_TERMINAL_PREFIX, NULL, NULL );
run_command = na_tokens_command_from_terminal_prefix( prefix, command );
g_free( prefix );
diff --git a/src/core/na-tokens.h b/src/core/na-tokens.h
index 56ca612..2a90a96 100644
--- a/src/core/na-tokens.h
+++ b/src/core/na-tokens.h
@@ -82,8 +82,6 @@
#include <api/na-object-profile.h>
-#include "na-settings.h"
-
G_BEGIN_DECLS
#define NA_TOKENS_TYPE ( na_tokens_get_type())
@@ -117,7 +115,7 @@ NATokens *na_tokens_new_for_example ( void );
NATokens *na_tokens_new_from_selection( GList *selection );
gchar *na_tokens_parse_for_display ( const NATokens *tokens, const gchar *string, gboolean utf8 );
-void na_tokens_execute_action ( const NATokens *tokens, const NASettings *settings, const NAObjectProfile *profile );
+void na_tokens_execute_action ( const NATokens *tokens, const NAObjectProfile *profile );
gchar *na_tokens_command_from_terminal_prefix( const gchar *prefix, const gchar *command );
diff --git a/src/core/na-updater.c b/src/core/na-updater.c
index d3b193d..26f92ab 100644
--- a/src/core/na-updater.c
+++ b/src/core/na-updater.c
@@ -207,10 +207,8 @@ are_preferences_locked( const NAUpdater *updater )
{
gboolean are_locked;
gboolean mandatory;
- NASettings *settings;
- settings = na_pivot_get_settings( NA_PIVOT( updater ));
- are_locked = na_settings_get_boolean( settings, NA_IPREFS_ADMIN_PREFERENCES_LOCKED, NULL, &mandatory );
+ are_locked = na_settings_get_boolean( NA_IPREFS_ADMIN_PREFERENCES_LOCKED, NULL, &mandatory );
return( are_locked && mandatory );
}
@@ -221,8 +219,7 @@ is_level_zero_writable( const NAUpdater *updater )
GSList *level_zero;
gboolean mandatory;
- level_zero = na_settings_get_string_list(
- na_pivot_get_settings( NA_PIVOT( updater )), NA_IPREFS_ITEMS_LEVEL_ZERO_ORDER, NULL, &mandatory );
+ level_zero = na_settings_get_string_list( NA_IPREFS_ITEMS_LEVEL_ZERO_ORDER, NULL, &mandatory );
na_core_utils_slist_free( level_zero );
@@ -477,18 +474,15 @@ na_updater_should_pasted_be_relabeled( const NAUpdater *updater, const NAObject
{
static const gchar *thisfn = "na_updater_should_pasted_be_relabeled";
gboolean relabel;
- NASettings *settings;
-
- settings = na_pivot_get_settings( NA_PIVOT( updater ));
if( NA_IS_OBJECT_MENU( item )){
- relabel = na_settings_get_boolean( settings, NA_IPREFS_RELABEL_DUPLICATE_MENU, NULL, NULL );
+ relabel = na_settings_get_boolean( NA_IPREFS_RELABEL_DUPLICATE_MENU, NULL, NULL );
} else if( NA_IS_OBJECT_ACTION( item )){
- relabel = na_settings_get_boolean( settings, NA_IPREFS_RELABEL_DUPLICATE_ACTION, NULL, NULL );
+ relabel = na_settings_get_boolean( NA_IPREFS_RELABEL_DUPLICATE_ACTION, NULL, NULL );
} else if( NA_IS_OBJECT_PROFILE( item )){
- relabel = na_settings_get_boolean( settings, NA_IPREFS_RELABEL_DUPLICATE_PROFILE, NULL, NULL );
+ relabel = na_settings_get_boolean( NA_IPREFS_RELABEL_DUPLICATE_PROFILE, NULL, NULL );
} else {
g_warning( "%s: unknown item type at %p", thisfn, ( void * ) item );
diff --git a/src/nact/base-gtk-utils.c b/src/nact/base-gtk-utils.c
index c3840cb..836fe18 100644
--- a/src/nact/base-gtk-utils.c
+++ b/src/nact/base-gtk-utils.c
@@ -47,9 +47,6 @@
#define DEFAULT_WIDTH 22
#define DEFAULT_HEIGHT 22
-static NASettings *get_settings( const BaseWindow *window );
-static GList *read_int_list( const BaseWindow *window, const gchar *key );
-static void write_int_list( const BaseWindow *window, const gchar *key, GList *list );
static void int_list_to_position( const BaseWindow *window, GList *list, gint *x, gint *y, gint *width, gint *height );
static GList *position_to_int_list( const BaseWindow *window, gint x, gint y, gint width, gint height );
static void free_int_list( GList *list );
@@ -83,7 +80,7 @@ base_gtk_utils_restore_window_position( const BaseWindow *window, const gchar *w
thisfn, ( void * ) window, G_OBJECT_TYPE_NAME( window ),
( void * ) toplevel, G_OBJECT_TYPE_NAME( toplevel ), wsp_name );
- list = read_int_list( window, wsp_name );
+ list = na_settings_get_uint_list( wsp_name, NULL, NULL );
if( list ){
int_list_to_position( window, list, &x, &y, &width, &height );
@@ -130,40 +127,10 @@ base_gtk_utils_save_window_position( const BaseWindow *window, const gchar *wsp_
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( window, x, y, width, height );
- write_int_list( window, wsp_name, list );
+ na_settings_set_uint_list( wsp_name, list );
free_int_list( list );
}
-/* It seems inevitable that preferences are attached to the application.
- * Unfortunately, it does not seem possible to have a base window size and
- * position itself. So, this BaseIPrefs interface is not really a base
- * interface, but rather a common one, attached to the application
- */
-static NASettings *
-get_settings( const BaseWindow *window )
-{
- NactApplication *appli = NACT_APPLICATION( base_window_get_application( window ));
- NAUpdater *updater = nact_application_get_updater( appli );
- return( na_pivot_get_settings( NA_PIVOT( updater )));
-}
-
-/*
- * returns a list of int
- */
-static GList *
-read_int_list( const BaseWindow *window, const gchar *key )
-{
- NASettings *settings = get_settings( window );
- return( na_settings_get_uint_list( settings, key, NULL, NULL ));
-}
-
-static void
-write_int_list( const BaseWindow *window, const gchar *key, GList *list )
-{
- NASettings *settings = get_settings( window );
- na_settings_set_uint_list( settings, key, list );
-}
-
/*
* extract the position of the window from the list of unsigned integers
*/
@@ -614,11 +581,9 @@ base_gtk_utils_select_file_with_preview( BaseWindow *window,
const gchar *text;
gchar *filename, *uri;
GtkWidget *preview;
- NASettings *settings;
application = NACT_APPLICATION( base_window_get_application( window ));
updater = nact_application_get_updater( application );
- settings = na_pivot_get_settings( NA_PIVOT( updater ));
toplevel = base_window_get_gtk_toplevel( window );
dialog = gtk_file_chooser_dialog_new(
@@ -644,7 +609,7 @@ base_gtk_utils_select_file_with_preview( BaseWindow *window,
gtk_file_chooser_set_filename( GTK_FILE_CHOOSER( dialog ), text );
} else {
- uri = na_settings_get_string( settings, entry_name, NULL, NULL );
+ uri = na_settings_get_string( entry_name, NULL, NULL );
if( uri ){
gtk_file_chooser_set_current_folder_uri( GTK_FILE_CHOOSER( dialog ), uri );
g_free( uri );
@@ -658,7 +623,7 @@ base_gtk_utils_select_file_with_preview( BaseWindow *window,
}
uri = gtk_file_chooser_get_current_folder_uri( GTK_FILE_CHOOSER( dialog ));
- na_settings_set_string( settings, entry_name, uri );
+ na_settings_set_string( entry_name, uri );
g_free( uri );
base_gtk_utils_save_window_position( window, wsp_name );
@@ -696,11 +661,9 @@ base_gtk_utils_select_dir( BaseWindow *window,
GtkWidget *dialog;
const gchar *text;
gchar *dir, *uri;
- NASettings *settings;
application = NACT_APPLICATION( base_window_get_application( window ));
updater = nact_application_get_updater( application );
- settings = na_pivot_get_settings( NA_PIVOT( updater ));
toplevel = base_window_get_gtk_toplevel( window );
dialog = gtk_file_chooser_dialog_new(
@@ -720,7 +683,7 @@ base_gtk_utils_select_dir( BaseWindow *window,
gtk_file_chooser_set_filename( GTK_FILE_CHOOSER( dialog ), text );
} else {
- uri = na_settings_get_string( settings, entry_name, NULL, NULL );
+ uri = na_settings_get_string( entry_name, NULL, NULL );
if( uri ){
gtk_file_chooser_set_current_folder_uri( GTK_FILE_CHOOSER( dialog ), uri );
g_free( uri );
@@ -734,7 +697,7 @@ base_gtk_utils_select_dir( BaseWindow *window,
}
uri = gtk_file_chooser_get_current_folder_uri( GTK_FILE_CHOOSER( dialog ));
- na_settings_set_string( settings, entry_name, uri );
+ na_settings_set_string( entry_name, uri );
g_free( uri );
base_gtk_utils_save_window_position( window, wsp_name );
diff --git a/src/nact/nact-assistant-export.c b/src/nact/nact-assistant-export.c
index 82e7068..3c4ac2f 100644
--- a/src/nact/nact-assistant-export.c
+++ b/src/nact/nact-assistant-export.c
@@ -274,19 +274,12 @@ void
nact_assistant_export_run( BaseWindow *main_window )
{
NactAssistantExport *assistant;
- NactApplication *application;
- NAUpdater *updater;
- NASettings *settings;
gboolean esc_quit, esc_confirm;
g_return_if_fail( NACT_IS_MAIN_WINDOW( main_window ));
- application = NACT_APPLICATION( base_window_get_application( main_window ));
- updater = nact_application_get_updater( application );
- settings = na_pivot_get_settings( NA_PIVOT( updater ));
-
- esc_quit = na_settings_get_boolean( settings, NA_IPREFS_ASSISTANT_ESC_QUIT, NULL, NULL );
- esc_confirm = na_settings_get_boolean( settings, NA_IPREFS_ASSISTANT_ESC_CONFIRM, NULL, NULL );
+ esc_quit = na_settings_get_boolean( NA_IPREFS_ASSISTANT_ESC_QUIT, NULL, NULL );
+ esc_confirm = na_settings_get_boolean( NA_IPREFS_ASSISTANT_ESC_CONFIRM, NULL, NULL );
assistant = g_object_new( NACT_ASSISTANT_EXPORT_TYPE,
BASE_PROP_PARENT, main_window,
@@ -307,9 +300,6 @@ static void
on_base_initialize_gtk_toplevel( NactAssistantExport *dialog, GtkAssistant *assistant, gpointer user_data )
{
static const gchar *thisfn = "nact_assistant_export_on_base_initialize_gtk_toplevel";
- NactApplication *application;
- NAUpdater *updater;
- NASettings *settings;
gboolean are_locked, mandatory;
g_return_if_fail( NACT_IS_ASSISTANT_EXPORT( dialog ));
@@ -318,11 +308,7 @@ on_base_initialize_gtk_toplevel( NactAssistantExport *dialog, GtkAssistant *assi
g_debug( "%s: dialog=%p, assistant=%p, user_data=%p",
thisfn, ( void * ) dialog, ( void * ) assistant, ( void * ) user_data );
- application = NACT_APPLICATION( base_window_get_application( BASE_WINDOW( dialog )));
- updater = nact_application_get_updater( application );
- settings = na_pivot_get_settings( NA_PIVOT( updater ));
-
- are_locked = na_settings_get_boolean( settings, NA_IPREFS_ADMIN_PREFERENCES_LOCKED, NULL, &mandatory );
+ are_locked = na_settings_get_boolean( NA_IPREFS_ADMIN_PREFERENCES_LOCKED, NULL, &mandatory );
dialog->private->preferences_locked = are_locked && mandatory;
assist_initial_load_target_folder( dialog, assistant );
@@ -440,20 +426,13 @@ static void
assist_runtime_init_target_folder( NactAssistantExport *window, GtkAssistant *assistant )
{
GtkFileChooser *chooser;
- NactApplication *application;
- NAUpdater *updater;
- NASettings *settings;
gchar *uri;
GtkWidget *content;
chooser = get_folder_chooser( window );
gtk_file_chooser_unselect_all( chooser );
- application = NACT_APPLICATION( base_window_get_application( BASE_WINDOW( window )));
- updater = nact_application_get_updater( application );
- settings = na_pivot_get_settings( NA_PIVOT( updater ));
-
- uri = na_settings_get_string( settings, NA_IPREFS_EXPORT_ASSISTANT_URI, NULL, NULL );
+ uri = na_settings_get_string( NA_IPREFS_EXPORT_ASSISTANT_URI, NULL, NULL );
if( uri && strlen( uri )){
gtk_file_chooser_set_current_folder_uri( GTK_FILE_CHOOSER( chooser ), uri );
}
@@ -487,9 +466,6 @@ on_folder_selection_changed( GtkFileChooser *chooser, gpointer user_data )
gboolean enabled;
NactAssistantExport *assist;
GtkWidget *content;
- NactApplication *application;
- NAUpdater *updater;
- NASettings *settings;
g_debug( "%s: chooser=%p, user_data=%p", thisfn, ( void * ) chooser, ( void * ) user_data );
g_assert( NACT_IS_ASSISTANT_EXPORT( user_data ));
@@ -506,12 +482,7 @@ on_folder_selection_changed( GtkFileChooser *chooser, gpointer user_data )
if( enabled ){
g_free( assist->private->uri );
assist->private->uri = g_strdup( uri );
-
- application = NACT_APPLICATION( base_window_get_application( BASE_WINDOW( assist )));
- updater = nact_application_get_updater( application );
- settings = na_pivot_get_settings( NA_PIVOT( updater ));
-
- na_settings_set_string( settings, NA_IPREFS_EXPORT_ASSISTANT_URI, uri );
+ na_settings_set_string( NA_IPREFS_EXPORT_ASSISTANT_URI, uri );
}
g_free( uri );
@@ -542,13 +513,9 @@ assist_runtime_init_format( NactAssistantExport *window, GtkAssistant *assistant
GtkWidget *content;
GtkWidget *container;
GQuark format;
- NactApplication *application;
- NAUpdater *updater;
gboolean mandatory;
- application = NACT_APPLICATION( base_window_get_application( BASE_WINDOW( window )));
- updater = nact_application_get_updater( application );
- format = na_iprefs_get_export_format( NA_PIVOT( updater ), NA_IPREFS_EXPORT_PREFERRED_FORMAT, &mandatory );
+ format = na_iprefs_get_export_format( NA_IPREFS_EXPORT_PREFERRED_FORMAT, &mandatory );
container = base_window_get_widget( BASE_WINDOW( window ), "AssistantExportFormatVBox" );
nact_export_format_select( container, !mandatory, format );
@@ -602,15 +569,10 @@ assist_prepare_confirm( NactAssistantExport *window, GtkAssistant *assistant, Gt
GList *it;
NAExportFormat *format;
GtkLabel *confirm_label;
- NactApplication *application;
- NAUpdater *updater;
g_debug( "%s: window=%p, assistant=%p, page=%p",
thisfn, ( void * ) window, ( void * ) assistant, ( void * ) page );
- application = NACT_APPLICATION( base_window_get_application( BASE_WINDOW( window )));
- updater = nact_application_get_updater( application );
-
/* i18n: this is the title of the confirm page of the export assistant */
text = g_string_new( "" );
g_string_printf( text, "<b>%s</b>\n\n", _( "About to export selected items:" ));
@@ -632,7 +594,7 @@ assist_prepare_confirm( NactAssistantExport *window, GtkAssistant *assistant, Gt
format = get_export_format( window );
label11 = na_export_format_get_label( format );
label21 = na_export_format_get_description( format );
- na_iprefs_set_export_format( NA_PIVOT( updater ), NA_IPREFS_EXPORT_PREFERRED_FORMAT, na_export_format_get_quark( format ));
+ na_iprefs_set_export_format( NA_IPREFS_EXPORT_PREFERRED_FORMAT, na_export_format_get_quark( format ));
label12 = na_core_utils_str_remove_char( label11, "_" );
label22 = na_core_utils_str_add_prefix( "\t", label21 );
g_string_append_printf( text, "\n\n<b>%s</b>\n\n%s", label12, label22 );
@@ -682,7 +644,7 @@ assistant_apply( BaseAssistant *wnd, GtkAssistant *assistant )
str->item = NA_OBJECT_ITEM( na_object_get_origin( NA_IDUPLICABLE( ia->data )));
- str->format = na_iprefs_get_export_format( NA_PIVOT( updater ), NA_IPREFS_EXPORT_PREFERRED_FORMAT, NULL );
+ str->format = na_iprefs_get_export_format( NA_IPREFS_EXPORT_PREFERRED_FORMAT, NULL );
if( str->format == IPREFS_EXPORT_FORMAT_ASK ){
str->format = nact_export_ask_user( BASE_WINDOW( wnd ), str->item, first );
diff --git a/src/nact/nact-assistant-import.c b/src/nact/nact-assistant-import.c
index 8e5a664..86d974d 100644
--- a/src/nact/nact-assistant-import.c
+++ b/src/nact/nact-assistant-import.c
@@ -243,19 +243,12 @@ void
nact_assistant_import_run( BaseWindow *main_window )
{
NactAssistantImport *assistant;
- NactApplication *application;
- NAUpdater *updater;
- NASettings *settings;
gboolean esc_quit, esc_confirm;
g_return_if_fail( NACT_IS_MAIN_WINDOW( main_window ));
- application = NACT_APPLICATION( base_window_get_application( main_window ));
- updater = nact_application_get_updater( application );
- settings = na_pivot_get_settings( NA_PIVOT( updater ));
-
- esc_quit = na_settings_get_boolean( settings, NA_IPREFS_ASSISTANT_ESC_QUIT, NULL, NULL );
- esc_confirm = na_settings_get_boolean( settings, NA_IPREFS_ASSISTANT_ESC_CONFIRM, NULL, NULL );
+ esc_quit = na_settings_get_boolean( NA_IPREFS_ASSISTANT_ESC_QUIT, NULL, NULL );
+ esc_confirm = na_settings_get_boolean( NA_IPREFS_ASSISTANT_ESC_CONFIRM, NULL, NULL );
assistant = g_object_new( NACT_ASSISTANT_IMPORT_TYPE,
BASE_PROP_PARENT, main_window,
@@ -307,9 +300,6 @@ static void
runtime_init_file_selector( NactAssistantImport *window, GtkAssistant *assistant )
{
static const gchar *thisfn = "nact_assistant_import_runtime_init_file_selector";
- NactApplication *application;
- NAUpdater *updater;
- NASettings *settings;
GtkWidget *page;
GtkWidget *chooser;
gchar *uri;
@@ -319,12 +309,8 @@ runtime_init_file_selector( NactAssistantImport *window, GtkAssistant *assistant
g_debug( "%s: window=%p, assistant=%p, page=%p",
thisfn, ( void * ) window, ( void * ) assistant, ( void * ) page );
- application = NACT_APPLICATION( base_window_get_application( BASE_WINDOW( window )));
- updater = nact_application_get_updater( application );
- settings = na_pivot_get_settings( NA_PIVOT( updater ));
-
chooser = base_window_get_widget( BASE_WINDOW( window ), "ImportFileChooser" );
- uri = na_settings_get_string( settings, NA_IPREFS_IMPORT_ASSISTANT_URI, NULL, NULL );
+ uri = na_settings_get_string( NA_IPREFS_IMPORT_ASSISTANT_URI, NULL, NULL );
if( uri && strlen( uri )){
gtk_file_chooser_set_current_folder_uri( GTK_FILE_CHOOSER( chooser ), uri );
}
@@ -342,9 +328,6 @@ runtime_init_file_selector( NactAssistantImport *window, GtkAssistant *assistant
static void
on_file_selection_changed( GtkFileChooser *chooser, gpointer user_data )
{
- NactApplication *application;
- NAUpdater *updater;
- NASettings *settings;
GtkAssistant *assistant;
gint pos;
GSList *uris;
@@ -361,12 +344,8 @@ on_file_selection_changed( GtkFileChooser *chooser, gpointer user_data )
enabled = has_readable_files( uris );
if( enabled ){
- application = NACT_APPLICATION( base_window_get_application( BASE_WINDOW( user_data )));
- updater = nact_application_get_updater( application );
- settings = na_pivot_get_settings( NA_PIVOT( updater ));
-
folder = gtk_file_chooser_get_current_folder_uri( GTK_FILE_CHOOSER( chooser ));
- na_settings_set_string( settings, NA_IPREFS_IMPORT_ASSISTANT_URI, folder );
+ na_settings_set_string( NA_IPREFS_IMPORT_ASSISTANT_URI, folder );
g_free( folder );
}
@@ -440,15 +419,10 @@ runtime_init_duplicates( NactAssistantImport *window, GtkAssistant *assistant )
static const gchar *thisfn = "nact_assistant_import_runtime_init_duplicates";
GtkWidget *page;
guint mode;
- NactApplication *application;
- NAUpdater *updater;
g_debug( "%s: window=%p", thisfn, ( void * ) window );
- application = NACT_APPLICATION( base_window_get_application( BASE_WINDOW( window )));
- updater = nact_application_get_updater( application );
-
- mode = na_iprefs_get_import_mode( NA_PIVOT( updater ), NA_IPREFS_IMPORT_PREFERRED_MODE, NULL );
+ mode = na_iprefs_get_import_mode( NA_IPREFS_IMPORT_PREFERRED_MODE, NULL );
set_import_mode( window, mode );
page = gtk_assistant_get_nth_page( assistant, ASSIST_PAGE_DUPLICATES );
@@ -724,15 +698,10 @@ prepare_importdone( NactAssistantImport *window, GtkAssistant *assistant, GtkWid
GtkTextTag *title_tag;
GtkTextIter start, end;
gint title_len;
- NactApplication *application;
- NAUpdater *updater;
g_debug( "%s: window=%p, assistant=%p, page=%p",
thisfn, ( void * ) window, ( void * ) assistant, ( void * ) page );
- application = NACT_APPLICATION( base_window_get_application( BASE_WINDOW( window )));
- updater = nact_application_get_updater( application );
-
/* i18n: result of the import assistant */
text = g_strdup( _( "Selected files have been proceeded :" ));
title_len = g_utf8_strlen( text, -1 );
@@ -802,7 +771,7 @@ prepare_importdone( NactAssistantImport *window, GtkAssistant *assistant, GtkWid
g_object_unref( title_tag );
mode = get_import_mode( window );
- na_iprefs_set_import_mode( NA_PIVOT( updater ), NA_IPREFS_IMPORT_PREFERRED_MODE, mode );
+ na_iprefs_set_import_mode( NA_IPREFS_IMPORT_PREFERRED_MODE, mode );
gtk_assistant_set_page_complete( assistant, page, TRUE );
g_object_set( G_OBJECT( window ), BASE_PROP_WARN_ON_ESCAPE, FALSE, NULL );
diff --git a/src/nact/nact-clipboard.c b/src/nact/nact-clipboard.c
index e2dffb9..c8e0e67 100644
--- a/src/nact/nact-clipboard.c
+++ b/src/nact/nact-clipboard.c
@@ -616,7 +616,7 @@ export_row_object( NactClipboard *clipboard, NAObject *object, const gchar *dest
if( index == -1 ){
*exported = g_list_prepend( *exported, ( gpointer ) action );
- format = na_iprefs_get_export_format( NA_PIVOT( updater ), NA_IPREFS_EXPORT_PREFERRED_FORMAT, NULL );
+ format = na_iprefs_get_export_format( NA_IPREFS_EXPORT_PREFERRED_FORMAT, NULL );
if( format == IPREFS_EXPORT_FORMAT_ASK ){
format = nact_export_ask_user( clipboard->private->window, NA_OBJECT_ITEM( action ), first );
diff --git a/src/nact/nact-export-ask.c b/src/nact/nact-export-ask.c
index 50b433f..f450e21 100644
--- a/src/nact/nact-export-ask.c
+++ b/src/nact/nact-export-ask.c
@@ -228,9 +228,6 @@ nact_export_ask_user( BaseWindow *parent, NAObjectItem *item, gboolean first )
{
static const gchar *thisfn = "nact_export_ask_user";
NactExportAsk *editor;
- NactApplication *application;
- NAUpdater *updater;
- NASettings *settings;
gboolean are_locked, mandatory;
gboolean keep, keep_mandatory;
@@ -241,12 +238,8 @@ nact_export_ask_user( BaseWindow *parent, NAObjectItem *item, gboolean first )
g_debug( "%s: parent=%p, item=%p (%s), first=%s",
thisfn, ( void * ) parent, ( void * ) item, G_OBJECT_TYPE_NAME( item ), first ? "True":"False" );
- application = NACT_APPLICATION( base_window_get_application( parent ));
- updater = nact_application_get_updater( application );
- settings = na_pivot_get_settings( NA_PIVOT( updater ));
-
- format = na_iprefs_get_export_format( NA_PIVOT( updater ), NA_IPREFS_EXPORT_ASK_USER_LAST_FORMAT, &mandatory );
- keep = na_settings_get_boolean( settings, NA_IPREFS_EXPORT_ASK_USER_KEEP_LAST_CHOICE, NULL, &keep_mandatory );
+ format = na_iprefs_get_export_format( NA_IPREFS_EXPORT_ASK_USER_LAST_FORMAT, &mandatory );
+ keep = na_settings_get_boolean( NA_IPREFS_EXPORT_ASK_USER_KEEP_LAST_CHOICE, NULL, &keep_mandatory );
if( first || !keep ){
@@ -265,7 +258,7 @@ nact_export_ask_user( BaseWindow *parent, NAObjectItem *item, gboolean first )
editor->private->parent = parent;
editor->private->item = item;
- are_locked = na_settings_get_boolean( settings, NA_IPREFS_ADMIN_PREFERENCES_LOCKED, NULL, &mandatory );
+ are_locked = na_settings_get_boolean( NA_IPREFS_ADMIN_PREFERENCES_LOCKED, NULL, &mandatory );
editor->private->preferences_locked = are_locked && mandatory;
if( base_window_run( BASE_WINDOW( editor )) == GTK_RESPONSE_OK ){
@@ -391,23 +384,16 @@ get_export_format( NactExportAsk *editor )
GtkWidget *container;
NAExportFormat *format;
GQuark format_quark;
- NactApplication *application;
- NAUpdater *updater;
- NASettings *settings;
container = base_window_get_widget( BASE_WINDOW( editor ), "ExportFormatAskVBox" );
format = nact_export_format_get_selected( container );
format_quark = na_export_format_get_quark( format );
- application = NACT_APPLICATION( base_window_get_application( BASE_WINDOW( editor )));
- updater = nact_application_get_updater( application );
- settings = na_pivot_get_settings( NA_PIVOT( updater ));
-
if( !editor->private->keep_last_choice_mandatory ){
- na_settings_set_boolean( settings, NA_IPREFS_EXPORT_ASK_USER_KEEP_LAST_CHOICE, editor->private->keep_last_choice );
+ na_settings_set_boolean( NA_IPREFS_EXPORT_ASK_USER_KEEP_LAST_CHOICE, editor->private->keep_last_choice );
}
- na_iprefs_set_export_format( NA_PIVOT( updater ), NA_IPREFS_EXPORT_ASK_USER_LAST_FORMAT, format_quark );
+ na_iprefs_set_export_format( NA_IPREFS_EXPORT_ASK_USER_LAST_FORMAT, format_quark );
return( format_quark );
}
diff --git a/src/nact/nact-icon-chooser.c b/src/nact/nact-icon-chooser.c
index ecc5290..1699d57 100644
--- a/src/nact/nact-icon-chooser.c
+++ b/src/nact/nact-icon-chooser.c
@@ -219,9 +219,6 @@ instance_dispose( GObject *dialog )
NactIconChooser *self;
guint pos;
GtkWidget *paned;
- NactApplication *application;
- NAUpdater *updater;
- NASettings *settings;
g_return_if_fail( NACT_IS_ICON_CHOOSER( dialog ));
@@ -232,13 +229,9 @@ instance_dispose( GObject *dialog )
self->private->dispose_has_run = TRUE;
- application = NACT_APPLICATION( base_window_get_application( BASE_WINDOW( self )));
- updater = nact_application_get_updater( application );
- settings = na_pivot_get_settings( NA_PIVOT( updater ));
-
paned = base_window_get_widget( BASE_WINDOW( self ), "IconPaned" );
pos = gtk_paned_get_position( GTK_PANED( paned ));
- na_settings_set_uint( settings, NA_IPREFS_ICON_CHOOSER_PANED, pos );
+ na_settings_set_uint( NA_IPREFS_ICON_CHOOSER_PANED, pos );
/* chain up to the parent class */
if( G_OBJECT_CLASS( st_parent_class )->dispose ){
@@ -415,20 +408,13 @@ on_base_initialize_base_window( NactIconChooser *editor )
static const gchar *thisfn = "nact_icon_chooser_on_base_initialize_base_window";
guint pos;
GtkWidget *paned;
- NactApplication *application;
- NAUpdater *updater;
- NASettings *settings;
g_return_if_fail( NACT_IS_ICON_CHOOSER( editor ));
if( !editor->private->dispose_has_run ){
g_debug( "%s: editor=%p", thisfn, ( void * ) editor );
- application = NACT_APPLICATION( base_window_get_application( BASE_WINDOW( editor )));
- updater = nact_application_get_updater( application );
- settings = na_pivot_get_settings( NA_PIVOT( updater ));
-
- pos = na_settings_get_uint( settings, NA_IPREFS_ICON_CHOOSER_PANED, NULL, NULL );
+ pos = na_settings_get_uint( NA_IPREFS_ICON_CHOOSER_PANED, NULL, NULL );
if( pos ){
paned = base_window_get_widget( BASE_WINDOW( editor ), "IconPaned" );
gtk_paned_set_position( GTK_PANED( paned ), pos );
@@ -492,22 +478,15 @@ static void
fillup_icons_by_path( NactIconChooser *editor )
{
GtkFileChooser *file_chooser;
- NactApplication *application;
- NAUpdater *updater;
- NASettings *settings;
gchar *uri;
file_chooser = GTK_FILE_CHOOSER( base_window_get_widget( BASE_WINDOW( editor ), "FileChooser" ));
editor->private->path_preview = gtk_image_new();
gtk_file_chooser_set_preview_widget( file_chooser, editor->private->path_preview );
- application = NACT_APPLICATION( base_window_get_application( BASE_WINDOW( editor )));
- updater = nact_application_get_updater( application );
- settings = na_pivot_get_settings( NA_PIVOT( updater ));
-
gtk_file_chooser_unselect_all( file_chooser );
- uri = na_settings_get_string( settings, NA_IPREFS_ICON_CHOOSER_URI, NULL, NULL );
+ uri = na_settings_get_string( NA_IPREFS_ICON_CHOOSER_URI, NULL, NULL );
if( uri ){
gtk_file_chooser_set_current_folder_uri( file_chooser, uri );
g_free( uri );
@@ -796,16 +775,10 @@ static void
on_path_selection_changed( GtkFileChooser *file_chooser, NactIconChooser *editor )
{
gchar *uri;
- NactApplication *application;
- NAUpdater *updater;
- NASettings *settings;
uri = gtk_file_chooser_get_current_folder_uri( file_chooser );
if( uri ){
- application = NACT_APPLICATION( base_window_get_application( BASE_WINDOW( editor )));
- updater = nact_application_get_updater( application );
- settings = na_pivot_get_settings( NA_PIVOT( updater ));
- na_settings_set_string( settings, NA_IPREFS_ICON_CHOOSER_URI, uri );
+ na_settings_set_string( NA_IPREFS_ICON_CHOOSER_URI, uri );
g_free( uri );
}
}
diff --git a/src/nact/nact-ifolders-tab.c b/src/nact/nact-ifolders-tab.c
index c8b8fe4..5dc6f8f 100644
--- a/src/nact/nact-ifolders-tab.c
+++ b/src/nact/nact-ifolders-tab.c
@@ -270,9 +270,6 @@ on_browse_folder_clicked( GtkButton *button, BaseWindow *window )
gchar *uri, *path;
GtkWindow *toplevel;
GtkWidget *dialog;
- NactApplication *application;
- NAUpdater *updater;
- NASettings *settings;
uri = NULL;
toplevel = base_window_get_gtk_toplevel( window );
@@ -287,13 +284,9 @@ on_browse_folder_clicked( GtkButton *button, BaseWindow *window )
GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
NULL );
- application = NACT_APPLICATION( base_window_get_application( window ));
- updater = nact_application_get_updater( application );
- settings = na_pivot_get_settings( NA_PIVOT( updater ));
-
base_gtk_utils_restore_window_position( window, NA_IPREFS_FOLDER_CHOOSER_WSP );
- uri = na_settings_get_string( settings, NA_IPREFS_FOLDER_CHOOSER_URI, NULL, NULL );
+ uri = na_settings_get_string( NA_IPREFS_FOLDER_CHOOSER_URI, NULL, NULL );
if( uri && g_utf8_strlen( uri, -1 )){
gtk_file_chooser_set_current_folder_uri( GTK_FILE_CHOOSER( dialog ), uri );
}
@@ -301,7 +294,7 @@ on_browse_folder_clicked( GtkButton *button, BaseWindow *window )
if( gtk_dialog_run( GTK_DIALOG( dialog )) == GTK_RESPONSE_ACCEPT ){
uri = gtk_file_chooser_get_current_folder_uri( GTK_FILE_CHOOSER( dialog ));
- na_settings_set_string( settings, NA_IPREFS_FOLDER_CHOOSER_URI, uri );
+ na_settings_set_string( NA_IPREFS_FOLDER_CHOOSER_URI, uri );
path = g_filename_from_uri( uri, NULL, NULL );
nact_match_list_insert_row( window, ITAB_NAME, path, FALSE, FALSE );
diff --git a/src/nact/nact-main-toolbar.c b/src/nact/nact-main-toolbar.c
index 071e4c5..ce9f6a1 100644
--- a/src/nact/nact-main-toolbar.c
+++ b/src/nact/nact-main-toolbar.c
@@ -97,17 +97,13 @@ nact_main_toolbar_init( BaseWindow *window, GtkActionGroup *group )
static void
init_toolbar( BaseWindow *window, GtkActionGroup *group, int toolbar_id )
{
- NactApplication *application;
- NAUpdater *updater;
ToolbarProps *props;
gboolean is_active;
GtkToggleAction *action;
- application = NACT_APPLICATION( base_window_get_application( window ));
- updater = nact_application_get_updater( application );
props = get_toolbar_properties( toolbar_id );
if( props ){
- is_active = na_settings_get_boolean( na_pivot_get_settings( NA_PIVOT( updater )), props->prefs_key, NULL, NULL );
+ is_active = na_settings_get_boolean( props->prefs_key, NULL, NULL );
if( is_active ){
action = GTK_TOGGLE_ACTION( gtk_action_group_get_action( group, props->ui_item ));
gtk_toggle_action_set_active( action, TRUE );
@@ -131,9 +127,6 @@ nact_main_toolbar_activate( NactMainWindow *window, int toolbar_id, GtkUIManager
ToolbarProps *props;
GtkWidget *toolbar, *hbox, *handle;
gulong attach_id, detach_id;
- NactApplication *application;
- NAUpdater *updater;
- NASettings *settings;
props = get_toolbar_properties( toolbar_id );
if( !props ){
@@ -168,11 +161,7 @@ nact_main_toolbar_activate( NactMainWindow *window, int toolbar_id, GtkUIManager
gtk_container_remove( GTK_CONTAINER( hbox ), handle );
}
- application = NACT_APPLICATION( base_window_get_application( BASE_WINDOW( window )));
- updater = nact_application_get_updater( application );
- settings = na_pivot_get_settings( NA_PIVOT( updater ));
-
- na_settings_set_boolean( settings, props->prefs_key, is_active );
+ na_settings_set_boolean( props->prefs_key, is_active );
}
/*
diff --git a/src/nact/nact-main-window.c b/src/nact/nact-main-window.c
index 1a1c700..33654ce 100644
--- a/src/nact/nact-main-window.c
+++ b/src/nact/nact-main-window.c
@@ -700,7 +700,6 @@ instance_dispose( GObject *window )
NactMainWindow *self;
GtkWidget *pane;
gint pos;
- NASettings *settings;
g_return_if_fail( NACT_IS_MAIN_WINDOW( window ));
@@ -714,11 +713,9 @@ instance_dispose( GObject *window )
g_object_unref( self->private->clipboard );
g_object_unref( self->private->menubar );
- settings = na_pivot_get_settings( NA_PIVOT( self->private->updater ));
-
pane = base_window_get_widget( BASE_WINDOW( window ), "MainPaned" );
pos = gtk_paned_get_position( GTK_PANED( pane ));
- na_settings_set_uint( settings, NA_IPREFS_MAIN_PANED, pos );
+ na_settings_set_uint( NA_IPREFS_MAIN_PANED, pos );
nact_iaction_tab_dispose( NACT_IACTION_TAB( window ));
nact_icommand_tab_dispose( NACT_ICOMMAND_TAB( window ));
@@ -819,7 +816,6 @@ static void
on_base_initialize_base_window( NactMainWindow *window, gpointer user_data )
{
static const gchar *thisfn = "nact_main_window_on_base_initialize_base_window";
- NASettings *settings;
guint pos;
GtkWidget *pane;
@@ -828,9 +824,7 @@ on_base_initialize_base_window( NactMainWindow *window, gpointer user_data )
if( !window->private->dispose_has_run ){
g_debug( "%s: window=%p, user_data=%p", thisfn, ( void * ) window, ( void * ) user_data );
- settings = na_pivot_get_settings( NA_PIVOT( window->private->updater ));
-
- pos = na_settings_get_uint( settings, NA_IPREFS_MAIN_PANED, NULL, NULL );
+ pos = na_settings_get_uint( NA_IPREFS_MAIN_PANED, NULL, NULL );
if( pos ){
pane = base_window_get_widget( BASE_WINDOW( window ), "MainPaned" );
gtk_paned_set_position( GTK_PANED( pane ), pos );
diff --git a/src/nact/nact-menubar-file.c b/src/nact/nact-menubar-file.c
index 0c8343f..007a44c 100644
--- a/src/nact/nact-menubar-file.c
+++ b/src/nact/nact-menubar-file.c
@@ -287,7 +287,7 @@ nact_menubar_file_save_items( BaseWindow *window )
messages = NULL;
if( nact_tree_ieditable_is_level_zero_modified( NACT_TREE_IEDITABLE( items_view ))){
- if( !na_iprefs_write_level_zero( NA_PIVOT( bar->private->updater ), items, &messages )){
+ if( !na_iprefs_write_level_zero( items, &messages )){
if( g_slist_length( messages )){
msg = na_core_utils_slist_join_at_end( messages, "\n" );
} else {
@@ -429,16 +429,12 @@ nact_menubar_file_on_quit( GtkAction *gtk_action, BaseWindow *window )
static void
install_autosave( NactMenubar *bar )
{
- NASettings *settings;
-
st_autosave_prefs_timeout.timeout = 100;
st_autosave_prefs_timeout.handler = ( NATimeoutFunc ) on_autosave_prefs_timeout;
st_autosave_prefs_timeout.user_data = bar;
- settings = na_pivot_get_settings( NA_PIVOT( bar->private->updater ));
-
- na_settings_register_key_callback( settings, NA_IPREFS_MAIN_SAVE_AUTO, G_CALLBACK( on_autosave_prefs_changed ), NULL );
- na_settings_register_key_callback( settings, NA_IPREFS_MAIN_SAVE_PERIOD, G_CALLBACK( on_autosave_prefs_changed ), NULL );
+ na_settings_register_key_callback( NA_IPREFS_MAIN_SAVE_AUTO, G_CALLBACK( on_autosave_prefs_changed ), NULL );
+ na_settings_register_key_callback( NA_IPREFS_MAIN_SAVE_PERIOD, G_CALLBACK( on_autosave_prefs_changed ), NULL );
on_autosave_prefs_timeout( bar );
}
@@ -453,16 +449,13 @@ static void
on_autosave_prefs_timeout( NactMenubar *bar )
{
static const gchar *thisfn = "nact_menubar_file_on_autosave_prefs_timeout";
- NASettings *settings;
gboolean autosave_on;
guint autosave_period;
g_return_if_fail( NACT_IS_MENUBAR( bar ));
- settings = na_pivot_get_settings( NA_PIVOT( bar->private->updater ));
-
- autosave_on = na_settings_get_boolean( settings, NA_IPREFS_MAIN_SAVE_AUTO, NULL, NULL );
- autosave_period = na_settings_get_uint( settings, NA_IPREFS_MAIN_SAVE_PERIOD, NULL, NULL );
+ autosave_on = na_settings_get_boolean( NA_IPREFS_MAIN_SAVE_AUTO, NULL, NULL );
+ autosave_period = na_settings_get_uint( NA_IPREFS_MAIN_SAVE_PERIOD, NULL, NULL );
if( st_event_autosave ){
if( !g_source_remove( st_event_autosave )){
diff --git a/src/nact/nact-preferences-editor.c b/src/nact/nact-preferences-editor.c
index 12d0b6a..f32335c 100644
--- a/src/nact/nact-preferences-editor.c
+++ b/src/nact/nact-preferences-editor.c
@@ -129,34 +129,34 @@ static void instance_finalize( GObject *dialog );
static void on_base_initialize_gtk_toplevel( NactPreferencesEditor *editor, GtkDialog *toplevel );
static void on_base_initialize_base_window( NactPreferencesEditor *editor );
static void on_base_all_widgets_showed( NactPreferencesEditor *editor );
-static void order_mode_setup( NactPreferencesEditor *editor, NAPivot *pivot );
+static void order_mode_setup( NactPreferencesEditor *editor );
static void order_mode_on_alpha_asc_toggled( GtkToggleButton *togglebutton, NactPreferencesEditor *editor );
static void order_mode_on_alpha_desc_toggled( GtkToggleButton *togglebutton, NactPreferencesEditor *editor );
static void order_mode_on_manual_toggled( GtkToggleButton *togglebutton, NactPreferencesEditor *editor );
static void order_mode_on_toggled( NactPreferencesEditor *editor, GtkToggleButton *togglebutton, GCallback cb, guint order_mode );
-static void root_menu_setup( NactPreferencesEditor *editor, NASettings *settings );
+static void root_menu_setup( NactPreferencesEditor *editor );
static void root_menu_on_toggled( GtkToggleButton *button, NactPreferencesEditor *editor );
-static void about_item_setup( NactPreferencesEditor *editor, NASettings *settings );
+static void about_item_setup( NactPreferencesEditor *editor );
static void about_item_on_toggled( GtkToggleButton *button, NactPreferencesEditor *editor );
-static void terminal_prefix_setup( NactPreferencesEditor *editor, NASettings *settings );
+static void terminal_prefix_setup( NactPreferencesEditor *editor );
static void terminal_prefix_on_changed( GtkEntry *entry, NactPreferencesEditor *editor );
static void desktop_create_model( NactPreferencesEditor *editor );
-static void desktop_setup( NactPreferencesEditor *editor, NASettings *settings );
+static void desktop_setup( NactPreferencesEditor *editor );
static void desktop_on_changed( GtkComboBox *combo, NactPreferencesEditor *editor );
-static void relabel_menu_setup( NactPreferencesEditor *editor, NASettings *settings );
+static void relabel_menu_setup( NactPreferencesEditor *editor );
static void relabel_menu_on_toggled( GtkToggleButton *button, NactPreferencesEditor *editor );
-static void relabel_action_setup( NactPreferencesEditor *editor, NASettings *settings );
+static void relabel_action_setup( NactPreferencesEditor *editor );
static void relabel_action_on_toggled( GtkToggleButton *button, NactPreferencesEditor *editor );
-static void relabel_profile_setup( NactPreferencesEditor *editor, NASettings *settings );
+static void relabel_profile_setup( NactPreferencesEditor *editor );
static void relabel_profile_on_toggled( GtkToggleButton *button, NactPreferencesEditor *editor );
-static void esc_quit_setup( NactPreferencesEditor *editor, NASettings *settings );
+static void esc_quit_setup( NactPreferencesEditor *editor );
static void esc_quit_on_toggled( GtkToggleButton *button, NactPreferencesEditor *editor );
-static void esc_confirm_setup( NactPreferencesEditor *editor, NASettings *settings );
+static void esc_confirm_setup( NactPreferencesEditor *editor );
static void esc_confirm_on_toggled( GtkToggleButton *button, NactPreferencesEditor *editor );
-static void auto_save_setup( NactPreferencesEditor *editor, NASettings *settings );
+static void auto_save_setup( NactPreferencesEditor *editor );
static void auto_save_on_toggled( GtkToggleButton *button, NactPreferencesEditor *editor );
static void auto_save_period_on_change_value( GtkSpinButton *spinbutton, NactPreferencesEditor *editor );
-static void import_mode_setup( NactPreferencesEditor *editor, NAPivot *pivot );
+static void import_mode_setup( NactPreferencesEditor *editor );
static void import_mode_on_ask_toggled( GtkToggleButton *togglebutton, NactPreferencesEditor *editor );
static void import_mode_on_override_toggled( GtkToggleButton *togglebutton, NactPreferencesEditor *editor );
static void import_mode_on_renumber_toggled( GtkToggleButton *togglebutton, NactPreferencesEditor *editor );
@@ -307,9 +307,6 @@ nact_preferences_editor_run( BaseWindow *parent )
{
static const gchar *thisfn = "nact_preferences_editor_run";
NactPreferencesEditor *editor;
- NactApplication *application;
- NAUpdater *updater;
- NASettings *settings;
gboolean are_locked, mandatory;
GtkNotebook *notebook;
@@ -324,11 +321,7 @@ nact_preferences_editor_run( BaseWindow *parent )
BASE_PROP_WSP_NAME, st_wsp_name,
NULL );
- application = NACT_APPLICATION( base_window_get_application( parent ));
- updater = nact_application_get_updater( application );
- settings = na_pivot_get_settings( NA_PIVOT( updater ));
-
- are_locked = na_settings_get_boolean( settings, NA_IPREFS_ADMIN_PREFERENCES_LOCKED, NULL, &mandatory );
+ are_locked = na_settings_get_boolean( NA_IPREFS_ADMIN_PREFERENCES_LOCKED, NULL, &mandatory );
editor->private->preferences_locked = are_locked && mandatory;
g_debug( "%s: are_locked=%s, mandatory=%s",
thisfn, are_locked ? "True":"False", mandatory ? "True":"False" );
@@ -377,9 +370,6 @@ static void
on_base_initialize_base_window( NactPreferencesEditor *editor )
{
static const gchar *thisfn = "nact_preferences_editor_on_base_initialize_base_window";
- NactApplication *application;
- NAUpdater *updater;
- NASettings *settings;
GtkWidget *container;
GQuark export_format;
GtkTreeView *listview;
@@ -390,37 +380,33 @@ on_base_initialize_base_window( NactPreferencesEditor *editor )
if( !editor->private->dispose_has_run ){
g_debug( "%s: editor=%p", thisfn, ( void * ) editor );
- application = NACT_APPLICATION( base_window_get_application( BASE_WINDOW( editor )));
- updater = nact_application_get_updater( application );
- settings = na_pivot_get_settings( NA_PIVOT( updater ));
-
/* first tab: runtime preferences
*/
- order_mode_setup( editor, NA_PIVOT( updater ));
- root_menu_setup( editor, settings );
- about_item_setup( editor, settings );
+ order_mode_setup( editor );
+ root_menu_setup( editor );
+ about_item_setup( editor );
/* second tab: runtime execution
*/
- terminal_prefix_setup( editor, settings );
- desktop_setup( editor, settings );
+ terminal_prefix_setup( editor );
+ desktop_setup( editor );
/* third tab: ui preferences
*/
- relabel_menu_setup( editor, settings );
- relabel_action_setup( editor, settings );
- relabel_profile_setup( editor, settings );
- esc_quit_setup( editor, settings );
- esc_confirm_setup( editor, settings );
- auto_save_setup( editor, settings );
+ relabel_menu_setup( editor );
+ relabel_action_setup( editor );
+ relabel_profile_setup( editor );
+ esc_quit_setup( editor );
+ esc_confirm_setup( editor );
+ auto_save_setup( editor );
/* fourth tab: import mode
*/
- import_mode_setup( editor, NA_PIVOT( updater ));
+ import_mode_setup( editor );
/* fifth tab: export format
*/
- export_format = na_iprefs_get_export_format( NA_PIVOT( updater ), NA_IPREFS_EXPORT_PREFERRED_FORMAT, &editor->private->export_format_mandatory );
+ export_format = na_iprefs_get_export_format( NA_IPREFS_EXPORT_PREFERRED_FORMAT, &editor->private->export_format_mandatory );
container = base_window_get_widget( BASE_WINDOW( editor ), "PreferencesExportFormatVBox" );
nact_export_format_select( container, !editor->private->export_format_mandatory, export_format );
@@ -475,14 +461,14 @@ on_base_all_widgets_showed( NactPreferencesEditor *editor )
* then the radio group is sensitive, but not editable.
*/
static void
-order_mode_setup( NactPreferencesEditor *editor, NAPivot *pivot )
+order_mode_setup( NactPreferencesEditor *editor )
{
gboolean editable;
GtkWidget *alpha_asc_button, *alpha_desc_button, *manual_button;
GtkWidget *active_button;
GCallback active_handler;
- editor->private->order_mode = na_iprefs_get_order_mode( pivot, &editor->private->order_mode_mandatory );
+ editor->private->order_mode = na_iprefs_get_order_mode( &editor->private->order_mode_mandatory );
editable = !editor->private->preferences_locked && !editor->private->order_mode_mandatory;
alpha_asc_button = base_window_get_widget( BASE_WINDOW( editor ), "OrderAlphaAscButton" );
@@ -555,11 +541,11 @@ order_mode_on_toggled( NactPreferencesEditor *editor, GtkToggleButton *toggle_bu
* create a root menu
*/
static void
-root_menu_setup( NactPreferencesEditor *editor, NASettings *settings )
+root_menu_setup( NactPreferencesEditor *editor )
{
gboolean editable;
- editor->private->root_menu = na_settings_get_boolean( settings, NA_IPREFS_ITEMS_CREATE_ROOT_MENU, NULL, &editor->private->root_menu_mandatory );
+ editor->private->root_menu = na_settings_get_boolean( NA_IPREFS_ITEMS_CREATE_ROOT_MENU, NULL, &editor->private->root_menu_mandatory );
editable = !editor->private->preferences_locked && !editor->private->root_menu_mandatory;
base_gtk_utils_toggle_set_initial_state( BASE_WINDOW( editor ),
@@ -586,11 +572,11 @@ root_menu_on_toggled( GtkToggleButton *button, NactPreferencesEditor *editor )
* add an about item
*/
static void
-about_item_setup( NactPreferencesEditor *editor, NASettings *settings )
+about_item_setup( NactPreferencesEditor *editor )
{
gboolean editable;
- editor->private->about_item = na_settings_get_boolean( settings, NA_IPREFS_ITEMS_ADD_ABOUT_ITEM, NULL, &editor->private->about_item_mandatory );
+ editor->private->about_item = na_settings_get_boolean( NA_IPREFS_ITEMS_ADD_ABOUT_ITEM, NULL, &editor->private->about_item_mandatory );
editable = !editor->private->preferences_locked && !editor->private->about_item_mandatory;
base_gtk_utils_toggle_set_initial_state( BASE_WINDOW( editor ),
@@ -618,12 +604,12 @@ about_item_on_toggled( GtkToggleButton *button, NactPreferencesEditor *editor )
* the prefix to add to the command when execution mode is 'Terminal'
*/
static void
-terminal_prefix_setup( NactPreferencesEditor *editor, NASettings *settings )
+terminal_prefix_setup( NactPreferencesEditor *editor )
{
gboolean editable;
GtkWidget *entry;
- editor->private->terminal_prefix = na_settings_get_string( settings, NA_IPREFS_TERMINAL_PREFIX, NULL, &editor->private->terminal_prefix_mandatory );
+ editor->private->terminal_prefix = na_settings_get_string( NA_IPREFS_TERMINAL_PREFIX, NULL, &editor->private->terminal_prefix_mandatory );
editable = !editor->private->preferences_locked && !editor->private->terminal_prefix_mandatory;
entry = base_window_get_widget( BASE_WINDOW( editor ), "TerminalPrefixEntry" );
@@ -714,7 +700,7 @@ desktop_create_model( NactPreferencesEditor *editor )
}
static void
-desktop_setup( NactPreferencesEditor *editor, NASettings *settings )
+desktop_setup( NactPreferencesEditor *editor )
{
gboolean editable;
GtkWidget *combo;
@@ -722,7 +708,7 @@ desktop_setup( NactPreferencesEditor *editor, NASettings *settings )
guint i;
gint found;
- editor->private->desktop = na_settings_get_string( settings, NA_IPREFS_DESKTOP_ENVIRONMENT, NULL, &editor->private->desktop_mandatory );
+ editor->private->desktop = na_settings_get_string( NA_IPREFS_DESKTOP_ENVIRONMENT, NULL, &editor->private->desktop_mandatory );
editable = !editor->private->preferences_locked && !editor->private->desktop_mandatory;
combo = base_window_get_widget( BASE_WINDOW( editor ), "DesktopComboBox" );
@@ -768,11 +754,11 @@ desktop_on_changed( GtkComboBox *combo, NactPreferencesEditor *editor )
* relabel copied/paster menu ?
*/
static void
-relabel_menu_setup( NactPreferencesEditor *editor, NASettings *settings )
+relabel_menu_setup( NactPreferencesEditor *editor )
{
gboolean editable;
- editor->private->relabel_menu = na_settings_get_boolean( settings, NA_IPREFS_RELABEL_DUPLICATE_MENU, NULL, &editor->private->relabel_menu_mandatory );
+ editor->private->relabel_menu = na_settings_get_boolean( NA_IPREFS_RELABEL_DUPLICATE_MENU, NULL, &editor->private->relabel_menu_mandatory );
editable = !editor->private->preferences_locked && !editor->private->relabel_menu_mandatory;
base_gtk_utils_toggle_set_initial_state( BASE_WINDOW( editor ),
@@ -799,11 +785,11 @@ relabel_menu_on_toggled( GtkToggleButton *button, NactPreferencesEditor *editor
* add an about item
*/
static void
-relabel_action_setup( NactPreferencesEditor *editor, NASettings *settings )
+relabel_action_setup( NactPreferencesEditor *editor )
{
gboolean editable;
- editor->private->relabel_action = na_settings_get_boolean( settings, NA_IPREFS_RELABEL_DUPLICATE_ACTION, NULL, &editor->private->relabel_action_mandatory );
+ editor->private->relabel_action = na_settings_get_boolean( NA_IPREFS_RELABEL_DUPLICATE_ACTION, NULL, &editor->private->relabel_action_mandatory );
editable = !editor->private->preferences_locked && !editor->private->relabel_action_mandatory;
base_gtk_utils_toggle_set_initial_state( BASE_WINDOW( editor ),
@@ -830,11 +816,11 @@ relabel_action_on_toggled( GtkToggleButton *button, NactPreferencesEditor *edito
* add an about item
*/
static void
-relabel_profile_setup( NactPreferencesEditor *editor, NASettings *settings )
+relabel_profile_setup( NactPreferencesEditor *editor )
{
gboolean editable;
- editor->private->relabel_profile = na_settings_get_boolean( settings, NA_IPREFS_RELABEL_DUPLICATE_PROFILE, NULL, &editor->private->relabel_profile_mandatory );
+ editor->private->relabel_profile = na_settings_get_boolean( NA_IPREFS_RELABEL_DUPLICATE_PROFILE, NULL, &editor->private->relabel_profile_mandatory );
editable = !editor->private->preferences_locked && !editor->private->relabel_profile_mandatory;
base_gtk_utils_toggle_set_initial_state( BASE_WINDOW( editor ),
@@ -861,11 +847,11 @@ relabel_profile_on_toggled( GtkToggleButton *button, NactPreferencesEditor *edit
* whether Esc key quits the assistants
*/
static void
-esc_quit_setup( NactPreferencesEditor *editor, NASettings *settings )
+esc_quit_setup( NactPreferencesEditor *editor )
{
gboolean editable;
- editor->private->esc_quit = na_settings_get_boolean( settings, NA_IPREFS_ASSISTANT_ESC_QUIT, NULL, &editor->private->esc_quit_mandatory );
+ editor->private->esc_quit = na_settings_get_boolean( NA_IPREFS_ASSISTANT_ESC_QUIT, NULL, &editor->private->esc_quit_mandatory );
editable = !editor->private->preferences_locked && !editor->private->esc_quit_mandatory;
base_gtk_utils_toggle_set_initial_state( BASE_WINDOW( editor ),
@@ -896,11 +882,11 @@ esc_quit_on_toggled( GtkToggleButton *button, NactPreferencesEditor *editor )
* on 'Esc' key
*/
static void
-esc_confirm_setup( NactPreferencesEditor *editor, NASettings *settings )
+esc_confirm_setup( NactPreferencesEditor *editor )
{
gboolean editable;
- editor->private->esc_confirm = na_settings_get_boolean( settings, NA_IPREFS_ASSISTANT_ESC_CONFIRM, NULL, &editor->private->esc_confirm_mandatory );
+ editor->private->esc_confirm = na_settings_get_boolean( NA_IPREFS_ASSISTANT_ESC_CONFIRM, NULL, &editor->private->esc_confirm_mandatory );
editable = !editor->private->preferences_locked && !editor->private->esc_confirm_mandatory;
base_gtk_utils_toggle_set_initial_state( BASE_WINDOW( editor ),
@@ -927,17 +913,17 @@ esc_confirm_on_toggled( GtkToggleButton *button, NactPreferencesEditor *editor )
* add an about item
*/
static void
-auto_save_setup( NactPreferencesEditor *editor, NASettings *settings )
+auto_save_setup( NactPreferencesEditor *editor )
{
gboolean editable;
GtkWidget *spin_button;
GtkAdjustment *adjustment;
g_debug( "nact_preferences_editor_auto_save_setup" );
- editor->private->auto_save = na_settings_get_boolean( settings, NA_IPREFS_MAIN_SAVE_AUTO, NULL, &editor->private->auto_save_mandatory );
+ editor->private->auto_save = na_settings_get_boolean( NA_IPREFS_MAIN_SAVE_AUTO, NULL, &editor->private->auto_save_mandatory );
editable = !editor->private->preferences_locked && !editor->private->auto_save_mandatory;
- editor->private->auto_save_period = na_settings_get_uint( settings, NA_IPREFS_MAIN_SAVE_PERIOD, NULL, &editor->private->auto_save_period_mandatory );
+ editor->private->auto_save_period = na_settings_get_uint( NA_IPREFS_MAIN_SAVE_PERIOD, NULL, &editor->private->auto_save_period_mandatory );
spin_button = base_window_get_widget( BASE_WINDOW( editor ), "AutoSavePeriodicitySpinButton" );
adjustment = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin_button ));
gtk_adjustment_configure( adjustment, editor->private->auto_save_period, 1, 999, 1, 10, 0 );
@@ -992,7 +978,7 @@ auto_save_period_on_change_value( GtkSpinButton *spinbutton, NactPreferencesEdit
* preferred import mode
*/
static void
-import_mode_setup( NactPreferencesEditor *editor, NAPivot *pivot )
+import_mode_setup( NactPreferencesEditor *editor )
{
gboolean editable;
GtkWidget *ask_button, *override_button, *renumber_button, *noimport_button;
@@ -1000,7 +986,7 @@ import_mode_setup( NactPreferencesEditor *editor, NAPivot *pivot )
GCallback active_handler;
editor->private->import_mode = na_iprefs_get_import_mode(
- pivot, NA_IPREFS_IMPORT_PREFERRED_MODE, &editor->private->import_mode_mandatory );
+ NA_IPREFS_IMPORT_PREFERRED_MODE, &editor->private->import_mode_mandatory );
editable = !editor->private->preferences_locked && !editor->private->import_mode_mandatory;
ask_button = base_window_get_widget( BASE_WINDOW( editor ), "PrefsAskButton" );
@@ -1100,9 +1086,6 @@ static void
on_dialog_ok( BaseDialog *dialog )
{
NactPreferencesEditor *editor;
- NactApplication *application;
- NAUpdater *updater;
- NASettings *settings;
GtkWidget *container;
NAExportFormat *export_format;
@@ -1111,59 +1094,56 @@ on_dialog_ok( BaseDialog *dialog )
editor = NACT_PREFERENCES_EDITOR( dialog );
if( !editor->private->preferences_locked ){
- application = NACT_APPLICATION( base_window_get_application( BASE_WINDOW( editor )));
- updater = nact_application_get_updater( application );
- settings = na_pivot_get_settings( NA_PIVOT( updater ));
/* first tab: runtime preferences
*/
if( !editor->private->order_mode_mandatory ){
- na_iprefs_set_order_mode( NA_PIVOT( updater ), editor->private->order_mode );
+ na_iprefs_set_order_mode( editor->private->order_mode );
}
if( !editor->private->root_menu_mandatory ){
- na_settings_set_boolean( settings, NA_IPREFS_ITEMS_CREATE_ROOT_MENU, editor->private->root_menu );
+ na_settings_set_boolean( NA_IPREFS_ITEMS_CREATE_ROOT_MENU, editor->private->root_menu );
}
if( !editor->private->about_item_mandatory ){
- na_settings_set_boolean( settings, NA_IPREFS_ITEMS_ADD_ABOUT_ITEM, editor->private->about_item );
+ na_settings_set_boolean( NA_IPREFS_ITEMS_ADD_ABOUT_ITEM, editor->private->about_item );
}
/* second tab: runtime execution
*/
if( !editor->private->terminal_prefix_mandatory ){
- na_settings_set_string( settings, NA_IPREFS_TERMINAL_PREFIX, editor->private->terminal_prefix );
+ na_settings_set_string( NA_IPREFS_TERMINAL_PREFIX, editor->private->terminal_prefix );
}
if( !editor->private->desktop_mandatory ){
- na_settings_set_string( settings, NA_IPREFS_DESKTOP_ENVIRONMENT, editor->private->desktop );
+ na_settings_set_string( NA_IPREFS_DESKTOP_ENVIRONMENT, editor->private->desktop );
}
/* third tab: ui preferences
*/
if( !editor->private->relabel_menu_mandatory ){
- na_settings_set_boolean( settings, NA_IPREFS_RELABEL_DUPLICATE_MENU, editor->private->relabel_menu );
+ na_settings_set_boolean( NA_IPREFS_RELABEL_DUPLICATE_MENU, editor->private->relabel_menu );
}
if( !editor->private->relabel_action_mandatory ){
- na_settings_set_boolean( settings, NA_IPREFS_RELABEL_DUPLICATE_ACTION, editor->private->relabel_action );
+ na_settings_set_boolean( NA_IPREFS_RELABEL_DUPLICATE_ACTION, editor->private->relabel_action );
}
if( !editor->private->relabel_profile_mandatory ){
- na_settings_set_boolean( settings, NA_IPREFS_RELABEL_DUPLICATE_PROFILE, editor->private->relabel_profile );
+ na_settings_set_boolean( NA_IPREFS_RELABEL_DUPLICATE_PROFILE, editor->private->relabel_profile );
}
if( !editor->private->esc_quit_mandatory ){
- na_settings_set_boolean( settings, NA_IPREFS_ASSISTANT_ESC_QUIT, editor->private->esc_quit );
+ na_settings_set_boolean( NA_IPREFS_ASSISTANT_ESC_QUIT, editor->private->esc_quit );
}
if( !editor->private->esc_confirm_mandatory ){
- na_settings_set_boolean( settings, NA_IPREFS_ASSISTANT_ESC_CONFIRM, editor->private->esc_confirm );
+ na_settings_set_boolean( NA_IPREFS_ASSISTANT_ESC_CONFIRM, editor->private->esc_confirm );
}
if( !editor->private->auto_save_mandatory ){
- na_settings_set_boolean( settings, NA_IPREFS_MAIN_SAVE_AUTO, editor->private->auto_save );
+ na_settings_set_boolean( NA_IPREFS_MAIN_SAVE_AUTO, editor->private->auto_save );
}
if( !editor->private->auto_save_period_mandatory ){
- na_settings_set_uint( settings, NA_IPREFS_MAIN_SAVE_PERIOD, editor->private->auto_save_period );
+ na_settings_set_uint( NA_IPREFS_MAIN_SAVE_PERIOD, editor->private->auto_save_period );
}
/* fourth tab: import mode
*/
if( !editor->private->import_mode_mandatory ){
- na_iprefs_set_import_mode( NA_PIVOT( updater ), NA_IPREFS_IMPORT_PREFERRED_MODE, editor->private->import_mode );
+ na_iprefs_set_import_mode( NA_IPREFS_IMPORT_PREFERRED_MODE, editor->private->import_mode );
}
/* fifth tab: export format
@@ -1171,8 +1151,7 @@ on_dialog_ok( BaseDialog *dialog )
if( !editor->private->export_format_mandatory ){
container = base_window_get_widget( BASE_WINDOW( editor ), "PreferencesExportFormatVBox" );
export_format = nact_export_format_get_selected( container );
- na_iprefs_set_export_format(
- NA_PIVOT( updater ), NA_IPREFS_EXPORT_PREFERRED_FORMAT, na_export_format_get_quark( export_format ));
+ na_iprefs_set_export_format( NA_IPREFS_EXPORT_PREFERRED_FORMAT, na_export_format_get_quark( export_format ));
}
/* sixth tab: list of default schemes
diff --git a/src/nact/nact-providers-list.c b/src/nact/nact-providers-list.c
index 72ed642..5f8a15e 100644
--- a/src/nact/nact-providers-list.c
+++ b/src/nact/nact-providers-list.c
@@ -78,7 +78,6 @@ typedef struct {
/* some data needed when saving the list store
*/
typedef struct {
- NASettings *settings;
GSList *order;
}
ProvidersListSaveData;
@@ -353,21 +352,13 @@ void
nact_providers_list_save( BaseWindow *window )
{
static const gchar *thisfn = "nact_providers_list_save";
- NactApplication *application;
- NAUpdater *updater;
GtkTreeView *treeview;
GtkTreeModel *model;
ProvidersListSaveData *plsd;
- NASettings *settings;
g_debug( "%s: window=%p", thisfn, ( void * ) window );
- application = NACT_APPLICATION( base_window_get_application( window ));
- updater = nact_application_get_updater( application );
- settings = na_pivot_get_settings( NA_PIVOT( updater ));
-
plsd = g_new0( ProvidersListSaveData, 1 );
- plsd->settings = settings;
plsd->order = NULL;
treeview = GTK_TREE_VIEW( g_object_get_data( G_OBJECT( window ), PROVIDERS_LIST_TREEVIEW ));
@@ -375,7 +366,7 @@ nact_providers_list_save( BaseWindow *window )
gtk_tree_model_foreach( model, ( GtkTreeModelForeachFunc ) providers_list_save_iter, plsd );
plsd->order = g_slist_reverse( plsd->order );
- na_settings_set_string_list( settings, NA_IPREFS_IO_PROVIDERS_WRITE_ORDER, plsd->order );
+ na_settings_set_string_list( NA_IPREFS_IO_PROVIDERS_WRITE_ORDER, plsd->order );
na_core_utils_slist_free( plsd->order );
g_free( plsd );
@@ -397,8 +388,8 @@ providers_list_save_iter( GtkTreeModel *model, GtkTreePath *path, GtkTreeIter* i
-1 );
group = g_strdup_printf( "%s %s", NA_IPREFS_IO_PROVIDER_GROUP, id );
- na_settings_set_boolean_ex( plsd->settings, group, NA_IPREFS_IO_PROVIDER_READABLE, readable );
- na_settings_set_boolean_ex( plsd->settings, group, NA_IPREFS_IO_PROVIDER_WRITABLE, writable );
+ na_settings_set_boolean_ex( group, NA_IPREFS_IO_PROVIDER_READABLE, readable );
+ na_settings_set_boolean_ex( group, NA_IPREFS_IO_PROVIDER_WRITABLE, writable );
g_free( group );
plsd->order = g_slist_prepend( plsd->order, g_strdup( id ));
@@ -448,9 +439,6 @@ on_selection_changed( GtkTreeSelection *selection, BaseWindow *window )
gboolean may_up, may_down;
gboolean order_mandatory;
GSList *write_order;
- NactApplication *application;
- NAUpdater *updater;
- NASettings *settings;
ProvidersListData *data;
GtkTreeView *treeview;
@@ -463,10 +451,7 @@ on_selection_changed( GtkTreeSelection *selection, BaseWindow *window )
treeview = GTK_TREE_VIEW( g_object_get_data( G_OBJECT( window ), PROVIDERS_LIST_TREEVIEW ));
data = get_providers_list_data( treeview );
- application = NACT_APPLICATION( base_window_get_application( window ));
- updater = nact_application_get_updater( application );
- settings = na_pivot_get_settings( NA_PIVOT( updater ));
- write_order = na_settings_get_string_list( settings, NA_IPREFS_IO_PROVIDERS_WRITE_ORDER, NULL, &order_mandatory );
+ write_order = na_settings_get_string_list( NA_IPREFS_IO_PROVIDERS_WRITE_ORDER, NULL, &order_mandatory );
if( !data->preferences_locked &&
!order_mandatory &&
diff --git a/src/nact/nact-schemes-list.c b/src/nact/nact-schemes-list.c
index 348d06c..46c45a3 100644
--- a/src/nact/nact-schemes-list.c
+++ b/src/nact/nact-schemes-list.c
@@ -264,16 +264,9 @@ static GSList *
init_view_get_default_list( SchemesListData *data )
{
GSList *list = NULL;
- NactApplication *application;
- NAUpdater *updater;
- NASettings *settings;
gboolean mandatory;
- application = NACT_APPLICATION( base_window_get_application( data->window ));
- updater = nact_application_get_updater( application );
- settings = na_pivot_get_settings( NA_PIVOT( updater ));
-
- list = na_settings_get_string_list( settings, NA_IPREFS_SCHEME_DEFAULT_LIST, NULL, &mandatory );
+ list = na_settings_get_string_list( NA_IPREFS_SCHEME_DEFAULT_LIST, NULL, &mandatory );
if( !list ){
list = init_view_get_default_default_list( data );
}
@@ -507,18 +500,11 @@ nact_schemes_list_save_defaults( BaseWindow *window )
{
GtkTreeView *treeview;
GSList *schemes;
- NactApplication *application;
- NAUpdater *updater;
- NASettings *settings;
treeview = GTK_TREE_VIEW( g_object_get_data( G_OBJECT( window ), SCHEMES_LIST_TREEVIEW ));
schemes = get_list_schemes( treeview );
- application = NACT_APPLICATION( base_window_get_application( window ));
- updater = nact_application_get_updater( application );
- settings = na_pivot_get_settings( NA_PIVOT( updater ));
-
- na_settings_set_string_list( settings, NA_IPREFS_SCHEME_DEFAULT_LIST, schemes );
+ na_settings_set_string_list( NA_IPREFS_SCHEME_DEFAULT_LIST, schemes );
na_core_utils_slist_free( schemes );
}
diff --git a/src/nact/nact-sort-buttons.c b/src/nact/nact-sort-buttons.c
index 49483cf..4758707 100644
--- a/src/nact/nact-sort-buttons.c
+++ b/src/nact/nact-sort-buttons.c
@@ -253,7 +253,6 @@ on_base_initialize_buttons( BaseWindow *window, gpointer user_data )
static const gchar *thisfn = "nact_sort_buttons_on_base_initialize_buttons";
NactSortButtons *sort_buttons;
gint i;
- NASettings *settings;
g_return_if_fail( BASE_IS_WINDOW( window ));
@@ -268,8 +267,7 @@ on_base_initialize_buttons( BaseWindow *window, gpointer user_data )
G_OBJECT( st_toggle_group[i].button ), "toggled", G_CALLBACK( on_toggle_button_toggled ));
}
- settings = na_pivot_get_settings( NA_PIVOT( sort_buttons->private->updater ));
- na_settings_register_key_callback( settings,
+ na_settings_register_key_callback(
NA_IPREFS_ITEMS_LIST_ORDER_MODE, G_CALLBACK( on_settings_order_mode_changed ), sort_buttons );
/* for now, disable the sort buttons
@@ -311,8 +309,7 @@ on_toggle_button_toggled( GtkToggleButton *toggled_button, BaseWindow *window )
}
gtk_toggle_button_set_active( toggled_button, TRUE );
sort_buttons->private->active = ibtn;
- na_iprefs_set_order_mode(
- NA_PIVOT( sort_buttons->private->updater ), st_toggle_group[ibtn].order_mode );
+ na_iprefs_set_order_mode( st_toggle_group[ibtn].order_mode );
}
sort_buttons->private->toggling = FALSE;
@@ -404,7 +401,7 @@ enable_buttons( const NactSortButtons *sort_buttons, gboolean enabled )
}
if( finally_enabled && sort_buttons->private->active == -1 ){
- order_mode = na_iprefs_get_order_mode( NA_PIVOT( sort_buttons->private->updater ), NULL );
+ order_mode = na_iprefs_get_order_mode( NULL );
i = toggle_group_get_from_mode( order_mode );
gtk_toggle_button_set_active( st_toggle_group[i].button, TRUE );
}
diff --git a/src/nact/nact-tree-model-dnd.c b/src/nact/nact-tree-model-dnd.c
index eeaf35b..e9e1eb3 100644
--- a/src/nact/nact-tree-model-dnd.c
+++ b/src/nact/nact-tree-model-dnd.c
@@ -886,7 +886,7 @@ drop_uri_list( NactTreeModel *model, GtkTreePath *dest, GtkSelectionData *selec
parms.parent = base_window_get_gtk_toplevel( BASE_WINDOW( main_window ));
parms.uris = g_slist_reverse( na_core_utils_slist_from_split( selection_data_data, "\r\n" ));
- parms.mode = na_iprefs_get_import_mode( NA_PIVOT( updater ), NA_IPREFS_IMPORT_PREFERRED_MODE, NULL );
+ parms.mode = na_iprefs_get_import_mode( NA_IPREFS_IMPORT_PREFERRED_MODE, NULL );
parms.check_fn = ( NAIImporterCheckFn ) is_dropped_already_exists;
parms.check_fn_data = main_window;
diff --git a/src/nact/nact-tree-model.c b/src/nact/nact-tree-model.c
index 165ac0f..8a77efe 100644
--- a/src/nact/nact-tree-model.c
+++ b/src/nact/nact-tree-model.c
@@ -307,8 +307,6 @@ nact_tree_model_new( BaseWindow *window, GtkTreeView *treeview, NactTreeMode mod
static const gchar *thisfn = "nact_tree_model_new";
GtkTreeStore *ts_model;
NactTreeModel *model;
- NactApplication *application;
- NAUpdater *updater;
gint order_mode;
g_return_val_if_fail( BASE_IS_WINDOW( window ), NULL );
@@ -328,9 +326,7 @@ nact_tree_model_new( BaseWindow *window, GtkTreeView *treeview, NactTreeMode mod
/* initialize the sortable interface
*/
- application = NACT_APPLICATION( base_window_get_application( window ));
- updater = nact_application_get_updater( application );
- order_mode = na_iprefs_get_order_mode( NA_PIVOT( updater ), NULL );
+ order_mode = na_iprefs_get_order_mode( NULL );
display_order_change( model, order_mode );
/* setup instanciation time data
@@ -371,9 +367,6 @@ static void
on_initialize_model( BaseWindow *window, gpointer user_data )
{
static const gchar *thisfn = "nact_tree_model_on_initialize_model";
- NactApplication *application;
- NAUpdater *updater;
- NASettings *settings;
WINDOW_MODEL_VOID( window );
@@ -407,10 +400,7 @@ on_initialize_model( BaseWindow *window, gpointer user_data )
base_window_signal_connect( window,
G_OBJECT( model->private->treeview ), "drag-end", G_CALLBACK( nact_tree_model_dnd_on_drag_end ));
- application = NACT_APPLICATION( base_window_get_application( window ));
- updater = nact_application_get_updater( application );
- settings = na_pivot_get_settings( NA_PIVOT( updater ));
- na_settings_register_key_callback( settings, NA_IPREFS_ITEMS_LIST_ORDER_MODE, G_CALLBACK( on_settings_order_mode_changed ), model );
+ na_settings_register_key_callback( NA_IPREFS_ITEMS_LIST_ORDER_MODE, G_CALLBACK( on_settings_order_mode_changed ), model );
base_window_signal_connect( window,
G_OBJECT( window ), TAB_UPDATABLE_SIGNAL_ITEM_UPDATED, G_CALLBACK( on_tab_updatable_item_updated ));
diff --git a/src/plugin-menu/nautilus-actions.c b/src/plugin-menu/nautilus-actions.c
index 039b163..5e8a365 100644
--- a/src/plugin-menu/nautilus-actions.c
+++ b/src/plugin-menu/nautilus-actions.c
@@ -67,12 +67,9 @@ struct _NautilusActionsPrivate {
NATimeout change_timeout;
};
-static GObjectClass *st_parent_class = NULL;
-static GType st_actions_type = 0;
-static gint st_burst_timeout = 100; /* burst timeout in msec */
-
-/* used in order to be able to get settings from the module */
-static NautilusActions *st_plugin = NULL;
+static GObjectClass *st_parent_class = NULL;
+static GType st_actions_type = 0;
+static gint st_burst_timeout = 100; /* burst timeout in msec */
static void class_init( NautilusActionsClass *klass );
static void instance_init( GTypeInstance *instance, gpointer klass );
@@ -179,7 +176,6 @@ instance_init( GTypeInstance *instance, gpointer klass )
thisfn, ( void * ) instance, G_OBJECT_TYPE_NAME( instance ), ( void * ) klass );
self = NAUTILUS_ACTIONS( instance );
- st_plugin = self;
self->private = g_new0( NautilusActionsPrivate, 1 );
@@ -206,7 +202,6 @@ instance_constructed( GObject *object )
{
static const gchar *thisfn = "nautilus_actions_instance_constructed";
NautilusActions *self;
- NASettings *settings;
g_return_if_fail( NAUTILUS_IS_ACTIONS( object ));
@@ -233,17 +228,15 @@ instance_constructed( GObject *object )
* because we only monitor here four runtime keys, we prefer the
* callback way that the signal one
*/
- settings = na_pivot_get_settings( self->private->pivot );
-
- na_settings_register_key_callback( settings,
+ na_settings_register_key_callback(
NA_IPREFS_IO_PROVIDERS_READ_STATUS, G_CALLBACK( on_settings_key_changed_handler ), self );
- na_settings_register_key_callback( settings,
+ na_settings_register_key_callback(
NA_IPREFS_ITEMS_ADD_ABOUT_ITEM, G_CALLBACK( on_settings_key_changed_handler ), self );
- na_settings_register_key_callback( settings,
+ na_settings_register_key_callback(
NA_IPREFS_ITEMS_CREATE_ROOT_MENU, G_CALLBACK( on_settings_key_changed_handler ), self );
- na_settings_register_key_callback( settings,
+ na_settings_register_key_callback(
NA_IPREFS_ITEMS_LEVEL_ZERO_ORDER, G_CALLBACK( on_settings_key_changed_handler ), self );
- na_settings_register_key_callback( settings,
+ na_settings_register_key_callback(
NA_IPREFS_ITEMS_LIST_ORDER_MODE, G_CALLBACK( on_settings_key_changed_handler ), self );
/* chain up to the parent class */
@@ -266,7 +259,6 @@ instance_dispose( GObject *object )
if( !self->private->dispose_has_run ){
self->private->dispose_has_run = TRUE;
- st_plugin = NULL;
if( self->private->items_changed_handler ){
g_signal_handler_disconnect( self->private->pivot, self->private->items_changed_handler );
@@ -301,19 +293,7 @@ instance_finalize( GObject *object )
gboolean
nautilus_action_is_log_enabled( void )
{
- gboolean log_ok;
- NASettings *settings;
-
- log_ok = FALSE;
-
- if( st_plugin ){
- g_return_val_if_fail( NAUTILUS_IS_ACTIONS( st_plugin ), FALSE );
-
- settings = na_pivot_get_settings( st_plugin->private->pivot );
- log_ok = na_settings_get_boolean( settings, NA_IPREFS_PLUGIN_LOG, NULL, NULL );
- }
-
- return( log_ok );
+ return( na_settings_get_boolean( NA_IPREFS_PLUGIN_LOG, NULL, NULL ));
}
static void
@@ -464,7 +444,6 @@ get_menus_items( NautilusActions *plugin, guint target, GList *selection )
GList *menus_list;
NATokens *tokens;
GList *pivot_tree, *copy_tree;
- NASettings *settings;
gboolean items_add_about_item;
gboolean items_create_root_menu;
@@ -481,14 +460,12 @@ get_menus_items( NautilusActions *plugin, guint target, GList *selection )
if( target != ITEM_TARGET_TOOLBAR ){
- settings = na_pivot_get_settings( plugin->private->pivot );
-
- items_create_root_menu = na_settings_get_boolean( settings, NA_IPREFS_ITEMS_CREATE_ROOT_MENU, NULL, NULL );
+ items_create_root_menu = na_settings_get_boolean( NA_IPREFS_ITEMS_CREATE_ROOT_MENU, NULL, NULL );
if( items_create_root_menu ){
menus_list = create_root_menu( plugin, menus_list );
}
- items_add_about_item = na_settings_get_boolean( settings, NA_IPREFS_ITEMS_ADD_ABOUT_ITEM, NULL, NULL );
+ items_add_about_item = na_settings_get_boolean( NA_IPREFS_ITEMS_ADD_ABOUT_ITEM, NULL, NULL );
if( items_add_about_item ){
menus_list = add_about_item( plugin, menus_list );
}
@@ -888,7 +865,7 @@ execute_action( NautilusMenuItem *item, NAObjectProfile *profile )
g_debug( "%s: item=%p, profile=%p", thisfn, ( void * ) item, ( void * ) profile );
tokens = NA_TOKENS( g_object_get_data( G_OBJECT( item ), "nautilus-actions-tokens" ));
- na_tokens_execute_action( tokens, na_pivot_get_settings( st_plugin->private->pivot ), profile );
+ na_tokens_execute_action( tokens, profile );
}
/*
diff --git a/src/utils/nautilus-actions-run.c b/src/utils/nautilus-actions-run.c
index 08698e0..386f442 100644
--- a/src/utils/nautilus-actions-run.c
+++ b/src/utils/nautilus-actions-run.c
@@ -70,15 +70,13 @@ static GOptionEntry misc_entries[] = {
{ NULL }
};
-static NAPivot *st_pivot = NULL;
-
static GOptionContext *init_options( void );
static NAObjectAction *get_action( const gchar *id );
static GList *targets_from_selection( void );
static GList *targets_from_commandline( void );
static GList *get_selection_from_strv( const gchar **strv, gboolean has_mimetype );
static NAObjectProfile *get_profile_for_targets( NAObjectAction *action, GList *targets );
-static void execute_action( NAObjectAction *action, NAObjectProfile *profile, GList *targets, const NASettings *settings );
+static void execute_action( NAObjectAction *action, NAObjectProfile *profile, GList *targets );
static void dump_targets( GList *targets );
static void exit_with_usage( void );
@@ -172,7 +170,7 @@ main( int argc, char** argv )
}
g_debug( "%s: profile %p found", thisfn, ( void * ) profile );
- execute_action( action, profile, targets, na_pivot_get_settings( st_pivot ));
+ execute_action( action, profile, targets );
na_selected_info_free_list( targets );
exit( status );
@@ -221,15 +219,16 @@ init_options( void )
static NAObjectAction *
get_action( const gchar *id )
{
+ NAPivot *pivot;
NAObjectAction *action;
action = NULL;
- st_pivot = na_pivot_new();
- na_pivot_set_loadable( st_pivot, !PIVOT_LOAD_DISABLED & !PIVOT_LOAD_INVALID );
- na_pivot_load_items( st_pivot );
+ pivot = na_pivot_new();
+ na_pivot_set_loadable( pivot, !PIVOT_LOAD_DISABLED & !PIVOT_LOAD_INVALID );
+ na_pivot_load_items( pivot );
- action = ( NAObjectAction * ) na_pivot_get_item( st_pivot, id );
+ action = ( NAObjectAction * ) na_pivot_get_item( pivot, id );
if( !action ){
g_printerr( _( "Error: action '%s' doesn't exist.\n" ), id );
@@ -392,13 +391,13 @@ get_profile_for_targets( NAObjectAction *action, GList *targets )
}
static void
-execute_action( NAObjectAction *action, NAObjectProfile *profile, GList *targets, const NASettings *settings )
+execute_action( NAObjectAction *action, NAObjectProfile *profile, GList *targets )
{
/*static const gchar *thisfn = "nautilus_action_run_execute_action";*/
NATokens *tokens;
tokens = na_tokens_new_from_selection( targets );
- na_tokens_execute_action( tokens, settings, profile );
+ na_tokens_execute_action( tokens, profile );
}
/*
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]