summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 993a89c)
raw | patch | inline | side by side (parent: 993a89c)
author | ishmal <ishmal@users.sourceforge.net> | |
Thu, 13 Jul 2006 00:23:44 +0000 (00:23 +0000) | ||
committer | ishmal <ishmal@users.sourceforge.net> | |
Thu, 13 Jul 2006 00:23:44 +0000 (00:23 +0000) |
src/ui/dialog/filedialog.cpp | patch | blob | history |
index 8a1fc492ed461eb529c29093198ac70ad0073e99..e3ebffc632bc8eabc0d5b6572812493352aca8c2 100644 (file)
+/*#########################################################################
+### F I L E D I A L O G B A S E C L A S S
+#########################################################################*/
+
+/**
+ * This class is the base implementation for the others. This
+ * reduces redundancies and bugs.
+ */
+class FileDialogBase : public Gtk::FileChooserDialog
+{
+public:
+
+ /**
+ *
+ */
+ FileDialogBase(const Glib::ustring &title) :
+ Gtk::FileChooserDialog(title)
+ {
+ }
+
+ /**
+ *
+ */
+ FileDialogBase(const Glib::ustring &title,
+ Gtk::FileChooserAction dialogType) :
+ Gtk::FileChooserDialog(title, dialogType)
+ {
+ }
+
+ /**
+ *
+ */
+ virtual ~FileDialogBase()
+ {}
+
+};
+
+
+
/*#########################################################################
### F I L E O P E N
#########################################################################*/
/**
* Our implementation class for the FileOpenDialog interface..
*/
-class FileOpenDialogImpl : public FileOpenDialog, public Gtk::FileChooserDialog
+class FileOpenDialogImpl : public FileOpenDialog, public FileDialogBase
{
public:
+
FileOpenDialogImpl(const Glib::ustring &dir,
FileDialogType fileTypes,
const Glib::ustring &title);
gchar *getFilename();
Glib::SListHandle<Glib::ustring> getFilenames ();
+
protected:
*/
void FileOpenDialogImpl::fileNameEntryChangedCallback()
{
- Glib::ustring fileName = fileNameEntry.get_text();
+ Glib::ustring rawFileName = fileNameEntry.get_text();
- // TODO remove this leak
- fileName = Glib::filename_from_utf8(fileName);
+ Glib::ustring fileName = Glib::filename_from_utf8(rawFileName);
- //g_message("User hit return. Text is '%s'\n", fName.c_str());
+ //g_message("User hit return. Text is '%s'\n", fileName.c_str());
if (!Glib::path_is_absolute(fileName)) {
//try appending to the current path
FileOpenDialogImpl::FileOpenDialogImpl(const Glib::ustring &dir,
FileDialogType fileTypes,
const Glib::ustring &title) :
- Gtk::FileChooserDialog(title)
+ FileDialogBase(title)
{
/**
* Our implementation of the FileSaveDialog interface.
*/
-class FileSaveDialogImpl : public FileSaveDialog, public Gtk::FileChooserDialog
+class FileSaveDialogImpl : public FileSaveDialog, public FileDialogBase
{
public:
* Constructor
*/
FileSaveDialogImpl::FileSaveDialogImpl(const Glib::ustring &dir,
- FileDialogType fileTypes,
- const Glib::ustring &title,
- const Glib::ustring &default_key) :
- Gtk::FileChooserDialog(title, Gtk::FILE_CHOOSER_ACTION_SAVE)
+ FileDialogType fileTypes,
+ const Glib::ustring &title,
+ const Glib::ustring &default_key) :
+ FileDialogBase(title, Gtk::FILE_CHOOSER_ACTION_SAVE)
{
append_extension = (bool)prefs_get_int_attribute("dialogs.save_as",
"append_extension", 1);
/**
* Our implementation of the FileExportDialog interface.
*/
-class FileExportDialogImpl : public FileExportDialog, public Gtk::FileChooserDialog
+class FileExportDialogImpl : public FileExportDialog, public FileDialogBase
{
public:
* Constructor
*/
FileExportDialogImpl::FileExportDialogImpl(const Glib::ustring &dir,
- FileDialogType fileTypes,
- const Glib::ustring &title,
- const Glib::ustring &default_key) :
- Gtk::FileChooserDialog(title, Gtk::FILE_CHOOSER_ACTION_SAVE)
+ FileDialogType fileTypes,
+ const Glib::ustring &title,
+ const Glib::ustring &default_key) :
+ FileDialogBase(title, Gtk::FILE_CHOOSER_ACTION_SAVE)
{
append_extension = (bool)prefs_get_int_attribute("dialogs.save_as", "append_extension", 1);