Chip Rodden wrote: > I'm trying to modify a gtk program which uses a file selection > widget.(gtk_file_selection_new) I have maybe 3 hours of experience > looking at gtk code so I'm fairly clueless. What I am trying to do is > to limit the user to just one directory where he can open from or save > files to.
Hi Chip, you need to hide the widgets you don't want: #include <gtk/gtk.h> int main( int argc, char **argv ) { GtkWidget *fsb; GtkWidget *but; GtkWidget *wid; gtk_set_locale(); gtk_init( &argc, &argv ); fsb = gtk_file_selection_new( "" ); gtk_widget_hide( GTK_FILE_SELECTION( fsb )->dir_list->parent ); gtk_widget_hide( GTK_FILE_SELECTION( fsb )->history_pulldown ); gtk_file_selection_hide_fileop_buttons( GTK_FILE_SELECTION( fsb ) ); gtk_widget_show( fsb ); gtk_main(); return( 0 ); } This isn't bulletproof though :-( for example, a user could type "../fred" and select a file in the parent directory. You'll need to either also get rid of the text selection area and do that stuff yourself, or carefully sanity check the results of the dialog and pop and error box if you think the user is messing about. John ========================================================== Coming soon: Aelbert Cuyp 13 February - 12 May 2002 For information and tickets: http://www.nationalgallery.org.uk _______________________________________________ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list