2 * \file FileDialogPrivate.C
3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
8 * Full author contact details are available in file CREDITS.
13 // Too hard to make concept checks work with this file
14 #ifdef _GLIBCPP_CONCEPT_CHECKS
15 #undef _GLIBCPP_CONCEPT_CHECKS
18 #include "FileDialogPrivate.h"
23 FileDialog::Private::Private(string const & title,
25 FileDialog::Button /*b1*/,
26 FileDialog::Button /*b2*/) :
29 fileSelection_.set_title(title);
30 /* fileSelection_.get_button_area()->children().push_back(
31 Gtk::Box_Helpers::Element(button1_));
32 fileSelection_.get_button_area()->children().push_back(
33 Gtk::Box_Helpers::Element(button2_));
34 button1_.signal_clicked().connect(
35 sigc::mem_fun(*this, &FileDialog::Private::onButton1Clicked));
36 button2_.signal_clicked().connect(
37 sigc::mem_fun(*this, &FileDialog::Private::onButton2Clicked));
38 if (!b1.first.empty() && !b1.second.empty()) {
39 string::size_type pos = b1.first.find('|');
41 Glib::locale_to_utf8(b1.first.substr(0, pos)));
45 if (!b2.first.empty() && !b2.second.empty()) {
46 string::size_type pos = b2.first.find('|');
48 Glib::locale_to_utf8(b2.first.substr(0, pos)));
55 void FileDialog::Private::onButton1Clicked()
57 fileSelection_.set_filename(dir1_);
61 void FileDialog::Private::onButton2Clicked()
63 fileSelection_.set_filename(dir2_);
67 FileDialog::Result const
68 FileDialog::Private::open(string const & path,
69 lyx::support::FileFilterList const & /*filters*/,
70 string const & /*suggested*/)
72 fileSelection_.set_filename(path);
73 fileSelection_.get_file_list()->get_parent()->show();
75 result.first = FileDialog::Chosen;
76 if (fileSelection_.run() == Gtk::RESPONSE_OK)
77 result.second = fileSelection_.get_filename();
79 result.second = string();
84 FileDialog::Result const FileDialog::Private::opendir(string const & path,
85 string const & /*suggested*/)
87 fileSelection_.set_filename(path);
88 fileSelection_.get_file_list()->get_parent()->hide();
90 result.first = FileDialog::Chosen;
91 if (fileSelection_.run() == Gtk::RESPONSE_OK)
92 result.second = fileSelection_.get_filename();
94 result.second = string();
99 FileDialog::Result const FileDialog::Private::save(string const & path,
100 lyx::support::FileFilterList const & filters,
101 string const & suggested)
103 return open(path, filters, suggested);