]> git.saurik.com Git - wxWidgets.git/commitdiff
fixed to not duplicate code needlessly; clarified why gtk_file_chooser_set_current_na...
authorVáclav Slavík <vslavik@fastmail.fm>
Sun, 28 Nov 2004 09:33:43 +0000 (09:33 +0000)
committerVáclav Slavík <vslavik@fastmail.fm>
Sun, 28 Nov 2004 09:33:43 +0000 (09:33 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@30804 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/gtk/filedlg.cpp
src/gtk1/filedlg.cpp

index 04aa374d7967ae63bd0ebf6ed371728389118de8..929c0ccd68a4e6505ee22d8f9b1e92f431295222 100644 (file)
@@ -237,21 +237,9 @@ void wxFileDialog::SetPath(const wxString& path)
 
     wxFileName fn(path);
     m_path = fn.GetFullPath();
 
     wxFileName fn(path);
     m_path = fn.GetFullPath();
-    m_dir = fn.GetPath();
-    m_fileName = fn.GetFullName();
     
     
-    gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(m_widget),
-                                            wxGTK_CONV(m_dir));
-                                            
-    gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(m_widget),
-                                      wxGTK_CONV(m_path));
-                                      
-    // pre-fill the filename, too:
-    if (GetWindowStyle() & wxSAVE) // Why only then??
-    {
-        gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(m_widget),
-                                              wxGTK_CONV(m_fileName));
-    }
+    SetDirectory(fn.GetPath());
+    SetFilename(fn.GetFullName());
 }
 
 void wxFileDialog::SetDirectory(const wxString& dir)
 }
 
 void wxFileDialog::SetDirectory(const wxString& dir)
@@ -275,8 +263,10 @@ void wxFileDialog::SetFilename(const wxString& name)
     gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(m_widget),
                                       wxGTK_CONV(m_path));
 
     gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(m_widget),
                                       wxGTK_CONV(m_path));
 
-    // pre-fill the filename, too:
-    if (GetWindowStyle() & wxSAVE) // Why only then??
+    // pre-fill the filename when saving, too (there's no text entry
+    // control when opening a file, so it doesn't make sense to
+    // do this in when opening files):
+    if (GetWindowStyle() & wxSAVE)
     {
         gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(m_widget),
                                               wxGTK_CONV(m_fileName));
     {
         gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(m_widget),
                                               wxGTK_CONV(m_fileName));
index 04aa374d7967ae63bd0ebf6ed371728389118de8..929c0ccd68a4e6505ee22d8f9b1e92f431295222 100644 (file)
@@ -237,21 +237,9 @@ void wxFileDialog::SetPath(const wxString& path)
 
     wxFileName fn(path);
     m_path = fn.GetFullPath();
 
     wxFileName fn(path);
     m_path = fn.GetFullPath();
-    m_dir = fn.GetPath();
-    m_fileName = fn.GetFullName();
     
     
-    gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(m_widget),
-                                            wxGTK_CONV(m_dir));
-                                            
-    gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(m_widget),
-                                      wxGTK_CONV(m_path));
-                                      
-    // pre-fill the filename, too:
-    if (GetWindowStyle() & wxSAVE) // Why only then??
-    {
-        gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(m_widget),
-                                              wxGTK_CONV(m_fileName));
-    }
+    SetDirectory(fn.GetPath());
+    SetFilename(fn.GetFullName());
 }
 
 void wxFileDialog::SetDirectory(const wxString& dir)
 }
 
 void wxFileDialog::SetDirectory(const wxString& dir)
@@ -275,8 +263,10 @@ void wxFileDialog::SetFilename(const wxString& name)
     gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(m_widget),
                                       wxGTK_CONV(m_path));
 
     gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(m_widget),
                                       wxGTK_CONV(m_path));
 
-    // pre-fill the filename, too:
-    if (GetWindowStyle() & wxSAVE) // Why only then??
+    // pre-fill the filename when saving, too (there's no text entry
+    // control when opening a file, so it doesn't make sense to
+    // do this in when opening files):
+    if (GetWindowStyle() & wxSAVE)
     {
         gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(m_widget),
                                               wxGTK_CONV(m_fileName));
     {
         gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(m_widget),
                                               wxGTK_CONV(m_fileName));