Commit Graph

66 Commits

Author SHA1 Message Date
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
4ccbc1b9d7 girepository: Rename gi_base_info_gtype_get_type() to just get_type()
This makes it more conventional for how `GType` code is normally written.

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:27 +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
95693f78fc girepository: Fix a minor string leak
Caught by the new unit tests.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2023-12-12 16:58:27 +00:00
Philip Withnall
e699037fef girepository: Add a couple of very simple unit tests
For the moment, this is enough to roughly verify that the port to
`GTypeInstance` has not massively broken things. It’s not anywhere near
sufficient to qualify as a proper test suite though.

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

Helps: #3155
2023-12-12 16:58:27 +00:00
Philip Withnall
76a70381d4 girepository: Rename meson variables for consistency
If they’re all named after the actual library name, rather than a
contraction of it, that’s easier to remember so they can be easily
referenced elsewhere in the build system (such as when adding unit
tests).

This introduces no functional changes.

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

Helps: #3155
2023-12-12 16:58:04 +00:00
Philip Withnall
0d9b674784 girepository: Add a gi_repository_new() function
It’s not intended that most people will use this, but it’s going to be
quite useful for adding unit tests — we don’t really want the unit tests
to share global state (a singleton `GIRepository`) between tests.

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

Helps: #3155
2023-12-12 16:58:04 +00:00
Philip Withnall
f5d13c9cf8 gifieldinfo: Port from gtk-doc to gi-docgen
Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2023-12-12 16:58:04 +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
cdb5ab0cd2 gicallableinfo: Fix type of method self argument
This is an API break, but that’s fine since we haven’t frozen the
libgirepository API yet.

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

Helps: #3155
2023-12-12 16:58:04 +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
aa50e6fd9d girepository: Use gi_base_info_get_type() instead of field access
The `type` field will eventually disappear, so use an accessor method to
get it.

This introduces no functional changes.

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

Helps: #3155
2023-12-12 16:58:04 +00:00
Philip Withnall
b5dedf88cb gibaseinfo: Add a missing (transfer full) annotation
Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2023-12-12 16:58:04 +00:00
Philip Withnall
20fea9515d girepository: Add various missing casts
These aren’t needed at the moment, since all the `TypeInfo` structs in
libgirepository are all aliases for each other.

An upcoming commit will change that, however, so we need to be a little
bit stricter about type safety in advance.

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
a16be963b4 gitypeinfo: Add missing introspection annotations in GITypeInfo
Signed-off-by: Philip Withnall <pwithnall@gnome.org>

Helps: #3155
2023-12-12 16:58:04 +00:00
Philip Withnall
392833b67f gitypes: Remove obsolete non-fixed-width types
These can safely be removed now we’ve bumped the major library version.

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

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

Helps: #3155
2023-12-12 16:58:04 +00:00
Philip Withnall
2d2263fa4f girepository: Update docs for GITypelib 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
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
ca9291a87d givfuncinfo: Add missing precondition checks
Signed-off-by: Philip Withnall <pwithnall@gnome.org>

Helps: #3155
2023-12-12 16:58:04 +00:00
Philip Withnall
7d90780bbb givfuncinfo: Fix crash in GIVFuncInfo if a GError isn’t passed
Signed-off-by: Philip Withnall <pwithnall@gnome.org>

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

Helps: #3155
2023-12-12 16:58:04 +00:00
Philip Withnall
458cc700ce girepository: Update docs for GIVFuncInfo 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
bd803f8a11 girepository: Add missing #include to gitypes.h
Otherwise the GIR generation for libgirepository doesn’t work, as GLib
doesn’t get pulled in to provide basic types.

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
Emmanuele Bassi
cf28391d5b gir: Build introspection data for libgirepository
We currently add the GI and gi prefixes, but outside of visibility
macros we should move every identifier to the G namespace.
2023-12-12 16:58:04 +00:00
Philip Withnall
2a7ff62417 tests: Improve build of cmph tests in girepository
They were still failing with `-Dglib_assert=false` because
`G_DISABLE_ASSERT` wasn’t being explicitly un-defined for the test.

See https://gitlab.gnome.org/GNOME/glib/-/jobs/3309889

Also while we’re there, take the opportunity to correctly set the test
suite, protocol and environment.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2023-11-21 14:21:07 +00:00
Philip Withnall
00f836b11a Merge branch 'leak-fixes' into 'main'
Fix various leaks in cmph-bdz-test and gutils

See merge request GNOME/glib!3708
2023-11-14 13:59:58 +00:00
Philip Withnall
aed9098530 girepository: Fix various leaks in cmph-bdz-test
See https://gitlab.gnome.org/GNOME/glib/-/jobs/3294034

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2023-11-14 11:00:01 +00:00
Philip Withnall
d00bbf94a6 girepository: Ignore set-but-not-used warnings with G_DISABLE_ASSERT
This fixes some compiler warnings when building with
`-Dglib_assert=false`.

See https://gitlab.gnome.org/GNOME/glib/-/jobs/3294022

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2023-11-14 10:37:27 +00:00
Philip Withnall
24776cb5bd tests: Use g_assert_*() rather than g_assert() in girepository tests
It won’t get compiled out with `G_DISABLE_ASSERT`.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2023-11-14 10:36:06 +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
7b029e564d girepository: Remove redundant GLib version checks
Now that libgirepository is inside glib.git, it’s guaranteed access to
all the latest APIs, so there’s no need for version checks.

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

Helps: #3155
2023-11-08 15:06:21 +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
Philip Withnall
9c10f3ec02 girepository: Remove backwards compatibility symbol renames
After bumping the major version number, we don’t need backwards
compatibility any more.

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

Helps: #3155
2023-11-08 12:52:23 +00:00
Emmanuele Bassi
ebb0346380 gir: Do not include builtin directories in pkgconfig.generate()
It's deprecated since Meson 0.62, and breaks the build with fatal
warnings enabled for Meson.
2023-11-08 12:04:12 +00:00
Emmanuele Bassi
db5c42fad0 gir: Rename gir_writer_write()
Use g_ir_writer_write(), as a dual of g_ir_parser_parse_*().

Also, don't abuse C++ reserved keywords for argument names.
2023-11-08 00:23:35 +00:00
Emmanuele Bassi
9a6c518d31 gir: Rename girwriter.h to girwriter-private.h
It's a private header.
2023-11-08 00:16:58 +00:00
Emmanuele Bassi
b0f4a6bcc4 gir: Rename girnode.h to girnode-private.h
It's a private header.
2023-11-08 00:09:04 +00:00
Emmanuele Bassi
f9580e90c4 gir: Rename girparser.h to girparser-private.h
It's a private header.
2023-11-08 00:07:11 +00:00
Emmanuele Bassi
48984375dc gir: Rename girmodule.h to girmodule-private.h
It's private header.
2023-11-08 00:06:01 +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
ba24fc659d Remove deprecated API
There's no point in releasing a new library with deprecated API.
2023-11-07 23:57:18 +00:00
Emmanuele Bassi
b3dfaf5e97 gir: Use pragma once for the inclusion guard 2023-11-07 18:23:17 +00:00
Philip Withnall
75800b6b09 girepository: Ensure config.h is included first in gdump.c
Follow on from the previous commit.

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

Helps: #3155
2023-10-25 19:33:29 +01:00
Philip Withnall
371ddd62e5 girepository: Move an include to avoid _WIN32_WINNT being redefined
This fixes a warning on msys2-mingw32:
https://gitlab.gnome.org/GNOME/glib/-/jobs/3227892.

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

Helps: #3155
2023-10-25 19:16:58 +01:00