vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx |    3 +++
 1 file changed, 3 insertions(+)

New commits:
commit 521bcdc4535555a45934a6e224a96aa87bbef659
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Fri Mar 7 06:10:49 2025 +0100
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Fri Mar 7 18:04:08 2025 +0100

    tdf#162995 gtk4: Show extra controls in file dialog
    
    While the custom widgets for the file chooser were
    created for the gtk4 case as well, they were never
    added to the dialog because the call to
    `gtk_file_chooser_set_extra_widget` only happens for the
    gtk3 VCL plugin.
    That GTK function is no longer available in GTK 4.
    
    For gtk4, use gtk_dialog_get_content_area to get
    the GtkBox holding the dialog content, and add the
    GtkBox holding our custom controls to it manually.
    
    With this in place, it's now e.g. possible to save a
    file with password protection by checking the "Save with password"
    checkbox in the "File" -> "Save As" dialog.
    
    Currently, too many controls are visible there for gtk4, but that
    will be addressed in a separate commit.
    
    Change-Id: If351c24010702e374adb816366892d9ed5280d17
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182609
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx 
b/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx
index 00557acf192f..c935b3f8488c 100644
--- a/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx
+++ b/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx
@@ -323,6 +323,9 @@ SalGtkFilePicker::SalGtkFilePicker( const uno::Reference< 
uno::XComponentContext
 
 #if !GTK_CHECK_VERSION(4, 0, 0)
     gtk_file_chooser_set_extra_widget( GTK_FILE_CHOOSER( m_pDialog ), m_pVBox 
);
+#else
+    GtkBox* pContentBox = 
GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(m_pDialog)));
+    gtk_box_append(pContentBox, m_pVBox);
 #endif
 
     m_pPreview = gtk_image_new();

Reply via email to