[nautilus] view-icon-ui: add support for file previews
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus] view-icon-ui: add support for file previews
- Date: Thu, 29 Aug 2019 23:33:42 +0000 (UTC)
commit 2d3dcbcfb78df09f8707a12b33468cd63da2b020
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Sat Jul 6 14:30:52 2019 -0700
view-icon-ui: add support for file previews
Launch the previewer with spacebar like everywhere else.
src/nautilus-view-icon-ui.c | 23 ++++++++++++++++++++++-
1 file changed, 22 insertions(+), 1 deletion(-)
---
diff --git a/src/nautilus-view-icon-ui.c b/src/nautilus-view-icon-ui.c
index 2ccdf8b95..04f7bd4e7 100644
--- a/src/nautilus-view-icon-ui.c
+++ b/src/nautilus-view-icon-ui.c
@@ -153,12 +153,33 @@ on_child_activated (GtkFlowBox *flow_box,
NautilusViewItemModel *item_model;
NautilusFile *file;
g_autoptr (GList) list = NULL;
+ GdkEvent *event;
+ guint keyval;
+ gboolean is_preview = FALSE;
item_model = nautilus_view_icon_item_ui_get_model (NAUTILUS_VIEW_ICON_ITEM_UI (child));
file = nautilus_view_item_model_get_file (item_model);
list = g_list_append (list, file);
- nautilus_files_view_activate_files (NAUTILUS_FILES_VIEW (self->controller), list, 0, TRUE);
+ event = gtk_get_current_event ();
+ if (event && gdk_event_get_keyval (event, &keyval))
+ {
+ if (keyval == GDK_KEY_space)
+ {
+ is_preview = TRUE;
+ }
+ }
+
+ if (is_preview)
+ {
+ nautilus_files_view_preview_files (NAUTILUS_FILES_VIEW (self->controller), list, NULL);
+ }
+ else
+ {
+ nautilus_files_view_activate_files (NAUTILUS_FILES_VIEW (self->controller), list, 0, TRUE);
+ }
+
+ g_clear_pointer (&event, gdk_event_free);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]