Re: File Chooser Dialog: display only files with chosen extensions: SOLVED






Hey friends,

Solution:
You could
either use gtk_file_filter_add_mime_type or
gtk_file_filter_add_pattern(filefilter, "*.exe").

Thanks ...the last thing works. I tried mime type, that didnt work too ..


Vijay

gtk_Add_fil
On Sun, January 13, 2008 3:39 am, Armin Burgmeier wrote:



On Sat, 2008-01-12 at 17:04 +0530, vijayasarathy setsindia net wrote:




Hey friend,


Thanks for that suggestion ...I did try adding file filter and
associating the filter with the file dialog.


Here is the code I tried:


**********************************START CODE CHUNK
*************************


GtkFileFilter *filefilter;//For filtering only exe files into
GtkWidget *wdgt_filechooser;//pointer for creating filechooser dialog
box

//Create and configure filter
filefilter = gtk_file_filter_new();

gtk_file_filter_set_name(filefilter,(const gchar *)"exe filter"); //Add
mime type "exe" to created filter.
gtk_file_filter_add_pattern(filefilter,(const gchar
*)"application/octet-stream");


gtk_file_filter_add_pattern is for shell-style glob matches. You could
either use gtk_file_filter_add_mime_type or
gtk_file_filter_add_pattern(filefilter, "*.exe").

//create file chooser dialog box
wdgt_filechooser = create_ui_filechooser();

//Add filter to the dialog box
gtk_file_chooser_add_filter((GtkFileChooser
*)wdgt_filechooser,filefilter);
//Show file chooser dialog box
gtk_widget_show(wdgt_filechooser);

*****************************END CODE CHUNK
********************************


This just didnt work out ...Only sub-folders in respective folders are
being showed ...nothing else !!


Help pls...


Armin


Vijay
On Sat, January 12, 2008 4:18 pm, Eduardo M KALINOWSKI wrote:



vijayasarathy setsindia net wrote:
Hi all,



Is it possible that we can let a GtkFileChooserDialog object [file
chooser dialog] to display only files of specific extensions, for
example, display only exe files in the navigated folder ?


Certainly. You have to create GtkFileFilter's. See these links:



http://library.gnome.org/devel/gtk/unstable/GtkFileChooser.html#gtk-f
ile- chooser-add-filter
http://library.gnome.org/devel/gtk/unstable/gtk-gtkfilefilter.html#Gt
kFil eFilter

--
The only time a dog gets complimented is when he doesn't do anything.
-- C. Schulz



Eduardo M KALINOWSKI
ekalin gmail com http://move.to/hpkb




*************************************************************************************
DISCLAIMER 
This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may 
contain confidential and privileged information. 
Any use,distribution,copying or disclosure by any other person is strictly prohibited. If you have received 
this transmission in error please notify SETS immediately either by replying to this e-mail or by telephone 
+91-44-28205655 and then delete this e-mail. The sender does not accept any responsibility for any damage 
which you sustain as a result of software viruses or malicious programs. You should therefore scan 
attachments (if any) prior to opening them. 
************************************************************************************







[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]