diff options
author | Jörg Frings-Fürst <debian@jff.email> | 2023-06-14 20:36:17 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff.email> | 2023-06-14 20:36:17 +0200 |
commit | 31804433d72460cbe0a39f9f8ea5e76058d84cda (patch) | |
tree | 2084a84c39f159c6aea254775dc0880d52579d45 /src/Dialogs.vala | |
parent | a9898fb3f39c44a85876930ef6b2558052569ae6 (diff) | |
parent | d443a3c2509889533ca812c163056bace396b586 (diff) |
Update upstream source from tag 'upstream/0.32.1'
Update to upstream version '0.32.1'
with Debian dir c460ad6e13d3c39eaa2d5399059385e64e6fba4c
Diffstat (limited to 'src/Dialogs.vala')
-rw-r--r-- | src/Dialogs.vala | 63 |
1 files changed, 49 insertions, 14 deletions
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<DataObject> 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<string>(); + 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<LibraryPhoto> 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<MediaSource> sources, string dialog_title, |