Define mnemonics for main menu bar
[xboard.git] / gtk / xboard.c
index 8a2b887..3588c9d 100644 (file)
@@ -2317,6 +2317,9 @@ void FileNamePopUpWrapper(label, def, filter, proc, pathFlag, openMode, name, fp
   char fileext[10] = "";
   char *result     = NULL;
   char *cp;
+  char curDir[MSG_SIZ];
+
+  StartDir(filter, NULL); // change to start directory for this file type
 
   /* make a copy of the filter string, so that strtok can work with it*/
   cp = strdup(filter);
@@ -2390,12 +2393,16 @@ void FileNamePopUpWrapper(label, def, filter, proc, pathFlag, openMode, name, fp
            ASSIGN(*name, filename);
            ScheduleDelayedEvent(DelayedLoad, 50);
         }
+      StartDir(filter, filename);
       g_free (filename);
-    };
+    }
+  else StartDir(filter, "");
 
   gtk_widget_destroy (dialog);
   ModeHighlight();
 
+  if(def && *def && def[strlen(def)-1] == '/') chdir(curDir);
+
   free(cp);
   return;