Improve support for PROGNAME_DESKTOP

This commit is contained in:
Pierre Pronchery 2017-12-28 05:26:16 +01:00
parent 21c08442ff
commit 0558a7cb68
2 changed files with 11 additions and 10 deletions

View File

@ -64,14 +64,14 @@
/* constants */ /* constants */
#ifndef PROGNAME #ifndef PROGNAME_DESKTOP
# define PROGNAME "desktop" # define PROGNAME_DESKTOP "desktop"
#endif #endif
#ifndef PREFIX #ifndef PREFIX
# define PREFIX "/usr/local" # define PREFIX "/usr/local"
#endif #endif
#ifndef DATADIR #ifndef DATADIR
# define DATADIR PREFIX "/share" # define DATADIR PREFIX "/share"
#endif #endif
@ -1438,7 +1438,7 @@ static int _desktop_error(Desktop * desktop, char const * message,
static int _error_text(char const * message, char const * error, int ret) static int _error_text(char const * message, char const * error, int ret)
{ {
fprintf(stderr, "%s: %s%s%s\n", PROGNAME, fprintf(stderr, "%s: %s%s%s\n", PROGNAME_DESKTOP,
(message != NULL) ? message : "", (message != NULL) ? message : "",
(message != NULL) ? ": " : "", error); (message != NULL) ? ": " : "", error);
return ret; return ret;
@ -2443,7 +2443,7 @@ static void _on_preferences_response_apply(gpointer data)
{ {
/* FIXME save configuration in _on_preferences_ok() instead */ /* FIXME save configuration in _on_preferences_ok() instead */
if(config_save(config, p) != 0) if(config_save(config, p) != 0)
error_print(PROGNAME); error_print(PROGNAME_DESKTOP);
string_delete(p); string_delete(p);
} }
config_delete(config); config_delete(config);

View File

@ -53,15 +53,15 @@
/* constants */ /* constants */
#ifndef PROGNAME
# define PROGNAME "desktop"
#endif
#ifndef PROGNAME_BROWSER #ifndef PROGNAME_BROWSER
# define PROGNAME_BROWSER "browser" # define PROGNAME_BROWSER "browser"
#endif #endif
#ifndef PROGNAME_DELETE #ifndef PROGNAME_DELETE
# define PROGNAME_DELETE "delete" # define PROGNAME_DELETE "delete"
#endif #endif
#ifndef PROGNAME_DESKTOP
# define PROGNAME_DESKTOP "desktop"
#endif
#ifndef PROGNAME_HTMLAPP #ifndef PROGNAME_HTMLAPP
# define PROGNAME_HTMLAPP "htmlapp" # define PROGNAME_HTMLAPP "htmlapp"
#endif #endif
@ -186,7 +186,8 @@ DesktopIcon * desktopicon_new(Desktop * desktop, char const * name,
if((p = g_filename_to_utf8(path, -1, NULL, NULL, &error)) if((p = g_filename_to_utf8(path, -1, NULL, NULL, &error))
== NULL) == NULL)
{ {
fprintf(stderr, "%s%s\n", "desktop: ", error->message); fprintf(stderr, "%s: %s\n", PROGNAME_DESKTOP,
error->message);
name = path; name = path;
} }
else else