[Git][wxwidgets/wxwidgets][master] Fix wxDirPickerCtrl wxDIRP_DIR_MUST_EXIST handling with GTK

1 view
Skip to first unread message

Vadim Zeitlin (@_VZ_)

unread,
Oct 24, 2025, 5:57:04 PMOct 24
to wx-commi...@googlegroups.com

Vadim Zeitlin pushed to branch master at wxWidgets / wxWidgets

Commits:

  • 7729d065
    by Paul Cornett at 2025-10-24T14:23:17-07:00
    Fix wxDirPickerCtrl wxDIRP_DIR_MUST_EXIST handling with GTK
    
    While it's true GtkFileChooserButton does not support
    GTK_FILE_CHOOSER_CREATE_FOLDER, we're using our own dialog,
    and GtkFileChooserDialog does support it.
    

2 changed files:

Changes:

  • src/gtk/dirdlg.cpp
    ... ... @@ -142,14 +142,18 @@ bool wxDirDialog::Create(wxWindow* parent,
    142 142
         {
    
    143 143
             gtk_file_chooser_set_create_folders(
    
    144 144
                 m_fileChooser, !HasFlag(wxDD_DIR_MUST_EXIST));
    
    145
    +        gtk_file_chooser_set_create_folders(
    
    146
    +            (GtkFileChooser*)m_widget, !HasFlag(wxDD_DIR_MUST_EXIST));
    
    145 147
         }
    
    146 148
     #endif
    
    147 149
     
    
    148 150
         // Enable multiple selection if desired
    
    149 151
         gtk_file_chooser_set_select_multiple(m_fileChooser, HasFlag(wxDD_MULTIPLE));
    
    152
    +    gtk_file_chooser_set_select_multiple((GtkFileChooser*)m_widget, HasFlag(wxDD_MULTIPLE));
    
    150 153
     
    
    151 154
         // Enable show hidden folders if desired
    
    152 155
         gtk_file_chooser_set_show_hidden(m_fileChooser, HasFlag(wxDD_SHOW_HIDDEN));
    
    156
    +    gtk_file_chooser_set_show_hidden((GtkFileChooser*)m_widget, HasFlag(wxDD_SHOW_HIDDEN));
    
    153 157
     
    
    154 158
         // local-only property could be set to false to allow non-local files to be loaded.
    
    155 159
         // In that case get/set_uri(s) should be used instead of get/set_filename(s) everywhere
    

  • src/gtk/filepicker.cpp
    ... ... @@ -310,14 +310,12 @@ bool wxDirButton::Create( wxWindow *parent, wxWindowID id,
    310 310
     
    
    311 311
             m_path = path;
    
    312 312
     
    
    313
    -        // GtkFileChooserButton does not support GTK_FILE_CHOOSER_CREATE_FOLDER
    
    314
    -        // thus we must ensure that the wxDD_DIR_MUST_EXIST style was given
    
    315 313
             m_dialog = new wxDirDialog
    
    316 314
                            (
    
    317 315
                                 nullptr,
    
    318 316
                                 message,
    
    319 317
                                 m_path.empty() ? m_initialDir : m_path,
    
    320
    -                            wxGenericDirButton::GetDialogStyle(style | wxDIRP_DIR_MUST_EXIST)
    
    318
    +                            wxGenericDirButton::GetDialogStyle(style)
    
    321 319
                            );
    
    322 320
     
    
    323 321
             // little trick used to avoid problems when there are other GTK windows 'grabbed':
    


View it on GitLab.
You're receiving this email because of your account on gitlab.com. Manage all notifications · Help Notification message regarding https://gitlab.com/wxwidgets/wxwidgets/-/commit/7729d065a98c3e96c34c57eb9b2e6970b90effca at 1761343021

Reply all
Reply to author
Forward
0 new messages