[nautilus-actions] Fix sensitivities in Action tab when selected item is a menu



commit 1bc6e7729707032297cb93d080dc2359c292ccbb
Author: Pierre Wieser <pwieser trychlos org>
Date:   Sun Oct 25 15:33:41 2009 +0100

    Fix sensitivities in Action tab when selected item is a menu

 src/nact/nact-iaction-tab.c              |   29 ++++++++++++++---------------
 src/nact/nautilus-actions-config-tool.ui |   16 ++++++++--------
 2 files changed, 22 insertions(+), 23 deletions(-)
---
diff --git a/src/nact/nact-iaction-tab.c b/src/nact/nact-iaction-tab.c
index b65e193..1a4591a 100644
--- a/src/nact/nact-iaction-tab.c
+++ b/src/nact/nact-iaction-tab.c
@@ -467,8 +467,7 @@ on_target_selection_toggled( GtkToggleButton *button, NactIActionTab *instance )
 			TAB_UPDATABLE_PROP_EDITED_ACTION, &action,
 			NULL );
 
-	if( action ){
-		g_return_if_fail( !action || NA_IS_OBJECT_ACTION( action ));
+	if( action && NA_IS_OBJECT_ACTION( action )){
 
 		is_target = gtk_toggle_button_get_active( button );
 		na_object_action_set_target_selection( action, is_target );
@@ -492,8 +491,7 @@ on_target_background_toggled( GtkToggleButton *button, NactIActionTab *instance
 			TAB_UPDATABLE_PROP_EDITED_ACTION, &action,
 			NULL );
 
-	if( action ){
-		g_return_if_fail( !action || NA_IS_OBJECT_ACTION( action ));
+	if( action && NA_IS_OBJECT_ACTION( action )){
 
 		is_target = gtk_toggle_button_get_active( button );
 		na_object_action_set_target_background( action, is_target );
@@ -595,18 +593,17 @@ on_target_toolbar_toggled( GtkToggleButton *button, NactIActionTab *instance )
 			TAB_UPDATABLE_PROP_EDITED_ACTION, &action,
 			NULL );
 
-	if( action ){
-		g_return_if_fail( !action || NA_IS_OBJECT_ACTION( action ));
+	if( action && NA_IS_OBJECT_ACTION( action )){
 
 		is_target = gtk_toggle_button_get_active( button );
 		na_object_action_set_target_toolbar( action, is_target );
 
-		toolbar_same_label_set_sensitive( instance, NA_OBJECT_ITEM( action ));
-		toolbar_label_set_sensitive( instance, NA_OBJECT_ITEM( action ));
-
 		g_signal_emit_by_name( G_OBJECT( instance ), TAB_UPDATABLE_SIGNAL_ENABLE_TAB, action );
 		g_signal_emit_by_name( G_OBJECT( instance ), TAB_UPDATABLE_SIGNAL_ITEM_UPDATED, action, FALSE );
 	}
+
+	toolbar_same_label_set_sensitive( instance, NA_OBJECT_ITEM( action ));
+	toolbar_label_set_sensitive( instance, NA_OBJECT_ITEM( action ));
 }
 
 static void
@@ -620,16 +617,16 @@ on_toolbar_same_label_toggled( GtkToggleButton *button, NactIActionTab *instance
 			TAB_UPDATABLE_PROP_EDITED_ACTION, &edited,
 			NULL );
 
-	if( edited ){
-		g_return_if_fail( NA_IS_OBJECT_ACTION( edited ));
+	if( edited && NA_IS_OBJECT_ACTION( edited )){
 
 		same_label = gtk_toggle_button_get_active( button );
 		na_object_action_toolbar_set_same_label( NA_OBJECT_ACTION( edited ), same_label );
 
-		toolbar_label_set_sensitive( instance, edited );
-
 		g_signal_emit_by_name( G_OBJECT( instance ), TAB_UPDATABLE_SIGNAL_ITEM_UPDATED, edited, FALSE );
 	}
+
+	toolbar_same_label_set_sensitive( instance, NA_OBJECT_ITEM( edited ));
+	toolbar_label_set_sensitive( instance, NA_OBJECT_ITEM( edited ));
 }
 
 static void
@@ -667,12 +664,14 @@ on_toolbar_label_changed( GtkEntry *entry, NactIActionTab *instance )
 static void
 toolbar_label_set_sensitive( NactIActionTab *instance, NAObjectItem *item )
 {
+	gboolean is_action;
 	gboolean same_label;
 	GtkWidget *label_widget;
 
-	same_label = item && NA_IS_OBJECT_ACTION( item ) ? na_object_action_toolbar_use_same_label( NA_OBJECT_ACTION( item )) : FALSE;
+	is_action = item && NA_IS_OBJECT_ACTION( item );
+	same_label = is_action ? na_object_action_toolbar_use_same_label( NA_OBJECT_ACTION( item )) : FALSE;
 	label_widget = base_window_get_widget( BASE_WINDOW( instance ), "ActionIconLabelEntry" );
-	gtk_widget_set_sensitive( label_widget, !same_label );
+	gtk_widget_set_sensitive( label_widget, is_action && !same_label );
 }
 
 static void
diff --git a/src/nact/nautilus-actions-config-tool.ui b/src/nact/nautilus-actions-config-tool.ui
index 7c9808f..2f4a293 100644
--- a/src/nact/nautilus-actions-config-tool.ui
+++ b/src/nact/nautilus-actions-config-tool.ui
@@ -869,7 +869,7 @@ Defining several profiles lets you have several commands, each applying with a d
                       <object class="GtkLabel" id="label15">
                         <property name="visible">True</property>
                         <property name="tooltip_text" translatable="yes">This advanced tab lets you precisely choose on which schemes the selection will apply.</property>
-                        <property name="label" translatable="yes">_Folder</property>
+                        <property name="label" translatable="yes">_Folders</property>
                         <property name="use_underline">True</property>
                       </object>
                       <packing>
@@ -1290,9 +1290,9 @@ Defining several profiles lets you have several commands, each applying with a d
           <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="select_multiple">True</property>
             <property name="local_only">False</property>
+            <property name="preview_widget_active">False</property>
           </object>
           <packing>
             <property name="position">0</property>
@@ -2695,25 +2695,25 @@ Be warned: this mode may be dangerous. You will not be prompted another time.</p
   </object>
   <object class="GtkSizeGroup" id="CommandLabelSizeGroup">
     <widgets>
-      <widget name="CommandParametersLabel"/>
-      <widget name="CommandPathLabel"/>
       <widget name="ProfileLabelLabel"/>
+      <widget name="CommandPathLabel"/>
+      <widget name="CommandParametersLabel"/>
     </widgets>
   </object>
   <object class="GtkSizeGroup" id="CommandButtonSizeGroup">
     <widgets>
-      <widget name="CommandLegendButton"/>
       <widget name="CommandPathButton"/>
+      <widget name="CommandLegendButton"/>
     </widgets>
   </object>
   <object class="GtkSizeGroup" id="ActionLabelSizeGroup">
     <widgets>
+      <widget name="ActionIconLabelLabel"/>
+      <widget name="ActionMenuLabelLabel"/>
       <widget name="label4"/>
-      <widget name="ActionIconLabel"/>
       <widget name="ActionTooltipLabel"/>
+      <widget name="ActionIconLabel"/>
       <widget name="label4"/>
-      <widget name="ActionMenuLabelLabel"/>
-      <widget name="ActionIconLabelLabel"/>
     </widgets>
   </object>
 </interface>



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