Code

Swedish translation update by Elias.
[inkscape.git] / src / jabber_whiteboard / session-file-selector.cpp
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 <glibmm.h>
13 #include <gtkmm.h>
15 #include "session-file-selector.h"
17 #include <glibmm/i18n.h>
19 namespace Inkscape {
21 namespace Whiteboard {
23 SessionFileSelectorBox::SessionFileSelectorBox() :
24         _usesessionfile(_("_Write session file:"), true)
25 {
26         this->_construct();
27 }
29 SessionFileSelectorBox::~SessionFileSelectorBox()
30 {
32 }
34 bool
35 SessionFileSelectorBox::isSelected()
36 {
37         return this->_usesessionfile.get_active();
38 }
40 Glib::ustring const&
41 SessionFileSelectorBox::getFilename()
42 {
43         return this->_filename;
44 }
46 void
47 SessionFileSelectorBox::_construct()
48 {
49         this->_getfilepath.set_label("...");
51         this->pack_start(this->_usesessionfile);
52         this->pack_start(this->_sessionfile);
53         this->pack_end(this->_getfilepath);
55         this->_getfilepath.signal_clicked().connect(sigc::mem_fun(*this, &SessionFileSelectorBox::_callback));
56 }
58 void
59 SessionFileSelectorBox::_callback() {
60         Gtk::FileChooserDialog sessionfiledlg(_("Select a location and filename"), Gtk::FILE_CHOOSER_ACTION_SAVE);
61         sessionfiledlg.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
62         sessionfiledlg.add_button(_("Set filename"), Gtk::RESPONSE_OK);
63         int result = sessionfiledlg.run();
64         switch (result) {
65                 case Gtk::RESPONSE_OK:
66                 {
67                         this->_usesessionfile.set_active();
68                         this->_sessionfile.set_text(sessionfiledlg.get_filename());
69                         this->_filename = sessionfiledlg.get_filename();
70                         break;
71                 }
72                 case Gtk::RESPONSE_CANCEL:
73                 default:
74                         break;
75         }
76 }
78 }
80 }
83 /*
84   Local Variables:
85   mode:c++
86   c-file-style:"stroustrup"
87   c-file-offsets:((innamespace . 0)(inline-open . 0))
88   indent-tabs-mode:nil
89   fill-column:99
90   End:
91 */