Add keyboard shortcuts for thumbnail size

This commit is contained in:
Přemysl Eric Janouch 2022-01-23 06:44:34 +01:00
parent a7e638207f
commit 38670428da
Signed by: p
GPG Key ID: A0420B94F92B9493
2 changed files with 15 additions and 1 deletions

View File

@ -1321,7 +1321,8 @@ static gboolean
fiv_browser_key_press_event(GtkWidget *widget, GdkEventKey *event) fiv_browser_key_press_event(GtkWidget *widget, GdkEventKey *event)
{ {
FivBrowser *self = FIV_BROWSER(widget); FivBrowser *self = FIV_BROWSER(widget);
if (!(event->state & gtk_accelerator_get_default_mod_mask())) { switch ((event->state & gtk_accelerator_get_default_mod_mask())) {
case 0:
switch (event->keyval) { switch (event->keyval) {
case GDK_KEY_Return: case GDK_KEY_Return:
if (self->selected) if (self->selected)
@ -1346,6 +1347,17 @@ fiv_browser_key_press_event(GtkWidget *widget, GdkEventKey *event)
move_selection_end(self); move_selection_end(self);
return TRUE; return TRUE;
} }
break;
case GDK_CONTROL_MASK:
case GDK_CONTROL_MASK | GDK_SHIFT_MASK:
switch (event->keyval) {
case GDK_KEY_plus:
set_item_size(self, self->item_size + 1);
return TRUE;
case GDK_KEY_minus:
set_item_size(self, self->item_size - 1);
return TRUE;
}
} }
return GTK_WIDGET_CLASS(fiv_browser_parent_class) return GTK_WIDGET_CLASS(fiv_browser_parent_class)

2
fiv.c
View File

@ -86,6 +86,8 @@ static struct key_group help_keys_browser[] = {
{"F9", "Toggle navigation sidebar"}, {"F9", "Toggle navigation sidebar"},
{"F5 r <control>r", "Refresh"}, {"F5 r <control>r", "Refresh"},
{"h <control>h", "Toggle hiding unsupported files"}, {"h <control>h", "Toggle hiding unsupported files"},
{"<control>plus", "Larger thumbnails"},
{"<control>minus", "Smaller thumbnails"},
{} {}
}}, }},
{"Navigation", (struct key[]) { {"Navigation", (struct key[]) {