Bind F5 and r to refreshing the directory

This commit is contained in:
Přemysl Eric Janouch 2021-11-18 13:58:27 +01:00
parent f8526d486a
commit 411f0b3e91
Signed by: p
GPG Key ID: A0420B94F92B9493

View File

@ -275,8 +275,10 @@ on_open_location(G_GNUC_UNUSED GtkPlacesSidebar *sidebar, GFile *location,
G_GNUC_UNUSED GtkPlacesOpenFlags flags, G_GNUC_UNUSED gpointer user_data) G_GNUC_UNUSED GtkPlacesOpenFlags flags, G_GNUC_UNUSED gpointer user_data)
{ {
gchar *path = g_file_get_path(location); gchar *path = g_file_get_path(location);
load_directory(path); if (path) {
g_free(path); load_directory(path);
g_free(path);
}
} }
// Cursor keys, e.g., simply cannot be bound through accelerators // Cursor keys, e.g., simply cannot be bound through accelerators
@ -321,6 +323,14 @@ on_key_press(G_GNUC_UNUSED GtkWidget *widget, GdkEventKey *event,
on_open(); on_open();
return TRUE; return TRUE;
case GDK_KEY_F5:
case GDK_KEY_r: {
char *copy = g_strdup(g.directory);
load_directory(copy);
g_free(copy);
return TRUE;
}
case GDK_KEY_F9: case GDK_KEY_F9:
if (gtk_widget_is_visible(g.browser_sidebar)) if (gtk_widget_is_visible(g.browser_sidebar))
gtk_widget_hide(g.browser_sidebar); gtk_widget_hide(g.browser_sidebar);