Re: [PATCH] Drop text in Nautilus window, new file created

On Thu, 2005-06-02 at 11:33 +0200, Christian Neumair wrote:
> One thing that bugged me for ages in Nautilus is that one can not drop
> text (from gedit, Epiphany) to Nautilus to create a new file. After
> applying the attached patch, this works.

Why did you change the general code to take filenames instead of uris?
This only makes it less generic and forces us to do an extra
uri->filename roundtrip.

+       source_uri_text = g_filename_to_uri (template_file, NULL, NULL);

Never use g_filename_to/from_uri in gnome-vfs code. Use the gnome-vfs
code for this.

+                                                GdkDragAction copy_action,

don't pass dnd enum stuff in here. Just take a boolean.

+               target_filename = gnome_vfs_uri_extract_short_path_name (source_uri);
+               target_uri = gnome_vfs_uri_append_file_name (parent_uri, target_filename);
+               g_free ((char *) target_filename);

This escapes twice.


Why not allow drag text?

+	if (initial_contents != NULL) {
+		source_file = fdopen (fd, "a+");
+		fprintf (source_file, initial_contents);
+		fclose (source_file);
+	}

This is not right. What if initial_contents contains e.g. "%s".

+	void (* handle_text)    (NautilusTreeViewDragDest *dest,
+				  char *uri_list,
+				  int x,
+				  int y);


+			      NULL, NULL,
+			      nautilus_marshal_VOID__STRING_INT_INT_INT,
+			      G_TYPE_NONE, 4,
+			      G_TYPE_STRING,
+			      G_TYPE_INT,
+			      G_TYPE_INT,
+			      G_TYPE_INT);

This looks wrong. There is only two int args. The others seem wrong too.

 Alexander Larsson                                            Red Hat, Inc 
                   alexl redhat com    alla lysator liu se 
He's an old-fashioned white trash dog-catcher on the hunt for the last 
specimen of a great and near-mythical creature. She's a mistrustful snooty cab 
driver with a birthmark shaped like Liberty's torch. They fight crime! 

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