[Xfce4-commits] [apps/xfce4-screensaver] 01/02: Avoid to hard code path (bug #14822)
noreply at xfce.org
noreply at xfce.org
Thu Nov 1 23:47:48 CET 2018
This is an automated email from the git hooks/post-receive script.
b l u e s a b r e p u s h e d a c o m m i t t o b r a n c h m a s t e r
in repository apps/xfce4-screensaver.
commit 99d44ea3a07eaa32f7256f08fac5cc76098d08bf
Author: Olivier Duchateau <duchateau.olivier at gmail.com>
Date: Thu Nov 1 19:23:38 2018 +0100
Avoid to hard code path (bug #14822)
Signed-off-by: Sean Davis <smd.seandavis at gmail.com>
---
src/gs-theme-manager.c | 3 +--
src/xfce-bg.c | 30 ++++++++++++++++++++++++++++--
2 files changed, 29 insertions(+), 4 deletions(-)
diff --git a/src/gs-theme-manager.c b/src/gs-theme-manager.c
index c3d0c69..6249027 100644
--- a/src/gs-theme-manager.c
+++ b/src/gs-theme-manager.c
@@ -65,8 +65,7 @@ static const char *known_engine_locations [] =
XSCREENSAVER_HACK_DIR,
#endif
LIBEXECDIR "/xscreensaver",
- "/usr/libexec/xscreensaver",
- "/usr/lib/xscreensaver",
+ LIBDIR "/xscreensaver",
NULL
};
diff --git a/src/xfce-bg.c b/src/xfce-bg.c
index 8077f44..82d3edf 100644
--- a/src/xfce-bg.c
+++ b/src/xfce-bg.c
@@ -34,7 +34,11 @@ Authors: Soren Sandmann <sandmann at redhat.com>
#include <math.h>
#include <stdarg.h>
#include <stdlib.h>
+#include <fcntl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <glib/gprintf.h>
#include <glib/gstdio.h>
#include <gio/gio.h>
@@ -50,7 +54,7 @@ Authors: Soren Sandmann <sandmann at redhat.com>
#include <cairo-xlib.h>
#define XFCE_BG_CACHE_DIR "xfce/background"
-#define XFCE_BG_FALLBACK_IMG "/usr/share/backgrounds/xfce/xfce-teal.jpg"
+#define XFCE_BG_FALLBACK_IMG "xfce-teal.jpg"
/* We keep the large pixbufs around if the next update
in the slideshow is less than 60 seconds away */
@@ -301,6 +305,26 @@ queue_transitioned (XfceBG *bg)
NULL);
}
+static gchar *
+find_system_backgrounds (void)
+{
+ const gchar * const *dirs;
+ gchar *path;
+ gint i;
+
+ dirs = g_get_system_data_dirs ();
+ for (i = 0; dirs[i]; i++) {
+ path = g_build_path (G_DIR_SEPARATOR_S, dirs[i],
+ "backgrounds", "xfce");
+ if (g_file_test (path, G_FILE_TEST_IS_DIR))
+ return path;
+ else
+ g_free (path);
+ }
+
+ return NULL;
+}
+
/* This function loads the user's preferences */
void
xfce_bg_load_from_preferences (XfceBG *bg,
@@ -446,7 +470,9 @@ xfce_bg_load_from_xfconf (XfceBG *bg,
property = g_strconcat(prop_prefix, "/image-path", NULL);
}
filename = NULL;
- tmp = xfconf_channel_get_string(channel, property, XFCE_BG_FALLBACK_IMG);
+ tmp = xfconf_channel_get_string(channel, property,
+ g_build_filename(find_system_backgrounds(),
+ XFCE_BG_FALLBACK_IMG));
if (tmp && *tmp != '\0') {
/* FIXME: UTF-8 checks should go away.
* picture-filename is of type string, which can only be used for
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list