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:
Dan Winship
2011-05-19 16:12:03 -04:00
parent 2c0d884330
commit f9ebb4e99d
16 changed files with 17 additions and 493 deletions

View File

@@ -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;
}