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



commit 3191d7d6ca9073406f3e67f70bdcaf312bf4ab6c
Author: Brian Masney <masneyb onstation org>
Date:   Tue Feb 3 17:56:06 2015 -0800

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

 src/searches/SavedSearchDialog.vala |    8 ++++++--
 src/searches/SearchBoolean.vala     |   12 +++++++++++-
 2 files changed, 17 insertions(+), 3 deletions(-)
---
diff --git a/src/searches/SavedSearchDialog.vala b/src/searches/SavedSearchDialog.vala
index 124841f..b9a28c2 100644
--- a/src/searches/SavedSearchDialog.vala
+++ b/src/searches/SavedSearchDialog.vala
@@ -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();
diff --git a/src/searches/SearchBoolean.vala b/src/searches/SearchBoolean.vala
index 431e398..656a470 100644
--- a/src/searches/SearchBoolean.vala
+++ b/src/searches/SearchBoolean.vala
@@ -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;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]