From 8562034e30e8b319a746009859cbefc1f41b41f5 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Sun, 2 Mar 2008 15:28:22 -0500 Subject: glib already prints a verbose error message when execute fails. don't add a second level of useless verbosity to that --- openbox/actions/execute.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'openbox/actions/execute.c') diff --git a/openbox/actions/execute.c b/openbox/actions/execute.c index eb1b461d..f87fe00c 100644 --- a/openbox/actions/execute.c +++ b/openbox/actions/execute.c @@ -143,7 +143,7 @@ static gboolean run_func(ObActionsData *data, gpointer options) event_cancel_all_key_grabs(); if (!g_shell_parse_argv(cmd, NULL, &argv, &e)) { - g_message(_("Failed to execute \"%s\": %s"), o->cmd, e->message); + g_message(e->message, o->cmd); g_error_free(e); } else { @@ -162,7 +162,7 @@ static gboolean run_func(ObActionsData *data, gpointer options) G_SPAWN_SEARCH_PATH | G_SPAWN_DO_NOT_REAP_CHILD, NULL, NULL, NULL, &e)) { - g_message(_("Failed to execute \"%s\": %s"), o->cmd, e->message); + g_message(e->message, o->cmd); g_error_free(e); if (o->sn) -- 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/execute.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'openbox/actions/execute.c') diff --git a/openbox/actions/execute.c b/openbox/actions/execute.c index f87fe00c..636dbebf 100644 --- a/openbox/actions/execute.c +++ b/openbox/actions/execute.c @@ -98,11 +98,15 @@ static Options* dup_options(Options *in) static gboolean run_func(ObActionsData *data, gpointer options); -static void prompt_cb(ObPrompt *p, gint result, gpointer options) +static gboolean prompt_cb(ObPrompt *p, gint result, gpointer options) { if (result) run_func(NULL, options); + return TRUE; /* call the cleanup func */ +} +static void prompt_cleanup(ObPrompt *p, gpointer options) +{ prompt_unref(p); free_func(options); } @@ -126,7 +130,8 @@ static gboolean run_func(ObActionsData *data, gpointer options) }; ocp = dup_options(options); - p = prompt_new(o->prompt, answers, 2, 0, 0, prompt_cb, ocp); + p = prompt_new(o->prompt, answers, 2, 0, 0, + prompt_cb, prompt_cleanup, ocp); prompt_show(p, NULL, FALSE); return FALSE; -- 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/execute.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'openbox/actions/execute.c') diff --git a/openbox/actions/execute.c b/openbox/actions/execute.c index 636dbebf..cb3ab247 100644 --- a/openbox/actions/execute.c +++ b/openbox/actions/execute.c @@ -130,7 +130,7 @@ static gboolean run_func(ObActionsData *data, gpointer options) }; ocp = dup_options(options); - p = prompt_new(o->prompt, answers, 2, 0, 0, + p = prompt_new(o->prompt, _("Execute"), answers, 2, 0, 0, prompt_cb, prompt_cleanup, ocp); prompt_show(p, NULL, FALSE); -- cgit v1.2.3