Add gvdb_table_is_valid() API

Checks that the on-disk file is still valid.
This commit is contained in:
Ryan Lortie 2010-07-18 20:45:37 -04:00
parent afea703422
commit df40747190
2 changed files with 20 additions and 0 deletions

View File

@ -534,6 +534,23 @@ gvdb_table_unref (GvdbTable *file)
}
}
/**
* gvdb_table_is_valid:
* @table: a #GvdbTable
* @returns: %TRUE if @table is still valid
*
* Checks if the table is still valid.
*
* An on-disk GVDB can be marked as invalid. This happens when the file
* has been replaced. The appropriate action is typically to reopen the
* file.
**/
gboolean
gvdb_table_is_valid (GvdbTable *table)
{
return !!table->data;
}
void
gvdb_table_walk (GvdbTable *table,
const gchar *key,

View File

@ -49,6 +49,9 @@ G_GNUC_INTERNAL
gboolean gvdb_table_has_value (GvdbTable *table,
const gchar *key);
G_GNUC_INTERNAL
gboolean gvdb_table_is_valid (GvdbTable *table);
typedef void (*GvdbWalkValueFunc) (const gchar *name,
gsize name_len,
GVariant *value,