mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-09-06 07:58:44 +02:00
Add g_file_info_has_namespace
Need this to quickly see if we should set attributes from this GFileInfo in metadata extension.
This commit is contained in:
@@ -484,6 +484,42 @@ g_file_info_has_attribute (GFileInfo *info,
|
||||
return value != NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* g_file_info_has_namespace:
|
||||
* @info: a #GFileInfo.
|
||||
* @name_space: a file attribute namespace.
|
||||
*
|
||||
* Checks if a file info structure has an attribute in the
|
||||
* specified @name_space.
|
||||
*
|
||||
* Returns: %TRUE if @Ginfo has an attribute in @name_space,
|
||||
* %FALSE otherwise.
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
gboolean
|
||||
g_file_info_has_namespace (GFileInfo *info,
|
||||
const char *name_space)
|
||||
{
|
||||
GFileAttribute *attrs;
|
||||
guint32 ns_id;
|
||||
int i;
|
||||
|
||||
g_return_val_if_fail (G_IS_FILE_INFO (info), FALSE);
|
||||
g_return_val_if_fail (name_space != NULL, FALSE);
|
||||
|
||||
ns_id = lookup_namespace (name_space);
|
||||
|
||||
attrs = (GFileAttribute *)info->attributes->data;
|
||||
for (i = 0; i < info->attributes->len; i++)
|
||||
{
|
||||
if (GET_NS (attrs[i].attribute) == ns_id)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* g_file_info_list_attributes:
|
||||
* @info: a #GFileInfo.
|
||||
|
Reference in New Issue
Block a user