index 1405e11aa0700c4f62f116c6ab210ee0acbabff4..b93e7837acbee80737acae44a23811693a3a5b4f 100644 (file)
*
* Copyright (C) 2004-2007 Bob Jamison
* Copyright (C) 2006 Johan Engelen <johan@shouraizou.nl>
+ * Copyright (C) 2007-2008 Joel Holdsworth
* Copyright (C) 2004-2007 The Inkscape Organization
- * Copyright (C) 2007 Joel Holdsworth
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
set_default(*add_button(Gtk::Stock::OPEN, Gtk::RESPONSE_OK));
-
- //###### Allow easy access to our examples folder
- if(Inkscape::IO::file_test(INKSCAPE_EXAMPLESDIR,
- (GFileTest)(G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR)))
- {
+
+ //###### Allow easy access to our examples folder
+ if ( Inkscape::IO::file_test(INKSCAPE_EXAMPLESDIR, G_FILE_TEST_EXISTS)
+ && Inkscape::IO::file_test(INKSCAPE_EXAMPLESDIR, G_FILE_TEST_IS_DIR)
+ && g_path_is_absolute(INKSCAPE_EXAMPLESDIR)
+ )
+ {
add_shortcut_folder(INKSCAPE_EXAMPLESDIR);
}
}
bool
FileOpenDialogImplGtk::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
set_modal (TRUE); //Window
sp_transientize((GtkWidget *)gobj()); //Make transient
gint b = run(); //Dialog
expander->set_expanded(true);
}
- // allow easy access to the user's own templates folder
+ // allow easy access to the user's own templates folder
gchar *templates = profile_path ("templates");
- if (Inkscape::IO::file_test(templates, (GFileTest)(G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR)))
+ if ( Inkscape::IO::file_test(templates, G_FILE_TEST_EXISTS)
+ && Inkscape::IO::file_test(templates, G_FILE_TEST_IS_DIR)
+ && g_path_is_absolute(templates)
+ )
+ {
add_shortcut_folder(templates);
+ }
g_free (templates);
-
-
+
+
//if (extension == NULL)
// checkbox.set_sensitive(FALSE);
@@ -1141,7 +1144,7 @@ void FileSaveDialogImplGtk::setSelectionType( Inkscape::Extension::Extension * k
Glib::ustring FileSaveDialogImplGtk::getCurrentDirectory()
{
- return get_current_folder();
+ return get_current_folder();
}
void
FileSaveDialogImplGtk::change_path(const Glib::ustring& path)
{
- myFilename = 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);
Inkscape::Extension::Output* newOut = extension ? dynamic_cast<Inkscape::Extension::Output*>(extension) : 0;
if ( fileTypeCheckbox.get_active() && newOut ) {
- // Append the file extension if it's not already present
- appendExtension(myFilename, newOut);
+ // Append the file extension if it's not already present
+ appendExtension(myFilename, newOut);
}
}