Commit Graph

31182 Commits

Author SHA1 Message Date
Simon McVittie
feca93e51e girepository: Correct --c-include arguments for GIO Unix/Windows headers
The deprecated construct '@0@'.format(h) (where h is a file object)
expanded to the filename relative to the project root, which in this
particular case happens to be what we wanted:
`--c-include=gio/gunixmounts.h` resulted in a recommendation to
`#include <gio/gunixmounts.h>` and so on. Replacing it with
h.full_path() resulted in GIR XML and documentation that recommended
constructs like `#include </home/me/src/glib/gio/gunixmounts.h>`,
which is not what was intended (and caused new differences between
different architectures' Gio-2.0.gir on multiarch systems, which is
how I discovered this).

Hard-coding `gio/` and appending the basename of the header seems like
the simplest non-deprecated spelling that will do what we wanted.

Fixes: 51e3e7d9 "build: Bump Meson dependency to 1.4.0"
Resolves: https://gitlab.gnome.org/GNOME/glib/-/issues/3564
Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-12-13 23:34:10 +00:00
Philip Withnall
bc56578a08 Merge branch 'fix_GVfsFileLookupFunc' into 'main'
Add nullable annotations for GVfsFileLookupFunc

Closes #3561

See merge request GNOME/glib!4438
2024-12-13 15:20:24 +00:00
Philip Withnall
7ac156401d Merge branch 'win32-clear-com' into 'main'
GWin32: Add g_win32_com_clear()

See merge request GNOME/glib!4392
2024-12-13 09:49:03 +00:00
Chun-wei Fan
2af6baad08 tests: Add more tests for COM refcounts
As suggested by Luca Bacci, so that we keep track of things more clearly
in terms of COM.
2024-12-13 11:09:03 +08:00
Chun-wei Fan
4ab7977a4d gwin32.h: Make g_win32_clear_com() static inline
...for C++ implementations, as suggested by Luca Bacci.

Make things safer in terms of avoiding ODR violations[1].

[1]: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/4392#note_2296862
2024-12-13 11:03:32 +08:00
Chun-wei Fan
a3a95c2a0b glib/tests: Add C++ test for g_win32_clear_com()
This tests the C++ version of g_win32_clear_com() as there are some
COM interfaces that are only available in C++, such as DirectWrite from
the headers shipped with the Windows SDK.

This mimicks the test for the same function in glib/tests/win32.c but
done in a C++ fashion.
2024-12-13 10:45:09 +08:00
Chun-wei Fan
5642331603 GLib tests: Add test for g_win32_clear_com()
This mimicks the test for g_clear_object() in gobject/tests/reference.c.

We use the system's wincodec library for our sample here.
2024-12-13 10:45:09 +08:00
Chun-wei Fan
aff6b930a1 gwin32: Add g_win32_clear_com()
This is quite similar in concept to what g_clear_object() does, except
that is meant to deal with Windows COM objects. Note that there is a
separate C++ version available for this as there are COM interfaces that
are available in C++ only, such as DirectWrite that is shipped with the
Windows SDK (albeit a C interface is provided with the mingw-w64
toolchain.

This will call `->Release()` on the non-NULL COM object referenced by its
pointer  and sets the COM object to NULL; if the pointer refers to a
NULL COM object, this is a no-op.
2024-12-13 10:45:09 +08:00
fbrouille
d9844472a8 Add nullable annotations for GVfsFileLookupFunc
Add the nullable annotation on the parameter 'user_data'
and fix the description.
Add the nullable annotation on the return value.

Fixes #3561
2024-12-12 21:52:32 +00:00
Emmanuele Bassi
be72b8cc4a Merge branch 'macros-docs-escaping' into 'main'
docs: Fix some backslash escaping issues in doc comments

See merge request GNOME/glib!4437
2024-12-12 14:27:10 +00:00
Philip Withnall
553b026aa5
docs: Fix some backslash escaping issues in doc comments
None of these comments have been ported to gi-docgen format properly
yet, but let’s at least fix the backslash escaping so that
`G_DIR_SEPARATOR_S` can be documented usefully.

A full port of this file to gi-docgen format can happen in future.

Spotted on
https://discourse.gnome.org/t/escaped-char-in-glib-dir-separator-s-doc/25607.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-12-12 13:52:11 +00:00
Philip Withnall
ad3e0a6597 Merge branch 'tintou/gdbus-codegen-doc' into 'main'
docs: Add --generate-md to the gdbus-codegen documentation

See merge request GNOME/glib!4436
2024-12-12 11:51:49 +00:00
Corentin Noël
2021e20a8a docs: Add --generate-md to the gdbus-codegen documentation
Add it to the documentation the same way it is done for reStructured and docbook.
2024-12-12 11:51:49 +00:00
Philip Withnall
67b5a37f2b
2.83.2
Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-12-11 17:19:24 +00:00
Philip Withnall
27426ab345 Merge branch 'wip/pwithnall/dist-faff' into 'main'
ci: Enable -Dintrospection for dist builds

See merge request GNOME/glib!4433
2024-12-11 17:15:45 +00:00
Philip Withnall
f582a0dd9c
ci: Fix output paths for docs tarballs in dist-job
Otherwise they’re not picked up as artifacts, and hence are basically
lost.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-12-11 15:39:40 +00:00
Philip Withnall
fe1ff50e5c
ci: Run dist-job on a schedule as well as on tags
This will allow us to test that it actually still works, which is
important for being able to make releases, because once we push a tag,
there’s no going back. The release can’t happen if `dist-job` then fails
on that tag.

Sigh.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-12-11 15:38:46 +00:00
Philip Withnall
cc627ea0df
ci: Clear dependencies for dist-job
Otherwise it never executes, because it’s waiting patiently for zero
dependencies to complete. 🤦

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-12-11 15:37:52 +00:00
Philip Withnall
e9670d3c3c
docs: Warn if building documentation without enable_gir
If `-Ddocumentation=true` is specified without
`-Dintrospection=enabled`, warn the user. They might expect the
documentation to be built, but it won’t.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-12-11 15:36:50 +00:00
Philip Withnall
67fb5a94b6
ci: Enable -Dintrospection for dist builds
This means that the documentation can actually be generated, which was
broken before. Building the documentation requires `enable_gir`.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-12-11 15:36:00 +00:00
Philip Withnall
322d74b141
2.83.1
Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-12-11 14:51:36 +00:00
Philip Withnall
ce8fb573cb Merge branch 'alatiera/add-relase-service' into 'main'
ci: Add release component to automate tarball publishing

See merge request GNOME/glib!4432
2024-12-11 14:42:47 +00:00
Philip Withnall
7b5ee8cb75
ci: Slightly improve quoting of variables
Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-12-11 14:26:50 +00:00
Jordan Petridis
b7abe843e4
ci: Add release component to automate tarball publishing
Publishing the dist tarball to download.gnome.org is now automated.

See [1]

[1] https://gitlab.gnome.org/Teams/Websites/handbook.gnome.org/-/merge_requests/83/
2024-12-11 15:42:44 +02:00
Philip Withnall
cfa36f5e96 Merge branch '3559-revert-dbus-method-invocation-refcounting' into 'main'
Revert "gdbus: Fix leak of method invocation when registering an object with closures"

Closes #3559

See merge request GNOME/glib!4427
2024-12-11 12:41:16 +00:00
Philip Withnall
5c63da2f9c Merge branch 'ewlsh/expose-pkg-config-gi-tools' into 'main'
girepository: Expose gi-compile-repository and gi-* tools in pkg-config

See merge request GNOME/glib!4428
2024-12-11 12:39:18 +00:00
Marco Trevisan
8447052fe3 Merge branch 'wip/sophie-h/fd-list-nullable' into 'main'
gdbus: Add nullable annotations for fd list outs

See merge request GNOME/glib!4429
2024-12-10 21:41:00 +00:00
Sophie Herold
8be0a9af5b gdbus: Add nullable annotations for fd list outs 2024-12-10 22:23:56 +01:00
Evan Welsh
bb0dd59a6b
girepository: Expose gi-compile-repository in pkg-config
Expose the binary path to gi-compile-repository similar to how
glib-compile-resources is exposed so meson and other external
tools can locate it.
2024-12-10 17:58:41 +00:00
Philip Withnall
2442b370b4
gdbusconnection: Document existing refcount semantics of closures
As per the previous few commits, explicitly document the established
reference counting semantics of the method call closure for
`g_dbus_connection_register_object_with_closures()`.

This isn’t ideal, but
`g_dbus_connection_register_object_with_closures()` has had these
semantics for 10 years now, and it’s a bit late to change them to
something neater.

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

Helps: #3559
2024-12-10 16:59:33 +00:00
Philip Withnall
25cbde1e16
gdbusconnection: Add a comment explaining why an invocation is ‘leaked’
It’s not leaked, it’s transferred forwards to the eventual
`g_dbus_method_invocation_return_*()` call.

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

Helps: #3559
2024-12-10 15:59:04 +00:00
Philip Withnall
4641535596
Revert "gdbus: Fix leak of method invocation when registering an object with closures"
This reverts commit 092fedd5f0.

This was not the right change to make, and I shouldn’t have accepted the
MR. The situation is laid out in this comment:
https://gitlab.gnome.org/GNOME/glib/-/issues/2600#note_1385050

tl;dr: The reference on the `GDBusMethodInvocation` which is transferred
in to the `GDBusInterfaceMethodCallFunc` is balanced by a reference
transferred to `g_dbus_method_invocation_return_*()`. This is how the
refcounting has always worked for these functions, and even if we’d
probably arrange things differently if the code was written now, we
can’t change those semantics without breaking API.

In particular, bindings have various bits of custom code to account for
these reference tranfers (since they can’t be represented using
gobject-introspection annotations), so changing the semantics will break
bindings.

Fixes: #3559
2024-12-10 15:53:54 +00:00
Michael Catanzaro
a5f68ba494 Merge branch '3538-dbus-appinfo-hurd' into 'main'
tests: Skip unsupported dbus-appinfo test on GNU/Hurd for the moment

See merge request GNOME/glib!4425
2024-12-10 14:24:52 +00:00
Philip Withnall
8c3fda5c8d
tests: Skip unsupported dbus-appinfo test on GNU/Hurd for the moment
Parts of the `dbus-appinfo` test need support for converting an FD to a
path, and Hurd doesn’t currently allow that (see
https://gitlab.gnome.org/GNOME/glib/-/merge_requests/4396#note_2279923).

Since there’s no fix for that visible in the medium term (new kernel
APIs will need to be added), skip parts of the `dbus-appinfo` test which
require that functionality for now.

This prevents the whole test from failing, and means we can usefully get
results from the parts of it which don’t depend on converting FDs to
paths.

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

Helps: #3538
2024-12-10 11:47:43 +00:00
Michael Catanzaro
7705bbe8fc Merge branch 'ci-quoting' into 'main'
ci: Ensure all variables are quoted in .gitlab-ci.yml

See merge request GNOME/glib!4424
2024-12-09 14:33:55 +00:00
Michael Catanzaro
c5f9eb51a2 Merge branch 'gio-tool-mount-docs' into 'main'
gio-tool: Clarify that `gio mount -l` only lists user-interesting things

See merge request GNOME/glib!4423
2024-12-09 14:32:21 +00:00
Philip Withnall
eecacf7053 Merge branch 'document-constructed' into 'main'
gparam: Add link to constructed vfunc to CONSTRUCT

See merge request GNOME/glib!4421
2024-12-09 11:12:12 +00:00
Philip Withnall
628d623b57
ci: Ensure all variables are quoted in .gitlab-ci.yml
Don’t want any argument escaping problems, given that some of these
variables can be controlled by unprivileged users who are running CI
jobs.

The except:variables and rules:if lines don’t need to be quoted because
they are [GitLab CI/CD Variable
Expressions](https://docs.gitlab.com/ee/ci/jobs/job_rules.html#cicd-variable-expressions)
rather than bash script.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-12-08 23:57:34 +00:00
Philip Withnall
f5941d3284 Merge branch 'bugfix/gsettings-schema-has-key' into 'main'
Fix g_settings_schema_has_key() to work with extended schemas

Closes #3548

See merge request GNOME/glib!4420
2024-12-08 23:09:13 +00:00
Philip Withnall
fa33e232d2
gio-tool: Clarify that gio mount -l only lists user-interesting things
It doesn’t list all mounts, only the ones you’d expect to see in a file
chooser sidebar.

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

Helps: #3555
2024-12-08 23:03:07 +00:00
Martin Domig
70fe6839a5 Fix typo in test_extended_schema
Signed-off-by: Martin Domig <martin.domig@wolfvision.net>
2024-12-08 22:15:03 +01:00
Martin Domig
d63d27b195 Add test for g_settings_schema_has_key on extended schema
The test checks that the keys of the base schema do all exist in the
extended schema.

Signed-off-by: Martin Domig <martin.domig@wolfvision.net>
2024-12-08 22:13:51 +01:00
Michael Catanzaro
1bd1c912d3 Merge branch 'fix-link-contributing' into 'main'
docs: Fix dead link in CONTRIBUTING

See merge request GNOME/glib!4422
2024-12-07 14:01:24 +00:00
Rebecca N. Palmer
2ae3dc6b8c docs: Fix dead link in CONTRIBUTING 2024-12-07 10:54:25 +00:00
Maximiliano Sandoval
c1fcc7be49
gparam: Add link to constructed vfunc to CONSTRUCT
The docs for the constructed vfunc make it clear that when called
constructed properties are already set. However, the first place where a
user would look for is the flag's documentation.
2024-12-06 18:07:47 +01:00
Johannes Marte
58f9667def GSettingsSchema: fix g_settings_schema_has_key()
A settings schema that extends another schema should return TRUE for
all keys that are present in the extended schema. The list of keys
returned by list_keys() already includes these,
so it makes sense to include them in has_key().

Signed-off-by: Johannes Marte <johannes.marte@wolfvision.net>
2024-12-06 08:06:18 +01:00
Philip Withnall
f06352f841 Merge branch 'fix-3552' into 'main'
gmessages: Add nullable annotation for `log_domain` in `GLogFunc`

Closes #3552

See merge request GNOME/glib!4419
2024-12-05 18:24:04 +00:00
Roberto Leinardi
78b4b66e9a
gmessages: Clarify log_domain behavior in function descriptions
Move details about the `log_domain` parameter being `NULL` or an empty string
for the default application domain from argument descriptions to the main
function descriptions.

This ensures concise argument descriptions while providing a clear
explanation of exceptions in the function body.
2024-12-05 17:19:27 +01:00
Roberto Leinardi
1691657cb3
gmessages: Add nullable annotation for log_domain in GLogFunc
Add a missing `(nullable)` annotation for the `log_domain` parameter in the
`GLogFunc` callback. This ensures consistency with the documentation and
usage in functions like `g_log_set_handler`, where `log_domain` can be `NULL`.

Without this annotation, the GIR file generated from the C source does not
reflect the nullability of `log_domain`, leading to potential issues in
language bindings and other introspection-based tools.

This change updates the documentation in `glib/gmessages.c` to include the
nullable annotation and clarifies the expected behavior of the `GLogFunc`
callback.

Fixes #3552
2024-12-05 17:19:19 +01:00
Philip Withnall
b6da230b8f Merge branch 'find_signal_avoid_alloc' into 'main'
girepository: gi_object_info_find_signal(): Avoid repeated allocations

See merge request GNOME/glib!4382
2024-12-05 10:47:57 +00:00