Commit Graph

19 Commits

Author SHA1 Message Date
Philip Withnall
7acef299c2 girepository: Fix declaration of ‘find using interfaces’ methods
Fix the declaration and documentation of
`gi_object_info_find_method_using_interfaces()` and
`gi_object_info_find_vfunc_using_interfaces()`. The documentation was
wrong when I wrote it: the value returned is the object or interface
which declares the method or vfunc, not the one which implements it.

The returned declarer info may be a `GIObjectInfo` or a
`GIInterfaceInfo`. Since those two types have no subtype relation
between them, the return type has to be changed to `GIBaseInfo`. Using
`GIObjectInfo` would have been fine in girepository-1.0 because all
`*Info` types were aliases of each other — but since the move to
`GTypeInstance` this is no longer true.

A unit test will be in the following commit.

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

Fixes: #3246
2024-02-05 18:40:03 +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
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
5422788455 giobjectinfo: 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
15660b49b5 giobjectinfo: 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
030f4f003c giobjectinfo: 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
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
51f518e749 Replace GI_AVAILABLE_IN_2_* with GI_AVAILABLE_IN_ALL
This is the first release of GIRepository 2.0.
2023-11-08 00:02:12 +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
af36393e60 Build libgirepository as a GLib sub-library
The introspection API has lived out of tree far too long. It has the
same ABI guarantees as the rest of GLib, so it has no reason to be split
from the main library.

The gobject-introspection project can depend on libgirepository, and the
language bindings can drop the gobject-introspection-1.0 dependency.
2023-10-16 15:24:08 +01:00
Emmanuele Bassi
03d6c16434 Move girepository 2023-10-15 17:56:05 +01:00