[nautilus-actions] Define NactIPrefs interface



commit c5db69d19d6b2d3ff35d4720396521c331e05ab4
Author: Pierre Wieser <pwieser trychlos org>
Date:   Mon Feb 15 21:15:21 2010 +0100

    Define NactIPrefs interface

 ChangeLog                    |    5 +
 src/core/Makefile.am         |    8 +-
 src/core/na-dbus-tracker.h   |    2 +-
 src/core/na-object-profile.c |    2 +-
 src/nact/Makefile.am         |  218 ++++++++++++++---------------
 src/nact/base-builder.c      |    4 +-
 src/nact/nact-iprefs.c       |  312 ++++++++++++++++++++++++++++++++++++++++++
 src/nact/nact-iprefs.h       |   86 ++++++++++++
 8 files changed, 516 insertions(+), 121 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 9092d8c..09e4ee8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2009-02-15 Pierre Wieser <pwieser trychlos org>
 
+	Define NactIPrefs interface.
+
+	* src/nact/nact-iprefs.c:
+	* src/nact/nact-iprefs.h: New files.
+
 	Update src/nact/
 	Remove useless src/private directory.
 
diff --git a/src/core/Makefile.am b/src/core/Makefile.am
index 888a84c..3df847e 100644
--- a/src/core/Makefile.am
+++ b/src/core/Makefile.am
@@ -43,6 +43,8 @@ libna_core_la_SOURCES = \
 	na-data-factory.c									\
 	na-data-factory.h									\
 	na-dbus-tracker.h									\
+	na-exporter.c										\
+	na-exporter.h										\
 	na-gconf-monitor.c									\
 	na-gconf-utils.c									\
 	na-iabout.c											\
@@ -57,6 +59,8 @@ libna_core_la_SOURCES = \
 	na-io-factory.h										\
 	na-io-provider.c									\
 	na-io-provider.h									\
+	na-importer.c										\
+	na-importer.h										\
 	na-ipivot-consumer.c								\
 	na-ipivot-consumer.h								\
 	na-iprefs.c											\
@@ -78,10 +82,6 @@ libna_core_la_SOURCES = \
 	na-pivot.h											\
 	na-updater.c										\
 	na-updater.h										\
-	\
-	na-xml-names.h										\
-	na-xml-writer.c										\
-	na-xml-writer.h										\
 	$(NULL)
 
 libna_core_la_LIBADD = \
diff --git a/src/core/na-dbus-tracker.h b/src/core/na-dbus-tracker.h
index 5592f23..9ae4669 100644
--- a/src/core/na-dbus-tracker.h
+++ b/src/core/na-dbus-tracker.h
@@ -39,7 +39,7 @@
 
 #include <glib-object.h>
 
-#include <api/na-dbus-names.h>
+#include <api/na-dbus.h>
 
 G_BEGIN_DECLS
 
diff --git a/src/core/na-object-profile.c b/src/core/na-object-profile.c
index 9dd9c1a..f31c073 100644
--- a/src/core/na-object-profile.c
+++ b/src/core/na-object-profile.c
@@ -44,7 +44,7 @@
 
 #include "na-io-factory.h"
 #include "na-data-factory.h"
-#include "na-dbus.h"
+#include "na-dbus-tracker.h"
 #include "na-gnome-vfs-uri.h"
 
 /* private class data
diff --git a/src/nact/Makefile.am b/src/nact/Makefile.am
index 0e59e78..6009aa2 100644
--- a/src/nact/Makefile.am
+++ b/src/nact/Makefile.am
@@ -27,115 +27,108 @@
 #   ... and many others (see AUTHORS)
 
 bin_PROGRAMS = \
-	nautilus-actions-config-tool								\
+	nautilus-actions-config-tool						\
 	$(NULL)
 
 egg_platform_defines = -DEGG_SM_CLIENT_BACKEND_XSMP
 
 AM_CPPFLAGS += \
-	-I $(top_srcdir)											\
-	-I $(top_srcdir)/nautilus-actions							\
-	-DGNOMELOCALEDIR=\""$(datadir)/locale"\"					\
-	-DPKGDATADIR=\"$(pkgdatadir)\"								\
-	-DG_LOG_DOMAIN=\"${NA_LOGDOMAIN_NACT}\"						\
-	$(egg_platform_defines)										\
-	$(NAUTILUS_ACTIONS_CFLAGS)									\
+	-I $(top_srcdir)									\
+	-DGNOMELOCALEDIR=\""$(datadir)/locale"\"			\
+	-DPKGDATADIR=\"$(pkgdatadir)\"						\
+	-DG_LOG_DOMAIN=\"${NA_LOGDOMAIN_NACT}\"				\
+	$(egg_platform_defines)								\
+	$(NAUTILUS_ACTIONS_CFLAGS)							\
 	$(NULL)
 
 BUILT_SOURCES = \
-	nact-marshal.c												\
-	nact-marshal.h												\
+	nact-marshal.c										\
+	nact-marshal.h										\
 	$(NULL)
 
 nautilus_actions_config_tool_SOURCES = \
-	base-application.c											\
-	base-application.h											\
-	base-application-class.h									\
-	base-assistant.c											\
-	base-assistant.h											\
-	base-builder.c												\
-	base-builder.h												\
-	base-dialog.c												\
-	base-dialog.h												\
-	base-iprefs.c												\
-	base-iprefs.h												\
-	base-window.c												\
-	base-window.h												\
-	base-window-class.h											\
-	egg-desktop-file.c											\
-	egg-desktop-file.h											\
-	egg-sm-client.c												\
-	egg-sm-client.h												\
-	egg-sm-client-private.h										\
-	egg-sm-client-xsmp.c										\
-	egg-tree-multi-dnd.c										\
-	egg-tree-multi-dnd.h										\
-	na-exporter.c												\
-	na-exporter.h												\
-	na-iexporter.c												\
-	na-importer.c												\
-	na-importer.h												\
-	na-iimporter.c												\
-	nact-application.c											\
-	nact-application.h											\
-	nact-assistant-export.c										\
-	nact-assistant-export.h										\
-	nact-assistant-export-ask.c									\
-	nact-assistant-export-ask.h									\
-	nact-assistant-import.c										\
-	nact-assistant-import.h										\
-	nact-assistant-import-ask.c									\
-	nact-assistant-import-ask.h									\
-	nact-clipboard.c											\
-	nact-clipboard.h											\
-	nact-confirm-logout.c										\
-	nact-confirm-logout.h										\
-	nact-gtk-utils.c											\
-	nact-gtk-utils.h											\
-	nact-iactions-list.c										\
-	nact-iactions-list.h										\
-	nact-iactions-list-bis.c									\
-	nact-iactions-list-priv.c									\
-	nact-iactions-list-priv.h									\
-	nact-iaction-tab.c											\
-	nact-iaction-tab.h											\
-	nact-iadvanced-tab.c										\
-	nact-iadvanced-tab.h										\
-	nact-ibackground-tab.c										\
-	nact-ibackground-tab.h										\
-	nact-icommand-tab.c											\
-	nact-icommand-tab.h											\
-	nact-iconditions-tab.c										\
-	nact-iconditions-tab.h										\
-	nact-iprefs.c												\
-	nact-iprefs.h												\
-	nact-main.c													\
-	nact-main-menubar.c											\
-	nact-main-menubar.h											\
-	nact-main-statusbar.c										\
-	nact-main-statusbar.h										\
-	nact-main-tab.c												\
-	nact-main-tab.h												\
-	nact-main-toolbar.c											\
-	nact-main-toolbar.h											\
-	nact-main-window.c											\
-	nact-main-window.h											\
-	nact-preferences-editor.c									\
-	nact-preferences-editor.h									\
-	nact-providers-list.c										\
-	nact-providers-list.h										\
-	nact-schemes-list.c											\
-	nact-schemes-list.h											\
-	nact-tree-model.c											\
-	nact-tree-model.h											\
-	nact-tree-model-dnd.c										\
-	nact-tree-model-dnd.h										\
-	nact-tree-model-priv.h										\
-	nact-window.c												\
-	nact-window.h												\
-	nact-xml-reader.c											\
-	nact-xml-reader.h											\
-	$(BUILT_SOURCES)											\
+	base-application.c									\
+	base-application.h									\
+	base-application-class.h							\
+	base-assistant.c									\
+	base-assistant.h									\
+	base-builder.c										\
+	base-builder.h										\
+	base-dialog.c										\
+	base-dialog.h										\
+	base-iprefs.c										\
+	base-iprefs.h										\
+	base-window.c										\
+	base-window.h										\
+	base-window-class.h									\
+	egg-desktop-file.c									\
+	egg-desktop-file.h									\
+	egg-sm-client.c										\
+	egg-sm-client.h										\
+	egg-sm-client-private.h								\
+	egg-sm-client-xsmp.c								\
+	egg-tree-multi-dnd.c								\
+	egg-tree-multi-dnd.h								\
+	nact-application.c									\
+	nact-application.h									\
+	nact-assistant-export.c								\
+	nact-assistant-export.h								\
+	nact-assistant-export-ask.c							\
+	nact-assistant-export-ask.h							\
+	nact-assistant-import.c								\
+	nact-assistant-import.h								\
+	nact-assistant-import-ask.c							\
+	nact-assistant-import-ask.h							\
+	nact-clipboard.c									\
+	nact-clipboard.h									\
+	nact-confirm-logout.c								\
+	nact-confirm-logout.h								\
+	nact-gtk-utils.c									\
+	nact-gtk-utils.h									\
+	nact-iactions-list.c								\
+	nact-iactions-list.h								\
+	nact-iactions-list-bis.c							\
+	nact-iactions-list-priv.c							\
+	nact-iactions-list-priv.h							\
+	nact-iaction-tab.c									\
+	nact-iaction-tab.h									\
+	nact-iadvanced-tab.c								\
+	nact-iadvanced-tab.h								\
+	nact-ibackground-tab.c								\
+	nact-ibackground-tab.h								\
+	nact-icommand-tab.c									\
+	nact-icommand-tab.h									\
+	nact-iconditions-tab.c								\
+	nact-iconditions-tab.h								\
+	nact-iprefs.c										\
+	nact-iprefs.h										\
+	nact-main.c											\
+	nact-main-menubar.c									\
+	nact-main-menubar.h									\
+	nact-main-statusbar.c								\
+	nact-main-statusbar.h								\
+	nact-main-tab.c										\
+	nact-main-tab.h										\
+	nact-main-toolbar.c									\
+	nact-main-toolbar.h									\
+	nact-main-window.c									\
+	nact-main-window.h									\
+	nact-preferences-editor.c							\
+	nact-preferences-editor.h							\
+	nact-providers-list.c								\
+	nact-providers-list.h								\
+	nact-schemes-list.c									\
+	nact-schemes-list.h									\
+	nact-tree-model.c									\
+	nact-tree-model.h									\
+	nact-tree-model-dnd.c								\
+	nact-tree-model-dnd.h								\
+	nact-tree-model-priv.h								\
+	nact-window.c										\
+	nact-window.h										\
+	nact-xml-reader.c									\
+	nact-xml-reader.h									\
+	$(BUILT_SOURCES)									\
 	$(NULL)
 
 nact-marshal.h: nact-marshal.list $(GLIB_GENMARSHAL)
@@ -146,19 +139,18 @@ nact-marshal.c: nact-marshal.list $(GLIB_GENMARSHAL)
 	$(GLIB_GENMARSHAL) $< --body --prefix=nact_marshal >> $@
 
 nautilus_actions_config_tool_LDADD = \
-	-L$(top_builddir)/nautilus-actions/private	-lna-private	\
-	-L$(top_builddir)/nautilus-actions/runtime	-lna-runtime	\
-	$(NAUTILUS_ACTIONS_LIBS)									\
+	$(top_builddir)/src/core/libna-core.la				\
+	$(NAUTILUS_ACTIONS_LIBS)							\
 	$(NULL)
 
 pkgdata_DATA = \
-	nautilus-actions-config-tool.actions						\
-	nautilus-actions-maintainer.actions							\
-	nact-assistant-export.ui									\
-	nact-preferences.ui											\
-	nautilus-actions-config-tool.ui								\
-	locked.png													\
-	transparent.png												\
+	nautilus-actions-config-tool.actions				\
+	nautilus-actions-maintainer.actions					\
+	nact-assistant-export.ui							\
+	nact-preferences.ui									\
+	nautilus-actions-config-tool.ui						\
+	locked.png											\
+	transparent.png										\
 	$(NULL)
 
 @INTLTOOL_DESKTOP_RULE@
@@ -172,14 +164,14 @@ applicationsdir = $(datadir)/applications
 applications_DATA = $(applications_files)
 
 CLEANFILES = \
-	$(applications_files)										\
-	$(BUILT_SOURCES)											\
+	$(applications_files)								\
+	$(BUILT_SOURCES)									\
 	$(NULL)
 
 EXTRA_DIST = \
-	$(applications_in_files)									\
-	$(pkgdata_DATA)												\
-	nact-marshal.list											\
+	$(applications_in_files)							\
+	$(pkgdata_DATA)										\
+	nact-marshal.list									\
 	$(NULL)
 
 uninstall-hook:
diff --git a/src/nact/base-builder.c b/src/nact/base-builder.c
index e6eb398..e0c2c24 100644
--- a/src/nact/base-builder.c
+++ b/src/nact/base-builder.c
@@ -32,7 +32,7 @@
 #include <config.h>
 #endif
 
-#include <runtime/na-utils.h>
+#include <api/na-core-utils.h>
 
 #include "base-builder.h"
 
@@ -161,7 +161,7 @@ instance_finalize( GObject *window )
 	g_return_if_fail( BASE_IS_BUILDER( window ));
 	self = BASE_BUILDER( window );
 
-	na_utils_free_string_list( self->private->fnames );
+	na_core_utils_slist_free( self->private->fnames );
 
 	g_free( self->private );
 
diff --git a/src/nact/nact-iprefs.c b/src/nact/nact-iprefs.c
new file mode 100644
index 0000000..085de53
--- /dev/null
+++ b/src/nact/nact-iprefs.c
@@ -0,0 +1,312 @@
+/*
+ * Nautilus Actions
+ * A Nautilus extension which offers configurable context menu actions.
+ *
+ * Copyright (C) 2005 The GNOME Foundation
+ * Copyright (C) 2006, 2007, 2008 Frederic Ruaudel and others (see AUTHORS)
+ * Copyright (C) 2009, 2010 Pierre Wieser and others (see AUTHORS)
+ *
+ * This Program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this Library; see the file COPYING.  If not,
+ * write to the Free Software Foundation, Inc., 59 Temple Place,
+ * Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * Authors:
+ *   Frederic Ruaudel <grumz grumz net>
+ *   Rodrigo Moya <rodrigo gnome-db org>
+ *   Pierre Wieser <pwieser trychlos org>
+ *   ... and many others (see AUTHORS)
+ */
+
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <api/na-gconf-utils.h>
+
+#include "nact-iprefs.h"
+
+/* private interface data
+ */
+struct NactIPrefsInterfacePrivate {
+	GConfClient *client;
+};
+
+#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 }
+};
+
+#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 }
+};
+
+static gboolean st_initialized = FALSE;
+static gboolean st_finalized = FALSE;
+
+static GType   register_type( void );
+static void    interface_base_init( NactIPrefsInterface *klass );
+static void    interface_base_finalize( NactIPrefsInterface *klass );
+
+GType
+nact_iprefs_get_type( void )
+{
+	static GType iface_type = 0;
+
+	if( !iface_type ){
+		iface_type = register_type();
+	}
+
+	return( iface_type );
+}
+
+static GType
+register_type( void )
+{
+	static const gchar *thisfn = "nact_iprefs_register_type";
+	GType type;
+
+	static const GTypeInfo info = {
+		sizeof( NactIPrefsInterface ),
+		( GNactInitFunc ) interface_base_init,
+		( GNactFinalizeFunc ) interface_base_finalize,
+		NULL,
+		NULL,
+		NULL,
+		0,
+		0,
+		NULL
+	};
+
+	g_debug( "%s", thisfn );
+
+	type = g_type_register_static( NA_IPREFS_TYPE, "NactIPrefs", &info, 0 );
+
+	g_type_interface_add_prerequisite( type, G_TYPE_OBJECT );
+
+	return( type );
+}
+
+static void
+interface_base_init( NactIPrefsInterface *klass )
+{
+	static const gchar *thisfn = "nact_iprefs_interface_base_init";
+
+	if( !st_initialized ){
+
+		g_debug( "%s: klass=%p", thisfn, ( void * ) klass );
+
+		klass->private = g_new0( NactIPrefsInterfacePrivate, 1 );
+
+		klass->private->client = gconf_client_get_default();
+
+		st_initialized = TRUE;
+	}
+}
+
+static void
+interface_nact_finalize( NactIPrefsInterface *klass )
+{
+	static const gchar *thisfn = "nact_iprefs_interface_base_finalize";
+
+	if( st_initialized && !st_finalized ){
+
+		g_debug( "%s: klass=%p", thisfn, ( void * ) klass );
+
+		st_finalized = TRUE;
+
+		g_free( klass->private );
+	}
+}
+
+/**
+ * nact_iprefs_get_export_format:
+ * @window: this #BaseWindow-derived window.
+ * @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.
+ */
+guint
+nact_iprefs_get_export_format( const BaseWindow *window, const gchar *name )
+{
+	guint export_format;
+	guint format_int;
+	gchar *format_str;
+	NactApplication *application;
+	NAUpdater *updater;
+
+	export_format = DEFAULT_EXPORT_FORMAT_INT;
+
+	g_return_val_if_fail( BASE_IS_WINDOW, export_format );
+
+	if( st_initialized && !st_finalized ){
+
+		application = NACT_APPLICATION( base_window_get_application( window ));
+		updater = nact_application_get_updater( application );
+
+		format_str = na_iprefs_read_string(
+				NA_IPREFS( updater ),
+				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 );
+}
+
+/**
+ * nact_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
+nact_iprefs_get_import_mode( const BaseWindow *window, const gchar *name )
+{
+	gint import_mode = DEFAULT_IMPORT_MODE_INT;
+	gint import_int;
+	gchar *import_str;
+	NactApplication *application;
+	NAUpdater *updater;
+
+	g_return_val_if_fail( NA_IS_IPREFS( instance ), DEFAULT_IMPORT_MODE_INT );
+
+	if( st_initialized && !st_finalized ){
+
+		application = NACT_APPLICATION( base_window_get_application( window ));
+		updater = nact_application_get_updater( application );
+
+		import_str = na_iprefs_read_string(
+				NA_IPREFS( updater ),
+				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 );
+}
+
+/**
+ * nact_iprefs_set_export_format:
+ * @window: this #BaseWindow-derived window.
+ * @format: the new value to be written.
+ *
+ * Writes the current status of 'import/export format' to the GConf
+ * preference system.
+ */
+void
+nact_iprefs_set_export_format( const BaseWindow *window, const gchar *name, gint format )
+{
+	const gchar *format_str;
+
+	g_return_if_fail( NA_IS_IPREFS( instance ));
+
+	if( st_initialized && !st_finalized ){
+
+		format_str = gconf_enum_to_string( export_format_table, format );
+
+		nact_iprefs_write_string(
+				window,
+				name,
+				format_str ? format_str : DEFAULT_EXPORT_FORMAT_STR );
+	}
+}
+
+/**
+ * nact_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
+nact_iprefs_set_import_mode( const BaseWindow *window, const gchar *name, gint mode )
+{
+	const gchar *import_str;
+
+	g_return_if_fail( NA_IS_IPREFS( instance ));
+
+	if( st_initialized && !st_finalized ){
+
+		import_str = gconf_enum_to_string( import_mode_table, mode );
+
+		nact_iprefs_write_string(
+				window,
+				name,
+				import_str ? import_str : DEFAULT_IMPORT_MODE_STR );
+	}
+}
+
+/**
+ * nact_iprefs_write_string:
+ * @window: this #BaseWindow-derived window.
+ * @name: the preference key.
+ * @value: the value to be written.
+ *
+ * Writes the value as the given GConf preference.
+ */
+void
+nact_iprefs_write_string( const BaseWindow *window, const gchar *name, const gchar *value )
+{
+	gchar *path;
+
+	g_return_if_fail( BASE_IS_WINDOW( window ));
+	g_return_if_fail( NACT_IS_IPREFS( window ));
+
+	if( st_initialized && !st_finalized ){
+
+		path = gconf_concat_dir_and_key( IPREFS_GCONF_PREFS_PATH, name );
+
+		na_gconf_utils_write_string( NACT_IPREFS_GET_INTERFACE( window )->private->client, path, value, NULL );
+
+		g_free( path );
+	}
+}
diff --git a/src/nact/nact-iprefs.h b/src/nact/nact-iprefs.h
new file mode 100644
index 0000000..cfa7418
--- /dev/null
+++ b/src/nact/nact-iprefs.h
@@ -0,0 +1,86 @@
+/*
+ * Nautilus Actions
+ * A Nautilus extension which offers configurable context menu actions.
+ *
+ * Copyright (C) 2005 The GNOME Foundation
+ * Copyright (C) 2006, 2007, 2008 Frederic Ruaudel and others (see AUTHORS)
+ * Copyright (C) 2009, 2010 Pierre Wieser and others (see AUTHORS)
+ *
+ * This Program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this Library; see the file COPYING.  If not,
+ * write to the Free Software Foundation, Inc., 59 Temple Place,
+ * Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * Authors:
+ *   Frederic Ruaudel <grumz grumz net>
+ *   Rodrigo Moya <rodrigo gnome-db org>
+ *   Pierre Wieser <pwieser trychlos org>
+ *   ... and many others (see AUTHORS)
+ */
+
+#ifndef __NACT_IPREFS_H__
+#define __NACT_IPREFS_H__
+
+/**
+ * SECTION: nact_iprefs
+ * @short_description: #NactIPrefs interface definition.
+ * @include: nact/nact-iprefs.h
+ *
+ * This interface cooperates with #NactWindow to manage preferences.
+ */
+
+#include <core/na-iprefs.h>
+
+#include "base-window.h"
+
+G_BEGIN_DECLS
+
+#define NACT_IPREFS_TYPE						( nact_iprefs_get_type())
+#define NACT_IPREFS( object )					( G_TYPE_CHECK_INSTANCE_CAST( object, NACT_IPREFS_TYPE, NactIPrefs ))
+#define NACT_IS_IPREFS( object )				( G_TYPE_CHECK_INSTANCE_TYPE( object, NACT_IPREFS_TYPE ))
+#define NACT_IPREFS_GET_INTERFACE( instance )	( G_TYPE_INSTANCE_GET_INTERFACE(( instance ), NACT_IPREFS_TYPE, NactIPrefsInterface ))
+
+typedef struct NactIPrefs                 NactIPrefs;
+
+typedef struct NactIPrefsInterfacePrivate NactIPrefsInterfacePrivate;
+
+typedef struct {
+	NAIPrefsInterface           parent;
+	NactIPrefsInterfacePrivate *private;
+}
+	NactIPrefsInterface;
+
+#define IPREFS_EXPORT_ITEMS_FOLDER_URI			"export-folder-uri"
+#define IPREFS_EXPORT_FORMAT					"export-format"
+#define IPREFS_EXPORT_ASK_LAST_FORMAT			"export-ask-user-last-format"
+
+#define IPREFS_IMPORT_ITEMS_FOLDER_URI			"import-folder-uri"
+#define IPREFS_IMPORT_ITEMS_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"
+
+GType nact_iprefs_get_type( void );
+
+guint nact_iprefs_get_export_format( const BaseWindow *window, const gchar *pref );
+gint  nact_iprefs_get_import_mode  ( const BaseWindow *window, const gchar *pref );
+
+void  nact_iprefs_set_export_format( const BaseWindow *window, const gchar *pref, gint format );
+void  nact_iprefs_set_import_mode  ( const BaseWindow *window, const gchar *pref, gint mode );
+
+void  nact_iprefs_write_string( const BaseWindow *window, const gchar *name, const gchar *value );
+
+G_END_DECLS
+
+#endif /* __NACT_IPREFS_H__ */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]