Top | ![]() |
![]() |
![]() |
![]() |
GtkDirectoryList * | gtk_directory_list_new () |
const char * | gtk_directory_list_get_attributes () |
void | gtk_directory_list_set_attributes () |
GFile * | gtk_directory_list_get_file () |
void | gtk_directory_list_set_file () |
int | gtk_directory_list_get_io_priority () |
void | gtk_directory_list_set_io_priority () |
gboolean | gtk_directory_list_is_loading () |
const GError * | gtk_directory_list_get_error () |
gchar * | attributes | Read / Write |
GError * | error | Read |
GFile * | file | Read / Write |
gint | io-priority | Read / Write |
GType * | item-type | Read |
gboolean | loading | Read |
GtkDirectoryList is a list model that wraps g_file_enumerate_children_async()
.
It presents a GListModel and fills it asynchronously with the GFileInfos
returned from that function.
Enumeration will start automatically when a the GtkDirectoryList:file property is set.
While the GtkDirectoryList is being filled, the GtkDirectoryList:loading
property will be set to TRUE
. You can listen to that property if you want
to show information like a GtkSpinner or a "Loading..." text.
If loading fails at any point, the GtkDirectoryList:error property will be set
to give more indication about the failure.
The GFileInfos returned from a GtkDirectoryList have the "standard::file"
attribute set to the GFile they refer to. This way you can get at the file
that is referred to in the same way you would via g_file_enumerator_get_child()
.
This means you do not need access to the GtkDirectoryList but can access
the GFile directly from the GFileInfo when operating with a GtkListView or
similar.
GtkDirectoryList * gtk_directory_list_new (const char *attributes
,GFile *file
);
Creates a new GtkDirectoryList querying the given file
with the given
attributes
.
const char *
gtk_directory_list_get_attributes (GtkDirectoryList *self
);
Gets the attributes queried on the children.
void gtk_directory_list_set_attributes (GtkDirectoryList *self
,const char *attributes
);
Sets the attributes
to be enumerated and starts the enumeration.
If attributes
is NULL
, no attributes will be queried, but a list
of GFileInfos will still be created.
GFile *
gtk_directory_list_get_file (GtkDirectoryList *self
);
Gets the file whose children are currently enumerated.
void gtk_directory_list_set_file (GtkDirectoryList *self
,GFile *file
);
Sets the file
to be enumerated and starts the enumeration.
If file
is NULL
, the result will be an empty list.
int
gtk_directory_list_get_io_priority (GtkDirectoryList *self
);
Gets the IO priority set via gtk_directory_list_set_io_priority()
.
void gtk_directory_list_set_io_priority (GtkDirectoryList *self
,int io_priority
);
Sets the IO priority to use while loading directories.
Setting the priority while self
is loading will reprioritize the
ongoing load as soon as possible.
The default IO priority is G_PRIORITY_DEFAULT
, which is higher than
the GTK redraw priority. If you are loading a lot of directories in
parrallel, lowering it to something like G_PRIORITY_DEFAULT_IDLE
may increase responsiveness.
gboolean
gtk_directory_list_is_loading (GtkDirectoryList *self
);
Returns TRUE
if the children enumeration is currently in
progress.
Files will be added to self
from time to time while loading is
going on. The order in which are added is undefined and may change
inbetween runs.
const GError *
gtk_directory_list_get_error (GtkDirectoryList *self
);
Gets the loading error, if any.
If an error occurs during the loading process, the loading process will finish and this property allows querying the error that happened. This error will persist until a file is loaded again.
An error being set does not mean that no files were loaded, and all successfully queried files will remain in the list.
“attributes”
property “attributes” gchar *
The attributes to query
Owner: GtkDirectoryList
Flags: Read / Write
Default value: NULL
“error”
property “error” GError *
Error encountered while loading files
Owner: GtkDirectoryList
Flags: Read
“io-priority”
property “io-priority” gint
Priority used when loading
Owner: GtkDirectoryList
Flags: Read / Write
Allowed values: >= -2147483647
Default value: 0
“item-type”
property “item-type” GType *
The GType for elements of this object
Owner: GtkDirectoryList
Flags: Read
Allowed values: GFileInfo