aboutsummaryrefslogtreecommitdiff
path: root/fastiv-sidebar.c
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2021-11-23 00:26:28 +0100
committerPřemysl Eric Janouch <p@janouch.name>2021-11-23 00:26:49 +0100
commit1e6689aed42d3362ea2d56e6f05376f801b5862b (patch)
tree375b9d6a030bb2ef530185d912f9457ac172384d /fastiv-sidebar.c
parente6ad6c63023c3be97aa6a60aa780365cb9c9b5ca (diff)
downloadfiv-1e6689aed42d3362ea2d56e6f05376f801b5862b.tar.gz
fiv-1e6689aed42d3362ea2d56e6f05376f801b5862b.tar.xz
fiv-1e6689aed42d3362ea2d56e6f05376f801b5862b.zip
Mildly improve path autocompletion
Diffstat (limited to 'fastiv-sidebar.c')
-rw-r--r--fastiv-sidebar.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/fastiv-sidebar.c b/fastiv-sidebar.c
index 57ef40d..3f1eaed 100644
--- a/fastiv-sidebar.c
+++ b/fastiv-sidebar.c
@@ -239,8 +239,12 @@ complete_path(GFile *location, GtkListStore *model)
g_file_info_get_is_hidden(info))
continue;
- // TODO(p): Resolve ~ paths a bit better.
char *parse_name = g_file_get_parse_name(child);
+ if (!g_str_has_suffix(parse_name, G_DIR_SEPARATOR_S)) {
+ char *save = parse_name;
+ parse_name = g_strdup_printf("%s%c", parse_name, G_DIR_SEPARATOR);
+ g_free(save);
+ }
gtk_list_store_insert_with_values(model, NULL, -1, 0, parse_name, -1);
g_free(parse_name);
}
@@ -310,6 +314,7 @@ on_show_enter_location(G_GNUC_UNUSED GtkPlacesSidebar *sidebar,
GtkEntryCompletion *completion = gtk_entry_completion_new();
gtk_entry_completion_set_model(completion, GTK_TREE_MODEL(model));
gtk_entry_completion_set_text_column(completion, 0);
+ // TODO(p): Complete ~ paths so that they start with ~, then we can filter.
gtk_entry_completion_set_match_func(
completion, (GtkEntryCompletionMatchFunc) gtk_true, NULL, NULL);
g_object_unref(model);