Commit graph

413 commits

Author SHA1 Message Date
Razvan Chitu
0a90763726 file-undo-manager: rename undo_redo_flag
Nautilus undo manager previously relied on a stack-like implementation of its
operating state. The stack operations (pushing and popping) were removed in a
previous commit due to possible unexpected behavior and errors. The flag alone
now has an inadequate name for what it represents.

Rename the flag to "is_operating", since it is set when the manager is
performing an undo / redo operation and unset otherwise. Rename the associated
getter function accordingly.

https://bugzilla.gnome.org/show_bug.cgi?id=759850
2016-01-12 20:51:07 +02:00
Razvan Chitu
d52c523414 file-undo-manager: handle undo_redo_flag internally
Nautilus undo manager reuses undo information based on a flag that marks whether
an undo / redo operation is currently being performed. Previously, the flag was
managed both internally and externally. This proved to be unnecessary and even
harmful, as it led to an unexpected behavior.

Remove push and pop functions and handle the flag explicitly, at the start and
at the end of an undo / redo operation. Replace external use of pop with the use
of a getter function, also introduced in this patch.

https://bugzilla.gnome.org/show_bug.cgi?id=759850
2016-01-12 20:51:07 +02:00
Razvan Chitu
c9135ce6b6 file-operations: always pop undo manager flag
Nautilus undo manager reuses undo information based on a flag that is pushed
when an undo operation begins and popped during the operation itself. In the
case of trashing / deleting files, the flag was not popped in some situations,
which caused the next operations to not be undoable.

Flip operands of a logical operator so the flag is always popped, avoiding
issues caused by lazy evaluation.

A better solution would be to always update the flag internally in the manager,
and only peek its value externally.

https://bugzilla.gnome.org/show_bug.cgi?id=759850
2015-12-24 16:28:36 +01:00
Carlos Soriano
5c9f68da01 file-operations: don't free ngettext strings
Pointed by Mathias.

https://bugzilla.gnome.org/show_bug.cgi?id=755586
2015-10-06 18:37:40 +02:00
Debarshi Ray
18fe29c85d file-operations: Let file/directory creation work on Google Drive
Immediately check the volatility of the newly created file or directory
and switch to using the "real" persistent URI. The following operations
are affected:
  - creating new directories
  - creating new files from templates
  - dragging & dropping text to create new files
  - copying and moving of files and directories

The Google Drive backend doesn't support creating symbolic links so we
ignore that case.

https://bugzilla.gnome.org/show_bug.cgi?id=751481
2015-09-11 13:54:59 +02:00
Carlos Soriano
6d897c950c file-operations: use total number of files for reporting
We were using the current transfer information for
"duplicating <n> files", which should actually show
the total amount.
2015-09-08 16:26:49 +02:00
Carlos Soriano
04c6c58e33 file-operations: fix crash when copying
Commit 2db9a295 introduced an obvious crash, not sure how
I managed to make it in if it was part of the tests and seems
it was working for other people.
Anyway, we were using the wrong argument, which pointed
to a wrong address when reporting operations, and that was
causing a crash.

To fix it, remove the  spurious argument.

https://bugzilla.gnome.org/show_bug.cgi?id=753282
2015-09-08 16:26:49 +02:00
Piotr Drąg
1d1ed4820e file-operations: unify comments 2015-09-01 19:50:38 +02:00
Carlos Soriano
13bde5bd37 file-operations: fix plurals translation
We were doing it elsewhere except here.

https://bugzilla.gnome.org/show_bug.cgi?id=754322
2015-09-01 17:16:17 +02:00
Carlos Soriano
fca077aa41 file-operations: add comments for translators
https://bugzilla.gnome.org/show_bug.cgi?id=754034
2015-09-01 11:51:49 +02:00
Carlos Soriano
01481e5207 file-operations: fix plural translations 2015-07-24 13:01:49 +02:00
Piotr Drąg
2e41dcfaeb file-operations: fix some minor typos 2015-07-18 00:21:33 +02:00
Carlos Soriano
e92c2ed3b9 file-operations: rename report functions
Some of them were not actually the one reporting the status,
but instead just the preparing status.
That was confusing since the actual functions that report the
progress status for move/link/count were report_copy_progress.
So just call them report_preparing_*
2015-07-17 00:45:39 +02:00
Carlos Soriano
7d40ce7f94 file-operations: reduce the time for reliable transfer rate
Currently it was 15 seconds, which is a little too much. Most
of the time 8 seconds is enough, and even more with SSDs. In this
way we are able to provide feedback of the remaining time to the
user in a more reasonable time.
2015-07-17 00:45:39 +02:00
Carlos Soriano
2d5a7e6dfd operations: show a notification when operation finishes
When the operations popover is not visible, we have to give
feedback to the user about if an operation finished.
For that, show a in-app notification in case the operation popover
is closed and a operation finishes. Also, to link the notification
with the operation button, make the button pulse for a second.

The code interaction between nautilus-file-operations and nautilus-progress-info
start to get crowed. At some point, the best we can do is delegate all the
progress UI part to nautilus-progress-info, providing all the needed information
like the CommonJob, TransferInfo and SourceInfo; so we avoid the current
odd interaction between them. This is a future work.
2015-07-17 00:45:39 +02:00
Carlos Soriano
2db9a2950b progress-info: allow finished infos to remain alive
We want to not hide the operations and the operations button
in the toolbar if the popover is open. For that, we need to
allow operations widgets to remain alive even when the operation
is finished.

For that we need to add a new status state to copying/moving/trashing,
like copied/moved/trashed.
On the way, improve the wording of file-operations to match the mockups,
and also make the report operations code more consistent to each other.
2015-07-17 00:45:39 +02:00
Carlos Soriano
192d2e2fcc operations: implement new design
Now operations reside in the toolbar, in form of a button with
a popover. In this way we avoid to have a nautilus window hanging
around for it.
When no nautilus window is open, the persistence handlers of nautilus
are enough. This use a notification if the server supports it or
a systray icon in case it doesn't.
2015-07-17 00:45:39 +02:00
Georges Basile Stavracas Neto
6ae3384aa4 view: show "New Folder" dialog
This commit introduces the "New Folder"
dialog, which asks the folder name before
actually creating it.

With the introduced changes, the folder
is created with the given name instead
of creating it first with the generic
"Unamed folder" and then renaming it.

The dialog has a "delayed message" logic,
where typos are immediatly recognized, but
coincident folder names appear ~2s later.

This dialog is part of the ongoing effort
to modernize Nautilus to better fit GNOME
standards, and the latest mockups can
be found at [1].

[1] https://raw.githubusercontent.com/gnome-design-team/gnome-mockups/master/nautilus/nautilus-next/create-folder-wires.png

https://bugzilla.gnome.org/show_bug.cgi?id=747381
2015-04-20 10:39:05 -03:00
Carlos Soriano
f0a17d6598 Revert "view: show "New Folder" dialog"
This reverts commit 6f4fc64791.
2015-04-08 14:50:22 +02:00
Georges Basile Stavracas Neto
6f4fc64791 view: show "New Folder" dialog
This commit introduces the "New Folder"
dialog, which asks the folder name before
actually creating it.

With the introduced changes, the folder
is created with the given name instead
of creating it first with the generic
"Unamed folder" and then renaming it.

This dialog is part of the ongoing effort
to modernize Nautilus to better fit GNOME
standards, and the latest mockups can
be found at [1].

[1] https://raw.githubusercontent.com/gnome-design-team/gnome-mockups/master/nautilus/nautilus-next/new-folder.png

https://bugzilla.gnome.org/show_bug.cgi?id=747381
2015-04-08 13:18:22 +02:00
Carlos Soriano
7c31e775c8 nautilus-file-operations: Use mount name if available
Currently custom_basename_to_string uses the base name or display name
of the files for the copying and moving dialog.
In the cases of unlabeled removable drives, the name is a code, showing
in the dialog a not very friendly name.
gtkplacessidebar and nautilus-pathbar uses the mount name retrieved by
g_mount_name if available.
Use that fir the operations dialogs as well to display a more friendly
name to the user and to be consistent with the sidebar and pathbar name.

https://bugzilla.gnome.org/show_bug.cgi?id=738087
2014-10-09 10:41:52 +02:00
Ross Lagerwall
89004e521b file-operations: Add spaces between em dashes
Add spaces between em dashes when reporting delete progress for
consistency with the reporting of copy progress.

https://bugzilla.gnome.org/show_bug.cgi?id=721292
2014-03-31 09:18:56 +01:00
Daniel Mustieles
e314fbcc99 Updated FSF's address 2014-01-31 14:13:48 +01:00
Ross Lagerwall
fb2eaaaa5c file-operations: Don't crash after failed inhibit
If gtk_application_inhibit fails, it returns a 0 cookie.  When this
invalid value is passed to gtk_application_uninhibit, Nautilus crashes
if glib or gtk is compiled with minimal debug checks.
So, only call gtk_application_uninhibit if a non-zero cookie is
returned.  Also, use the correct type for inhibit_cookie (guint).

https://bugzilla.gnome.org/show_bug.cgi?id=709015
2013-11-03 08:06:26 +02:00
William Kunkel
63f4d5c4af Bug 698694 - Redundant options presented in operations on single files
https://bugzilla.gnome.org/show_bug.cgi?id=698694
2013-08-31 17:45:02 -07:00
Nelson Benitez Leon
e296a869fb file operations: fix double unref and show invalid filename error dialog
Remove a superflous g_object_unref() call plus show error dialog when
creating a new file with an invalid file name for the destination
file system.

Fixes bug 706131

https://bugzilla.gnome.org/show_bug.cgi?id=706131
2013-08-16 18:38:38 +02:00
Cosimo Cecchi
8ff0bf18f9 file-operations: replace control characters for FAT fs operations
Those are invalid - if we find one, replace it with an underscore as
well.

https://bugzilla.gnome.org/show_bug.cgi?id=706131
2013-08-16 18:38:33 +02:00
Cosimo Cecchi
3a61cbb240 libnautilus-private: don't use deprecated GtkImageMenuItem and GtkStock 2013-08-13 12:34:51 +02:00
Cosimo Cecchi
463e8d1b19 places-sidebar: make sure to always notify when unmounting
When unmounting from the sidebar with an operation other than eject, we
still need to set up the progress notification, as some drives return
FALSE for can_eject.

https://bugzilla.redhat.com/show_bug.cgi?id=885133
2012-12-11 11:29:03 -05:00
Timothy Arceri
ecee8be850 Make sure to use correct filename when restoring from Trash
https://bugzilla.gnome.org/show_bug.cgi?id=673598
2012-11-30 17:44:38 -05:00
Cosimo Cecchi
7af24a892c all: don't use eel_g_object_list_copy()
Use g_list_copy_deep() instead.
2012-10-23 16:13:58 -04:00
Cosimo Cecchi
41d2230d6f file-operations: use the local (FUSE) path for remote symlinks
Instead of the path relative to the remote machine, in case the
destination of the link is native.

https://bugzilla.gnome.org/show_bug.cgi?id=148330
2012-09-13 21:56:28 -04:00
Tomas Bzatek
f83d19ac91 Don't verify symlinked target for I/O operations
Nautilus verifies the destination for free space, read-only ability
and such. This however doesn't work for symlink pointing to a directory.

Internally (in gio) we call statfs() but that actually stats the fs the
symlink is on, instead of the place symlink is pointing to. This appears
to be a limitation of POSIX statfs().

To work around this limitation, let's disable these extra checks when
destination is a folder and symlinked.

The bug manifestation are false error messages preventing to create a file
or directory when parent fs is read-only but contains a symlink to rw fs
which is the desired destination.

https://bugzilla.redhat.com/show_bug.cgi?id=844713
2012-09-12 18:09:04 +02:00
Pavel Vasin
c092d25e90 file-operations: fix GList leak
https://bugzilla.gnome.org/show_bug.cgi?id=682603
2012-08-24 18:41:32 +02:00
Pavel Vasin
09670c24ed file-operations: move: fix potential GError leaks
https://bugzilla.gnome.org/show_bug.cgi?id=682603
2012-08-24 18:41:30 +02:00
Pavel Vasin
21ae836048 file-operations: fix GFile leak
https://bugzilla.gnome.org/show_bug.cgi?id=682603
2012-08-24 18:41:29 +02:00
William Jon McCann
9c46ee05af Use quotes consistently for error dialogs 2012-08-22 14:22:12 -04:00
William Jon McCann
216e50f40e Make getting extension more robust
Ensure the basename and extension have at least one char each.
2012-08-22 14:22:12 -04:00
William Jon McCann
6b3dd822dc Use double quotes instead of ascii quotes
https://bugzilla.gnome.org/show_bug.cgi?id=681808
2012-08-14 10:47:11 -04:00
William Jon McCann
efbf42c956 Improve the alert text when trashing a remove file
https://bugzilla.gnome.org/show_bug.cgi?id=657461
2012-08-14 10:28:07 -04:00
William Jon McCann
73445a7927 always pass the parent window to the file operations
So that we can properly place resulting dialogs.
2012-07-16 15:20:35 -04:00
William Jon McCann
3515bc368a Don't use the term mount in the error dialog
Use the human term access instead.
2012-07-16 13:30:50 -04:00
William Jon McCann
ce64cbc6bf Add a Recent files place
https://bugzilla.gnome.org/show_bug.cgi?id=325824
2012-07-14 06:59:35 -04:00
Cosimo Cecchi
c039b03590 all: fix some issues highlighted by static analysis
Thanks to Jasper for the clang scanner tricks.
2012-04-27 15:02:00 -04:00
Cosimo Cecchi
8468037daa file-operations: use gtk_application_inhibit/uninhibit()
Instead of our custom code that does the same thing.
2012-04-26 15:17:23 -04:00
Cosimo Cecchi
4303c5b23d all: use g_object_add/remove_weak_pointer()
Instead of the eel helpers.
2012-04-11 11:36:41 -04:00
Abderrahim Kitouni
0531db12b0 file-operations: don't mix character and byte lengths
Otherwise untitled files end up with a (possibly) corrupt part of the
name appended.

https://bugzilla.gnome.org/show_bug.cgi?id=672761
2012-04-06 09:21:39 +01:00
Cosimo Cecchi
49c753b1e2 file-operations: fix off-by-one error in copied files count
TransferInfo->num_files counts from zero, so we have to increment it by
one when formatting it into a string.

https://bugzilla.gnome.org/show_bug.cgi?id=673345
2012-04-02 11:24:01 -04:00
Michael Terry
819a5d14a3 file-operations: use the right prototype for empty trash callback
When unmounting, we might first prompt whether the trash should be
emptied or not on the target volume. If we do so, make sure the callback
from the empty trash job has the right prototype, to avoid crashing
later trying to interpret a gboolean as a pointer to a data structure.

https://bugzilla.gnome.org/show_bug.cgi?id=670595
2012-03-05 12:00:58 -05:00
Cosimo Cecchi
362fb6464b undo: rework undo for the trash operation to be asynchronous
Also, make the mtime checks actually useful; we need to check the
trash::deletion-date attribute and match it with the time we trashed the
file (which we can easily know using g_get_current_time()).
2012-01-21 19:00:10 -05:00