Commit Graph

9100 Commits

Author SHA1 Message Date
Matthias Clasen
1bb48a76a6 application: Call before/after_emit consistently
Call these vfuncs also for cases where the launching instance
is the primary one. This is what the docs suggest, and it makes
before/after_emit much more useful.

Fixes: #3726
2025-07-11 07:33:02 -04:00
Matthias Clasen
182185e31e application: Clarify documentation
Existing uses of before_emit in GTK will break if an app overrides
before/after_emit without chaining up. Clarify in the documentation
that these vfuncs need to chain up.
2025-07-11 07:33:02 -04:00
Matthias Clasen
de85736791 tests: Remove an overzealous assertion
The dbus-appinfo test was asserting that before_emit only happens
when we haven't seen a startup ID yet. But the docs imply that it
gets emitted for every activate/open/commandline, which may well
happen repeatedly. So drop this assertion.
2025-07-11 07:33:02 -04:00
Philip Withnall
5da569a425 Merge branch 'pgriffis/ipv6-scope-id' into 'main'
Fix IPv6 scope-id from DNS responses being lost

See merge request GNOME/glib!4676
2025-07-09 14:00:18 +00:00
Christoph Martin
e2970dad72 tests: skip gio launch tests on darwin
Tests currently fail under macOS because the tool claims not to work
on apple devices. Since I cannot disprove this myself, I'm disabling the
tests on Darwin.
2025-07-09 13:39:34 +01:00
Christoph Martin
c924de69f0 gio-tool-launch: fix %k field code expansion
As per the desktop entry specification, the `%k` field code should be
expanded to the location of the desktop entry file being processed. This
is only possible if the constructor-only filename property is populated,
which does not happen when using g_desktop_app_info_new_from_keyfile().

Moreover, since the Path directive in a desktop entry can be used to
set the working directory for the program to be launched, the location
passed as argument to the program must be modified such that it points
at the correct file when interpreted by the launched program. The
simplest way to achieve this consistently is to pass an absolute path.

However, g_desktop_app_info_new_from_keyfile() does not indicate why it
fails when it does. Because the tool aims to indicate whether launching
failed due to a missing file or a malformed one we first check this with
g_key_file_load_from_file().
2025-07-09 13:39:34 +01:00
Christoph Martin
c2debf4fa9 tests: ensure gio launch expands field code %k
This introduces an integration test that executes gio launch from a
variety of working directories, and checks that %k is expanded to a
location that makes sense in the context of the executed program, i.e.
an absolute path.
2025-07-09 13:39:34 +01:00
Michael Catanzaro
25a176869d Merge branch 'gio-launch-quotes' into 'main'
gio-tool-launch: Fix mismatched curly quotes in translatable strings

See merge request GNOME/glib!4683
2025-07-08 08:05:40 -05:00
Philip Withnall
8b05d8e95d gio-tool-launch: Fix mismatched curly quotes in translatable strings
Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2025-07-08 11:11:40 +01:00
Patrick Griffis
e419c1e10d inet-address: Ignore windows specific failure
In this case getaddrinfo on Windows succeeds at parsing something that fails on Linux.
2025-07-07 15:45:50 -05:00
Patrick Griffis
7e85ae9d5f ginetaddress: Scope ID parsing is not supported on win32
getaddrinfo doesn't parse it on Windows. This could be replaced by more manual parsing in the future.
2025-07-07 11:24:11 -05:00
Philip Withnall
d0f31c23d5 Merge branch 'fix_file_enumerator' into 'main'
gio: call g_file_enumerator_close in dispose instead of finalize

Closes #3713

See merge request GNOME/glib!4672
2025-07-07 12:35:50 +00:00
fbrouille
02597ca9d2 gio: call g_file_enumerator_close in dispose
`g_file_enumerator_finalize` should not call `g_file_enumerator_close`
because object parts (i.e. subclass variable and/or resources) might
already be freed, causing memory safety issues.
A better place to call `g_file_enumerator_close` is
`g_file_enumerator_dispose` because it is safe to access the object
memory here.

Fixes #3713

Signed-off-by: fbrouille <150549-fbrouille@users.noreply.gitlab.gnome.org>
2025-07-07 13:01:49 +01:00
Philip Withnall
acfe9d043f glocalfile: Fix another leak in g_local_file_set_display_name()
Signed-off-by: Philip Withnall <pwithnall@gnome.org>

Fixes: #3721
2025-07-07 12:58:59 +01:00
Marco Trevisan
29b47390c5 Merge branch 'mcatanzaro/#3721' into 'main'
Fix GFile leak in g_local_file_set_display_name()

Closes #3721

See merge request GNOME/glib!4677
2025-07-07 03:40:47 +02:00
Michael Catanzaro
0d845f3816 Fix GFile leak in g_local_file_set_display_name()
Fixes #3721
2025-07-06 17:34:48 -05:00
Patrick Griffis
b40194865a Unify address parsing for GInetAddress and GInetSocketAddress
This allows scope-ids to work for GInetAddress
2025-07-03 16:53:52 -05:00
Patrick Griffis
ed8bae5483 socket-testclient: Fix leaking debug strings 2025-07-03 16:11:29 -05:00
Patrick Griffis
bb8281fa72 socket-testclient: Include scope-id in debug output 2025-07-03 16:11:29 -05:00
Patrick Griffis
984d5cb199 socket-testclient: Support connecting to IPv6 addresses
Each enumerated address can be of a different family type, so you have to make a socket after you have that information.

As this is just a test client we make a new socket each time for simplicity.
2025-07-03 11:05:23 -05:00
Patrick Griffis
d03f495b31 gsocketaddress: Set scope-id and flowinfo of ginetaddress 2025-07-03 11:05:23 -05:00
Patrick Griffis
73d0627bda ginetaddress: Add scope-id and flowinfo properties
This will be used by GResolver as DNS responses include this
information along with the address.
2025-07-03 11:05:23 -05:00
Mark Nauwelaerts
bd20507909 gsettings: adjust closure helpers in g_settings_bind_with_mapping_closures
... to handle an output value parametere
2025-06-18 19:52:59 +02:00
Mark Nauwelaerts
9ee245b78e tests: gsettings: extend g_settings_bind_with_mapping_closures test
... so as to fail with current implementation
2025-06-17 18:18:40 +02:00
Maximiliano Sandoval
d02f59a54b gio: enums: Fix GBusNameOwnerFlags's annotation
g-ir-scanner won't pick Since or Deprecated annotations if they are
inlined, they need a dedicated documentation block for this to work. The
since annotation is used, e.g. in gtk-rs, to not expose enum flags if
not compiled declaring we have a new enough glib version.
2025-06-16 17:57:53 +02:00
Ignacy Kuchciński
181992ccb5 glocalfile: Verify deleting from trash beforehand
Verify that you can delete the file from the trash before moving it, if
the file is a directory owned by the user, recursively check for
non-empty directory not owned by he user.

Closes https://gitlab.gnome.org/GNOME/glib/-/issues/1665
2025-06-12 13:26:22 +02:00
Ignacy Kuchciński
2a7f28e88a glocalfile: Populate different statbuf for parent
Populate a different statbuf for the parent directory, so that we can
keep using file_state for the file we're removing later in the code.
2025-06-11 10:33:50 +02:00
Philip Withnall
b2f0bb9592 tests: Expand PATH for Python tests on Windows
This works around a Meson bug
(https://github.com/mesonbuild/meson/issues/4668).

If we have a Python test which spawns a built native binary, that binary is
listed in the `depends` argument of the `test()`. On Linux, this results in
the directories containing the built libraries which the binary depends on
being added to the `LD_LIBRARY_PATH` of the test invocation. On Windows,
however, Meson currently doesn’t add those directories to `PATH` (which is
the equivalent of `LD_LIBRARY_PATH`), so we have to do it manually.

This takes the same approach as Christoph Reiter did in
gobject-introspection
(13e8c7ff80/tests/meson.build (L2)).

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2025-05-28 16:10:55 +01:00
Philip Withnall
ac2ecb5a43 tests: Add e flag to fdopen() calls in gsubprocess tests
Unlike the previous commit, there is no `g_fdopen()` wrapper where we
can add cross-platform support for this.

I’m not adding that now just for `O_CLOEXEC` support for these two
calls, so pass the flag locally for now.

If someone wanted to add a `g_fdopen()` wrapper in future, the
`GLIB_FD_CLOEXEC` here could be refactored easily.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2025-05-28 14:37:08 +01:00
Philip Withnall
f9a7ac11f5 gstdio: Add support for the e flag (O_CLOEXEC) to g_fopen()
This adds cross-platform support for it: on glibc, musl and BSD’s libc,
the flag is natively supported. On Windows, convert it to the `N` flag,
which similarly indicates that an open file shouldn’t be inherited by
child processes.

This allows us to unconditionally pass `e` to `g_fopen()` so `O_CLOEXEC`
can easily be set on its FDs.

Also do the same for `g_freopen()`, since it shares the same underlying
mode handling code.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2025-05-28 14:37:02 +01:00
fbrouille
281f30ef41 gio: add 'type filename' annotation for 'g_vfs_get_file_for_path'
Add the 'type filename' annotation on the parameter 'path'.
2025-05-21 16:08:52 +00:00
fbrouille
5a546d452e gio: add nullable annotation for 'g_file_monitor_emit_event'
Add the nullable annotation on the parameter 'other_file'
and fix the description.
2025-05-21 16:08:38 +00:00
Philip Withnall
fc79ee45ec Merge branch 'android_no_faccessat' into 'main'
glocalfile: Disable faccessat()-based query_exists on Android

See merge request GNOME/glib!4620
2025-05-20 15:14:40 +00:00
Philip Withnall
25677d10bf Merge branch '3616-action-map-docs' into 'main'
gactionmap: Fix broken link in documentation comment

Closes #3616

See merge request GNOME/glib!4505
2025-05-20 14:35:17 +00:00
Colin Kinloch
06602315c3 glocalfile: Disable faccessat()-based query_exists on Android
The bionic version of faccessat() returns EINVAL when flags are set.

See 35778253a5
2025-05-20 15:00:02 +01:00
Fina Wilke
b36e646b54 gdesktopappinfo: Prefer matches that occur earlier in the match string
Some apps names or keywords contain multiple words. For example 'LibreOffice
Calc' contains the word 'Calc'. This is rightfully detected as a prefix match,
however generally it is expected that searching for 'calc' would consistantly
return 'Calculator' in first position, instead of ranking them equally.

We now prioritise tokens that would otherwise rank equal based on where they
occur in the string, giving earlier occurences precedence.
2025-05-17 15:43:13 +02:00
Michael Catanzaro
290d90473d Merge branch 'gzlib-docs' into 'main'
gzlibcompressor: Convert docs to gi-docgen linking syntax

See merge request GNOME/glib!4633
2025-05-14 11:35:03 -05:00
Philip Withnall
843779903c Merge branch 'socket_address_native_size' into 'main'
docs: Description of return value of get_native_size

Closes #2377

See merge request GNOME/glib!4625
2025-05-14 10:44:20 +00:00
Philip Withnall
13a73f9008 gzlibcompressor: Convert docs to gi-docgen linking syntax
Improve formatting while I’m there, and try and ensure all the docs in
these two files matches the
[guidelines](https://developer.gnome.org/documentation/guidelines/devel-docs.html#writing-api-references).

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

Helps: #3250
2025-05-14 11:38:05 +01:00
Benjamin Otte
f5b0415539 gio: Add GZlibCompressor:os property
The use case for exposing this field is GTK wanting reproducible
encoding output across different OSes.

I decided to expose the OS as an integer because zlib uses an int
in its header and does not make its OS codes available as a custom
type in its API.

I also decided to limit it to values between 0 and 255 because zlib
encodes the OS as a single byte.

Test included.

Fixes: #3663
2025-05-12 09:07:57 +02:00
marklkram
c0c0e212d9 docs: Description of return value of get_native_size
Specified that if the user passes an invalid address, the function returns -1.

closes #2377
2025-05-10 22:28:18 -04:00
marklkram
fdd41f9b65 docs: Description of return value of get_native_size
Specified that if the user passes an address that is not of type AF_INET or AF_INET6 ,
the function returns -1.

closes #2377
2025-05-07 15:58:50 -04:00
Gleb Popov
b479d14371 Fix GNetworkMonitorNetlink operation under a FreeBSD jail with shared network stack 2025-04-21 22:28:49 +00:00
Marvin W
cf44fb0d2a cocoa: add support for GBytesIcon in notification backend 2025-04-18 14:36:34 +02:00
Sergey Bugaev
bf266f4116 gtlsconnection: Fix annotation
The array is allocated by the *caller*, not the callee, and then filled
by the callee during the call.

Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
2025-04-14 15:32:18 +03:00
Philip Withnall
2d66caf6cb Merge branch 'wsign-conversion' into 'main'
Various -Wsign-conversion warning fixes

See merge request GNOME/glib!4590
2025-04-11 13:35:16 +00:00
Philip Withnall
98ab3d7a87 xdgmime: Disable -Wsign-conversion warning inside xdgmime
The code wasn’t written for it, and we don’t want to diverge from
upstream for this, so disable -Wsign-conversion in case it was set for
the overall GLib build.

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

Helps: #3405
2025-04-11 14:02:55 +01:00
Michael Catanzaro
defec7eef2 gthreadedresolver: fix crash in loopback interface check
It's expected that an interface may have a NULL socket address, so just
skip it and don't crash if so. In practice, this occurs for VPN
interfaces.

Fixes: fe0139ee98
2025-04-10 15:42:21 -05:00
Philip Withnall
a33df3d81e gfile: Expand documentation around file info for inaccessible files
Make it a bit clearer that a returned `GFileInfo` can be empty if
`stat()` fails (e.g. with `EACCES`), and that it’s the caller’s
responsibility to use `g_file_info_has_attribute()` before retrieving
attribute values.

This better documents what we implemented in, for example, !3336.

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

Helps: #3658
2025-04-08 16:59:20 +01:00
Philip Withnall
9d466bddc2 gfile: Port the g_file_query_info() doc comment to gi-docgen
This doesn’t change its content.

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

Helps: #3250
2025-04-08 16:54:19 +01:00