Re: [PATCH] Improve activation behavior of multiple files, part 1



On Tue, 2005-10-04 at 13:10 +0200, Christian Neumair wrote:
> The attached two patches change the Nautilus semantics for dealing with
> multiple files. The trick is to be notified about all activation URIs
> and decide what to do with the individual files later. We can then
> cumulate multiple files and pass them to the same application handler.
> 
> From quickly taking a look at the patch it looks like we sometimes leak
> the activation->files list, this can be resolved right before the
> commit, though.

nautilus-call-when-ready.diff:
The ready_data_list variable doesn't seem to be in the patch?

There is no way this can work right now. In
nautilus_file_list_cancel_call_when_ready() you look up data given a
GList* the user gave you using file_list == ready_data->file_list. But
the file list in the FileListReadyData is a copy that the user never
sees, so there is no way they match. A better solution is for 
nautilus_file_list_call_when_ready() to return a void * tag that is
passed to nautilus_file_list_cancel_call_when_ready. (This would just
be the ReadyData pointer of course.)

In list_cancel, the file cancels should only be on the remaining_files
list. And you need to free the ReadyData when cancelling.


nautilus-multi-activation-pt1.diff:

+	launch_in_terminal_files = g_list_reverse (launch_in_terminal_files);
+	for (l = launch_in_terminal_files; l != NULL; l = l->next) {
+		file = NAUTILUS_FILE (l->data);
+
+		uri = nautilus_file_get_activation_uri (file);
+		executable_path = gnome_vfs_get_local_path_from_uri (uri);
+		quoted_path = g_shell_quote (executable_path);
+		name = nautilus_file_get_name (file);
+		nautilus_launch_application_from_command (screen, name, quoted_path, NULL, FALSE);

Last arg should be TRUE here.

+	open_in_view_files = g_list_reverse (open_in_view_files);
+	for (l = open_in_view_files; l != NULL; l = l->next) {
+		file = NAUTILUS_FILE (l->data);
+
+		uri = nautilus_file_get_activation_uri (file);
 		open_location (view, uri, parameters->mode, parameters->flags);

This won't work that well for navigational mode if you activate multiple
folders. Also, this isn't using
fm_directory_view_confirm_multiple_windows any more, which can cause a
suprise for many users and render the machine unresponsible in some
cases).


+		nautilus_file_ref (file);
+	}
and
-	parameters->file = file;
+	parameters->files = g_list_copy (files);

Better to use nautilus_file_list_copy() instead of spliting that into
two and putting it in an unrelated loop.

-	file_name = nautilus_file_get_display_name (file);
-	timed_wait_prompt = g_strdup_printf (_("Opening \"%s\"."), file_name);
+	file_name = nautilus_file_get_display_name (files->data);
+	timed_wait_prompt = g_strdup_printf (ngettext ("Opening %d item.",
+						       "Opening %d items.",
+						       file_count),
+					     file_count);

Should special case the string in (common) one file case.

+	if (failed) {
 		stop_activate (parameters);
-		report_broken_symbolic_link (parameters->view, file);
-		nautilus_file_unref (parameters->file);
+		nautilus_file_list_unref (parameters->files);

Should be nautilus_file_list_free().

-	g_free (orig_uri);
+	nautilus_file_list_unref (files);

Should be nautilus_file_list_free().

+	if (parameters->cancelled || !parameters->mount_success) {
+		stop_activate (parameters);
+
+		nautilus_file_list_free (parameters->files);
 		g_free (parameters);
+		return;

Should be nautilus_file_list_free().

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Alexander Larsson                                            Red Hat, Inc 
                   alexl redhat com    alla lysator liu se 
He's a time-tossed day-dreaming assassin who dotes on his loving old ma. She's 
a plucky red-headed Hell's Angel married to the Mob. They fight crime! 




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