Commit Graph

24 Commits

Author SHA1 Message Date
Philip Withnall
343027d5de girepository: Make GIInfoType private
Eventually, we want to move to using `GType` directly for everything,
since `GIBaseInfo` and its subclasses are all using `GTypeInstance`.

However, that requires quite a lot of changes and we’re about to hit the
API freeze.

So do the smallest set of changes possible to remove `GIInfoType` and
related functions from the public API, which gives us freedom to make
more changes later without breaking API.

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

Helps: #3155
2024-02-08 12:56:02 +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
fe6f9a661b gitypeinfo: Change gi_type_info_get_array_length_index() to return uint
Rather than mixing `-1` and valid indexes, split out the indication of
whether the type is an array with a length argument from the actual
index of the length argument.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
Helps: #3155
2024-01-16 23:26:02 +00:00
Philip Withnall
6a7806da4d gitypeinfo: Change gi_type_info_get_array_fixed_size() to return size_t
Return information about whether the type is a fixed-size array
separately from the array size, which allows us to use the full `size_t`
for the array size.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
Helps: #3155
2024-01-16 23:13:01 +00:00
Marco Trevisan (Treviño)
de8ac339fb gitypeinfo: Use gssize to return the array length index
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
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)
eda4bfcf95 girrepository: Use void* instead of gpointer 2024-01-16 18:40:37 +01:00
Philip Withnall
299315007f gitypeinfo: Rename get_array_length() to get_array_length_index()
It returns the index of the array length argument, not the length
itself.

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

Helps: #3155
2023-12-12 18:55:41 +00:00
Philip Withnall
23d9a79c62 gitypeinfo: 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
6876f21aee girepository: Update docs for GITypeInfo 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:27 +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
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
ab3454a515 girepository: Remove duplicate macro definitions
Not sure what was going on there.

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
Philip Withnall
f4db8af9de gitypeinfo: Remove deprecated API
It’s not needed after a major version bump.

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