[nautilus-actions: 9/30] Merge common/na-iprefs.{c, h} into runtime/na-iprefs.{c, h}
- From: Pierre Wieser <pwieser src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [nautilus-actions: 9/30] Merge common/na-iprefs.{c, h} into runtime/na-iprefs.{c, h}
- Date: Sat, 21 Nov 2009 18:02:00 +0000 (UTC)
commit 25a2c44bd939e7be14c9b0c76756b1f8738cdd63
Author: Pierre Wieser <pwieser trychlos org>
Date: Wed Nov 18 23:19:06 2009 +0100
Merge common/na-iprefs.{c,h} into runtime/na-iprefs.{c,h}
ChangeLog | 36 +++-
nautilus-actions/common/Makefile.am | 2 -
nautilus-actions/common/na-iprefs.c | 262 ---------------------
nautilus-actions/common/na-iprefs.h | 105 --------
nautilus-actions/common/na-xml-writer.c | 3 +-
nautilus-actions/nact/base-iprefs.c | 3 +-
nautilus-actions/nact/nact-assistant-export-ask.c | 3 +-
nautilus-actions/nact/nact-assistant-export.c | 2 +-
nautilus-actions/nact/nact-assistant-import-ask.c | 3 +-
nautilus-actions/nact/nact-assistant-import.c | 2 +-
nautilus-actions/nact/nact-clipboard.c | 2 +-
nautilus-actions/nact/nact-iactions-list.c | 2 -
nautilus-actions/nact/nact-ibackground-tab.c | 2 +-
nautilus-actions/nact/nact-icommand-tab.c | 4 +-
nautilus-actions/nact/nact-main-menubar.c | 3 +-
nautilus-actions/nact/nact-main-window.c | 5 +-
nautilus-actions/nact/nact-preferences-editor.c | 2 +-
nautilus-actions/nact/nact-tree-model.c | 3 +-
nautilus-actions/nact/nact-window.c | 3 +-
nautilus-actions/nact/nact-xml-reader.c | 2 +-
nautilus-actions/runtime/Makefile.am | 1 -
nautilus-actions/runtime/na-gconf-keys.h | 47 ----
nautilus-actions/runtime/na-gconf-provider-keys.h | 2 +-
nautilus-actions/runtime/na-iprefs.c | 233 ++++++++++++++++++-
nautilus-actions/runtime/na-iprefs.h | 89 ++++++--
nautilus-actions/utils/nautilus-actions-new.c | 4 +-
nautilus-actions/utils/nautilus-actions-schemas.c | 3 +-
27 files changed, 359 insertions(+), 469 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 2b1def0..cc219d2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,40 @@
2009-11-18 Pierre Wieser <pwieser trychlos org>
- Merge common/na-object-* stuff to private/ subdirectory.
+ Merge common/na-iprefs.{c,h} into runtime/na-iprefs.{c,h}.
+
+ * nautilus-actions/common/na-iprefs.c:
+ * nautilus-actions/common/na-iprefs.h:
+ Merged into runtime/na-iprefs.{c,h}, thus deleted from common/.
+
+ * nautilus-actions/runtime/na-gconf-keys.h: Removed file
+ as duplicate from api/.
+
+ * nautilus-actions/common/Makefile.am:
+ * nautilus-actions/common/na-xml-writer.c:
+ * nautilus-actions/nact/base-iprefs.c:
+ * nautilus-actions/nact/nact-assistant-export-ask.c:
+ * nautilus-actions/nact/nact-assistant-export.c:
+ * nautilus-actions/nact/nact-assistant-import-ask.c:
+ * nautilus-actions/nact/nact-assistant-import.c:
+ * nautilus-actions/nact/nact-clipboard.c:
+ * nautilus-actions/nact/nact-iactions-list.c:
+ * nautilus-actions/nact/nact-ibackground-tab.c:
+ * nautilus-actions/nact/nact-icommand-tab.c:
+ * nautilus-actions/nact/nact-main-menubar.c:
+ * nautilus-actions/nact/nact-main-window.c:
+ * nautilus-actions/nact/nact-preferences-editor.c:
+ * nautilus-actions/nact/nact-tree-model.c:
+ * nautilus-actions/nact/nact-window.c:
+ * nautilus-actions/nact/nact-xml-reader.c:
+ * nautilus-actions/runtime/Makefile.am:
+ * nautilus-actions/runtime/na-gconf-provider-keys.h:
+ * nautilus-actions/runtime/na-iprefs.c:
+ * nautilus-actions/runtime/na-iprefs.h:
+ * nautilus-actions/utils/nautilus-actions-new.c:
+ * nautilus-actions/utils/nautilus-actions-schemas.c:
+ Updated accordingly.
+
+ Merge common/na-object-* stuff into private/ subdirectory.
* nautilus-actions/common/na-object-action-fn.h:
* nautilus-actions/common/na-object-action.c:
diff --git a/nautilus-actions/common/Makefile.am b/nautilus-actions/common/Makefile.am
index 110fa9c..e5ad27f 100644
--- a/nautilus-actions/common/Makefile.am
+++ b/nautilus-actions/common/Makefile.am
@@ -37,8 +37,6 @@ AM_CPPFLAGS += \
$(NULL)
libna_common_la_SOURCES = \
- na-iprefs.c \
- na-iprefs.h \
na-utils.c \
na-utils.h \
na-xml-names.h \
diff --git a/nautilus-actions/common/na-xml-writer.c b/nautilus-actions/common/na-xml-writer.c
index 644a6e9..920e715 100644
--- a/nautilus-actions/common/na-xml-writer.c
+++ b/nautilus-actions/common/na-xml-writer.c
@@ -35,11 +35,10 @@
#include <gio/gio.h>
#include <libxml/tree.h>
-#include <common/na-iprefs.h>
-
#include <private/na-object-api.h>
#include <runtime/na-gconf-provider-keys.h>
+#include <runtime/na-iprefs.h>
#include "na-utils.h"
#include "na-xml-names.h"
diff --git a/nautilus-actions/nact/base-iprefs.c b/nautilus-actions/nact/base-iprefs.c
index 4096cc1..8d6da2b 100644
--- a/nautilus-actions/nact/base-iprefs.c
+++ b/nautilus-actions/nact/base-iprefs.c
@@ -34,8 +34,7 @@
#endif
#include <runtime/na-gconf-utils.h>
-
-#include <common/na-iprefs.h>
+#include <runtime/na-iprefs.h>
#include "base-iprefs.h"
diff --git a/nautilus-actions/nact/nact-assistant-export-ask.c b/nautilus-actions/nact/nact-assistant-export-ask.c
index 16d7c59..9a4e2cf 100644
--- a/nautilus-actions/nact/nact-assistant-export-ask.c
+++ b/nautilus-actions/nact/nact-assistant-export-ask.c
@@ -34,10 +34,9 @@
#include <glib/gi18n.h>
-#include <common/na-iprefs.h>
-
#include <private/na-object-api.h>
+#include <runtime/na-iprefs.h>
#include <runtime/na-pivot.h>
#include "nact-application.h"
diff --git a/nautilus-actions/nact/nact-assistant-export.c b/nautilus-actions/nact/nact-assistant-export.c
index 9500c14..85b0b0d 100644
--- a/nautilus-actions/nact/nact-assistant-export.c
+++ b/nautilus-actions/nact/nact-assistant-export.c
@@ -36,7 +36,6 @@
#include <gtk/gtk.h>
#include <string.h>
-#include <common/na-iprefs.h>
#include <common/na-utils.h>
#include <common/na-xml-names.h>
#include <common/na-xml-writer.h>
@@ -44,6 +43,7 @@
#include <private/na-object-api.h>
#include <private/na-iduplicable.h>
+#include <runtime/na-iprefs.h>
#include <runtime/na-pivot.h>
#include "base-iprefs.h"
diff --git a/nautilus-actions/nact/nact-assistant-import-ask.c b/nautilus-actions/nact/nact-assistant-import-ask.c
index d4d4b54..dfbd348 100644
--- a/nautilus-actions/nact/nact-assistant-import-ask.c
+++ b/nautilus-actions/nact/nact-assistant-import-ask.c
@@ -34,10 +34,9 @@
#include <glib/gi18n.h>
-#include <common/na-iprefs.h>
-
#include <private/na-object-api.h>
+#include <runtime/na-iprefs.h>
#include <runtime/na-pivot.h>
#include "nact-application.h"
diff --git a/nautilus-actions/nact/nact-assistant-import.c b/nautilus-actions/nact/nact-assistant-import.c
index 79b832a..25f68c3 100644
--- a/nautilus-actions/nact/nact-assistant-import.c
+++ b/nautilus-actions/nact/nact-assistant-import.c
@@ -37,11 +37,11 @@
#include <gtk/gtk.h>
#include <string.h>
-#include <common/na-iprefs.h>
#include <common/na-utils.h>
#include <private/na-object-api.h>
+#include <runtime/na-iprefs.h>
#include <runtime/na-pivot.h>
#include "nact-application.h"
diff --git a/nautilus-actions/nact/nact-clipboard.c b/nautilus-actions/nact/nact-clipboard.c
index 38a03fb..888ecd8 100644
--- a/nautilus-actions/nact/nact-clipboard.c
+++ b/nautilus-actions/nact/nact-clipboard.c
@@ -35,13 +35,13 @@
#include <gtk/gtk.h>
#include <string.h>
-#include <common/na-iprefs.h>
#include <common/na-xml-names.h>
#include <common/na-xml-writer.h>
#include <common/na-utils.h>
#include <private/na-object-api.h>
+#include <runtime/na-iprefs.h>
#include <runtime/na-pivot.h>
#include "nact-application.h"
diff --git a/nautilus-actions/nact/nact-iactions-list.c b/nautilus-actions/nact/nact-iactions-list.c
index 3d142a6..537d4c1 100644
--- a/nautilus-actions/nact/nact-iactions-list.c
+++ b/nautilus-actions/nact/nact-iactions-list.c
@@ -35,8 +35,6 @@
#include <gdk/gdkkeysyms.h>
#include <string.h>
-#include <common/na-iprefs.h>
-
#include <private/na-object-api.h>
#include <private/na-iduplicable.h>
diff --git a/nautilus-actions/nact/nact-ibackground-tab.c b/nautilus-actions/nact/nact-ibackground-tab.c
index 2e90cb6..a83f392 100644
--- a/nautilus-actions/nact/nact-ibackground-tab.c
+++ b/nautilus-actions/nact/nact-ibackground-tab.c
@@ -36,11 +36,11 @@
#include <glib/gi18n.h>
#include <string.h>
-#include <common/na-iprefs.h>
#include <common/na-utils.h>
#include <private/na-object-api.h>
+#include <runtime/na-iprefs.h>
#include <runtime/na-pivot.h>
#include "base-iprefs.h"
diff --git a/nautilus-actions/nact/nact-icommand-tab.c b/nautilus-actions/nact/nact-icommand-tab.c
index 0a9a247..a2e7b25 100644
--- a/nautilus-actions/nact/nact-icommand-tab.c
+++ b/nautilus-actions/nact/nact-icommand-tab.c
@@ -35,11 +35,13 @@
#include <glib/gi18n.h>
#include <string.h>
-#include <common/na-iprefs.h>
#include <common/na-utils.h>
#include <private/na-object-api.h>
+#include <runtime/na-iprefs.h>
+#include <runtime/na-pivot.h>
+
#include "base-window.h"
#include "base-iprefs.h"
#include "nact-application.h"
diff --git a/nautilus-actions/nact/nact-main-menubar.c b/nautilus-actions/nact/nact-main-menubar.c
index d914d3e..b589659 100644
--- a/nautilus-actions/nact/nact-main-menubar.c
+++ b/nautilus-actions/nact/nact-main-menubar.c
@@ -34,11 +34,10 @@
#include <glib/gi18n.h>
-#include <common/na-iprefs.h>
-
#include <private/na-object-api.h>
#include <runtime/na-iabout.h>
+#include <runtime/na-iprefs.h>
#include <runtime/na-ipivot-consumer.h>
#include "nact-application.h"
diff --git a/nautilus-actions/nact/nact-main-window.c b/nautilus-actions/nact/nact-main-window.c
index 7f8a56f..93aa188 100644
--- a/nautilus-actions/nact/nact-main-window.c
+++ b/nautilus-actions/nact/nact-main-window.c
@@ -37,13 +37,12 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
-#include <common/na-iprefs.h>
-
#include <private/na-object-api.h>
-#include <runtime/na-pivot.h>
#include <runtime/na-iabout.h>
#include <runtime/na-ipivot-consumer.h>
+#include <runtime/na-iprefs.h>
+#include <runtime/na-pivot.h>
#include "base-iprefs.h"
#include "nact-application.h"
diff --git a/nautilus-actions/nact/nact-preferences-editor.c b/nautilus-actions/nact/nact-preferences-editor.c
index e0c5beb..6202f4c 100644
--- a/nautilus-actions/nact/nact-preferences-editor.c
+++ b/nautilus-actions/nact/nact-preferences-editor.c
@@ -34,7 +34,7 @@
#include <glib/gi18n.h>
-#include <common/na-iprefs.h>
+#include <runtime/na-iprefs.h>
#include "base-iprefs.h"
#include "nact-application.h"
diff --git a/nautilus-actions/nact/nact-tree-model.c b/nautilus-actions/nact/nact-tree-model.c
index 9d53d9b..2b96d41 100644
--- a/nautilus-actions/nact/nact-tree-model.c
+++ b/nautilus-actions/nact/nact-tree-model.c
@@ -34,12 +34,13 @@
#include <string.h>
-#include <common/na-iprefs.h>
#include <common/na-utils.h>
#include <common/na-xml-writer.h>
#include <private/na-object-api.h>
+#include <runtime/na-iprefs.h>
+
#include "egg-tree-multi-dnd.h"
#include "nact-application.h"
#include "nact-iactions-list.h"
diff --git a/nautilus-actions/nact/nact-window.c b/nautilus-actions/nact/nact-window.c
index 4dbc6ef..5207952 100644
--- a/nautilus-actions/nact/nact-window.c
+++ b/nautilus-actions/nact/nact-window.c
@@ -37,11 +37,12 @@
#include <api/na-iio-provider.h>
-#include <common/na-iprefs.h>
#include <common/na-utils.h>
#include <private/na-object-api.h>
+#include <runtime/na-iprefs.h>
+
#include "nact-application.h"
#include "nact-window.h"
diff --git a/nautilus-actions/nact/nact-xml-reader.c b/nautilus-actions/nact/nact-xml-reader.c
index f57ae4c..99c4154 100644
--- a/nautilus-actions/nact/nact-xml-reader.c
+++ b/nautilus-actions/nact/nact-xml-reader.c
@@ -38,7 +38,6 @@
#include <string.h>
#include <uuid/uuid.h>
-#include <common/na-iprefs.h>
#include <common/na-utils.h>
#include <common/na-xml-names.h>
@@ -46,6 +45,7 @@
#include <runtime/na-gconf-provider-keys.h>
#include <runtime/na-gconf-utils.h>
+#include <runtime/na-iprefs.h>
#include "nact-application.h"
#include "nact-main-window.h"
diff --git a/nautilus-actions/runtime/Makefile.am b/nautilus-actions/runtime/Makefile.am
index deae049..24718dd 100644
--- a/nautilus-actions/runtime/Makefile.am
+++ b/nautilus-actions/runtime/Makefile.am
@@ -38,7 +38,6 @@ AM_CPPFLAGS += \
$(NULL)
libna_runtime_la_SOURCES = \
- na-gconf-keys.h \
na-gconf-monitor.c \
na-gconf-monitor.h \
na-gconf-provider.c \
diff --git a/nautilus-actions/runtime/na-gconf-provider-keys.h b/nautilus-actions/runtime/na-gconf-provider-keys.h
index 54fc3bb..04149cd 100644
--- a/nautilus-actions/runtime/na-gconf-provider-keys.h
+++ b/nautilus-actions/runtime/na-gconf-provider-keys.h
@@ -31,7 +31,7 @@
#ifndef __NA_RUNTIME_GCONF_PROVIDER_KEYS_H__
#define __NA_RUNTIME_GCONF_PROVIDER_KEYS_H__
-#include "na-gconf-keys.h"
+#include <api/na-gconf-keys.h>
/* GConf general information
*/
diff --git a/nautilus-actions/runtime/na-iprefs.c b/nautilus-actions/runtime/na-iprefs.c
index fbbe93e..d8ec366 100644
--- a/nautilus-actions/runtime/na-iprefs.c
+++ b/nautilus-actions/runtime/na-iprefs.c
@@ -62,14 +62,38 @@ static GConfEnumStringPair order_mode_table[] = {
#define NA_IPREFS_PRIVATE_DATA "na-runtime-iprefs-private-data"
+#define DEFAULT_IMPORT_MODE_INT IPREFS_IMPORT_NO_IMPORT
+#define DEFAULT_IMPORT_MODE_STR "NoImport"
+
+static GConfEnumStringPair import_mode_table[] = {
+ { IPREFS_IMPORT_NO_IMPORT, DEFAULT_IMPORT_MODE_STR },
+ { IPREFS_IMPORT_RENUMBER, "Renumber" },
+ { IPREFS_IMPORT_OVERRIDE, "Override" },
+ { IPREFS_IMPORT_ASK, "Ask" },
+ { 0, NULL }
+};
+
+#define DEFAULT_EXPORT_FORMAT_INT IPREFS_EXPORT_FORMAT_GCONF_ENTRY
+#define DEFAULT_EXPORT_FORMAT_STR "GConfEntry"
+
+static GConfEnumStringPair export_format_table[] = {
+ { IPREFS_EXPORT_FORMAT_GCONF_SCHEMA_V1, "GConfSchemaV1" },
+ { IPREFS_EXPORT_FORMAT_GCONF_SCHEMA_V2, "GConfSchemaV2" },
+ { IPREFS_EXPORT_FORMAT_GCONF_ENTRY, DEFAULT_EXPORT_FORMAT_STR },
+ { IPREFS_EXPORT_FORMAT_ASK, "Ask" },
+ { 0, NULL }
+};
+
static gboolean st_initialized = FALSE;
static gboolean st_finalized = FALSE;
-static GType register_type( void );
-static void interface_base_init( NAIPrefsInterface *klass );
-static void interface_base_finalize( NAIPrefsInterface *klass );
+static GType register_type( void );
+static void interface_base_init( NAIPrefsInterface *klass );
+static void interface_base_finalize( NAIPrefsInterface *klass );
-static void setup_private_data( NAIPrefs *instance );
+static void setup_private_data( NAIPrefs *instance );
+static GConfValue *get_value( GConfClient *client, const gchar *path, const gchar *entry );
+static void set_value( GConfClient *client, const gchar *path, const gchar *entry, GConfValue *value );
GType
na_iprefs_get_type( void )
@@ -500,6 +524,160 @@ na_iprefs_write_string_list( NAIPrefs *instance, const gchar *name, GSList *list
g_free( path );
}
+/**
+ * na_iprefs_migrate_key:
+ * @instance: the #NAIPrefs implementor.
+ * @old_key: the old preference entry.
+ * @new_key: the new preference entry.
+ *
+ * Migrates the content of an entry from an obsoleted key to a new one.
+ * Removes the old key, along with the schema associated to it,
+ * considering that the version which asks for this migration has
+ * installed a schema corresponding to the new key.
+ */
+void
+na_iprefs_migrate_key( NAIPrefs *instance, const gchar *old_key, const gchar *new_key )
+{
+ static const gchar *thisfn = "na_iprefs_migrate_key";
+ GConfValue *value;
+
+ g_debug( "%s: instance=%p, old_key=%s, new_key=%s", thisfn, ( void * ) instance, old_key, new_key );
+ g_return_if_fail( NA_IS_IPREFS( instance ));
+
+ value = get_value( na_iprefs_get_gconf_client( instance ), NA_GCONF_PREFS_PATH, new_key );
+ if( !value ){
+ value = get_value( na_iprefs_get_gconf_client( instance ), NA_GCONF_PREFS_PATH, old_key );
+ if( value ){
+ set_value( na_iprefs_get_gconf_client( instance ), NA_GCONF_PREFS_PATH, new_key, value );
+ gconf_value_free( value );
+ }
+ }
+
+ /* do not remove entries which may be always used by another,
+ * while older, version of NACT
+ */
+ /*remove_entry( BASE_IPREFS_GET_INTERFACE( window )->private->client, NA_GCONF_PREFS_PATH, old_key );*/
+ /*remove_entry( BASE_IPREFS_GET_INTERFACE( window )->private->client, BASE_IPREFS_SCHEMAS_PATH, old_key );*/
+}
+
+/**
+ * na_iprefs_get_export_format:
+ * @instance: this #NAIPrefs interface instance.
+ * @name: name of the export format key to be readen
+ *
+ * Returns: the export format currently set.
+ *
+ * Note: this function returns a suitable default value even if the key
+ * is not found in GConf preferences or no schema has been installed.
+ *
+ * Note: please take care of keeping the default value synchronized with
+ * those defined in schemas.
+ */
+gint
+na_iprefs_get_export_format( NAIPrefs *instance, const gchar *name )
+{
+ gint export_format = DEFAULT_EXPORT_FORMAT_INT;
+ gint format_int;
+ gchar *format_str;
+
+ g_return_val_if_fail( NA_IS_IPREFS( instance ), DEFAULT_EXPORT_FORMAT_INT );
+
+ format_str = na_iprefs_read_string(
+ instance,
+ name,
+ DEFAULT_EXPORT_FORMAT_STR );
+
+ if( gconf_string_to_enum( export_format_table, format_str, &format_int )){
+ export_format = format_int;
+ }
+
+ g_free( format_str );
+
+ return( export_format );
+}
+
+/**
+ * na_iprefs_get_import_mode:
+ * @instance: this #NAIPrefs interface instance.
+ * @name: name of the import key to be readen
+ *
+ * Returns: the import mode currently set.
+ *
+ * Note: this function returns a suitable default value even if the key
+ * is not found in GConf preferences or no schema has been installed.
+ *
+ * Note: please take care of keeping the default value synchronized with
+ * those defined in schemas.
+ */
+gint
+na_iprefs_get_import_mode( NAIPrefs *instance, const gchar *name )
+{
+ gint import_mode = DEFAULT_IMPORT_MODE_INT;
+ gint import_int;
+ gchar *import_str;
+
+ g_return_val_if_fail( NA_IS_IPREFS( instance ), DEFAULT_IMPORT_MODE_INT );
+
+ import_str = na_iprefs_read_string(
+ instance,
+ name,
+ DEFAULT_IMPORT_MODE_STR );
+
+ if( gconf_string_to_enum( import_mode_table, import_str, &import_int )){
+ import_mode = import_int;
+ }
+
+ g_free( import_str );
+
+ return( import_mode );
+}
+
+/**
+ * na_iprefs_set_export_format:
+ * @instance: this #NAIPrefs interface instance.
+ * @format: the new value to be written.
+ *
+ * Writes the current status of 'import/export format' to the GConf
+ * preference system.
+ */
+void
+na_iprefs_set_export_format( NAIPrefs *instance, const gchar *name, gint format )
+{
+ const gchar *format_str;
+
+ g_return_if_fail( NA_IS_IPREFS( instance ));
+
+ format_str = gconf_enum_to_string( export_format_table, format );
+
+ na_iprefs_write_string(
+ instance,
+ name,
+ format_str ? format_str : DEFAULT_EXPORT_FORMAT_STR );
+}
+
+/**
+ * na_iprefs_set_import_mode:
+ * @instance: this #NAIPrefs interface instance.
+ * @mode: the new value to be written.
+ *
+ * Writes the current status of 'import mode' to the GConf
+ * preference system.
+ */
+void
+na_iprefs_set_import_mode( NAIPrefs *instance, const gchar *name, gint mode )
+{
+ const gchar *import_str;
+
+ g_return_if_fail( NA_IS_IPREFS( instance ));
+
+ import_str = gconf_enum_to_string( import_mode_table, mode );
+
+ na_iprefs_write_string(
+ instance,
+ name,
+ import_str ? import_str : DEFAULT_IMPORT_MODE_STR );
+}
+
static void
setup_private_data( NAIPrefs *instance )
{
@@ -512,3 +690,50 @@ setup_private_data( NAIPrefs *instance )
g_object_set_data( G_OBJECT( instance ), NA_IPREFS_PRIVATE_DATA, ipp );
}
}
+
+static GConfValue *
+get_value( GConfClient *client, const gchar *path, const gchar *entry )
+{
+ static const gchar *thisfn = "na_iprefs_get_value";
+ GError *error = NULL;
+ gchar *fullpath;
+ GConfValue *value;
+
+ fullpath = gconf_concat_dir_and_key( path, entry );
+
+ value = gconf_client_get_without_default( client, fullpath, &error );
+
+ if( error ){
+ g_warning( "%s: key=%s, %s", thisfn, fullpath, error->message );
+ g_error_free( error );
+ if( value ){
+ gconf_value_free( value );
+ value = NULL;
+ }
+ }
+
+ g_free( fullpath );
+
+ return( value );
+}
+
+static void
+set_value( GConfClient *client, const gchar *path, const gchar *entry, GConfValue *value )
+{
+ static const gchar *thisfn = "na_iprefs_set_value";
+ GError *error = NULL;
+ gchar *fullpath;
+
+ g_return_if_fail( value );
+
+ fullpath = gconf_concat_dir_and_key( path, entry );
+
+ gconf_client_set( client, fullpath, value, &error );
+
+ if( error ){
+ g_warning( "%s: key=%s, %s", thisfn, fullpath, error->message );
+ g_error_free( error );
+ }
+
+ g_free( fullpath );
+}
diff --git a/nautilus-actions/runtime/na-iprefs.h b/nautilus-actions/runtime/na-iprefs.h
index e448799..a7b447a 100644
--- a/nautilus-actions/runtime/na-iprefs.h
+++ b/nautilus-actions/runtime/na-iprefs.h
@@ -34,7 +34,7 @@
/**
* SECTION: na_iprefs
* @short_description: #NAIPrefs interface definition.
- * @include: common/na-iprefs.h
+ * @include: runtime/na-iprefs.h
*
* This interface should only be implemented by #NAPivot. This is
* because the interface stores as an implementor structure some data
@@ -70,7 +70,7 @@
#include <glib-object.h>
#include <gconf/gconf-client.h>
-#include "na-gconf-keys.h"
+#include <api/na-gconf-keys.h>
G_BEGIN_DECLS
@@ -89,6 +89,69 @@ typedef struct {
}
NAIPrefsInterface;
+/* GConf Preference keys managed by IPrefs interface
+ */
+#define NA_GCONF_PREFERENCES "preferences"
+#define NA_GCONF_PREFS_PATH NAUTILUS_ACTIONS_GCONF_BASEDIR "/" NA_GCONF_PREFERENCES
+
+#define IPREFS_LEVEL_ZERO_ITEMS "iprefs-level-zero"
+#define IPREFS_DISPLAY_ALPHABETICAL_ORDER "iprefs-alphabetical-order"
+#define IPREFS_CREATE_ROOT_MENU "iprefs-create-root-menu"
+#define IPREFS_ADD_ABOUT_ITEM "iprefs-add-about-item"
+
+#define IPREFS_EXPORT_FORMAT "export-format"
+#define IPREFS_EXPORT_ASK_LAST_FORMAT "export-ask-user-last-format"
+#define IPREFS_IMPORT_ACTIONS_IMPORT_MODE "import-mode"
+#define IPREFS_IMPORT_ASK_LAST_MODE "import-ask-user-last-mode"
+
+#define IPREFS_ASSIST_ESC_QUIT "assistant-esc-quit"
+#define IPREFS_ASSIST_ESC_CONFIRM "assistant-esc-confirm"
+
+#define IPREFS_RELABEL_MENUS "iprefs-relabel-menus"
+#define IPREFS_RELABEL_ACTIONS "iprefs-relabel-actions"
+#define IPREFS_RELABEL_PROFILES "iprefs-relabel-profiles"
+
+/* alphabetical order values
+ */
+enum {
+ IPREFS_ORDER_ALPHA_ASCENDING = 1,
+ IPREFS_ORDER_ALPHA_DESCENDING,
+ IPREFS_ORDER_MANUAL
+};
+
+/* import mode
+ */
+enum {
+ IPREFS_IMPORT_NO_IMPORT = 1,
+ IPREFS_IMPORT_RENUMBER,
+ IPREFS_IMPORT_OVERRIDE,
+ IPREFS_IMPORT_ASK
+};
+
+/* import/export formats
+ *
+ * FORMAT_GCONF_SCHEMA_V1: a schema with owner, short and long
+ * descriptions ; each action has its own schema addressed by the uuid
+ * (historical format up to v1.10.x serie)
+ *
+ * FORMAT_GCONF_SCHEMA_V2: the lightest schema still compatible
+ * with gconftool-2 --install-schema-file (no owner, no short nor long
+ * descriptions) - introduced in v 1.11
+ *
+ * FORMAT_GCONF_SCHEMA: exports a full schema, not an action
+ *
+ * FORMAT_GCONF_ENTRY: not a schema, but a dump of the GConf entry
+ * introduced in v 1.11
+ */
+enum {
+ IPREFS_EXPORT_NO_EXPORT = 1,
+ IPREFS_EXPORT_FORMAT_GCONF_SCHEMA_V1,
+ IPREFS_EXPORT_FORMAT_GCONF_SCHEMA_V2,
+ IPREFS_EXPORT_FORMAT_GCONF_SCHEMA,
+ IPREFS_EXPORT_FORMAT_GCONF_ENTRY,
+ IPREFS_EXPORT_FORMAT_ASK
+};
+
GType na_iprefs_get_type( void );
GSList *na_iprefs_get_level_zero_items( NAIPrefs *instance );
@@ -113,25 +176,13 @@ void na_iprefs_write_bool( NAIPrefs *instance, const gchar *key, gboolea
void na_iprefs_write_string( NAIPrefs *instance, const gchar *key, const gchar *value );
void na_iprefs_write_string_list( NAIPrefs *instance, const gchar *key, GSList *value );
-/* GConf keys
- */
-#define NA_GCONF_PREFERENCES "preferences"
-#define NA_GCONF_PREFS_PATH NAUTILUS_ACTIONS_GCONF_BASEDIR "/" NA_GCONF_PREFERENCES
+void na_iprefs_migrate_key( NAIPrefs *instance, const gchar *old_key, const gchar *new_key );
-/* GConf preference keys managed by IPrefs interface
- */
-#define IPREFS_LEVEL_ZERO_ITEMS "iprefs-level-zero"
-#define IPREFS_DISPLAY_ALPHABETICAL_ORDER "iprefs-alphabetical-order"
-#define IPREFS_CREATE_ROOT_MENU "iprefs-create-root-menu"
-#define IPREFS_ADD_ABOUT_ITEM "iprefs-add-about-item"
+gint na_iprefs_get_export_format( NAIPrefs *instance, const gchar *pref );
+gint na_iprefs_get_import_mode( NAIPrefs *instance, const gchar *pref );
-/* alphabetical order values
- */
-enum {
- IPREFS_ORDER_ALPHA_ASCENDING = 1,
- IPREFS_ORDER_ALPHA_DESCENDING,
- IPREFS_ORDER_MANUAL
-};
+void na_iprefs_set_export_format( NAIPrefs *instance, const gchar *pref, gint format );
+void na_iprefs_set_import_mode( NAIPrefs *instance, const gchar *pref, gint mode );
G_END_DECLS
diff --git a/nautilus-actions/utils/nautilus-actions-new.c b/nautilus-actions/utils/nautilus-actions-new.c
index 2666fcb..daa9362 100644
--- a/nautilus-actions/utils/nautilus-actions-new.c
+++ b/nautilus-actions/utils/nautilus-actions-new.c
@@ -38,15 +38,15 @@
#include <api/na-iio-provider.h>
-#include <common/na-iprefs.h>
#include <common/na-xml-names.h>
#include <common/na-xml-writer.h>
#include <common/na-utils.h>
#include <private/na-object-api.h>
-#include <runtime/na-io-provider.h>
#include <runtime/na-gconf-provider.h>
+#include <runtime/na-io-provider.h>
+#include <runtime/na-iprefs.h>
#include "console-utils.h"
diff --git a/nautilus-actions/utils/nautilus-actions-schemas.c b/nautilus-actions/utils/nautilus-actions-schemas.c
index d66a5e7..bad0933 100644
--- a/nautilus-actions/utils/nautilus-actions-schemas.c
+++ b/nautilus-actions/utils/nautilus-actions-schemas.c
@@ -38,11 +38,12 @@
#include <glib/gi18n.h>
#include <stdlib.h>
-#include <common/na-iprefs.h>
#include <common/na-xml-names.h>
#include <common/na-xml-writer.h>
#include <common/na-utils.h>
+#include <runtime/na-iprefs.h>
+
#include "console-utils.h"
/*static gchar *output_fname = NULL;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]