[gnome-photos] main-window: Implement handle_key_overview



commit 3fd86460e8329de3c990f3e2298e72248595206b
Author: Debarshi Ray <debarshir gnome org>
Date:   Wed Jan 29 10:29:21 2014 +0100

    main-window: Implement handle_key_overview

 src/photos-main-window.c |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)
---
diff --git a/src/photos-main-window.c b/src/photos-main-window.c
index 4826cab..009513e 100644
--- a/src/photos-main-window.c
+++ b/src/photos-main-window.c
@@ -34,6 +34,7 @@
 #include "photos-item-manager.h"
 #include "photos-main-window.h"
 #include "photos-mode-controller.h"
+#include "photos-selection-controller.h"
 #include "photos-settings.h"
 
 
@@ -44,6 +45,7 @@ struct _PhotosMainWindowPrivate
   PhotosBaseManager *col_mngr;
   PhotosBaseManager *item_mngr;
   PhotosModeController *mode_cntrlr;
+  PhotosSelectionController *sel_cntrlr;
   PhotosWindowMode old_mode;
   guint configure_id;
 };
@@ -210,7 +212,16 @@ photos_main_window_handle_back_key (PhotosMainWindow *self, GdkEventKey *event)
 static gboolean
 photos_main_window_handle_key_overview (PhotosMainWindow *self, GdkEventKey *event)
 {
-  return GDK_EVENT_PROPAGATE;
+  PhotosMainWindowPrivate *priv = self->priv;
+  gboolean handled = FALSE;
+
+  if (photos_selection_controller_get_selection_mode (priv->sel_cntrlr) && event->keyval == GDK_KEY_Escape)
+    {
+      photos_selection_controller_set_selection_mode (priv->sel_cntrlr, FALSE);
+      handled = TRUE;
+    }
+
+  return handled;
 }
 
 
@@ -301,6 +312,7 @@ photos_main_window_dispose (GObject *object)
   g_clear_object (&priv->col_mngr);
   g_clear_object (&priv->item_mngr);
   g_clear_object (&priv->mode_cntrlr);
+  g_clear_object (&priv->sel_cntrlr);
 
   if (priv->configure_id != 0)
     {
@@ -358,6 +370,8 @@ photos_main_window_init (PhotosMainWindow *self)
                            self,
                            G_CONNECT_SWAPPED);
 
+  priv->sel_cntrlr = photos_selection_controller_dup_singleton ();
+
   priv->embed = photos_embed_new ();
   gtk_container_add (GTK_CONTAINER (self), priv->embed);
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]