From 7ea56abf05b9e6cd4e806dbfa1146562378edc7b Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Sun, 2 Mar 2008 15:37:07 -0500 Subject: add a RECONFIGURING state, and enter that when doing reconfiguring --- openbox/openbox.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'openbox/openbox.c') diff --git a/openbox/openbox.c b/openbox/openbox.c index fb1e75d0..eb7934e0 100644 --- a/openbox/openbox.c +++ b/openbox/openbox.c @@ -121,7 +121,7 @@ gint main(gint argc, gchar **argv) { gchar *program_name; - state = OB_STATE_STARTING; + ob_set_state(OB_STATE_STARTING); /* initialize the locale */ if (!setlocale(LC_ALL, "")) @@ -367,9 +367,10 @@ gint main(gint argc, gchar **argv) reconfigure = FALSE; - state = OB_STATE_RUNNING; + ob_set_state(OB_STATE_RUNNING); ob_main_loop_run(ob_main_loop); - state = OB_STATE_EXITING; + ob_set_state(reconfigure ? + OB_STATE_RECONFIGURING : OB_STATE_EXITING); if (!reconfigure) { dock_remove_all(); @@ -709,3 +710,8 @@ ObState ob_state() { return state; } + +void ob_set_state(ObState s) +{ + state = s; +} -- 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/openbox.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'openbox/openbox.c') diff --git a/openbox/openbox.c b/openbox/openbox.c index eb7934e0..377b2199 100644 --- a/openbox/openbox.c +++ b/openbox/openbox.c @@ -323,7 +323,6 @@ gint main(gint argc, gchar **argv) grab_startup(reconfigure); group_startup(reconfigure); ping_startup(reconfigure); - prompt_startup(reconfigure); client_startup(reconfigure); dock_startup(reconfigure); moveresize_startup(reconfigure); @@ -331,6 +330,7 @@ gint main(gint argc, gchar **argv) mouse_startup(reconfigure); menu_frame_startup(reconfigure); menu_startup(reconfigure); + prompt_startup(reconfigure); if (!reconfigure) { guint32 xid; @@ -377,6 +377,7 @@ gint main(gint argc, gchar **argv) client_unmanage_all(); } + prompt_shutdown(reconfigure); menu_shutdown(reconfigure); menu_frame_shutdown(reconfigure); mouse_shutdown(reconfigure); @@ -384,7 +385,6 @@ gint main(gint argc, gchar **argv) moveresize_shutdown(reconfigure); dock_shutdown(reconfigure); client_shutdown(reconfigure); - prompt_shutdown(reconfigure); ping_shutdown(reconfigure); group_shutdown(reconfigure); grab_shutdown(reconfigure); -- cgit v1.2.3 From 14f4a0ba56b5e9619c9d9e65c0a3ede41595276e Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Sun, 2 Mar 2008 16:40:40 -0500 Subject: show an error message when parsing syntax errors are encountered in the openbox config files --- openbox/openbox.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'openbox/openbox.c') diff --git a/openbox/openbox.c b/openbox/openbox.c index 377b2199..43549280 100644 --- a/openbox/openbox.c +++ b/openbox/openbox.c @@ -368,6 +368,20 @@ gint main(gint argc, gchar **argv) reconfigure = FALSE; ob_set_state(OB_STATE_RUNNING); + + /* look for parsing errors */ + { + xmlErrorPtr e = xmlGetLastError(); + if (e) { + gchar *m; + + m = g_strdup_printf(_("One or more XML syntax errors were found while parsing the Openbox configuration files. See stdout for more information. The last error seen was in file \"%s\" line %d, with message: %s"), e->file, e->line, e->message); + prompt_show_message(m, _("Close")); + g_free(m); + xmlResetError(e); + } + } + ob_main_loop_run(ob_main_loop); ob_set_state(reconfigure ? OB_STATE_RECONFIGURING : OB_STATE_EXITING); -- 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/openbox.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'openbox/openbox.c') diff --git a/openbox/openbox.c b/openbox/openbox.c index 43549280..7221556e 100644 --- a/openbox/openbox.c +++ b/openbox/openbox.c @@ -229,6 +229,8 @@ gint main(gint argc, gchar **argv) if (screen_annex()) { /* it will be ours! */ do { + ObPrompt *xmlprompt = NULL; + modkeys_startup(reconfigure); /* get the keycodes for keys we use */ @@ -376,7 +378,8 @@ gint main(gint argc, gchar **argv) gchar *m; m = g_strdup_printf(_("One or more XML syntax errors were found while parsing the Openbox configuration files. See stdout for more information. The last error seen was in file \"%s\" line %d, with message: %s"), e->file, e->line, e->message); - prompt_show_message(m, _("Close")); + xmlprompt = + prompt_show_message(m, _("Openbox Syntax Error"), _("Close")); g_free(m); xmlResetError(e); } @@ -386,6 +389,11 @@ gint main(gint argc, gchar **argv) ob_set_state(reconfigure ? OB_STATE_RECONFIGURING : OB_STATE_EXITING); + if (xmlprompt) { + prompt_unref(xmlprompt); + xmlprompt = NULL; + } + if (!reconfigure) { dock_remove_all(); client_unmanage_all(); -- cgit v1.2.3