index 818de6f2dcbf179539b429edd9d74b7c886aab04..08c0d411615c801106332b5a31816862a84cb491 100644 (file)
//Another hack
#include <gtk/gtkentry.h>
#include <gtk/gtkexpander.h>
+#ifdef WITH_GNOME_VFS
+# include <libgnomevfs/gnome-vfs-init.h> // gnome_vfs_initialized
+#endif
fileName = Glib::filename_to_utf8(fileName);
- SPDocument *doc = sp_document_new (fileName.c_str(), 0);
+ /**
+ * I don't know why passing false to keepalive is bad. But it
+ * prevents the display of an svg with a non-ascii filename
+ */
+ SPDocument *doc = sp_document_new (fileName.c_str(), true);
if (!doc) {
g_warning("SVGView: error loading document '%s'\n", fileName.c_str());
return false;
if (!Glib::file_test(fileName, Glib::FILE_TEST_EXISTS))
return false;
- g_message("fname:%s", fileName.c_str());
+ //g_message("fname:%s", fileName.c_str());
if (Glib::file_test(fileName, Glib::FILE_TEST_IS_DIR)) {
showNoPreview();
Glib::ustring fileName = get_preview_filename();
#ifdef WITH_GNOME_VFS
- if (fileName.length() < 1)
+ if ( fileName.empty() && gnome_vfs_initialized() ) {
fileName = get_preview_uri();
+ }
#endif
- if (fileName.length() < 1)
+ if (fileName.empty()) {
return;
+ }
svgPreview.set(fileName, dialogType);
}
void FileOpenDialogImpl::createFilterMenu()
{
- //patterns added dynamically below
- Gtk::FileFilter allImageFilter;
- allImageFilter.set_name(_("All Images"));
- extensionMap[Glib::ustring(_("All Images"))]=NULL;
- add_filter(allImageFilter);
+ Gtk::FileFilter allInkscapeFilter;
+ allInkscapeFilter.set_name(_("All Inkscape Files"));
+ extensionMap[Glib::ustring(_("All Inkscape Files"))]=NULL;
+ add_filter(allInkscapeFilter);
Gtk::FileFilter allFilter;
allFilter.set_name(_("All Files"));
allFilter.add_pattern("*");
add_filter(allFilter);
- //patterns added dynamically below
- Gtk::FileFilter allInkscapeFilter;
- allInkscapeFilter.set_name(_("All Inkscape Files"));
- extensionMap[Glib::ustring(_("All Inkscape Files"))]=NULL;
- add_filter(allInkscapeFilter);
+ Gtk::FileFilter allImageFilter;
+ allImageFilter.set_name(_("All Images"));
+ extensionMap[Glib::ustring(_("All Images"))]=NULL;
+ add_filter(allImageFilter);
+ //patterns added dynamically below
Inkscape::Extension::DB::InputList extension_list;
Inkscape::Extension::db.get_input_list(extension_list);
set_select_multiple(true);
#ifdef WITH_GNOME_VFS
- set_local_only(false);
+ if (gnome_vfs_initialized()) {
+ set_local_only(false);
+ }
#endif
/* Initalize to Autodetect */
}
myFilename = get_filename();
#ifdef WITH_GNOME_VFS
- if (myFilename.length() < 1)
+ if (myFilename.empty() && gnome_vfs_initialized())
myFilename = get_uri();
#endif
cleanup( true );
{
std::vector<Glib::ustring> result = get_filenames();
#ifdef WITH_GNOME_VFS
- if (result.empty())
+ if (result.empty() && gnome_vfs_initialized())
result = get_uris();
#endif
return result;
set_select_multiple(false);
#ifdef WITH_GNOME_VFS
- set_local_only(false);
+ if (gnome_vfs_initialized()) {
+ set_local_only(false);
+ }
#endif
/* Initalize to Autodetect */
void FileSaveDialogImpl::setSelectionType( Inkscape::Extension::Extension * key )
{
- extension = key;
-
// If no pointer to extension is passed in, look up based on filename extension.
- if ( !extension ) {
+ if ( !key ) {
// Not quite UTF-8 here.
gchar *filenameLower = g_ascii_strdown(myFilename.c_str(), -1);
- for ( int i = 0; !extension && (i < (int)fileTypes.size()); i++ ) {
+ for ( int i = 0; !key && (i < (int)fileTypes.size()); i++ ) {
Inkscape::Extension::Output *ext = dynamic_cast<Inkscape::Extension::Output*>(fileTypes[i].extension);
if ( ext && ext->get_extension() ) {
gchar *extensionLower = g_ascii_strdown( ext->get_extension(), -1 );
if ( g_str_has_suffix(filenameLower, extensionLower) ) {
- extension = fileTypes[i].extension;
+ key = fileTypes[i].extension;
}
g_free(extensionLower);
}
@@ -1480,7 +1490,8 @@ void FileSaveDialogImpl::setSelectionType( Inkscape::Extension::Extension * key
}
// Ensure the proper entry in the combo box is selected.
- if ( extension ) {
+ if ( key ) {
+ extension = key;
gchar const * extensionID = extension->get_id();
if ( extensionID ) {
for ( int i = 0; i < (int)fileTypes.size(); i++ ) {
// Pick up any changes the user has typed in.
Glib::ustring tmp = get_filename();
#ifdef WITH_GNOME_VFS
- if ( tmp.empty() ) {
+ if ( tmp.empty() && gnome_vfs_initialized() ) {
tmp = get_uri();
}
#endif
set_select_multiple(false);
#ifdef WITH_GNOME_VFS
- set_local_only(false);
+ if (gnome_vfs_initialized()) {
+ set_local_only(false);
+ }
#endif
/* Initalize to Autodetect */
}
myFilename = get_filename();
#ifdef WITH_GNOME_VFS
- if (myFilename.length() < 1)
+ if ( myFilename.empty() && gnome_vfs_initialized() ) {
myFilename = get_uri();
+ }
#endif
/*