[nautilus-actions] Review NactICommandTab page



commit cbc03277a214727e738064878a63b04c9ae25b29
Author: Pierre Wieser <pwieser trychlos org>
Date:   Wed Jun 16 20:45:49 2010 +0200

    Review NactICommandTab page

 ChangeLog                         |    3 +
 src/nact/nact-iaction-tab.c       |  157 ++++++++++++++---------------
 src/nact/nact-ibasenames-tab.c    |    2 +-
 src/nact/nact-icapabilities-tab.c |   10 +-
 src/nact/nact-icommand-tab.c      |  199 ++++++++++++++++---------------------
 src/nact/nact-icommand-tab.h      |    2 +-
 src/nact/nact-ienvironment-tab.c  |    8 +-
 src/nact/nact-iexecution-tab.c    |    2 +-
 src/nact/nact-ifolders-tab.c      |    2 +-
 src/nact/nact-ischemes-tab.c      |    4 +-
 src/nact/nact-main-tab.c          |    2 +
 src/nact/nact-main-tab.h          |    2 +-
 src/nact/nact-main-window.c       |    2 +-
 src/nact/nact-match-list.c        |   14 ++--
 14 files changed, 194 insertions(+), 215 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index b39e38a..9409513 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2010-06-16 Pierre Wieser <pwieser trychlos org>
 
+	* src/nact/nact-icommand-tab.c:
+	* src/nact/nact-icommand-tab.h: Review NactICommandTab page.
+
 	* src/core/na-object-action-factory.c: Fix comment.
 
 	* src/nact/nact-iaction-tab.c:
diff --git a/src/nact/nact-iaction-tab.c b/src/nact/nact-iaction-tab.c
index 47d055f..b4af879 100644
--- a/src/nact/nact-iaction-tab.c
+++ b/src/nact/nact-iaction-tab.c
@@ -84,22 +84,16 @@ static void          on_tab_updatable_selection_changed( NactIActionTab *instanc
 
 static void          on_target_selection_toggled( GtkToggleButton *button, NactIActionTab *instance );
 static void          on_target_location_toggled( GtkToggleButton *button, NactIActionTab *instance );
-
 static void          check_for_label( NactIActionTab *instance, GtkEntry *entry, const gchar *label );
 static void          on_label_changed( GtkEntry *entry, NactIActionTab *instance );
 static void          set_label_label( NactIActionTab *instance, const gchar *color );
-
 static void          on_target_toolbar_toggled( GtkToggleButton *button, NactIActionTab *instance );
-
 static void          on_toolbar_same_label_toggled( GtkToggleButton *button, NactIActionTab *instance );
 static void          toolbar_same_label_set_sensitive( NactIActionTab *instance, NAObjectItem *item );
-
 static void          setup_toolbar_label( NactIActionTab *instance, NAObjectItem *item, const gchar *label );
 static void          on_toolbar_label_changed( GtkEntry *entry, NactIActionTab *instance );
 static void          toolbar_label_set_sensitive( NactIActionTab *instance, NAObjectItem *item );
-
 static void          on_tooltip_changed( GtkEntry *entry, NactIActionTab *instance );
-
 static GtkTreeModel *create_stock_icon_model( void );
 static void          icon_combo_list_fill( GtkComboBoxEntry* combo );
 static void          on_icon_browse( GtkButton *button, NactIActionTab *instance );
@@ -387,6 +381,7 @@ on_tab_updatable_selection_changed( NactIActionTab *instance, gint count_selecte
 	static const gchar *thisfn = "nact_iaction_tab_on_tab_updatable_selection_changed";
 	gboolean enable_tab;
 	NAObjectItem *item;
+	gboolean editable;
 	gboolean target_selection, target_location, target_toolbar;
 	gboolean enable_label;
 	gboolean same_label;
@@ -394,7 +389,6 @@ on_tab_updatable_selection_changed( NactIActionTab *instance, gint count_selecte
 	gchar *label, *tooltip, *icon;
 	GtkButton *icon_button;
 	GtkToggleButton *toggle;
-	gboolean editable;
 
 	g_return_if_fail( BASE_IS_WINDOW( instance ));
 	g_return_if_fail( NACT_IS_IACTION_TAB( instance ));
@@ -406,87 +400,90 @@ on_tab_updatable_selection_changed( NactIActionTab *instance, gint count_selecte
 		enable_tab = ( count_selected == 1 );
 		nact_main_tab_enable_page( NACT_MAIN_WINDOW( instance ), TAB_ACTION, enable_tab );
 
-		g_object_get(
-			G_OBJECT( instance ),
-			TAB_UPDATABLE_PROP_SELECTED_ITEM, &item,
-			TAB_UPDATABLE_PROP_EDITABLE, &editable,
-			NULL );
-
-		target_selection = ( item && (
-				( NA_IS_OBJECT_ACTION( item ) && na_object_is_target_selection( item )) ||
-				( NA_IS_OBJECT_MENU( item ))));
+		if( enable_tab ){
+			st_on_selection_change = TRUE;
 
-		target_location = ( item && (
-				( NA_IS_OBJECT_ACTION( item ) && na_object_is_target_location( item )) ||
-				( NA_IS_OBJECT_MENU( item ))));
+			g_object_get(
+				G_OBJECT( instance ),
+				TAB_UPDATABLE_PROP_SELECTED_ITEM, &item,
+				TAB_UPDATABLE_PROP_EDITABLE, &editable,
+				NULL );
 
-		target_toolbar = ( item && (
-				( NA_IS_OBJECT_ACTION( item ) && na_object_is_target_toolbar( NA_OBJECT_ACTION( item )))));
+			target_selection = ( item && (
+					( NA_IS_OBJECT_ACTION( item ) && na_object_is_target_selection( item )) ||
+					( NA_IS_OBJECT_MENU( item ))));
 
-		st_on_selection_change = TRUE;
+			target_location = ( item && (
+					( NA_IS_OBJECT_ACTION( item ) && na_object_is_target_location( item )) ||
+					( NA_IS_OBJECT_MENU( item ))));
 
-		toggle = GTK_TOGGLE_BUTTON( base_window_get_widget( BASE_WINDOW( instance ), "ActionTargetSelectionButton" ));
-		gtk_toggle_button_set_active( toggle, target_selection );
-		gtk_widget_set_sensitive( GTK_WIDGET( toggle ), item && NA_IS_OBJECT_ACTION( item ));
-		nact_gtk_utils_set_editable( GTK_OBJECT( toggle ), editable );
+			target_toolbar = ( item && (
+					( NA_IS_OBJECT_ACTION( item ) && na_object_is_target_toolbar( NA_OBJECT_ACTION( item )))));
 
-		toggle = GTK_TOGGLE_BUTTON( base_window_get_widget( BASE_WINDOW( instance ), "ActionTargetLocationButton" ));
-		gtk_toggle_button_set_active( toggle, target_location );
-		gtk_widget_set_sensitive( GTK_WIDGET( toggle ), item && NA_IS_OBJECT_ACTION( item ));
-		nact_gtk_utils_set_editable( GTK_OBJECT( toggle ), editable );
 
-		enable_label = ( item && ( NA_IS_OBJECT_MENU( item ) || target_selection || target_location ));
-		label_widget = base_window_get_widget( BASE_WINDOW( instance ), "ActionMenuLabelEntry" );
-		label = item ? na_object_get_label( item ) : g_strdup( "" );
-		label = label ? label : g_strdup( "" );
-		gtk_entry_set_text( GTK_ENTRY( label_widget ), label );
-		if( item ){
-			check_for_label( instance, GTK_ENTRY( label_widget ), label );
-		}
-		g_free( label );
-		gtk_widget_set_sensitive( label_widget, enable_label );
-		nact_gtk_utils_set_editable( GTK_OBJECT( label_widget ), editable );
+			toggle = GTK_TOGGLE_BUTTON( base_window_get_widget( BASE_WINDOW( instance ), "ActionTargetSelectionButton" ));
+			gtk_toggle_button_set_active( toggle, target_selection );
+			gtk_widget_set_sensitive( GTK_WIDGET( toggle ), item && NA_IS_OBJECT_ACTION( item ));
+			nact_gtk_utils_set_editable( GTK_OBJECT( toggle ), editable );
 
-		toggle = GTK_TOGGLE_BUTTON( base_window_get_widget( BASE_WINDOW( instance ), "ActionTargetToolbarButton" ));
-		gtk_toggle_button_set_active( toggle, target_toolbar );
-		gtk_widget_set_sensitive( GTK_WIDGET( toggle ), item && NA_IS_OBJECT_ACTION( item ));
-		nact_gtk_utils_set_editable( GTK_OBJECT( toggle ), editable );
+			toggle = GTK_TOGGLE_BUTTON( base_window_get_widget( BASE_WINDOW( instance ), "ActionTargetLocationButton" ));
+			gtk_toggle_button_set_active( toggle, target_location );
+			gtk_widget_set_sensitive( GTK_WIDGET( toggle ), item && NA_IS_OBJECT_ACTION( item ));
+			nact_gtk_utils_set_editable( GTK_OBJECT( toggle ), editable );
 
-		toggle = GTK_TOGGLE_BUTTON( base_window_get_widget( BASE_WINDOW( instance ), "ToolbarSameLabelButton" ));
-		same_label = item && NA_IS_OBJECT_ACTION( item ) ? na_object_is_toolbar_same_label( NA_OBJECT_ACTION( item )) : FALSE;
-		gtk_toggle_button_set_active( toggle, same_label );
-		toolbar_same_label_set_sensitive( instance, item );
-		nact_gtk_utils_set_editable( GTK_OBJECT( toggle ), editable );
+			enable_label = ( item && ( NA_IS_OBJECT_MENU( item ) || target_selection || target_location ));
+			label_widget = base_window_get_widget( BASE_WINDOW( instance ), "ActionMenuLabelEntry" );
+			label = item ? na_object_get_label( item ) : g_strdup( "" );
+			label = label ? label : g_strdup( "" );
+			gtk_entry_set_text( GTK_ENTRY( label_widget ), label );
+			if( item ){
+				check_for_label( instance, GTK_ENTRY( label_widget ), label );
+			}
+			g_free( label );
+			gtk_widget_set_sensitive( label_widget, enable_label );
+			nact_gtk_utils_set_editable( GTK_OBJECT( label_widget ), editable );
 
-		label_widget = base_window_get_widget( BASE_WINDOW( instance ), "ActionToolbarLabelEntry" );
-		label = item && NA_IS_OBJECT_ACTION( item ) ? na_object_get_toolbar_label( item ) : g_strdup( "" );
-		label = label ? label : g_strdup( "" );
-		gtk_entry_set_text( GTK_ENTRY( label_widget ), label );
-		g_free( label );
-		toolbar_label_set_sensitive( instance, item );
-		nact_gtk_utils_set_editable( GTK_OBJECT( label_widget ), editable );
+			toggle = GTK_TOGGLE_BUTTON( base_window_get_widget( BASE_WINDOW( instance ), "ActionTargetToolbarButton" ));
+			gtk_toggle_button_set_active( toggle, target_toolbar );
+			gtk_widget_set_sensitive( GTK_WIDGET( toggle ), item && NA_IS_OBJECT_ACTION( item ));
+			nact_gtk_utils_set_editable( GTK_OBJECT( toggle ), editable );
 
-		tooltip_widget = base_window_get_widget( BASE_WINDOW( instance ), "ActionTooltipEntry" );
-		tooltip = item ? na_object_get_tooltip( item ) : g_strdup( "" );
-		tooltip = tooltip ? tooltip : g_strdup( "" );
-		gtk_entry_set_text( GTK_ENTRY( tooltip_widget ), tooltip );
-		g_free( tooltip );
-		gtk_widget_set_sensitive( tooltip_widget, item != NULL );
-		nact_gtk_utils_set_editable( GTK_OBJECT( tooltip_widget ), editable );
+			toggle = GTK_TOGGLE_BUTTON( base_window_get_widget( BASE_WINDOW( instance ), "ToolbarSameLabelButton" ));
+			same_label = item && NA_IS_OBJECT_ACTION( item ) ? na_object_is_toolbar_same_label( NA_OBJECT_ACTION( item )) : FALSE;
+			gtk_toggle_button_set_active( toggle, same_label );
+			toolbar_same_label_set_sensitive( instance, item );
+			nact_gtk_utils_set_editable( GTK_OBJECT( toggle ), editable );
 
-		icon_widget = base_window_get_widget( BASE_WINDOW( instance ), "ActionIconComboBoxEntry" );
-		icon = item ? na_object_get_icon( item ) : g_strdup( "" );
-		icon = icon ? icon : g_strdup( "" );
-		gtk_entry_set_text( GTK_ENTRY( gtk_bin_get_child( GTK_BIN( icon_widget ))), icon );
-		g_free( icon );
-		gtk_widget_set_sensitive( icon_widget, item != NULL );
-		nact_gtk_utils_set_editable( GTK_OBJECT( icon_widget ), editable );
-
-		icon_button = GTK_BUTTON( base_window_get_widget( BASE_WINDOW( instance ), "ActionIconBrowseButton" ));
-		gtk_widget_set_sensitive( GTK_WIDGET( icon_button ), item != NULL );
-		nact_gtk_utils_set_editable( GTK_OBJECT( icon_button ), editable );
-
-		st_on_selection_change = FALSE;
+			label_widget = base_window_get_widget( BASE_WINDOW( instance ), "ActionToolbarLabelEntry" );
+			label = item && NA_IS_OBJECT_ACTION( item ) ? na_object_get_toolbar_label( item ) : g_strdup( "" );
+			label = label ? label : g_strdup( "" );
+			gtk_entry_set_text( GTK_ENTRY( label_widget ), label );
+			g_free( label );
+			toolbar_label_set_sensitive( instance, item );
+			nact_gtk_utils_set_editable( GTK_OBJECT( label_widget ), editable );
+
+			tooltip_widget = base_window_get_widget( BASE_WINDOW( instance ), "ActionTooltipEntry" );
+			tooltip = item ? na_object_get_tooltip( item ) : g_strdup( "" );
+			tooltip = tooltip ? tooltip : g_strdup( "" );
+			gtk_entry_set_text( GTK_ENTRY( tooltip_widget ), tooltip );
+			g_free( tooltip );
+			gtk_widget_set_sensitive( tooltip_widget, item != NULL );
+			nact_gtk_utils_set_editable( GTK_OBJECT( tooltip_widget ), editable );
+
+			icon_widget = base_window_get_widget( BASE_WINDOW( instance ), "ActionIconComboBoxEntry" );
+			icon = item ? na_object_get_icon( item ) : g_strdup( "" );
+			icon = icon ? icon : g_strdup( "" );
+			gtk_entry_set_text( GTK_ENTRY( gtk_bin_get_child( GTK_BIN( icon_widget ))), icon );
+			g_free( icon );
+			gtk_widget_set_sensitive( icon_widget, item != NULL );
+			nact_gtk_utils_set_editable( GTK_OBJECT( icon_widget ), editable );
+
+			icon_button = GTK_BUTTON( base_window_get_widget( BASE_WINDOW( instance ), "ActionIconBrowseButton" ));
+			gtk_widget_set_sensitive( GTK_WIDGET( icon_button ), item != NULL );
+			nact_gtk_utils_set_editable( GTK_OBJECT( icon_button ), editable );
+
+			st_on_selection_change = FALSE;
+		}
 	}
 }
 
diff --git a/src/nact/nact-ibasenames-tab.c b/src/nact/nact-ibasenames-tab.c
index 6bb45dc..8203a60 100644
--- a/src/nact/nact-ibasenames-tab.c
+++ b/src/nact/nact-ibasenames-tab.c
@@ -250,7 +250,7 @@ on_matchcase_toggled( GtkToggleButton *button, BaseWindow *window )
 		g_object_get(
 				G_OBJECT( window ),
 				TAB_UPDATABLE_PROP_SELECTED_ITEM, &item,
-				TAB_UPDATABLE_PROP_EDITED_PROFILE, &profile,
+				TAB_UPDATABLE_PROP_SELECTED_PROFILE, &profile,
 				TAB_UPDATABLE_PROP_EDITABLE, &editable,
 				NULL );
 
diff --git a/src/nact/nact-icapabilities-tab.c b/src/nact/nact-icapabilities-tab.c
index 97ac63e..714eef3 100644
--- a/src/nact/nact-icapabilities-tab.c
+++ b/src/nact/nact-icapabilities-tab.c
@@ -295,7 +295,7 @@ on_tab_updatable_selection_changed( NactICapabilitiesTab *instance, gint count_s
 		g_object_get(
 				G_OBJECT( instance ),
 				TAB_UPDATABLE_PROP_SELECTED_ITEM, &item,
-				TAB_UPDATABLE_PROP_EDITED_PROFILE, &profile,
+				TAB_UPDATABLE_PROP_SELECTED_PROFILE, &profile,
 				TAB_UPDATABLE_PROP_EDITABLE, &editable,
 				NULL );
 
@@ -333,7 +333,7 @@ on_selcount_ope_changed( GtkComboBox *combo, NactICapabilitiesTab *instance )
 	g_object_get(
 			G_OBJECT( instance ),
 			TAB_UPDATABLE_PROP_SELECTED_ITEM, &edited,
-			TAB_UPDATABLE_PROP_EDITED_PROFILE, &profile,
+			TAB_UPDATABLE_PROP_SELECTED_PROFILE, &profile,
 			TAB_UPDATABLE_PROP_EDITABLE, &editable,
 			NULL );
 
@@ -359,7 +359,7 @@ on_selcount_int_changed( GtkEntry *entry, NactICapabilitiesTab *instance )
 	g_object_get(
 			G_OBJECT( instance ),
 			TAB_UPDATABLE_PROP_SELECTED_ITEM, &edited,
-			TAB_UPDATABLE_PROP_EDITED_PROFILE, &profile,
+			TAB_UPDATABLE_PROP_SELECTED_PROFILE, &profile,
 			TAB_UPDATABLE_PROP_EDITABLE, &editable,
 			NULL );
 
@@ -385,7 +385,7 @@ on_add_clicked( GtkButton *button, BaseWindow *window )
 	g_object_get(
 			G_OBJECT( window ),
 			TAB_UPDATABLE_PROP_SELECTED_ITEM, &item,
-			TAB_UPDATABLE_PROP_EDITED_PROFILE, &profile,
+			TAB_UPDATABLE_PROP_SELECTED_PROFILE, &profile,
 			NULL );
 
 	context = ( profile ? NA_ICONTEXT( profile ) : ( NAIContext * ) item );
@@ -412,7 +412,7 @@ tab_set_sensitive( NactICapabilitiesTab *instance )
 	g_object_get(
 			G_OBJECT( instance ),
 			TAB_UPDATABLE_PROP_SELECTED_ITEM, &item,
-			TAB_UPDATABLE_PROP_EDITED_PROFILE, &profile,
+			TAB_UPDATABLE_PROP_SELECTED_PROFILE, &profile,
 			NULL );
 
 	enable_tab = ( item != NULL );
diff --git a/src/nact/nact-icommand-tab.c b/src/nact/nact-icommand-tab.c
index 0bbc784..c792756 100644
--- a/src/nact/nact-icommand-tab.c
+++ b/src/nact/nact-icommand-tab.c
@@ -81,7 +81,6 @@ static void       interface_base_finalize( NactICommandTabInterface *klass );
 
 static void       on_iactions_list_column_edited( NactICommandTab *instance, NAObject *object, gchar *text, gint column );
 static void       on_tab_updatable_selection_changed( NactICommandTab *instance, gint count_selected );
-static gboolean   tab_set_sensitive( NactICommandTab *instance );
 
 static void       check_for_label( NactICommandTab *instance, GtkEntry *entry, const gchar *label );
 static GtkWidget *get_label_entry( NactICommandTab *instance );
@@ -187,11 +186,12 @@ nact_icommand_tab_initial_load_toplevel( NactICommandTab *instance )
 {
 	static const gchar *thisfn = "nact_icommand_tab_initial_load_toplevel";
 
-	g_debug( "%s: instance=%p", thisfn, ( void * ) instance );
 	g_return_if_fail( NACT_IS_ICOMMAND_TAB( instance ));
 
 	if( st_initialized && !st_finalized ){
 
+		g_debug( "%s: instance=%p", thisfn, ( void * ) instance );
+
 		nact_iprefs_migrate_key( BASE_WINDOW( instance ), "iconditions-legend-dialog", IPREFS_LEGEND_DIALOG );
 		nact_iprefs_migrate_key( BASE_WINDOW( instance ), "iconditions-command-chooser", IPREFS_COMMAND_CHOOSER );
 		nact_iprefs_migrate_key( BASE_WINDOW( instance ), "iconditions-folder-uri", IPREFS_FOLDER_URI );
@@ -212,11 +212,12 @@ nact_icommand_tab_runtime_init_toplevel( NactICommandTab *instance )
 	GtkWidget *label_entry, *path_entry, *parameters_entry, *wdir_entry;
 	GtkButton *path_button, *legend_button, *wdir_button;
 
-	g_debug( "%s: instance=%p", thisfn, ( void * ) instance );
 	g_return_if_fail( NACT_IS_ICOMMAND_TAB( instance ));
 
 	if( st_initialized && !st_finalized ){
 
+		g_debug( "%s: instance=%p", thisfn, ( void * ) instance );
+
 		label_entry = get_label_entry( instance );
 		base_window_signal_connect(
 				BASE_WINDOW( instance ),
@@ -285,10 +286,11 @@ nact_icommand_tab_all_widgets_showed( NactICommandTab *instance )
 {
 	static const gchar *thisfn = "nact_icommand_tab_all_widgets_showed";
 
-	g_debug( "%s: instance=%p", thisfn, ( void * ) instance );
 	g_return_if_fail( NACT_IS_ICOMMAND_TAB( instance ));
 
 	if( st_initialized && !st_finalized ){
+
+		g_debug( "%s: instance=%p", thisfn, ( void * ) instance );
 	}
 }
 
@@ -303,10 +305,12 @@ nact_icommand_tab_dispose( NactICommandTab *instance )
 {
 	static const gchar *thisfn = "nact_icommand_tab_dispose";
 
-	g_debug( "%s: instance=%p", thisfn, ( void * ) instance );
 	g_return_if_fail( NACT_IS_ICOMMAND_TAB( instance ));
 
 	if( st_initialized && !st_finalized ){
+
+		g_debug( "%s: instance=%p", thisfn, ( void * ) instance );
+
 		legend_dialog_hide( instance );
 	}
 }
@@ -331,96 +335,81 @@ static void
 on_tab_updatable_selection_changed( NactICommandTab *instance, gint count_selected )
 {
 	static const gchar *thisfn = "nact_icommand_tab_on_tab_updatable_selection_changed";
-	NAObjectItem *item;
 	NAObjectProfile *profile;
+	gboolean editable;
 	gboolean enable_tab;
 	GtkWidget *label_entry, *path_entry, *parameters_entry, *wdir_entry;
 	gchar *label, *path, *parameters, *wdir;
-	gboolean editable;
 	GtkButton *path_button;
 	GtkButton *legend_button;
 
-	g_debug( "%s: instance=%p, count_selected=%d", thisfn, ( void * ) instance, count_selected );
 	g_return_if_fail( NACT_IS_ICOMMAND_TAB( instance ));
 
 	if( st_initialized && !st_finalized ){
 
-		st_on_selection_change = TRUE;
+		g_debug( "%s: instance=%p, count_selected=%d", thisfn, ( void * ) instance, count_selected );
 
 		g_object_get(
 				G_OBJECT( instance ),
-				TAB_UPDATABLE_PROP_SELECTED_ITEM, &item,
-				TAB_UPDATABLE_PROP_EDITED_PROFILE, &profile,
+				TAB_UPDATABLE_PROP_SELECTED_PROFILE, &profile,
 				TAB_UPDATABLE_PROP_EDITABLE, &editable,
 				NULL );
 
-		enable_tab = tab_set_sensitive( instance );
-
-		label_entry = get_label_entry( instance );
-		label = profile ? na_object_get_label( profile ) : g_strdup( "" );
-		label = label ? label : g_strdup( "" );
-		gtk_entry_set_text( GTK_ENTRY( label_entry ), label );
-		check_for_label( instance, GTK_ENTRY( label_entry ), label );
-		g_free( label );
-		gtk_widget_set_sensitive( label_entry, profile != NULL );
-		nact_gtk_utils_set_editable( GTK_OBJECT( label_entry ), editable );
-
-		path_entry = get_path_entry( instance );
-		path = profile ? na_object_get_path( profile ) : g_strdup( "" );
-		path = path ? path : g_strdup( "" );
-		gtk_entry_set_text( GTK_ENTRY( path_entry ), path );
-		g_free( path );
-		gtk_widget_set_sensitive( path_entry, profile != NULL );
-		nact_gtk_utils_set_editable( GTK_OBJECT( path_entry ), editable );
-
-		path_button = get_path_button( instance );
-		gtk_widget_set_sensitive( GTK_WIDGET( path_button ), profile != NULL );
-		nact_gtk_utils_set_editable( GTK_OBJECT( path_button ), editable );
-
-		parameters_entry = get_parameters_entry( instance );
-		parameters = profile ? na_object_get_parameters( profile ) : g_strdup( "" );
-		parameters = parameters ? parameters : g_strdup( "" );
-		gtk_entry_set_text( GTK_ENTRY( parameters_entry ), parameters );
-		g_free( parameters );
-		gtk_widget_set_sensitive( parameters_entry, profile != NULL );
-		nact_gtk_utils_set_editable( GTK_OBJECT( parameters_entry ), editable );
-
-		legend_button = get_legend_button( instance );
-		gtk_widget_set_sensitive( GTK_WIDGET( legend_button ), profile != NULL );
-
-		wdir_entry = base_window_get_widget( BASE_WINDOW( instance ), "WorkingDirectoryEntry" );
-		wdir = profile ? na_object_get_working_dir( profile ) : g_strdup( "" );
-		wdir = wdir ? wdir : g_strdup( "" );
-		gtk_entry_set_text( GTK_ENTRY( wdir_entry ), wdir );
-		g_free( wdir );
-		gtk_widget_set_sensitive( wdir_entry, profile != NULL );
-		nact_gtk_utils_set_editable( GTK_OBJECT( wdir_entry ), editable );
-
-		st_on_selection_change = FALSE;
+		enable_tab = ( profile != NULL );
+		nact_main_tab_enable_page( NACT_MAIN_WINDOW( instance ), TAB_COMMAND, enable_tab );
+
+		if( enable_tab ){
+			st_on_selection_change = TRUE;
+
+			label_entry = get_label_entry( instance );
+			label = profile ? na_object_get_label( profile ) : g_strdup( "" );
+			label = label ? label : g_strdup( "" );
+			gtk_entry_set_text( GTK_ENTRY( label_entry ), label );
+			check_for_label( instance, GTK_ENTRY( label_entry ), label );
+			g_free( label );
+			gtk_widget_set_sensitive( label_entry, profile != NULL );
+			nact_gtk_utils_set_editable( GTK_OBJECT( label_entry ), editable );
+
+			path_entry = get_path_entry( instance );
+			path = profile ? na_object_get_path( profile ) : g_strdup( "" );
+			path = path ? path : g_strdup( "" );
+			gtk_entry_set_text( GTK_ENTRY( path_entry ), path );
+			g_free( path );
+			gtk_widget_set_sensitive( path_entry, profile != NULL );
+			nact_gtk_utils_set_editable( GTK_OBJECT( path_entry ), editable );
+
+			path_button = get_path_button( instance );
+			gtk_widget_set_sensitive( GTK_WIDGET( path_button ), profile != NULL );
+			nact_gtk_utils_set_editable( GTK_OBJECT( path_button ), editable );
+
+			parameters_entry = get_parameters_entry( instance );
+			parameters = profile ? na_object_get_parameters( profile ) : g_strdup( "" );
+			parameters = parameters ? parameters : g_strdup( "" );
+			gtk_entry_set_text( GTK_ENTRY( parameters_entry ), parameters );
+			g_free( parameters );
+			gtk_widget_set_sensitive( parameters_entry, profile != NULL );
+			nact_gtk_utils_set_editable( GTK_OBJECT( parameters_entry ), editable );
+
+			legend_button = get_legend_button( instance );
+			gtk_widget_set_sensitive( GTK_WIDGET( legend_button ), profile != NULL );
+
+			wdir_entry = base_window_get_widget( BASE_WINDOW( instance ), "WorkingDirectoryEntry" );
+			wdir = profile ? na_object_get_working_dir( profile ) : g_strdup( "" );
+			wdir = wdir ? wdir : g_strdup( "" );
+			gtk_entry_set_text( GTK_ENTRY( wdir_entry ), wdir );
+			g_free( wdir );
+			gtk_widget_set_sensitive( wdir_entry, profile != NULL );
+			nact_gtk_utils_set_editable( GTK_OBJECT( wdir_entry ), editable );
+
+			st_on_selection_change = FALSE;
+		}
 	}
 }
 
-static gboolean
-tab_set_sensitive( NactICommandTab *instance )
-{
-	NAObjectProfile *profile;
-	gboolean enable_tab;
-
-	g_object_get(
-			G_OBJECT( instance ),
-			TAB_UPDATABLE_PROP_EDITED_PROFILE, &profile,
-			NULL );
-
-	enable_tab = ( profile != NULL );
-	nact_main_tab_enable_page( NACT_MAIN_WINDOW( instance ), TAB_COMMAND, enable_tab );
-
-	return( enable_tab );
-}
-
 static void
 check_for_label( NactICommandTab *instance, GtkEntry *entry, const gchar *label )
 {
-	NAObjectProfile *edited;
+	NAObjectProfile *profile;
 
 	nact_main_statusbar_hide_status(
 			NACT_MAIN_WINDOW( instance ),
@@ -430,10 +419,10 @@ check_for_label( NactICommandTab *instance, GtkEntry *entry, const gchar *label
 
 	g_object_get(
 			G_OBJECT( instance ),
-			TAB_UPDATABLE_PROP_EDITED_PROFILE, &edited,
+			TAB_UPDATABLE_PROP_SELECTED_PROFILE, &profile,
 			NULL );
 
-	if( edited && g_utf8_strlen( label, -1 ) == 0 ){
+	if( profile && g_utf8_strlen( label, -1 ) == 0 ){
 
 		/* i18n: status bar message when the profile label is empty */
 		nact_main_statusbar_display_status(
@@ -528,20 +517,20 @@ legend_dialog_show( NactICommandTab *instance )
 static void
 on_label_changed( GtkEntry *entry, NactICommandTab *instance )
 {
-	NAObjectProfile *edited;
+	NAObjectProfile *profile;
 	const gchar *label;
 
 	if( !st_on_selection_change ){
 
 		g_object_get(
 				G_OBJECT( instance ),
-				TAB_UPDATABLE_PROP_EDITED_PROFILE, &edited,
+				TAB_UPDATABLE_PROP_SELECTED_PROFILE, &profile,
 				NULL );
 
-		if( edited ){
+		if( profile ){
 			label = gtk_entry_get_text( entry );
-			na_object_set_label( edited, label );
-			g_signal_emit_by_name( G_OBJECT( instance ), TAB_UPDATABLE_SIGNAL_ITEM_UPDATED, edited, TRUE );
+			na_object_set_label( profile, label );
+			g_signal_emit_by_name( G_OBJECT( instance ), TAB_UPDATABLE_SIGNAL_ITEM_UPDATED, profile, TRUE );
 			check_for_label( instance, entry, label );
 		}
 	}
@@ -561,19 +550,19 @@ on_legend_clicked( GtkButton *button, NactICommandTab *instance )
 static void
 on_parameters_changed( GtkEntry *entry, NactICommandTab *instance )
 {
-	NAObjectProfile *edited;
+	NAObjectProfile *profile;
 
 	if( !st_on_selection_change ){
 
 		g_object_get(
 				G_OBJECT( instance ),
-				TAB_UPDATABLE_PROP_EDITED_PROFILE, &edited,
+				TAB_UPDATABLE_PROP_SELECTED_PROFILE, &profile,
 				NULL );
 
-		if( edited ){
-			na_object_set_parameters( edited, gtk_entry_get_text( entry ));
-			g_signal_emit_by_name( G_OBJECT( instance ), TAB_UPDATABLE_SIGNAL_ITEM_UPDATED, edited, FALSE );
-			update_example_label( instance, edited );
+		if( profile ){
+			na_object_set_parameters( profile, gtk_entry_get_text( entry ));
+			g_signal_emit_by_name( G_OBJECT( instance ), TAB_UPDATABLE_SIGNAL_ITEM_UPDATED, profile, FALSE );
+			update_example_label( instance, profile );
 		}
 	}
 }
@@ -636,20 +625,20 @@ on_path_browse( GtkButton *button, NactICommandTab *instance )
 static void
 on_path_changed( GtkEntry *entry, NactICommandTab *instance )
 {
-	NAObjectProfile *edited;
+	NAObjectProfile *profile;
 
 	if( !st_on_selection_change ){
 
 		g_object_get(
 				G_OBJECT( instance ),
-				TAB_UPDATABLE_PROP_EDITED_PROFILE, &edited,
+				TAB_UPDATABLE_PROP_SELECTED_PROFILE, &profile,
 				NULL );
 
-		if( edited ){
+		if( profile ){
 
-			na_object_set_path( edited, gtk_entry_get_text( entry ));
-			g_signal_emit_by_name( G_OBJECT( instance ), TAB_UPDATABLE_SIGNAL_ITEM_UPDATED, edited, FALSE );
-			update_example_label( instance, edited );
+			na_object_set_path( profile, gtk_entry_get_text( entry ));
+			g_signal_emit_by_name( G_OBJECT( instance ), TAB_UPDATABLE_SIGNAL_ITEM_UPDATED, profile, FALSE );
+			update_example_label( instance, profile );
 		}
 	}
 }
@@ -693,7 +682,7 @@ on_wdir_browse( GtkButton *button, NactICommandTab *instance )
 	} else {
 		g_object_get(
 				G_OBJECT( instance ),
-				TAB_UPDATABLE_PROP_EDITED_PROFILE, &profile,
+				TAB_UPDATABLE_PROP_SELECTED_PROFILE, &profile,
 				NULL );
 
 		default_value = na_factory_object_get_default( NA_IFACTORY_OBJECT( profile ), NAFO_DATA_WORKING_DIR );
@@ -721,36 +710,24 @@ on_wdir_browse( GtkButton *button, NactICommandTab *instance )
 static void
 on_wdir_changed( GtkEntry *entry, NactICommandTab *instance )
 {
-	NAObjectProfile *edited;
+	NAObjectProfile *profile;
 
 	if( !st_on_selection_change ){
 
 		g_object_get(
 				G_OBJECT( instance ),
-				TAB_UPDATABLE_PROP_EDITED_PROFILE, &edited,
+				TAB_UPDATABLE_PROP_SELECTED_PROFILE, &profile,
 				NULL );
 
-		if( edited ){
-			na_object_set_working_dir( edited, gtk_entry_get_text( entry ));
-			g_signal_emit_by_name( G_OBJECT( instance ), TAB_UPDATABLE_SIGNAL_ITEM_UPDATED, edited, FALSE );
+		if( profile ){
+			na_object_set_working_dir( profile, gtk_entry_get_text( entry ));
+			g_signal_emit_by_name( G_OBJECT( instance ), TAB_UPDATABLE_SIGNAL_ITEM_UPDATED, profile, FALSE );
 		}
 	}
 }
 
 /*
- * Valid parameters :
- *
- * %d : base dir of the (first) selected file(s)/folder(s)
- * %f : the name of the (firstà selected file/folder
- * %h : hostname of the (first) URI
- * %m : list of the basename of the selected files/directories separated by space.
- * %M : list of the selected files/directories with their complete path separated by space.
- * %p : port number of the (first) URI
- * %R : space-separated list of selected URIs
- * %s : scheme of the (first) URI
- * %u : (first) URI
- * %U : username of the (first) URI
- * %% : a percent sign
+ * See core/na-tokens.c for valid parameters
  */
 static gchar *
 parse_parameters( NactICommandTab *instance )
@@ -805,7 +782,7 @@ parse_parameters( NactICommandTab *instance )
 	g_object_get(
 			G_OBJECT( instance ),
 			TAB_UPDATABLE_PROP_SELECTED_ITEM, &item,
-			TAB_UPDATABLE_PROP_EDITED_PROFILE, &profile,
+			TAB_UPDATABLE_PROP_SELECTED_PROFILE, &profile,
 			NULL );
 
 	context = ( profile ? NA_ICONTEXT( profile ) : ( NAIContext * ) item );
diff --git a/src/nact/nact-icommand-tab.h b/src/nact/nact-icommand-tab.h
index 6a0078b..04972d9 100644
--- a/src/nact/nact-icommand-tab.h
+++ b/src/nact/nact-icommand-tab.h
@@ -37,7 +37,7 @@
  * @include: nact/nact-icommand-tab.h
  *
  * This interface implements all the widgets which define the
- * actual action to be executed.
+ * actual action to be executed (from NAObjectProfile).
  */
 
 #include <glib-object.h>
diff --git a/src/nact/nact-ienvironment-tab.c b/src/nact/nact-ienvironment-tab.c
index fbb76b6..4dc4ff5 100644
--- a/src/nact/nact-ienvironment-tab.c
+++ b/src/nact/nact-ienvironment-tab.c
@@ -416,7 +416,7 @@ on_tab_updatable_selection_changed( NactIEnvironmentTab *instance, gint count_se
 		g_object_get(
 				G_OBJECT( instance ),
 				TAB_UPDATABLE_PROP_SELECTED_ITEM, &item,
-				TAB_UPDATABLE_PROP_EDITED_PROFILE, &profile,
+				TAB_UPDATABLE_PROP_SELECTED_PROFILE, &profile,
 				TAB_UPDATABLE_PROP_EDITABLE, &editable,
 				NULL );
 
@@ -544,7 +544,7 @@ on_desktop_toggled( GtkCellRendererToggle *renderer, gchar *path, BaseWindow *wi
 		g_object_get(
 				G_OBJECT( window ),
 				TAB_UPDATABLE_PROP_SELECTED_ITEM, &item,
-				TAB_UPDATABLE_PROP_EDITED_PROFILE, &profile,
+				TAB_UPDATABLE_PROP_SELECTED_PROFILE, &profile,
 				TAB_UPDATABLE_PROP_EDITABLE, &editable,
 				NULL );
 
@@ -558,10 +558,10 @@ on_desktop_toggled( GtkCellRendererToggle *renderer, gchar *path, BaseWindow *wi
 		} else {
 			gtk_list_store_set( GTK_LIST_STORE( model ), &iter, ENV_BOOL_COLUMN, !state, -1 );
 			/*
-			if( g_object_class_find_property( G_OBJECT_GET_CLASS( window ), TAB_UPDATABLE_PROP_EDITED_PROFILE )){
+			if( g_object_class_find_property( G_OBJECT_GET_CLASS( window ), TAB_UPDATABLE_PROP_SELECTED_PROFILE )){
 				g_object_get(
 						G_OBJECT( window ),
-						TAB_UPDATABLE_PROP_EDITED_PROFILE, &edited,
+						TAB_UPDATABLE_PROP_SELECTED_PROFILE, &edited,
 						NULL );
 				if( edited ){
 					na_object_set_scheme( edited, scheme, !state );
diff --git a/src/nact/nact-iexecution-tab.c b/src/nact/nact-iexecution-tab.c
index 52b444e..062b53c 100644
--- a/src/nact/nact-iexecution-tab.c
+++ b/src/nact/nact-iexecution-tab.c
@@ -222,7 +222,7 @@ tab_set_sensitive( NactIExecutionTab *instance )
 
 	g_object_get(
 			G_OBJECT( instance ),
-			TAB_UPDATABLE_PROP_EDITED_PROFILE, &profile,
+			TAB_UPDATABLE_PROP_SELECTED_PROFILE, &profile,
 			NULL );
 
 	enable_tab = ( profile != NULL );
diff --git a/src/nact/nact-ifolders-tab.c b/src/nact/nact-ifolders-tab.c
index 98710c1..e3432e3 100644
--- a/src/nact/nact-ifolders-tab.c
+++ b/src/nact/nact-ifolders-tab.c
@@ -312,7 +312,7 @@ on_tab_updatable_selection_changed( NactIFoldersTab *instance, gint count_select
 	g_object_get(
 			G_OBJECT( instance ),
 			TAB_UPDATABLE_PROP_SELECTED_ITEM, &item,
-			TAB_UPDATABLE_PROP_EDITED_PROFILE, &profile,
+			TAB_UPDATABLE_PROP_SELECTED_PROFILE, &profile,
 			TAB_UPDATABLE_PROP_EDITABLE, &editable,
 			NULL );
 
diff --git a/src/nact/nact-ischemes-tab.c b/src/nact/nact-ischemes-tab.c
index cecf42f..f09c21d 100644
--- a/src/nact/nact-ischemes-tab.c
+++ b/src/nact/nact-ischemes-tab.c
@@ -228,7 +228,7 @@ on_add_from_defaults( GtkButton *button, BaseWindow *window )
 	g_object_get(
 			G_OBJECT( window ),
 			TAB_UPDATABLE_PROP_SELECTED_ITEM, &item,
-			TAB_UPDATABLE_PROP_EDITED_PROFILE, &profile,
+			TAB_UPDATABLE_PROP_SELECTED_PROFILE, &profile,
 			NULL );
 
 	context = ( profile ? NA_ICONTEXT( profile ) : ( NAIContext * ) item );
@@ -257,7 +257,7 @@ on_tab_updatable_selection_changed( BaseWindow *window, gint count_selected )
 	g_object_get(
 			G_OBJECT( window ),
 			TAB_UPDATABLE_PROP_SELECTED_ITEM, &item,
-			TAB_UPDATABLE_PROP_EDITED_PROFILE, &profile,
+			TAB_UPDATABLE_PROP_SELECTED_PROFILE, &profile,
 			TAB_UPDATABLE_PROP_EDITABLE, &editable,
 			NULL );
 
diff --git a/src/nact/nact-main-tab.c b/src/nact/nact-main-tab.c
index 40e3eb0..81a58c5 100644
--- a/src/nact/nact-main-tab.c
+++ b/src/nact/nact-main-tab.c
@@ -32,6 +32,8 @@
 #include <config.h>
 #endif
 
+#include <api/na-object-profile.h>
+
 #include "nact-main-tab.h"
 
 /**
diff --git a/src/nact/nact-main-tab.h b/src/nact/nact-main-tab.h
index fd47d7c..5f9cbff 100644
--- a/src/nact/nact-main-tab.h
+++ b/src/nact/nact-main-tab.h
@@ -46,7 +46,7 @@
 /* properties set against the GObject instance
  */
 #define TAB_UPDATABLE_PROP_SELECTED_ITEM				"nact-tab-updatable-selected-item"
-#define TAB_UPDATABLE_PROP_EDITED_PROFILE				"nact-tab-updatable-selected-profile"
+#define TAB_UPDATABLE_PROP_SELECTED_PROFILE				"nact-tab-updatable-selected-profile"
 #define TAB_UPDATABLE_PROP_EDITABLE						"nact-tab-updatable-editable"
 #define TAB_UPDATABLE_PROP_REASON						"nact-tab-updatable-reason"
 
diff --git a/src/nact/nact-main-window.c b/src/nact/nact-main-window.c
index 28a2d18..d90f8c7 100644
--- a/src/nact/nact-main-window.c
+++ b/src/nact/nact-main-window.c
@@ -364,7 +364,7 @@ class_init( NactMainWindowClass *klass )
 	g_object_class_install_property( object_class, PROP_EDITED_ITEM, spec );
 
 	spec = g_param_spec_pointer(
-			TAB_UPDATABLE_PROP_EDITED_PROFILE,
+			TAB_UPDATABLE_PROP_SELECTED_PROFILE,
 			"Edited NAObjectProfile",
 			"A pointer to the edited NAObjectProfile",
 			G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE );
diff --git a/src/nact/nact-match-list.c b/src/nact/nact-match-list.c
index d9e369f..5c3940b 100644
--- a/src/nact/nact-match-list.c
+++ b/src/nact/nact-match-list.c
@@ -325,7 +325,7 @@ nact_match_list_on_selection_changed( BaseWindow *window, const gchar *tab_name,
 	g_object_get(
 			G_OBJECT( window ),
 			TAB_UPDATABLE_PROP_SELECTED_ITEM, &item,
-			TAB_UPDATABLE_PROP_EDITED_PROFILE, &profile,
+			TAB_UPDATABLE_PROP_SELECTED_PROFILE, &profile,
 			TAB_UPDATABLE_PROP_EDITABLE, &editable,
 			NULL );
 
@@ -480,7 +480,7 @@ on_filter_edited( GtkCellRendererText *renderer, const gchar *path_str, const gc
 	g_object_get(
 			G_OBJECT( data->window ),
 			TAB_UPDATABLE_PROP_SELECTED_ITEM, &item,
-			TAB_UPDATABLE_PROP_EDITED_PROFILE, &profile,
+			TAB_UPDATABLE_PROP_SELECTED_PROFILE, &profile,
 			NULL );
 
 	context = ( profile ? NA_ICONTEXT( profile ) : ( NAIContext * ) item );
@@ -583,7 +583,7 @@ on_must_match_toggled( GtkCellRendererToggle *cell_renderer, gchar *path_str, Ma
 		g_object_get(
 				G_OBJECT( data->window ),
 				TAB_UPDATABLE_PROP_SELECTED_ITEM, &item,
-				TAB_UPDATABLE_PROP_EDITED_PROFILE, &profile,
+				TAB_UPDATABLE_PROP_SELECTED_PROFILE, &profile,
 				NULL );
 
 		context = ( profile ? NA_ICONTEXT( profile ) : ( NAIContext * ) item );
@@ -640,7 +640,7 @@ on_must_not_match_toggled( GtkCellRendererToggle *cell_renderer, gchar *path_str
 		g_object_get(
 				G_OBJECT( data->window ),
 				TAB_UPDATABLE_PROP_SELECTED_ITEM, &item,
-				TAB_UPDATABLE_PROP_EDITED_PROFILE, &profile,
+				TAB_UPDATABLE_PROP_SELECTED_PROFILE, &profile,
 				NULL );
 
 		context = ( profile ? NA_ICONTEXT( profile ) : ( NAIContext * ) item );
@@ -687,7 +687,7 @@ add_filter( MatchListStr *data, const gchar *filter, const gchar *prefix )
 	g_object_get(
 			G_OBJECT( data->window ),
 			TAB_UPDATABLE_PROP_SELECTED_ITEM, &item,
-			TAB_UPDATABLE_PROP_EDITED_PROFILE, &profile,
+			TAB_UPDATABLE_PROP_SELECTED_PROFILE, &profile,
 			NULL );
 
 	context = ( profile ? NA_ICONTEXT( profile ) : ( NAIContext * ) item );
@@ -731,7 +731,7 @@ delete_current_row( MatchListStr *data )
 		g_object_get(
 				G_OBJECT( data->window ),
 				TAB_UPDATABLE_PROP_SELECTED_ITEM, &item,
-				TAB_UPDATABLE_PROP_EDITED_PROFILE, &profile,
+				TAB_UPDATABLE_PROP_SELECTED_PROFILE, &profile,
 				NULL );
 
 		context = ( profile ? NA_ICONTEXT( profile ) : ( NAIContext * ) item );
@@ -904,7 +904,7 @@ tab_set_sensitive( MatchListStr *data )
 	g_object_get(
 			G_OBJECT( data->window ),
 			TAB_UPDATABLE_PROP_SELECTED_ITEM, &item,
-			TAB_UPDATABLE_PROP_EDITED_PROFILE, &profile,
+			TAB_UPDATABLE_PROP_SELECTED_PROFILE, &profile,
 			NULL );
 
 	enable_tab = ( profile != NULL || item != NULL );



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