found = bookmark_fill_tag_completion(store, token);
break;
+ case EX_HANDREM:
+ sort = true;
+ found = handler_fill_completion(store, token);
+ break;
+
default:
break;
}
#include "main.h"
#include "handlers.h"
+#include "completion.h"
#include "util.h"
extern VbCore vb;
return true;
}
+gboolean handler_fill_completion(GtkListStore *store, const char *input)
+{
+ gboolean found = false;
+ GtkTreeIter iter;
+ GList *src = g_hash_table_get_keys(handlers);
+
+ 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;
+ }
+ } else {
+ 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;
+}
+
static char *handler_lookup(const char *uri)
{
char *p, *handler = NULL;
gboolean handler_add(const char *key, const char *uri);
gboolean handler_remove(const char *key);
gboolean handle_uri(const char *uri);
+gboolean handler_fill_completion(GtkListStore *store, const char *input);
#endif /* end of include guard: _HANDLERS_H */