]> git.cworth.org Git - wordgame/commitdiff
Fix refresh bug for solution widget
authorCarl Worth <cworth@cworth.org>
Mon, 18 Dec 2006 17:51:54 +0000 (09:51 -0800)
committerCarl Worth <cworth@cworth.org>
Mon, 18 Dec 2006 17:51:54 +0000 (09:51 -0800)
All we were missing was a simple call to goo_canvas_item_simple_changed

rack-fancy.c

index f2caa13adae6daa53bd43cf896903fda61598dde..d08cd539c61615450c64c6ebd54b64bb95104e03 100644 (file)
@@ -46,6 +46,7 @@ typedef struct _rack
     char guess[MAX_TILES+1];
     int guess_length;
     dict_t *solution;
+    GooCanvasItem *solution_item;
 } rack_t;
 
 static rack_t the_rack;
@@ -261,6 +262,7 @@ rack_init (rack_t *rack, GooCanvasItem *parent, char *word, dict_t *solution)
        rack->tiles[i] = NULL;
     rack->guess_length = 0;
     rack->solution = solution;
+    rack->solution_item = NULL;
 }
 
 static gboolean
@@ -322,9 +324,7 @@ on_key_press_event (GtkWidget       *widget,
        entry = dict_lookup (rack->solution, rack->guess);
        if (DICT_ENTRY_IS_WORD (entry)) {
            *entry = *entry | RACK_DICT_ENTRY_FOUND;
-           printf ("%s is good\n", rack->guess);
-       } else {
-           printf ("%s is not a word\n", rack->guess);
+           goo_canvas_item_simple_changed (GOO_CANVAS_ITEM_SIMPLE (rack->solution_item), FALSE);
        }
        rack_return_all (rack);
        return TRUE;
@@ -420,12 +420,12 @@ create_canvas (GtkWidget *parent, char *word, dict_t *solution)
 
     rack_init (&the_rack, root, word, solution);
 
-    goo_demo_item_new (root,
-                      LETTER_PAD,
-                      LETTER_PAD + 2 * (LETTER_SIZE + 2 * LETTER_PAD),
-                      400, 400 - (2 * (LETTER_SIZE + 2 * LETTER_PAD)),
-                      dict_paint,
-                      solution, NULL);
+    the_rack.solution_item = goo_demo_item_new (root,
+                                               LETTER_PAD,
+                                               LETTER_PAD + 2 * (LETTER_SIZE + 2 * LETTER_PAD),
+                                               400, 400 - (2 * (LETTER_SIZE + 2 * LETTER_PAD)),
+                                               dict_paint,
+                                               solution, NULL);
 }
 
 int