Introduce katze_item_get_meta_boolean convenience

This commit is contained in:
Christian Dywan 2010-07-01 20:42:42 +02:00
parent fb634e19b9
commit 6822969aac
2 changed files with 30 additions and 0 deletions

View file

@ -595,6 +595,32 @@ katze_item_get_meta_integer (KatzeItem* item,
return -1; return -1;
} }
/**
* katze_item_get_meta_boolean:
* @item: a #KatzeItem
* @key: the name of a boolean value
*
* The Value should be set with katze_item_set_meta_integer().
* If the value is set and not 0, %TRUE will be returned.
*
* Since: 0.2.7
**/
gboolean
katze_item_get_meta_boolean (KatzeItem* item,
const gchar* key)
{
const gchar* value;
g_return_val_if_fail (KATZE_IS_ITEM (item), FALSE);
g_return_val_if_fail (key != NULL, FALSE);
value = katze_item_get_meta_string (item, key);
if (value == NULL || value[0] == '0')
return FALSE;
else
return TRUE;
}
/** /**
* katze_item_set_meta_integer: * katze_item_set_meta_integer:
* @item: a #KatzeItem * @item: a #KatzeItem

View file

@ -118,6 +118,10 @@ gint64
katze_item_get_meta_integer (KatzeItem* item, katze_item_get_meta_integer (KatzeItem* item,
const gchar* key); const gchar* key);
gboolean
katze_item_get_meta_boolean (KatzeItem* item,
const gchar* key);
void void
katze_item_set_meta_integer (KatzeItem* item, katze_item_set_meta_integer (KatzeItem* item,
const gchar* key, const gchar* key,