summaryrefslogtreecommitdiff
path: root/openbox/actions/exit.c
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2008-03-02 16:11:05 -0500
committerDana Jansens <danakj@orodu.net>2008-03-02 16:13:23 -0500
commitbb557f06a6828a95ee94c7579919dec1ee014484 (patch)
treea1a010bf38eb3ecf7c06b2f939d4f772603d600b /openbox/actions/exit.c
parent527ecafab95e66a6f0cedd6967fe2c61dfe85101 (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/exit.c')
-rw-r--r--openbox/actions/exit.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/openbox/actions/exit.c b/openbox/actions/exit.c
index 747514f6..67545cd2 100644
--- a/openbox/actions/exit.c
+++ b/openbox/actions/exit.c
@@ -29,10 +29,15 @@ static gpointer setup_func(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node)
return o;
}
-static void prompt_cb(ObPrompt *p, gint result, gpointer data)
+static gboolean prompt_cb(ObPrompt *p, gint result, gpointer data)
{
if (result)
ob_exit(0);
+ return TRUE; /* call the cleanup func */
+}
+
+static void prompt_cleanup(ObPrompt *p, gpointer data)
+{
prompt_unref(p);
}
@@ -49,7 +54,7 @@ static gboolean run_func(ObActionsData *data, gpointer options)
};
p = prompt_new(_("Are you sure you want to exit Openbox?"),
- answers, 2, 0, 0, prompt_cb, NULL);
+ answers, 2, 0, 0, prompt_cb, prompt_cleanup, NULL);
prompt_show(p, NULL, FALSE);
}
else