diff --git a/plugins/fuzzy-search/file-item.vala b/plugins/fuzzy-search/file-item.vala index 541d72300..45a0dde65 100644 --- a/plugins/fuzzy-search/file-item.vala +++ b/plugins/fuzzy-search/file-item.vala @@ -24,14 +24,11 @@ public class FileItem : Gtk.ListBoxRow { var path_box = new Gtk.Box (Gtk.Orientation.VERTICAL, 1); path_box.valign = Gtk.Align.CENTER; - var path_label = new Gtk.Label ( - @"$(should_distinguish_project ? result.project + " • " : "")$(result.relative_path)" - ) { + var path_label = new Gtk.Label (get_path_label (should_distinguish_project)) { + halign = START, ellipsize = MIDDLE }; - path_label.halign = Gtk.Align.START; - var filename_label = new Gtk.Label (Path.get_basename (result.relative_path)); filename_label.halign = Gtk.Align.START; @@ -58,4 +55,16 @@ public class FileItem : Gtk.ListBoxRow { this.child = container_box; } + + private string get_path_label (bool show_project) { + if (!show_project) { + return result.relative_path; + } + + if (Gtk.StateFlags.DIR_RTL in get_state_flags ()) { + return "%s ← %s".printf (result.relative_path, result.project); + } + + return "%s → %s".printf (result.project, result.relative_path); + } }