[passepartout] only instantiate the open dialog when needed
- From: Sven Herzberg <herzi src gnome org>
- To: svn-commits-list gnome org
- Subject: [passepartout] only instantiate the open dialog when needed
- Date: Sat, 2 May 2009 09:33:03 -0400 (EDT)
commit 4c42697f3bbb78f9bb2e965a541f03ba641be1bc
Author: Sven Herzberg <herzi lanedo com>
Date: Sat May 2 00:20:16 2009 +0200
only instantiate the open dialog when needed
* src/pptout/window.cc,
* src/pptout/window.h: don't have this dialog available all time
---
src/pptout/window.cc | 35 +++++++++++++++++------------------
src/pptout/window.h | 3 +--
2 files changed, 18 insertions(+), 20 deletions(-)
diff --git a/src/pptout/window.cc b/src/pptout/window.cc
index 3247df6..1fd3e56 100644
--- a/src/pptout/window.cc
+++ b/src/pptout/window.cc
@@ -104,14 +104,11 @@ FrameWindow::constructor_common (void)
{
p = new Private ();
- open_dialog.reset(new Filesel(*this, _("Open")));
save_dialog.reset(new Filesel(*this, _("Save As"),
Gtk::FILE_CHOOSER_ACTION_SAVE));
// file filters
- open_dialog->add_filter(p->pptout);
save_dialog->add_filter(p->pptout);
- open_dialog->add_filter(p->all);
save_dialog->add_filter(p->all);
print_dialog.reset(new PrintDialog(*this, document_view));
@@ -186,8 +183,6 @@ FrameWindow::constructor_common (void)
zoom_factor.signal_changed.connect
(sigc::mem_fun(*this, &FrameWindow::zoom_factor_changed_action));
- open_dialog->signal_hide().connect
- (sigc::mem_fun(*this, &FrameWindow::open_dialog_done));
save_dialog->signal_hide().connect
(sigc::mem_fun(*this, &FrameWindow::save_dialog_done));
import_dialog->signal_hide().connect
@@ -267,18 +262,6 @@ void FrameWindow::on_document_changed() {
}
-void FrameWindow::open_dialog_done() {
- if(!open_dialog->was_cancelled()) {
- if(document_view.get_document())
- new FrameWindow(open_dialog->get_filename());
- else {
- document_view.set_document
- (DocMeta(Document::create(open_dialog->get_filename(), false),
- open_dialog->get_filename()));
- }
- }
-}
-
void FrameWindow::import_dialog_done() {
if(!import_dialog->was_cancelled())
document_view.new_image_frame
@@ -317,7 +300,23 @@ void FrameWindow::close() {
void
FrameWindow::open_file (void)
{
- open_dialog->show_all ();
+ std::auto_ptr<Filesel> open_dialog (new Filesel (*this, _("Open")));
+ open_dialog->add_filter (p->pptout);
+ open_dialog->add_filter (p->all);
+
+ if (open_dialog->run () == Gtk::RESPONSE_OK)
+ {
+ if(document_view.get_document())
+ {
+ new FrameWindow(open_dialog->get_filename());
+ }
+ else
+ {
+ document_view.set_document
+ (DocMeta(Document::create(open_dialog->get_filename(), false),
+ open_dialog->get_filename()));
+ }
+ }
}
void FrameWindow::save() {
diff --git a/src/pptout/window.h b/src/pptout/window.h
index 0275326..cf55163 100644
--- a/src/pptout/window.h
+++ b/src/pptout/window.h
@@ -41,7 +41,7 @@ private:
Gtk::Statusbar *cafe_opera;
Zoomer zoom_factor;
DocumentView document_view;
- std::auto_ptr<Filesel> open_dialog, save_dialog, import_dialog;
+ std::auto_ptr<Filesel> save_dialog, import_dialog;
std::auto_ptr<PrintDialog> print_dialog;
std::auto_ptr<TextFrameDialog> text_frame_dialog;
Pagesel *pagesel;
@@ -69,7 +69,6 @@ private:
void open_file (void);
void create_menus (Gtk::RecentFilter& filter);
- void open_dialog_done();
void save_dialog_done();
void show_preferences ();
void import_dialog_done();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]