- // GtkFileChooserButton will automatically destroy the
- // GtkFileChooserDialog associated with m_dialog.
- // Thus we have to set its m_widget to NULL to avoid
- // double destruction on same widget
- m_dialog->m_widget = NULL;
+}
+
+void wxDirButton::GTKUpdatePath(const char *gtkpath)
+{
+ m_path = wxString::FromUTF8(gtkpath);
+}
+void wxDirButton::SetPath(const wxString& str)
+{
+ if ( m_path == str )
+ {
+ // don't do anything and especially don't set m_bIgnoreNextChange
+ return;
+ }
+
+ m_path = str;
+
+ // wxDirButton uses the "current-folder-changed" signal which is triggered also
+ // when we set the path on the dialog associated with this button; thus we need
+ // to set the following flag to avoid sending a wxFileDirPickerEvent from this
+ // function (which would be inconsistent with wxFileButton's behaviour and in
+ // general with all wxWidgets control-manipulation functions which do not send events).
+ m_bIgnoreNextChange = true;
+
+ if (m_dialog)
+ 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);