gobject: Add G_TYPE_FLAG_DEPRECATED

This can be used to mark entire types as deprecated,
and trigger a warning when they are instantiated
and `G_ENABLE_DIAGNOSTIC=1` is set in the environment.

There's currently no convenient macros for defining
types with the new flag, but you can do:

```c
_G_DEFINE_TYPE_EXTENDED_BEGIN (GtkAppChooserWidget,
                               gtk_app_chooser_widget,
                               GTK_TYPE_WIDGET,
                               G_TYPE_FLAG_DEPRECATED)
...
_G_DEFINE_TYPE_EXTENDED_END ()
```

Includes a unit test by Philip Withnall.
This commit is contained in:
Matthias Clasen
2022-10-20 20:04:01 -04:00
committed by Philip Withnall
parent abdb81efa2
commit fd0dd9e93c
4 changed files with 126 additions and 3 deletions

View File

@@ -18,6 +18,7 @@ G_TYPE_IS_DERIVABLE
G_TYPE_IS_DEEP_DERIVABLE
G_TYPE_IS_INTERFACE
G_TYPE_IS_FINAL
G_TYPE_IS_DEPRECATED
GTypeInterface
GTypeInstance
GTypeClass