Commit Graph

5301 Commits

Author SHA1 Message Date
Philip Withnall
205059b9c0 Merge branch 'wip/oholy/trashing-locations' into 'master'
glocalfile: Allow trashing only for locations supported by trash:///

See merge request GNOME/glib!49
2018-06-06 10:58:22 +00:00
Ondrej Holy
f7e80f8d0c glocalfile: Add test case for g_file_trash
g_local_file_trash has been changed to return G_IO_ERROR_NOT_SUPPORTED
for locations on system-internal mounts. Let's verify that.

https://gitlab.gnome.org/GNOME/glib/issues/251
2018-06-06 12:18:30 +02:00
Gaurav
4ade09416b Fix potential Null pointer dereference.
if "match" is NULL, it is dereferenced in match_free() (L:457)
2018-06-05 14:01:47 +00:00
Ondrej Holy
6dfd0a00e7 glocalfile: Update G_FILE_ATTRIBUTE_ACCESS_CAN_TRASH logic
Change G_FILE_ATTRIBUTE_ACCESS_CAN_TRASH logic to be consistent
with recent g_local_file_trash changes, i.e. set this to FALSE for
locations on system-internal mounts.

https://gitlab.gnome.org/GNOME/glib/issues/251
2018-06-05 14:53:15 +02:00
Ondrej Holy
15a47afb0e glocalfile: Allow trashing only for locations supported by trash:///
New bugs appears periodically in nautilus/gvfs/glib components that not
all trashed files are shown in trash:///. It used to be problem mostly
for "bind mounts" and btrfs subvolumes only. Currently, it is also
problem for nfs, cifs and other filesystems, which have been recently
added by commmit 0d69462f on the list of system internal filesystems.

This happens because the trash backend doesn't monitor files on system
internal mounts. Such behavior is not against the trash-spec, however,
we should be consistent within GNOME.

This behavior has the nice side-effect that it solves issues with hangs
on network filesystems: https://gitlab.gnome.org/GNOME/glib/issues/605,
because those are currently on the system internal filesystem list.

https://gitlab.gnome.org/GNOME/glib/issues/251
2018-06-05 14:53:15 +02:00
Christoph Reiter
553df9dcaf Merge branch 'fix-gdbus-unix-addresses-test' into 'master'
Fix failing gdbus-unix-addresses test when G_MESSAGES_DEBUG is set

See merge request GNOME/glib!50
2018-06-01 15:31:25 +00:00
Xavier Claessens
f929d14826 Fix failing gdbus-unix-addresses test when G_MESSAGES_DEBUG is set
This test assumes the subprocess does not print anything else on stdout
other than the dbus address, otherwise g_test_trap_assert_stdout()
fails to match. But if the env running tests has G_MESSAGES_DEBUG=all
then it will also print "PATH=%s".
2018-06-01 10:23:12 -04:00
Gaurav
593eeff55e Fix a warning reported by static analyser tool:
Assignment of a signed value which has type 'time_t' to a variable of a bigger integer type 'guint64'
2018-05-31 08:25:31 +00:00
Christoph Reiter
a2aa91ae5d win32: Remove all remaining WinXP compat code
Remove all code which is no longer built with Windows 7+
2018-05-29 17:16:38 +02:00
Emmanuele Bassi
61ccf733cc Merge branch 'wip/rishi/issue-1073' into 'master'
Revert "Return folder as icon for directories"

See merge request GNOME/glib!36
2018-05-29 07:43:56 +00:00
Philip Withnall
c3846b33d7 Merge branch 'identifier-typo-fix' into 'master'
gio: Fix some typos in the documentation

See merge request GNOME/glib!31
2018-05-28 16:58:13 +00:00
Philip Withnall
6730309826 Merge branch 'wip/hadess/g-drive-identifier' into 'master'
gio: Add G_DRIVE_IDENTIFIER_KIND_UNIX_DEVICE

See merge request GNOME/glib!10
2018-05-28 16:31:42 +00:00
Bastien Nocera
75950d70c9 gio: Deprecate G_VOLUME_IDENTIFIER_KIND_HAL_UDI
HAL itself has long been deprecated.
2018-05-28 17:20:21 +02:00
Debarshi Ray
25af5ad1da Revert "Return folder as icon for directories"
This workaround is no longer necessary because it was fixed in
shared-mime-info three years ago:
https://bugs.freedesktop.org/show_bug.cgi?id=89150

This reverts commit 90025254fd.

https://gitlab.gnome.org/GNOME/glib/issues/1073
2018-05-28 17:19:59 +02:00
Bastien Nocera
4c84eac38e gio: Add G_DRIVE_IDENTIFIER_KIND_UNIX_DEVICE
It's a synonym of G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE.
It doesn't change anything except not feeling dirty from using a wrongly
prefixed constant for the object type.

See: #182
2018-05-28 17:13:30 +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
Philip Withnall
dc4e63930f gio: Fix some typos in the documentation
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-05-28 10:26:06 +01:00
Nirbheek Chauhan
545641a8fb glib-compile-resources: Use g_fprintf() instead of fprintf()
G_GSIZE_FORMAT and friends cannot always be used with fprintf(), they
require gnu/C99 implementation.

https://bugzilla.gnome.org/show_bug.cgi?id=796283
2018-05-26 13:16:13 +05:30
Philip Withnall
d9df5d72e1 Merge branch '1354-volume-nullable' into 'master'
Resolve "Missing nullable annotation on the return value of gio_volume_get_mount"

Closes #1354

See merge request GNOME/glib!4
2018-05-25 14:15:18 +00:00
Xavier Claessens
c627fb4926 Fix missing osx files when running "make dist"
Fixes #528, #1381.
2018-05-25 03:06:07 +00:00
Xavier Claessens
d3735df34f Revert "Revert "Meson: Fix cocoa and carbon support""
This reverts commit e25a2f95b3.
2018-05-25 03:06:07 +00:00
Xavier Claessens
ead46cdc7e Revert "Revert "Rename objective-c files from .c to .m""
This reverts commit 2e9f3a9afe.
2018-05-25 03:06:07 +00:00
Philip Withnall
41ec0b9c60 gio: Add missing (nullable) annotations to GDrive, GMount, GVolume
Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://gitlab.gnome.org/GNOME/glib/issues/1354
2018-05-24 23:29:17 +01:00
Matthias Clasen
2e9f3a9afe Revert "Rename objective-c files from .c to .m"
This reverts commit e400af99d4.
2018-05-22 17:21:16 -04:00
Matthias Clasen
e25a2f95b3 Revert "Meson: Fix cocoa and carbon support"
This reverts commit 2e3769a4f7.
2018-05-22 17:21:16 -04:00
Xavier Claessens
2e3769a4f7 Meson: Fix cocoa and carbon support
- Compiler checks were failing because it were using C compiler to build
objc code.
- xdgmime is needed on osx too.
- -DGIO_COMPILATION must be passed to objc compiler too.
- gapplication doesn't build on osx, it is excluded in autotools too.

We have to be careful when we use add_project_link_arguments(): All
targets are built using link arguments for the C language, except for
libgio on osx which use the objc language, because it contains some ".m"
source files. See https://github.com/mesonbuild/meson/issues/3585.

https://bugzilla.gnome.org/show_bug.cgi?id=796214
2018-05-22 11:51:59 -04:00
Xavier Claessens
e400af99d4 Rename objective-c files from .c to .m
Those files got renamed to .c to work around an automake issue, but
Meson needs them to have .m extension. Better rename them at build time
in Makefile.am since that's where the workaround is needed.

https://bugzilla.gnome.org/show_bug.cgi?id=672777
2018-05-22 11:49:24 -04:00
Nirbheek Chauhan
458b6288bf gengiotypefuncs.py: Read and parse files in binary mode
Fixes this build error on macOS when inside an ssh terminal:

Traceback (most recent call last):
  File "[...]/gio/tests/gengiotypefuncs.py", line 23, in <module>
    for line in f:
  File "[...]/lib/python3.6/encodings/ascii.py", line 26, in decode
    return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 2625: ordinal not in range(128)

https://bugzilla.gnome.org/show_bug.cgi?id=796328
2018-05-22 14:34:17 +05:30
Xavier Claessens
41e008266d kqueue: Fix typo that breaks the build in previous commit 2018-05-18 10:52:08 -04:00
Xavier Claessens
5b19df2f44 kqueue: Fix -Wdeclaration-after-statement errors
https://bugzilla.gnome.org/show_bug.cgi?id=796213
2018-05-18 10:09:24 -04:00
Ondrej Holy
d0821da524 gio: Add g_unix_mount_get_options
GVfsUDisks2VolumeMonitor handles x-gvfs-hide/x-gvfs-show mount options
used to overwrite our heuristics whether the mount should be shown, or
hidden. Unfortunately, it works currently only for mounts with
corresponding fstab entries, because the options are read over
g_unix_mount_point_get_options. Let's introduce g_unix_mount_get_options
to allow reading of the options for all sort of mounts (e.g. created
over pam_mount, or manually mounted).

(Minor fixes to the documentation by Philip Withnall
<withnall@endlessm.com>.)

https://bugzilla.gnome.org/show_bug.cgi?id=668132
2018-05-16 11:31:42 +01:00
Xavier Claessens
7b8d8835f5 Meson: libintl is a public dependency of glib-2.0
On non-glibc platforms gettext is provided by extra libintl dependency.
We wrongly thought libintl is an internal dependency and applications
needs to explicitly link on it, but turns out that breaks many
applications and with autotools the .pc generated actually has -lintl in
public "Libs:".

https://bugzilla.gnome.org/show_bug.cgi?id=796085
2018-05-15 13:00:44 -04:00
Ondrej Holy
1ec70e713c gio: Fix typo in g_file_info_set_attribute docs
g_file_info_set_attribute mentions %G_ATTRIBUTE_TYPE_INVALID, but no
such value exists. It should be %G_FILE_ATTRIBUTE_TYPE_INVALID.

https://bugzilla.gnome.org/show_bug.cgi?id=796138
2018-05-15 15:54:18 +02:00
David Faure
1c177ce0ab xdgmime: Add better detection for text vs. binary and zero-sized files
This detects zero-sized files to return the special-case
"application/x-zerosize" mime-type, as well as trying to differentiate
unknown file types based on their first 128 bytes of data, so that text
editors can automatically handle unknown text files.

Based on:
https://cgit.freedesktop.org/xdg/xdgmime/commit/?id=5181175d5fdaa3832b0fd094cda0120b1fe92af6
https://cgit.freedesktop.org/xdg/xdgmime/commit/?id=9c5802b8da56187c5c6abaf70042d14b12d832a9

https://bugzilla.gnome.org/show_bug.cgi?id=795544
2018-05-10 11:46:17 +01:00
Xavier Claessens
b6cb22f32b Meson: Do not build tests with nodelete/Bsymbolic-functions
-z nodelete breaks the libresourceplugin module usage in the resources.c
test, which expects to be able to unload it.

Make the Meson build match what the autotools build does: only pass
glib_link_flags to the headline libraries (glib-2.0, gio-2.0,
gobject-2.0, gthread-2.0, gmodule-2.0) and omit it from all other build
targets.

https://bugzilla.gnome.org/show_bug.cgi?id=788771
2018-05-09 12:52:59 +01:00
Matthew Leeds
b437a13a70 gio: Fix a typo in the docs for g_file_is_native() 2018-05-04 18:32:43 -07:00
Iñigo Martínez
5faac84413 gdbus-codegen: Fix header include in the body file
When body file is generated, the header name to be included is
built by using the path passed by `--output` directory. However,
this might not be correct because, if the path includes a
subdirectory, the whole path will be used instead of only the
base name.

Please see:
  https://github.com/mesonbuild/meson/issues/3488
  https://github.com/gnome-mpv/gnome-mpv/issues/305#issuecomment-385056156

https://bugzilla.gnome.org/show_bug.cgi?id=795802
2018-05-04 17:16:10 +01:00
Tomasz Miąsko
9d40f64960 gdesktopappinfo: Mark GDesktopAppInfo constructors as nullable.
GDesktopAppInfo constructors return NULL on error without having
separate **GError parameter.

https://bugzilla.gnome.org/show_bug.cgi?id=795152
2018-05-04 17:13:39 +01:00
Havard Graff
71fba3b3be kqueue/meson: add missing dependency
gioenumtypes needs to be generated:
In file included from ../../../../external/glib/gio/kqueue/gkqueuefilemonitor.c:37:
In file included from ../../../../external/./glib/gio/glocalfilemonitor.h:25:
In file included from ../../../../external/./glib/gio/gunixmounts.h:24:
../../../../external/./glib/gio/gio.h:86:10: fatal error: 'gio/gioenumtypes.h' file not found
#include <gio/gioenumtypes.h>
         ^~~~~~~~~~~~~~~~~~~~

https://bugzilla.gnome.org/show_bug.cgi?id=794325
2018-05-03 00:01:50 +01:00
Georges Basile Stavracas Neto
0f37af7e9b glocalfile: Use g_canonicalize_filename
Drop the local function in favor of the exposed
one.

https://bugzilla.gnome.org/show_bug.cgi?id=111848
2018-04-30 21:54:49 +01:00
Christoph Reiter
fe9457dedd gliststore: Improve the test coverage
https://bugzilla.gnome.org/show_bug.cgi?id=795307
2018-04-30 13:02:41 +02:00
Christoph Reiter
758d7073a9 g_list_store_splice: Add items in the order of the input array and at the given position
It inserted the new items one position after the given one and inserted all new items
at the same position resulting in the items being in the reverse order of the
input array.

It was decided to make these behavioural changes because this function has according to
https://codesearch.debian.net/search?q=g_list_store_splice only one real user (nautilus)
and it didn't do what one would expect from reading the documentation.

https://bugzilla.gnome.org/show_bug.cgi?id=795307
2018-04-30 13:02:41 +02:00
Philip Withnall
9b4c50f63d all: Remove trailing newlines from g_message()/g_warning()/g_error()s
All those logging functions already add a newline to any message they
print, so there’s no need to add a trailing newline in the message
passed to them.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
Reviewed-by: nobody
2018-04-27 16:46:19 +01:00
Philip Withnall
8056b753e5 tests: Fix a free function in the GIO tests
The monitor_path comes from g_file_get_path(), so should be freed with
g_free() rather than free(). This makes no difference because they are
the same function in practice, but using free() is a bit confusing.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
Reviewed-by: nobody
2018-04-26 15:36:11 +01:00
Philip Withnall
9365e212f8 More const-correctness fixes
This continues one of the const-correctness fixes from the previous
commit (it needed some more transitive fixes), and reverts another of
them, since it was over-zealous.

This fixes CI failure: https://gitlab.gnome.org/GNOME/glib/-/jobs/27125.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
Reviewed-by: nobody
2018-04-26 15:35:58 +01:00
Philip Withnall
22cd18500d Fix various const-correctness issues
Spotted when temporarily compiling with -Wwrite-strings. This only goes
a small way towards making the code base -Wwrite-strings–clean. It
introduces no functional changes, and fixes no bugs.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
Reviewed-by: nobody
2018-04-26 15:19:17 +01:00