[gnome-session] Only support UPower 0.9



commit 3b518cadecf07f3885b2207152fff92e4f4aaff1
Author: Colin Walters <walters verbum org>
Date:   Thu Oct 17 08:41:51 2013 -0400

    Only support UPower 0.9
    
    Newer UPower drops support for APIs that duplicate systemd/logind, so
    if we detect it, then require consumers to use the systemd backend.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=710383

 configure.ac               |   10 +++++++++-
 gnome-session/Makefile.am  |    8 ++++++--
 gnome-session/gsm-system.c |    4 ++++
 3 files changed, 19 insertions(+), 3 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index bb3d02b..b470d3d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -64,11 +64,18 @@ PKG_CHECK_MODULES(GNOME_SESSION,
         glib-2.0 >= $GLIB_REQUIRED
         gio-2.0 >= $GLIB_REQUIRED
         dbus-glib-1 >= $DBUS_GLIB_REQUIRED
-        upower-glib >= $UPOWER_REQUIRED
         json-glib-1.0 >= $JSON_GLIB_REQUIRED
         gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED
 )
 
+dnl We can only support old upower
+dnl https://bugzilla.gnome.org/show_bug.cgi?id=710383
+PKG_CHECK_MODULES(UPOWER, upower-glib <= 0.9.22, have_old_upower=yes, have_old_upower=no)
+AS_IF([test x$have_old_upower = xyes], [
+  AC_DEFINE([HAVE_OLD_UPOWER], [1], [Define if we have an older upower])
+])
+AM_CONDITIONAL(HAVE_OLD_UPOWER, test x$have_old_upower = xyes)
+
 PKG_CHECK_MODULES(SESSION_PROPERTIES,
         glib-2.0 >= $GLIB_REQUIRED
         gtk+-3.0 >= $GTK3_REQUIRED
@@ -363,6 +370,7 @@ echo "
         XRender support:          ${have_xrender}
         XSync support:            ${have_xsync}
         XTest support:            ${have_xtest}
+       Legacy UPower backend:    ${have_old_upower}
         Build Docbook:            ${enable_docbook_docs}
         Build manpages:           ${enable_man}
 
diff --git a/gnome-session/Makefile.am b/gnome-session/Makefile.am
index 977a398..c7ae617 100644
--- a/gnome-session/Makefile.am
+++ b/gnome-session/Makefile.am
@@ -10,6 +10,7 @@ noinst_PROGRAMS =             \
 AM_CPPFLAGS =                                  \
        $(GTK3_CFLAGS)                          \
        $(GNOME_SESSION_CFLAGS)                 \
+       $(UPOWER_CFLAGS)                        \
        $(DISABLE_DEPRECATED_CFLAGS)
 
 AM_CFLAGS = $(WARN_CFLAGS)
@@ -29,8 +30,6 @@ gnome_session_SOURCES =                               \
        gsm-fail-whale.c                        \
        gsm-system.h                            \
        gsm-system.c                            \
-       gsm-consolekit.c                        \
-       gsm-consolekit.h                        \
        gsm-systemd.h                           \
        gsm-systemd.c                           \
        gsm-presence.h                          \
@@ -60,6 +59,10 @@ gnome_session_SOURCES =                              \
        gsm-xsmp-server.c                       \
        gsm-xsmp-server.h
 
+if HAVE_OLD_UPOWER
+gnome_session_SOURCES += gsm-consolekit.c gsm-consolekit.h
+endif
+
 gnome_session_CPPFLAGS =                       \
        $(AM_CPPFLAGS)                          \
        $(X11_CFLAGS)                           \
@@ -85,6 +88,7 @@ gnome_session_LDADD =                         \
        $(XTEST_LIBS)                           \
        $(XEXT_LIBS)                            \
        $(GNOME_SESSION_LIBS)                   \
+       $(UPOWER_LIBS)                          \
        $(GCONF_LIBS)                           \
        $(SYSTEMD_LIBS)                         \
        $(GIOUNIX_LIBS)                         \
diff --git a/gnome-session/gsm-system.c b/gnome-session/gsm-system.c
index 0be1bf7..c0ad962 100644
--- a/gnome-session/gsm-system.c
+++ b/gnome-session/gsm-system.c
@@ -24,7 +24,9 @@
 #include <glib/gi18n.h>
 
 #include "gsm-system.h"
+#ifdef HAVE_OLD_UPOWER
 #include "gsm-consolekit.h"
+#endif
 #include "gsm-systemd.h"
 
 enum {
@@ -202,12 +204,14 @@ gsm_get_system (void)
                         g_debug ("Using systemd for session tracking");
                 }
         }
+#ifdef HAVE_OLD_UPOWER
         if (system == NULL) {
                 system = GSM_SYSTEM (gsm_consolekit_new ());
                 if (system != NULL) {
                         g_debug ("Using ConsoleKit for session tracking");
                 }
         }
+#endif
 
         return g_object_ref (system);
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]