mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-30 04:44:16 +02:00
Deprecate ErrorDomain
The previous ErrorDomain blob was never actually scanned or used, and it was kind of a lame API conceptually. To keep some compatibility, rather than removing the enumeration values, rename them to _INVALID, and don't bump the typelib version. This should in theory allow a new libgirepository to read an old typelib. Based on a patch from Colin Walters https://bugzilla.gnome.org/show_bug.cgi?id=602516
This commit is contained in:
69
gitypeinfo.c
69
gitypeinfo.c
@@ -340,72 +340,3 @@ g_type_info_get_array_type (GITypeInfo *info)
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* g_type_info_get_n_error_domains:
|
||||
* @info: a #GITypeInfo
|
||||
*
|
||||
* Obtain the number of error domains for this type. The type tag
|
||||
* must be a #GI_TYPE_TAG_ERROR or -1 will be returned.
|
||||
*
|
||||
* Returns: number of error domains or -1
|
||||
*/
|
||||
gint
|
||||
g_type_info_get_n_error_domains (GITypeInfo *info)
|
||||
{
|
||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||
SimpleTypeBlob *type;
|
||||
|
||||
g_return_val_if_fail (info != NULL, 0);
|
||||
g_return_val_if_fail (GI_IS_TYPE_INFO (info), 0);
|
||||
|
||||
type = (SimpleTypeBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||
|
||||
if (!(type->flags.reserved == 0 && type->flags.reserved2 == 0))
|
||||
{
|
||||
ErrorTypeBlob *blob = (ErrorTypeBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||
|
||||
if (blob->tag == GI_TYPE_TAG_ERROR)
|
||||
return blob->n_domains;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* g_type_info_get_error_domain:
|
||||
* @info: a #GITypeInfo
|
||||
* @n: index of error domain
|
||||
*
|
||||
* Obtain the error domains at index @n for this type. The type tag
|
||||
* must be a #GI_TYPE_TAG_ERROR or -1 will be returned.
|
||||
*
|
||||
* Returns: (transfer full): the error domain or %NULL if type tag is wrong,
|
||||
* free the struct with g_base_info_unref() when done.
|
||||
*/
|
||||
GIErrorDomainInfo *
|
||||
g_type_info_get_error_domain (GITypeInfo *info,
|
||||
gint n)
|
||||
{
|
||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||
SimpleTypeBlob *type;
|
||||
|
||||
g_return_val_if_fail (info != NULL, NULL);
|
||||
g_return_val_if_fail (GI_IS_TYPE_INFO (info), NULL);
|
||||
|
||||
type = (SimpleTypeBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||
|
||||
if (!(type->flags.reserved == 0 && type->flags.reserved2 == 0))
|
||||
{
|
||||
ErrorTypeBlob *blob = (ErrorTypeBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||
|
||||
if (blob->tag == GI_TYPE_TAG_ERROR)
|
||||
return (GIErrorDomainInfo *) _g_info_from_entry (rinfo->repository,
|
||||
rinfo->typelib,
|
||||
blob->domains[n]);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user