[gnome-games/sudoku-vala] sudoku: Allow editing notes
- From: Robert Ancell <rancell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games/sudoku-vala] sudoku: Allow editing notes
- Date: Mon, 11 Jul 2011 23:39:36 +0000 (UTC)
commit 35a21669ab4292f8118de59d636297c093d5901b
Author: LubomÃr SedlÃÅ <lubomir sedlar gmail com>
Date: Mon Jul 4 21:36:42 2011 +0200
sudoku: Allow editing notes
gnome-sudoku/src/sudoku-view.vala | 19 +++++++++++++++----
1 files changed, 15 insertions(+), 4 deletions(-)
---
diff --git a/gnome-sudoku/src/sudoku-view.vala b/gnome-sudoku/src/sudoku-view.vala
index b54d0c0..722eb9b 100644
--- a/gnome-sudoku/src/sudoku-view.vala
+++ b/gnome-sudoku/src/sudoku-view.vala
@@ -18,6 +18,9 @@ private class SudokuCellView : Gtk.DrawingArea
get { return _cell; }
}
+ public string top_notes { set; get; default = ""; }
+ public string bottom_notes { set; get; default = ""; }
+
private string _text;
public string text
{
@@ -153,6 +156,11 @@ private class SudokuCellView : Gtk.DrawingArea
popup.set_size_request (get_allocated_width (), -1);
var entry = new Gtk.Entry ();
+ entry.has_frame = false;
+ if (top == 0)
+ entry.set_text (top_notes);
+ else
+ entry.set_text (bottom_notes);
popup.add (entry);
entry.focus_out_event.connect (() => {
@@ -163,7 +171,10 @@ private class SudokuCellView : Gtk.DrawingArea
entry.activate.connect (() => {
editing_notes = false;
- stdout.printf ("activate");
+ if (top == 0)
+ top_notes = entry.get_text ();
+ else
+ bottom_notes = entry.get_text ();
hide_popup ();
});
@@ -183,7 +194,7 @@ private class SudokuCellView : Gtk.DrawingArea
return false;
}
- public override bool key_release_event (Gdk.EventKey event)
+ public override bool key_press_event (Gdk.EventKey event)
{
// FIXME: Can't find vala bindings to Gdk keyvals...
@@ -242,10 +253,10 @@ private class SudokuCellView : Gtk.DrawingArea
c.set_font_size (note_size);
c.move_to (0, note_size);
- c.show_text ("123456789");
+ c.show_text (top_notes);
c.move_to (0, (get_allocated_height () - 3));
- c.show_text ("123456789");
+ c.show_text (bottom_notes);
return false;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]