From d443a3c2509889533ca812c163056bace396b586 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Wed, 14 Jun 2023 20:35:58 +0200 Subject: New upstream version 0.32.1 --- src/Dialogs.vala | 63 +++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 49 insertions(+), 14 deletions(-) (limited to 'src/Dialogs.vala') diff --git a/src/Dialogs.vala b/src/Dialogs.vala index b1f6e08..70dc76d 100644 --- a/src/Dialogs.vala +++ b/src/Dialogs.vala @@ -5,7 +5,7 @@ */ // namespace for future migration of AppWindow alert and other question dialogs into single -// place: http://trac.yorba.org/ticket/3452 +// place: https://bugzilla.gnome.org/show_bug.cgi?id=717659 namespace Dialogs { public bool confirm_delete_tag(Tag tag) { @@ -67,7 +67,7 @@ public File? choose_file(string current_file_basename) { current_export_dir = File.new_for_path(Environment.get_home_dir()); string file_chooser_title = VideoReader.is_supported_video_filename(current_file_basename) ? - _("Export Video") : _("Export Photo"); + _("Export Video") : GLib.dpgettext2 (null, "Dialog Title", "Export Photo"); var chooser = new Gtk.FileChooserNative(file_chooser_title, AppWindow.get_instance(), Gtk.FileChooserAction.SAVE, Resources.SAVE_LABEL, Resources.CANCEL_LABEL); @@ -214,7 +214,7 @@ public string create_result_report_from_manifest(ImportManifest manifest) { StringBuilder builder = new StringBuilder(); string header = _("Import Results Report") + " (Shotwell " + Resources.APP_VERSION + " @ " + - TimeVal().to_iso8601() + ")\n\n"; + new DateTime.now_utc().format_iso8601() + ")\n\n"; builder.append(header); string subhead = (ngettext("Attempted to import %d file.", "Attempted to import %d files.", @@ -817,8 +817,14 @@ public void multiple_object_error_dialog(Gee.ArrayList objects, stri public abstract class TagsDialog : TextEntryDialogMediator { protected TagsDialog(string title, string label, string? initial_text = null) { - base (title, label, initial_text, HierarchicalTagIndex.get_global_index().get_all_tags(), - ","); + var all = new Gee.ArrayList(); + all.add_all(HierarchicalTagIndex.get_global_index().get_all_tags()); + var paths = HierarchicalTagIndex.get_global_index().get_all_paths(); + foreach (var p in paths) { + if (p.has_prefix("/")) all.add(p); + } + + base (title, label, initial_text, all, ","); } } @@ -840,14 +846,24 @@ public class AddTagsDialog : TagsDialog { } protected override bool on_modify_validate(string text) { - if (text.contains(Tag.PATH_SEPARATOR_STRING)) - return false; - - // Can't simply call Tag.prep_tag_names().length because of this bug: - // https://bugzilla.gnome.org/show_bug.cgi?id=602208 string[] names = Tag.prep_tag_names(text.split(",")); - - return names.length > 0; + if (names.length == 0) + return false; + + // If allowing hierarchies, they have to start with a "/" + for (int i = 0; i < names.length; i++) { + if (names[i].contains(Tag.PATH_SEPARATOR_STRING) && !names[i].strip().has_prefix(Tag.PATH_SEPARATOR_STRING)) + return false; + + if (names[i].strip().has_prefix(Tag.PATH_SEPARATOR_STRING) && names[i].strip().length == 1) + return false; + + if (names[i].strip().contains(Tag.PATH_SEPARATOR_STRING + Tag.PATH_SEPARATOR_STRING)) { + return false; + } + } + + return true; } } @@ -904,7 +920,26 @@ public class ModifyTagsDialog : TagsDialog { } protected override bool on_modify_validate(string text) { - return (!text.contains(Tag.PATH_SEPARATOR_STRING)); + string[] names = Tag.prep_tag_names(text.split(",")); + if (names.length == 0) + return false; + + // If allowing hierarchies, they have to start with a "/" + for (int i = 0; i < names.length; i++) { + if (names[i].contains(Tag.PATH_SEPARATOR_STRING) && !names[i].strip().has_prefix(Tag.PATH_SEPARATOR_STRING)) { + return false; + } + + if (names[i].strip().has_prefix(Tag.PATH_SEPARATOR_STRING) && names[i].strip().length == 1) + return false; + + if (names[i].strip().contains(Tag.PATH_SEPARATOR_STRING + Tag.PATH_SEPARATOR_STRING)) { + return false; + } + } + + return true; + } } @@ -930,7 +965,7 @@ public Gtk.ResponseType copy_files_dialog() { public void remove_photos_from_library(Gee.Collection photos) { remove_from_app(photos, _("Remove From Library"), - (photos.size == 1) ? _("Removing Photo From Library") : _("Removing Photos From Library")); + ngettext("Removing Photo From Library", "Removing Photos From Library", photos.size)); } public void remove_from_app(Gee.Collection sources, string dialog_title, -- cgit v1.2.3