Commit Graph

13 Commits

Author SHA1 Message Date
Philip Chimento
3a01629955 girepository: Fix copy-paste error in type check macro
GI_IS_REGISTERED_TYPE_INFO() wasn't working because it was actually
defined to be the same as GI_IS_OBJECT_INFO().

Add some desultory type-checking assertions to the repository tests.
2024-02-04 10:16:31 -08: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
Marco Trevisan (Treviño)
8891429a5b girepository: Use char instead of glib-specific gchar 2024-01-16 18:40:42 +01:00
Philip Withnall
8c9a17ef93 giregisteredtypeinfo: 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
693f11cd42 girepository: Rename get_type_init() methods to get_type_init_function_name()
Because they return the function name, not a `GIFunctionInfo` for the
function, or anything else.

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
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