summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 6db0dd6)
raw | patch | inline | side by side (parent: 6db0dd6)
author | pjrm <pjrm@users.sourceforge.net> | |
Tue, 7 Apr 2009 06:11:20 +0000 (06:11 +0000) | ||
committer | pjrm <pjrm@users.sourceforge.net> | |
Tue, 7 Apr 2009 06:11:20 +0000 (06:11 +0000) |
src/selection-chemistry.cpp | patch | blob | history |
index 62fbdf172815c5a352bbe07f8e5e7c82b0833254..a57e5cfebd5a5d08f6a9edae863210e5d5c92bbd 100644 (file)
g_get_current_time(&cu);
guint current = (int) (cu.tv_sec * 1000000 + cu.tv_usec) % 1024;
- // Create the filename
- gchar *filename = g_strdup_printf("%s-%s-%u.png", document->name, SP_OBJECT_REPR(items->data)->attribute("id"), current);
+ // Create the filename.
+ gchar *const basename = g_strdup_printf("%s-%s-%u.png",
+ document->name,
+ SP_OBJECT_REPR(items->data)->attribute("id"),
+ current);
// Imagemagick is known not to handle spaces in filenames, so we replace anything but letters,
// digits, and a few other chars, with "_"
- g_strcanon(filename, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_.=+~$#@^&!?", '_');
+ g_strcanon(basename, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_.=+~$#@^&!?", '_');
// Build the complete path by adding document base dir, if set, otherwise home dir
gchar * directory = NULL;
if (directory == NULL) {
directory = homedir_path(NULL);
}
- gchar *filepath = g_build_filename(directory, filename, NULL);
+ gchar *filepath = g_build_filename(directory, basename, NULL);
//g_print("%s\n", filepath);
if (pb) {
// Create the repr for the image
Inkscape::XML::Node * repr = xml_doc->createElement("svg:image");
- repr->setAttribute("xlink:href", filename);
+ repr->setAttribute("xlink:href", basename);
repr->setAttribute("sodipodi:absref", filepath);
if (res == PX_PER_IN) { // for default 90 dpi, snap it to pixel grid
sp_repr_set_svg_double(repr, "width", width);
desktop->clearWaitingCursor();
- g_free(filename);
+ g_free(basename);
g_free(filepath);
}