summaryrefslogtreecommitdiffstats
path: root/src/dialogs
diff options
context:
space:
mode:
authorbulia byak <buliabyak@gmail.com>2009-08-17 23:09:16 +0000
committerbuliabyak <buliabyak@users.sourceforge.net>2009-08-17 23:09:16 +0000
commite6fc7252065fa1d48183d162a74013e533cf4240 (patch)
tree748fb62d5767c8a0c0dff080e0b5fa4abc3ed873 /src/dialogs
parentfix remaining issues of bug 407893 (diff)
downloadinkscape-e6fc7252065fa1d48183d162a74013e533cf4240.tar.gz
inkscape-e6fc7252065fa1d48183d162a74013e533cf4240.zip
fix 396851: move absolutizing relative path (added by Ted) out of sp_export_png_file and make sure it works only for rel filenames from hints (both on command line and on batch export), but not for filenames specified on command line or in export dialog; reenable export-id with export-use-hints; fix errors in string comparisons when choosing command line mode; fix crash when opening nonexistent file in command line mode
(bzr r8500)
Diffstat (limited to 'src/dialogs')
-rw-r--r--src/dialogs/export.cpp28
1 files changed, 22 insertions, 6 deletions
diff --git a/src/dialogs/export.cpp b/src/dialogs/export.cpp
index ee7852924..2e41850ed 100644
--- a/src/dialogs/export.cpp
+++ b/src/dialogs/export.cpp
@@ -1067,6 +1067,7 @@ sp_export_export_clicked (GtkButton */*button*/, GtkObject *base)
if (!SP_ACTIVE_DESKTOP) return;
SPNamedView *nv = sp_desktop_namedview(SP_ACTIVE_DESKTOP);
+ SPDocument *doc = sp_desktop_document (SP_ACTIVE_DESKTOP);
GtkWidget *be = (GtkWidget *)gtk_object_get_data(base, "batch_checkbox");
GtkWidget *he = (GtkWidget *)gtk_object_get_data(base, "hide_checkbox");
@@ -1088,10 +1089,24 @@ sp_export_export_clicked (GtkButton */*button*/, GtkObject *base)
i != NULL;
i = i->next) {
SPItem *item = (SPItem *) i->data;
+
// retrieve export filename hint
- const gchar *fn = SP_OBJECT_REPR(item)->attribute("inkscape:export-filename");
- if (!fn) {
- fn = create_filepath_from_id (SP_OBJECT_ID(item), NULL);
+ const gchar *filename = SP_OBJECT_REPR(item)->attribute("inkscape:export-filename");
+ gchar *path = 0;
+ if (!filename) {
+ path = create_filepath_from_id (SP_OBJECT_ID(item), NULL);
+ } else {
+ //Make relative paths go from the document location, if possible:
+ if (!g_path_is_absolute(filename) && doc->uri) {
+ gchar *dirname = g_path_get_dirname(doc->uri);
+ if (dirname) {
+ path = g_build_filename(dirname, filename, NULL);
+ g_free(dirname);
+ }
+ }
+ if (!path) {
+ path = g_strdup(filename);
+ }
}
// retrieve export dpi hints
@@ -1112,14 +1127,14 @@ sp_export_export_clicked (GtkButton */*button*/, GtkObject *base)
if (width > 1 && height > 1) {
/* Do export */
- if (!sp_export_png_file (sp_desktop_document (SP_ACTIVE_DESKTOP), fn,
+ if (!sp_export_png_file (doc, path,
*area, width, height, dpi, dpi,
nv->pagecolor,
NULL, NULL, TRUE, // overwrite without asking
hide ? (GSList *) sp_desktop_selection(SP_ACTIVE_DESKTOP)->itemList() : NULL
)) {
gchar * error;
- gchar * safeFile = Inkscape::IO::sanitizeString(fn);
+ gchar * safeFile = Inkscape::IO::sanitizeString(path);
error = g_strdup_printf(_("Could not export to filename %s.\n"), safeFile);
sp_ui_error_dialog(error);
g_free(safeFile);
@@ -1128,6 +1143,7 @@ sp_export_export_clicked (GtkButton */*button*/, GtkObject *base)
}
}
n++;
+ g_free(path);
sp_export_progress_callback((float)n/num, base);
}
@@ -1178,9 +1194,9 @@ sp_export_export_clicked (GtkButton */*button*/, GtkObject *base)
gtk_entry_set_text(GTK_ENTRY(fe), filename_ext);
gchar *fn = g_path_get_basename (filename_ext);
-
gchar *progress_text = g_strdup_printf (_("Exporting %s (%lu x %lu)"), fn, width, height);
g_free (fn);
+
GtkWidget *prog_dlg = create_progress_dialog (base, progress_text);
g_free (progress_text);