[nautilus/gnome-2-32: 275/283] Open current folder properties on Alt+Enter and Ctrl+I (#569694)



commit d13e9cfbc2406b68e8f16240b8d12104462535f3
Author: Marcus Carlson <mdc src gnome org>
Date:   Mon Aug 9 21:52:59 2010 +0200

    Open current folder properties on Alt+Enter and Ctrl+I (#569694)

 src/file-manager/fm-actions.h                   |    1 -
 src/file-manager/fm-directory-view.c            |   63 +++++++++-------------
 src/file-manager/nautilus-directory-view-ui.xml |    2 +-
 3 files changed, 27 insertions(+), 39 deletions(-)
---
diff --git a/src/file-manager/fm-actions.h b/src/file-manager/fm-actions.h
index f00a367..077d82c 100644
--- a/src/file-manager/fm-actions.h
+++ b/src/file-manager/fm-actions.h
@@ -37,7 +37,6 @@
 #define FM_ACTION_NEW_FOLDER "New Folder"
 #define FM_ACTION_PROPERTIES "Properties"
 #define FM_ACTION_PROPERTIES_ACCEL "PropertiesAccel"
-#define FM_ACTION_SELF_PROPERTIES "SelfProperties"
 #define FM_ACTION_LOCATION_PROPERTIES "LocationProperties"
 #define FM_ACTION_NO_TEMPLATES "No Templates"
 #define FM_ACTION_EMPTY_TRASH "Empty Trash"
diff --git a/src/file-manager/fm-directory-view.c b/src/file-manager/fm-directory-view.c
index a6fe51f..2404784 100644
--- a/src/file-manager/fm-directory-view.c
+++ b/src/file-manager/fm-directory-view.c
@@ -1454,35 +1454,24 @@ action_properties_callback (GtkAction *action,
 {
         FMDirectoryView *view;
         GList *selection;
+	GList *files;
         
         g_assert (FM_IS_DIRECTORY_VIEW (callback_data));
 
         view = FM_DIRECTORY_VIEW (callback_data);
 	selection = fm_directory_view_get_selection (view);
+	if (g_list_length (selection) == 0) {
+		if (view->details->directory_as_file != NULL) {
+			files = g_list_append (NULL, nautilus_file_ref (view->details->directory_as_file));
 
-	fm_properties_window_present (selection, GTK_WIDGET (view));
-
-        nautilus_file_list_free (selection);
-}
-
-static void
-action_self_properties_callback (GtkAction *action,
-				 gpointer   callback_data)
-{
-	FMDirectoryView *view;
-	GList           *files;
-
-	g_assert (FM_IS_DIRECTORY_VIEW (callback_data));
-
-	view = FM_DIRECTORY_VIEW (callback_data);
-
-	if (view->details->directory_as_file != NULL) {
-		files = g_list_append (NULL, nautilus_file_ref (view->details->directory_as_file));
-
-		fm_properties_window_present (files, GTK_WIDGET (view));
+			fm_properties_window_present (files, GTK_WIDGET (view));
 
-		nautilus_file_list_free (files);
+			nautilus_file_list_free (files);
+		}
+	} else {
+		fm_properties_window_present (selection, GTK_WIDGET (view));
 	}
+        nautilus_file_list_free (selection);
 }
 
 static void
@@ -7044,10 +7033,6 @@ static const GtkActionEntry directory_view_entries[] = {
   /* label, accelerator */       "PropertiesAccel", "<control>I",
   /* tooltip */                  NULL,
                                  G_CALLBACK (action_properties_callback) },
-  /* name, stock id */         { "SelfProperties", GTK_STOCK_PROPERTIES,
-  /* label, accelerator */       N_("_Properties"), NULL,
-  /* tooltip */                  N_("View or modify the properties of the open folder"),
-                                 G_CALLBACK (action_self_properties_callback) },
   /* name, stock id */         { "New Folder", "folder-new",
   /* label, accelerator */       N_("Create _Folder"), "<control><shift>N",
   /* tooltip */                  N_("Create a new empty folder inside this folder"),
@@ -8486,6 +8471,7 @@ real_update_menus (FMDirectoryView *view)
 	GIcon *app_icon;
 	GtkWidget *menuitem;
 	gboolean next_pane_is_writable;
+	gboolean show_properties;
 
 	selection = fm_directory_view_get_selection (view);
 	selection_count = g_list_length (selection);
@@ -8739,23 +8725,26 @@ real_update_menus (FMDirectoryView *view)
 				selection_count),
 		      NULL);
 	
+	show_properties = (!FM_IS_DESKTOP_ICON_VIEW (view) || selection_count > 0) &&
+			   fm_directory_view_supports_properties (view);
+
 	action = gtk_action_group_get_action (view->details->dir_action_group,
 					      FM_ACTION_PROPERTIES);
-	gtk_action_set_sensitive (action,
-				  selection_count != 0 &&
-				  fm_directory_view_supports_properties (view));
+
+	gtk_action_set_sensitive (action, show_properties);
+
+	if (selection_count == 0) {
+		gtk_action_set_tooltip (action, _("View or modify the properties of the open folder"));
+	} else {
+		gtk_action_set_tooltip (action, _("View or modify the properties of each selected item"));
+	}
+
+	gtk_action_set_visible (action, show_properties);
+
 	action = gtk_action_group_get_action (view->details->dir_action_group,
 					      FM_ACTION_PROPERTIES_ACCEL);
-	gtk_action_set_sensitive (action,
-				  selection_count != 0 &&
-				  fm_directory_view_supports_properties (view));
 
-	action = gtk_action_group_get_action (view->details->dir_action_group,
-					      FM_ACTION_SELF_PROPERTIES);
-	gtk_action_set_sensitive (action,
-				  fm_directory_view_supports_properties (view));
-	gtk_action_set_visible (action,
-				!FM_IS_DESKTOP_ICON_VIEW (view));
+	gtk_action_set_sensitive (action, show_properties);
 
 	action = gtk_action_group_get_action (view->details->dir_action_group,
 					      FM_ACTION_EMPTY_TRASH);
diff --git a/src/file-manager/nautilus-directory-view-ui.xml b/src/file-manager/nautilus-directory-view-ui.xml
index b857226..80b9e88 100644
--- a/src/file-manager/nautilus-directory-view-ui.xml
+++ b/src/file-manager/nautilus-directory-view-ui.xml
@@ -127,7 +127,7 @@
 		<menuitem name="Self Stop Volume" action="Self Stop Volume"/>
 		<menuitem name="Self Poll" action="Self Poll"/>
 		<separator name="Properties separator"/>
-		<menuitem name="SelfProperties" action="SelfProperties"/>
+		<menuitem name="Properties" action="Properties"/>
 	</placeholder>
 
 </popup>



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