Move the colour configuration into midend.c so that it becomes
[sgt/puzzles] / gtk.c
diff --git a/gtk.c b/gtk.c
index 24b2cca..55bc179 100644 (file)
--- a/gtk.c
+++ b/gtk.c
@@ -937,6 +937,13 @@ static void menu_solve_event(GtkMenuItem *menuitem, gpointer data)
        error_box(fe->window, msg);
 }
 
+static void menu_restart_event(GtkMenuItem *menuitem, gpointer data)
+{
+    frontend *fe = (frontend *)data;
+
+    midend_restart_game(fe->me);
+}
+
 static void menu_config_event(GtkMenuItem *menuitem, gpointer data)
 {
     frontend *fe = (frontend *)data;
@@ -1032,7 +1039,12 @@ static frontend *new_window(char *game_id, char **error)
     gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), menu);
 
     add_menu_item_with_key(fe, GTK_CONTAINER(menu), "New", 'n');
-    add_menu_item_with_key(fe, GTK_CONTAINER(menu), "Restart", 'r');
+
+    menuitem = gtk_menu_item_new_with_label("Restart");
+    gtk_container_add(GTK_CONTAINER(menu), menuitem);
+    gtk_signal_connect(GTK_OBJECT(menuitem), "activate",
+                      GTK_SIGNAL_FUNC(menu_restart_event), fe);
+    gtk_widget_show(menuitem);
 
     menuitem = gtk_menu_item_new_with_label("Specific...");
     gtk_object_set_data(GTK_OBJECT(menuitem), "user-data",
@@ -1131,24 +1143,9 @@ static frontend *new_window(char *game_id, char **error)
         fe->ncolours = ncolours;
         fe->colours = snewn(ncolours, GdkColor);
         for (i = 0; i < ncolours; i++) {
-            /*
-             * Just for Gareth: if you dislike any of the standard
-             * colours, here's your chance to configure them in a
-             * really hacky way. 
-             */
-            char buf[80], *e;
-            unsigned int r, g, b;
-            sprintf(buf, "PUZZLE_COLOUR_%d", i);
-            if ((e = getenv(buf)) != NULL &&
-                sscanf(e, "%2x%2x%2x", &r, &g, &b) == 3) {
-                fe->colours[i].red = r * 0x101;
-                fe->colours[i].green = g * 0x101;
-                fe->colours[i].blue = b * 0x101;
-            } else {
-                fe->colours[i].red = colours[i*3] * 0xFFFF;
-                fe->colours[i].green = colours[i*3+1] * 0xFFFF;
-                fe->colours[i].blue = colours[i*3+2] * 0xFFFF;
-            }
+            fe->colours[i].red = colours[i*3] * 0xFFFF;
+            fe->colours[i].green = colours[i*3+1] * 0xFFFF;
+            fe->colours[i].blue = colours[i*3+2] * 0xFFFF;
         }
         success = snewn(ncolours, gboolean);
         gdk_colormap_alloc_colors(fe->colmap, fe->colours, ncolours,