[shotwell/wip/phako/44] wip: Support adding hierarchical tags with /
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [shotwell/wip/phako/44] wip: Support adding hierarchical tags with /
- Date: Sat, 24 Aug 2019 11:43:05 +0000 (UTC)
commit 59f7d04e2349a1d60bd5cdaf2497601499d9d09a
Author: Jens Georg <mail jensge org>
Date: Sat Aug 24 13:42:35 2019 +0200
wip: Support adding hierarchical tags with /
Fixes #44
src/Dialogs.vala | 35 ++++++++++++++++++++++++++++++-----
1 file changed, 30 insertions(+), 5 deletions(-)
---
diff --git a/src/Dialogs.vala b/src/Dialogs.vala
index 9b9fbcc6..fab8fe67 100644
--- a/src/Dialogs.vala
+++ b/src/Dialogs.vala
@@ -844,14 +844,23 @@ public class AddTagsDialog : TagsDialog {
}
protected override bool on_modify_validate(string text) {
- if (text.contains(Tag.PATH_SEPARATOR_STRING))
- return false;
+// 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;
+ }
+
+ return true;
}
}
@@ -908,7 +917,23 @@ public class ModifyTagsDialog : TagsDialog {
}
protected override bool on_modify_validate(string text) {
- return (!text.contains(Tag.PATH_SEPARATOR_STRING));
+ // 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(","));
+ 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)) {
+ print("Faliing test. for %s\n", text.strip());
+ return false;
+ }
+ }
+
+ return true;
+
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]