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/prompt.h | |
| 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/prompt.h')
| -rw-r--r-- | openbox/prompt.h | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/openbox/prompt.h b/openbox/prompt.h index c4558ad2..007dae93 100644 --- a/openbox/prompt.h +++ b/openbox/prompt.h @@ -29,7 +29,8 @@ typedef struct _ObPrompt ObPrompt; typedef struct _ObPromptElement ObPromptElement; typedef struct _ObPromptAnswer ObPromptAnswer; -typedef void (*ObPromptCallback)(ObPrompt *p, gint result, gpointer data); +typedef gboolean (*ObPromptCallback)(ObPrompt *p, gint result, gpointer data); +typedef void (*ObPromptCleanup)(ObPrompt *p, gpointer data); struct _ObPromptElement { gchar *text; @@ -69,6 +70,7 @@ struct _ObPrompt gint cancel_result; ObPromptCallback func; + ObPromptCleanup cleanup; gpointer data; }; @@ -90,12 +92,19 @@ void prompt_shutdown(gboolean reconfig); of having a button presssed @param func The callback function which is called when the dialog is closed or a button is pressed + @param cleanup The cleanup function which is called if the prompt system + is shutting down, and someone is still holding a reference to the + prompt. This callback should cause the prompt's refcount to go to + zero so it can be freed, and free any other memory associated with + the prompt. The cleanup function is also called if the prompt's + callback function returns TRUE. @param data User defined data which will be passed to the callback */ ObPrompt* prompt_new(const gchar *msg, const ObPromptAnswer *answers, gint n_answers, gint default_result, gint cancel_result, - ObPromptCallback func, gpointer data); + ObPromptCallback func, ObPromptCleanup cleanup, + gpointer data); void prompt_ref(ObPrompt *self); void prompt_unref(ObPrompt *self); |
