summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJon A. Cruz <jon@joncruz.org>2012-05-24 08:18:07 +0000
committerJon A. Cruz <jon@joncruz.org>2012-05-24 08:18:07 +0000
commita09ed5aadd1f2ad3ecb3563f5ce54c3d1410d115 (patch)
tree83396a2596c41ef15953fe7344f28de42f7e4204 /src
parentAdded progress to export dialog and disabling export button while busy. Parti... (diff)
downloadinkscape-a09ed5aadd1f2ad3ecb3563f5ce54c3d1410d115.tar.gz
inkscape-a09ed5aadd1f2ad3ecb3563f5ce54c3d1410d115.zip
Added option to close export dialog upon completion. Fixes bug #43730.
Fixed bugs: - https://launchpad.net/bugs/43730 (bzr r11409)
Diffstat (limited to 'src')
-rw-r--r--src/ui/dialog/export.cpp22
-rw-r--r--src/ui/dialog/export.h2
2 files changed, 24 insertions, 0 deletions
diff --git a/src/ui/dialog/export.cpp b/src/ui/dialog/export.cpp
index 360c7c923..ee8e3c00d 100644
--- a/src/ui/dialog/export.cpp
+++ b/src/ui/dialog/export.cpp
@@ -63,6 +63,8 @@
#include "helper/png-write.h"
+#include "libgdl/gdl-dock-item.h"
+
// required to set status message after export
#include "desktop.h"
#include "message-stack.h"
@@ -141,6 +143,7 @@ Export::Export (void) :
batch_export(_("B_atch export all selected objects"), _("Export each selected object into its own PNG file, using export hints if any (caution, overwrites without asking!)")),
hide_box(false, 5),
hide_export(_("Hide a_ll except selected"), _("In the exported image, hide all objects except those that are selected")),
+ closeWhenDone(_("Close this dialog when complete"), _("Once the export completes, close this dialog")),
button_box(Gtk::BUTTONBOX_END),
export_label(_("_Export"), 1),
export_image(Gtk::StockID(Gtk::Stock::APPLY), Gtk::ICON_SIZE_BUTTON),
@@ -310,6 +313,9 @@ Export::Export (void) :
hide_export.set_sensitive(true);
hide_box.pack_start(hide_export, false, false);
+ Gtk::HBox *closeWhenBox = Gtk::manage(new Gtk::HBox(false, 5));
+ closeWhenBox->pack_start(closeWhenDone, Gtk::PACK_SHRINK);
+
/* Export Button row */
button_box.set_border_width(3);
Gtk::HBox* export_image_label = new Gtk::HBox(false, 3);
@@ -327,6 +333,7 @@ Export::Export (void) :
contents->pack_start(singleexport_box);
contents->pack_start(batch_box);
contents->pack_start(hide_box);
+ contents->pack_start(*closeWhenBox);
contents->pack_end(button_box, Gtk::PACK_SHRINK);
contents->pack_end(_prog, Gtk::PACK_EXPAND_WIDGET);
@@ -925,6 +932,8 @@ void Export::onExport ()
SPNamedView *nv = sp_desktop_namedview(desktop);
SPDocument *doc = sp_desktop_document (desktop);
+ bool exportSuccessful = false;
+
bool hide = hide_export.get_active ();
if (batch_export.get_active ()) {
// Batch export of selected objects
@@ -1015,6 +1024,7 @@ void Export::onExport ()
delete prog_dlg;
prog_dlg = NULL;
interrupted = false;
+ exportSuccessful = (export_count > 0);
} else {
Glib::ustring filename = filename_entry.get_text();
@@ -1084,6 +1094,7 @@ void Export::onExport ()
g_free(safeFile);
g_free(error);
} else if (status == EXPORT_OK) {
+ exportSuccessful = true;
gchar *safeFile = Inkscape::IO::sanitizeString(path.c_str());
desktop->messageStack()->flashF(Inkscape::INFORMATION_MESSAGE, _("Drawing exported to <b>%s</b>."), safeFile);
@@ -1188,6 +1199,17 @@ void Export::onExport ()
}
}
+ if (exportSuccessful && closeWhenDone.get_active()) {
+ for ( Gtk::Container *parent = get_parent(); parent; parent = parent->get_parent()) {
+ if ( GDL_IS_DOCK_ITEM(parent->gobj()) ) {
+ GdlDockItem *item = GDL_DOCK_ITEM(parent->gobj());
+ if (item) {
+ gdl_dock_item_hide_item(item);
+ }
+ break;
+ }
+ }
+ }
} // end of sp_export_export_clicked()
/// Called when Browse button is clicked
diff --git a/src/ui/dialog/export.h b/src/ui/dialog/export.h
index dd7cf2f62..46bad3df2 100644
--- a/src/ui/dialog/export.h
+++ b/src/ui/dialog/export.h
@@ -346,6 +346,8 @@ private:
Gtk::HBox hide_box;
Inkscape::UI::Widget::CheckButton hide_export;
+ Inkscape::UI::Widget::CheckButton closeWhenDone;
+
/* Export Button widgets */
Gtk::HButtonBox button_box;
Gtk::Button export_button;