1 /**
2 * Session file selector widget
3 *
4 * Authors:
5 * David Yip <yipdw@rose-hulman.edu>
6 *
7 * Copyright (c) 2005 Authors
8 *
9 * Released under GNU GPL, read the file 'COPYING' for more information
10 */
12 #include "session-file-selector.h"
14 #include <glibmm/i18n.h>
15 #include <gtkmm/filechooserdialog.h>
16 #include <gtkmm/stock.h>
18 namespace Inkscape {
20 namespace Whiteboard {
22 SessionFileSelectorBox::SessionFileSelectorBox() :
23 _usesessionfile(_("_Write session file:"), true)
24 {
25 this->_construct();
26 }
28 SessionFileSelectorBox::~SessionFileSelectorBox()
29 {
31 }
33 bool
34 SessionFileSelectorBox::isSelected()
35 {
36 return this->_usesessionfile.get_active();
37 }
39 Glib::ustring const&
40 SessionFileSelectorBox::getFilename()
41 {
42 return this->_filename;
43 }
45 void
46 SessionFileSelectorBox::_construct()
47 {
48 this->_getfilepath.set_label("...");
50 this->pack_start(this->_usesessionfile);
51 this->pack_start(this->_sessionfile);
52 this->pack_end(this->_getfilepath);
54 this->_getfilepath.signal_clicked().connect(sigc::mem_fun(*this, &SessionFileSelectorBox::_callback));
55 }
57 void
58 SessionFileSelectorBox::_callback() {
59 Gtk::FileChooserDialog sessionfiledlg(_("Select a location and filename"), Gtk::FILE_CHOOSER_ACTION_SAVE);
60 sessionfiledlg.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
61 sessionfiledlg.add_button(_("Set filename"), Gtk::RESPONSE_OK);
62 int result = sessionfiledlg.run();
63 switch (result) {
64 case Gtk::RESPONSE_OK:
65 {
66 this->_usesessionfile.set_active();
67 this->_sessionfile.set_text(sessionfiledlg.get_filename());
68 this->_filename = sessionfiledlg.get_filename();
69 break;
70 }
71 case Gtk::RESPONSE_CANCEL:
72 default:
73 break;
74 }
75 }
77 }
79 }
82 /*
83 Local Variables:
84 mode:c++
85 c-file-style:"stroustrup"
86 c-file-offsets:((innamespace . 0)(inline-open . 0))
87 indent-tabs-mode:nil
88 fill-column:99
89 End:
90 */