Commit Graph

16 Commits

Author SHA1 Message Date
Philip Withnall
c8132fdf78 girepository: Rename gi_arg_info_load_type() to gi_arg_info_load_type_info()
So that it matches `gi_arg_info_get_type_info()`. We can’t use
`gi_arg_info_get_type()` because that collides with the `GType` getter
for the type.

Spotted by Philip Chimento.

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

Fixes: #3243
2024-02-05 15:13:46 +00:00
Philip Withnall
57d64b111f girepository: Add type-checking cast macros
These follow GObject conventions, using `G_TYPE_CHECK_INSTANCE_CAST` to
cast to the given type, and potentially performing some runtime checks
of the type instance’s `GType` too.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
Fixes: #3216
2024-01-18 13:15:22 +00:00
Philip Withnall
5423bf4df7 girepository: Rework IS_(type) macros to use G_TYPE_CHECK_INSTANCE_TYPE
This means they’re now using the `GType` type system rather than the old
`GIInfoType` type system. Given the preceding few commits, these two
systems should now be equivalent.

This makes the type handling more conventional and hence a bit simpler
for people to use if they have experience with GObject.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
Helps: #3216
2024-01-18 13:15:22 +00:00
Philip Withnall
8e3d98fc98 girepository: Add get_type() wrapper macros
This makes `GIBaseInfo` and derived types more consistent with GObject
convention, and thus a bit more comfortable to use.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
Helps: #3216
2024-01-18 13:15:22 +00:00
Philip Withnall
9fcec66115 giarginfo: Return indexes as uints
As with previous commits, don’t use up half the return value space to
indicate an invalid index.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
Helps: #3155
2024-01-17 10:36:45 +00:00
Marco Trevisan (Treviño)
a3d29b6437 giarginfo: Use gssize to return the closure and destroy indexes
Use a bigger integer value, even though int is more than enough, but
to make it clearer that we're returning a size-related value.
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
Philip Withnall
54eae78597 giarginfo: 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:15 +00:00
Philip Withnall
5fa28d1b7e girepository: Rename GIArgInfo methods to be clearer
Indicate that they return an argument index, not the argument itself.

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

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

Helps: #3155
2023-12-12 18:55:41 +00:00
Philip Withnall
64ad0ecebc girepository: Rename gi_base_info_get_type() to get_info_type()
This method doesn’t return a `GType`, so when the code gets ported to
`GTypeInstance` in an upcoming commit, that will become quite confusing.

Rename it to `gi_base_info_get_info_type()` instead.

This introduces no functional changes, but it is an API break.

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

Helps: #3155
2023-12-12 16:58:04 +00:00
Philip Withnall
9eabdd7c2e girepository: Rename get_type() methods to get_type_info()
These methods don’t return a `GType`, so when the code gets ported to
`GTypeInstance` in an upcoming commit, that will become quite confusing.

Rename them all to `get_type_info()` instead.

This introduces no functional changes, but it is an API break.

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

Helps: #3155
2023-12-12 16:58:04 +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
Emmanuele Bassi
b3dfaf5e97 gir: Use pragma once for the inclusion guard 2023-11-07 18:23:17 +00: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