diff options
| author | Dana Jansens <danakj@orodu.net> | 2008-03-02 16:11:05 -0500 |
|---|---|---|
| committer | Dana Jansens <danakj@orodu.net> | 2008-03-02 16:13:23 -0500 |
| commit | bb557f06a6828a95ee94c7579919dec1ee014484 (patch) | |
| tree | a1a010bf38eb3ecf7c06b2f939d4f772603d600b /openbox/actions/execute.c | |
| parent | 527ecafab95e66a6f0cedd6967fe2c61dfe85101 (diff) | |
add a cleanup callback to the prompt interface. when the prompt's callback returns TRUE, then the cleanup function is called. likewise when the prompt system is shutdown (openbox is exiting), then the cleanup function is also called. it should unref/destroy the prompt and any memory associated with it
Diffstat (limited to 'openbox/actions/execute.c')
| -rw-r--r-- | openbox/actions/execute.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/openbox/actions/execute.c b/openbox/actions/execute.c index f87fe00c..636dbebf 100644 --- a/openbox/actions/execute.c +++ b/openbox/actions/execute.c @@ -98,11 +98,15 @@ static Options* dup_options(Options *in) static gboolean run_func(ObActionsData *data, gpointer options); -static void prompt_cb(ObPrompt *p, gint result, gpointer options) +static gboolean prompt_cb(ObPrompt *p, gint result, gpointer options) { if (result) run_func(NULL, options); + return TRUE; /* call the cleanup func */ +} +static void prompt_cleanup(ObPrompt *p, gpointer options) +{ prompt_unref(p); free_func(options); } @@ -126,7 +130,8 @@ static gboolean run_func(ObActionsData *data, gpointer options) }; ocp = dup_options(options); - p = prompt_new(o->prompt, answers, 2, 0, 0, prompt_cb, ocp); + p = prompt_new(o->prompt, answers, 2, 0, 0, + prompt_cb, prompt_cleanup, ocp); prompt_show(p, NULL, FALSE); return FALSE; |
