aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJavier Jardón <javier.jardon@codethink.co.uk>2011-07-18 15:40:17 +0200
committerJavier Jardón <javier.jardon@codethink.co.uk>2011-07-18 15:40:17 +0200
commit99c94ace2b89cbef26d72dac5edfd3f309ba2269 (patch)
tree42236254109b551ee5db241730389ad5450d24e9
parent8b03674c7f622f790e65cea59343c31865451c43 (diff)
downloadayatana-indicator-power-99c94ace2b89cbef26d72dac5edfd3f309ba2269.tar.gz
ayatana-indicator-power-99c94ace2b89cbef26d72dac5edfd3f309ba2269.tar.bz2
ayatana-indicator-power-99c94ace2b89cbef26d72dac5edfd3f309ba2269.zip
Use the new D-Bus interface if gnome-settings-daemon is new enough
Prepare the indicator-power about the changes upstream, where the code from gnome-power-manager is being moved to gnome-settings-daemon
-rw-r--r--configure.ac4
-rw-r--r--src/indicator-power.c18
2 files changed, 19 insertions, 3 deletions
diff --git a/configure.ac b/configure.ac
index 99780b6..54a9a4d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -32,12 +32,16 @@ LT_INIT
GTK_REQUIRED_VERSION=3.0
INDICATOR_REQUIRED_VERSION=0.3.90
UPOWER_REQUIRED_VERSION=0.9.5
+GSD_REQUIRED_VERSION=3.1.4
PKG_CHECK_MODULES([UPOWER],[upower-glib >= UPOWER_REQUIRED_VERSION])
PKG_CHECK_MODULES([INDICATOR],[
gtk+-3.0 >= $GTK_REQUIRED_VERSION
indicator3-0.4 >= $INDICATOR_REQUIRED_VERSION
])
+PKG_CHECK_MODULES([GSD],[gnome-settings-daemon>= $GSD_REQUIRED_VERSION],
+ [have_gsd=yes],[have_gsd=no])
+AM_CONDITIONAL([HAVE_GSD],[test x$have_gsd = xyes])
###########################
# Check to see if we're local
diff --git a/src/indicator-power.c b/src/indicator-power.c
index 8180d38..4c70b7d 100644
--- a/src/indicator-power.c
+++ b/src/indicator-power.c
@@ -38,6 +38,18 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#define DEFAULT_ICON "gpm-battery-missing"
+#if HAVE_GSD
+#define DBUS_SERVICE "org.gnome.SettingsDaemon"
+#define DBUS_PATH "/org/gnome/SettingsDaemon"
+#define POWER_DBUS_PATH DBUS_PATH "/Power"
+#define POWER_DBUS_INTERFACE "org.gnome.SettingsDaemon.Power"
+#else
+#define DBUS_SERVICE "org.gnome.PowerManager"
+#define DBUS_PATH "/org/gnome/PowerManager"
+#define POWER_DBUS_PATH DBUS_PATH
+#define POWER_DBUS_INTERFACE "org.gnome.PowerManager"
+#endif
+
#define INDICATOR_POWER_TYPE (indicator_power_get_type ())
#define INDICATOR_POWER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), INDICATOR_POWER_TYPE, IndicatorPower))
#define INDICATOR_POWER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), INDICATOR_POWER_TYPE, IndicatorPowerClass))
@@ -705,9 +717,9 @@ indicator_power_init (IndicatorPower *self)
g_dbus_proxy_new_for_bus (G_BUS_TYPE_SESSION,
G_DBUS_PROXY_FLAGS_NONE,
NULL,
- "org.gnome.PowerManager",
- "/org/gnome/PowerManager",
- "org.gnome.PowerManager",
+ DBUS_SERVICE,
+ POWER_DBUS_PATH,
+ POWER_DBUS_INTERFACE,
priv->proxy_cancel,
service_proxy_cb,
self);