I've been reading tutorial from
http://developer.gnome.org/gnome-devel-demos/unstable/image-viewer.vala.html.en. I am curently trying to do the task "Have the user select a directory rather than a file, and provide controls to cycle through all of the images in a directory." I am using FileChooserDialog to get the proper folder, but I have no idea how to operate on it.
I found out that there is enumerate_children of object File, which allows me to invent the way of loading the image.
Code:
//(Vala)
dirname = dialog.get_filename ();
File directory = File.new_for_path(dirname);
enumerator = directory.enumerate_children(FileAttribute.STANDARD_NAME, 0);
image.set_from_file (dirname+"/"+enumerator.next_file().get_name());
Although there are warnings:
Code:
warning: unhandled error `GLib.Error'
at each line, this method works fine. Unfortunately enumerator doesn't seem to be the good way of dealing with that problem as it only allows to move in one direction. Those warnings also makes me feel that something is wrong.
I didn't find any other way to browse directory content except of enumerating. Could you point me right direction?
@Edit:
GDir is the solution. I added GTK to each google query so it didn't find it as it's from Glib. (don't know why enumarate has been found).
@2Edit:
In fact GDir is not the solution. It seems that I have to use an array.