Bug 162995 - gtk4: Extra controls are missing in file dialog
Summary: gtk4: Extra controls are missing in file dialog
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: graphics stack (show other bugs)
Version:
(earliest affected)
25.2.0.0 alpha0+
Hardware: All Linux (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Gtk4
  Show dependency treegraph
 
Reported: 2024-09-16 16:48 UTC by Michael Weghorn
Modified: 2024-11-13 17:20 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Weghorn 2024-09-16 16:48:14 UTC
Steps to reproduce:

1) Start Writer, using the gtk4 VCL plugin on Linux
2) press Ctrl+Shift+S to open the save dialog

Actual result:
The file dialog opens. However, extra controls like the "Save with password" or "Encrypt with GPG key" checkboxes seen with the gtk3, gen or qt6 VCL plugins are not there, making that functionality unavailable.

Expected result:
Above-mentioned checkboxes (and more) should be present, allowing e.g. to save a file protected by a password.

Version: 25.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: a4a2cfa1bf746a4c1d379757c99d35ef5ac42cd3
CPU threads: 32; OS: Linux 6.10; UI render: default; VCL: gtk4
Locale: en-GB (en_GB.UTF-8); UI: en-US
Calc: CL threaded
Comment 1 Caolán McNamara 2024-09-17 11:28:31 UTC
Code for these is in vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx in SalGtkFilePicker::SalGtkFilePicker I think. There are various GTK_CHECK_VERSION conditionals in there, but I think it should generally work so hopefully something minor like requiring these to be explicitly shown where maybe that was implicit in earlier versions of gtk
Comment 2 Michael Weghorn 2024-09-17 12:35:52 UTC
(In reply to Caolán McNamara from comment #1)
> Code for these is in vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx in
> SalGtkFilePicker::SalGtkFilePicker I think. There are various
> GTK_CHECK_VERSION conditionals in there, but I think it should generally
> work so hopefully something minor like requiring these to be explicitly
> shown where maybe that was implicit in earlier versions of gtk

This line there looks relevant:

#if !GTK_CHECK_VERSION(4, 0, 0)
    gtk_file_chooser_set_extra_widget( GTK_FILE_CHOOSER( m_pDialog ), m_pVBox );
#endif

Items are added to m_pVBox for GTK 4 as well, but I don't see where m_pVBox is added to the file chooser.

`gtk_file_chooser_set_extra_widget` seems gone for GTK 4, the doc for GtkFileChooser [1] mentions this instead:

> You can add extra widgets to a file chooser to provide options that are not
> present in the default design, by using gtk_file_chooser_add_choice(). Each
> choice has an identifier and a user visible label; additionally, each choice
> can have multiple options. If a choice has no option, it will be rendered as a
> check button with the given label; if a choice has options, it will be rendered
> as a combo box.

The doc also mentions that GtkFileChooser is deprecated in GTK 4.10 and GtkFileDialog [2] should be used instead. For that one, I don't see any mention of being able to add custom widgets in the doc.


[1] https://docs.gtk.org/gtk4/iface.FileChooser.html
[2] https://docs.gtk.org/gtk4/class.FileDialog.html
Comment 3 Caolán McNamara 2024-09-17 15:29:31 UTC
Ah, forgot all that, maybe gtk_file_chooser_add_choice could be made to work (or a replacement dialog of our own that uses GtkFileChooserWidget). All those are deprecated too of course. Life is very difficult for an existing application with gtk4.