Merge lp:~jeremywootten/pantheon-files/fix-rename-new-file into lp:~elementary-apps/pantheon-files/trunk

Proposed by Jeremy Wootten
Status: Merged
Approved by: PerfectCarl
Approved revision: 1727
Merged at revision: 1728
Proposed branch: lp:~jeremywootten/pantheon-files/fix-rename-new-file
Merge into: lp:~elementary-apps/pantheon-files/trunk
Diff against target: 32 lines (+6/-1)
1 file modified
src/View/AbstractDirectoryView.vala (+6/-1)
To merge this branch: bzr merge lp:~jeremywootten/pantheon-files/fix-rename-new-file
Reviewer Review Type Date Requested Status
PerfectCarl (community) Approve
Review via email: mp+247801@code.launchpad.net

Commit message

Fix rename new file regression

Description of the change

This branch increases the delay before renaming a newly created file. This is to give more time for the file item to appear in the view before trying to rename.

In addition, a duplicate "add file" signal is inhibited (one is initiated by marlin_file_operations and one by the directory.monitor).

Better solutions are probably available but would require more extensive refactoring, risking further regressions.

To post a comment you must log in.
Revision history for this message
PerfectCarl (name-is-carl) wrote :

I don't like the solution that is to add another hard coded delay, either.

But this fix should land.

Delays/async/and other threading issues that currently make files laggy and unpredictable will be addressed in another issue.

Revision history for this message
PerfectCarl (name-is-carl) wrote :

I haven't ran the full test suite [1] but I checked that the issue is fixed with some quick regression check

[1]: https://github.com/PerfectCarl/elementary-files-testing/blob/master/rename.md

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/View/AbstractDirectoryView.vala'
2--- src/View/AbstractDirectoryView.vala 2015-01-24 12:31:20 +0000
3+++ src/View/AbstractDirectoryView.vala 2015-01-28 09:15:22 +0000
4@@ -767,6 +767,8 @@
5 if (parent_uri == null)
6 parent_uri = slot.directory.file.uri;
7
8+ /* Block the async directory file monitor to avoid generating unwanted "add-file" events */
9+ slot.directory.block_monitor ();
10 Marlin.FileOperations.new_file (this as Gtk.Widget,
11 null,
12 parent_uri,
13@@ -800,8 +802,9 @@
14 var view = (FM.AbstractDirectoryView)data;
15 var file_to_rename = GOF.File.@get (new_file);
16 /* Allow time for the file to appear in the tree model before renaming */
17- GLib.Timeout.add (50, () => {
18+ GLib.Timeout.add (250, () => {
19 view.rename_file (file_to_rename);
20+ view.slot.directory.unblock_monitor ();
21 return false;
22 });
23 }
24@@ -1949,6 +1952,8 @@
25 /** Menu action functions */
26
27 private void create_from_template (GOF.File template) {
28+ /* Block the async directory file monitor to avoid generating unwanted "add-file" events */
29+ slot.directory.block_monitor ();
30 Marlin.FileOperations.new_file_from_template (this,
31 null,
32 slot.location,

Subscribers

People subscribed via source and target branches

to all changes: