A list model that wraps [methodGio.File.enumerate_children_async].
It presents a GListModel and fills it asynchronously with the GFileInfos returned from that function.
Enumeration will start automatically when the [propertyGtk.DirectoryList:file] property is set.
While the GtkDirectoryList is being filled, the [propertyGtk.DirectoryList: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 [propertyGtk.DirectoryList: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.
<group>Lists</group> <gtkada_demo>create_data_lists.adb</gtkada_demo>
function "+"
(Widget : access Gtk_Directory_List_Record'Class)
return Glib.List_Model.Glist_Model
function "-"
(Interf : Glib.List_Model.Glist_Model)
return Gtk_Directory_List
Attributes_Property : constant Glib.Properties.Property_String;
The attributes to query.
Error_Property : constant Glib.Properties.Property_Boxed;
Type: GLib.Error Error encountered while loading files.
File_Property : constant Glib.Properties.Property_Interface;
Type: Glib.GFile.Gfile File to query.
function Get_Attributes
(Self : not null access Gtk_Directory_List_Record) return UTF8_String
Gets the attributes queried on the children.
The queried attributes
function Get_Error
(Self : not null access Gtk_Directory_List_Record)
return Glib.Error.GError
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.
The loading error or null if loading finished successfully
function Get_File
(Self : not null access Gtk_Directory_List_Record)
return Glib.GFile.Gfile
Gets the file whose children are currently enumerated.
The file whose children are enumerated
function Get_Io_Priority
(Self : not null access Gtk_Directory_List_Record) return Glib.Gint
Gets the IO priority set via Gtk.Directory_List.Set_Io_Priority.
The IO priority.
function Get_Item
(Self : not null access Gtk_Directory_List_Record;
Position : Guint) return Glib.Object.GObject
function Get_Item_Type
(Self : not null access Gtk_Directory_List_Record) return GType
function Get_Monitored
(Self : not null access Gtk_Directory_List_Record) return Boolean
Returns whether the directory list is monitoring the directory for changes.
True if the directory is monitored
function Get_N_Items
(Self : not null access Gtk_Directory_List_Record) return Guint
function Get_Type return Glib.GType
type Gtk_Directory_List is access all Gtk_Directory_List_Record'Class;
function Gtk_Directory_List_New
(Attributes : UTF8_String := "";
File : Glib.GFile.Gfile) return Gtk_Directory_List
Creates a new GtkDirectoryList. The GtkDirectoryList is querying the given File with the given Attributes.
The attributes to query with
The file to query
type Gtk_Directory_List_Record is new GObject_Record with null record;
procedure Gtk_New
(Self : out Gtk_Directory_List;
Attributes : UTF8_String := "";
File : Glib.GFile.Gfile)
Creates a new GtkDirectoryList. The GtkDirectoryList is querying the given File with the given Attributes. Initialize does nothing if the object was already created with another call to Initialize* or G_New.
The attributes to query with
The file to query
package Implements_Glist_Model is new Glib.Types.Implements
(Glib.List_Model.Glist_Model, Gtk_Directory_List_Record, Gtk_Directory_List);
procedure Initialize
(Self : not null access Gtk_Directory_List_Record'Class;
Attributes : UTF8_String := "";
File : Glib.GFile.Gfile)
Creates a new GtkDirectoryList. The GtkDirectoryList is querying the given File with the given Attributes. Initialize does nothing if the object was already created with another call to Initialize* or G_New.
The attributes to query with
The file to query
Io_Priority_Property : constant Glib.Properties.Property_Int;
Priority used when loading.
function Is_Loading
(Self : not null access Gtk_Directory_List_Record) return Boolean
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 in between runs.
True if Self is loading
Item_Type_Property : constant Glib.Properties.Property_Boxed;
Type: GType The type of items. See [methodGio.ListModel.get_item_type].
procedure Items_Changed
(Self : not null access Gtk_Directory_List_Record;
Position : Guint;
Removed : Guint;
Added : Guint)
Loading_Property : constant Glib.Properties.Property_Boolean;
True if files are being loaded.
Monitored_Property : constant Glib.Properties.Property_Boolean;
True if the directory is monitored for changed.
N_Items_Property : constant Glib.Properties.Property_Uint;
The number of items. See [methodGio.ListModel.get_n_items].
procedure Set_Attributes
(Self : not null access Gtk_Directory_List_Record;
Attributes : UTF8_String := "")
Sets the Attributes to be enumerated and starts the enumeration. If Attributes is null, the list of file infos will still be created, it will just not contain any extra attributes.
the attributes to enumerate
procedure Set_File
(Self : not null access Gtk_Directory_List_Record;
File : Glib.GFile.Gfile)
Sets the File to be enumerated and starts the enumeration. If File is null, the result will be an empty list.
the GFile to be enumerated
procedure Set_Io_Priority
(Self : not null access Gtk_Directory_List_Record;
Io_Priority : Glib.Gint)
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 parallel, lowering it to something like G_PRIORITY_DEFAULT_IDLE may increase responsiveness.
IO priority to use
procedure Set_Monitored
(Self : not null access Gtk_Directory_List_Record;
Monitored : Boolean)
Sets whether the directory list will monitor the directory for changes. If monitoring is enabled, the ::items-changed signal will be emitted when the directory contents change. When monitoring is turned on after the initial creation of the directory list, the directory is reloaded to avoid missing files that appeared between the initial loading and when monitoring was turned on.
True to monitor the directory for changes