Class
GioFileEnumerator
Description [src]
class Gio.FileEnumerator : GObject.Object
{
/* No available fields */
}
GFileEnumerator
allows you to operate on a set of GFile
objects,
returning a GFileInfo
structure for each file enumerated (e.g.
g_file_enumerate_children()
will return a GFileEnumerator
for each
of the children within a directory).
To get the next file’s information from a GFileEnumerator
, use
g_file_enumerator_next_file()
or its asynchronous version,
g_file_enumerator_next_files_async()
. Note that the asynchronous
version will return a list of GFileInfo
objects, whereas the
synchronous will only return the next file in the enumerator.
The ordering of returned files is unspecified for non-Unix
platforms; for more information, see g_dir_read_name()
. On Unix,
when operating on local files, returned files will be sorted by
inode number. Effectively you can assume that the ordering of
returned files will be stable between successive calls (and
applications) assuming the directory is unchanged.
If your application needs a specific ordering, such as by name or modification time, you will have to implement that in your application code.
To close a GFileEnumerator
, use g_file_enumerator_close()
, or
its asynchronous version, g_file_enumerator_close_async()
. Once
a GFileEnumerator
is closed, no further actions may be performed
on it, and it should be freed with g_object_unref()
.
Instance methods
g_file_enumerator_close
Releases all resources used by this enumerator, making the
enumerator return G_IO_ERROR_CLOSED
on all calls.
g_file_enumerator_close_finish
Finishes closing a file enumerator, started from g_file_enumerator_close_async().
g_file_enumerator_get_child
Return a new GFile
which refers to the file named by info
in the source
directory of enumerator
. This function is primarily intended to be used
inside loops with g_file_enumerator_next_file().
since: 2.36
g_file_enumerator_iterate
This is a version of g_file_enumerator_next_file()
that’s easier to
use correctly from C programs. With g_file_enumerator_next_file(),
the gboolean return value signifies “end of iteration or error”, which
requires allocation of a temporary GError
.
since: 2.44
g_file_enumerator_next_file
Returns information for the next file in the enumerated object.
Will block until the information is available. The GFileInfo
returned from this function will contain attributes that match the
attribute string that was passed when the GFileEnumerator
was created.
g_file_enumerator_next_files_async
Request information for a number of files from the enumerator asynchronously.
When all I/O for the operation is finished the callback
will be called with
the requested information.
g_file_enumerator_next_files_finish
Finishes the asynchronous operation started with g_file_enumerator_next_files_async().
Signals
Signals inherited from GObject (1)
GObject::notify
The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.
Class structure
struct GioFileEnumeratorClass {
GObjectClass parent_class;
GFileInfo* (* next_file) (
GFileEnumerator* enumerator,
GCancellable* cancellable,
GError** error
);
gboolean (* close_fn) (
GFileEnumerator* enumerator,
GCancellable* cancellable,
GError** error
);
void (* next_files_async) (
GFileEnumerator* enumerator,
int num_files,
int io_priority,
GCancellable* cancellable,
GAsyncReadyCallback callback,
gpointer user_data
);
GList* (* next_files_finish) (
GFileEnumerator* enumerator,
GAsyncResult* result,
GError** error
);
void (* close_async) (
GFileEnumerator* enumerator,
int io_priority,
GCancellable* cancellable,
GAsyncReadyCallback callback,
gpointer user_data
);
gboolean (* close_finish) (
GFileEnumerator* enumerator,
GAsyncResult* result,
GError** error
);
void (* _g_reserved1) (
void
);
void (* _g_reserved2) (
void
);
void (* _g_reserved3) (
void
);
void (* _g_reserved4) (
void
);
void (* _g_reserved5) (
void
);
void (* _g_reserved6) (
void
);
void (* _g_reserved7) (
void
);
}
No description available.
Class members
parent_class: GObjectClass
No description available.
next_file: GFileInfo* (* next_file) ( GFileEnumerator* enumerator, GCancellable* cancellable, GError** error )
No description available.
close_fn: gboolean (* close_fn) ( GFileEnumerator* enumerator, GCancellable* cancellable, GError** error )
No description available.
next_files_async: void (* next_files_async) ( GFileEnumerator* enumerator, int num_files, int io_priority, GCancellable* cancellable, GAsyncReadyCallback callback, gpointer user_data )
No description available.
next_files_finish: GList* (* next_files_finish) ( GFileEnumerator* enumerator, GAsyncResult* result, GError** error )
No description available.
close_async: void (* close_async) ( GFileEnumerator* enumerator, int io_priority, GCancellable* cancellable, GAsyncReadyCallback callback, gpointer user_data )
No description available.
close_finish: gboolean (* close_finish) ( GFileEnumerator* enumerator, GAsyncResult* result, GError** error )
No description available.
_g_reserved1: void (* _g_reserved1) ( void )
No description available.
_g_reserved2: void (* _g_reserved2) ( void )
No description available.
_g_reserved3: void (* _g_reserved3) ( void )
No description available.
_g_reserved4: void (* _g_reserved4) ( void )
No description available.
_g_reserved5: void (* _g_reserved5) ( void )
No description available.
_g_reserved6: void (* _g_reserved6) ( void )
No description available.
_g_reserved7: void (* _g_reserved7) ( void )
No description available.
Virtual methods
Gio.FileEnumeratorClass.close_finish
Finishes closing a file enumerator, started from g_file_enumerator_close_async().
Gio.FileEnumeratorClass.next_file
Returns information for the next file in the enumerated object.
Will block until the information is available. The GFileInfo
returned from this function will contain attributes that match the
attribute string that was passed when the GFileEnumerator
was created.
Gio.FileEnumeratorClass.next_files_async
Request information for a number of files from the enumerator asynchronously.
When all I/O for the operation is finished the callback
will be called with
the requested information.
Gio.FileEnumeratorClass.next_files_finish
Finishes the asynchronous operation started with g_file_enumerator_next_files_async().