Commit 3191d7d6 authored by Brian Masney's avatar Brian Masney Committed by Jim Nelson

New saved search option: text field is set: Bug #743924

parent af5ac66d
......@@ -171,6 +171,7 @@ public class SavedSearchDialog {
text_context.append_text(_("ends with"));
text_context.append_text(_("does not contain"));
text_context.append_text(_("is not set"));
text_context.append_text(_("is set"));
text_context.set_active(0);
text_context.changed.connect(on_changed);
......@@ -211,7 +212,9 @@ public class SavedSearchDialog {
}
public override bool is_complete() {
return entry.text.chomp() != "" || get_text_context() == SearchConditionText.Context.IS_NOT_SET;
return entry.text.chomp() != "" ||
get_text_context() == SearchConditionText.Context.IS_NOT_SET ||
get_text_context() == SearchConditionText.Context.IS_SET;
}
private SearchConditionText.Context get_text_context() {
......@@ -219,7 +222,8 @@ public class SavedSearchDialog {
}
private void on_changed() {
if (get_text_context() == SearchConditionText.Context.IS_NOT_SET) {
if (get_text_context() == SearchConditionText.Context.IS_NOT_SET
|| get_text_context() == SearchConditionText.Context.IS_SET) {
entry.hide();
} else {
entry.show();
......
......@@ -206,7 +206,8 @@ public class SearchConditionText : SearchCondition {
STARTS_WITH,
ENDS_WITH,
DOES_NOT_CONTAIN,
IS_NOT_SET;
IS_NOT_SET,
IS_SET;
public string to_string() {
switch (this) {
......@@ -228,6 +229,9 @@ public class SearchConditionText : SearchCondition {
case Context.IS_NOT_SET:
return "IS_NOT_SET";
case Context.IS_SET:
return "IS_SET";
default:
error("unrecognized text search context enumeration value");
}
......@@ -252,6 +256,9 @@ public class SearchConditionText : SearchCondition {
else if (str == "IS_NOT_SET")
return Context.IS_NOT_SET;
else if (str == "IS_SET")
return Context.IS_SET;
else
error("unrecognized text search context name: %s", str);
}
......@@ -287,6 +294,9 @@ public class SearchConditionText : SearchCondition {
case Context.IS_NOT_SET:
return (is_string_empty(haystack));
case Context.IS_SET:
return (!is_string_empty(haystack));
}
return false;
......
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