[PATCH] Re: Change Desktop Right Click Menu Items



Am Samstag, den 13.08.2005, 17:22 -0400 schrieb Kevin C. Krinke:
> On Sat, 2005-08-13 at 14:43 +0200, Christian Neumair wrote:
> > Sven J. schrieb:

> > The desktop is a window as well. Currently, we just don't convert 
> > "x-nautilus-desktop:///" to the location of the physical desktop 
> > directory. There is a bug report [1]. I'd appreciate if you could test 
> > the attached patch and give some feedback.  I don't think that the 
> > attached patch fixes the selected files' location yet.
> > 
> > [1] http://bugzilla.gnome.org/show_bug.cgi?id=148545
> 
> Sadly I must report that I've done nothing else with the bug report or
> patch, and in fact I had no idea people even commented on the bug
> report. *sigh* I really need to keep up to speed with these things more.
> 
> So, no the patch doesn't work nor do I know what to really do about it
> considering I seriously do not have the time to devote to solving a
> problem I still bang my head on from time to time.

I've attached a new patch which just converts the selected URIs. This is
IMHO better, since it still allows the programmer to find out whether
the currently displayed directory is trash:/// or ~/.Trash resp.
x-nautilus-desktop:/// or ~ resp. ~/Desktop.

Attaching the new patch to this mail as well, hoping that it helps you
with your problem.

-- 
Christian Neumair <chris gnome-de org>
Index: src/file-manager/fm-directory-view.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/file-manager/fm-directory-view.c,v
retrieving revision 1.703
diff -u -p -r1.703 fm-directory-view.c
--- src/file-manager/fm-directory-view.c	1 Aug 2005 22:08:55 -0000	1.703
+++ src/file-manager/fm-directory-view.c	14 Aug 2005 19:05:52 -0000
@@ -4655,17 +4690,32 @@ get_file_paths_or_uris_as_newline_delimi
 	char *path;
 	char *uri;
 	char *result;
+	NautilusDesktopLink *link;
 	GString *expanding_string;
 	GList *node;
 
 	expanding_string = g_string_new ("");
 	for (node = selection; node != NULL; node = node->next) {
-		uri = nautilus_file_get_uri (NAUTILUS_FILE (node->data));
+		uri = NULL;
+
+		if (NAUTILUS_IS_DESKTOP_ICON_FILE (node->data)) {
+			link = nautilus_desktop_icon_file_get_link (NAUTILUS_DESKTOP_ICON_FILE (node->data));
+			if (link != NULL) {
+				uri = nautilus_desktop_link_get_activation_uri (link);
+				g_object_unref (G_OBJECT (link));
+			}
+		}
+
+		if (uri == NULL) {
+			uri = nautilus_file_get_uri (NAUTILUS_FILE (node->data));
+		}
 
 		if (get_paths) {
 			path = gnome_vfs_get_local_path_from_uri (uri);
-			g_string_append (expanding_string, path);
-			g_free (path);
+			if (path != NULL) {
+				g_string_append (expanding_string, path);
+				g_free (path);
+			}
 		} else {
 			g_string_append (expanding_string, uri);
 		}
@@ -4708,7 +4758,9 @@ set_script_environment_variables (FMDire
 	 * nautilus_directory_is_local returns FALSE for nfs.
 	 */
 	directory_uri = nautilus_directory_get_uri (view->details->model);
-	if (eel_str_has_prefix (directory_uri, "file:")) {
+	if (eel_str_has_prefix (directory_uri, "file:") ||
+	    eel_uri_is_desktop (directory_uri) ||
+	    eel_uri_is_trash (directory_uri)) {
 		file_paths = get_file_paths_as_newline_delimited_string (selected_files);
 	} else {
 		file_paths = g_strdup ("");

Attachment: signature.asc
Description: This is a digitally signed message part



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