From 5db1edfdeb9ccd5ff276677acc3748cde6110d78 Mon Sep 17 00:00:00 2001 From: fgerlits Date: Wed, 13 Sep 2006 11:04:20 +0000 Subject: [PATCH] fixing #1799 --- .../src/products/gLiveSupport/src/GLiveSupport.cxx | 7 +------ .../products/gLiveSupport/src/UploadFileWindow.cxx | 11 ++++++++++- .../src/products/gLiveSupport/src/UploadFileWindow.h | 5 +++++ 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/livesupport/src/products/gLiveSupport/src/GLiveSupport.cxx b/livesupport/src/products/gLiveSupport/src/GLiveSupport.cxx index 6ec6f2717..60ec1dd88 100644 --- a/livesupport/src/products/gLiveSupport/src/GLiveSupport.cxx +++ b/livesupport/src/products/gLiveSupport/src/GLiveSupport.cxx @@ -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::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); diff --git a/livesupport/src/products/gLiveSupport/src/UploadFileWindow.cxx b/livesupport/src/products/gLiveSupport/src/UploadFileWindow.cxx index ddb37982b..54bcd8fb2 100644 --- a/livesupport/src/products/gLiveSupport/src/UploadFileWindow.cxx +++ b/livesupport/src/products/gLiveSupport/src/UploadFileWindow.cxx @@ -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); } } diff --git a/livesupport/src/products/gLiveSupport/src/UploadFileWindow.h b/livesupport/src/products/gLiveSupport/src/UploadFileWindow.h index 7aaee1406..9efbdf7fd 100644 --- a/livesupport/src/products/gLiveSupport/src/UploadFileWindow.h +++ b/livesupport/src/products/gLiveSupport/src/UploadFileWindow.h @@ -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.