]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/filepicker.cpp
Vietnamese translations update from Trần Ngọc Quân.
[wxWidgets.git] / src / gtk / filepicker.cpp
index 2b0f7fca9e8d7b468fc9f1ffcf33a9c129caf6a9..62ee1f45117abbcc8544ce4972aae41666f4da9e 100644 (file)
@@ -80,9 +80,7 @@ bool wxFileButton::Create( wxWindow *parent, wxWindowID id,
 
         //       use as label the currently selected file
         m_widget = gtk_file_chooser_button_new_with_dialog( m_dialog->m_widget );
-
         g_object_ref(m_widget);
-        gtk_widget_show(m_widget);
 
         // we need to know when the dialog has been dismissed clicking OK...
         // NOTE: the "clicked" signal is not available for a GtkFileChooserButton
@@ -129,6 +127,14 @@ void wxFileButton::SetPath(const wxString &str)
         UpdateDialogPath(m_dialog);
 }
 
+void wxFileButton::SetInitialDirectory(const wxString& dir)
+{
+    if (m_dialog)
+        DoSetInitialDirectory(static_cast<wxFileDialog*>(m_dialog), dir);
+    else
+        wxGenericFileButton::SetInitialDirectory(dir);
+}
+
 #endif      // wxUSE_FILEPICKERCTRL && defined(__WXGTK26__)
 
 
@@ -136,7 +142,9 @@ void wxFileButton::SetPath(const wxString &str)
 
 #if wxUSE_DIRPICKERCTRL && defined(__WXGTK26__)
 
+#ifdef __UNIX__
 #include <unistd.h> // chdir
+#endif
 
 //-----------------------------------------------------------------------------
 // "current-folder-changed"
@@ -227,9 +235,6 @@ bool wxDirButton::Create( wxWindow *parent, wxWindowID id,
         m_widget = gtk_file_chooser_button_new_with_dialog( m_dialog->m_widget );
         g_object_ref(m_widget);
 
-
-        gtk_widget_show(m_widget);
-
         // GtkFileChooserButton signals
         g_signal_connect(m_widget, "current-folder-changed",
                          G_CALLBACK(gtk_dirbutton_currentfolderchanged_callback), this);
@@ -274,4 +279,15 @@ void wxDirButton::SetPath(const wxString& str)
         UpdateDialogPath(m_dialog);
 }
 
+void wxDirButton::SetInitialDirectory(const wxString& dir)
+{
+    if (m_dialog)
+    {
+        if (m_path.empty())
+            static_cast<wxDirDialog*>(m_dialog)->SetPath(dir);
+    }
+    else
+        wxGenericDirButton::SetInitialDirectory(dir);
+}
+
 #endif      // wxUSE_DIRPICKERCTRL && defined(__WXGTK26__)