[gnome-boxes] Escape key to quit selection mode



commit 116708235960f40bd167a795650367ac409844ba
Author: Marc-Andrà Lureau <marcandre lureau gmail com>
Date:   Sat Jun 9 01:28:47 2012 +0200

    Escape key to quit selection mode
    
    https://bugzilla.gnome.org/show_bug.cgi?id=677739

 src/app.vala    |    3 +++
 src/topbar.vala |    7 +++++--
 2 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/src/app.vala b/src/app.vala
index 503a045..012e44c 100644
--- a/src/app.vala
+++ b/src/app.vala
@@ -578,6 +578,9 @@ private class Boxes.App: Boxes.UI {
         if (event.keyval == Gdk.Key.F11) {
             fullscreen = !fullscreen;
             return true;
+        } else if (event.keyval == Gdk.Key.Escape) {
+            if (selection_mode && ui_state == UIState.COLLECTION)
+               selection_mode = false;
         }
 
         return false;
diff --git a/src/topbar.vala b/src/topbar.vala
index e43753a..642e988 100644
--- a/src/topbar.vala
+++ b/src/topbar.vala
@@ -91,9 +91,13 @@ private class Boxes.Topbar: Boxes.UI {
         select_btn.get_style_context ().add_class ("raised");
         select_btn.valign = Gtk.Align.CENTER;
         select_btn.clicked.connect (() => {
-            notebook.page = TopbarPage.SELECTION;
             App.app.selection_mode = true;
         });
+        App.app.notify["selection-mode"].connect (() => {
+            notebook.page = App.app.selection_mode ?
+                TopbarPage.SELECTION : notebook.page = TopbarPage.COLLECTION;
+        });
+
         update_select_btn_sensitivity ();
         App.app.collection.item_added.connect (update_select_btn_sensitivity);
         App.app.collection.item_removed.connect (update_select_btn_sensitivity);
@@ -128,7 +132,6 @@ private class Boxes.Topbar: Boxes.UI {
         toolbar_selection.insert (cancel_btn, 1);
         cancel_btn.clicked.connect (() => {
             App.app.selection_mode = false;
-            notebook.page = TopbarPage.COLLECTION;
         });
 
         /* TopbarPage.WIZARD */



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