mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-28 06:21:14 +00:00
gtk-demo: Improve an error message
Be more helpful when we can't do syntax highlighting.
This commit is contained in:
parent
d1d269ea6b
commit
4f5e3b7b0d
@ -239,7 +239,6 @@ fontify_text (const char *format,
|
|||||||
const char *text)
|
const char *text)
|
||||||
{
|
{
|
||||||
GSubprocess *subprocess;
|
GSubprocess *subprocess;
|
||||||
static gboolean warned = FALSE;
|
|
||||||
GBytes *stdin_buf;
|
GBytes *stdin_buf;
|
||||||
GBytes *stdout_buf = NULL;
|
GBytes *stdout_buf = NULL;
|
||||||
GBytes *stderr_buf = NULL;
|
GBytes *stderr_buf = NULL;
|
||||||
@ -259,11 +258,19 @@ fontify_text (const char *format,
|
|||||||
|
|
||||||
if (!subprocess)
|
if (!subprocess)
|
||||||
{
|
{
|
||||||
if (!warned)
|
if (g_error_matches (error, G_SPAWN_ERROR, G_SPAWN_ERROR_NOENT))
|
||||||
{
|
{
|
||||||
g_warning ("%s", error->message);
|
static gboolean warned = FALSE;
|
||||||
warned = TRUE;
|
|
||||||
|
if (!warned)
|
||||||
|
{
|
||||||
|
warned = TRUE;
|
||||||
|
g_message ("For syntax highlighting, install the “highlight” program");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
g_warning ("%s", error->message);
|
||||||
|
|
||||||
g_clear_error (&error);
|
g_clear_error (&error);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user