diff options
-rw-r--r-- | configure.in | 19 | ||||
-rw-r--r-- | plugins/glue/xorg/ohm-plugin-xorg.c | 21 |
2 files changed, 33 insertions, 7 deletions
diff --git a/configure.in b/configure.in index b09441d..9eda015 100644 --- a/configure.in +++ b/configure.in @@ -112,6 +112,25 @@ AC_SUBST(OHM_PLUGIN_DIR, "\$(libdir)/ohm") AC_SUBST(OHM_PLUGIN_CFLAGS, "-I\$(top_srcdir)/ohmd $GLIB_CFLAGS $DBUS_CFLAGS $GMODULE_CFLAGS") AC_SUBST(OHM_PLUGIN_LIBS, "$GLIB_LIBS $DBUS_LIBS $GMODULE_LIBS") +dnl Assume single-user-device for now +single_user_device="yes" + +if test "$single_user_device" = yes; then + AC_DEFINE(OHM_SINGLE_USER_DEVICE, 1, [Whether OHM is built for a single-user device with a known .Xauthority location]) + + AC_ARG_WITH(xauth-dir, + [AC_HELP_STRING([--with-xauth-dir=<dir>], + [directory where we can find .Xauthority (for single-user device)] + )] + ) + + if test -z "$with_xauth_dir"; then + AC_MSG_ERROR([Must use --with-xauth-dir for a single-user device]) + else + AC_DEFINE(OHM_DEVICE_XAUTH_DIR, "$xauth_dir", [Where to find .Xauthority]) + fi +fi + dnl --------------------------------------------------------------------------- dnl - Where should we put documentation ? dnl --------------------------------------------------------------------------- diff --git a/plugins/glue/xorg/ohm-plugin-xorg.c b/plugins/glue/xorg/ohm-plugin-xorg.c index 3f0b226..f91c8af 100644 --- a/plugins/glue/xorg/ohm-plugin-xorg.c +++ b/plugins/glue/xorg/ohm-plugin-xorg.c @@ -35,20 +35,27 @@ plugin_poll_startup (gpointer data) gboolean ret; const gchar *xauth; - /* we should search all of home */ - xauth = "/home/olpc/.Xauthority"; +#ifdef OHM_SINGLE_USER_DEVICE + xauth = OHM_DEVICE_XAUTH_DIR "/.Xauthority"; + g_debug ("xorg: testing %s", xauth); ret = g_file_test (xauth, G_FILE_TEST_EXISTS); - /* be nice to hughsie... */ + /* be nice to developers... */ if (ret == FALSE) { - xauth = "/home/hughsie/.Xauthority"; - ret = g_file_test (xauth, G_FILE_TEST_EXISTS); + const char *home = getenv("HOME"); + if (home != NULL) { + xauth = g_strdup_printf ("%s/.Xauthority", home); + g_debug ("xorg: testing %s", xauth); + ret = g_file_test (xauth, G_FILE_TEST_EXISTS); + } } if (ret == FALSE) { - /* not yet */ + g_debug ("xorg: no .Xauthority found"); return TRUE; } - +#else +#error ConsoleKit support not yet implemented +#endif /* woot! X is alive */ g_debug ("Got X!"); ohm_plugin_conf_set_key (plugin, "xorg.has_xauthority", 1); |