static gboolean photos_main_window_handle_key_preview (PhotosMainWindow *self, GdkEventKey *event) { PhotosMainWindowPrivate *priv = self->priv; PhotosPreviewView *preview; gboolean fullscreen; gboolean handled = FALSE; preview = photos_embed_get_preview (PHOTOS_EMBED (priv->embed)); fullscreen = photos_mode_controller_get_fullscreen (priv->mode_cntrlr); switch (event->keyval) { case GDK_KEY_Escape: if (fullscreen) { photos_base_manager_set_active_object (priv->item_mngr, NULL); photos_mode_controller_go_back (priv->mode_cntrlr); } break; case GDK_KEY_Left: photos_preview_view_load_previous (preview); handled = TRUE; break; case GDK_KEY_Right: photos_preview_view_load_next (preview); handled = TRUE; break; } return handled; }
static gboolean photos_main_window_key_press_event (GtkWidget *widget, GdkEventKey *event) { PhotosMainWindow *self = PHOTOS_MAIN_WINDOW (widget); PhotosMainWindowPrivate *priv = self->priv; PhotosMainToolbar *toolbar; PhotosWindowMode mode; gboolean handled = GDK_EVENT_PROPAGATE; handled = photos_main_window_handle_back_key (self, event); if (handled) goto out; toolbar = photos_embed_get_main_toolbar (PHOTOS_EMBED (priv->embed)); handled = photos_main_toolbar_handle_event (toolbar, event); if (handled) goto out; mode = photos_mode_controller_get_window_mode (priv->mode_cntrlr); switch (mode) { case PHOTOS_WINDOW_MODE_NONE: handled = GDK_EVENT_PROPAGATE; break; case PHOTOS_WINDOW_MODE_PREVIEW: handled = photos_main_window_handle_key_preview (self, event); break; case PHOTOS_WINDOW_MODE_COLLECTIONS: case PHOTOS_WINDOW_MODE_FAVORITES: case PHOTOS_WINDOW_MODE_OVERVIEW: case PHOTOS_WINDOW_MODE_SEARCH: handled = photos_main_window_handle_key_overview (self, event); break; default: g_assert_not_reached (); break; } out: if (!handled) handled = GTK_WIDGET_CLASS (photos_main_window_parent_class)->key_press_event (widget, event); return handled; }