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/client.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/client.c')
| -rw-r--r-- | openbox/client.c | 14 |
1 files changed, 12 insertions, 2 deletions
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); } |
