[nautilus-actions] Import mode is displayed in Preferences editor



commit 5ecb7bb726376dec0b4c29385da48f46a8df6d3a
Author: Pierre Wieser <pwieser trychlos org>
Date:   Thu Oct 1 19:56:14 2009 +0200

    Import mode is displayed in Preferences editor
    
    Move all GConf string enumerations to na-iprefs.
    Rename all na-iprefs-managed preferences as IPREFS_xxxx.

 src/common/na-iio-provider.c             |    6 +-
 src/common/na-iprefs.c                   |   93 +++++++++++++--
 src/common/na-iprefs.h                   |   24 +++-
 src/common/na-pivot.c                    |    8 +-
 src/common/na-xml-writer.c               |    5 +-
 src/nact/nact-assistant-import.c         |   70 ++---------
 src/nact/nact-preferences-editor.c       |   86 ++++++++++---
 src/nact/nautilus-actions-config-tool.ui |  196 ++++++++++--------------------
 8 files changed, 252 insertions(+), 236 deletions(-)
---
diff --git a/src/common/na-iio-provider.c b/src/common/na-iio-provider.c
index 061f19b..c5d8f6e 100644
--- a/src/common/na-iio-provider.c
+++ b/src/common/na-iio-provider.c
@@ -183,15 +183,15 @@ na_iio_provider_get_items_tree( const NAPivot *pivot )
 
 		order_mode = na_iprefs_get_order_mode( NA_IPREFS( pivot ));
 		switch( order_mode ){
-			case PREFS_ORDER_ALPHA_ASCENDING:
+			case IPREFS_ORDER_ALPHA_ASCENDING:
 				hierarchy = sort_tree( pivot, hierarchy, ( GCompareFunc ) na_pivot_sort_alpha_asc );
 				break;
 
-			case PREFS_ORDER_ALPHA_DESCENDING:
+			case IPREFS_ORDER_ALPHA_DESCENDING:
 				hierarchy = sort_tree( pivot, hierarchy, ( GCompareFunc ) na_pivot_sort_alpha_desc );
 				break;
 
-			case PREFS_ORDER_MANUAL:
+			case IPREFS_ORDER_MANUAL:
 			default:
 				break;
 		}
diff --git a/src/common/na-iprefs.c b/src/common/na-iprefs.c
index 8fa9224..3ad5025 100644
--- a/src/common/na-iprefs.c
+++ b/src/common/na-iprefs.c
@@ -50,13 +50,23 @@ typedef struct {
 }
 	NAIPrefsPrivate;
 
-#define DEFAULT_ORDER_MODE_INT			PREFS_ORDER_ALPHA_ASCENDING
+#define DEFAULT_ORDER_MODE_INT			IPREFS_ORDER_ALPHA_ASCENDING
 #define DEFAULT_ORDER_MODE_STR			"AscendingOrder"
 
 static GConfEnumStringPair order_mode_table[] = {
-	{ PREFS_ORDER_ALPHA_ASCENDING , "AscendingOrder" },
-	{ PREFS_ORDER_ALPHA_DESCENDING, "DescendingOrder" },
-	{ PREFS_ORDER_MANUAL          , "ManualOrder" },
+	{ IPREFS_ORDER_ALPHA_ASCENDING ,	"AscendingOrder" },
+	{ IPREFS_ORDER_ALPHA_DESCENDING,	"DescendingOrder" },
+	{ IPREFS_ORDER_MANUAL          ,	"ManualOrder" },
+	{ 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,			"NoImport" },
+	{ IPREFS_IMPORT_RENUMBER ,			"Renumber" },
+	{ IPREFS_IMPORT_OVERRIDE ,			"Override" },
 	{ 0, NULL }
 };
 
@@ -166,7 +176,7 @@ na_iprefs_get_level_zero_items( NAIPrefs *instance )
 
 	if( st_initialized && !st_finalized ){
 		setup_private_data( instance );
-		level_zero = read_string_list( instance, PREFS_LEVEL_ZERO_ITEMS );
+		level_zero = read_string_list( instance, IPREFS_LEVEL_ZERO_ITEMS );
 	}
 
 	return( level_zero );
@@ -186,7 +196,7 @@ na_iprefs_set_level_zero_items( NAIPrefs *instance, GSList *order )
 
 	if( st_initialized && !st_finalized ){
 		setup_private_data( instance );
-		write_string_list( instance, PREFS_LEVEL_ZERO_ITEMS, order );
+		write_string_list( instance, IPREFS_LEVEL_ZERO_ITEMS, order );
 	}
 }
 
@@ -216,7 +226,7 @@ na_iprefs_get_order_mode( NAIPrefs *instance )
 		setup_private_data( instance );
 		order_str = na_iprefs_read_string(
 				instance,
-				PREFS_DISPLAY_ALPHABETICAL_ORDER,
+				IPREFS_DISPLAY_ALPHABETICAL_ORDER,
 				DEFAULT_ORDER_MODE_STR );
 		if( gconf_string_to_enum( order_mode_table, order_str, &order_int )){
 			alpha_order = order_int;
@@ -248,7 +258,7 @@ na_iprefs_set_order_mode( NAIPrefs *instance, gint mode )
 		order_str = gconf_enum_to_string( order_mode_table, mode );
 		na_iprefs_write_string(
 				instance,
-				PREFS_DISPLAY_ALPHABETICAL_ORDER,
+				IPREFS_DISPLAY_ALPHABETICAL_ORDER,
 				order_str ? order_str : DEFAULT_ORDER_MODE_STR );
 	}
 }
@@ -275,7 +285,7 @@ na_iprefs_should_add_about_item( NAIPrefs *instance )
 
 	if( st_initialized && !st_finalized ){
 		setup_private_data( instance );
-		about = read_bool( instance, PREFS_ADD_ABOUT_ITEM, TRUE );
+		about = read_bool( instance, IPREFS_ADD_ABOUT_ITEM, TRUE );
 	}
 
 	return( about );
@@ -295,7 +305,70 @@ na_iprefs_set_add_about_item( NAIPrefs *instance, gboolean enabled )
 
 	if( st_initialized && !st_finalized ){
 		setup_private_data( instance );
-		write_bool( instance, PREFS_ADD_ABOUT_ITEM, enabled );
+		write_bool( instance, IPREFS_ADD_ABOUT_ITEM, enabled );
+	}
+}
+
+/**
+ * na_iprefs_get_import_mode:
+ * @instance: this #NAIPrefs interface instance.
+ *
+ * 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 )
+{
+	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 );
+
+	if( st_initialized && !st_finalized ){
+
+		setup_private_data( instance );
+		import_str = na_iprefs_read_string(
+				instance,
+				IPREFS_IMPORT_ACTIONS_IMPORT_MODE,
+				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_import_mode:
+ * @instance: this #NAIPrefs interface instance.
+ * @mode: the new value to be written.
+ *
+ * Writes the current status of 'alphabetical order' to the GConf
+ * preference system.
+ */
+void
+na_iprefs_set_import_mode( NAIPrefs *instance, gint mode )
+{
+	const gchar *import_str;
+
+	g_return_if_fail( NA_IS_IPREFS( instance ));
+
+	if( st_initialized && !st_finalized ){
+
+		setup_private_data( instance );
+		import_str = gconf_enum_to_string( import_mode_table, mode );
+		na_iprefs_write_string(
+				instance,
+				IPREFS_IMPORT_ACTIONS_IMPORT_MODE,
+				import_str ? import_str : DEFAULT_IMPORT_MODE_STR );
 	}
 }
 
diff --git a/src/common/na-iprefs.h b/src/common/na-iprefs.h
index 3054114..b5d9882 100644
--- a/src/common/na-iprefs.h
+++ b/src/common/na-iprefs.h
@@ -108,6 +108,9 @@ void     na_iprefs_set_order_mode( NAIPrefs *instance, gint mode );
 gboolean na_iprefs_should_add_about_item( NAIPrefs *instance );
 void     na_iprefs_set_add_about_item( NAIPrefs *instance, gboolean enabled );
 
+gint     na_iprefs_get_import_mode( NAIPrefs *instance );
+void     na_iprefs_set_import_mode( NAIPrefs *instance, gint mode );
+
 gchar   *na_iprefs_read_string( NAIPrefs *instance, const gchar *key, const gchar *default_value );
 void     na_iprefs_write_string( NAIPrefs *instance, const gchar *key, const gchar *value );
 
@@ -118,16 +121,25 @@ void     na_iprefs_write_string( NAIPrefs *instance, const gchar *key, const gch
 
 /* GConf Preference keys managed by IPrefs interface
  */
-#define PREFS_LEVEL_ZERO_ITEMS				"iprefs-level-zero"
-#define PREFS_DISPLAY_ALPHABETICAL_ORDER	"iprefs-alphabetical-order"
-#define PREFS_ADD_ABOUT_ITEM				"iprefs-add-about-item"
+#define IPREFS_LEVEL_ZERO_ITEMS				"iprefs-level-zero"
+#define IPREFS_DISPLAY_ALPHABETICAL_ORDER	"iprefs-alphabetical-order"
+#define IPREFS_ADD_ABOUT_ITEM				"iprefs-add-about-item"
+#define IPREFS_IMPORT_ACTIONS_IMPORT_MODE	"import-mode"
 
 /* alphabetical order values
  */
 enum {
-	PREFS_ORDER_ALPHA_ASCENDING = 1,
-	PREFS_ORDER_ALPHA_DESCENDING,
-	PREFS_ORDER_MANUAL
+	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
 };
 
 G_END_DECLS
diff --git a/src/common/na-pivot.c b/src/common/na-pivot.c
index a42878b..e68fd33 100644
--- a/src/common/na-pivot.c
+++ b/src/common/na-pivot.c
@@ -876,7 +876,7 @@ monitor_runtime_preferences( NAPivot *pivot )
 static void
 on_preferences_change( GConfClient *client, guint cnxn_id, GConfEntry *entry, NAPivot *pivot )
 {
-	static const gchar *thisfn = "na_pivot_on_preferences_change";
+	/*static const gchar *thisfn = "na_pivot_on_preferences_change";*/
 	const gchar *key;
 	gchar *key_entry;
 
@@ -884,13 +884,13 @@ on_preferences_change( GConfClient *client, guint cnxn_id, GConfEntry *entry, NA
 
 	key = gconf_entry_get_key( entry );
 	key_entry = na_utils_path_extract_last_dir( key );
-	g_debug( "%s: key=%s", thisfn, key_entry );
+	/*g_debug( "%s: key=%s", thisfn, key_entry );*/
 
-	if( !g_ascii_strcasecmp( key_entry, PREFS_ADD_ABOUT_ITEM )){
+	if( !g_ascii_strcasecmp( key_entry, IPREFS_ADD_ABOUT_ITEM )){
 		display_about_changed( pivot );
 	}
 
-	if( !g_ascii_strcasecmp( key_entry, PREFS_DISPLAY_ALPHABETICAL_ORDER )){
+	if( !g_ascii_strcasecmp( key_entry, IPREFS_DISPLAY_ALPHABETICAL_ORDER )){
 		display_order_changed( pivot );
 	}
 
diff --git a/src/common/na-xml-writer.c b/src/common/na-xml-writer.c
index c94c7cd..1343241 100644
--- a/src/common/na-xml-writer.c
+++ b/src/common/na-xml-writer.c
@@ -437,7 +437,7 @@ na_xml_writer_get_xml_buffer( const NAObjectAction *action, gint format )
 	int textlen;
 	gchar *buffer;
 
-	g_assert( action || format == FORMAT_GCONFSCHEMA );
+	g_return_val_if_fail( action || format == FORMAT_GCONFSCHEMA, NULL );
 
 	uuid = action ? na_object_get_id( action ) : NULL;
 	writer = xml_writer_new( uuid );
@@ -486,7 +486,8 @@ na_xml_writer_output_xml( const gchar *xml, const gchar *filename )
 	GFileOutputStream *stream;
 	GError *error = NULL;
 
-	g_assert( filename );
+	g_return_if_fail( xml );
+	g_return_if_fail( filename && g_utf8_strlen( filename, -1 ));
 
 	file = g_file_new_for_uri( filename );
 
diff --git a/src/nact/nact-assistant-import.c b/src/nact/nact-assistant-import.c
index 174831d..0d1a73c 100644
--- a/src/nact/nact-assistant-import.c
+++ b/src/nact/nact-assistant-import.c
@@ -91,17 +91,6 @@ struct NactAssistantImportPrivate {
 };
 
 #define IPREFS_IMPORT_ACTIONS_FOLDER_URI		"import-folder-uri"
-#define IPREFS_IMPORT_ACTIONS_IMPORT_MODE		"import-mode"
-
-#define DEFAULT_IMPORT_MODE_INT					NO_IMPORT_MODE
-#define DEFAULT_IMPORT_MODE_STR					"NoImport"
-
-static GConfEnumStringPair import_mode_table[] = {
-	{ NO_IMPORT_MODE, "NoImport" },
-	{ RENUMBER_MODE , "Renumber" },
-	{ OVERRIDE_MODE , "Override" },
-	{ 0, NULL }
-};
 
 static BaseAssistantClass *st_parent_class = NULL;
 
@@ -123,8 +112,6 @@ static void     on_file_selection_changed( GtkFileChooser *chooser, gpointer use
 static gboolean has_readable_files( GSList *uris );
 static void     runtime_init_duplicates( NactAssistantImport *window, GtkAssistant *assistant );
 static void     set_import_mode( NactAssistantImport *window, gint mode );
-static gint     get_pref_import_mode( NactAssistantImport *window );
-static void     set_pref_import_mode( NactAssistantImport *window, gint mode );
 
 static void     assistant_prepare( BaseAssistant *window, GtkAssistant *assistant, GtkWidget *page );
 static void     prepare_confirm( NactAssistantImport *window, GtkAssistant *assistant, GtkWidget *page );
@@ -468,12 +455,16 @@ static void
 runtime_init_duplicates( NactAssistantImport *window, GtkAssistant *assistant )
 {
 	static const gchar *thisfn = "nact_assistant_import_runtime_init_duplicates";
+	NactApplication *application;
+	NAPivot *pivot;
 	GtkWidget *page;
 	gint mode;
 
 	g_debug( "%s: window=%p", thisfn, ( void * ) window );
 
-	mode = get_pref_import_mode( window );
+	application = NACT_APPLICATION( base_window_get_application( BASE_WINDOW( window )));
+	pivot = nact_application_get_pivot( application );
+	mode = na_iprefs_get_import_mode( NA_IPREFS( pivot ));
 	set_import_mode( window, mode );
 
 	page = gtk_assistant_get_nth_page( assistant, ASSIST_PAGE_DUPLICATES );
@@ -504,50 +495,6 @@ set_import_mode( NactAssistantImport *window, gint mode )
 	}
 }
 
-static gint
-get_pref_import_mode( NactAssistantImport *window )
-{
-	gint import_mode = DEFAULT_IMPORT_MODE_INT;
-	NactApplication *application;
-	NAPivot *pivot;
-	gchar *mode_str;
-	gint mode_int;
-
-	application = NACT_APPLICATION( base_window_get_application( BASE_WINDOW( window )));
-	pivot = nact_application_get_pivot( application );
-
-	mode_str = na_iprefs_read_string(
-			NA_IPREFS( pivot ),
-			IPREFS_IMPORT_ACTIONS_IMPORT_MODE,
-			DEFAULT_IMPORT_MODE_STR );
-
-	if( gconf_string_to_enum( import_mode_table, mode_str, &mode_int )){
-		import_mode = mode_int;
-	}
-
-	g_free( mode_str );
-
-	return( import_mode );
-}
-
-static void
-set_pref_import_mode( NactAssistantImport *window, gint mode )
-{
-	NactApplication *application;
-	NAPivot *pivot;
-	const gchar *mode_str;
-
-	mode_str = gconf_enum_to_string( import_mode_table, mode );
-
-	application = NACT_APPLICATION( base_window_get_application( BASE_WINDOW( window )));
-	pivot = nact_application_get_pivot( application );
-
-	na_iprefs_write_string(
-			NA_IPREFS( pivot ),
-			IPREFS_IMPORT_ACTIONS_IMPORT_MODE,
-			mode_str ? mode_str : DEFAULT_IMPORT_MODE_STR );
-}
-
 static void
 assistant_prepare( BaseAssistant *window, GtkAssistant *assistant, GtkWidget *page )
 {
@@ -725,6 +672,8 @@ static void
 prepare_importdone( NactAssistantImport *window, GtkAssistant *assistant, GtkWidget *page )
 {
 	static const gchar *thisfn = "nact_assistant_import_prepare_importdone";
+	NactApplication *application;
+	NAPivot *pivot;
 	gchar *text, *tmp, *text2;
 	gchar *bname, *uuid, *label;
 	GSList *is, *im;
@@ -735,6 +684,9 @@ prepare_importdone( NactAssistantImport *window, GtkAssistant *assistant, GtkWid
 	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 )));
+	pivot = nact_application_get_pivot( application );
+
 	/* i18n: result of the import assistant */
 	text = g_strdup( _( "Selected files have been imported:" ));
 
@@ -792,7 +744,7 @@ prepare_importdone( NactAssistantImport *window, GtkAssistant *assistant, GtkWid
 	g_free( text );
 
 	mode = get_import_mode( window );
-	set_pref_import_mode( window, mode );
+	na_iprefs_set_import_mode( NA_IPREFS( pivot ), mode );
 
 	gtk_assistant_set_page_complete( assistant, page, TRUE );
 	base_assistant_set_warn_on_cancel( BASE_ASSISTANT( window ), FALSE );
diff --git a/src/nact/nact-preferences-editor.c b/src/nact/nact-preferences-editor.c
index 56394f7..6f43bf3 100644
--- a/src/nact/nact-preferences-editor.c
+++ b/src/nact/nact-preferences-editor.c
@@ -275,6 +275,7 @@ on_base_runtime_init_dialog( NactPreferencesEditor *editor, gpointer user_data )
 	gint order_mode;
 	gboolean add_about_item;
 	gboolean relabel;
+	gint import_mode;
 	GtkWidget *button;
 
 	g_debug( "%s: editor=%p, user_data=%p", thisfn, ( void * ) editor, ( void * ) user_data );
@@ -282,17 +283,19 @@ on_base_runtime_init_dialog( NactPreferencesEditor *editor, gpointer user_data )
 	application = NACT_APPLICATION( base_window_get_application( BASE_WINDOW( editor )));
 	pivot = nact_application_get_pivot( application );
 
+	/* first tab: runtime preferences
+	 */
 	order_mode = na_iprefs_get_order_mode( NA_IPREFS( pivot ));
 	switch( order_mode ){
-		case PREFS_ORDER_ALPHA_ASCENDING:
+		case IPREFS_ORDER_ALPHA_ASCENDING:
 			button = base_window_get_widget( BASE_WINDOW( editor ), "OrderAlphaAscButton" );
 			break;
 
-		case PREFS_ORDER_ALPHA_DESCENDING:
+		case IPREFS_ORDER_ALPHA_DESCENDING:
 			button = base_window_get_widget( BASE_WINDOW( editor ), "OrderAlphaDescButton" );
 			break;
 
-		case PREFS_ORDER_MANUAL:
+		case IPREFS_ORDER_MANUAL:
 		default:
 			button = base_window_get_widget( BASE_WINDOW( editor ), "OrderManualButton" );
 			break;
@@ -303,18 +306,8 @@ on_base_runtime_init_dialog( NactPreferencesEditor *editor, gpointer user_data )
 	button = base_window_get_widget( BASE_WINDOW( editor ), "AddAboutButton" );
 	gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( button ), add_about_item );
 
-	base_window_signal_connect_by_name(
-			BASE_WINDOW( editor ),
-			"CancelButton",
-			"clicked",
-			G_CALLBACK( on_cancel_clicked ));
-
-	base_window_signal_connect_by_name(
-			BASE_WINDOW( editor ),
-			"OKButton",
-			"clicked",
-			G_CALLBACK( on_ok_clicked ));
-
+	/* second tab: ui preferences
+	 */
 	relabel = base_iprefs_get_bool( BASE_IPREFS( editor ), BASE_IPREFS_RELABEL_MENUS );
 	button = base_window_get_widget( BASE_WINDOW( editor ), "RelabelMenuButton" );
 	gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( button ), relabel );
@@ -326,6 +319,37 @@ on_base_runtime_init_dialog( NactPreferencesEditor *editor, gpointer user_data )
 	relabel = base_iprefs_get_bool( BASE_IPREFS( editor ), BASE_IPREFS_RELABEL_PROFILES );
 	button = base_window_get_widget( BASE_WINDOW( editor ), "RelabelProfileButton" );
 	gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( button ), relabel );
+
+	/* third tab: tools preferences
+	 */
+	import_mode = na_iprefs_get_import_mode( NA_IPREFS( pivot ));
+	switch( import_mode ){
+		case IPREFS_IMPORT_NO_IMPORT:
+			button = base_window_get_widget( BASE_WINDOW( editor ), "PrefsNoImportButton" );
+			break;
+
+		case IPREFS_IMPORT_RENUMBER:
+			button = base_window_get_widget( BASE_WINDOW( editor ), "PrefsRenumberButton" );
+			break;
+
+		case IPREFS_IMPORT_OVERRIDE:
+		default:
+			button = base_window_get_widget( BASE_WINDOW( editor ), "PrefsOverrideButton" );
+			break;
+	}
+	gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( button ), TRUE );
+
+	base_window_signal_connect_by_name(
+			BASE_WINDOW( editor ),
+			"CancelButton",
+			"clicked",
+			G_CALLBACK( on_cancel_clicked ));
+
+	base_window_signal_connect_by_name(
+			BASE_WINDOW( editor ),
+			"OKButton",
+			"clicked",
+			G_CALLBACK( on_ok_clicked ));
 }
 
 static void
@@ -364,22 +388,25 @@ save_preferences( NactPreferencesEditor *editor )
 	gint order_mode;
 	gboolean enabled;
 	gboolean relabel;
+	gint import_mode;
 
 	application = NACT_APPLICATION( base_window_get_application( BASE_WINDOW( editor )));
 	pivot = nact_application_get_pivot( application );
 
-	order_mode = PREFS_ORDER_ALPHA_ASCENDING;
+	/* first tab: runtime preferences
+	 */
+	order_mode = IPREFS_ORDER_ALPHA_ASCENDING;
 	button = base_window_get_widget( BASE_WINDOW( editor ), "OrderAlphaAscButton" );
 	if( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( button ))){
-		order_mode = PREFS_ORDER_ALPHA_ASCENDING;
+		order_mode = IPREFS_ORDER_ALPHA_ASCENDING;
 	} else {
 		button = base_window_get_widget( BASE_WINDOW( editor ), "OrderAlphaDescButton" );
 		if( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( button ))){
-			order_mode = PREFS_ORDER_ALPHA_DESCENDING;
+			order_mode = IPREFS_ORDER_ALPHA_DESCENDING;
 		} else {
 			button = base_window_get_widget( BASE_WINDOW( editor ), "OrderManualButton" );
 			if( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( button ))){
-				order_mode = PREFS_ORDER_MANUAL;
+				order_mode = IPREFS_ORDER_MANUAL;
 			}
 		}
 	}
@@ -389,6 +416,8 @@ save_preferences( NactPreferencesEditor *editor )
 	enabled = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( button ));
 	na_iprefs_set_add_about_item( NA_IPREFS( pivot ), enabled );
 
+	/* second tab: runtime preferences
+	 */
 	button = base_window_get_widget( BASE_WINDOW( editor ), "RelabelMenuButton" );
 	relabel = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( button ));
 	base_iprefs_set_bool( BASE_IPREFS( editor ), BASE_IPREFS_RELABEL_MENUS, relabel );
@@ -400,6 +429,25 @@ save_preferences( NactPreferencesEditor *editor )
 	button = base_window_get_widget( BASE_WINDOW( editor ), "RelabelProfileButton" );
 	relabel = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( button ));
 	base_iprefs_set_bool( BASE_IPREFS( editor ), BASE_IPREFS_RELABEL_PROFILES, relabel );
+
+	/* third tab: tools preferences
+	 */
+	import_mode = IPREFS_IMPORT_NO_IMPORT;
+	button = base_window_get_widget( BASE_WINDOW( editor ), "PrefsNoImportButton" );
+	if( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( button ))){
+		import_mode = IPREFS_IMPORT_NO_IMPORT;
+	} else {
+		button = base_window_get_widget( BASE_WINDOW( editor ), "PrefsRenumberButton" );
+		if( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( button ))){
+			import_mode = IPREFS_IMPORT_RENUMBER;
+		} else {
+			button = base_window_get_widget( BASE_WINDOW( editor ), "PrefsOverrideButton" );
+			if( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( button ))){
+				import_mode = IPREFS_IMPORT_OVERRIDE;
+			}
+		}
+	}
+	na_iprefs_set_import_mode( NA_IPREFS( pivot ), import_mode );
 }
 
 static gboolean
diff --git a/src/nact/nautilus-actions-config-tool.ui b/src/nact/nautilus-actions-config-tool.ui
index d1b6585..29f3107 100644
--- a/src/nact/nautilus-actions-config-tool.ui
+++ b/src/nact/nautilus-actions-config-tool.ui
@@ -1599,106 +1599,6 @@ Be warned: you will not be prompted another time. This mode may be dangerous.</p
       </object>
     </child>
   </object>
-  <object class="GtkDialog" id="PreferencesDialog2">
-    <property name="border_width">5</property>
-    <property name="title" translatable="yes">Nautilus Actions Preferences</property>
-    <property name="modal">True</property>
-    <property name="type_hint">dialog</property>
-    <child internal-child="vbox">
-      <object class="GtkVBox" id="dialog-vbox2">
-        <property name="visible">True</property>
-        <property name="spacing">2</property>
-        <child>
-          <object class="GtkNotebook" id="PreferencesNotebook2">
-            <property name="visible">True</property>
-            <property name="can_focus">True</property>
-            <child>
-              <object class="GtkVBox" id="vbox25">
-                <property name="visible">True</property>
-                <child>
-                  <placeholder/>
-                </child>
-                <child>
-                  <placeholder/>
-                </child>
-              </object>
-            </child>
-            <child type="tab">
-              <object class="GtkLabel" id="label391">
-                <property name="visible">True</property>
-                <property name="label" translatable="yes">page 1</property>
-              </object>
-              <packing>
-                <property name="tab_fill">False</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkVBox" id="vbox261">
-                <property name="visible">True</property>
-                <child>
-                  <placeholder/>
-                </child>
-              </object>
-              <packing>
-                <property name="position">1</property>
-              </packing>
-            </child>
-            <child type="tab">
-              <object class="GtkLabel" id="label401">
-                <property name="visible">True</property>
-                <property name="label" translatable="yes">page 2</property>
-              </object>
-              <packing>
-                <property name="position">1</property>
-                <property name="tab_fill">False</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkVBox" id="vbox311">
-                <property name="visible">True</property>
-                <child>
-                  <placeholder/>
-                </child>
-              </object>
-              <packing>
-                <property name="position">1</property>
-              </packing>
-            </child>
-            <child type="tab">
-              <object class="GtkLabel" id="label431">
-                <property name="visible">True</property>
-                <property name="label" translatable="yes">page 3</property>
-              </object>
-              <packing>
-                <property name="position">2</property>
-                <property name="tab_fill">False</property>
-              </packing>
-            </child>
-          </object>
-          <packing>
-            <property name="position">1</property>
-          </packing>
-        </child>
-        <child internal-child="action_area">
-          <object class="GtkHButtonBox" id="dialog-action_area2">
-            <property name="visible">True</property>
-            <property name="layout_style">end</property>
-            <child>
-              <placeholder/>
-            </child>
-            <child>
-              <placeholder/>
-            </child>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="pack_type">end</property>
-            <property name="position">0</property>
-          </packing>
-        </child>
-      </object>
-    </child>
-  </object>
   <object class="GtkDialog" id="PreferencesDialog">
     <property name="border_width">5</property>
     <property name="title" translatable="yes">Nautilus Actions Preferences</property>
@@ -1742,6 +1642,7 @@ Be warned: you will not be prompted another time. This mode may be dangerous.</p
                                     <property name="visible">True</property>
                                     <property name="can_focus">True</property>
                                     <property name="receives_default">False</property>
+                                    <property name="tooltip_text" translatable="yes">This button being selected, treeview items (actions and menus) will be maintained in alphabetical ascending order of their label.</property>
                                     <property name="use_underline">True</property>
                                     <property name="active">True</property>
                                     <property name="draw_indicator">True</property>
@@ -1756,6 +1657,7 @@ Be warned: you will not be prompted another time. This mode may be dangerous.</p
                                     <property name="visible">True</property>
                                     <property name="can_focus">True</property>
                                     <property name="receives_default">False</property>
+                                    <property name="tooltip_text" translatable="yes">This button being selected, treeview items (actions and menus) will be maintained in alphabetical descending order of their label.</property>
                                     <property name="use_underline">True</property>
                                     <property name="draw_indicator">True</property>
                                     <property name="group">OrderAlphaAscButton</property>
@@ -1770,6 +1672,7 @@ Be warned: you will not be prompted another time. This mode may be dangerous.</p
                                     <property name="visible">True</property>
                                     <property name="can_focus">True</property>
                                     <property name="receives_default">False</property>
+                                    <property name="tooltip_text" translatable="yes">This button being selected, no order will be automagically forced in the treeview. Instead, you will be able to reorder each item, action or menu, individually.</property>
                                     <property name="use_underline">True</property>
                                     <property name="draw_indicator">True</property>
                                     <property name="group">OrderAlphaAscButton</property>
@@ -1826,6 +1729,8 @@ Be warned: you will not be prompted another time. This mode may be dangerous.</p
                                     <property name="visible">True</property>
                                     <property name="can_focus">True</property>
                                     <property name="receives_default">False</property>
+                                    <property name="tooltip_text" translatable="yes">When this option is checked, an 'About Nautilus Actions' item is added as the last item of the first level of submenus in Nautilus context menu.
+If there is no root submenu, a 'Nautilus Actions' one is created.</property>
                                     <property name="use_underline">True</property>
                                     <property name="draw_indicator">True</property>
                                   </object>
@@ -1887,50 +1792,71 @@ Be warned: you will not be prompted another time. This mode may be dangerous.</p
                             <property name="visible">True</property>
                             <property name="left_padding">12</property>
                             <child>
-                              <object class="GtkVBox" id="vbox27">
+                              <object class="GtkVBox" id="vbox25">
                                 <property name="visible">True</property>
-                                <property name="border_width">6</property>
                                 <property name="orientation">vertical</property>
-                                <property name="homogeneous">True</property>
                                 <child>
-                                  <object class="GtkCheckButton" id="RelabelMenuButton">
-                                    <property name="label" translatable="yes">Relabel _menus</property>
+                                  <object class="GtkLabel" id="label45">
                                     <property name="visible">True</property>
-                                    <property name="can_focus">True</property>
-                                    <property name="receives_default">False</property>
-                                    <property name="use_underline">True</property>
-                                    <property name="draw_indicator">True</property>
+                                    <property name="xalign">0</property>
+                                    <property name="label" translatable="yes">What to do when pasting, duplicating or importing an action or a menu which already exists in the tree ?</property>
+                                    <property name="wrap">True</property>
                                   </object>
                                   <packing>
                                     <property name="position">0</property>
                                   </packing>
                                 </child>
                                 <child>
-                                  <object class="GtkCheckButton" id="RelabelActionButton">
-                                    <property name="label" translatable="yes">Relabel _actions</property>
+                                  <object class="GtkVBox" id="vbox27">
                                     <property name="visible">True</property>
-                                    <property name="can_focus">True</property>
-                                    <property name="receives_default">False</property>
-                                    <property name="use_underline">True</property>
-                                    <property name="draw_indicator">True</property>
+                                    <property name="orientation">vertical</property>
+                                    <child>
+                                      <object class="GtkCheckButton" id="RelabelMenuButton">
+                                        <property name="label" translatable="yes">Relabel _menus</property>
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">True</property>
+                                        <property name="receives_default">False</property>
+                                        <property name="tooltip_text" translatable="yes">The menu will be relabeled as 'Copy of &lt;original menu label&gt;'.</property>
+                                        <property name="use_underline">True</property>
+                                        <property name="draw_indicator">True</property>
+                                      </object>
+                                      <packing>
+                                        <property name="position">0</property>
+                                      </packing>
+                                    </child>
+                                    <child>
+                                      <object class="GtkCheckButton" id="RelabelActionButton">
+                                        <property name="label" translatable="yes">Relabel _actions</property>
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">True</property>
+                                        <property name="receives_default">False</property>
+                                        <property name="tooltip_text" translatable="yes">The action will be relabeled as 'Copy of &lt;original action label&gt;'.</property>
+                                        <property name="use_underline">True</property>
+                                        <property name="draw_indicator">True</property>
+                                      </object>
+                                      <packing>
+                                        <property name="position">1</property>
+                                      </packing>
+                                    </child>
+                                    <child>
+                                      <object class="GtkCheckButton" id="RelabelProfileButton">
+                                        <property name="label" translatable="yes">Relabel _profiles</property>
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">True</property>
+                                        <property name="receives_default">False</property>
+                                        <property name="tooltip_text" translatable="yes">The profile will be relabeled as 'Copy of &lt;original profile label&gt;'.</property>
+                                        <property name="use_underline">True</property>
+                                        <property name="draw_indicator">True</property>
+                                      </object>
+                                      <packing>
+                                        <property name="position">2</property>
+                                      </packing>
+                                    </child>
                                   </object>
                                   <packing>
                                     <property name="position">1</property>
                                   </packing>
                                 </child>
-                                <child>
-                                  <object class="GtkCheckButton" id="RelabelProfileButton">
-                                    <property name="label" translatable="yes">Relabel _profiles</property>
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">True</property>
-                                    <property name="receives_default">False</property>
-                                    <property name="use_underline">True</property>
-                                    <property name="draw_indicator">True</property>
-                                  </object>
-                                  <packing>
-                                    <property name="position">2</property>
-                                  </packing>
-                                </child>
                               </object>
                             </child>
                           </object>
@@ -1939,7 +1865,7 @@ Be warned: you will not be prompted another time. This mode may be dangerous.</p
                           <object class="GtkLabel" id="label42">
                             <property name="visible">True</property>
                             <property name="xpad">4</property>
-                            <property name="label" translatable="yes">&lt;b&gt;Relabeling items when pasted or duplicated&lt;/b&gt;</property>
+                            <property name="label" translatable="yes">&lt;b&gt;Relabeling items&lt;/b&gt;</property>
                             <property name="use_markup">True</property>
                           </object>
                         </child>
@@ -2000,6 +1926,7 @@ Be warned: you will not be prompted another time. This mode may be dangerous.</p
                                     <property name="visible">True</property>
                                     <property name="can_focus">True</property>
                                     <property name="receives_default">False</property>
+                                    <property name="tooltip_text" translatable="yes">Do not import actions whose UUID already exists. Existing action will remain unchanged.</property>
                                     <property name="use_underline">True</property>
                                     <property name="active">True</property>
                                     <property name="draw_indicator">True</property>
@@ -2014,6 +1941,7 @@ Be warned: you will not be prompted another time. This mode may be dangerous.</p
                                     <property name="visible">True</property>
                                     <property name="can_focus">True</property>
                                     <property name="receives_default">False</property>
+                                    <property name="tooltip_text" translatable="yes">Imported actions whose UUID already exists will be renumbered. Depending on UI preferences, they may also be relabeled. Existing action will remain unchanged.</property>
                                     <property name="use_underline">True</property>
                                     <property name="draw_indicator">True</property>
                                     <property name="group">PrefsNoImportButton</property>
@@ -2028,6 +1956,8 @@ Be warned: you will not be prompted another time. This mode may be dangerous.</p
                                     <property name="visible">True</property>
                                     <property name="can_focus">True</property>
                                     <property name="receives_default">False</property>
+                                    <property name="tooltip_text" translatable="yes">The imported action will silently override the current action which has the same identifiant.
+Be warned: you will not be prompted another time. This mode may be dangerous.	</property>
                                     <property name="use_underline">True</property>
                                     <property name="draw_indicator">True</property>
                                     <property name="group">PrefsNoImportButton</property>
@@ -2128,16 +2058,16 @@ Be warned: you will not be prompted another time. This mode may be dangerous.</p
   </object>
   <object class="GtkSizeGroup" id="CommandLabelSizeGroup">
     <widgets>
-      <widget name="ProfileLabelLabel"/>
-      <widget name="CommandPathLabel"/>
-      <widget name="CommandParametersLabel"/>
       <widget name="CommandExamplePreLabel"/>
+      <widget name="CommandParametersLabel"/>
+      <widget name="CommandPathLabel"/>
+      <widget name="ProfileLabelLabel"/>
     </widgets>
   </object>
   <object class="GtkSizeGroup" id="CommandButtonSizeGroup">
     <widgets>
-      <widget name="CommandPathButton"/>
       <widget name="CommandLegendButton"/>
+      <widget name="CommandPathButton"/>
     </widgets>
   </object>
 </interface>



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