Logo Search packages:      
Sourcecode: inkscape version File versions

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

Callback for user input into fileNameEntry

Callback for fileNameEntry widget

Definition at line 704 of file filedialog.cpp.

References fileNameEntry.

Referenced by FileOpenDialogImpl().

{
    Glib::ustring fileName = fileNameEntry.get_text();

    // TODO remove this leak
    fileName = Glib::filename_from_utf8(fileName);

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

    if (!Glib::path_is_absolute(fileName)) {
        //try appending to the current path
        // not this way: fileName = get_current_folder() + "/" + fName;
        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", fName.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)) {
        //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