Skip to content

Commit

Permalink
Merge branch 'master' into fix-rename-in-sidebar
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremypw authored Jan 11, 2024
2 parents f3fb31a + 12d8322 commit bb4b80f
Show file tree
Hide file tree
Showing 25 changed files with 1,493 additions and 36 deletions.
49 changes: 49 additions & 0 deletions data/Application.css
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,52 @@ textview.scrubber {
border: 0;
}

.fuzzy-popover {
padding-top: 0.5rem;
padding-bottom: 1rem;
}

.fuzzy-popover entry {
margin-left: 1rem;
margin-right: 1rem;
}

.fuzzy-popover scrolledwindow {
margin-top: 1rem;
}

.fuzzy-list {
background-color: transparent;
}

.fuzzy-item {
padding: 0.5rem;
margin-left: 10px;
margin-right: 10px;
background-color: transparent;
}

.fuzzy-item.preselect-fuzzy,
.fuzzy-item:hover {
border-radius: 0.5rem;
}

.fuzzy-item:hover {
background-color: @theme_unfocused_selected_bg_color;
}

.fuzzy-item.preselect-fuzzy {
background-color: @selected_bg_color;
}

.fuzzy-item .fuzzy-file-icon {
margin-right: 0.5rem;
}

.fuzzy-item label:nth-child(1) {
font-weight: 700;
}

.fuzzy-item.preselect-fuzzy label {
opacity: 0.7;
}
5 changes: 5 additions & 0 deletions data/io.elementary.code.gschema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@
<summary>Symbol outline visibility</summary>
<description>Whether or not the symbol outline is visible</description>
</key>
<key name="outline-width" type="i">
<default>160</default>
<summary>Symbol outline width</summary>
<description>Width of the symbol outline sidebar</description>
</key>
<key name="last-opened-path" type="s">
<default>''</default>
<summary>Last opened path</summary>
Expand Down
58 changes: 58 additions & 0 deletions plugins/fuzzy-search/file-item.vala
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/*
* SPDX-License-Identifier: GPL-3.0-or-later
* SPDX-FileCopyrightText: 2023 elementary, Inc. <https://elementary.io>
*
* Authored by: Marvin Ahlgrimm
* Colin Kiama <[email protected]>
*/

public class FileItem : Gtk.ListBoxRow {
private SearchResult result;

public string filepath {
get {
return result.full_path;
}
}
public FileItem (SearchResult res, bool should_distinguish_project = false) {
this.get_style_context ().add_class ("fuzzy-item");
this.get_style_context ().add_class ("flat");

result = res;
Icon icon;
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)"
);

path_label.halign = Gtk.Align.START;

var filename_label = new Gtk.Label (Path.get_basename (result.relative_path));
filename_label.halign = Gtk.Align.START;

try {
var fi = File.new_for_path (result.full_path);
var info = fi.query_info ("standard::*", 0);
icon = ContentType.get_icon (info.get_content_type ());
} catch (Error e) {
icon = ContentType.get_icon ("text/plain");
}

var image = new Gtk.Image.from_gicon (icon, Gtk.IconSize.DND);
image.get_style_context ().add_class ("fuzzy-file-icon");

path_box.add (filename_label);
path_box.add (path_label);

var container_box = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 1) {
valign = Gtk.Align.CENTER
};

container_box.add (image);
container_box.add (path_box);

this.child = container_box;
}
}
Loading

0 comments on commit bb4b80f

Please sign in to comment.