telepathy-mission-control: Remove support for UPower

Simon McVittie smcv at kemper.freedesktop.org
Tue Oct 29 12:49:14 CET 2013


Module: telepathy-mission-control
Branch: master
Commit: ec348cd0fc7c456de226034a5b1ec8dc5fccdc9c
URL:    http://cgit.freedesktop.org/telepathy/telepathy-mission-control/commit/?id=ec348cd0fc7c456de226034a5b1ec8dc5fccdc9c

Author: Simon McVittie <simon.mcvittie at collabora.co.uk>
Date:   Tue Oct 15 11:37:07 2013 +0100

Remove support for UPower

As of git master, it no longer has the API we use. On Linux, the
recommended way to be notified about suspend this week appears to
be logind, for which support was added in 5.15.1. Elsewhere, this
is a regression, but if UPower is deleting this functionality
we don't have much choice.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=70458
Reviewed-by: Colin Walters <walters at verbum.org>
Reviewed-by: Guillaume Desmottes <guillaume.desmottes at collabora.co.uk>

---

 configure.ac               |   29 --------------------
 src/Makefile.am            |    2 -
 src/connectivity-monitor.c |   63 +-------------------------------------------
 3 files changed, 1 insertions(+), 93 deletions(-)

diff --git a/configure.ac b/configure.ac
index 99bcf13..5e9ab49 100644
--- a/configure.ac
+++ b/configure.ac
@@ -281,34 +281,6 @@ if test x"$enable_conn_setting" = xyes; then
 fi
 AM_CONDITIONAL([ENABLE_CONN_SETTING], [test x"$enable_conn_setting" = xyes])
 
-# -----------------------------------------------------------
-# Suspend/resume tracking goop
-# -----------------------------------------------------------
-
-AC_ARG_ENABLE([upower],
-    [AS_HELP_STRING([--enable-upower],
-        [monitor device suspending and resuming using upower-glib @<:@default=auto@:>@])],
-    [],
-    [enable_upower=auto])
-
-if test "x$enable_upower" != xno; then
-    PKG_CHECK_MODULES([UPOWER_GLIB], [upower-glib],
-        [AC_DEFINE([HAVE_UPOWER], [1], [Define to use upower-glib])
-         have_upower=yes
-        ],
-        [if test "x$enable_upower" == xyes; then
-            AC_MSG_ERROR([$UPOWER_GLIB_PKG_ERRORS])
-         else
-            have_upower=no
-         fi
-        ])
-else
-    have_upower=no
-fi
-
-AC_SUBST([UPOWER_GLIB_CFLAGS])
-AC_SUBST([UPOWER_GLIB_LIBS])
-
 dnl ***************************************************************************
 dnl Check for marshal and enum generators
 dnl ***************************************************************************
@@ -364,7 +336,6 @@ Configure summary:
         Network Manager integration..:  ${have_nm}
         ConnMan integration..........:  ${have_connman}
         Connectivity GSetting........:  ${enable_conn_setting}
-        Suspend tracking with UPower.:  ${have_upower}
         Aegis........................:  ${aegis_enabled}
         libaccounts-glib backend.....:  ${libaccounts_sso_enabled}
         Nokia Mode Control Entity....:  ${HAVE_MCE}
diff --git a/src/Makefile.am b/src/Makefile.am
index b8835a6..4f5ed6d 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -4,7 +4,6 @@ AM_CPPFLAGS = \
 	   $(GLIB_CFLAGS) \
 	   $(NETWORK_MANAGER_CFLAGS) \
 	   $(CONNMAN_CFLAGS) \
-	   $(UPOWER_GLIB_CFLAGS) \
 	   -DG_LOG_DOMAIN=\"mcd\" \
 	   -DMCD_PLUGIN_LOADER_DIR=\"@libdir@/mission-control-plugins. at MCP_ABI_VERSION@\" \
 	   -DMC_DISABLE_DEPRECATED -I$(top_srcdir)
@@ -75,7 +74,6 @@ libmcd_convenience_la_LIBADD = \
 	$(GLIB_LIBS) \
 	$(NETWORK_MANAGER_LIBS) \
 	$(CONNMAN_LIBS) \
-	$(UPOWER_GLIB_LIBS) \
 	$(NULL)
 
 if ENABLE_LIBACCOUNTS_SSO
diff --git a/src/connectivity-monitor.c b/src/connectivity-monitor.c
index b1b03a1..fded50b 100644
--- a/src/connectivity-monitor.c
+++ b/src/connectivity-monitor.c
@@ -35,10 +35,6 @@
 #include <nm-client.h>
 #endif
 
-#ifdef HAVE_UPOWER
-#include <upower.h>
-#endif
-
 #include <telepathy-glib/telepathy-glib.h>
 
 #include "mcd-debug.h"
@@ -96,10 +92,6 @@ struct _McdConnectivityMonitorPrivate {
   gulong state_change_signal_id;
 #endif
 
-#ifdef HAVE_UPOWER
-  UpClient *upower_client;
-#endif
-
 #ifdef ENABLE_CONN_SETTING
     /* Application settings we steal from under Empathy's nose. */
     GSettings *settings;
@@ -264,43 +256,6 @@ connectivity_monitor_network_changed (GNetworkMonitor *monitor,
     }
 }
 
-#ifdef HAVE_UPOWER
-static void
-connectivity_monitor_set_awake (
-    McdConnectivityMonitor *self,
-    gboolean awake)
-{
-  if (awake)
-    connectivity_monitor_add_states (self, CONNECTIVITY_AWAKE, NULL);
-  else
-    connectivity_monitor_remove_states (self, CONNECTIVITY_AWAKE, NULL);
-}
-
-static void
-notify_sleep_cb (
-    UpClient *upower_client,
-    UpSleepKind sleep_kind,
-    gpointer user_data)
-{
-  McdConnectivityMonitor *self = MCD_CONNECTIVITY_MONITOR (user_data);
-
-  DEBUG ("about to sleep! sleep_kind=%s", up_sleep_kind_to_string (sleep_kind));
-  connectivity_monitor_set_awake (self, FALSE);
-}
-
-static void
-notify_resume_cb (
-    UpClient *upower_client,
-    UpSleepKind sleep_kind,
-    gpointer user_data)
-{
-  McdConnectivityMonitor *self = MCD_CONNECTIVITY_MONITOR (user_data);
-
-  DEBUG ("woke up! sleep_kind=%s", up_sleep_kind_to_string (sleep_kind));
-  connectivity_monitor_set_awake (self, TRUE);
-}
-#endif
-
 #ifdef HAVE_GIO_UNIX
 static void
 login1_inhibit_cb (GObject *source G_GNUC_UNUSED,
@@ -543,16 +498,6 @@ mcd_connectivity_monitor_init (McdConnectivityMonitor *connectivity_monitor)
     }
 #endif
 
-#ifdef HAVE_UPOWER
-  priv->upower_client = up_client_new ();
-  tp_g_signal_connect_object (priv->upower_client,
-      "notify-sleep", G_CALLBACK (notify_sleep_cb), connectivity_monitor,
-      G_CONNECT_AFTER);
-  tp_g_signal_connect_object (priv->upower_client,
-      "notify-resume", G_CALLBACK (notify_resume_cb), connectivity_monitor,
-      G_CONNECT_AFTER);
-#endif
-
   g_bus_get (G_BUS_TYPE_SYSTEM, NULL, got_system_bus_cb,
       g_object_ref (connectivity_monitor));
 }
@@ -560,12 +505,10 @@ mcd_connectivity_monitor_init (McdConnectivityMonitor *connectivity_monitor)
 static void
 connectivity_monitor_finalize (GObject *object)
 {
-#if defined(HAVE_NM) || defined(HAVE_UPOWER)
+#if defined(HAVE_NM)
   McdConnectivityMonitor *connectivity_monitor = MCD_CONNECTIVITY_MONITOR (object);
   McdConnectivityMonitorPrivate *priv = connectivity_monitor->priv;
-#endif
 
-#ifdef HAVE_NM
   if (priv->nm_client != NULL)
     {
       g_signal_handler_disconnect (priv->nm_client,
@@ -576,10 +519,6 @@ connectivity_monitor_finalize (GObject *object)
     }
 #endif
 
-#ifdef HAVE_UPOWER
-  tp_clear_object (&priv->upower_client);
-#endif
-
   G_OBJECT_CLASS (mcd_connectivity_monitor_parent_class)->finalize (object);
 }
 



More information about the telepathy-commits mailing list