Implement selection in the browser

Keyboard controls are missing so far.
This commit is contained in:
2022-01-10 17:54:41 +01:00
parent 1a190001fc
commit e663f02754
2 changed files with 89 additions and 15 deletions

31
fiv.c
View File

@@ -567,7 +567,7 @@ switch_to_browser(void)
{
set_window_title(g.directory);
gtk_stack_set_visible_child(GTK_STACK(g.stack), g.browser_paned);
gtk_widget_grab_focus(g.browser_scroller);
gtk_widget_grab_focus(g.browser);
}
static void
@@ -1567,6 +1567,8 @@ make_browser_sidebar(FivIoModel *model)
// thus resolving the problem using overlaps.
// We're trying to be universal for light and dark themes both. It's hard.
static const char stylesheet[] = "@define-color fiv-tile @content_view_bg; \
@define-color fiv-semiselected \
mix(@theme_selected_bg_color, @content_view_bg, 0.5); \
fiv-view, fiv-browser { background: @content_view_bg; } \
placessidebar.fiv .toolbar { padding: 2px 6px; } \
placessidebar.fiv box > separator { margin: 4px 0; } \
@@ -1579,6 +1581,7 @@ static const char stylesheet[] = "@define-color fiv-tile @content_view_bg; \
} \
fiv-browser { padding: 5px; } \
fiv-browser.item { \
/* For non-symbolic, color is applied to the glowing margin. */ \
color: mix(#000, @content_view_bg, 0.625); margin: 8px; \
border: 2px solid #fff; \
} \
@@ -1591,14 +1594,36 @@ static const char stylesheet[] = "@define-color fiv-tile @content_view_bg; \
background-size: 40px 40px; \
background-position: 0 0, 0 20px, 20px -20px, -20px 0px; \
} \
fiv-browser.item:backdrop { \
fiv-browser.item:selected { \
color: @theme_selected_bg_color; \
border-color: @theme_selected_bg_color; \
} \
fiv-browser.item:selected:not(:focus) { \
color: @fiv-semiselected; \
border-color: @fiv-semiselected; \
} \
fiv-browser.item:backdrop:not(:selected) { \
color: mix(#000, @content_view_bg, 0.875); \
border-color: mix(#fff, @content_view_bg, 0.5); \
} \
fiv-browser.item.symbolic, \
fiv-browser.item.symbolic:selected, \
fiv-browser.item.symbolic:backdrop { \
color: shade(@theme_bg_color, 0.875); \
border-color: transparent; \
} \
fiv-browser.item.symbolic { \
border-color: transparent; color: shade(@theme_bg_color, 0.875); \
background-blend-mode: color; \
background: @theme_bg_color; background-image: none; \
} \
fiv-browser.item.symbolic:selected { \
color: @theme_selected_bg_color; background-image: linear-gradient(0, \
@theme_selected_bg_color, @theme_selected_bg_color); \
} \
fiv-browser.item.symbolic:selected:not(:focus) { \
color: @fiv-semiselected; background-image: linear-gradient(0, \
@fiv-semiselected, @fiv-semiselected); \
} \
.fiv-information label { padding: 0 4px; }";
int