From bb557f06a6828a95ee94c7579919dec1ee014484 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Sun, 2 Mar 2008 16:11:05 -0500 Subject: 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 --- openbox/client.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'openbox/client.c') diff --git a/openbox/client.c b/openbox/client.c index 98d1035b..44b12870 100644 --- a/openbox/client.c +++ b/openbox/client.c @@ -3400,12 +3400,20 @@ void client_close(ObClient *self) #define OB_KILL_RESULT_NO 0 #define OB_KILL_RESULT_YES 1 -static void client_kill_requested(ObPrompt *p, gint result, gpointer data) +static gboolean client_kill_requested(ObPrompt *p, gint result, gpointer data) { ObClient *self = data; if (result == OB_KILL_RESULT_YES) client_kill(self); + return TRUE; /* call the cleanup func */ +} + +static void client_kill_cleanup(ObPrompt *p, gpointer data) +{ + ObClient *self = data; + + g_assert(p == self->kill_prompt); prompt_unref(self->kill_prompt); self->kill_prompt = NULL; @@ -3456,7 +3464,9 @@ static void client_prompt_kill(ObClient *self) sizeof(answers)/sizeof(answers[0]), OB_KILL_RESULT_NO, /* default = no */ OB_KILL_RESULT_NO, /* cancel = no */ - client_kill_requested, self); + client_kill_requested, + client_kill_cleanup, + self); g_free(m); } -- cgit v1.2.3 From 9d9ca8d1cf76a63767aef4bd74f5caceaad5ff23 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Sun, 2 Mar 2008 17:12:11 -0500 Subject: allow prompts to have titles specified. show a prompt when there are syntax errors in the xml config files. --- openbox/client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'openbox/client.c') diff --git a/openbox/client.c b/openbox/client.c index 44b12870..82976f6a 100644 --- a/openbox/client.c +++ b/openbox/client.c @@ -3460,7 +3460,7 @@ static void client_prompt_kill(ObClient *self) answers[0].text = _("Cancel"); /* "no" */ answers[1].text = y; /* "yes" */ - self->kill_prompt = prompt_new(m, answers, + self->kill_prompt = prompt_new(m, NULL, answers, sizeof(answers)/sizeof(answers[0]), OB_KILL_RESULT_NO, /* default = no */ OB_KILL_RESULT_NO, /* cancel = no */ -- cgit v1.2.3