Top | ![]() |
![]() |
![]() |
![]() |
A TeplFileMetadata object stores the metadata of a TeplFile. You need to
call tepl_metadata_manager_init()
and tepl_metadata_manager_shutdown()
in
your application, in case GVfs metadata are not supported.
The tepl_file_metadata_get()
and tepl_file_metadata_set()
functions don't
load or save the metadata on disk. They only access the metadata stored in
the TeplFileMetadata object memory. To load the metadata from disk, call
tepl_file_metadata_load()
or its async variant. Likewise, to save the
metadata on disk, call tepl_file_metadata_save()
or its async variant. When
loading or saving metadata, the file at “location”, if non-NULL
,
must exist on the filesystem, otherwise an error is returned.
When the “location” changes, the metadata are still kept in the TeplFileMetadata object memory. But the metadata are not automatically saved for the new location.
TeplFile *
tepl_file_metadata_get_file (TeplFileMetadata *metadata
);
Since: 1.0
gchar * tepl_file_metadata_get (TeplFileMetadata *metadata
,const gchar *key
);
Gets the value of a metadata stored in the metadata
object memory.
the value of the metadata, or NULL
if the metadata
doesn't exist. Free with g_free()
.
[nullable]
Since: 1.0
void tepl_file_metadata_set (TeplFileMetadata *metadata
,const gchar *key
,const gchar *value
);
Sets the value of a metadata. It's preferable that key
starts with a
namespace, to not get metadata conflicts between applications.
This function just stores the new metadata value in the metadata
object
memory.
metadata |
||
key |
the name of the metadata. |
|
value |
the value of the metadata, or |
[nullable] |
Since: 1.0
gboolean tepl_file_metadata_load (TeplFileMetadata *metadata
,GCancellable *cancellable
,GError **error
);
Loads synchronously the metadata from “location”. The loaded
metadata values can then be accessed with tepl_file_metadata_get()
.
If the metadata are loaded successfully, this function deletes all previous
metadata stored in the metadata
object memory.
The file at “location”, if non-NULL
, must exist on the
filesystem, otherwise an error is returned.
If “location” is NULL
, FALSE
is simply returned.
Since: 1.0
void tepl_file_metadata_load_async (TeplFileMetadata *metadata
,gint io_priority
,GCancellable *cancellable
,GAsyncReadyCallback callback
,gpointer user_data
);
The asynchronous version of tepl_file_metadata_load()
.
If the metadata is loaded from the metadata manager (i.e. not with GVfs), this function loads the metadata synchronously. A future version might fix this.
See the GAsyncResult documentation to know how to use this function.
metadata |
||
io_priority |
the I/O priority of the request. E.g. |
|
cancellable |
optional GCancellable object, |
[nullable] |
callback |
a GAsyncReadyCallback to call when the request is satisfied. |
[scope async] |
user_data |
user data to pass to |
Since: 1.0
gboolean tepl_file_metadata_load_finish (TeplFileMetadata *metadata
,GAsyncResult *result
,GError **error
);
Finishes the metadata loading started with tepl_file_metadata_load_async()
.
Since: 1.0
gboolean tepl_file_metadata_save (TeplFileMetadata *metadata
,GCancellable *cancellable
,GError **error
);
Saves synchronously the metadata for “location”.
The file at “location”, if non-NULL
, must exist on the
filesystem, otherwise an error is returned.
If “location” is NULL
, FALSE
is simply returned.
Since: 1.0
void tepl_file_metadata_save_async (TeplFileMetadata *metadata
,gint io_priority
,GCancellable *cancellable
,GAsyncReadyCallback callback
,gpointer user_data
);
The asynchronous version of tepl_file_metadata_save()
.
If the metadata is saved with the metadata manager (i.e. not with GVfs), this function saves the metadata synchronously. A future version might fix this.
See the GAsyncResult documentation to know how to use this function.
metadata |
||
io_priority |
the I/O priority of the request. E.g. |
|
cancellable |
optional GCancellable object, |
[nullable] |
callback |
a GAsyncReadyCallback to call when the request is satisfied. |
[scope async] |
user_data |
user data to pass to |
Since: 1.0
gboolean tepl_file_metadata_save_finish (TeplFileMetadata *metadata
,GAsyncResult *result
,GError **error
);
Finishes the metadata saving started with tepl_file_metadata_save_async()
.
Since: 1.0