[nautilus-actions] Relabeling items is a user preference



commit fa7878ccbb4f1dc4c3ba4ed808fd1ede1387c76c
Author: Pierre Wieser <pwieser trychlos org>
Date:   Mon Sep 28 06:13:40 2009 +0200

    Relabeling items is a user preference

 ChangeLog                                |   26 ++++
 src/common/na-object-api.h               |    2 +-
 src/common/na-object-id-fn.h             |    2 +-
 src/common/na-object-id.c                |   15 ++-
 src/nact/base-iprefs.c                   |   30 ++---
 src/nact/base-iprefs.h                   |    8 +-
 src/nact/nact-clipboard.c                |   46 ++++++-
 src/nact/nact-main-menubar.c             |   19 +++-
 src/nact/nact-main-window.c              |   29 ++++-
 src/nact/nact-preferences-editor.c       |   59 +++++++--
 src/nact/nautilus-actions-config-tool.ui |  199 ++++++++++++++++++++++++------
 11 files changed, 346 insertions(+), 89 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 0609518..4d172ad 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,29 @@
+2009-09-28 Pierre Wieser <pwieser trychlos org>
+
+	* src/common/na-object-api.h:
+	* src/common/na-object-id-fn.h:
+	* src/common/na-object-id.c (na_object_id_set_for_copy):
+	Add a relabel argument.
+
+	* src/nact/base-iprefs.c:
+	* src/nact/base-iprefs.c (base_iprefs_get_bool,
+	base_iprefs_set_bool):
+	Replace the BaseWindow argument by a BaseIPrefs	one.
+	Define three new UI preferences.
+
+	* src/nact/nact-clipboard.c:
+	* src/nact/nact-main-window.c:
+	Now implements the BaseIPrefs interface.
+
+	* src/nact/nact-main-menubar.c (on_duplicate_activated):
+	Takes advantage of new UI preferences.
+
+	* src/nact/nact-preferences-editor.c:
+	Edit the new UI preferences.
+
+	* src/nact/nautilus-actions-config-tool.ui:
+	Edit the user preferences in a notebook.
+
 2009-09-27 Pierre Wieser <pwieser trychlos org>
 
 	* src/common/na-object-api.h (na_object_set_for_copy): New function.
diff --git a/src/common/na-object-api.h b/src/common/na-object-api.h
index 3752882..e87703c 100644
--- a/src/common/na-object-api.h
+++ b/src/common/na-object-api.h
@@ -68,7 +68,7 @@ G_BEGIN_DECLS
 #define na_object_get_label( object )				na_object_id_get_label( NA_OBJECT_ID( object ))
 
 #define na_object_set_id( object, id )				na_object_id_set_id( NA_OBJECT_ID( object ), id )
-#define na_object_set_for_copy( object )			na_object_id_set_for_copy( NA_OBJECT_ID( object ))
+#define na_object_set_for_copy( object, relabel )	na_object_id_set_for_copy( NA_OBJECT_ID( object ), relabel )
 #define na_object_set_new_id( object )				na_object_id_set_new_id( NA_OBJECT_ID( object ))
 #define na_object_set_label( object, label )		na_object_id_set_label( NA_OBJECT_ID( object ), label )
 
diff --git a/src/common/na-object-id-fn.h b/src/common/na-object-id-fn.h
index 79ecaae..414f1a2 100644
--- a/src/common/na-object-id-fn.h
+++ b/src/common/na-object-id-fn.h
@@ -50,7 +50,7 @@ gchar *na_object_id_get_id( const NAObjectId *object );
 gchar *na_object_id_get_label( const NAObjectId *object );
 
 void   na_object_id_set_id( NAObjectId *object, const gchar *id );
-void   na_object_id_set_for_copy( NAObjectId *object );
+void   na_object_id_set_for_copy( NAObjectId *object, gboolean relabel );
 void   na_object_id_set_new_id( NAObjectId *object );
 void   na_object_id_set_label( NAObjectId *object, const gchar *label );
 
diff --git a/src/common/na-object-id.c b/src/common/na-object-id.c
index 05277ee..e137f53 100644
--- a/src/common/na-object-id.c
+++ b/src/common/na-object-id.c
@@ -347,12 +347,13 @@ na_object_id_set_id( NAObjectId *object, const gchar *id )
 /**
  * na_object_id_set_for_copy:
  * @object: the #NAObjectId object to be copied.
+ * @relabel: whether this item should be relabeled ?
  *
  * Prepares @object to be copied, allocating to it a new uuid if apply,
- * and relabeling it as "Copy of ...".
+ * and relabeling it as "Copy of ..." if applies.
  */
 void
-na_object_id_set_for_copy( NAObjectId *object )
+na_object_id_set_for_copy( NAObjectId *object, gboolean relabel )
 {
 	gchar *new_label;
 
@@ -362,10 +363,12 @@ na_object_id_set_for_copy( NAObjectId *object )
 
 		na_object_id_set_new_id( object );
 
-		/* i18n: copied items have a label as 'Copy of original label' */
-		new_label = g_strdup_printf( _( "Copy of %s" ), object->private->label );
-		g_free( object->private->label );
-		object->private->label = new_label;
+		if( relabel ){
+			/* i18n: copied items have a label as 'Copy of original label' */
+			new_label = g_strdup_printf( _( "Copy of %s" ), object->private->label );
+			g_free( object->private->label );
+			object->private->label = new_label;
+		}
 	}
 }
 
diff --git a/src/nact/base-iprefs.c b/src/nact/base-iprefs.c
index 033ae0e..35613d0 100644
--- a/src/nact/base-iprefs.c
+++ b/src/nact/base-iprefs.c
@@ -60,12 +60,12 @@ static GConfValue *get_value( GConfClient *client, const gchar *path, const gcha
 static void        set_value( GConfClient *client, const gchar *path, const gchar *entry, GConfValue *value );
 static gboolean    remove_entry( GConfClient *client, const gchar *path, const gchar *entry );
 
-static gboolean    read_bool( BaseWindow *window, const gchar *name );
+static gboolean    read_bool( BaseIPrefs *instance, const gchar *name );
 static gint        read_int( BaseWindow *window, const gchar *name );
 static GSList     *read_int_list( BaseWindow *window, const gchar *key );
 static gchar      *read_str( BaseWindow *window, const gchar *key );
 
-static void        write_bool( BaseWindow *window, const gchar *name, gboolean value );
+static void        write_bool( BaseIPrefs *instance, const gchar *name, gboolean value );
 static void        write_int( BaseWindow *window, const gchar *name, gint value );
 static void        write_int_list( BaseWindow *window, const gchar *key, GSList *list );
 static void        write_str( BaseWindow *window, const gchar *key, const gchar *text );
@@ -318,21 +318,20 @@ base_iprefs_save_named_window_position( BaseWindow *window, GtkWindow *toplevel,
 
 /**
  * base_iprefs_get_bool:
- * @window: this #BaseWindow-derived window.
+ * @istance: this #BaseIPrefs implementation.
  * @name: the entry to be readen.
  *
  * Returns: the named boolean.
  */
 gboolean
-base_iprefs_get_bool( BaseWindow *window, const gchar *name )
+base_iprefs_get_bool( BaseIPrefs *instance, const gchar *name )
 {
 	gboolean ret = FALSE;
 
-	g_return_val_if_fail( BASE_IS_WINDOW( window ), FALSE );
-	g_return_val_if_fail( BASE_IS_IPREFS( window ), FALSE );
+	g_return_val_if_fail( BASE_IS_IPREFS( instance ), FALSE );
 
 	if( st_initialized && !st_finalized ){
-		ret = read_bool( window, name );
+		ret = read_bool( instance, name );
 	}
 
 	return( ret );
@@ -340,20 +339,19 @@ base_iprefs_get_bool( BaseWindow *window, const gchar *name )
 
 /**
  * base_iprefs_set_bool:
- * @window: this #BaseWindow-derived window.
+ * @istance: this #BaseIPrefs implementation.
  * @name: the entry to be readen.
  * @value: the value to be set.
  *
  * Writes the named boolean in GConf.
  */
 void
-base_iprefs_set_bool( BaseWindow *window, const gchar *name, gboolean value )
+base_iprefs_set_bool( BaseIPrefs *instance, const gchar *name, gboolean value )
 {
-	g_return_if_fail( BASE_IS_WINDOW( window ));
-	g_return_if_fail( BASE_IS_IPREFS( window ));
+	g_return_if_fail( BASE_IS_IPREFS( instance ));
 
 	if( st_initialized && !st_finalized ){
-		write_bool( window, name, value );
+		write_bool( instance, name, value );
 	}
 }
 
@@ -522,14 +520,14 @@ remove_entry( GConfClient *client, const gchar *path, const gchar *entry )
 }
 
 static gboolean
-read_bool( BaseWindow *window, const gchar *name )
+read_bool( BaseIPrefs *instance, const gchar *name )
 {
 	gchar *path;
 	gint value;
 
 	path = g_strdup_printf( "%s/%s", NA_GCONF_PREFS_PATH, name );
 
-	value = na_gconf_utils_read_bool( BASE_IPREFS_GET_INTERFACE( window )->private->client, path, TRUE, FALSE );
+	value = na_gconf_utils_read_bool( BASE_IPREFS_GET_INTERFACE( instance )->private->client, path, TRUE, FALSE );
 
 	g_free( path );
 	return( value );
@@ -605,13 +603,13 @@ read_str( BaseWindow *window, const gchar *key )
 }
 
 static void
-write_bool( BaseWindow *window, const gchar *name, gboolean value )
+write_bool( BaseIPrefs *instance, const gchar *name, gboolean value )
 {
 	gchar *path;
 
 	path = g_strdup_printf( "%s/%s", NA_GCONF_PREFS_PATH, name );
 
-	na_gconf_utils_write_bool( BASE_IPREFS_GET_INTERFACE( window )->private->client, path, value, NULL );
+	na_gconf_utils_write_bool( BASE_IPREFS_GET_INTERFACE( instance )->private->client, path, value, NULL );
 
 	g_free( path );
 }
diff --git a/src/nact/base-iprefs.h b/src/nact/base-iprefs.h
index 5e7c457..3f93bc6 100644
--- a/src/nact/base-iprefs.h
+++ b/src/nact/base-iprefs.h
@@ -67,6 +67,10 @@ typedef struct {
 }
 	BaseIPrefsInterface;
 
+#define BASE_IPREFS_RELABEL_MENUS		"iprefs-relabel-menus"
+#define BASE_IPREFS_RELABEL_ACTIONS		"iprefs-relabel-actions"
+#define BASE_IPREFS_RELABEL_PROFILES	"iprefs-relabel-profiles"
+
 GType    base_iprefs_get_type( void );
 
 void     base_iprefs_migrate_key( BaseWindow *window, const gchar *old_key, const gchar *new_key );
@@ -77,8 +81,8 @@ void     base_iprefs_position_named_window( BaseWindow *window, GtkWindow *tople
 void     base_iprefs_save_window_position( BaseWindow *window );
 void     base_iprefs_save_named_window_position( BaseWindow *window, GtkWindow *toplevel, const gchar *name );
 
-gboolean base_iprefs_get_bool( BaseWindow *window, const gchar *key );
-void     base_iprefs_set_bool( BaseWindow *window, const gchar *key, gboolean value );
+gboolean base_iprefs_get_bool( BaseIPrefs *instance, const gchar *key );
+void     base_iprefs_set_bool( BaseIPrefs *instance, const gchar *key, gboolean value );
 
 gint     base_iprefs_get_int( BaseWindow *window, const gchar *key );
 void     base_iprefs_set_int( BaseWindow *window, const gchar *key, gint value );
diff --git a/src/nact/nact-clipboard.c b/src/nact/nact-clipboard.c
index c7f910a..4e3aed9 100644
--- a/src/nact/nact-clipboard.c
+++ b/src/nact/nact-clipboard.c
@@ -42,6 +42,7 @@
 #include <common/na-xml-names.h>
 #include <common/na-xml-writer.h>
 
+#include "base-iprefs.h"
 #include "nact-clipboard.h"
 
 /* private class data
@@ -91,6 +92,7 @@ static GObjectClass *st_parent_class = NULL;
 
 static GType         register_type( void );
 static void          class_init( NactClipboardClass *klass );
+static void          iprefs_base_iface_init( BaseIPrefsInterface *iface );
 static void          instance_init( GTypeInstance *instance, gpointer klass );
 static void          instance_dispose( GObject *application );
 static void          instance_finalize( GObject *application );
@@ -103,7 +105,7 @@ static void          export_action( const gchar *uri, const NAObject *action, GS
 static gchar        *get_action_xml_buffer( const NAObject *action, GSList **exported );
 static void          get_from_clipboard_callback( GtkClipboard *clipboard, GtkSelectionData *selection_data, guint info, guchar *data );
 static void          clear_clipboard_callback( GtkClipboard *clipboard, NactClipboardData *data );
-static void          renumber_items( GList *items );
+static void          renumber_items( NactClipboard *clipboard, GList *items );
 
 GType
 nact_clipboard_get_type( void )
@@ -135,10 +137,18 @@ register_type( void )
 		( GInstanceInitFunc ) instance_init
 	};
 
+	static const GInterfaceInfo iprefs_base_iface_info = {
+		( GInterfaceInitFunc ) iprefs_base_iface_init,
+		NULL,
+		NULL
+	};
+
 	g_debug( "%s", thisfn );
 
 	type = g_type_register_static( G_TYPE_OBJECT, "NactClipboard", &info, 0 );
 
+	g_type_add_interface_static( type, BASE_IPREFS_TYPE, &iprefs_base_iface_info );
+
 	return( type );
 }
 
@@ -160,6 +170,14 @@ class_init( NactClipboardClass *klass )
 }
 
 static void
+iprefs_base_iface_init( BaseIPrefsInterface *iface )
+{
+	static const gchar *thisfn = "nact_main_window_iprefs_base_iface_init";
+
+	g_debug( "%s: iface=%p", thisfn, ( void * ) iface );
+}
+
+static void
 instance_init( GTypeInstance *instance, gpointer klass )
 {
 	static const gchar *thisfn = "nact_clipboard_instance_init";
@@ -343,7 +361,7 @@ nact_clipboard_export_items( const gchar *uri, GList *items )
  * nact_clipboard_primary_set:
  * @clipboard: this #NactClipboard object.
  * @items: a list of #NAObject items
- * @renumber_items: whether the actions or menus items should be
+ * @renumber: whether the actions or menus items should be
  * renumbered when copied in the clipboard ?
  *
  * Installs a copy of provided items in the clipboard.
@@ -388,7 +406,7 @@ nact_clipboard_primary_set( NactClipboard *clipboard, GList *items, gboolean ren
 		data->items = g_list_reverse( data->items );
 
 		if( renumber ){
-			renumber_items( data->items );
+			renumber_items( clipboard, data->items );
 		}
 
 		gtk_clipboard_set_with_data( clipboard->private->primary,
@@ -434,7 +452,7 @@ nact_clipboard_primary_get( NactClipboard *clipboard )
 			}
 			items = g_list_reverse( items );
 
-			renumber_items( data->items );
+			renumber_items( clipboard, data->items );
 		}
 	}
 
@@ -588,11 +606,27 @@ clear_clipboard_callback( GtkClipboard *clipboard, NactClipboardData *data )
 }
 
 static void
-renumber_items( GList *items )
+renumber_items( NactClipboard *clipboard, GList *items )
 {
 	GList *it;
+	gboolean relabel_menus, relabel_actions, relabel_profiles;
+	gboolean relabel;
+
+	relabel_menus = base_iprefs_get_bool( BASE_IPREFS( clipboard ), BASE_IPREFS_RELABEL_MENUS );
+	relabel_actions = base_iprefs_get_bool( BASE_IPREFS( clipboard ), BASE_IPREFS_RELABEL_ACTIONS );
+	relabel_profiles = base_iprefs_get_bool( BASE_IPREFS( clipboard ), BASE_IPREFS_RELABEL_PROFILES );
 
 	for( it = items ; it ; it = it->next ){
-		na_object_set_for_copy( it->data );
+
+		if( NA_IS_OBJECT_MENU( it->data )){
+			relabel = relabel_menus;
+		} else if( NA_IS_OBJECT_ACTION( it->data )){
+			relabel = relabel_actions;
+		} else {
+			g_return_if_fail( NA_IS_OBJECT_PROFILE( it->data ));
+			relabel = relabel_profiles;
+		}
+
+		na_object_set_for_copy( it->data, relabel );
 	}
 }
diff --git a/src/nact/nact-main-menubar.c b/src/nact/nact-main-menubar.c
index 0e08d74..b3897d7 100644
--- a/src/nact/nact-main-menubar.c
+++ b/src/nact/nact-main-menubar.c
@@ -40,6 +40,7 @@
 #include <common/na-object-menu.h>
 #include <common/na-ipivot-consumer.h>
 
+#include "base-iprefs.h"
 #include "nact-application.h"
 #include "nact-assistant-export.h"
 #include "nact-assistant-import.h"
@@ -573,14 +574,30 @@ on_duplicate_activated( GtkAction *gtk_action, NactMainWindow *window )
 	GList *items, *it;
 	GList *dup;
 	NAObject *obj;
+	gboolean relabel_menus, relabel_actions, relabel_profiles;
+	gboolean relabel;
 
 	g_return_if_fail( GTK_IS_ACTION( gtk_action ));
 	g_return_if_fail( NACT_IS_MAIN_WINDOW( window ));
 
+	relabel_menus = base_iprefs_get_bool( BASE_IPREFS( window ), BASE_IPREFS_RELABEL_MENUS );
+	relabel_actions = base_iprefs_get_bool( BASE_IPREFS( window ), BASE_IPREFS_RELABEL_ACTIONS );
+	relabel_profiles = base_iprefs_get_bool( BASE_IPREFS( window ), BASE_IPREFS_RELABEL_PROFILES );
+
 	items = nact_iactions_list_get_selected_items( NACT_IACTIONS_LIST( window ));
 	for( it = items ; it ; it = it->next ){
 		obj = NA_OBJECT( na_object_duplicate( it->data ));
-		na_object_set_for_copy( obj );
+
+		if( NA_IS_OBJECT_MENU( obj )){
+			relabel = relabel_menus;
+		} else if( NA_IS_OBJECT_ACTION( obj )){
+			relabel = relabel_actions;
+		} else {
+			g_return_if_fail( NA_IS_OBJECT_PROFILE( obj ));
+			relabel = relabel_profiles;
+		}
+
+		na_object_set_for_copy( obj, relabel );
 		na_object_set_origin( obj, NULL );
 		dup = g_list_prepend( NULL, obj );
 		nact_iactions_list_insert_items( NACT_IACTIONS_LIST( window ), dup, it->data );
diff --git a/src/nact/nact-main-window.c b/src/nact/nact-main-window.c
index 498c706..3b92914 100644
--- a/src/nact/nact-main-window.c
+++ b/src/nact/nact-main-window.c
@@ -123,7 +123,8 @@ static void     icommand_tab_iface_init( NactICommandTabInterface *iface );
 static void     iconditions_tab_iface_init( NactIConditionsTabInterface *iface );
 static void     iadvanced_tab_iface_init( NactIAdvancedTabInterface *iface );
 static void     ipivot_consumer_iface_init( NAIPivotConsumerInterface *iface );
-static void     iprefs_iface_init( NAIPrefsInterface *iface );
+static void     iprefs_na_iface_init( NAIPrefsInterface *iface );
+static void     iprefs_base_iface_init( BaseIPrefsInterface *iface );
 static void     instance_init( GTypeInstance *instance, gpointer klass );
 static void     instance_get_property( GObject *object, guint property_id, GValue *value, GParamSpec *spec );
 static void     instance_set_property( GObject *object, guint property_id, const GValue *value, GParamSpec *spec );
@@ -217,8 +218,14 @@ register_type( void )
 		NULL
 	};
 
-	static const GInterfaceInfo iprefs_iface_info = {
-		( GInterfaceInitFunc ) iprefs_iface_init,
+	static const GInterfaceInfo iprefs_na_iface_info = {
+		( GInterfaceInitFunc ) iprefs_na_iface_init,
+		NULL,
+		NULL
+	};
+
+	static const GInterfaceInfo iprefs_base_iface_info = {
+		( GInterfaceInitFunc ) iprefs_base_iface_init,
 		NULL,
 		NULL
 	};
@@ -239,7 +246,9 @@ register_type( void )
 
 	g_type_add_interface_static( type, NA_IPIVOT_CONSUMER_TYPE, &ipivot_consumer_iface_info );
 
-	g_type_add_interface_static( type, NA_IPREFS_TYPE, &iprefs_iface_info );
+	g_type_add_interface_static( type, NA_IPREFS_TYPE, &iprefs_na_iface_info );
+
+	g_type_add_interface_static( type, BASE_IPREFS_TYPE, &iprefs_base_iface_info );
 
 	return( type );
 }
@@ -386,9 +395,17 @@ ipivot_consumer_iface_init( NAIPivotConsumerInterface *iface )
 }
 
 static void
-iprefs_iface_init( NAIPrefsInterface *iface )
+iprefs_na_iface_init( NAIPrefsInterface *iface )
+{
+	static const gchar *thisfn = "nact_main_window_iprefs_na_iface_init";
+
+	g_debug( "%s: iface=%p", thisfn, ( void * ) iface );
+}
+
+static void
+iprefs_base_iface_init( BaseIPrefsInterface *iface )
 {
-	static const gchar *thisfn = "nact_main_window_iprefs_iface_init";
+	static const gchar *thisfn = "nact_main_window_iprefs_base_iface_init";
 
 	g_debug( "%s: iface=%p", thisfn, ( void * ) iface );
 }
diff --git a/src/nact/nact-preferences-editor.c b/src/nact/nact-preferences-editor.c
index f2d6211..a30e484 100644
--- a/src/nact/nact-preferences-editor.c
+++ b/src/nact/nact-preferences-editor.c
@@ -57,7 +57,8 @@ static GObjectClass *st_parent_class = NULL;
 
 static GType    register_type( void );
 static void     class_init( NactPreferencesEditorClass *klass );
-static void     iprefs_iface_init( NAIPrefsInterface *iface );
+static void     iprefs_na_iface_init( NAIPrefsInterface *iface );
+static void     iprefs_base_iface_init( BaseIPrefsInterface *iface );
 static void     instance_init( GTypeInstance *instance, gpointer klass );
 static void     instance_dispose( GObject *dialog );
 static void     instance_finalize( GObject *dialog );
@@ -108,8 +109,14 @@ register_type( void )
 		( GInstanceInitFunc ) instance_init
 	};
 
-	static const GInterfaceInfo prefs_iface_info = {
-		( GInterfaceInitFunc ) iprefs_iface_init,
+	static const GInterfaceInfo iprefs_na_iface_info = {
+		( GInterfaceInitFunc ) iprefs_na_iface_init,
+		NULL,
+		NULL
+	};
+
+	static const GInterfaceInfo iprefs_base_iface_info = {
+		( GInterfaceInitFunc ) iprefs_base_iface_init,
 		NULL,
 		NULL
 	};
@@ -118,7 +125,9 @@ register_type( void )
 
 	type = g_type_register_static( BASE_DIALOG_TYPE, "NactPreferencesEditor", &info, 0 );
 
-	g_type_add_interface_static( type, NA_IPREFS_TYPE, &prefs_iface_info );
+	g_type_add_interface_static( type, NA_IPREFS_TYPE, &iprefs_na_iface_info );
+
+	g_type_add_interface_static( type, NA_IPREFS_TYPE, &iprefs_base_iface_info );
 
 	return( type );
 }
@@ -147,9 +156,17 @@ class_init( NactPreferencesEditorClass *klass )
 }
 
 static void
-iprefs_iface_init( NAIPrefsInterface *iface )
+iprefs_na_iface_init( NAIPrefsInterface *iface )
 {
-	static const gchar *thisfn = "nact_preferences_editor_iprefs_iface_init";
+	static const gchar *thisfn = "nact_preferences_editor_iprefs_na_iface_init";
+
+	g_debug( "%s: iface=%p", thisfn, ( void * ) iface );
+}
+
+static void
+iprefs_base_iface_init( BaseIPrefsInterface *iface )
+{
+	static const gchar *thisfn = "nact_preferences_editor_iprefs_base_iface_init";
 
 	g_debug( "%s: iface=%p", thisfn, ( void * ) iface );
 }
@@ -278,10 +295,6 @@ on_base_initial_load_dialog( NactPreferencesEditor *editor, gpointer user_data )
 	GtkWindow *parent_toplevel;*/
 
 	g_debug( "%s: editor=%p, user_data=%p", thisfn, ( void * ) editor, ( void * ) user_data );
-
-	/*toplevel = base_window_get_toplevel_window( dialog );
-	parent_toplevel = base_window_get_toplevel_dialog( BASE_WINDOW( editor->private->parent ));
-	gtk_window_set_transient_for( toplevel, parent_toplevel );*/
 }
 
 static void
@@ -289,6 +302,7 @@ on_base_runtime_init_dialog( NactPreferencesEditor *editor, gpointer user_data )
 {
 	static const gchar *thisfn = "nact_preferences_editor_on_runtime_init_dialog";
 	gboolean sort_alpha, add_about_item;
+	gboolean relabel;
 	GtkWidget *button;
 
 	g_debug( "%s: editor=%p, user_data=%p", thisfn, ( void * ) editor, ( void * ) user_data );
@@ -323,7 +337,17 @@ on_base_runtime_init_dialog( NactPreferencesEditor *editor, gpointer user_data )
 			"clicked",
 			G_CALLBACK( on_ok_clicked ));
 
-	/*setup_buttons( editor, FALSE );*/
+	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 );
+
+	relabel = base_iprefs_get_bool( BASE_IPREFS( editor ), BASE_IPREFS_RELABEL_ACTIONS );
+	button = base_window_get_widget( BASE_WINDOW( editor ), "RelabelActionButton" );
+	gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( button ), relabel );
+
+	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 );
 }
 
 /*
@@ -399,6 +423,7 @@ save_preferences( NactPreferencesEditor *editor )
 {
 	GtkWidget *button;
 	gboolean enabled;
+	gboolean relabel;
 
 	button = base_window_get_widget( BASE_WINDOW( editor ), "SortAlphabeticalButton" );
 	enabled = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( button ));
@@ -407,6 +432,18 @@ save_preferences( NactPreferencesEditor *editor )
 	button = base_window_get_widget( BASE_WINDOW( editor ), "AddAboutButton" );
 	enabled = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( button ));
 	na_iprefs_set_add_about_item( NA_IPREFS( editor ), enabled );
+
+	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 );
+
+	button = base_window_get_widget( BASE_WINDOW( editor ), "RelabelActionButton" );
+	relabel = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( button ));
+	base_iprefs_set_bool( BASE_IPREFS( editor ), BASE_IPREFS_RELABEL_ACTIONS, relabel );
+
+	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 );
 }
 
 static gboolean
diff --git a/src/nact/nautilus-actions-config-tool.ui b/src/nact/nautilus-actions-config-tool.ui
index 0918be4..d940bbc 100644
--- a/src/nact/nautilus-actions-config-tool.ui
+++ b/src/nact/nautilus-actions-config-tool.ui
@@ -1014,10 +1014,10 @@ Defining several profiles lets you have several commands, each applying with a d
         <child>
           <object class="GtkFileChooserWidget" id="ImportFileChooser">
             <property name="visible">True</property>
+            <property name="use_preview_label">False</property>
             <property name="preview_widget_active">False</property>
-            <property name="local_only">False</property>
             <property name="select_multiple">True</property>
-            <property name="use_preview_label">False</property>
+            <property name="local_only">False</property>
           </object>
           <packing>
             <property name="position">0</property>
@@ -1609,58 +1609,179 @@ Be warned: you will not be prompted another time. This mode may be dangerous.</p
         <property name="visible">True</property>
         <property name="spacing">2</property>
         <child>
-          <object class="GtkFrame" id="frame1">
+          <object class="GtkNotebook" id="notebook1">
             <property name="visible">True</property>
-            <property name="label_xalign">0</property>
-            <property name="shadow_type">in</property>
+            <property name="can_focus">True</property>
             <child>
-              <object class="GtkAlignment" id="alignment1">
+              <object class="GtkVBox" id="vbox25">
                 <property name="visible">True</property>
-                <property name="left_padding">12</property>
+                <property name="orientation">vertical</property>
                 <child>
-                  <object class="GtkVBox" id="vbox17">
+                  <object class="GtkFrame" id="frame1">
                     <property name="visible">True</property>
-                    <property name="border_width">10</property>
-                    <property name="spacing">10</property>
+                    <property name="border_width">6</property>
+                    <property name="label_xalign">0</property>
+                    <property name="shadow_type">in</property>
                     <child>
-                      <object class="GtkCheckButton" id="SortAlphabeticalButton">
-                        <property name="label" translatable="yes">_Sort actions in alphabetical order</property>
+                      <object class="GtkAlignment" id="alignment1">
                         <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="receives_default">False</property>
-                        <property name="tooltip_text" translatable="yes">When checked, actions appear in Nautilus context menu in alphabetical order of their label. Unchecked, this option lets you reorder yourself the actions.</property>
-                        <property name="use_underline">True</property>
-                        <property name="draw_indicator">True</property>
+                        <property name="left_padding">12</property>
+                        <child>
+                          <object class="GtkVBox" id="vbox17">
+                            <property name="visible">True</property>
+                            <property name="border_width">6</property>
+                            <property name="orientation">vertical</property>
+                            <child>
+                              <object class="GtkCheckButton" id="SortAlphabeticalButton">
+                                <property name="label" translatable="yes">_Sort actions in alphabetical order</property>
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="receives_default">False</property>
+                                <property name="tooltip_text" translatable="yes">When checked, the actions will be forced to be displayed in ascending alphabetical order of their label. They cannot be reordered in the user interface.</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="AddAboutButton">
+                                <property name="label" translatable="yes">Add an '_About Nautilus Actions' item in the Nautilus context menu</property>
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="receives_default">False</property>
+                                <property name="tooltip_text" translatable="yes">When checked and a root submenu is defined, an 'About Nautilus Actions' item will be added at the end of the root submenu in the Nautilus context menu.</property>
+                                <property name="use_underline">True</property>
+                                <property name="draw_indicator">True</property>
+                              </object>
+                              <packing>
+                                <property name="position">1</property>
+                              </packing>
+                            </child>
+                          </object>
+                        </child>
                       </object>
-                      <packing>
-                        <property name="position">0</property>
-                      </packing>
                     </child>
+                    <child type="label">
+                      <object class="GtkLabel" id="label41">
+                        <property name="visible">True</property>
+                        <property name="xpad">5</property>
+                        <property name="label" translatable="yes">&lt;b&gt;Nautilus menu layout&lt;/b&gt;</property>
+                        <property name="use_markup">True</property>
+                      </object>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+              </object>
+            </child>
+            <child type="tab">
+              <object class="GtkLabel" id="label39">
+                <property name="visible">True</property>
+                <property name="tooltip_text" translatable="yes">Edit here preferences which have an impact on Nautilus Actions plugin appearance and layout.</property>
+                <property name="label" translatable="yes">_Runtime preferences</property>
+                <property name="use_underline">True</property>
+              </object>
+              <packing>
+                <property name="tab_fill">False</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkVBox" id="vbox26">
+                <property name="visible">True</property>
+                <property name="orientation">vertical</property>
+                <child>
+                  <object class="GtkFrame" id="frame2">
+                    <property name="visible">True</property>
+                    <property name="border_width">6</property>
+                    <property name="label_xalign">0</property>
+                    <property name="shadow_type">in</property>
                     <child>
-                      <object class="GtkCheckButton" id="AddAboutButton">
-                        <property name="label" translatable="yes">Add an '_About Nautilus Actions' item in the Nautilus context menu</property>
+                      <object class="GtkAlignment" id="alignment2">
                         <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="receives_default">False</property>
-                        <property name="tooltip_text" translatable="yes">When checked, and if only a single entry is defined as a root menu in the Nautilus context menu, then add an "About Nautilus Actions" at the end of the first level of your submenu.</property>
-                        <property name="use_underline">True</property>
-                        <property name="draw_indicator">True</property>
+                        <property name="left_padding">12</property>
+                        <child>
+                          <object class="GtkVBox" id="vbox27">
+                            <property name="visible">True</property>
+                            <property name="border_width">6</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 pasted or duplicated menu will be relabeled as 'Copy of &lt;original&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 pasted or duplicated action will be relabeled as 'Copy of &lt;original&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 pasted or duplicated profile will be relabeled as 'Copy of &lt;original&gt;'.</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>
+                    </child>
+                    <child type="label">
+                      <object class="GtkLabel" id="label42">
+                        <property name="visible">True</property>
+                        <property name="label" translatable="yes">&lt;b&gt; Relabeling items when pasted or duplicated &lt;/b&gt;</property>
+                        <property name="use_markup">True</property>
                       </object>
-                      <packing>
-                        <property name="position">1</property>
-                      </packing>
                     </child>
                   </object>
+                  <packing>
+                    <property name="position">0</property>
+                  </packing>
                 </child>
               </object>
+              <packing>
+                <property name="position">1</property>
+              </packing>
             </child>
-            <child type="label">
-              <object class="GtkLabel" id="label1">
+            <child type="tab">
+              <object class="GtkLabel" id="label40">
                 <property name="visible">True</property>
-                <property name="xpad">5</property>
-                <property name="label" translatable="yes">&lt;b&gt;Edit your preferences here&lt;/b&gt;</property>
-                <property name="use_markup">True</property>
+                <property name="tooltip_text" translatable="yes">There preferences only have an impact on nautilus-actions-config-tool user interface.</property>
+                <property name="label" translatable="yes">_UI Preferences</property>
+                <property name="use_underline">True</property>
               </object>
+              <packing>
+                <property name="position">1</property>
+                <property name="tab_fill">False</property>
+              </packing>
             </child>
           </object>
           <packing>
@@ -1715,16 +1836,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]