aboutsummaryrefslogtreecommitdiff
path: root/midend.c
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>2013-03-31 09:58:52 +0000
committerSimon Tatham <anakin@pobox.com>2013-03-31 09:58:52 +0000
commitbb14689b4a555b4b176192d2c3cd02a4c354a37f (patch)
tree6377b0f21fc1c9ba18716f3e4bdb7c07500d018e /midend.c
parentbf696f83fc8076e748c04a53f425aa29d78c020d (diff)
downloadpuzzles-bb14689b4a555b4b176192d2c3cd02a4c354a37f.zip
puzzles-bb14689b4a555b4b176192d2c3cd02a4c354a37f.tar.gz
puzzles-bb14689b4a555b4b176192d2c3cd02a4c354a37f.tar.bz2
puzzles-bb14689b4a555b4b176192d2c3cd02a4c354a37f.tar.xz
Introduce a mechanism by which calls to midend_supersede_game_desc()
can trigger a call to a front end notification function. Use this to update the game ID permalink when Mines supersedes its game ID. [originally from svn r9793]
Diffstat (limited to 'midend.c')
-rw-r--r--midend.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/midend.c b/midend.c
index fddf01d..d55be55 100644
--- a/midend.c
+++ b/midend.c
@@ -81,6 +81,9 @@ struct midend {
int pressed_mouse_button;
int preferred_tilesize, tilesize, winwidth, winheight;
+
+ void (*game_desc_change_notify_function)(void *);
+ void *game_desc_change_notify_ctx;
};
#define ensure(me) do { \
@@ -1079,12 +1082,20 @@ int midend_wants_statusbar(midend *me)
return me->ourgame->wants_statusbar;
}
+void midend_request_desc_changes(midend *me, void (*notify)(void *), void *ctx)
+{
+ me->game_desc_change_notify_function = notify;
+ me->game_desc_change_notify_ctx = ctx;
+}
+
void midend_supersede_game_desc(midend *me, char *desc, char *privdesc)
{
sfree(me->desc);
sfree(me->privdesc);
me->desc = dupstr(desc);
me->privdesc = privdesc ? dupstr(privdesc) : NULL;
+ if (me->game_desc_change_notify_function)
+ me->game_desc_change_notify_function(me->game_desc_change_notify_ctx);
}
config_item *midend_get_config(midend *me, int which, char **wintitle)