Commit Graph

22 Commits

Author SHA1 Message Date
Philip Withnall
86cd95f1ae Merge branch 'gi-info-new' into 'main'
gibaseinfo: Rename gi_info_new() to gi_base_info_new()

See merge request GNOME/glib!3903
2024-02-08 10:34:40 +00:00
Philip Withnall
beb59595b7 gibaseinfo: Rename gi_info_new() to gi_base_info_new()
It’s actually a factory method rather than a constructor, since
`GIBaseInfo` is abstract, but despite that, changing the name so it sits
inside the `GIBaseInfo` class makes sense. There is no `GIInfo` type.

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

Helps: #3155
2024-02-08 10:34:40 +00:00
Philip Withnall
e286497c1f giunioninfo: Mark get_discriminator_type() as nullable
It may (and should) return `NULL` if called on a union which isn’t
discriminated.

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

Helps: #3155
2024-02-06 13:35:23 +00:00
Philip Withnall
11e8075e51 giunioninfo: Split success and return value for get_discriminator_offset()
Otherwise there’s no obvious suitable return value to return when the
union is *not* discriminated.

This is an API break, but libgirepository has not been in a stable
release yet, so that’s fine.

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

Helps: #3155
2024-02-06 13:34:17 +00:00
Marco Trevisan (Treviño)
157f93d2ee girepository: Use size_t for size-related arguments and return types
We used to use unsigned values, while they should be big enough to old
the data we're handling here, it's cleaner and clearer if we use size_t
as type for such values, as it makes straight forward to understand what
a value should contain. It also makes these values more future proof.
2024-01-16 18:40:42 +01:00
Marco Trevisan (Treviño)
bc2e4b3de5 girrepository: Replace usage of gsize with standard size_t
We just do a safe s/gsize/size_t/ replacement here without doing any
changes to places in which different size of size_t and gsize may be
actually different and create troubles.
2024-01-16 18:40:42 +01:00
Marco Trevisan (Treviño)
9f33015a25 girrepository: Use standard int sized types instead of g[u]int* 2024-01-16 18:40:42 +01:00
Marco Trevisan (Treviño)
8891429a5b girepository: Use char instead of glib-specific gchar 2024-01-16 18:40:42 +01:00
Marco Trevisan (Treviño)
91fc45ea57 girepository: Replace tabs with spaces in indentation
We don't use tabs anywhere and the mixed setup just makes many editors
to cry. So let's just replace the tabs with 8 spaces.
2024-01-16 17:30:37 +01:00
Philip Withnall
2684155ee9 giunioninfo: Port documentation to gi-docgen and update
Review and update the documentation, making sure it’s complete,
formatted in gi-docgen format, and has all appropriate GIR annotations
and `Since:` lines.

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

Helps: #3155
2023-12-18 14:14:16 +00:00
Philip Withnall
83c41fe09e giunioninfo: Rename get_*_function() methods to get_*_function_name()
Because they return the function name, not a `GIFunctionInfo` or
anything else.

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

Helps: #3155
2023-12-12 18:55:41 +00:00
Philip Withnall
b10b5a2fe6 giunioninfo: Fix int signedness in APIs
Signed-off-by: Philip Withnall <pwithnall@gnome.org>

Helps: #3155
2023-12-12 18:55:41 +00:00
Philip Withnall
52ac467426 girepository: Port GIBaseInfo to GTypeInstance
This adds more type safety to libgirepository, and allows
differentiating the `GIBaseInfo` derived types using the type system.

Two new derived types had to be added (previously they were just a
collection of helper methods which worked directly on a `GIBaseInfo` and
didn’t check types): `GICallbackInfo` and `GIUnresolvedInfo`.

Further cleanups and refactoring might be needed on this, but the core
of libgirepository now uses `GTypeInstance` and appears to still work
(it’s difficult to be entirely sure because there are no unit tests
yet).

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

Helps: #3155
2023-12-12 16:58:04 +00:00
Philip Withnall
85bed115d8 giunioninfo: Add missing introspection annotations in GIUnionInfo
Signed-off-by: Philip Withnall <pwithnall@gnome.org>

Helps: #3155
2023-12-12 16:58:04 +00:00
Philip Withnall
5e0c402f38 girepository: Update docs for GIUnionInfo for gi-docgen
Move the SECTION into the struct docs, update the documentation comment
syntax, and add `Since: 2.80` everywhere.

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

Helps: #3155
2023-12-12 16:58:04 +00:00
Philip Withnall
c42e63c637 girepository: Update existing Since tags to 2.80
Since the APIs are new to libgirepository-2.0 in version 2.80.

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

Helps: #3155
2023-12-12 16:58:04 +00:00
Philip Withnall
2b544c3f66 girepository: Remove _ prefix from private functions
Now that libgirepository uses `GI_AVAILABLE_IN_*` macros, that’s what
controls symbol visibility. The `_` prefixes are redundant, and out of
keeping with the rest of GLib.

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

Helps: #3155
2023-11-08 15:23:31 +00:00
Philip Withnall
b32da06a7c girepository: Rename symbols to the GI namespace
Rather than a mix of structs being in `GI` and their methods being in
`g_`.

We’ve chosen not to use the `g_` namespace because a number of the
libgirepository class names are quite generic, so we’d end up with
confusing symbols like `GScopeType` and `GArgument`.

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

Helps: #3155
2023-11-08 15:05:20 +00:00
Philip Withnall
5f012e9f12 girepository: Add missing includes of corresponding headers
Make sure that each C file in `girepository/` includes its corresponding
header file (if such a file exists).

This ensures that the first declaration the compiler sees for each
function contains the symbol visibility macros. This fixes symbol export
(`dllexport`) on Windows platforms.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3155
2023-10-25 18:11:38 +01:00
Philip Withnall
a27a75b219 girepository: Use subdir paths in #includes
The pkg-config file sets the include directory to the level above
`girepository/`, just like with GIO, GObject and GModule.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3155
2023-10-25 17:45:42 +01:00
Philip Withnall
844544f72c girepository: Add SPDX license header to all obvious files
Add the SPDX license runes to all the files which have an obvious
copyright header already. This is a mechanical edit.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3155
2023-10-25 17:10:10 +01:00
Emmanuele Bassi
03d6c16434 Move girepository 2023-10-15 17:56:05 +01:00