From 527ecafab95e66a6f0cedd6967fe2c61dfe85101 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Sun, 2 Mar 2008 16:04:28 -0500 Subject: the #ifdef was backwards for using SM or not --- openbox/actions/session.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'openbox/actions/session.c') diff --git a/openbox/actions/session.c b/openbox/actions/session.c index 2c373654..fc66d25b 100644 --- a/openbox/actions/session.c +++ b/openbox/actions/session.c @@ -35,7 +35,7 @@ static void prompt_cb(ObPrompt *p, gint result, gpointer data) { Options *o = data; if (result) { -#ifndef USE_SM +#ifdef USE_SM session_request_logout(o->silent); #else g_message(_("The SessionLogout actions is not available since Openbox was built without session management support")); -- cgit v1.2.3 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/actions/session.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'openbox/actions/session.c') 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 -- 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/actions/session.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'openbox/actions/session.c') diff --git a/openbox/actions/session.c b/openbox/actions/session.c index ef1497c1..8fb4f4d7 100644 --- a/openbox/actions/session.c +++ b/openbox/actions/session.c @@ -64,7 +64,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?"), + p = prompt_new(_("Are you sure you want to log out?"), NULL, answers, 2, 0, 0, prompt_cb, prompt_cleanup, o2); prompt_show(p, NULL, FALSE); } -- cgit v1.2.3 From f542c5143ac115937c5ee8f3a229e557383cd180 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Sun, 2 Mar 2008 17:19:39 -0500 Subject: add a title to the session logout confirm prompt --- openbox/actions/session.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'openbox/actions/session.c') diff --git a/openbox/actions/session.c b/openbox/actions/session.c index 8fb4f4d7..9bc9ea80 100644 --- a/openbox/actions/session.c +++ b/openbox/actions/session.c @@ -64,7 +64,8 @@ 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?"), NULL, + p = prompt_new(_("Are you sure you want to log out?"), + _("Log out"), answers, 2, 0, 0, prompt_cb, prompt_cleanup, o2); prompt_show(p, NULL, FALSE); } -- cgit v1.2.3