[gnome-sudoku] Improvements for the Popover



commit d0d40d8e8c5169b921c5f60a6aa75a52f504263b
Author: Parin Porecha <parinporecha gmail com>
Date:   Tue Jul 15 19:13:17 2014 +0200

    Improvements for the Popover
    
    - Show popover on single click
    - make the number buttons bigger
    - Dismiss the popover on clicking same cell again
    
    https://bugzilla.gnome.org/show_bug.cgi?id=731276

 src/number-picker.vala |    8 ++++++++
 src/sudoku-view.vala   |   18 ++++++++++++++++--
 2 files changed, 24 insertions(+), 2 deletions(-)
---
diff --git a/src/number-picker.vala b/src/number-picker.vala
index 4b53774..1335d41 100644
--- a/src/number-picker.vala
+++ b/src/number-picker.vala
@@ -30,6 +30,9 @@ private class NumberPicker : Gtk.Grid
 
                 var label = new Label ("<big>%d</big>".printf (n));
                 label.use_markup = true;
+                label.margin = 4;
+                label.margin_start = 8;
+                label.margin_end = 8;
                 button.add (label);
                 label.show ();
 
@@ -74,6 +77,11 @@ private class NumberPicker : Gtk.Grid
             });
         }
 
+        this.valign = Align.CENTER;
+        this.halign = Align.CENTER;
+        this.margin = 2;
+        this.row_spacing = 3;
+        this.column_spacing = 3;
         this.show ();
     }
 
diff --git a/src/sudoku-view.vala b/src/sudoku-view.vala
index 802a5dd..bdce34c 100644
--- a/src/sudoku-view.vala
+++ b/src/sudoku-view.vala
@@ -203,8 +203,11 @@ private class SudokuCellView : Gtk.DrawingArea
             return false;
 
         if (!is_focus)
-        {
             grab_focus ();
+
+        if (popover.visible || earmark_popover.visible)
+        {
+            hide_both_popovers ();
             return false;
         }
 
@@ -240,10 +243,15 @@ private class SudokuCellView : Gtk.DrawingArea
         }
     }
 
-    private bool focus_out_cb (Gtk.Widget widget, Gdk.EventFocus event)
+    private void hide_both_popovers ()
     {
         popover.hide ();
         earmark_popover.hide ();
+    }
+
+    private bool focus_out_cb (Gtk.Widget widget, Gdk.EventFocus event)
+    {
+        hide_both_popovers ();
         return false;
     }
 
@@ -309,6 +317,12 @@ private class SudokuCellView : Gtk.DrawingArea
             return true;
         }
 
+        if (k_name == "Escape")
+        {
+            hide_both_popovers ();
+            return true;
+        }
+
         return false;
     }
 


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