This commit is contained in:
fgerlits 2006-09-13 11:04:20 +00:00
parent f069b3ead9
commit 5db1edfdeb
3 changed files with 16 additions and 7 deletions

View File

@ -374,12 +374,7 @@ GLiveSupport :: configure(const xmlpp::Element & element)
// save the configuration so we can modify it later
// TODO: move configuration code to the OptionsContainer class?
Ptr<Glib::ustring>::Ref configFileName(new Glib::ustring);
struct passwd * pwd = getpwuid(getuid());
if (pwd) {
configFileName->append(pwd->pw_dir);
} else {
throw std::logic_error("this never happens: getpwuid() returned 0");
}
configFileName->append(Glib::get_home_dir());
configFileName->append(configFileDirStr);
mkdir(configFileName->c_str(), 0700); // create dir if does not exist
configFileName->append(configFileNameStr);

View File

@ -254,6 +254,9 @@ UploadFileWindow :: UploadFileWindow (
closeButton->signal_clicked().connect(sigc::mem_fun(*this,
&UploadFileWindow::onCloseButtonClicked));
// set the file chooser's default folder to the user's home directory
fileChooserFolder = Glib::get_home_dir();
// show everything
set_name("uploadFileWindow");
set_default_size(350, 500);
@ -281,11 +284,15 @@ UploadFileWindow :: onChooseFileButtonClicked(void) throw ()
std::exit(1);
}
dialog->set_name("uploadFileChooserDialog");
gLiveSupport->getWindowPosition(dialog);
dialog->set_current_folder(fileChooserFolder);
dialog->set_transient_for(*this);
//Add response buttons the the dialog:
dialog->add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
dialog->add_button(Gtk::Stock::OPEN, Gtk::RESPONSE_OK);
dialog->add_button(Gtk::Stock::OPEN, Gtk::RESPONSE_OK);
int result = dialog->run();
@ -293,6 +300,8 @@ UploadFileWindow :: onChooseFileButtonClicked(void) throw ()
clearEverything();
fileNameEntry->set_text(dialog->get_filename());
updateFileInfo();
fileChooserFolder = dialog->get_current_folder();
gLiveSupport->putWindowPosition(dialog);
}
}

View File

@ -203,6 +203,11 @@ class UploadFileWindow : public GuiWindow
*/
FileType fileType;
/**
* The starting folder for the file chooser dialog.
*/
Glib::ustring fileChooserFolder;
/**
* Update the information for the file to upload, based on the
* value of the fileNameEntry text entry field.