return TRUE;
}
-/**
- * Fills the given list store by matching data of also given src list.
- */
-gboolean completion_fill(GtkListStore *store, const char *input, GList *src)
-{
- gboolean found = FALSE;
- GtkTreeIter iter;
-
- /* If no filter input given - copy all entries into the data store. */
- if (!input || !*input) {
- for (GList *l = src; l; l = l->next) {
- gtk_list_store_append(store, &iter);
- gtk_list_store_set(store, &iter, COMPLETION_STORE_FIRST, l->data, -1);
- found = TRUE;
- }
- return found;
- }
-
- /* If filter input is given - copy matching list entires into data store.
- * Strings are compared by prefix matching. */
- for (GList *l = src; l; l = l->next) {
- char *value = (char*)l->data;
- if (g_str_has_prefix(value, input)) {
- gtk_list_store_append(store, &iter);
- gtk_list_store_set(store, &iter, COMPLETION_STORE_FIRST, l->data, -1);
- found = TRUE;
- }
- }
-
- return found;
-}
-
static gboolean tree_selection_func(GtkTreeSelection *selection,
GtkTreeModel *model, GtkTreePath *path, gboolean selected, gpointer data)
{
CompletionSelectFunc selfunc, gboolean back);
void completion_init(Client *c);
gboolean completion_next(Client *c, gboolean back);
-gboolean completion_fill(GtkListStore *store, const char *input, GList *src);
#endif /* end of include guard: _COMPLETION_H */
gboolean setting_fill_completion(Client *c, GtkListStore *store, const char *input)
{
- GList *src = g_hash_table_get_keys(c->config.settings);
- gboolean found = completion_fill(store, input, src);
- g_list_free(src);
+ GtkTreeIter iter;
+ gboolean found = FALSE;
+ GList *src = g_hash_table_get_keys(c->config.settings);
+
+ /* If no filter input given - copy all entries into the data store. */
+ if (!input || !*input) {
+ for (GList *l = src; l; l = l->next) {
+ gtk_list_store_append(store, &iter);
+ gtk_list_store_set(store, &iter, COMPLETION_STORE_FIRST, l->data, -1);
+ found = TRUE;
+ }
+ g_list_free(src);
+ return found;
+ }
+ /* If filter input is given - copy matching list entires into data store.
+ * Strings are compared by prefix matching. */
+ for (GList *l = src; l; l = l->next) {
+ char *value = (char*)l->data;
+ if (g_str_has_prefix(value, input)) {
+ gtk_list_store_append(store, &iter);
+ gtk_list_store_set(store, &iter, COMPLETION_STORE_FIRST, l->data, -1);
+ found = TRUE;
+ }
+ }
+
+ g_list_free(src);
return found;
}