From 12d05a382d75a19d82992319a32d4e2d20863ded Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Tue, 15 Oct 2013 11:37:07 +0100 Subject: [PATCH] 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 --- configure.ac | 29 --------------------- src/Makefile.am | 2 -- src/connectivity-monitor.c | 63 +--------------------------------------------- 3 files changed, 1 insertion(+), 93 deletions(-) diff --git a/configure.ac b/configure.ac index c5b945c..0d9a4f3 100644 --- a/configure.ac +++ b/configure.ac @@ -294,34 +294,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 *************************************************************************** @@ -377,7 +349,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} Hidden accounts-glib accounts: ${with_accounts_glib_hidden_service_type} diff --git a/src/Makefile.am b/src/Makefile.am index d49295d..de5f221 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.@MCP_ABI_VERSION@\" \ -DMC_DISABLE_DEPRECATED -I$(top_srcdir) @@ -88,7 +87,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 #endif -#ifdef HAVE_UPOWER -#include -#endif - #include #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); } -- 1.8.4.rc3