[cheese/wip-cancel] Removed hardcoded hex keyvalue for Escape



commit 8c02f90998d3b7dbbe4781d03ee107fb364c1921
Author: Yuvaraj Pandian T <yuvipanda gmail com>
Date:   Thu Aug 19 01:20:38 2010 +0530

    Removed hardcoded hex keyvalue for Escape

 src/cheese-window.vala |   48 ++++++++++++++++++++++++------------------------
 1 files changed, 24 insertions(+), 24 deletions(-)
---
diff --git a/src/cheese-window.vala b/src/cheese-window.vala
index 6635cbc..7b43e2e 100644
--- a/src/cheese-window.vala
+++ b/src/cheese-window.vala
@@ -645,31 +645,31 @@ public class Cheese.MainWindow : Gtk.Window
 
   private bool on_key_release (Gdk.EventKey event)
   {
-    /* HACK: Replace literals with constants when Vala supports gdkkeysyms.h */
-    switch (event.keyval)
+    string key;
+
+    key = Gdk.keyval_name (event.keyval);
+    if (strcmp (key, "Escape") == 0)
     {
-      case 0xFF1B:     /* GDK_ESCAPE */
-        action_cancelled = true;
-        if (current_mode == MediaMode.PHOTO)
-        {
-          current_countdown.stop ();
-          finish_countdown_callback ();
-        }
-        else
-        if (current_mode == MediaMode.BURST)
-        {
-          current_countdown.stop ();
-          is_bursting = false;
-          burst_take_photo ();
-        }
-        else
-        if (current_mode == MediaMode.VIDEO)
-        {
-          is_recording = true;
-          on_take_action (null);
-        }
-        action_cancelled = false;
-        break;
+      action_cancelled = true;
+      if (current_mode == MediaMode.PHOTO)
+      {
+        current_countdown.stop ();
+        finish_countdown_callback ();
+      }
+      else
+      if (current_mode == MediaMode.BURST)
+      {
+        current_countdown.stop ();
+        is_bursting = false;
+        burst_take_photo ();
+      }
+      else
+      if (current_mode == MediaMode.VIDEO)
+      {
+        is_recording = true;
+        on_take_action (null);
+      }
+      action_cancelled = false;
     }
     return false;
   }



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