GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Sat Nov 29, 2014 12:05 am

All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Displaying only certain files with a listView
PostPosted: Sun Jul 15, 2007 1:30 am 
Offline

Joined: Fri Apr 20, 2007 11:07 am
Posts: 4
Hello,
I'm writing an app. in which I want to display the contents of a folder (selected via filechooserdiag) in a listView. However I only want 'certain' filetypes to be displayed.
Now while I can do this using standard c-functions to analyise the filename and select only those files with the correct type(ending), I wonder if there is a way of doing this through GTK or GDK?

Also, on a side note, how can I include subfolders when 'opening' a directory with ' g_dir_open' & 'g_dir_read_name'?

ThanX

_________________
"...and also because he is one of those people who find reasons to blame Microsoft for almost all their problems in life."


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jul 15, 2007 5:29 pm 
Offline
Never Seen the Sunlight

Joined: Wed Sep 21, 2005 3:07 am
Posts: 384
Location: Fairfax, Virginia
To display sub folders, you need to use g_file_test() to check whether the current file is a file or folder. Create a recursive parsing function.

As for file types, GVFS is coming in the next few releases of GLib, which checks mime types. For now, you can either check the file extension by searching the filename string, or using GnomeVFS.

_________________
Andrew Krause

Foundations of GTK+ Development: Buy now for only $31.49!


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jul 15, 2007 11:29 pm 
Offline

Joined: Fri Apr 20, 2007 11:07 am
Posts: 4
Thank you for your help. I'll look into using GnomeVFS, however I want to keep dependencies low, so I'll probably stick with checking strings.

Quote:
To display sub folders, you need to use g_file_test() to check whether the current file is a file or folder.


How obvious, now why didn't I realise this... :oops:

_________________
"...and also because he is one of those people who find reasons to blame Microsoft for almost all their problems in life."


Top
 Profile  
 
 Post subject:
PostPosted: Sun Mar 09, 2008 4:44 pm 
Offline

Joined: Sun Mar 09, 2008 4:40 pm
Posts: 2
Hi, I'm looking to implement something similar but is a total noob.
Do you have some code/sample to share? Thanks.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group