Commit Graph

24 Commits

Author SHA1 Message Date
Philip Withnall
6e362ce3b6
gio: Fix various implicit conversions from size_t to smaller types
Basically various trivial instances of the following MSVC compiler
warning:
```
../gio/gio-tool-set.c(50): warning C4267: '=': conversion from 'size_t' to 'int', possible loss of data
```

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-04-25 00:37:47 +01:00
Ondrej Holy
c083a4d1a6 gio-tool-mount: Add option to show progress when unmounting 2023-06-28 15:51:51 +00:00
Marco Trevisan (Treviño)
a0e71ff86f gio-tool-mount: Return early on fgets EOF
As per commit a5390002 we're exiting with error in case fgets failed,
however it could also fail because of EOF (like on ^D), so in such case
we can just return early treating it as a non-error.

Otherwise still exit with error.

Fixes: #2737
2022-08-30 16:33:29 +02:00
Marco Trevisan (Treviño)
a5390002fc gio-tool-mount: Exit with error in case we can't read from stdin
It's a fatal situation so we can just exit without caring much.
2022-07-06 16:05:33 +02:00
Philip Withnall
5942cd7984 gio: Add SPDX license headers automatically
Add SPDX license (but not copyright) headers to all files which follow a
certain pattern in their existing non-machine-readable header comment.

This commit was entirely generated using the command:
```
git ls-files gio/*.[ch] | xargs perl -0777 -pi -e 's/\n \*\n \* This library is free software; you can redistribute it and\/or\n \* modify it under the terms of the GNU Lesser General Public/\n \*\n \* SPDX-License-Identifier: LGPL-2.1-or-later\n \*\n \* This library is free software; you can redistribute it and\/or\n \* modify it under the terms of the GNU Lesser General Public/igs'
```

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Helps: #1415
2022-05-18 09:18:52 +01:00
Loic Le Page
71de9553ca Fix global variable name hidden by local variables in gio/gio-tool-mount.c 2022-03-31 13:10:25 +01:00
Emmanuel Fleury
e952248dc2 Use G_OPTION_ENTRY_NULL to avoid missing initializer warnings 2021-05-13 20:16:46 +00:00
Ondrej Holy
dd49962eaf gio-tool-mount: Do not print anything if "gio mount -d" suceeded
"gio mount" doesn't print anything in case of success, however "gio mount -d"
prints "Mounted [id] at [mount_path]", which is inconsistent. It might probably
make sense for fstab volumes, but "gio mount -d" now support UUIDs which are
heavily used for daemon mounts and I think that it is not wise to print
"/run/user/$UID/gvfs" mount paths. The mount path can be still found over
"gio mount -l". Let's remove this message to make it more consistent.
2019-11-27 13:37:51 +01:00
Ondrej Holy
8c24b7cd6e gio-tool-mount: Allow mounting by the given UUID
"gio mount" only allows mounting volumes using device files, but not using
UUIDs. Volume monitors for various GVfs locations usually supports just UUIDs.
It would be handy to support them also for testing purposes (because
"g_file_mount_enclosing_volume()" does something else than "g_volume_mount()"
in case of shares provided by GOA volume monitor for example). Let's update
"-d" option to support also UUIDs.

https://gitlab.gnome.org/GNOME/gvfs/issues/251
2019-11-27 13:20:57 +01:00
Ondrej Holy
88b8ebb5dd gio-tool: Hold GVolumeMonitor reference during operations
Releasing GVolumeMonitor before g_volume_mount finish cause that
g_volume_get_mount returns NULL, because the mount is not correctly
propagated to the volume.

https://gitlab.gnome.org/GNOME/glib/issues/1458
2018-08-02 11:35:48 +02:00
segfault
76b4d0ab3f Add support for TCRYPT volumes to GMountOperation
Add G_ASK_PASSWORD_TCRYPT flag to GAskPasswordFlags and add the
following properties to GMountOperation:

- hidden_volume [1]
- system_volume [2]
- pim [3]

[1] https://www.veracrypt.fr/en/Hidden%20Volume.html
[2] https://www.veracrypt.fr/en/System%20Encryption.html
[3] https://www.veracrypt.fr/en/Personal%20Iterations%20Multiplier%20(PIM).html
2018-06-21 15:32:04 +02:00
Philip Withnall
137ae066fe Merge branch 'wip/oholy/gio-mount-stop' into 'master'
gio-tool: Add support for stopping drives

See merge request GNOME/glib!17
2018-05-28 14:03:37 +00:00
Ondrej Holy
9ac1ba56a3 gio-tool: Fix GMountOperation leaks
GMountOperation is used on various places, but it is not properly unrefed.
Let's fix the leaks.
2018-05-28 14:44:07 +02:00
Ondrej Holy
fe9c6192c4 gio-tool: Add support for stopping drives
There is not currently an option for stopping drives, however it
would be really useful for testing. Let's add that possibility
for "gio mount".
2018-05-28 14:44:07 +02:00
Ondrej Holy
2cb2a617f1 gio-tool: Print help if no arguments are given
Help is usually printed from tools if no arguments are given and there
is not default action. However "gio mount" and "gio trash" just silently
return. Let's print "No locations given" error and show help consistently.
2018-05-28 13:50:55 +02:00
Ondrej Holy
bc365c9b4e gio-tool: Use "…" consistently
"gio help COMMAND" shows some arguments with "..." and some with "…",
which looks weird, e.g.:

$ gio help mount
gio mount [OPTION…] [LOCATION...]

Let's use "…" consitently.
2018-05-28 13:50:55 +02:00
Ondrej Holy
6863080c32 gio-tool: Fix alignment of monitor messages
Name of GMount/GVolume/GDrive is aligned in many cases in output messages,
except few cases. Let's unify the alignment.

https://bugzilla.gnome.org/show_bug.cgi?id=776169
2017-06-06 11:11:58 +02:00
Sébastien Wilmet
3bf4a720c3 gio/: LGPLv2+ -> LGPLv2.1+
Sub-directories inside gio/ already processed in a previous commit:
- fam/
- gdbus-2.0/ (which contains only codegen/)
- gvdb/
- inotify/
- tests/
- win32/
- xdgmime/

Other sub-directories inside gio/:
- completion/: no license headers
- kqueue/: not LGPL, BSD-style license

https://bugzilla.gnome.org/show_bug.cgi?id=776504
2017-05-29 19:53:34 +02:00
Ondrej Holy
fb7d2184a6 gio-tool: Do not leak GOptionContext
GOptionContext is freed only in case of success. Free the context
also in case of failure.

https://bugzilla.gnome.org/show_bug.cgi?id=776169
2017-04-10 10:14:04 +02:00
Ondrej Holy
292f10d053 gio-tool: Add g_drive_is_removable() support
The g_drive_is_removable() support was added recently in gio/gvfs
(see Bug 765900 and Bug 765457). It was also added in gvfs-mount,
but we forgot to add it also in gio-tool-mount.

https://bugzilla.gnome.org/show_bug.cgi?id=776169
2017-04-10 10:14:04 +02:00
Ondrej Holy
094613425e gio-tool: Return error if there are not any volumes to mount
Print error and return error code if device doesn't contain any
volumes to mount.

https://bugzilla.gnome.org/show_bug.cgi?id=776169
2017-04-10 10:14:04 +02:00
Ondrej Holy
0beeeb2ec9 gio-tool: Various fixes related to error messages
This patch contains the following changes:
- Print all errors with "gio: " prefix
- Print file uri in error for each tool allowing multiple locations
- Mark all error messages translatable
- Do not leak strings used in error messages
- Always start error messages with capital letter
- Unify some error messages across various tools
- Fix addional/missing new line characters

https://bugzilla.gnome.org/show_bug.cgi?id=776169
2017-04-10 10:14:04 +02:00
Philip Withnall
a9172c6d03 gio-tool: Fix memory leaks on error paths in mount command
Various GErrors were being leaked.

Coverity CID: 1357351 (amongst others)
2016-07-11 21:56:04 +01:00
Matthias Clasen
9edba4e49c Add a new gio commandline tool
This command collects the various commandline utilities that
are currently shipped in gvfs, and unifies them under a single,
command-style binary.

The tools just use GIO APIs, so it makes sense for them to live here.
2016-07-01 16:01:34 -04:00