From 0f4eb09b61ba2b30a349fa11014176df2c0ace5f Mon Sep 17 00:00:00 2001 From: Peter Moulder Date: Thu, 21 Jun 2007 09:05:40 +0000 Subject: Handle the case of gnome_vfs_init failing. (Fixes Debian bug http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=415640.) (bzr r3082) --- src/ui/dialog/filedialog.cpp | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/filedialog.cpp b/src/ui/dialog/filedialog.cpp index b6c35140e..2a5ededbb 100644 --- a/src/ui/dialog/filedialog.cpp +++ b/src/ui/dialog/filedialog.cpp @@ -34,6 +34,9 @@ //Another hack #include #include +#ifdef WITH_GNOME_VFS +# include // gnome_vfs_initialized +#endif @@ -821,12 +824,14 @@ void FileDialogBase::_updatePreviewCallback() 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); } @@ -955,7 +960,9 @@ FileOpenDialogImpl::FileOpenDialogImpl(const Glib::ustring &dir, set_select_multiple(true); #ifdef WITH_GNOME_VFS - set_local_only(false); + if (gnome_vfs_initialized()) { + set_local_only(false); + } #endif /* Initalize to Autodetect */ @@ -1047,7 +1054,7 @@ FileOpenDialogImpl::show() } myFilename = get_filename(); #ifdef WITH_GNOME_VFS - if (myFilename.length() < 1) + if (myFilename.empty() && gnome_vfs_initialized()) myFilename = get_uri(); #endif cleanup( true ); @@ -1090,7 +1097,7 @@ std::vectorFileOpenDialogImpl::getFilenames() { std::vector result = get_filenames(); #ifdef WITH_GNOME_VFS - if (result.empty()) + if (result.empty() && gnome_vfs_initialized()) result = get_uris(); #endif return result; @@ -1311,7 +1318,9 @@ FileSaveDialogImpl::FileSaveDialogImpl(const Glib::ustring &dir, set_select_multiple(false); #ifdef WITH_GNOME_VFS - set_local_only(false); + if (gnome_vfs_initialized()) { + set_local_only(false); + } #endif /* Initalize to Autodetect */ @@ -1557,7 +1566,7 @@ void FileSaveDialogImpl::updateNameAndExtension() // 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 @@ -1932,7 +1941,9 @@ FileExportDialogImpl::FileExportDialogImpl(const Glib::ustring &dir, set_select_multiple(false); #ifdef WITH_GNOME_VFS - set_local_only(false); + if (gnome_vfs_initialized()) { + set_local_only(false); + } #endif /* Initalize to Autodetect */ @@ -2141,8 +2152,9 @@ FileExportDialogImpl::show() } myFilename = get_filename(); #ifdef WITH_GNOME_VFS - if (myFilename.length() < 1) + if ( myFilename.empty() && gnome_vfs_initialized() ) { myFilename = get_uri(); + } #endif /* -- cgit v1.2.3