summaryrefslogtreecommitdiff
path: root/openbox/actions/session.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/session.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/session.c')
-rw-r--r--openbox/actions/session.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/openbox/actions/session.c b/openbox/actions/session.c
index fc66d25b..ef1497c1 100644
--- a/openbox/actions/session.c
+++ b/openbox/actions/session.c
@@ -31,7 +31,7 @@ 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)
{
Options *o = data;
if (result) {
@@ -41,7 +41,12 @@ static void prompt_cb(ObPrompt *p, gint result, gpointer data)
g_message(_("The SessionLogout actions is not available since Openbox was built without session management support"));
#endif
}
- g_free(o);
+ return TRUE; /* call cleanup func */
+}
+
+static void prompt_cleanup(ObPrompt *p, gpointer data)
+{
+ g_free(data);
prompt_unref(p);
}
@@ -60,7 +65,7 @@ static gboolean logout_func(ObActionsData *data, gpointer options)
o2 = g_memdup(o, sizeof(Options));
p = prompt_new(_("Are you sure you want to log out?"),
- answers, 2, 0, 0, prompt_cb, o2);
+ answers, 2, 0, 0, prompt_cb, prompt_cleanup, o2);
prompt_show(p, NULL, FALSE);
}
else