Re: gtkfileselection



is it true that there is no way to tell a gtk file selection to refresh
its directory contents (gtk 1.2.10)?


double-clicking the . directory forces a refresh of the files
listed, but I'm not sure if there's a way to trigger this from
the application.


Hi, you can force a refresh by doing get_filename/set_filename. This will also trigger the auto-complete code, sadly, but it's maybe better than nothing.

John

--#include <gtk/gtk.h>

static void
clicked_cb( GtkWidget *button, GtkWidget *fsb )
{
	char *name;

name = gtk_file_selection_get_filename( GTK_FILE_SELECTION( fsb ) );
	gtk_file_selection_set_filename( GTK_FILE_SELECTION( fsb ), name );
}

int
main( int argc, char **argv )
{
	GtkWidget *fsb;
	GtkWidget *but;

	GtkWidget *wid;

	gtk_set_locale();
	gtk_init( &argc, &argv );

	fsb = gtk_file_selection_new( "" );

	but = gtk_button_new_with_label( "Refresh" );
	gtk_container_add( GTK_CONTAINER(
		GTK_FILE_SELECTION( fsb )->action_area ), but );
	gtk_signal_connect( GTK_OBJECT( but ), "clicked",
		GTK_SIGNAL_FUNC( clicked_cb ), fsb );
	gtk_widget_show( but );

	gtk_widget_show( fsb );

	gtk_main();

	return( 0 );
}






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