Commit ec5093b8 authored by Jens Georg's avatar Jens Georg

Use GtkFileChooserNative

Make proper use of portals in the flatpak
parent e436baba
......@@ -73,9 +73,8 @@ public File? choose_file(string current_file_basename) {
string file_chooser_title = VideoReader.is_supported_video_filename(current_file_basename) ?
_("Export Video") : _("Export Photo");
Gtk.FileChooserDialog chooser = new Gtk.FileChooserDialog(file_chooser_title,
AppWindow.get_instance(), Gtk.FileChooserAction.SAVE, Resources.CANCEL_LABEL,
Gtk.ResponseType.CANCEL, Resources.SAVE_LABEL, Gtk.ResponseType.ACCEPT, null);
var chooser = new Gtk.FileChooserNative(file_chooser_title,
AppWindow.get_instance(), Gtk.FileChooserAction.SAVE, Resources.SAVE_LABEL, Resources.CANCEL_LABEL);
chooser.set_do_overwrite_confirmation(true);
chooser.set_current_folder(current_export_dir.get_path());
chooser.set_current_name(current_file_basename);
......@@ -98,9 +97,8 @@ public File? choose_dir(string? user_title = null) {
if (user_title == null)
user_title = _("Export Photos");
Gtk.FileChooserDialog chooser = new Gtk.FileChooserDialog(user_title,
AppWindow.get_instance(), Gtk.FileChooserAction.SELECT_FOLDER, Resources.CANCEL_LABEL,
Gtk.ResponseType.CANCEL, Resources.OK_LABEL, Gtk.ResponseType.ACCEPT, null);
var chooser = new Gtk.FileChooserNative(user_title,
AppWindow.get_instance(), Gtk.FileChooserAction.SELECT_FOLDER, Resources.OK_LABEL, Resources.CANCEL_LABEL);
chooser.set_current_folder(current_export_dir.get_path());
chooser.set_local_only(false);
......@@ -582,9 +580,9 @@ public bool report_manifest(ImportManifest manifest, bool show_dest_id,
}
internal void save_import_results(Gtk.Window? chooser_dialog_parent, string results_log) {
Gtk.FileChooserDialog chooser_dialog = new Gtk.FileChooserDialog(
var chooser_dialog = new Gtk.FileChooserNative(
ImportUI.SAVE_RESULTS_FILE_CHOOSER_TITLE, chooser_dialog_parent, Gtk.FileChooserAction.SAVE,
Resources.CANCEL_LABEL, Gtk.ResponseType.CANCEL, Resources.SAVE_AS_LABEL, Gtk.ResponseType.ACCEPT, null);
Resources.SAVE_AS_LABEL, Resources.CANCEL_LABEL);
chooser_dialog.set_do_overwrite_confirmation(true);
chooser_dialog.set_current_folder(Environment.get_home_dir());
chooser_dialog.set_current_name("Shotwell Import Log.txt");
......
......@@ -407,9 +407,8 @@ public class DirectPhotoPage : EditingHostPage {
output_format_filter.add_pattern("*." + uppercase_extension);
}
Gtk.FileChooserDialog save_as_dialog = new Gtk.FileChooserDialog(_("Save As"),
AppWindow.get_instance(), Gtk.FileChooserAction.SAVE, Resources.CANCEL_LABEL,
Gtk.ResponseType.CANCEL, Resources.OK_LABEL, Gtk.ResponseType.OK);
var save_as_dialog = new Gtk.FileChooserNative(_("Save As"),
AppWindow.get_instance(), Gtk.FileChooserAction.SAVE, Resources.OK_LABEL, Resources.CANCEL_LABEL);
save_as_dialog.set_select_multiple(false);
save_as_dialog.set_current_name(filename);
save_as_dialog.set_current_folder(current_save_dir.get_path());
......@@ -418,7 +417,7 @@ public class DirectPhotoPage : EditingHostPage {
save_as_dialog.set_local_only(false);
int response = save_as_dialog.run();
if (response == Gtk.ResponseType.OK) {
if (response == Gtk.ResponseType.ACCEPT) {
// flag to prevent asking user about losing changes to the old file (since they'll be
// loaded right into the new one)
drop_if_dirty = true;
......
......@@ -523,9 +523,8 @@ public class LibraryWindow : AppWindow {
}
private void on_file_import() {
Gtk.FileChooserDialog import_dialog = new Gtk.FileChooserDialog(_("Import From Folder"), null,
Gtk.FileChooserAction.SELECT_FOLDER, Resources.CANCEL_LABEL, Gtk.ResponseType.CANCEL,
Resources.OK_LABEL, Gtk.ResponseType.OK);
var import_dialog = new Gtk.FileChooserNative(_("Import From Folder"), null,
Gtk.FileChooserAction.SELECT_FOLDER, Resources.OK_LABEL, Resources.CANCEL_LABEL);
import_dialog.set_local_only(false);
import_dialog.set_select_multiple(true);
import_dialog.set_current_folder(import_dir);
......@@ -536,7 +535,7 @@ public class LibraryWindow : AppWindow {
int response = import_dialog.run();
if (response == Gtk.ResponseType.OK) {
if (response == Gtk.ResponseType.ACCEPT) {
import_dialog.hide();
// force file linking if directory is inside current library directory
Gtk.ResponseType copy_files_response =
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment