[PATCH] bug in FileSaveDialog
by Kees Cook
I know inkscape is normally a patch-first-talk-later place, but I
haven't done a "serious" commit to SVN in a while, so I thought I'd see
what people thought of this patch...
Here is the problem: in Ubuntu Edgy (glib 2.12.3) the filedialog throws
an error if you give it a _file_ rather than a _path_ in
set_current_folder(). src/file.cpp expected (at one time) to give the
dialog a full path, not a directory, but at some point the logic slowly
changed. This patch restores the logic of letting the dialog specify a
full path name. (And as such, the "drawing.svg", "drawing-1.svg"
default names re-appear too.)
Example scenario:
- start without ~/.inkscape dir and without any ~/drawing*.svg files
- open inkscape
- draw anything
- click "save"
expected results: put in home directory, with "drawing.svg"
already in the filename entry box.
- click "OK"
- open new inkscape window
- draw anything
- click "save"
expected results: put in home directory, with "drawing-1.svg"
- click on "Filesystem" and scroll to "tmp".
- click "OK"
- switch back to first window
- Select "File/Save As..."
expected results: put in home directory, with "drawing.svg"
already in the filename entry box.
Thoughts?
Index: src/ui/dialog/filedialog.h
===================================================================
--- src/ui/dialog/filedialog.h (revision 13104)
+++ src/ui/dialog/filedialog.h (working copy)
@@ -172,6 +172,10 @@
*/
virtual void change_title(const Glib::ustring& title) =0;
+ /**
+ * Change the default save path location.
+ */
+ virtual void change_path(const Glib::ustring& path) =0;
}; //FileSaveDialog
Index: src/ui/dialog/filedialog.cpp
===================================================================
--- src/ui/dialog/filedialog.cpp (revision 13104)
+++ src/ui/dialog/filedialog.cpp (working copy)
@@ -1138,6 +1138,7 @@
Glib::ustring getFilename();
void change_title(const Glib::ustring& title);
+ void change_path(const Glib::ustring& dir);
private:
@@ -1355,7 +1356,7 @@
// leaving a trailing backslash on the directory name leads to the infamous
// double-directory bug on win32
if (len != 0 && udir[len - 1] == '\\') udir.erase(len - 1);
- set_current_folder(udir.c_str());
+ myFilename = udir;
}
//###### Add the file types menu
@@ -1455,10 +1456,7 @@
bool
FileSaveDialogImpl::show()
{
- Glib::ustring s = Glib::filename_to_utf8 (get_current_folder());
- if (s.length() == 0)
- s = getcwd (NULL, 0);
- set_current_folder(Glib::filename_from_utf8(s)); //hack to force initial dir listing
+ change_path(myFilename);
set_modal (TRUE); //Window
sp_transientize((GtkWidget *)gobj()); //Make transient
gint b = run(); //Dialog
@@ -1519,6 +1517,24 @@
this->set_title(title);
}
+/**
+ * Change the default save path location.
+ */
+void
+FileSaveDialogImpl::change_path(const Glib::ustring& path)
+{
+ myFilename = path;
+ if (Glib::file_test(myFilename, Glib::FILE_TEST_IS_DIR)) {
+ //fprintf(stderr,"set_current_folder(%s)\n",myFilename.c_str());
+ set_current_folder(myFilename);
+ } else {
+ //fprintf(stderr,"set_filename(%s)\n",myFilename.c_str());
+ set_filename(myFilename);
+ Glib::ustring basename = Glib::path_get_basename(myFilename);
+ //fprintf(stderr,"set_current_name(%s)\n",basename.c_str());
+ set_current_name(basename);
+ }
+}
Index: src/file.cpp
===================================================================
--- src/file.cpp (revision 13104)
+++ src/file.cpp (working copy)
@@ -589,7 +589,8 @@
save_loc.append(formatBuf);
}
} else {
- save_loc = Glib::path_get_dirname(doc->uri);
+ save_loc = Glib::build_filename(Glib::path_get_dirname(doc->uri),
+ Glib::path_get_basename(doc->uri));
}
// convert save_loc from utf-8 to locale
@@ -615,6 +616,8 @@
(char const *) _("Select file to save to"),
default_extension
);
+ else
+ saveDialogInstance->change_path(save_loc);
saveDialogInstance->change_title(dialog_title);
bool success = saveDialogInstance->show();
@@ -640,7 +643,7 @@
if (success)
prefs_set_recent_file(SP_DOCUMENT_URI(doc), SP_DOCUMENT_NAME(doc));
- save_path = fileName;
+ save_path = Glib::path_get_dirname(fileName);
prefs_set_string_attribute("dialogs.save_as", "path", save_path.c_str());
return success;
--
Kees Cook @outflux.net
16 years, 8 months
pr launched for 0.44.1
by Jon Phillips
I finally launched out the press barrage for 0.44.1
>From the looks of the tracker, there aren't many packages up there.
Also, could someone please post up a snippet or notice of the release up
on the main Inkscape blog. I don't know the process for doing it after
the site changeover.
Thanks!
Jon
--
Jon Phillips
San Francisco, CA
USA PH 510.499.0894
jon@...235...
http://www.rejon.org
MSN, AIM, Yahoo Chat: kidproto
Jabber Chat: rejon@...896...
IRC: rejon@...897...
Inkscape (http://inkscape.org)
Open Clip Art Library (www.openclipart.org)
Creative Commons (www.creativecommons.org)
San Francisco Art Institute (www.sfai.edu)
16 years, 8 months
metadata: general vs. specific in SVG
by Jon Phillips
So, one of the things I've wanted to work on is more specific metadata
usage per-object which we could hav UI for in Inkscape and for use in
Open Clip Art Library. I did some spelunking while doing research on
pippin's gegl (next generation gimp library,
http://pippin.gimp.org/gegl) and I found how to do this in SVG.
The SVG spec defines global and specific per object metadata:
SVG 1.1 standard
http://www.w3.org/TR/SVG11/metadata.html
SVG 1.2 working draft with more specifics
http://www.w3.org/TR/2004/WD-SVG12-20041027/nonvisual.html#external-metadata
Its really simple and is spelled out in the SVG 1.1 spec like so:
<svg>
<metadata>
<!-- general: any namespaced metadata, like rdf:rdf -->
</metadata>
<rect>
<metadata>
<!-- specific: namespaced metadata -->
</metadata>
</rect>
</svg>
Here is what the spec states about the specific metadata: "It is
strongly recommended that at most one 'metadata' element appear as a
child of any particular element, and that this element appear before any
other child elements (except possibly 'desc' or 'title' elements) or
character data content. If metadata-processing user agents need to
choose among multiple 'metadata' elements for processing it should
choose the first one."
Thus, what I think would be a good approach is to generalize Kees'
document metadata dialog into a panel which can be re-used and then
either we add an object metadata dialog (using Jon's panel work), or
just attach this functionality to the object properties dialog.
Thus, one could select any object and attach the same good ole quality
metadata we currently can set to the entire document.
Kees what do you think? Others, what do you think?
This would be awesome for asset management, right Andy, and would also
allow some cool features in compositing multiple elements from Open Clip
Art Library...
Jon
--
Jon Phillips
San Francisco, CA
USA PH 510.499.0894
jon@...235...
http://www.rejon.org
MSN, AIM, Yahoo Chat: kidproto
Jabber Chat: rejon@...896...
IRC: rejon@...897...
Inkscape (http://inkscape.org)
Open Clip Art Library (www.openclipart.org)
Creative Commons (www.creativecommons.org)
San Francisco Art Institute (www.sfai.edu)
16 years, 8 months
Re: [Inkscape-devel] Please clean up console output
by Johan Engelen
Bulia Byak wrote: [mailto:buliabyak@...400...]
> Here are some specific problems I found:
>
> 1. Several "** Message: arg" lines every time GUI is started.
> I think this is from the axonometric grid code by Johan
> Engelen (though I may be wrong).
>
> 2. "(inkscape:12768): Gtk-CRITICAL **: gtk_style_detach:
> assertion `style->attach_count > 0' failed" every time I quit
> Inkscape. Has been there for a long time already, though I
> don't know who's the culprit.
>
> 3. Three "(inkscape:12772): GLib-GObject-CRITICAL **:
> g_object_set_qdata_full: assertion `quark > 0' failed"
> warnings when I run Inkscape with a query, for example
> "inkscape -W file.svg". This warning originates in
> paramnotebook.cpp code, also by Johan - most likely the new
> code is unaware that Inkscape can be run without GUI, tries
> to do something GUIish and fails.
>
> 4. A stream of "(inkscape:12776): GLib-GObject-WARNING **:
> invalid cast from `SPCAxonomGrid' to `SPCGrid'" when I'm
> trying to use the new axonometric grid.
>
> 5. A "(inkscape:12778): Gtk-CRITICAL **: gtk_misc_set_alignment:
> assertion `GTK_IS_MISC (misc)' failed" when I open the
> Document Properties.
Ad 1. Correct. Removed the stupid debug message. I forgot about it. It is
actually not that handy to have a window in Inkscape which you have to
enable to see these messages :(
Ad 2. I cannot reproduce this one.
Ad 3. Will look into this later. I already knew in the back of my head that
Inkscape can be run without UI. On WinXP because the console output didn't
work, I forgot about it; thanks for making me remember!
Ad 5. Fixed. Had to do with the entry of the radiobutton-widget (which
gridtype to use) in the widgetlist.
Ad 4. Solution: do not use the axonometric grid with snapping! :P I
haven't had time to code the snapping thing yet for the axonometric grid;
and it is clear that some generalization of grid/snapping code and mechanism
is needed for this to work nicely. At the moment, I haven't changed any of
the snapping code, therefore invalid casts result.
I am sorry that the axonometric grid commit gives so many warnings/errors.
Especially the invalid cast to SPCGrid is nasty. I committed it so all can
see what the grid looks like on which I am working, so I can get comments on
how to improve things. Use on your own risk! :P
16 years, 8 months
wouldn't penitentiary
by Flora Malone
warming,A said Mark Pagani, professor of geology and geophysics at Yale
16 years, 8 months
Re: [Inkscape-devel] Please clean up console output
by Johan Engelen
> -----Original Message-----
> From: bulia byak [mailto:buliabyak@...400...]
> Sent: donderdag 28 september 2006 4:23
>
> Some of the recent commits resulted in various debug stuff
> and warnings output to console. Please don't leave it that
> way, clean up after yourself promptly.
Thanks for letting me know about these problems: I will try to fix them
ASAP.
I did not know about these warnings/errors because I don't see any: how can
I view console output in windows XP?
(running Inkscape from the commandline does not help)
Regards,
Johan
16 years, 8 months
Re: [Inkscape-devel] Tango style icons
by Ronan Zeegers
The first idea with this icons theme was not to follow strictly the
Tango guideline.
I Just wanted a style that fit well with the default tango gtk/gnome
icons (open, save, print, preferences...), very minimalist icons and
that can be fast and easy to read.
Some work and elements from the Tango icons have also been reused.
So, Tangoished for this theme is maybe not the best term...
I'm award of the new gimp icons that can be found here:
http://tango.freedesktop.org/ArtLibreSet
I think they don't fit exactly the minimalist idea behind my theme. But
I can take a closer look to the Tango guidelines and see if I can change
my icons and still stick to the original concept....
@graffoo:
> Also can you post a download link?
>
Yep. Before that, I have to work on lots of stuffs (menu icons) and
clean the icons.svg
I also have to take a closer look the icons size. The toolbar seems to
use a not very conventional 24x24 pix size...
Ronan Zeegers
16 years, 8 months
SoC outcome?
by bulia byak
There's a thread on the SoC list discussing the results for different
projects, which got me curious about, naturally, Inkscape :) I know my
projects turned out well, but what about the others? Could the mentors
share their experience?
--
bulia byak
Inkscape. Draw Freely.
http://www.inkscape.org
16 years, 8 months
'tabs' in extensions
by Ted Gould
Hey,
I've been out of it for a while, so I don't know that I get much of a
vote on this... but here's an idea:
Instead of making another parameter type for the tabs, we could allow it
to be a property of each parameter -- like a group tag. So then all the
parameters with the group 'help' would then be put together on the tab
'help'. Then it could be reorganized with other means also.
--Ted
16 years, 8 months