summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Georg <mail@jensge.org>2020-07-19 17:09:43 +0200
committerJens Georg <mail@jensge.org>2020-07-29 22:44:37 +0200
commitb526286a4798bc4f3f9f5d13bdcaeee316011e2a (patch)
tree1b1e223282dd7ab257a6a607c70aa315ed6139f8
parentc9f353f80d2a9980012ec66ac21b1258b572ca71 (diff)
downloadgupnp-tools-b526286a4798bc4f3f9f5d13bdcaeee316011e2a.tar.gz
av-cp: Add more keywords to completion
-rw-r--r--src/av-cp/entry-completion.c53
1 files changed, 33 insertions, 20 deletions
diff --git a/src/av-cp/entry-completion.c b/src/av-cp/entry-completion.c
index 7c9aaba..c2ef8e0 100644
--- a/src/av-cp/entry-completion.c
+++ b/src/av-cp/entry-completion.c
@@ -152,33 +152,46 @@ entry_completion_constructed (GObject *object)
gtk_entry_completion_set_text_column (GTK_ENTRY_COMPLETION (self), 0);
}
+static const char *keywords[] = {
+ "and",
+ "or",
+ "contains",
+ "doesNotContain",
+ "derivedFrom",
+ "exists",
+ "true",
+ "false",
+ ">", ">=", "<", "<=", "=", "!=", "*",
+ NULL
+};
+
void
entry_completion_set_search_criteria (EntryCompletion *self, char** criteria)
{
GtkTreeIter iter;
gtk_list_store_clear (self->store);
+
// Prefill ListStore with the search expression keywords
- gtk_list_store_insert_with_values (self->store, &iter, -1,
- 0, "and", -1);
- gtk_list_store_insert_with_values (self->store, &iter, -1,
- 0, "or", -1);
- gtk_list_store_insert_with_values (self->store, &iter, -1,
- 0, "contains", -1);
- gtk_list_store_insert_with_values (self->store, &iter, -1,
- 0, "doesNotContain", -1);
- gtk_list_store_insert_with_values (self->store, &iter, -1,
- 0, "derivedFrom", -1);
- gtk_list_store_insert_with_values (self->store, &iter, -1,
- 0, "exists", -1);
- gtk_list_store_insert_with_values (self->store, &iter, -1,
- 0, "true", -1);
- gtk_list_store_insert_with_values (self->store, &iter, -1,
- 0, "false", -1);
-
- char **it = criteria;
+ char **it = keywords;
+ while (*it != NULL) {
+ gtk_list_store_insert_with_values (self->store,
+ &iter,
+ -1,
+ 0,
+ *it,
+ -1);
+ it++;
+ }
+
+ // Add the properties supported by the search criteria
+ it = criteria;
while (*it != NULL) {
- gtk_list_store_insert_with_values (self->store, &iter, -1,
- 0, *it, -1);
+ gtk_list_store_insert_with_values (self->store,
+ &iter,
+ -1,
+ 0,
+ *it,
+ -1);
it++;
}
} \ No newline at end of file