[nautilus-actions] Label column is not editable when read-only or locked down



commit 248aa85bf0ccd85cc495d9a7b9e04faf4ac553b7
Author: Pierre Wieser <pwieser trychlos org>
Date:   Sun Dec 13 00:06:20 2009 +0100

    Label column is not editable when read-only or locked down

 ChangeLog                                  |    4 ++++
 TODO                                       |    1 -
 nautilus-actions/nact/nact-iactions-list.c |   13 ++++++++-----
 3 files changed, 12 insertions(+), 6 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 001b4e7..21f1a64 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2009-12-12 Pierre Wieser <pwieser trychlos org>
 
+	* nautilus-actions/nact/nact-iactions-list.c
+	(nact_iactions_list_initial_load_toplevel, display_label):
+	Label column is not editable when read-only or locked down.
+
 	* nautilus-actions/nact/nact-main-menubar.c (on_update_sensitivities):
 	Do not enable 'cut' if locked down.
 
diff --git a/TODO b/TODO
index ab80086..67aca4e 100644
--- a/TODO
+++ b/TODO
@@ -100,5 +100,4 @@
 - desktop provider: fix default toolbar label
 
 - lockdown:
-  inline edition should be disabled
   all entry fields should be readonly
diff --git a/nautilus-actions/nact/nact-iactions-list.c b/nautilus-actions/nact/nact-iactions-list.c
index fdb05da..a0311f8 100644
--- a/nautilus-actions/nact/nact-iactions-list.c
+++ b/nautilus-actions/nact/nact-iactions-list.c
@@ -465,11 +465,6 @@ nact_iactions_list_initial_load_toplevel( NactIActionsList *instance )
 		gtk_tree_view_column_set_title( column, _( "Label" ));
 		gtk_tree_view_column_set_sort_column_id( column, IACTIONS_LIST_LABEL_COLUMN );
 		renderer = gtk_cell_renderer_text_new();
-
-		if( ialid->management_mode == IACTIONS_LIST_MANAGEMENT_MODE_EDITION ){
-			g_object_set( G_OBJECT( renderer ), "editable", TRUE, NULL );
-		}
-
 		gtk_tree_view_column_pack_start( column, renderer, TRUE );
 		gtk_tree_view_column_set_cell_data_func(
 				column, renderer, ( GtkTreeCellDataFunc ) display_label, instance, NULL );
@@ -1639,11 +1634,15 @@ display_label( GtkTreeViewColumn *column, GtkCellRenderer *cell, GtkTreeModel *m
 	gboolean modified = FALSE;
 	gboolean valid = TRUE;
 	IActionsListInstanceData *ialid;
+	gboolean lockdown;
+	gboolean readonly;
 
 	gtk_tree_model_get( model, iter, IACTIONS_LIST_NAOBJECT_COLUMN, &object, -1 );
 	g_object_unref( object );
 	g_return_if_fail( NA_IS_OBJECT( object ));
 
+	lockdown = nact_window_is_lockdown( NACT_WINDOW( instance ));
+
 	ialid = get_instance_data( instance );
 	label = na_object_get_label( object );
 	g_object_set( cell, "style-set", FALSE, NULL );
@@ -1653,6 +1652,7 @@ display_label( GtkTreeViewColumn *column, GtkCellRenderer *cell, GtkTreeModel *m
 
 		modified = na_object_is_modified( object );
 		valid = na_object_is_valid( object );
+		readonly = na_object_is_readonly( object );
 
 		if( modified ){
 			g_object_set( cell, "style", PANGO_STYLE_ITALIC, "style-set", TRUE, NULL );
@@ -1660,6 +1660,9 @@ display_label( GtkTreeViewColumn *column, GtkCellRenderer *cell, GtkTreeModel *m
 		if( !valid ){
 			g_object_set( cell, "foreground", "Red", "foreground-set", TRUE, NULL );
 		}
+		if( !lockdown && !readonly ){
+			g_object_set( cell, "editable", TRUE, NULL );
+		}
 	}
 
 	g_object_set( cell, "text", label, NULL );



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