diff options
| author | Dana Jansens <danakj@orodu.net> | 2013-08-10 20:46:27 -0400 |
|---|---|---|
| committer | Dana Jansens <danakj@orodu.net> | 2013-08-10 21:59:12 -0400 |
| commit | 4e6c0086a657399d989f2e4849f7b397d7d4efbc (patch) | |
| tree | 64cb34f3a3ee63df40443e39661c33a060953860 /openbox/openbox.c | |
| parent | a5eb363f48b75b6eae0a1dc4a6c8e079c9831f92 (diff) | |
Add support for loading SVG icons using librsvg.
This adds a configure option --disable-librsvg, but defaults to
using the library if it is present during configure.
When enabled, Openbox will attempt to load svg image files using
the library, similar to how Imlib2 is used for other image
formats.
Since librsvg uses the libXml2 library, their errors end up in
the same global namespace as Openbox config file parsing. To
avoid this, we reset the libXml current error whenever we start
loading a file, and save the last error that occurred when we
are finished, by storing the error in the ObtXmlInst.
Diffstat (limited to 'openbox/openbox.c')
| -rw-r--r-- | openbox/openbox.c | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/openbox/openbox.c b/openbox/openbox.c index 4ac09cd6..cba04995 100644 --- a/openbox/openbox.c +++ b/openbox/openbox.c @@ -224,6 +224,7 @@ gint main(gint argc, gchar **argv) event_reset_time(); do { + gchar *xml_error_string = NULL; ObPrompt *xmlprompt = NULL; if (reconfigure) obt_keyboard_reload(); @@ -264,6 +265,14 @@ gint main(gint argc, gchar **argv) else OBT_PROP_ERASE(obt_root(ob_screen), OB_CONFIG_FILE); + if (obt_xml_last_error(i)) { + xml_error_string = 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"), + obt_xml_last_error_file(i), + obt_xml_last_error_line(i), + obt_xml_last_error_message(i)); + } + /* we're done with parsing now, kill it */ obt_xml_instance_unref(i); } @@ -362,17 +371,12 @@ gint main(gint argc, gchar **argv) reconfigure = FALSE; /* 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); - xmlprompt = - prompt_show_message(m, _("Openbox Syntax Error"), _("Close")); - g_free(m); - xmlResetError(e); - } + if (xml_error_string) { + xmlprompt = prompt_show_message(xml_error_string, + _("Openbox Syntax Error"), + _("Close")); + g_free(xml_error_string); + xml_error_string = NULL; } g_main_loop_run(ob_main_loop); |
