Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions plugins/fuzzy-search/file-item.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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);
}
}