Logo Search packages:      
Sourcecode: inkscape version File versions

void Inkscape::UI::Dialogs::FileSaveDialogImpl::fileNameEntryChangedCallback (  )  [private]

Callback for user input into fileNameEntry

Callback for fileNameEntry widget

Definition at line 1087 of file filedialog.cpp.

References fileNameEntry.

Referenced by FileSaveDialogImpl().

{
    if (!fileNameEntry)
        return;

    Glib::ustring fileName = fileNameEntry->get_text();
    if (!Glib::get_charset()) //If we are not utf8
        fileName = Glib::filename_to_utf8(fileName);

    //g_message("User hit return.  Text is '%s'\n", fileName.c_str());

    if (!Glib::path_is_absolute(fileName)) {
        //try appending to the current path
        // not this way: fileName = get_current_folder() + "/" + fileName;
        std::vector<Glib::ustring> pathSegments;
        pathSegments.push_back( get_current_folder() );
        pathSegments.push_back( fileName );
        fileName = Glib::build_filename(pathSegments);
    }

    //g_message("path:'%s'\n", fileName.c_str());

    if (Glib::file_test(fileName, Glib::FILE_TEST_IS_DIR)) {
        set_current_folder(fileName);
    } else if (/*Glib::file_test(fileName, Glib::FILE_TEST_IS_REGULAR)*/1) {
        //dialog with either (1) select a regular file or (2) cd to dir
        //simulate an 'OK'
        set_filename(fileName);
        response(Gtk::RESPONSE_OK);
    }
}


Generated by  Doxygen 1.6.0   Back to index