#! /usr/bin/perl

use strict;
use warnings;
use utf8;
use Gtk2 '-init';
use Gnome2::VFS '-init';

my $window 	= Gtk2::Window->new('toplevel');
$window->signal_connect( 'delete-event' => sub { Gtk2->main_quit } );

my $vbox = Gtk2::VBox->new();

my $entry = new Gtk2::Entry();
my $uri = Gnome2::VFS::URI->new( "/home/user/töüä/" );
$entry->set_text(Gnome2::VFS->format_uri_for_display($uri->to_string)); #does not work
#~ $entry->set_text(utf8_decode(Gnome2::VFS->format_uri_for_display($uri->to_string))); #does work

my $button = new Gtk2::Button( "Show text in dialog" );
$button->signal_connect( 'clicked', sub { 
	my $dialog = Gtk2::MessageDialog->new ($window, 'destroy-with-parent', 'question', 'yes-no', $entry->get_text);	
	$dialog->signal_connect ('response' => sub { $dialog->destroy });
	$dialog->run;
});

$vbox->pack_start_defaults($entry);
$vbox->pack_start_defaults($button);

$window->add($vbox);
$window->show_all;

Gtk2->main;

sub utf8_decode {
	my $string	= shift;	
	utf8::decode $string;
	return $string;
}

0;
