nemo r45 - in trunk: . gtk



Author: arj
Date: Mon Jan  7 11:04:21 2008
New Revision: 45
URL: http://svn.gnome.org/viewvc/nemo?rev=45&view=rev

Log:
Add open directory to right click menu for file



Modified:
   trunk/NEWS
   trunk/gtk/Common.cs
   trunk/gtk/DisplayItem.cs

Modified: trunk/NEWS
==============================================================================
--- trunk/NEWS	(original)
+++ trunk/NEWS	Mon Jan  7 11:04:21 2008
@@ -12,6 +12,7 @@
 - Add indexing dialog
 - Add shortcut for search
 - Show path in file view
+- Add open directory to right click menu for file
 
 0.1.2 alpha
 -----------

Modified: trunk/gtk/Common.cs
==============================================================================
--- trunk/gtk/Common.cs	(original)
+++ trunk/gtk/Common.cs	Mon Jan  7 11:04:21 2008
@@ -4,6 +4,8 @@
 
 using System.Collections.Generic;
 
+using System.Diagnostics; // for opening files
+
 namespace Nemo
 {
 	class GtkCommon
@@ -82,6 +84,19 @@
 
 				popup_menu.Add(open_with_item);
 
+				MenuItem open_folder = new MenuItem(Mono.Unix.Catalog.GetString("Open directory"));
+				open_folder.Activated += delegate { 
+					string path = item.path;
+					int index = -1;
+					if ((index = path.LastIndexOf('/')) != -1) {
+						Gnome.Vfs.MimeApplication[] folder_handlers = Gnome.Vfs.Mime.GetAllApplications("inode/directory");
+						GLib.List tmp = new GLib.List(typeof(System.String)); // fixme, use better name
+						tmp.Append(Gnome.Vfs.Uri.GetUriFromLocalPath(path.Substring(0, index+1)));
+						folder_handlers[0].Launch(tmp);
+					}
+				};
+				popup_menu.Add(open_folder);
+
 				MenuItem labels_item = new MenuItem(Mono.Unix.Catalog.GetString("Labels"));
 				Menu categories_menu = new Menu();
 

Modified: trunk/gtk/DisplayItem.cs
==============================================================================
--- trunk/gtk/DisplayItem.cs	(original)
+++ trunk/gtk/DisplayItem.cs	Mon Jan  7 11:04:21 2008
@@ -172,7 +172,7 @@
 					path = path.Substring(0, 25);
 					path += "...";
 				} else
-					path = path.Substring(0, index);
+					path = path.Substring(0, index+1);
 			
 			add_line(Mono.Unix.Catalog.GetString("Path:"), path);
 			add_line(Mono.Unix.Catalog.GetString("Size:"), item.size);



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