[nautilus] Rearrange copy/move to menus and add home + desktop items



commit 0a6c249015c7ab1cfa62e64428652970d397f57b
Author: Alexander Larsson <alexl redhat com>
Date:   Wed Dec 16 12:17:01 2009 +0100

    Rearrange copy/move to menus and add home + desktop items

 src/file-manager/fm-actions.h                   |    4 +
 src/file-manager/fm-directory-view.c            |  108 +++++++++++++++++++++--
 src/file-manager/nautilus-directory-view-ui.xml |   33 ++++---
 3 files changed, 121 insertions(+), 24 deletions(-)
---
diff --git a/src/file-manager/fm-actions.h b/src/file-manager/fm-actions.h
index e6a7e69..002a250 100644
--- a/src/file-manager/fm-actions.h
+++ b/src/file-manager/fm-actions.h
@@ -51,6 +51,10 @@
 #define FM_ACTION_PASTE_FILES_INTO "Paste Files Into"
 #define FM_ACTION_COPY_TO_NEXT_PANE "Copy to next pane"
 #define FM_ACTION_MOVE_TO_NEXT_PANE "Move to next pane"
+#define FM_ACTION_COPY_TO_HOME "Copy to Home"
+#define FM_ACTION_MOVE_TO_HOME "Move to Home"
+#define FM_ACTION_COPY_TO_DESKTOP "Copy to Desktop"
+#define FM_ACTION_MOVE_TO_DESKTOP "Move to Desktop"
 #define FM_ACTION_LOCATION_PASTE_FILES_INTO "LocationPasteFilesInto"
 #define FM_ACTION_NEW_LAUNCHER "New Launcher"
 #define FM_ACTION_NEW_LAUNCHER_DESKTOP "New Launcher Desktop"
diff --git a/src/file-manager/fm-directory-view.c b/src/file-manager/fm-directory-view.c
index 8722932..67215ff 100644
--- a/src/file-manager/fm-directory-view.c
+++ b/src/file-manager/fm-directory-view.c
@@ -6017,6 +6017,58 @@ action_move_to_next_pane_callback (GtkAction *action, gpointer callback_data)
 }
 
 static void
+action_copy_to_home_callback (GtkAction *action, gpointer callback_data)
+{
+	FMDirectoryView *view;
+	char *dest_location;
+
+	view = get_active_directory_view (NAUTILUS_WINDOW_INFO (callback_data));
+
+	dest_location = nautilus_get_home_directory_uri ();
+	move_copy_selection_to_location (view, GDK_ACTION_COPY, dest_location);
+	g_free (dest_location);
+}
+
+static void
+action_move_to_home_callback (GtkAction *action, gpointer callback_data)
+{
+	FMDirectoryView *view;
+	char *dest_location;
+
+	view = get_active_directory_view (NAUTILUS_WINDOW_INFO (callback_data));
+
+	dest_location = nautilus_get_home_directory_uri ();
+	move_copy_selection_to_location (view, GDK_ACTION_MOVE, dest_location);
+	g_free (dest_location);
+}
+
+static void
+action_copy_to_desktop_callback (GtkAction *action, gpointer callback_data)
+{
+	FMDirectoryView *view;
+	char *dest_location;
+
+	view = get_active_directory_view (NAUTILUS_WINDOW_INFO (callback_data));
+
+	dest_location = nautilus_get_desktop_directory_uri ();
+	move_copy_selection_to_location (view, GDK_ACTION_COPY, dest_location);
+	g_free (dest_location);
+}
+
+static void
+action_move_to_desktop_callback (GtkAction *action, gpointer callback_data)
+{
+	FMDirectoryView *view;
+	char *dest_location;
+
+	view = get_active_directory_view (NAUTILUS_WINDOW_INFO (callback_data));
+
+	dest_location = nautilus_get_desktop_directory_uri ();
+	move_copy_selection_to_location (view, GDK_ACTION_MOVE, dest_location);
+	g_free (dest_location);
+}
+
+static void
 action_cut_files (GtkAction *action,
 		  FMDirectoryView *view)
 {
@@ -7460,12 +7512,28 @@ static const GtkActionEntry directory_view_entries[] = {
   /* tooltip */                  N_("View or modify the properties of this folder"),
                                  G_CALLBACK (action_location_properties_callback) },
 
-  /* name, stock id, label */  {"Copy to next pane", NULL, N_("Copy to other pane"),
-				NULL, N_("Copy the current selection to the other side of the split view"),
+  /* name, stock id, label */  {FM_ACTION_COPY_TO_NEXT_PANE, NULL, N_("_Other pane"),
+				NULL, N_("Copy the current selection to the other pane in the window"),
 				G_CALLBACK (action_copy_to_next_pane_callback) },
-  /* name, stock id, label */  {"Move to next pane", NULL, N_("Move to other pane"),
-				NULL, N_("Move the current selection to the other side of the split view"),
-				G_CALLBACK (action_move_to_next_pane_callback) },                                 
+  /* name, stock id, label */  {FM_ACTION_MOVE_TO_NEXT_PANE, NULL, N_("_Other pane"),
+				NULL, N_("Move the current selection to the other pane in the window"),
+				G_CALLBACK (action_move_to_next_pane_callback) },
+  /* name, stock id, label */  {FM_ACTION_COPY_TO_HOME, NAUTILUS_ICON_HOME,
+				N_("_Home Folder"), NULL,
+				N_("Copy the current selection to the home folder"),
+				G_CALLBACK (action_copy_to_home_callback) },
+  /* name, stock id, label */  {FM_ACTION_MOVE_TO_HOME, NAUTILUS_ICON_HOME,
+				N_("_Home Folder"), NULL,
+				N_("Move the current selection to the home folder"),
+				G_CALLBACK (action_move_to_home_callback) },
+  /* name, stock id, label */  {FM_ACTION_COPY_TO_DESKTOP, NAUTILUS_ICON_DESKTOP,
+				N_("_Desktop"), NULL,
+				N_("Copy the current selection to the home folder"),
+				G_CALLBACK (action_copy_to_desktop_callback) },
+  /* name, stock id, label */  {FM_ACTION_MOVE_TO_DESKTOP, NAUTILUS_ICON_DESKTOP,
+				N_("_Desktop"), NULL,
+				N_("Move the current selection to the home folder"),
+				G_CALLBACK (action_move_to_desktop_callback) },
 };
 
 static void
@@ -9016,14 +9084,36 @@ real_update_menus (FMDirectoryView *view)
 	next_pane_is_writable = has_writable_extra_pane (view);
 
 	/* next pane: works if file is copyable, and next pane is writable */
-	action = gtk_action_group_get_action(view->details->dir_action_group,
-			FM_ACTION_COPY_TO_NEXT_PANE);
+	action = gtk_action_group_get_action (view->details->dir_action_group,
+					      FM_ACTION_COPY_TO_NEXT_PANE);
 	gtk_action_set_sensitive (action, can_copy_files && next_pane_is_writable);
 
 	/* move to next pane: works if file is cuttable, and next pane is writable */
-	action = gtk_action_group_get_action(view->details->dir_action_group,
-			FM_ACTION_MOVE_TO_NEXT_PANE);
+	action = gtk_action_group_get_action (view->details->dir_action_group,
+					      FM_ACTION_MOVE_TO_NEXT_PANE);
 	gtk_action_set_sensitive (action, can_delete_files && next_pane_is_writable);
+
+
+	action = gtk_action_group_get_action (view->details->dir_action_group,
+					      FM_ACTION_COPY_TO_HOME);
+	gtk_action_set_sensitive (action, can_copy_files);
+	action = gtk_action_group_get_action (view->details->dir_action_group,
+					      FM_ACTION_COPY_TO_DESKTOP);
+	gtk_action_set_sensitive (action, can_copy_files);
+
+	action = gtk_action_group_get_action (view->details->dir_action_group,
+					      FM_ACTION_MOVE_TO_HOME);
+	gtk_action_set_sensitive (action, can_delete_files);
+	action = gtk_action_group_get_action (view->details->dir_action_group,
+					      FM_ACTION_MOVE_TO_DESKTOP);
+	gtk_action_set_sensitive (action, can_delete_files);
+
+	action = gtk_action_group_get_action (view->details->dir_action_group,
+					      "CopyToMenu");
+	gtk_action_set_sensitive (action, can_copy_files);
+	action = gtk_action_group_get_action (view->details->dir_action_group,
+					      "MoveToMenu");
+	gtk_action_set_sensitive (action, can_delete_files);
 }
 
 /**
diff --git a/src/file-manager/nautilus-directory-view-ui.xml b/src/file-manager/nautilus-directory-view-ui.xml
index 5d69082..b857226 100644
--- a/src/file-manager/nautilus-directory-view-ui.xml
+++ b/src/file-manager/nautilus-directory-view-ui.xml
@@ -58,14 +58,6 @@
 			<menuitem name="Copy" action="Copy"/>
 			<menuitem name="Paste" action="Paste"/>
 		</placeholder>
-		<placeholder name="Copy Move to Placeholder">
-			<menu action="CopyToMenu">
-				<menuitem name="Copy to next pane" action="Copy to next pane"/>
-			</menu>
-			<menu action="MoveToMenu">
-				<menuitem name="Move to next pane" action="Move to next pane"/>
-			</menu>
-		</placeholder>        
 		<placeholder name="Select Items">
 		<menuitem name="Select All" action="Select All"/>
 		<menuitem name="Select Pattern" action="Select Pattern"/>
@@ -75,6 +67,16 @@
 			<menuitem name="Duplicate" action="Duplicate"/>
 			<menuitem name="Create Link" action="Create Link"/>
 			<menuitem name="Rename" action="Rename"/>
+			<menu action="CopyToMenu">
+				<menuitem name="Copy to next pane" action="Copy to next pane"/>
+				<menuitem name="Copy to Home" action="Copy to Home"/>
+				<menuitem name="Copy to Desktop" action="Copy to Desktop"/>
+			</menu>
+			<menu action="MoveToMenu">
+				<menuitem name="Move to next pane" action="Move to next pane"/>
+				<menuitem name="Copy to Home" action="Move to Home"/>
+				<menuitem name="Copy to Desktop" action="Move to Desktop"/>
+			</menu>
 		</placeholder>
 		<placeholder name="Dangerous File Items Placeholder">
 			<menuitem name="Trash" action="Trash"/>
@@ -157,19 +159,20 @@
 		<menuitem name="Copy" action="Copy"/>
 		<menuitem name="Paste Files Into" action="Paste Files Into"/>
 	</placeholder>
-	<separator name="Copy Move to separator"/>
-	<placeholder name="Copy Move to Placeholder">
+	<separator name="File actions separator"/>
+	<placeholder name="File Actions">
+		<menuitem name="Create Link" action="Create Link"/>
+		<menuitem name="Rename" action="Rename"/>
 		<menu action="CopyToMenu">
 			<menuitem name="Copy to next pane" action="Copy to next pane"/>
+			<menuitem name="Copy to Home" action="Copy to Home"/>
+			<menuitem name="Copy to Desktop" action="Copy to Desktop"/>
 		</menu>
 		<menu action="MoveToMenu">
 			<menuitem name="Move to next pane" action="Move to next pane"/>
+			<menuitem name="Copy to Home" action="Move to Home"/>
+			<menuitem name="Copy to Desktop" action="Move to Desktop"/>
 		</menu>
-	</placeholder>	    
-	<separator name="File actions separator"/>
-	<placeholder name="File Actions">
-		<menuitem name="Create Link" action="Create Link"/>
-		<menuitem name="Rename" action="Rename"/>
 	</placeholder>
 	<separator name="Dangerous separator"/>
 	<placeholder name="Dangerous File Actions">



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