Esempio n. 1
0
void loadfile()
{
	Gtk::FileChooserDialog* d;
	b->get_widget("filechooserdialog1", d);
	Gtk::Window* w;
	b->get_widget("window1", w);
	d->set_transient_for(*w);
	d->set_action(FILE_CHOOSER_ACTION_OPEN);
	Gtk::Button* b = d->add_button(Stock::OPEN, RESPONSE_OK);
	if(d->run() == RESPONSE_OK)
	{
		GIOGenericStream s = Glib::RefPtr<Gio::InputStream>::cast_dynamic(d->get_file()->read());
		do_load(s);
		s.Close();
		fname = d->get_filename();
		if(fname.length() <= 0)
		{
			WARN(1, "current file name could not be updated because the file path is not obtainable(not a local file?)");
		}
	}
	d->hide();
	b->get_parent()->Gtk::Container::remove(*b);
	delete b;
}