[nautilus-actions] Remove the 'target background' indicator



commit 9ec3d52e8361a65446371655fe061598f1a5f1c1
Author: Pierre Wieser <pwieser trychlos org>
Date:   Sat Mar 6 18:39:13 2010 +0100

    Remove the 'target background' indicator
    
    According to threads on xdg-list, it is natural for actions to target
    selected folder when it is unique, or current folder when selection is
    empty.

 ChangeLog                                |   15 ++++++++
 TODO                                     |    1 -
 src/core/na-object-action-factory.c      |   20 ++++++++---
 src/nact/nact-iaction-tab.c              |   56 +----------------------------
 src/nact/nact-ibackground-tab.c          |    3 +-
 src/nact/nautilus-actions-config-tool.ui |   53 +++++++++------------------
 6 files changed, 51 insertions(+), 97 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 81036ef..0822d61 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,20 @@
 2009-03-05 Pierre Wieser <pwieser trychlos org>
 
+	Remove the 'target background' indicator which was introduced in 2.29.1.
+
+	* src/core/na-object-action-factory.c:
+	Update properties for NAFO_DATA_TARGET_BACKGROUND.
+
+	* src/nact/nact-iaction-tab.c
+	(nact_iaction_tab_runtime_init_toplevel): Remove the signal connection.
+	(on_tab_updatable_selection_changed): Remove fields initialization.
+	(on_target_background_toggled): Remove the function.
+
+	* src/nact/nact-ibackground-tab.c (tab_set_sensitive):
+	Always sensitive for profiles.
+
+	* src/nact/nautilus-actions-config-tool.ui: Remove the fields.
+
 	* src/core/na-object-action-factory.c:
 	data_def_action_v1 is now available from outside.
 
diff --git a/TODO b/TODO
index 527d035..e7cd32d 100644
--- a/TODO
+++ b/TODO
@@ -166,4 +166,3 @@
 - before next release
   as it is probable that desktop files will not be ready
   -> join path and parameters
-  -> remove target background
diff --git a/src/core/na-object-action-factory.c b/src/core/na-object-action-factory.c
index f91bd28..1f0c561 100644
--- a/src/core/na-object-action-factory.c
+++ b/src/core/na-object-action-factory.c
@@ -74,16 +74,26 @@ static NADataDef data_def_action [] = {
 				FALSE,
 				"target-selection" },
 
+	/* this data has been introduced in 2.29.1 and has been left up to 2.29.4
+	 * it has been removed starting with 2.29.5
+	 * it is no more used anywhere
+	 * it is so no more readable (it doesn't take anymore any useful information)
+	 * nor writable (obsolete)
+	 *
+	 * we now consider that folders condition is to be met when the target is
+	 * is only one folder, whether this is a selected item, or the current
+	 * folder when there is no selection
+	 */
 	{ NAFO_DATA_TARGET_BACKGROUND,
 				TRUE,
-				TRUE,
-				TRUE,
+				FALSE,
+				FALSE,
 				"Target the folder context menu",
 				"Does the action target the context menu when there is no selection ?",
 				NAFD_TYPE_BOOLEAN,
-				"false",
-				TRUE,
-				TRUE,
+				"true",
+				FALSE,
+				FALSE,
 				FALSE,
 				FALSE,
 				"target-background" },
diff --git a/src/nact/nact-iaction-tab.c b/src/nact/nact-iaction-tab.c
index 418f688..cc3ae5d 100644
--- a/src/nact/nact-iaction-tab.c
+++ b/src/nact/nact-iaction-tab.c
@@ -78,7 +78,6 @@ static void          on_tab_updatable_selection_changed( NactIActionTab *instanc
 static void          on_tab_updatable_provider_changed( NactIActionTab *instance, NAObjectItem *item );
 
 static void          on_target_selection_toggled( GtkToggleButton *button, NactIActionTab *instance );
-static void          on_target_background_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 );
@@ -259,13 +258,6 @@ nact_iaction_tab_runtime_init_toplevel( NactIActionTab *instance )
 				"toggled",
 				G_CALLBACK( on_target_selection_toggled ));
 
-		button = base_window_get_widget( BASE_WINDOW( instance ), "ActionTargetBackgroundButton" );
-		base_window_signal_connect(
-				BASE_WINDOW( instance ),
-				G_OBJECT( button ),
-				"toggled",
-				G_CALLBACK( on_target_background_toggled ));
-
 		label_widget = base_window_get_widget( BASE_WINDOW( instance ), "ActionMenuLabelEntry" );
 		base_window_signal_connect(
 				BASE_WINDOW( instance ),
@@ -406,7 +398,7 @@ on_tab_updatable_selection_changed( NactIActionTab *instance, gint count_selecte
 	static const gchar *thisfn = "nact_iaction_tab_on_tab_updatable_selection_changed";
 	NAObjectItem *item;
 	gboolean enable_tab;
-	gboolean target_selection, target_background, target_toolbar;
+	gboolean target_selection, target_toolbar;
 	gboolean enable_label;
 	gboolean same_label;
 	GtkWidget *label_widget, *tooltip_widget, *icon_widget, *title_widget;
@@ -443,10 +435,6 @@ on_tab_updatable_selection_changed( NactIActionTab *instance, gint count_selecte
 				( NA_IS_OBJECT_ACTION( item ) && na_object_is_target_selection( NA_OBJECT_ACTION( item ))) ||
 				( NA_IS_OBJECT_MENU( item ))));
 
-		target_background = ( item && (
-				( NA_IS_OBJECT_ACTION( item ) && na_object_is_target_background( NA_OBJECT_ACTION( item ))) ||
-				( NA_IS_OBJECT_MENU( item ))));
-
 		target_toolbar = ( item && (
 				( NA_IS_OBJECT_ACTION( item ) && na_object_is_target_toolbar( NA_OBJECT_ACTION( item )))));
 
@@ -455,12 +443,7 @@ on_tab_updatable_selection_changed( NactIActionTab *instance, gint count_selecte
 		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 ), "ActionTargetBackgroundButton" ));
-		gtk_toggle_button_set_active( toggle, target_background );
-		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_background ));
+		enable_label = ( item && ( NA_IS_OBJECT_MENU( item ) || target_selection ));
 		label_widget = base_window_get_widget( BASE_WINDOW( instance ), "ActionMenuLabelEntry" );
 		label = item ? na_object_get_label( item ) : g_strdup( "" );
 		gtk_entry_set_text( GTK_ENTRY( label_widget ), label );
@@ -599,41 +582,6 @@ on_target_selection_toggled( GtkToggleButton *button, NactIActionTab *instance )
 }
 
 static void
-on_target_background_toggled( GtkToggleButton *button, NactIActionTab *instance )
-{
-	static const gchar *thisfn = "nact_iaction_tab_on_target_background_toggled";
-	NAObjectAction *action;
-	gboolean is_target;
-	gboolean editable;
-
-	if( !st_on_selection_change ){
-		g_debug( "%s: button=%p, instance=%p", thisfn, ( void * ) button, ( void * ) instance );
-
-		g_object_get(
-				G_OBJECT( instance ),
-				TAB_UPDATABLE_PROP_EDITED_ACTION, &action,
-				TAB_UPDATABLE_PROP_EDITABLE, &editable,
-				NULL );
-
-		if( action && NA_IS_OBJECT_ACTION( action )){
-
-			is_target = gtk_toggle_button_get_active( button );
-
-			if( editable ){
-				na_object_set_target_background( action, is_target );
-				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 );
-
-			} else {
-				g_signal_handlers_block_by_func(( gpointer ) button, on_target_background_toggled, instance );
-				gtk_toggle_button_set_active( button, !is_target );
-				g_signal_handlers_unblock_by_func(( gpointer ) button, on_target_background_toggled, instance );
-			}
-		}
-	}
-}
-
-static void
 check_for_label( NactIActionTab *instance, GtkEntry *entry, const gchar *label )
 {
 	NAObjectItem *edited;
diff --git a/src/nact/nact-ibackground-tab.c b/src/nact/nact-ibackground-tab.c
index ce6eb38..55cbd0e 100644
--- a/src/nact/nact-ibackground-tab.c
+++ b/src/nact/nact-ibackground-tab.c
@@ -368,8 +368,7 @@ tab_set_sensitive( NactIBackgroundTab *instance )
 			TAB_UPDATABLE_PROP_EDITED_PROFILE, &profile,
 			NULL );
 
-	enable_tab = ( profile != NULL &&
-			( na_object_is_target_background( action ) || na_object_is_target_toolbar( action )));
+	enable_tab = ( profile != NULL );
 
 	nact_main_tab_enable_page( NACT_MAIN_WINDOW( instance ), TAB_BACKGROUND, enable_tab );
 
diff --git a/src/nact/nautilus-actions-config-tool.ui b/src/nact/nautilus-actions-config-tool.ui
index de28808..47243cc 100644
--- a/src/nact/nautilus-actions-config-tool.ui
+++ b/src/nact/nautilus-actions-config-tool.ui
@@ -113,7 +113,7 @@
                                     <child>
                                       <object class="GtkTable" id="table7">
                                         <property name="visible">True</property>
-                                        <property name="n_rows">3</property>
+                                        <property name="n_rows">2</property>
                                         <property name="n_columns">2</property>
                                         <property name="column_spacing">5</property>
                                         <child>
@@ -132,23 +132,6 @@
                                           </packing>
                                         </child>
                                         <child>
-                                          <object class="GtkCheckButton" id="ActionTargetBackgroundButton">
-                                            <property name="label" translatable="yes">Display item in background _folder 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, the item will be candidate to be displayed in Nautilus context menu when there is no selection. It thus applies to current folder. The item will also appear in Nautilus File menu.</property>
-                                            <property name="use_underline">True</property>
-                                            <property name="draw_indicator">True</property>
-                                          </object>
-                                          <packing>
-                                            <property name="left_attach">1</property>
-                                            <property name="right_attach">2</property>
-                                            <property name="top_attach">1</property>
-                                            <property name="bottom_attach">2</property>
-                                          </packing>
-                                        </child>
-                                        <child>
                                           <object class="GtkEntry" id="ActionMenuLabelEntry">
                                             <property name="visible">True</property>
                                             <property name="can_focus">True</property>
@@ -158,8 +141,8 @@
                                           <packing>
                                             <property name="left_attach">1</property>
                                             <property name="right_attach">2</property>
-                                            <property name="top_attach">2</property>
-                                            <property name="bottom_attach">3</property>
+                                            <property name="top_attach">1</property>
+                                            <property name="bottom_attach">2</property>
                                           </packing>
                                         </child>
                                         <child>
@@ -171,8 +154,8 @@
                                             <property name="mnemonic_widget">ActionMenuLabelEntry</property>
                                           </object>
                                           <packing>
-                                            <property name="top_attach">2</property>
-                                            <property name="bottom_attach">3</property>
+                                            <property name="top_attach">1</property>
+                                            <property name="bottom_attach">2</property>
                                             <property name="x_options">GTK_FILL</property>
                                             <property name="y_options"></property>
                                           </packing>
@@ -180,9 +163,6 @@
                                         <child>
                                           <placeholder/>
                                         </child>
-                                        <child>
-                                          <placeholder/>
-                                        </child>
                                       </object>
                                       <packing>
                                         <property name="position">0</property>
@@ -786,7 +766,7 @@ Defining several profiles lets you have several commands, each applying with a d
                                 <property name="visible">True</property>
                                 <property name="xalign">0</property>
                                 <property name="ypad">10</property>
-                                <property name="label" translatable="yes">&lt;b&gt;Appears if URI is one or inside one of these&lt;/b&gt;</property>
+                                <property name="label" translatable="yes">&lt;b&gt;Appears if folder's path is one or inside one of these&lt;/b&gt;</property>
                                 <property name="use_markup">True</property>
                               </object>
                               <packing>
@@ -1350,6 +1330,9 @@ Defining several profiles lets you have several commands, each applying with a d
       <placeholder/>
     </child>
     <child>
+      <placeholder/>
+    </child>
+    <child>
       <object class="GtkLabel" id="label3">
         <property name="visible">True</property>
         <property name="label" translatable="yes">This assistant will guide you through the process of importing items, actions or menus.</property>
@@ -1365,10 +1348,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="local_only">False</property>
+            <property name="use_preview_label">False</property>
             <property name="preview_widget_active">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>
@@ -2147,24 +2130,24 @@ Be warned: this mode may be dangerous. You will not be prompted another time.</p
   </object>
   <object class="GtkSizeGroup" id="CommandLabelSizeGroup">
     <widgets>
-      <widget name="ProfileLabelLabel"/>
-      <widget name="CommandPathLabel"/>
       <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>
   <object class="GtkSizeGroup" id="ActionLabelSizeGroup">
     <widgets>
-      <widget name="ActionToolbarLabelLabel"/>
-      <widget name="ActionMenuLabelLabel"/>
-      <widget name="ActionIdLabel"/>
-      <widget name="ActionTooltipLabel"/>
       <widget name="ActionIconLabel"/>
+      <widget name="ActionTooltipLabel"/>
+      <widget name="ActionIdLabel"/>
+      <widget name="ActionMenuLabelLabel"/>
+      <widget name="ActionToolbarLabelLabel"/>
     </widgets>
   </object>
 </interface>



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