I would recommend against making different types of clicks performHeHe, since I am the user I will not get confused but I actually disagree
different actions on the button. That will be really confusing to
users.
> 1) The board generation is run by a Worker which eventually ends up
> at:
> puzzle = QQwing.generate_puzzle ((int) category); // in
> sudoku-generator.vala
> So when the first run is performed for a number of boards how do
> I get
> new boards when
> I need to fill up the list?
Currently there's no saved state, we just generate a bunch of boards,
add them to a list, and return them.
You probably don't want to modify
the SudokuGenerator as the code there is tricky. The public interface
is pretty easy to use, though, so I would use that to get new boards
when you want them:
SudokuGenerator.generate_boards_async.begin (num_boards, difficulty, (obj, res) => {
try {
var boards = SudokuGenerator.generate_boards_async.end (res);
// Do something with your boards
} catch (Error e) {
// ThreadError or IOError, unlikely
}
});
Then store the boards you get from that in some other list somewhere
and call it again whenever you want to get some new boards to add to
your list.
If you haven't worked with async functions before: the implementation
is a bit tricky but they're easy to use. The begin function returns
immediately, you pass to it a GAsyncReadyCallback that will be executed
sometime in the future when it completes. Usually easiest to use a
lambda for this, if the implementation is small. Inside that callback,
you pass the GAsyncResult res to the end function, and out pops your
result. If the async function throws an exception (generate_boards can
throw two types of exceptions), it will be thrown from the end
function.
Michael